summaryrefslogtreecommitdiff
authorLarson Jiang <larson.jiang@amlogic.com>2015-10-13 02:20:45 (GMT)
committer Larson Jiang <larson.jiang@amlogic.com>2015-10-13 02:48:58 (GMT)
commit49b30e22a9a554e9e5dc88a81e0e1e977368f13e (patch)
tree3acf02633f0f802f2ac4960e05376c4b24ebdd1e
parent39fc9d97bcfe02c61723552bca3c00af9d43c199 (diff)
download8188eu-49b30e22a9a554e9e5dc88a81e0e1e977368f13e.zip
8188eu-49b30e22a9a554e9e5dc88a81e0e1e977368f13e.tar.gz
8188eu-49b30e22a9a554e9e5dc88a81e0e1e977368f13e.tar.bz2
PD#113870: wifi: update 8188eu driver for 3.14 support
Change-Id: I6077cdf82d33792ffa5981d4cb1c8468cbf08b10
Diffstat
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/Makefile67
-rwxr-xr-xrtl8xxx_EU/core/rtw_ap.c6944
-rwxr-xr-xrtl8xxx_EU/core/rtw_beamforming.c2020
-rwxr-xr-xrtl8xxx_EU/core/rtw_br_ext.c1
-rwxr-xr-xrtl8xxx_EU/core/rtw_bt_mp.c3558
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/core/rtw_cmd.c5
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/core/rtw_debug.c215
-rwxr-xr-xrtl8xxx_EU/core/rtw_ieee80211.c105
-rwxr-xr-xrtl8xxx_EU/core/rtw_ioctl_set.c5
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/core/rtw_mlme.c77
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/core/rtw_mlme_ext.c246
-rwxr-xr-xrtl8xxx_EU/core/rtw_mp_ioctl.c4
-rwxr-xr-xrtl8xxx_EU/core/rtw_odm.c157
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/core/rtw_p2p.c10
-rwxr-xr-xrtl8xxx_EU/core/rtw_pwrctrl.c3
-rwxr-xr-xrtl8xxx_EU/core/rtw_recv.c405
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/core/rtw_sreset.c730
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/core/rtw_sta_mgt.c33
-rwxr-xr-xrtl8xxx_EU/core/rtw_tdls.c5938
-rwxr-xr-xrtl8xxx_EU/core/rtw_wapi.c2652
-rwxr-xr-xrtl8xxx_EU/core/rtw_wapi_sms4.c1846
-rwxr-xr-xrtl8xxx_EU/core/rtw_wlan_util.c7
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/core/rtw_xmit.c6
-rwxr-xr-xrtl8xxx_EU/hal/HalPwrSeqCmd.c366
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c4106
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h288
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c4116
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h330
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c6562
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h418
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c8796
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h402
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c3196
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.h342
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c7560
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h358
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c7338
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h422
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c8310
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h372
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c5946
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h402
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c9652
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h426
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c6446
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h420
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c8444
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h360
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h1362
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/PhyDM_Adaptivity.c873
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/PhyDM_Adaptivity.h157
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm.c427
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm.h4779
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_AntDiv.c4538
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_AntDiv.h272
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_HWConfig.c4717
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_HWConfig.h468
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_RegDefine11AC.h138
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_RegDefine11N.h361
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_debug.c1258
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_debug.h1790
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_interface.c1500
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_interface.h788
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_precomp.h614
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/odm_reg.h244
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188ERateAdaptive.h216
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188EReg.h108
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.c3304
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.h148
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.c10020
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.h166
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.c1216
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.h94
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.c2808
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.h166
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.c6598
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.h282
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.c918
-rwxr-xr-xrtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.h128
-rwxr-xr-xrtl8xxx_EU/hal/led/hal_usb_led.c10452
-rwxr-xr-xrtl8xxx_EU/hal/rtl8188e/Hal8188EPwrSeq.c194
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/hal/rtl8188e/rtl8188e_cmd.c2958
-rwxr-xr-xrtl8xxx_EU/hal/rtl8188e/rtl8188e_dm.c1258
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/hal/rtl8188e/rtl8188e_hal_init.c760
-rwxr-xr-xrtl8xxx_EU/hal/rtl8188e/rtl8188e_mp.c2314
-rwxr-xr-xrtl8xxx_EU/hal/rtl8188e/rtl8188e_phycfg.c4545
-rwxr-xr-xrtl8xxx_EU/hal/rtl8188e/rtl8188e_rf6052.c696
-rwxr-xr-xrtl8xxx_EU/hal/rtl8188e/rtl8188e_rxdesc.c43
-rwxr-xr-xrtl8xxx_EU/hal/rtl8188e/rtl8188e_sreset.c250
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/hal/rtl8188e/usb/usb_halinit.c729
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/hal/rtl8188e/usb/usb_ops_linux.c30
-rwxr-xr-xrtl8xxx_EU/include/Hal8188EPhyCfg.h558
-rwxr-xr-xrtl8xxx_EU/include/Hal8188EPhyReg.h2220
-rwxr-xr-xrtl8xxx_EU/include/Hal8188EPwrSeq.h352
-rwxr-xr-xrtl8xxx_EU/include/Hal8192EPhyCfg.h330
-rwxr-xr-xrtl8xxx_EU/include/Hal8192EPhyReg.h2264
-rwxr-xr-xrtl8xxx_EU/include/Hal8192EPwrSeq.h310
-rwxr-xr-xrtl8xxx_EU/include/Hal8723APhyCfg.h78
-rwxr-xr-xrtl8xxx_EU/include/Hal8723APhyReg.h148
-rwxr-xr-xrtl8xxx_EU/include/Hal8723BPhyCfg.h298
-rwxr-xr-xrtl8xxx_EU/include/Hal8723BPhyReg.h166
-rwxr-xr-xrtl8xxx_EU/include/Hal8723BPwrSeq.h466
-rwxr-xr-xrtl8xxx_EU/include/Hal8723PwrSeq.h340
-rwxr-xr-xrtl8xxx_EU/include/Hal8812PhyCfg.h330
-rwxr-xr-xrtl8xxx_EU/include/Hal8812PhyReg.h1460
-rwxr-xr-xrtl8xxx_EU/include/Hal8812PwrSeq.h420
-rwxr-xr-xrtl8xxx_EU/include/Hal8821APwrSeq.h372
-rwxr-xr-xrtl8xxx_EU/include/HalPwrSeqCmd.h276
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/include/autoconf.h26
-rwxr-xr-xrtl8xxx_EU/include/drv_conf.h20
-rwxr-xr-xrtl8xxx_EU/include/drv_types.h7
-rwxr-xr-xrtl8xxx_EU/include/drv_types_gspi.h112
-rwxr-xr-xrtl8xxx_EU/include/drv_types_pci.h560
-rwxr-xr-xrtl8xxx_EU/include/drv_types_sdio.h162
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/include/hal_com_reg.h0
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/include/hal_intf.h0
-rwxr-xr-xrtl8xxx_EU/include/hal_pg.h1312
-rwxr-xr-xrtl8xxx_EU/include/ieee80211_ext.h918
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/include/ioctl_cfg80211.h355
-rwxr-xr-xrtl8xxx_EU/include/osdep_service.h2
-rwxr-xr-xrtl8xxx_EU/include/osdep_service_bsd.h1498
-rwxr-xr-xrtl8xxx_EU/include/osdep_service_ce.h348
-rwxr-xr-xrtl8xxx_EU/include/osdep_service_linux.h818
-rwxr-xr-xrtl8xxx_EU/include/osdep_service_xp.h404
-rwxr-xr-xrtl8xxx_EU/include/recv_osdep.h2
-rwxr-xr-xrtl8xxx_EU/include/rtl8188e_hal.h605
-rwxr-xr-xrtl8xxx_EU/include/rtl8188e_led.h82
-rwxr-xr-xrtl8xxx_EU/include/rtl8188e_recv.h278
-rwxr-xr-xrtl8xxx_EU/include/rtl8188e_spec.h308
-rwxr-xr-xrtl8xxx_EU/include/rtl8188e_xmit.h608
-rwxr-xr-xrtl8xxx_EU/include/rtl8192c_event.h20
-rwxr-xr-xrtl8xxx_EU/include/rtl8192e_hal.h590
-rwxr-xr-xrtl8xxx_EU/include/rtl8192e_led.h82
-rwxr-xr-xrtl8xxx_EU/include/rtl8192e_recv.h294
-rwxr-xr-xrtl8xxx_EU/include/rtl8192e_spec.h506
-rwxr-xr-xrtl8xxx_EU/include/rtl8192e_xmit.h826
-rwxr-xr-xrtl8xxx_EU/include/rtl8723a_hal.h934
-rwxr-xr-xrtl8xxx_EU/include/rtl8723a_led.h90
-rwxr-xr-xrtl8xxx_EU/include/rtl8723a_recv.h82
-rwxr-xr-xrtl8xxx_EU/include/rtl8723a_spec.h206
-rwxr-xr-xrtl8xxx_EU/include/rtl8723a_xmit.h474
-rwxr-xr-xrtl8xxx_EU/include/rtl8723b_hal.h676
-rwxr-xr-xrtl8xxx_EU/include/rtl8723b_led.h98
-rwxr-xr-xrtl8xxx_EU/include/rtl8723b_recv.h346
-rwxr-xr-xrtl8xxx_EU/include/rtl8723b_spec.h586
-rwxr-xr-xrtl8xxx_EU/include/rtl8723b_xmit.h1004
-rwxr-xr-xrtl8xxx_EU/include/rtl8812a_hal.h694
-rwxr-xr-xrtl8xxx_EU/include/rtl8812a_led.h82
-rwxr-xr-xrtl8xxx_EU/include/rtl8812a_recv.h316
-rwxr-xr-xrtl8xxx_EU/include/rtl8812a_spec.h504
-rwxr-xr-xrtl8xxx_EU/include/rtl8812a_xmit.h752
-rwxr-xr-xrtl8xxx_EU/include/rtl8821a_spec.h194
-rwxr-xr-xrtl8xxx_EU/include/rtl8821a_xmit.h360
-rwxr-xr-xrtl8xxx_EU/include/rtw_android.h4
-rwxr-xr-xrtl8xxx_EU/include/rtw_ap.h152
-rwxr-xr-xrtl8xxx_EU/include/rtw_beamforming.h284
-rwxr-xr-xrtl8xxx_EU/include/rtw_bt_mp.h638
-rwxr-xr-xrtl8xxx_EU/include/rtw_debug.h8
-rwxr-xr-xrtl8xxx_EU/include/rtw_iol.h274
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/include/rtw_mlme.h110
-rwxr-xr-xrtl8xxx_EU/include/rtw_mlme_ext.h4
-rwxr-xr-xrtl8xxx_EU/include/rtw_odm.h6
-rwxr-xr-xrtl8xxx_EU/include/rtw_recv.h15
-rwxr-xr-xrtl8xxx_EU/include/rtw_tdls.h282
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/include/rtw_version.h2
-rwxr-xr-xrtl8xxx_EU/include/rtw_wapi.h444
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/include/rtw_wifi_regd.h0
-rwxr-xr-xrtl8xxx_EU/include/sdio_ops_ce.h74
-rwxr-xr-xrtl8xxx_EU/include/wlan_bssdef.h3
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/include/xmit_osdep.h0
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/os_dep/linux/ioctl_cfg80211.c12406
-rwxr-xr-xrtl8xxx_EU/os_dep/linux/ioctl_linux.c72
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/os_dep/linux/mlme_linux.c0
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/os_dep/linux/os_intfs.c22
-rwxr-xr-xrtl8xxx_EU/os_dep/linux/recv_linux.c49
-rwxr-xr-xrtl8xxx_EU/os_dep/linux/rtw_android.c95
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/os_dep/linux/rtw_proc.c27
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/os_dep/linux/usb_intf.c0
-rwxr-xr-xrtl8xxx_EU/os_dep/linux/usb_ops_linux.c1566
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/os_dep/linux/wifi_regd.c0
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/os_dep/linux/xmit_linux.c0
-rwxr-xr-xrtl8xxx_EU/platform/platform_ARM_SUNnI_sdio.c222
-rwxr-xr-xrtl8xxx_EU/platform/platform_ARM_SUNxI_sdio.c190
-rwxr-xr-xrtl8xxx_EU/platform/platform_ARM_SUNxI_usb.c284
-rwxr-xr-xrtl8xxx_EU/platform/platform_RTK_DMP_usb.c72
-rwxr-xr-x[-rw-r--r--]rtl8xxx_EU/platform/platform_aml.c0
-rwxr-xr-xrtl8xxx_EU/platform/platform_ops.c74
-rwxr-xr-xrtl8xxx_EU/platform/platform_ops.h62
-rwxr-xr-xrtl8xxx_EU/platform/platform_sprd_sdio.c178
189 files changed, 116723 insertions, 114524 deletions
diff --git a/rtl8xxx_EU/Makefile b/rtl8xxx_EU/Makefile
index 2caa422..6f81d49 100644..100755
--- a/rtl8xxx_EU/Makefile
+++ b/rtl8xxx_EU/Makefile
@@ -53,7 +53,9 @@ 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
######################## Wake On Lan ##########################
CONFIG_WOWLAN = n
CONFIG_GPIO_WAKEUP = n
@@ -63,7 +65,7 @@ CONFIG_AP_WOWLAN = n
######### Notify SDIO Host Keep Power During Syspend ##########
CONFIG_RTW_SDIO_PM_KEEP_POWER = y
###################### Platform Related #######################
-CONFIG_PLATFORM_I386_PC = n
+CONFIG_PLATFORM_I386_PC = y
CONFIG_PLATFORM_ANDROID_X86 = n
CONFIG_PLATFORM_JB_X86 = n
CONFIG_PLATFORM_ARM_S3C2K4 = n
@@ -100,6 +102,7 @@ CONFIG_PLATFORM_ARM_SUN6I = n
CONFIG_PLATFORM_ARM_SUN7I = n
CONFIG_PLATFORM_ARM_SUN8I = n
CONFIG_PLATFORM_ACTIONS_ATM702X = n
+CONFIG_PLATFORM_ACTIONS_ATM705X = n
CONFIG_PLATFORM_ACTIONS_ATV5201 = n
CONFIG_PLATFORM_ARM_RTD299X = n
CONFIG_PLATFORM_ARM_SPREADTRUM_6820 = n
@@ -166,7 +169,8 @@ _OUTSRC_FILES := hal/OUTSRC/odm_debug.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/PhyDM_Adaptivity.o
EXTRA_CFLAGS += -I$(src)/platform
_PLATFORM_FILES := platform/platform_ops.o
@@ -712,8 +716,20 @@ 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_WOWLAN), y)
@@ -770,6 +786,27 @@ KSRC := $(KERNEL_BUILD_PATH)
MODULE_NAME :=wlan
endif
+ifeq ($(CONFIG_PLATFORM_ACTIONS_ATM705X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+# default setting for Android 4.1, 4.2, 4.3, 4.4
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ACTIONS_ATM705X
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
+
+# Enable this for Android 5.0
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+_PLATFORM_FILES += platform/platform_arm_act_sdio.o
+endif
+
+ARCH := arm
+CROSS_COMPILE := /opt/arm-2011.09/bin/arm-none-linux-gnueabi-
+KSRC := /home/android_sdk/Action-semi/705a_android_L/android/kernel
+endif
+
ifeq ($(CONFIG_PLATFORM_TI_AM3517), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_SHUTTLE
CROSS_COMPILE := arm-eabi-
@@ -1250,14 +1287,18 @@ endif
endif
ifeq ($(CONFIG_PLATFORM_AML), y)
-EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-ARCH := arm
-CROSS_COMPILE := arm-none-linux-gnueabi-
-KSRC :=
-EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
-_PLATFORM_FILES += platform/platform_aml.o
-endif
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -fno-pic
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_P2P_IPS -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_LPS_SLOW_TRANSITION
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+#ARCH := arm
+ARCH := arm64
+#CROSS_COMPILE := arm-linux-gnueabihf-
+CROSS_COMPILE := aarch64-linux-gnu-
+KSRC := /mnt/nfsroot/rongjun.chen/android64/common
+endif
ifneq ($(USER_MODULE_NAME),)
MODULE_NAME := $(USER_MODULE_NAME)
endif
@@ -1316,7 +1357,7 @@ ifeq ($(CONFIG_RTL8821A), y)
$(MODULE_NAME)-$(CONFIG_MP_INCLUDED)+= core/rtw_bt_mp.o
endif
-obj-$(CONFIG_RTL8188EU) := $(MODULE_NAME).o
+obj-m := $(MODULE_NAME).o
else
diff --git a/rtl8xxx_EU/core/rtw_ap.c b/rtl8xxx_EU/core/rtw_ap.c
index 9e6e8ae..551458d 100755
--- a/rtl8xxx_EU/core/rtw_ap.c
+++ b/rtl8xxx_EU/core/rtw_ap.c
@@ -1,3473 +1,3471 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#define _RTW_AP_C_
-
-#include <drv_types.h>
-
-
-#ifdef CONFIG_AP_MODE
-
-extern unsigned char RTW_WPA_OUI[];
-extern unsigned char WMM_OUI[];
-extern unsigned char WPS_OUI[];
-extern unsigned char P2P_OUI[];
-extern unsigned char WFD_OUI[];
-
-void init_mlme_ap_info(_adapter *padapter)
-{
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
-
-
- _rtw_spinlock_init(&pmlmepriv->bcn_update_lock);
-
- //for ACL
- _rtw_init_queue(&pacl_list->acl_node_q);
-
- //pmlmeext->bstart_bss = _FALSE;
-
- start_ap_mode(padapter);
-}
-
-void free_mlme_ap_info(_adapter *padapter)
-{
- _irqL irqL;
- struct sta_info *psta=NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- //stop_ap_mode(padapter);
-
- pmlmepriv->update_bcn = _FALSE;
- pmlmeext->bstart_bss = _FALSE;
-
- rtw_sta_flush(padapter);
-
- pmlmeinfo->state = _HW_STATE_NOLINK_;
-
- //free_assoc_sta_resources
- rtw_free_all_stainfo(padapter);
-
- //free bc/mc sta_info
- psta = rtw_get_bcmc_stainfo(padapter);
- _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- rtw_free_stainfo(padapter, psta);
- _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
-
-
- _rtw_spinlock_free(&pmlmepriv->bcn_update_lock);
-
-}
-
-static void update_BCNTIM(_adapter *padapter)
-{
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network);
- unsigned char *pie = pnetwork_mlmeext->IEs;
-
- //DBG_871X("%s\n", __FUNCTION__);
-
- //update TIM IE
- //if(pstapriv->tim_bitmap)
- if(_TRUE)
- {
- u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
- u16 tim_bitmap_le;
- uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
-
- tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);
-
- p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
- if (p != NULL && tim_ielen>0)
- {
- tim_ielen += 2;
-
- premainder_ie = p+tim_ielen;
-
- tim_ie_offset = (sint)(p -pie);
-
- remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen;
-
- //append TIM IE from dst_ie offset
- dst_ie = p;
- }
- else
- {
- tim_ielen = 0;
-
- //calucate head_len
- offset = _FIXED_IE_LENGTH_;
-
- /* get ssid_ie len */
- p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SSID_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
- if (p != NULL)
- offset += tmp_len+2;
-
- // get supported rates len
- p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
- if (p != NULL)
- {
- offset += tmp_len+2;
- }
-
- //DS Parameter Set IE, len=3
- offset += 3;
-
- premainder_ie = pie + offset;
-
- remainder_ielen = pnetwork_mlmeext->IELength - offset - tim_ielen;
-
- //append TIM IE from offset
- dst_ie = pie + offset;
-
- }
-
-
- if(remainder_ielen>0)
- {
- pbackup_remainder_ie = rtw_malloc(remainder_ielen);
- if(pbackup_remainder_ie && premainder_ie)
- _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
- }
-
- *dst_ie++=_TIM_IE_;
-
- if((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fe))
- tim_ielen = 5;
- else
- tim_ielen = 4;
-
- *dst_ie++= tim_ielen;
-
- *dst_ie++=0;//DTIM count
- *dst_ie++=1;//DTIM peroid
-
- if(pstapriv->tim_bitmap&BIT(0))//for bc/mc frames
- *dst_ie++ = BIT(0);//bitmap ctrl
- else
- *dst_ie++ = 0;
-
- if(tim_ielen==4)
- {
- u8 pvb=0;
-
- if(pstapriv->tim_bitmap&0x00fe)
- pvb = (u8)tim_bitmap_le;
- else if(pstapriv->tim_bitmap&0xff00)
- pvb = (u8)(tim_bitmap_le>>8);
- else
- pvb = (u8)tim_bitmap_le;
-
- *dst_ie++ = pvb;
-
- }
- else if(tim_ielen==5)
- {
- _rtw_memcpy(dst_ie, &tim_bitmap_le, 2);
- dst_ie+=2;
- }
-
- //copy remainder IE
- if(pbackup_remainder_ie)
- {
- _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
-
- rtw_mfree(pbackup_remainder_ie, remainder_ielen);
- }
-
- offset = (uint)(dst_ie - pie);
- pnetwork_mlmeext->IELength = offset + remainder_ielen;
-
- }
-}
-
-void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len)
-{
- PNDIS_802_11_VARIABLE_IEs pIE;
- u8 bmatch = _FALSE;
- u8 *pie = pnetwork->IEs;
- u8 *p=NULL, *dst_ie=NULL, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
- u32 i, offset, ielen, ie_offset, remainder_ielen = 0;
-
- for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;)
- {
- pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
-
- if (pIE->ElementID > index)
- {
- break;
- }
- else if(pIE->ElementID == index) // already exist the same IE
- {
- p = (u8 *)pIE;
- ielen = pIE->Length;
- bmatch = _TRUE;
- break;
- }
-
- p = (u8 *)pIE;
- ielen = pIE->Length;
- i += (pIE->Length + 2);
- }
-
- if (p != NULL && ielen>0)
- {
- ielen += 2;
-
- premainder_ie = p+ielen;
-
- ie_offset = (sint)(p -pie);
-
- remainder_ielen = pnetwork->IELength - ie_offset - ielen;
-
- if(bmatch)
- dst_ie = p;
- else
- dst_ie = (p+ielen);
- }
-
- if(dst_ie == NULL)
- return;
-
- if(remainder_ielen>0)
- {
- pbackup_remainder_ie = rtw_malloc(remainder_ielen);
- if(pbackup_remainder_ie && premainder_ie)
- _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
- }
-
- *dst_ie++=index;
- *dst_ie++=len;
-
- _rtw_memcpy(dst_ie, data, len);
- dst_ie+=len;
-
- //copy remainder IE
- if(pbackup_remainder_ie)
- {
- _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
-
- rtw_mfree(pbackup_remainder_ie, remainder_ielen);
- }
-
- offset = (uint)(dst_ie - pie);
- pnetwork->IELength = offset + remainder_ielen;
-}
-
-void rtw_remove_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index)
-{
- u8 *p, *dst_ie=NULL, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
- uint offset, ielen, ie_offset, remainder_ielen = 0;
- u8 *pie = pnetwork->IEs;
-
- p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, index, &ielen, pnetwork->IELength - _FIXED_IE_LENGTH_);
- if (p != NULL && ielen>0)
- {
- ielen += 2;
-
- premainder_ie = p+ielen;
-
- ie_offset = (sint)(p -pie);
-
- remainder_ielen = pnetwork->IELength - ie_offset - ielen;
-
- dst_ie = p;
- }
- else {
- return;
- }
-
- if(remainder_ielen>0)
- {
- pbackup_remainder_ie = rtw_malloc(remainder_ielen);
- if(pbackup_remainder_ie && premainder_ie)
- _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
- }
-
- //copy remainder IE
- if(pbackup_remainder_ie)
- {
- _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
-
- rtw_mfree(pbackup_remainder_ie, remainder_ielen);
- }
-
- offset = (uint)(dst_ie - pie);
- pnetwork->IELength = offset + remainder_ielen;
-}
-
-
-u8 chk_sta_is_alive(struct sta_info *psta);
-u8 chk_sta_is_alive(struct sta_info *psta)
-{
- u8 ret = _FALSE;
- #ifdef DBG_EXPIRATION_CHK
- DBG_871X("sta:"MAC_FMT", rssi:%d, rx:"STA_PKTS_FMT", expire_to:%u, %s%ssq_len:%u\n"
- , MAC_ARG(psta->hwaddr)
- , psta->rssi_stat.UndecoratedSmoothedPWDB
- //, STA_RX_PKTS_ARG(psta)
- , STA_RX_PKTS_DIFF_ARG(psta)
- , psta->expire_to
- , psta->state&WIFI_SLEEP_STATE?"PS, ":""
- , psta->state&WIFI_STA_ALIVE_CHK_STATE?"SAC, ":""
- , psta->sleepq_len
- );
- #endif
-
- //if(sta_last_rx_pkts(psta) == sta_rx_pkts(psta))
- if((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) == (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts))
- {
- #if 0
- if(psta->state&WIFI_SLEEP_STATE)
- ret = _TRUE;
- #endif
- }
- else
- {
- ret = _TRUE;
- }
-
- sta_update_last_rx_pkts(psta);
-
- return ret;
-}
-
-void expire_timeout_chk(_adapter *padapter)
-{
- _irqL irqL;
- _list *phead, *plist;
- u8 updated = _FALSE;
- struct sta_info *psta=NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- u8 chk_alive_num = 0;
- char chk_alive_list[NUM_STA];
- int i;
-
-
- _enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
-
- phead = &pstapriv->auth_list;
- plist = get_next(phead);
-
- //check auth_queue
- #ifdef DBG_EXPIRATION_CHK
- if (rtw_end_of_queue_search(phead, plist) == _FALSE) {
- DBG_871X(FUNC_NDEV_FMT" auth_list, cnt:%u\n"
- , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->auth_list_cnt);
- }
- #endif
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- psta = LIST_CONTAINOR(plist, struct sta_info, auth_list);
-
- plist = get_next(plist);
-
-
-#ifdef CONFIG_ATMEL_RC_PATCH
- if (_TRUE == _rtw_memcmp((void *)(pstapriv->atmel_rc_pattern), (void *)(psta->hwaddr), ETH_ALEN))
- continue;
- if (psta->flag_atmel_rc)
- continue;
-#endif
- if(psta->expire_to>0)
- {
- psta->expire_to--;
- if (psta->expire_to == 0)
- {
- rtw_list_delete(&psta->auth_list);
- pstapriv->auth_list_cnt--;
-
- DBG_871X("auth expire %02X%02X%02X%02X%02X%02X\n",
- psta->hwaddr[0],psta->hwaddr[1],psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5]);
-
- _exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
-
- _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- rtw_free_stainfo(padapter, psta);
- _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
-
- _enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
- }
- }
-
- }
-
- _exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
- psta = NULL;
-
-
- _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- phead = &pstapriv->asoc_list;
- plist = get_next(phead);
-
- //check asoc_queue
- #ifdef DBG_EXPIRATION_CHK
- if (rtw_end_of_queue_search(phead, plist) == _FALSE) {
- DBG_871X(FUNC_NDEV_FMT" asoc_list, cnt:%u\n"
- , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->asoc_list_cnt);
- }
- #endif
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
- plist = get_next(plist);
-#ifdef CONFIG_ATMEL_RC_PATCH
- DBG_871X("%s:%d psta=%p, %02x,%02x||%02x,%02x \n\n", __func__, __LINE__,
- psta,pstapriv->atmel_rc_pattern[0], pstapriv->atmel_rc_pattern[5], psta->hwaddr[0], psta->hwaddr[5]);
- if (_TRUE == _rtw_memcmp((void *)pstapriv->atmel_rc_pattern, (void *)(psta->hwaddr), ETH_ALEN))
- continue;
- if (psta->flag_atmel_rc)
- continue;
- DBG_871X("%s: debug line:%d \n", __func__, __LINE__);
-#endif
-#ifdef CONFIG_AUTO_AP_MODE
- if(psta->isrc)
- continue;
-#endif
- if (chk_sta_is_alive(psta) || !psta->expire_to) {
- psta->expire_to = pstapriv->expire_to;
- psta->keep_alive_trycnt = 0;
- #ifdef CONFIG_TX_MCAST2UNI
- psta->under_exist_checking = 0;
- #endif // CONFIG_TX_MCAST2UNI
- } else {
- psta->expire_to--;
- }
-
-#ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
-#ifdef CONFIG_80211N_HT
-#ifdef CONFIG_TX_MCAST2UNI
- if ( (psta->flags & WLAN_STA_HT) && (psta->htpriv.agg_enable_bitmap || psta->under_exist_checking) ) {
- // check sta by delba(addba) for 11n STA
- // ToDo: use CCX report to check for all STAs
- //DBG_871X("asoc check by DELBA/ADDBA! (pstapriv->expire_to=%d s)(psta->expire_to=%d s), [%02x, %d]\n", pstapriv->expire_to*2, psta->expire_to*2, psta->htpriv.agg_enable_bitmap, psta->under_exist_checking);
-
- if ( psta->expire_to <= (pstapriv->expire_to - 50 ) ) {
- DBG_871X("asoc expire by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2);
- psta->under_exist_checking = 0;
- psta->expire_to = 0;
- } else if ( psta->expire_to <= (pstapriv->expire_to - 3) && (psta->under_exist_checking==0)) {
- DBG_871X("asoc check by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2);
- psta->under_exist_checking = 1;
- //tear down TX AMPDU
- send_delba(padapter, 1, psta->hwaddr);// // originator
- psta->htpriv.agg_enable_bitmap = 0x0;//reset
- psta->htpriv.candidate_tid_bitmap = 0x0;//reset
- }
- }
-#endif //CONFIG_TX_MCAST2UNI
-#endif //CONFIG_80211N_HT
-#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK
-
- if (psta->expire_to <= 0)
- {
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-
- if (padapter->registrypriv.wifi_spec == 1)
- {
- psta->expire_to = pstapriv->expire_to;
- continue;
- }
-
-#ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
-#ifdef CONFIG_80211N_HT
-
-#define KEEP_ALIVE_TRYCNT (3)
-
- if(psta->keep_alive_trycnt > 0 && psta->keep_alive_trycnt <= KEEP_ALIVE_TRYCNT)
- {
- if(psta->state & WIFI_STA_ALIVE_CHK_STATE)
- psta->state ^= WIFI_STA_ALIVE_CHK_STATE;
- else
- psta->keep_alive_trycnt = 0;
-
- }
- else if((psta->keep_alive_trycnt > KEEP_ALIVE_TRYCNT) && !(psta->state & WIFI_STA_ALIVE_CHK_STATE))
- {
- psta->keep_alive_trycnt = 0;
- }
- if((psta->htpriv.ht_option==_TRUE) && (psta->htpriv.ampdu_enable==_TRUE))
- {
- uint priority = 1; //test using BK
- u8 issued=0;
-
- //issued = (psta->htpriv.agg_enable_bitmap>>priority)&0x1;
- issued |= (psta->htpriv.candidate_tid_bitmap>>priority)&0x1;
-
- if(0==issued)
- {
- if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE))
- {
- psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority);
-
- if (psta->state & WIFI_SLEEP_STATE)
- psta->expire_to = 2; // 2x2=4 sec
- else
- psta->expire_to = 1; // 2 sec
-
- psta->state |= WIFI_STA_ALIVE_CHK_STATE;
-
- //add_ba_hdl(padapter, (u8*)paddbareq_parm);
-
- DBG_871X("issue addba_req to check if sta alive, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);
-
- issue_action_BA(padapter, psta->hwaddr, RTW_WLAN_ACTION_ADDBA_REQ, (u16)priority);
-
- _set_timer(&psta->addba_retry_timer, ADDBA_TO);
-
- psta->keep_alive_trycnt++;
-
- continue;
- }
- }
- }
- if(psta->keep_alive_trycnt > 0 && psta->state & WIFI_STA_ALIVE_CHK_STATE)
- {
- psta->keep_alive_trycnt = 0;
- psta->state ^= WIFI_STA_ALIVE_CHK_STATE;
- DBG_871X("change to another methods to check alive if staion is at ps mode\n");
- }
-
-#endif //CONFIG_80211N_HT
-#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK
- if (psta->state & WIFI_SLEEP_STATE) {
- if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE)) {
- //to check if alive by another methods if staion is at ps mode.
- psta->expire_to = pstapriv->expire_to;
- psta->state |= WIFI_STA_ALIVE_CHK_STATE;
-
- //DBG_871X("alive chk, sta:" MAC_FMT " is at ps mode!\n", MAC_ARG(psta->hwaddr));
-
- //to update bcn with tim_bitmap for this station
- pstapriv->tim_bitmap |= BIT(psta->aid);
- update_beacon(padapter, _TIM_IE_, NULL, _TRUE);
-
- if(!pmlmeext->active_keep_alive_check)
- continue;
- }
- }
- #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
- if (pmlmeext->active_keep_alive_check) {
- int stainfo_offset;
-
- stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
- if (stainfo_offset_valid(stainfo_offset)) {
- chk_alive_list[chk_alive_num++] = stainfo_offset;
- }
-
- continue;
- }
- #endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
- rtw_list_delete(&psta->asoc_list);
- pstapriv->asoc_list_cnt--;
- DBG_871X("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state);
- updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING);
- }
- else
- {
- /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */
- if (psta->sleepq_len > (NR_XMITFRAME/pstapriv->asoc_list_cnt)
- && padapter->xmitpriv.free_xmitframe_cnt < ((NR_XMITFRAME/pstapriv->asoc_list_cnt)/2)
- ){
- DBG_871X("%s sta:"MAC_FMT", sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__
- , MAC_ARG(psta->hwaddr)
- , psta->sleepq_len, padapter->xmitpriv.free_xmitframe_cnt, pstapriv->asoc_list_cnt);
- wakeup_sta_to_xmit(padapter, psta);
- }
- }
- }
-
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
-#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
-if (chk_alive_num) {
-
- u8 backup_oper_channel=0;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- /* switch to correct channel of current network before issue keep-alive frames */
- if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
- backup_oper_channel = rtw_get_oper_ch(padapter);
- SelectChannel(padapter, pmlmeext->cur_channel);
- }
-
- /* issue null data to check sta alive*/
- for (i = 0; i < chk_alive_num; i++) {
- int ret = _FAIL;
-
- psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
-#ifdef CONFIG_ATMEL_RC_PATCH
- if (_TRUE == _rtw_memcmp( pstapriv->atmel_rc_pattern, psta->hwaddr, ETH_ALEN))
- continue;
- if (psta->flag_atmel_rc)
- continue;
-#endif
- if(!(psta->state &_FW_LINKED))
- continue;
-
- if (psta->state & WIFI_SLEEP_STATE)
- ret = issue_nulldata(padapter, psta->hwaddr, 0, 1, 50);
- else
- ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50);
-
- psta->keep_alive_trycnt++;
- if (ret == _SUCCESS)
- {
- DBG_871X("asoc check, sta(" MAC_FMT ") is alive\n", MAC_ARG(psta->hwaddr));
- psta->expire_to = pstapriv->expire_to;
- psta->keep_alive_trycnt = 0;
- continue;
- }
- else if (psta->keep_alive_trycnt <= 3)
- {
- DBG_871X("ack check for asoc expire, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);
- psta->expire_to = 1;
- continue;
- }
-
- psta->keep_alive_trycnt = 0;
- DBG_871X("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state);
- _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
- if (rtw_is_list_empty(&psta->asoc_list)==_FALSE) {
- rtw_list_delete(&psta->asoc_list);
- pstapriv->asoc_list_cnt--;
- updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING);
- }
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- }
-
- if (backup_oper_channel>0) /* back to the original operation channel */
- SelectChannel(padapter, backup_oper_channel);
-}
-#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
-
- associated_clients_update(padapter, updated);
-}
-
-void add_RATid(_adapter *padapter, struct sta_info *psta, u8 rssi_level)
-{
- int i;
- u8 rf_type;
- unsigned char sta_band = 0, shortGIrate = _FALSE;
- unsigned int tx_ra_bitmap=0;
- struct ht_priv *psta_ht = NULL;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
-
-#ifdef CONFIG_80211N_HT
- if(psta)
- psta_ht = &psta->htpriv;
- else
- return;
-#endif //CONFIG_80211N_HT
-
- if(!(psta->state & _FW_LINKED))
- return;
-
-#if 0//gtest
- if(get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R)
- {
- //is this a 2r STA?
- if((pstat->tx_ra_bitmap & 0x0ff00000) != 0 && !(priv->pshare->has_2r_sta & BIT(pstat->aid)))
- {
- priv->pshare->has_2r_sta |= BIT(pstat->aid);
- if(rtw_read16(padapter, 0x102501f6) != 0xffff)
- {
- rtw_write16(padapter, 0x102501f6, 0xffff);
- reset_1r_sta_RA(priv, 0xffff);
- Switch_1SS_Antenna(priv, 3);
- }
- }
- else// bg or 1R STA?
- {
- if((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len && priv->pshare->has_2r_sta == 0)
- {
- if(rtw_read16(padapter, 0x102501f6) != 0x7777)
- { // MCS7 SGI
- rtw_write16(padapter, 0x102501f6,0x7777);
- reset_1r_sta_RA(priv, 0x7777);
- Switch_1SS_Antenna(priv, 2);
- }
- }
- }
-
- }
-
- if ((pstat->rssi_level < 1) || (pstat->rssi_level > 3))
- {
- if (pstat->rssi >= priv->pshare->rf_ft_var.raGoDownUpper)
- pstat->rssi_level = 1;
- else if ((pstat->rssi >= priv->pshare->rf_ft_var.raGoDown20MLower) ||
- ((priv->pshare->is_40m_bw) && (pstat->ht_cap_len) &&
- (pstat->rssi >= priv->pshare->rf_ft_var.raGoDown40MLower) &&
- (pstat->ht_cap_buf.ht_cap_info & cpu_to_le16(_HTCAP_SUPPORT_CH_WDTH_))))
- pstat->rssi_level = 2;
- else
- pstat->rssi_level = 3;
- }
-
- // rate adaptive by rssi
- if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len)
- {
- if ((get_rf_mimo_mode(priv) == MIMO_1T2R) || (get_rf_mimo_mode(priv) == MIMO_1T1R))
- {
- switch (pstat->rssi_level) {
- case 1:
- pstat->tx_ra_bitmap &= 0x100f0000;
- break;
- case 2:
- pstat->tx_ra_bitmap &= 0x100ff000;
- break;
- case 3:
- if (priv->pshare->is_40m_bw)
- pstat->tx_ra_bitmap &= 0x100ff005;
- else
- pstat->tx_ra_bitmap &= 0x100ff001;
-
- break;
- }
- }
- else
- {
- switch (pstat->rssi_level) {
- case 1:
- pstat->tx_ra_bitmap &= 0x1f0f0000;
- break;
- case 2:
- pstat->tx_ra_bitmap &= 0x1f0ff000;
- break;
- case 3:
- if (priv->pshare->is_40m_bw)
- pstat->tx_ra_bitmap &= 0x000ff005;
- else
- pstat->tx_ra_bitmap &= 0x000ff001;
-
- break;
- }
-
- // Don't need to mask high rates due to new rate adaptive parameters
- //if (pstat->is_broadcom_sta) // use MCS12 as the highest rate vs. Broadcom sta
- // pstat->tx_ra_bitmap &= 0x81ffffff;
-
- // NIC driver will report not supporting MCS15 and MCS14 in asoc req
- //if (pstat->is_rtl8190_sta && !pstat->is_2t_mimo_sta)
- // pstat->tx_ra_bitmap &= 0x83ffffff; // if Realtek 1x2 sta, don't use MCS15 and MCS14
- }
- }
- else if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11G) && isErpSta(pstat))
- {
- switch (pstat->rssi_level) {
- case 1:
- pstat->tx_ra_bitmap &= 0x00000f00;
- break;
- case 2:
- pstat->tx_ra_bitmap &= 0x00000ff0;
- break;
- case 3:
- pstat->tx_ra_bitmap &= 0x00000ff5;
- break;
- }
- }
- else
- {
- pstat->tx_ra_bitmap &= 0x0000000d;
- }
-
- // disable tx short GI when station cannot rx MCS15(AP is 2T2R)
- // disable tx short GI when station cannot rx MCS7 (AP is 1T2R or 1T1R)
- // if there is only 1r STA and we are 2T2R, DO NOT mask SGI rate
- if ((!(pstat->tx_ra_bitmap & 0x8000000) && (priv->pshare->has_2r_sta > 0) && (get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R)) ||
- (!(pstat->tx_ra_bitmap & 0x80000) && (get_rf_mimo_mode(padapter) != RTL8712_RF_2T2R)))
- {
- pstat->tx_ra_bitmap &= ~BIT(28);
- }
-#endif
-
- rtw_hal_update_sta_rate_mask(padapter, psta);
- tx_ra_bitmap = psta->ra_mask;
-
- shortGIrate = query_ra_short_GI(psta);
-
- if ( pcur_network->Configuration.DSConfig > 14 ) {
-
- if (tx_ra_bitmap & 0xffff000)
- sta_band |= WIRELESS_11_5N ;
-
- if (tx_ra_bitmap & 0xff0)
- sta_band |= WIRELESS_11A;
-
- // 5G band
- #ifdef CONFIG_80211AC_VHT
- if (psta->vhtpriv.vht_option) {
- sta_band = WIRELESS_11_5AC;
- }
- #endif
-
- } else {
- if (tx_ra_bitmap & 0xffff000)
- sta_band |= WIRELESS_11_24N;
-
- if (tx_ra_bitmap & 0xff0)
- sta_band |= WIRELESS_11G;
-
- if (tx_ra_bitmap & 0x0f)
- sta_band |= WIRELESS_11B;
- }
-
- psta->wireless_mode = sta_band;
- psta->raid = rtw_hal_networktype_to_raid(padapter, psta);
-
- if (psta->aid < NUM_STA)
- {
- u8 arg[4] = {0};
-
- arg[0] = psta->mac_id;
- arg[1] = psta->raid;
- arg[2] = shortGIrate;
- arg[3] = psta->init_rate;
-
- DBG_871X("%s=> mac_id:%d , raid:%d , shortGIrate=%d, bitmap=0x%x\n",
- __FUNCTION__ , psta->mac_id, psta->raid ,shortGIrate, tx_ra_bitmap);
-
- rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, rssi_level);
- }
- else
- {
- DBG_871X("station aid %d exceed the max number\n", psta->aid);
- }
-
-}
-
-void update_bmc_sta(_adapter *padapter)
-{
- _irqL irqL;
- unsigned char network_type;
- int supportRateNum = 0;
- unsigned int tx_ra_bitmap=0;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
- struct sta_info *psta = rtw_get_bcmc_stainfo(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;
-
- psta->qos_option = 0;
-#ifdef CONFIG_80211N_HT
- psta->htpriv.ht_option = _FALSE;
-#endif //CONFIG_80211N_HT
-
- psta->ieee8021x_blocked = 0;
-
- _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
-
- //psta->dot118021XPrivacy = _NO_PRIVACY_;//!!! remove it, because it has been set before this.
-
- //prepare for add_RATid
- supportRateNum = rtw_get_rateset_len((u8*)&pcur_network->SupportedRates);
- network_type = rtw_check_network_type((u8*)&pcur_network->SupportedRates, supportRateNum, pcur_network->Configuration.DSConfig);
- if (IsSupportedTxCCK(network_type)) {
- network_type = WIRELESS_11B;
- }
- else if (network_type == WIRELESS_INVALID) { // error handling
- if ( pcur_network->Configuration.DSConfig > 14 )
- network_type = WIRELESS_11A;
- else
- network_type = WIRELESS_11B;
- }
- update_sta_basic_rate(psta, network_type);
- psta->wireless_mode = network_type;
-
- rtw_hal_update_sta_rate_mask(padapter, psta);
- tx_ra_bitmap = psta->ra_mask;
-
- psta->raid = rtw_hal_networktype_to_raid(padapter,psta);
-
- //ap mode
- rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, _TRUE);
-
- //if(pHalData->fw_ractrl == _TRUE)
- {
- u8 arg[4] = {0};
-
- arg[0] = psta->mac_id;
- arg[1] = psta->raid;
- arg[2] = 0;
- arg[3] = psta->init_rate;
-
- DBG_871X("%s=> mac_id:%d , raid:%d , bitmap=0x%x\n",
- __FUNCTION__ , psta->mac_id, psta->raid , tx_ra_bitmap);
-
- rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, 0);
- }
-
- rtw_sta_media_status_rpt(padapter, psta, 1);
-
- _enter_critical_bh(&psta->lock, &irqL);
- psta->state = _FW_LINKED;
- _exit_critical_bh(&psta->lock, &irqL);
-
- }
- else
- {
- DBG_871X("add_RATid_bmc_sta error!\n");
- }
-
-}
-
-//notes:
-//AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode
-//MAC_ID = AID+1 for sta in ap/adhoc mode
-//MAC_ID = 1 for bc/mc for sta/ap/adhoc
-//MAC_ID = 0 for bssid for sta/ap/adhoc
-//CAM_ID = //0~3 for default key, cmd_id=macid + 3, macid=aid+1;
-
-void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
-{
- _irqL irqL;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-#ifdef CONFIG_80211N_HT
- struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
- struct ht_priv *phtpriv_sta = &psta->htpriv;
-#endif //CONFIG_80211N_HT
- u8 cur_ldpc_cap=0, cur_stbc_cap=0, cur_beamform_cap=0;
- //set intf_tag to if1
- //psta->intf_tag = 0;
-
- DBG_871X("%s\n",__FUNCTION__);
-
- //psta->mac_id = psta->aid+4;
- //psta->mac_id = psta->aid+1;//alloc macid when call rtw_alloc_stainfo(),
- //release macid when call rtw_free_stainfo()
-
- //ap mode
- rtw_hal_set_odm_var(padapter,HAL_ODM_STA_INFO,psta,_TRUE);
-
- if(psecuritypriv->dot11AuthAlgrthm==dot11AuthAlgrthm_8021X)
- psta->ieee8021x_blocked = _TRUE;
- else
- psta->ieee8021x_blocked = _FALSE;
-
-
- //update sta's cap
-
- //ERP
- VCS_update(padapter, psta);
-#ifdef CONFIG_80211N_HT
- //HT related cap
- if(phtpriv_sta->ht_option)
- {
- //check if sta supports rx ampdu
- phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable;
-
- //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
- 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;
- }
-
- 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)))
- {
- 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);
- }
-
- // 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)))
- {
- 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);
- }
-
-#ifdef CONFIG_BEAMFORMING
- // Config Tx beamforming setting
- if (TEST_FLAG(phtpriv_ap->beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE) &&
- GET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP((u8 *)(&phtpriv_sta->ht_cap)))
- {
- SET_FLAG(cur_beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE);
- }
-
- if (TEST_FLAG(phtpriv_ap->beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE) &&
- GET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP((u8 *)(&phtpriv_sta->ht_cap)))
- {
- SET_FLAG(cur_beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE);
- }
-
- if (cur_beamform_cap) {
- DBG_871X("Client STA(%d) HT Beamforming Cap = 0x%02X\n", psta->aid, cur_beamform_cap);
- }
-#endif //CONFIG_BEAMFORMING
- }
- else
- {
- phtpriv_sta->ampdu_enable = _FALSE;
-
- phtpriv_sta->sgi_20m = _FALSE;
- phtpriv_sta->sgi_40m = _FALSE;
- psta->bw_mode = CHANNEL_WIDTH_20;
- phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
- }
-
- phtpriv_sta->ldpc_cap = cur_ldpc_cap;
- phtpriv_sta->stbc_cap = cur_stbc_cap;
- phtpriv_sta->beamform_cap = cur_beamform_cap;
-
- //Rx AMPDU
- send_delba(padapter, 0, psta->hwaddr);// recipient
-
- //TX AMPDU
- send_delba(padapter, 1, psta->hwaddr);// // originator
- phtpriv_sta->agg_enable_bitmap = 0x0;//reset
- phtpriv_sta->candidate_tid_bitmap = 0x0;//reset
-#endif //CONFIG_80211N_HT
-
-#ifdef CONFIG_80211AC_VHT
- update_sta_vht_info_apmode(padapter, psta);
-#endif
-
- update_ldpc_stbc_cap(psta);
-
- //todo: init other variables
-
- _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
-
-
- //add ratid
- //add_RATid(padapter, psta);//move to ap_sta_info_defer_update()
-
-
- _enter_critical_bh(&psta->lock, &irqL);
- psta->state |= _FW_LINKED;
- _exit_critical_bh(&psta->lock, &irqL);
-
-
-}
-
-static void update_ap_info(_adapter *padapter, struct sta_info *psta)
-{
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
- struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-#ifdef CONFIG_80211N_HT
- struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
-#endif //CONFIG_80211N_HT
-
-
- psta->wireless_mode = pmlmeext->cur_wireless_mode;
-
- psta->bssratelen = rtw_get_rateset_len(pnetwork->SupportedRates);
- _rtw_memcpy(psta->bssrateset, pnetwork->SupportedRates, psta->bssratelen);
-
-#ifdef CONFIG_80211N_HT
- //HT related cap
- if(phtpriv_ap->ht_option)
- {
- //check if sta supports rx ampdu
- //phtpriv_ap->ampdu_enable = phtpriv_ap->ampdu_enable;
-
- //check if sta support s Short GI 20M
- if((phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20))
- {
- phtpriv_ap->sgi_20m = _TRUE;
- }
- //check if sta support s Short GI 40M
- if((phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_40))
- {
- phtpriv_ap->sgi_40m = _TRUE;
- }
-
- psta->qos_option = _TRUE;
- }
- else
- {
- phtpriv_ap->ampdu_enable = _FALSE;
-
- phtpriv_ap->sgi_20m = _FALSE;
- phtpriv_ap->sgi_40m = _FALSE;
- }
-
- psta->bw_mode = pmlmeext->cur_bwmode;
- phtpriv_ap->ch_offset = pmlmeext->cur_ch_offset;
-
- phtpriv_ap->agg_enable_bitmap = 0x0;//reset
- phtpriv_ap->candidate_tid_bitmap = 0x0;//reset
-
- _rtw_memcpy(&psta->htpriv, &pmlmepriv->htpriv, sizeof(struct ht_priv));
-
-#ifdef CONFIG_80211AC_VHT
- _rtw_memcpy(&psta->vhtpriv, &pmlmepriv->vhtpriv, sizeof(struct vht_priv));
-#endif //CONFIG_80211AC_VHT
-
-#endif //CONFIG_80211N_HT
-}
-
-static void update_hw_ht_param(_adapter *padapter)
-{
- unsigned char max_AMPDU_len;
- unsigned char min_MPDU_spacing;
- struct registry_priv *pregpriv = &padapter->registrypriv;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- DBG_871X("%s\n", __FUNCTION__);
-
-
- //handle A-MPDU parameter field
- /*
- AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
- AMPDU_para [4:2]:Min MPDU Start Spacing
- */
- max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03;
-
- min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;
-
- rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing));
-
- rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len));
-
- //
- // Config SM Power Save setting
- //
- pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & 0x0C) >> 2;
- if(pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
- {
- /*u8 i;
- //update the MCS rates
- for (i = 0; i < 16; i++)
- {
- pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
- }*/
- DBG_871X("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__FUNCTION__);
- }
-
- //
- // Config current HT Protection mode.
- //
- //pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3;
-
-}
-
-void start_bss_network(_adapter *padapter, u8 *pbuf)
-{
- u8 *p;
- u8 val8, cur_channel, cur_bwmode, cur_ch_offset;
- u16 bcn_interval;
- u32 acparm;
- int ie_len;
- struct registry_priv *pregpriv = &padapter->registrypriv;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct security_priv* psecuritypriv=&(padapter->securitypriv);
- WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network);
- struct HT_info_element *pht_info=NULL;
-#ifdef CONFIG_P2P
- struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
-#endif //CONFIG_P2P
- u8 cbw40_enable=0;
- u8 change_band = _FALSE;
-
- //DBG_871X("%s\n", __FUNCTION__);
-
- bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod;
- cur_channel = pnetwork->Configuration.DSConfig;
- cur_bwmode = CHANNEL_WIDTH_20;
- cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-
-
- //check if there is wps ie,
- //if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd,
- //and at first time the security ie ( RSN/WPA IE) will not include in beacon.
- if(NULL == rtw_get_wps_ie(pnetwork->IEs+_FIXED_IE_LENGTH_, pnetwork->IELength-_FIXED_IE_LENGTH_, NULL, NULL))
- {
- pmlmeext->bstart_bss = _TRUE;
- }
-
- //todo: update wmm, ht cap
- //pmlmeinfo->WMM_enable;
- //pmlmeinfo->HT_enable;
- if(pmlmepriv->qospriv.qos_option)
- pmlmeinfo->WMM_enable = _TRUE;
-#ifdef CONFIG_80211N_HT
- if(pmlmepriv->htpriv.ht_option)
- {
- pmlmeinfo->WMM_enable = _TRUE;
- pmlmeinfo->HT_enable = _TRUE;
- //pmlmeinfo->HT_info_enable = _TRUE;
- //pmlmeinfo->HT_caps_enable = _TRUE;
-
- update_hw_ht_param(padapter);
- }
-#endif //#CONFIG_80211N_HT
-
-#ifdef CONFIG_80211AC_VHT
- if(pmlmepriv->vhtpriv.vht_option) {
- pmlmeinfo->VHT_enable = _TRUE;
- update_hw_vht_param(padapter);
- }
-#endif //CONFIG_80211AC_VHT
-
- if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time
- {
- //WEP Key will be set before this function, do not clear CAM.
- if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_))
- flush_all_cam_entry(padapter); //clear CAM
- }
-
- //set MSR to AP_Mode
- Set_MSR(padapter, _HW_STATE_AP_);
-
- //Set BSSID REG
- rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pnetwork->MacAddress);
-
- //Set EDCA param reg
-#ifdef CONFIG_CONCURRENT_MODE
- acparm = 0x005ea42b;
-#else
- acparm = 0x002F3217; // VO
-#endif
- rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm));
- acparm = 0x005E4317; // VI
- rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm));
- //acparm = 0x00105320; // BE
- acparm = 0x005ea42b;
- rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
- acparm = 0x0000A444; // BK
- rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm));
-
- //Set Security
- val8 = (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf;
- rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
-
- //Beacon Control related register
- rtw_hal_set_hwreg(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&bcn_interval));
-
- rtw_hal_set_hwreg(padapter, HW_VAR_DO_IQK, NULL);
-
- if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time
- {
- //u32 initialgain;
-
- //initialgain = 0x1e;
-
-
- //disable dynamic functions, such as high power, DIG
- //Save_DM_Func_Flag(padapter);
- //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-
- //turn on all dynamic functions
- Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE);
-
- //rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
-
- }
-#ifdef CONFIG_80211N_HT
- //set channel, bwmode
- p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
- if( p && ie_len)
- {
- pht_info = (struct HT_info_element *)(p+2);
-
- if (cur_channel > 14) {
- if ((pregpriv->bw_mode & 0xf0) > 0)
- cbw40_enable = 1;
- } else {
- if ((pregpriv->bw_mode & 0x0f) > 0)
- cbw40_enable = 1;
- }
-
- if ((cbw40_enable) && (pht_info->infos[0] & BIT(2)))
- {
- //switch to the 40M Hz mode
- //pmlmeext->cur_bwmode = CHANNEL_WIDTH_40;
- cur_bwmode = CHANNEL_WIDTH_40;
- switch (pht_info->infos[0] & 0x3)
- {
- case 1:
- //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
- cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
- break;
-
- case 3:
- //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
- cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
- break;
-
- default:
- //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
- cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
- break;
- }
-
- }
-
- }
-#endif //CONFIG_80211N_HT
-
-#ifdef CONFIG_80211AC_VHT
- p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), EID_VHTOperation, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
- if( p && ie_len)
- {
- if(GET_VHT_OPERATION_ELE_CHL_WIDTH(p+2) >= 1) {
- cur_bwmode = CHANNEL_WIDTH_80;
- }
- }
-#endif
-
-#ifdef CONFIG_DUALMAC_CONCURRENT
- dc_set_ap_channel_bandwidth(padapter, cur_channel, cur_ch_offset, cur_bwmode);
-#else //!CONFIG_DUALMAC_CONCURRENT
-#ifdef CONFIG_CONCURRENT_MODE
- //TODO: need to judge the phy parameters on concurrent mode for single phy
- concurrent_set_ap_chbw(padapter, cur_channel, cur_ch_offset, cur_bwmode);
-#else //!CONFIG_CONCURRENT_MODE
- set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
- DBG_871X("CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset);
- pmlmeext->cur_channel = cur_channel;
- pmlmeext->cur_bwmode = cur_bwmode;
- pmlmeext->cur_ch_offset = cur_ch_offset;
-#endif //!CONFIG_CONCURRENT_MODE
-#endif //!CONFIG_DUALMAC_CONCURRENT
-
- pmlmeext->cur_wireless_mode = pmlmepriv->cur_network.network_type;
-
- //let pnetwork_mlmeext == pnetwork_mlme.
- _rtw_memcpy(pnetwork_mlmeext, pnetwork, pnetwork->Length);
-
- //update cur_wireless_mode
- update_wireless_mode(padapter);
-
- //update RRSR after set channel and bandwidth
- UpdateBrateTbl(padapter, pnetwork->SupportedRates);
- rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates);
-
- //udpate capability after cur_wireless_mode updated
- update_capinfo(padapter, rtw_get_capability((WLAN_BSSID_EX *)pnetwork));
-
-
-#ifdef CONFIG_P2P
- _rtw_memcpy(pwdinfo->p2p_group_ssid, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength);
- pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength;
-#endif //CONFIG_P2P
-
- if(_TRUE == pmlmeext->bstart_bss)
- {
- update_beacon(padapter, _TIM_IE_, NULL, _TRUE);
-
-#ifndef CONFIG_INTERRUPT_BASED_TXBCN //other case will tx beacon when bcn interrupt coming in.
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
- //issue beacon frame
- if(send_beacon(padapter)==_FAIL)
- {
- DBG_871X("issue_beacon, fail!\n");
- }
-#endif
-#endif //!CONFIG_INTERRUPT_BASED_TXBCN
-
- }
-
-
- //update bc/mc sta_info
- update_bmc_sta(padapter);
-
- //pmlmeext->bstart_bss = _TRUE;
-
-}
-
-int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
-{
- int ret=_SUCCESS;
- u8 *p;
- u8 *pHT_caps_ie=NULL;
- u8 *pHT_info_ie=NULL;
- struct sta_info *psta = NULL;
- u16 cap, ht_cap=_FALSE;
- uint ie_len = 0;
- int group_cipher, pairwise_cipher;
- u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX];
- int supportRateNum = 0;
- u8 OUI1[] = {0x00, 0x50, 0xf2,0x01};
- u8 wps_oui[4]={0x0,0x50,0xf2,0x04};
- u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01};
- struct registry_priv *pregistrypriv = &padapter->registrypriv;
- struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- WLAN_BSSID_EX *pbss_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
- struct sta_priv *pstapriv = &padapter->stapriv;
- u8 *ie = pbss_network->IEs;
- u8 vht_cap=_FALSE;
-
- /* SSID */
- /* Supported rates */
- /* DS Params */
- /* WLAN_EID_COUNTRY */
- /* ERP Information element */
- /* Extended supported rates */
- /* WPA/WPA2 */
- /* Wi-Fi Wireless Multimedia Extensions */
- /* ht_capab, ht_oper */
- /* WPS IE */
-
- DBG_871X("%s, len=%d\n", __FUNCTION__, len);
-
- if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
- return _FAIL;
-
-
- if(len>MAX_IE_SZ)
- return _FAIL;
-
- pbss_network->IELength = len;
-
- _rtw_memset(ie, 0, MAX_IE_SZ);
-
- _rtw_memcpy(ie, pbuf, pbss_network->IELength);
-
-
- if(pbss_network->InfrastructureMode!=Ndis802_11APMode)
- return _FAIL;
-
- pbss_network->Rssi = 0;
-
- _rtw_memcpy(pbss_network->MacAddress, myid(&(padapter->eeprompriv)), ETH_ALEN);
-
- //beacon interval
- p = rtw_get_beacon_interval_from_ie(ie);//ie + 8; // 8: TimeStamp, 2: Beacon Interval 2:Capability
- //pbss_network->Configuration.BeaconPeriod = le16_to_cpu(*(unsigned short*)p);
- pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p);
-
- //capability
- //cap = *(unsigned short *)rtw_get_capability_from_ie(ie);
- //cap = le16_to_cpu(cap);
- cap = RTW_GET_LE16(ie);
-
- //SSID
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength -_BEACON_IE_OFFSET_));
- if(p && ie_len>0)
- {
- _rtw_memset(&pbss_network->Ssid, 0, sizeof(NDIS_802_11_SSID));
- _rtw_memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len);
- pbss_network->Ssid.SsidLength = ie_len;
- }
-
- //chnnel
- channel = 0;
- pbss_network->Configuration.Length = 0;
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _DSSET_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
- if(p && ie_len>0)
- channel = *(p + 2);
-
- pbss_network->Configuration.DSConfig = channel;
-
-
- _rtw_memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
- // get supported rates
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
- if (p != NULL)
- {
- _rtw_memcpy(supportRate, p+2, ie_len);
- supportRateNum = ie_len;
- }
-
- //get ext_supported rates
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_);
- if (p != NULL)
- {
- _rtw_memcpy(supportRate+supportRateNum, p+2, ie_len);
- supportRateNum += ie_len;
-
- }
-
- network_type = rtw_check_network_type(supportRate, supportRateNum, channel);
-
- rtw_set_supported_rate(pbss_network->SupportedRates, network_type);
-
-
- //parsing ERP_IE
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
- if(p && ie_len>0)
- {
- ERP_IE_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)p);
- }
-
- //update privacy/security
- if (cap & BIT(4))
- pbss_network->Privacy = 1;
- else
- pbss_network->Privacy = 0;
-
- psecuritypriv->wpa_psk = 0;
-
- //wpa2
- group_cipher = 0; pairwise_cipher = 0;
- psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
- psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
- if(p && ie_len>0)
- {
- if(rtw_parse_wpa2_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
- {
- psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
-
- psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x
- psecuritypriv->wpa_psk |= BIT(1);
-
- psecuritypriv->wpa2_group_cipher = group_cipher;
- psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher;
-#if 0
- switch(group_cipher)
- {
- case WPA_CIPHER_NONE:
- psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
- break;
- case WPA_CIPHER_WEP40:
- psecuritypriv->wpa2_group_cipher = _WEP40_;
- break;
- case WPA_CIPHER_TKIP:
- psecuritypriv->wpa2_group_cipher = _TKIP_;
- break;
- case WPA_CIPHER_CCMP:
- psecuritypriv->wpa2_group_cipher = _AES_;
- break;
- case WPA_CIPHER_WEP104:
- psecuritypriv->wpa2_group_cipher = _WEP104_;
- break;
- }
-
- switch(pairwise_cipher)
- {
- case WPA_CIPHER_NONE:
- psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
- break;
- case WPA_CIPHER_WEP40:
- psecuritypriv->wpa2_pairwise_cipher = _WEP40_;
- break;
- case WPA_CIPHER_TKIP:
- psecuritypriv->wpa2_pairwise_cipher = _TKIP_;
- break;
- case WPA_CIPHER_CCMP:
- psecuritypriv->wpa2_pairwise_cipher = _AES_;
- break;
- case WPA_CIPHER_WEP104:
- psecuritypriv->wpa2_pairwise_cipher = _WEP104_;
- break;
- }
-#endif
- }
-
- }
-
- //wpa
- ie_len = 0;
- group_cipher = 0; pairwise_cipher = 0;
- psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
- psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
- for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2))
- {
- p = rtw_get_ie(p, _SSN_IE_1_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
- if ((p) && (_rtw_memcmp(p+2, OUI1, 4)))
- {
- if(rtw_parse_wpa_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
- {
- psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
-
- psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x
-
- psecuritypriv->wpa_psk |= BIT(0);
-
- psecuritypriv->wpa_group_cipher = group_cipher;
- psecuritypriv->wpa_pairwise_cipher = pairwise_cipher;
-
-#if 0
- switch(group_cipher)
- {
- case WPA_CIPHER_NONE:
- psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
- break;
- case WPA_CIPHER_WEP40:
- psecuritypriv->wpa_group_cipher = _WEP40_;
- break;
- case WPA_CIPHER_TKIP:
- psecuritypriv->wpa_group_cipher = _TKIP_;
- break;
- case WPA_CIPHER_CCMP:
- psecuritypriv->wpa_group_cipher = _AES_;
- break;
- case WPA_CIPHER_WEP104:
- psecuritypriv->wpa_group_cipher = _WEP104_;
- break;
- }
-
- switch(pairwise_cipher)
- {
- case WPA_CIPHER_NONE:
- psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
- break;
- case WPA_CIPHER_WEP40:
- psecuritypriv->wpa_pairwise_cipher = _WEP40_;
- break;
- case WPA_CIPHER_TKIP:
- psecuritypriv->wpa_pairwise_cipher = _TKIP_;
- break;
- case WPA_CIPHER_CCMP:
- psecuritypriv->wpa_pairwise_cipher = _AES_;
- break;
- case WPA_CIPHER_WEP104:
- psecuritypriv->wpa_pairwise_cipher = _WEP104_;
- break;
- }
-#endif
- }
-
- break;
-
- }
-
- if ((p == NULL) || (ie_len == 0))
- {
- break;
- }
-
- }
-
- //wmm
- ie_len = 0;
- pmlmepriv->qospriv.qos_option = 0;
- if(pregistrypriv->wmm_enable)
- {
- for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2))
- {
- p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
- if((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6))
- {
- pmlmepriv->qospriv.qos_option = 1;
-
- *(p+8) |= BIT(7);//QoS Info, support U-APSD
-
- /* disable all ACM bits since the WMM admission control is not supported */
- *(p + 10) &= ~BIT(4); /* BE */
- *(p + 14) &= ~BIT(4); /* BK */
- *(p + 18) &= ~BIT(4); /* VI */
- *(p + 22) &= ~BIT(4); /* VO */
-
- break;
- }
-
- if ((p == NULL) || (ie_len == 0))
- {
- break;
- }
- }
- }
-#ifdef CONFIG_80211N_HT
- //parsing HT_CAP_IE
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
- if(p && ie_len>0)
- {
- u8 rf_type=0;
- u32 max_rx_ampdu_factor=0;
- struct rtw_ieee80211_ht_cap *pht_cap = (struct rtw_ieee80211_ht_cap *)(p+2);
-
- pHT_caps_ie=p;
-
- ht_cap = _TRUE;
- network_type |= WIRELESS_11_24N;
-
- rtw_ht_use_default_setting(padapter);
-
- if (pmlmepriv->htpriv.sgi_20m == _FALSE)
- pht_cap->cap_info &= ~(IEEE80211_HT_CAP_SGI_20);
-
- if (pmlmepriv->htpriv.sgi_40m == _FALSE)
- pht_cap->cap_info &= ~(IEEE80211_HT_CAP_SGI_40);
-
- if (!TEST_FLAG(pmlmepriv->htpriv.ldpc_cap, LDPC_HT_ENABLE_RX))
- {
- pht_cap->cap_info &= ~(IEEE80211_HT_CAP_LDPC_CODING);
- }
-
- if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_TX))
- {
- pht_cap->cap_info &= ~(IEEE80211_HT_CAP_TX_STBC);
- }
-
- if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_RX))
- {
- pht_cap->cap_info &= ~(IEEE80211_HT_CAP_RX_STBC_3R);
- }
-
- 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))
- {
- pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2));
- }
- else
- {
- pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00);
- }
-
- 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;
- }
-
-#ifdef CONFIG_BEAMFORMING
- // Use registry value to enable HT Beamforming.
- // ToDo: use configure file to set these capability.
- pht_cap->tx_BF_cap_info = 0;
-
- // HT Beamformer
- if(TEST_FLAG(pmlmepriv->htpriv.beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE))
- {
- // Transmit NDP Capable
- SET_HT_CAP_TXBF_TRANSMIT_NDP_CAP(pht_cap, 1);
- // Explicit Compressed Steering Capable
- SET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP(pht_cap, 1);
- // Compressed Steering Number Antennas
- SET_HT_CAP_TXBF_COMP_STEERING_NUM_ANTENNAS(pht_cap, 1);
- }
-
- // HT Beamformee
- if(TEST_FLAG(pmlmepriv->htpriv.beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE))
- {
- // Receive NDP Capable
- SET_HT_CAP_TXBF_RECEIVE_NDP_CAP(pht_cap, 1);
- // Explicit Compressed Beamforming Feedback Capable
- SET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP(pht_cap, 2);
- }
-#endif //CONFIG_BEAMFORMING
-
- _rtw_memcpy(&pmlmepriv->htpriv.ht_cap, p+2, ie_len);
-
- }
-
- //parsing HT_INFO_IE
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
- if(p && ie_len>0)
- {
- pHT_info_ie=p;
- }
-#endif //CONFIG_80211N_HT
- switch(network_type)
- {
- case WIRELESS_11B:
- pbss_network->NetworkTypeInUse = Ndis802_11DS;
- break;
- case WIRELESS_11G:
- case WIRELESS_11BG:
- case WIRELESS_11G_24N:
- case WIRELESS_11BG_24N:
- pbss_network->NetworkTypeInUse = Ndis802_11OFDM24;
- break;
- case WIRELESS_11A:
- pbss_network->NetworkTypeInUse = Ndis802_11OFDM5;
- break;
- default :
- pbss_network->NetworkTypeInUse = Ndis802_11OFDM24;
- break;
- }
-
- pmlmepriv->cur_network.network_type = network_type;
-
-#ifdef CONFIG_80211N_HT
- pmlmepriv->htpriv.ht_option = _FALSE;
-
- if( (psecuritypriv->wpa2_pairwise_cipher&WPA_CIPHER_TKIP) ||
- (psecuritypriv->wpa_pairwise_cipher&WPA_CIPHER_TKIP))
- {
- //todo:
- //ht_cap = _FALSE;
- }
-
- //ht_cap
- if(pregistrypriv->ht_enable && ht_cap==_TRUE)
- {
- pmlmepriv->htpriv.ht_option = _TRUE;
- pmlmepriv->qospriv.qos_option = 1;
-
- if(pregistrypriv->ampdu_enable==1)
- {
- pmlmepriv->htpriv.ampdu_enable = _TRUE;
- }
-
- HT_caps_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)pHT_caps_ie);
-
- HT_info_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)pHT_info_ie);
- }
-#endif
-
-#ifdef CONFIG_80211AC_VHT
-
- //Parsing VHT CAP IE
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, EID_VHTCapability, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
- if(p && ie_len>0)
- {
- vht_cap = _TRUE;
- }
- //Parsing VHT OPERATION IE
-
-
- pmlmepriv->vhtpriv.vht_option = _FALSE;
- // if channel in 5G band, then add vht ie .
- if ((pbss_network->Configuration.DSConfig > 14) &&
- (pmlmepriv->htpriv.ht_option == _TRUE) &&
- (pregistrypriv->vht_enable))
- {
- if(vht_cap == _TRUE)
- {
- pmlmepriv->vhtpriv.vht_option = _TRUE;
- }
- else if(pregistrypriv->vht_enable == 2) // auto enabled
- {
- u8 cap_len, operation_len;
-
- rtw_vht_use_default_setting(padapter);
-
- // VHT Capabilities element
- cap_len = rtw_build_vht_cap_ie(padapter, pbss_network->IEs + pbss_network->IELength);
- pbss_network->IELength += cap_len;
-
- // VHT Operation element
- operation_len = rtw_build_vht_operation_ie(padapter, pbss_network->IEs + pbss_network->IELength, pbss_network->Configuration.DSConfig);
- pbss_network->IELength += operation_len;
-
- pmlmepriv->vhtpriv.vht_option = _TRUE;
- }
- }
-#endif //CONFIG_80211AC_VHT
-
- pbss_network->Length = get_WLAN_BSSID_EX_sz((WLAN_BSSID_EX *)pbss_network);
-
- //issue beacon to start bss network
- //start_bss_network(padapter, (u8*)pbss_network);
- rtw_startbss_cmd(padapter, RTW_CMDF_WAIT_ACK);
-
-
- //alloc sta_info for ap itself
- psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress);
- if(!psta)
- {
- psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress);
- if (psta == NULL)
- {
- return _FAIL;
- }
- }
-
- // update AP's sta info
- update_ap_info(padapter, psta);
-
- psta->state |= WIFI_AP_STATE; //Aries, add,fix bug of flush_cam_entry at STOP AP mode , 0724
- rtw_indicate_connect( padapter);
-
- pmlmepriv->cur_network.join_res = _TRUE;//for check if already set beacon
-
- //update bc/mc sta_info
- //update_bmc_sta(padapter);
-
- return ret;
-
-}
-
-void rtw_set_macaddr_acl(_adapter *padapter, int mode)
-{
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
-
- DBG_871X("%s, mode=%d\n", __func__, mode);
-
- pacl_list->mode = mode;
-}
-
-int rtw_acl_add_sta(_adapter *padapter, u8 *addr)
-{
- _irqL irqL;
- _list *plist, *phead;
- u8 added = _FALSE;
- int i, ret=0;
- struct rtw_wlan_acl_node *paclnode;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
- _queue *pacl_node_q =&pacl_list->acl_node_q;
-
- DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr));
-
- if((NUM_ACL-1) < pacl_list->num)
- return (-1);
-
-
- _enter_critical_bh(&(pacl_node_q->lock), &irqL);
-
- phead = get_list_head(pacl_node_q);
- plist = get_next(phead);
-
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
- plist = get_next(plist);
-
- if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN))
- {
- if(paclnode->valid == _TRUE)
- {
- added = _TRUE;
- DBG_871X("%s, sta has been added\n", __func__);
- break;
- }
- }
- }
-
- _exit_critical_bh(&(pacl_node_q->lock), &irqL);
-
-
- if(added == _TRUE)
- return ret;
-
-
- _enter_critical_bh(&(pacl_node_q->lock), &irqL);
-
- for(i=0; i< NUM_ACL; i++)
- {
- paclnode = &pacl_list->aclnode[i];
-
- if(paclnode->valid == _FALSE)
- {
- _rtw_init_listhead(&paclnode->list);
-
- _rtw_memcpy(paclnode->addr, addr, ETH_ALEN);
-
- paclnode->valid = _TRUE;
-
- rtw_list_insert_tail(&paclnode->list, get_list_head(pacl_node_q));
-
- pacl_list->num++;
-
- break;
- }
- }
-
- DBG_871X("%s, acl_num=%d\n", __func__, pacl_list->num);
-
- _exit_critical_bh(&(pacl_node_q->lock), &irqL);
-
- return ret;
-}
-
-int rtw_acl_remove_sta(_adapter *padapter, u8 *addr)
-{
- _irqL irqL;
- _list *plist, *phead;
- int i, ret=0;
- struct rtw_wlan_acl_node *paclnode;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
- _queue *pacl_node_q =&pacl_list->acl_node_q;
- u8 baddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; //Baddr is used for clearing acl_list
-
- DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr));
-
- _enter_critical_bh(&(pacl_node_q->lock), &irqL);
-
- phead = get_list_head(pacl_node_q);
- plist = get_next(phead);
-
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
- plist = get_next(plist);
-
- if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN) || _rtw_memcmp(baddr, addr, ETH_ALEN))
- {
- if(paclnode->valid == _TRUE)
- {
- paclnode->valid = _FALSE;
-
- rtw_list_delete(&paclnode->list);
-
- pacl_list->num--;
- }
- }
- }
-
- _exit_critical_bh(&(pacl_node_q->lock), &irqL);
-
- DBG_871X("%s, acl_num=%d\n", __func__, pacl_list->num);
-
- return ret;
-
-}
-
-u8 rtw_ap_set_pairwise_key(_adapter *padapter, struct sta_info *psta)
-{
- struct cmd_obj* ph2c;
- struct set_stakey_parm *psetstakey_para;
- struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
- u8 res=_SUCCESS;
-
- ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
- if ( ph2c == NULL){
- res= _FAIL;
- goto exit;
- }
-
- psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm));
- if(psetstakey_para==NULL){
- rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
- res=_FAIL;
- goto exit;
- }
-
- init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_);
-
-
- psetstakey_para->algorithm = (u8)psta->dot118021XPrivacy;
-
- _rtw_memcpy(psetstakey_para->addr, psta->hwaddr, ETH_ALEN);
-
- _rtw_memcpy(psetstakey_para->key, &psta->dot118021x_UncstKey, 16);
-
-
- res = rtw_enqueue_cmd(pcmdpriv, ph2c);
-
-exit:
-
- return res;
-
-}
-
-static int rtw_ap_set_key(_adapter *padapter, u8 *key, u8 alg, int keyid, u8 set_tx)
-{
- u8 keylen;
- struct cmd_obj* pcmd;
- struct setkey_parm *psetkeyparm;
- struct cmd_priv *pcmdpriv=&(padapter->cmdpriv);
- int res=_SUCCESS;
-
- //DBG_871X("%s\n", __FUNCTION__);
-
- pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
- if(pcmd==NULL){
- res= _FAIL;
- goto exit;
- }
- psetkeyparm=(struct setkey_parm*)rtw_zmalloc(sizeof(struct setkey_parm));
- if(psetkeyparm==NULL){
- rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj));
- res= _FAIL;
- goto exit;
- }
-
- _rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm));
-
- psetkeyparm->keyid=(u8)keyid;
- if (is_wep_enc(alg))
- padapter->securitypriv.key_mask |= BIT(psetkeyparm->keyid);
-
- psetkeyparm->algorithm = alg;
-
- psetkeyparm->set_tx = set_tx;
-
- switch(alg)
- {
- case _WEP40_:
- keylen = 5;
- break;
- case _WEP104_:
- keylen = 13;
- break;
- case _TKIP_:
- case _TKIP_WTMIC_:
- case _AES_:
- default:
- keylen = 16;
- }
-
- _rtw_memcpy(&(psetkeyparm->key[0]), key, keylen);
-
- pcmd->cmdcode = _SetKey_CMD_;
- pcmd->parmbuf = (u8 *)psetkeyparm;
- pcmd->cmdsz = (sizeof(struct setkey_parm));
- pcmd->rsp = NULL;
- pcmd->rspsz = 0;
-
-
- _rtw_init_listhead(&pcmd->list);
-
- res = rtw_enqueue_cmd(pcmdpriv, pcmd);
-
-exit:
-
- return res;
-}
-
-int rtw_ap_set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid)
-{
- DBG_871X("%s\n", __FUNCTION__);
-
- return rtw_ap_set_key(padapter, key, alg, keyid, 1);
-}
-
-int rtw_ap_set_wep_key(_adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set_tx)
-{
- u8 alg;
-
- switch(keylen)
- {
- case 5:
- alg =_WEP40_;
- break;
- case 13:
- alg =_WEP104_;
- break;
- default:
- alg =_NO_PRIVACY_;
- }
-
- DBG_871X("%s\n", __FUNCTION__);
-
- return rtw_ap_set_key(padapter, key, alg, keyid, set_tx);
-}
-
-#ifdef CONFIG_NATIVEAP_MLME
-
-static void update_bcn_fixed_ie(_adapter *padapter)
-{
- DBG_871X("%s\n", __FUNCTION__);
-
-}
-
-static void update_bcn_erpinfo_ie(_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 = &(pmlmeinfo->network);
- unsigned char *p, *ie = pnetwork->IEs;
- u32 len = 0;
-
- DBG_871X("%s, ERP_enable=%d\n", __FUNCTION__, pmlmeinfo->ERP_enable);
-
- if(!pmlmeinfo->ERP_enable)
- return;
-
- //parsing ERP_IE
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
- if(p && len>0)
- {
- PNDIS_802_11_VARIABLE_IEs pIE = (PNDIS_802_11_VARIABLE_IEs)p;
-
- if (pmlmepriv->num_sta_non_erp == 1)
- pIE->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION;
- else
- pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION);
-
- if(pmlmepriv->num_sta_no_short_preamble > 0)
- pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE;
- else
- pIE->data[0] &= ~(RTW_ERP_INFO_BARKER_PREAMBLE_MODE);
-
- ERP_IE_handler(padapter, pIE);
- }
-
-}
-
-static void update_bcn_htcap_ie(_adapter *padapter)
-{
- DBG_871X("%s\n", __FUNCTION__);
-
-}
-
-static void update_bcn_htinfo_ie(_adapter *padapter)
-{
- DBG_871X("%s\n", __FUNCTION__);
-
-}
-
-static void update_bcn_rsn_ie(_adapter *padapter)
-{
- DBG_871X("%s\n", __FUNCTION__);
-
-}
-
-static void update_bcn_wpa_ie(_adapter *padapter)
-{
- DBG_871X("%s\n", __FUNCTION__);
-
-}
-
-static void update_bcn_wmm_ie(_adapter *padapter)
-{
- DBG_871X("%s\n", __FUNCTION__);
-
-}
-
-static void update_bcn_wps_ie(_adapter *padapter)
-{
- u8 *pwps_ie=NULL, *pwps_ie_src, *premainder_ie, *pbackup_remainder_ie=NULL;
- uint wps_ielen=0, wps_offset, remainder_ielen;
- 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 = &(pmlmeinfo->network);
- unsigned char *ie = pnetwork->IEs;
- u32 ielen = pnetwork->IELength;
-
-
- DBG_871X("%s\n", __FUNCTION__);
-
- pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen);
-
- if(pwps_ie==NULL || wps_ielen==0)
- return;
-
- pwps_ie_src = pmlmepriv->wps_beacon_ie;
- if(pwps_ie_src == NULL)
- return;
-
- wps_offset = (uint)(pwps_ie-ie);
-
- premainder_ie = pwps_ie + wps_ielen;
-
- remainder_ielen = ielen - wps_offset - wps_ielen;
-
- if(remainder_ielen>0)
- {
- pbackup_remainder_ie = rtw_malloc(remainder_ielen);
- if(pbackup_remainder_ie)
- _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
- }
-
- wps_ielen = (uint)pwps_ie_src[1];//to get ie data len
- if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ)
- {
- _rtw_memcpy(pwps_ie, pwps_ie_src, wps_ielen+2);
- pwps_ie += (wps_ielen+2);
-
- if(pbackup_remainder_ie)
- _rtw_memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
-
- //update IELength
- pnetwork->IELength = wps_offset + (wps_ielen+2) + remainder_ielen;
- }
-
- if(pbackup_remainder_ie)
- rtw_mfree(pbackup_remainder_ie, remainder_ielen);
-
- // deal with the case without set_tx_beacon_cmd() in update_beacon()
-#if defined( CONFIG_INTERRUPT_BASED_TXBCN ) || defined( CONFIG_PCI_HCI )
- if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
- {
- u8 sr = 0;
- rtw_get_wps_attr_content(pwps_ie_src, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL);
-
- if( sr ) {
- set_fwstate(pmlmepriv, WIFI_UNDER_WPS);
- DBG_871X("%s, set WIFI_UNDER_WPS\n", __func__);
- }
- }
-#endif
-}
-
-static void update_bcn_p2p_ie(_adapter *padapter)
-{
-
-}
-
-static void update_bcn_vendor_spec_ie(_adapter *padapter, u8*oui)
-{
- DBG_871X("%s\n", __FUNCTION__);
-
- if(_rtw_memcmp(RTW_WPA_OUI, oui, 4))
- {
- update_bcn_wpa_ie(padapter);
- }
- else if(_rtw_memcmp(WMM_OUI, oui, 4))
- {
- update_bcn_wmm_ie(padapter);
- }
- else if(_rtw_memcmp(WPS_OUI, oui, 4))
- {
- update_bcn_wps_ie(padapter);
- }
- else if(_rtw_memcmp(P2P_OUI, oui, 4))
- {
- update_bcn_p2p_ie(padapter);
- }
- else
- {
- DBG_871X("unknown OUI type!\n");
- }
-
-
-}
-
-void update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
-{
- _irqL irqL;
- struct mlme_priv *pmlmepriv;
- struct mlme_ext_priv *pmlmeext;
- //struct mlme_ext_info *pmlmeinfo;
-
- //DBG_871X("%s\n", __FUNCTION__);
-
- if(!padapter)
- return;
-
- pmlmepriv = &(padapter->mlmepriv);
- pmlmeext = &(padapter->mlmeextpriv);
- //pmlmeinfo = &(pmlmeext->mlmext_info);
-
- if(_FALSE == pmlmeext->bstart_bss)
- return;
-
- _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
-
- switch(ie_id)
- {
- case 0xFF:
-
- update_bcn_fixed_ie(padapter);//8: TimeStamp, 2: Beacon Interval 2:Capability
-
- break;
-
- case _TIM_IE_:
-
- update_BCNTIM(padapter);
-
- break;
-
- case _ERPINFO_IE_:
-
- update_bcn_erpinfo_ie(padapter);
-
- break;
-
- case _HT_CAPABILITY_IE_:
-
- update_bcn_htcap_ie(padapter);
-
- break;
-
- case _RSN_IE_2_:
-
- update_bcn_rsn_ie(padapter);
-
- break;
-
- case _HT_ADD_INFO_IE_:
-
- update_bcn_htinfo_ie(padapter);
-
- break;
-
- case _VENDOR_SPECIFIC_IE_:
-
- update_bcn_vendor_spec_ie(padapter, oui);
-
- break;
-
- default:
- break;
- }
-
- pmlmepriv->update_bcn = _TRUE;
-
- _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
-
-#ifndef CONFIG_INTERRUPT_BASED_TXBCN
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
- if(tx)
- {
- //send_beacon(padapter);//send_beacon must execute on TSR level
- set_tx_beacon_cmd(padapter);
- }
-#else
- {
- //PCI will issue beacon when BCN interrupt occurs.
- }
-#endif
-#endif //!CONFIG_INTERRUPT_BASED_TXBCN
-
-}
-
-#ifdef CONFIG_80211N_HT
-
-/*
-op_mode
-Set to 0 (HT pure) under the followign conditions
- - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or
- - all STAs in the BSS are 20 MHz HT in 20 MHz BSS
-Set to 1 (HT non-member protection) if there may be non-HT STAs
- in both the primary and the secondary channel
-Set to 2 if only HT STAs are associated in BSS,
- however and at least one 20 MHz HT STA is associated
-Set to 3 (HT mixed mode) when one or more non-HT STAs are associated
- (currently non-GF HT station is considered as non-HT STA also)
-*/
-static int rtw_ht_operation_update(_adapter *padapter)
-{
- u16 cur_op_mode, new_op_mode;
- int op_mode_changes = 0;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
-
- if(pmlmepriv->htpriv.ht_option == _TRUE)
- return 0;
-
- //if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed)
- // return 0;
-
- DBG_871X("%s current operation mode=0x%X\n",
- __FUNCTION__, pmlmepriv->ht_op_mode);
-
- if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT)
- && pmlmepriv->num_sta_ht_no_gf) {
- pmlmepriv->ht_op_mode |=
- HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT;
- op_mode_changes++;
- } else if ((pmlmepriv->ht_op_mode &
- HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) &&
- pmlmepriv->num_sta_ht_no_gf == 0) {
- pmlmepriv->ht_op_mode &=
- ~HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT;
- op_mode_changes++;
- }
-
- if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) &&
- (pmlmepriv->num_sta_no_ht || pmlmepriv->olbc_ht)) {
- pmlmepriv->ht_op_mode |= HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT;
- op_mode_changes++;
- } else if ((pmlmepriv->ht_op_mode &
- HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) &&
- (pmlmepriv->num_sta_no_ht == 0 && !pmlmepriv->olbc_ht)) {
- pmlmepriv->ht_op_mode &=
- ~HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT;
- op_mode_changes++;
- }
-
- /* Note: currently we switch to the MIXED op mode if HT non-greenfield
- * station is associated. Probably it's a theoretical case, since
- * it looks like all known HT STAs support greenfield.
- */
- new_op_mode = 0;
- if (pmlmepriv->num_sta_no_ht ||
- (pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT))
- new_op_mode = OP_MODE_MIXED;
- else if ((phtpriv_ap->ht_cap.cap_info & IEEE80211_HT_CAP_SUP_WIDTH)
- && pmlmepriv->num_sta_ht_20mhz)
- new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED;
- else if (pmlmepriv->olbc_ht)
- new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS;
- else
- new_op_mode = OP_MODE_PURE;
-
- cur_op_mode = pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_OP_MODE_MASK;
- if (cur_op_mode != new_op_mode) {
- pmlmepriv->ht_op_mode &= ~HT_INFO_OPERATION_MODE_OP_MODE_MASK;
- pmlmepriv->ht_op_mode |= new_op_mode;
- op_mode_changes++;
- }
-
- DBG_871X("%s new operation mode=0x%X changes=%d\n",
- __FUNCTION__, pmlmepriv->ht_op_mode, op_mode_changes);
-
- return op_mode_changes;
-
-}
-
-#endif /* CONFIG_80211N_HT */
-
-void associated_clients_update(_adapter *padapter, u8 updated)
-{
- //update associcated stations cap.
- if(updated == _TRUE)
- {
- _irqL irqL;
- _list *phead, *plist;
- struct sta_info *psta=NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
-
- _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- phead = &pstapriv->asoc_list;
- plist = get_next(phead);
-
- //check asoc_queue
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
-
- plist = get_next(plist);
-
- VCS_update(padapter, psta);
- }
-
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- }
-
-}
-
-/* called > TSR LEVEL for USB or SDIO Interface*/
-void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
-{
- u8 beacon_updated = _FALSE;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-
-
-#if 0
- if (!(psta->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) &&
- !psta->no_short_preamble_set) {
- psta->no_short_preamble_set = 1;
- pmlmepriv->num_sta_no_short_preamble++;
- if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
- (pmlmepriv->num_sta_no_short_preamble == 1))
- ieee802_11_set_beacons(hapd->iface);
- }
-#endif
-
-
- if(!(psta->flags & WLAN_STA_SHORT_PREAMBLE))
- {
- if(!psta->no_short_preamble_set)
- {
- psta->no_short_preamble_set = 1;
-
- pmlmepriv->num_sta_no_short_preamble++;
-
- if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
- (pmlmepriv->num_sta_no_short_preamble == 1))
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, 0xFF, NULL, _TRUE);
- }
-
- }
- }
- else
- {
- if(psta->no_short_preamble_set)
- {
- psta->no_short_preamble_set = 0;
-
- pmlmepriv->num_sta_no_short_preamble--;
-
- if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
- (pmlmepriv->num_sta_no_short_preamble == 0))
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, 0xFF, NULL, _TRUE);
- }
-
- }
- }
-
-#if 0
- if (psta->flags & WLAN_STA_NONERP && !psta->nonerp_set) {
- psta->nonerp_set = 1;
- pmlmepriv->num_sta_non_erp++;
- if (pmlmepriv->num_sta_non_erp == 1)
- ieee802_11_set_beacons(hapd->iface);
- }
-#endif
-
- if(psta->flags & WLAN_STA_NONERP)
- {
- if(!psta->nonerp_set)
- {
- psta->nonerp_set = 1;
-
- pmlmepriv->num_sta_non_erp++;
-
- if (pmlmepriv->num_sta_non_erp == 1)
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE);
- }
- }
-
- }
- else
- {
- if(psta->nonerp_set)
- {
- psta->nonerp_set = 0;
-
- pmlmepriv->num_sta_non_erp--;
-
- if (pmlmepriv->num_sta_non_erp == 0)
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE);
- }
- }
-
- }
-
-
-#if 0
- if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT) &&
- !psta->no_short_slot_time_set) {
- psta->no_short_slot_time_set = 1;
- pmlmepriv->num_sta_no_short_slot_time++;
- if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
- (pmlmepriv->num_sta_no_short_slot_time == 1))
- ieee802_11_set_beacons(hapd->iface);
- }
-#endif
-
- if(!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT))
- {
- if(!psta->no_short_slot_time_set)
- {
- psta->no_short_slot_time_set = 1;
-
- pmlmepriv->num_sta_no_short_slot_time++;
-
- if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
- (pmlmepriv->num_sta_no_short_slot_time == 1))
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, 0xFF, NULL, _TRUE);
- }
-
- }
- }
- else
- {
- if(psta->no_short_slot_time_set)
- {
- psta->no_short_slot_time_set = 0;
-
- pmlmepriv->num_sta_no_short_slot_time--;
-
- if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
- (pmlmepriv->num_sta_no_short_slot_time == 0))
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, 0xFF, NULL, _TRUE);
- }
- }
- }
-
-#ifdef CONFIG_80211N_HT
-
- if (psta->flags & WLAN_STA_HT)
- {
- u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info);
-
- DBG_871X("HT: STA " MAC_FMT " HT Capabilities "
- "Info: 0x%04x\n", MAC_ARG(psta->hwaddr), ht_capab);
-
- if (psta->no_ht_set) {
- psta->no_ht_set = 0;
- pmlmepriv->num_sta_no_ht--;
- }
-
- if ((ht_capab & IEEE80211_HT_CAP_GRN_FLD) == 0) {
- if (!psta->no_ht_gf_set) {
- psta->no_ht_gf_set = 1;
- pmlmepriv->num_sta_ht_no_gf++;
- }
- DBG_871X("%s STA " MAC_FMT " - no "
- "greenfield, num of non-gf stations %d\n",
- __FUNCTION__, MAC_ARG(psta->hwaddr),
- pmlmepriv->num_sta_ht_no_gf);
- }
-
- if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH) == 0) {
- if (!psta->ht_20mhz_set) {
- psta->ht_20mhz_set = 1;
- pmlmepriv->num_sta_ht_20mhz++;
- }
- DBG_871X("%s STA " MAC_FMT " - 20 MHz HT, "
- "num of 20MHz HT STAs %d\n",
- __FUNCTION__, MAC_ARG(psta->hwaddr),
- pmlmepriv->num_sta_ht_20mhz);
- }
-
- }
- else
- {
- if (!psta->no_ht_set) {
- psta->no_ht_set = 1;
- pmlmepriv->num_sta_no_ht++;
- }
- if(pmlmepriv->htpriv.ht_option == _TRUE) {
- DBG_871X("%s STA " MAC_FMT
- " - no HT, num of non-HT stations %d\n",
- __FUNCTION__, MAC_ARG(psta->hwaddr),
- pmlmepriv->num_sta_no_ht);
- }
- }
-
- if (rtw_ht_operation_update(padapter) > 0)
- {
- update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE);
- update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE);
- }
-
-#endif /* CONFIG_80211N_HT */
-
- //update associcated stations cap.
- associated_clients_update(padapter, beacon_updated);
-
- DBG_871X("%s, updated=%d\n", __func__, beacon_updated);
-
-}
-
-u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta)
-{
- u8 beacon_updated = _FALSE;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-
- if(!psta)
- return beacon_updated;
-
- if (psta->no_short_preamble_set) {
- psta->no_short_preamble_set = 0;
- pmlmepriv->num_sta_no_short_preamble--;
- if (pmlmeext->cur_wireless_mode > WIRELESS_11B
- && pmlmepriv->num_sta_no_short_preamble == 0)
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, 0xFF, NULL, _TRUE);
- }
- }
-
- if (psta->nonerp_set) {
- psta->nonerp_set = 0;
- pmlmepriv->num_sta_non_erp--;
- if (pmlmepriv->num_sta_non_erp == 0)
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE);
- }
- }
-
- if (psta->no_short_slot_time_set) {
- psta->no_short_slot_time_set = 0;
- pmlmepriv->num_sta_no_short_slot_time--;
- if (pmlmeext->cur_wireless_mode > WIRELESS_11B
- && pmlmepriv->num_sta_no_short_slot_time == 0)
- {
- beacon_updated = _TRUE;
- update_beacon(padapter, 0xFF, NULL, _TRUE);
- }
- }
-
-#ifdef CONFIG_80211N_HT
-
- if (psta->no_ht_gf_set) {
- psta->no_ht_gf_set = 0;
- pmlmepriv->num_sta_ht_no_gf--;
- }
-
- if (psta->no_ht_set) {
- psta->no_ht_set = 0;
- pmlmepriv->num_sta_no_ht--;
- }
-
- if (psta->ht_20mhz_set) {
- psta->ht_20mhz_set = 0;
- pmlmepriv->num_sta_ht_20mhz--;
- }
-
- if (rtw_ht_operation_update(padapter) > 0)
- {
- update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE);
- update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE);
- }
-
-#endif /* CONFIG_80211N_HT */
-
- //update associcated stations cap.
- //associated_clients_update(padapter, beacon_updated); //move it to avoid deadlock
-
- DBG_871X("%s, updated=%d\n", __func__, beacon_updated);
-
- return beacon_updated;
-
-}
-
-u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reason)
-{
- _irqL irqL;
- u8 beacon_updated = _FALSE;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct sta_priv *pstapriv = &padapter->stapriv;
-
- if(!psta)
- return beacon_updated;
-
- if (active == _TRUE)
- {
-#ifdef CONFIG_80211N_HT
- //tear down Rx AMPDU
- send_delba(padapter, 0, psta->hwaddr);// recipient
-
- //tear down TX AMPDU
- send_delba(padapter, 1, psta->hwaddr);// // originator
-
-#endif //CONFIG_80211N_HT
-
- issue_deauth(padapter, psta->hwaddr, reason);
- }
-
- psta->htpriv.agg_enable_bitmap = 0x0;//reset
- psta->htpriv.candidate_tid_bitmap = 0x0;//reset
-
-
- //report_del_sta_event(padapter, psta->hwaddr, reason);
-
- //clear cam entry / key
- rtw_clearstakey_cmd(padapter, psta, _TRUE);
-
-
- _enter_critical_bh(&psta->lock, &irqL);
- psta->state &= ~_FW_LINKED;
- _exit_critical_bh(&psta->lock, &irqL);
-
- #ifdef CONFIG_IOCTL_CFG80211
- if (1) {
- #ifdef COMPAT_KERNEL_RELEASE
- rtw_cfg80211_indicate_sta_disassoc(padapter, psta->hwaddr, reason);
- #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
- rtw_cfg80211_indicate_sta_disassoc(padapter, psta->hwaddr, reason);
- #else //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
- /* will call rtw_cfg80211_indicate_sta_disassoc() in cmd_thread for old API context */
- #endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
- } else
- #endif //CONFIG_IOCTL_CFG80211
- {
- rtw_indicate_sta_disassoc_event(padapter, psta);
- }
-
- report_del_sta_event(padapter, psta->hwaddr, reason);
-
- beacon_updated = bss_cap_update_on_sta_leave(padapter, psta);
-
- _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- rtw_free_stainfo(padapter, psta);
- _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
-
-
- return beacon_updated;
-
-}
-
-int rtw_ap_inform_ch_switch(_adapter *padapter, u8 new_ch, u8 ch_offset)
-{
- _irqL irqL;
- _list *phead, *plist;
- int ret=0;
- struct sta_info *psta = NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
- if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
- return ret;
-
- DBG_871X(FUNC_NDEV_FMT" with ch:%u, offset:%u\n",
- FUNC_NDEV_ARG(padapter->pnetdev), new_ch, ch_offset);
-
- _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
- phead = &pstapriv->asoc_list;
- plist = get_next(phead);
-
- /* for each sta in asoc_queue */
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
- plist = get_next(plist);
-
- issue_action_spct_ch_switch(padapter, psta->hwaddr, new_ch, ch_offset);
- psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
- }
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- issue_action_spct_ch_switch(padapter, bc_addr, new_ch, ch_offset);
-
- return ret;
-}
-
-int rtw_sta_flush(_adapter *padapter)
-{
- _irqL irqL;
- _list *phead, *plist;
- int ret=0;
- struct sta_info *psta = NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- 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;
-
-
- _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
- phead = &pstapriv->asoc_list;
- plist = get_next(phead);
-
- //free sta asoc_queue
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
-
- plist = get_next(plist);
-
- rtw_list_delete(&psta->asoc_list);
- pstapriv->asoc_list_cnt--;
-
- //_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
- ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING);
- //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
- }
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
-
- issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
-
- associated_clients_update(padapter, _TRUE);
-
- return ret;
-
-}
-
-/* called > TSR LEVEL for USB or SDIO Interface*/
-void sta_info_update(_adapter *padapter, struct sta_info *psta)
-{
- int flags = psta->flags;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-
-
- //update wmm cap.
- if(WLAN_STA_WME&flags)
- psta->qos_option = 1;
- else
- psta->qos_option = 0;
-
- if(pmlmepriv->qospriv.qos_option == 0)
- psta->qos_option = 0;
-
-
-#ifdef CONFIG_80211N_HT
- //update 802.11n ht cap.
- if(WLAN_STA_HT&flags)
- {
- psta->htpriv.ht_option = _TRUE;
- psta->qos_option = 1;
- }
- else
- {
- psta->htpriv.ht_option = _FALSE;
- }
-
- if(pmlmepriv->htpriv.ht_option == _FALSE)
- psta->htpriv.ht_option = _FALSE;
-#endif
-
-#ifdef CONFIG_80211AC_VHT
- //update 802.11AC vht cap.
- if(WLAN_STA_VHT&flags)
- {
- psta->vhtpriv.vht_option = _TRUE;
- }
- else
- {
- psta->vhtpriv.vht_option = _FALSE;
- }
-
- if(pmlmepriv->vhtpriv.vht_option == _FALSE)
- psta->vhtpriv.vht_option = _FALSE;
-#endif
-
-
- update_sta_info_apmode(padapter, psta);
-
-
-}
-
-/* called >= TSR LEVEL for USB or SDIO Interface*/
-void ap_sta_info_defer_update(_adapter *padapter, struct sta_info *psta)
-{
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- if(psta->state & _FW_LINKED)
- {
- pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
-
- //add ratid
- add_RATid(padapter, psta, 0);//DM_RATR_STA_INIT
- }
-}
-/* restore hw setting from sw data structures */
-void rtw_ap_restore_network(_adapter *padapter)
-{
- struct mlme_priv *mlmepriv = &padapter->mlmepriv;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct sta_priv * pstapriv = &padapter->stapriv;
- struct sta_info *psta;
- struct security_priv* psecuritypriv=&(padapter->securitypriv);
- _irqL irqL;
- _list *phead, *plist;
- u8 chk_alive_num = 0;
- char chk_alive_list[NUM_STA];
- int i;
-
- rtw_setopmode_cmd(padapter, Ndis802_11APMode,_FALSE);
-
- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-
- start_bss_network(padapter, (u8*)&mlmepriv->cur_network.network);
-
- if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
- (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
- {
- /* restore group key, WEP keys is restored in ips_leave() */
- rtw_set_key(padapter, psecuritypriv, psecuritypriv->dot118021XGrpKeyid, 0,_FALSE);
- }
-
- _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)) {
- chk_alive_list[chk_alive_num++] = stainfo_offset;
- }
- }
-
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- for (i = 0; i < chk_alive_num; i++) {
- psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
-
- 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, psta, _TRUE,_FALSE);
- }
- }
- }
-
-}
-
-void start_ap_mode(_adapter *padapter)
-{
- int i;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
-
- pmlmepriv->update_bcn = _FALSE;
-
- //init_mlme_ap_info(padapter);
- pmlmeext->bstart_bss = _FALSE;
-
- pmlmepriv->num_sta_non_erp = 0;
-
- pmlmepriv->num_sta_no_short_slot_time = 0;
-
- pmlmepriv->num_sta_no_short_preamble = 0;
-
- pmlmepriv->num_sta_ht_no_gf = 0;
-#ifdef CONFIG_80211N_HT
- pmlmepriv->num_sta_no_ht = 0;
-#endif //CONFIG_80211N_HT
- pmlmepriv->num_sta_ht_20mhz = 0;
-
- pmlmepriv->olbc = _FALSE;
-
- pmlmepriv->olbc_ht = _FALSE;
-
-#ifdef CONFIG_80211N_HT
- pmlmepriv->ht_op_mode = 0;
-#endif
-
- for(i=0; i<NUM_STA; i++)
- pstapriv->sta_aid[i] = NULL;
-
- 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));
- pacl_list->num = 0;
- pacl_list->mode = 0;
- for(i = 0; i < NUM_ACL; i++)
- {
- _rtw_init_listhead(&pacl_list->aclnode[i].list);
- pacl_list->aclnode[i].valid = _FALSE;
- }
-
-}
-
-void stop_ap_mode(_adapter *padapter)
-{
- _irqL irqL;
- _list *phead, *plist;
- struct rtw_wlan_acl_node *paclnode;
- struct sta_info *psta=NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
- _queue *pacl_node_q =&pacl_list->acl_node_q;
-
- pmlmepriv->update_bcn = _FALSE;
- pmlmeext->bstart_bss = _FALSE;
- //_rtw_spinlock_free(&pmlmepriv->bcn_update_lock);
-
- //reset and init security priv , this can refine with rtw_reset_securitypriv
- _rtw_memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv));
- padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;
-
- //for ACL
- _enter_critical_bh(&(pacl_node_q->lock), &irqL);
- phead = get_list_head(pacl_node_q);
- plist = get_next(phead);
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
- plist = get_next(plist);
-
- if(paclnode->valid == _TRUE)
- {
- paclnode->valid = _FALSE;
-
- rtw_list_delete(&paclnode->list);
-
- pacl_list->num--;
- }
- }
- _exit_critical_bh(&(pacl_node_q->lock), &irqL);
-
- DBG_871X("%s, free acl_node_queue, num=%d\n", __func__, pacl_list->num);
-
- rtw_sta_flush(padapter);
-
- //free_assoc_sta_resources
- rtw_free_all_stainfo(padapter);
-
- psta = rtw_get_bcmc_stainfo(padapter);
- _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- rtw_free_stainfo(padapter, psta);
- _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
-
- rtw_init_bcmc_stainfo(padapter);
-
- rtw_free_mlme_priv_ie_data(pmlmepriv);
-
-#ifdef CONFIG_BT_COEXIST
- rtw_btcoex_MediaStatusNotify(padapter, 0); //disconnect
-#endif
-
-}
-
-#endif //CONFIG_NATIVEAP_MLME
-
-#ifdef CONFIG_CONCURRENT_MODE
-void concurrent_set_ap_chbw(_adapter *padapter, u8 channel, u8 channel_offset, u8 bwmode)
-{
- u8 *p;
- int ie_len=0;
- u8 cur_channel, cur_bwmode, cur_ch_offset, change_band;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct HT_info_element *pht_info=NULL;
-
- cur_channel = channel;
- cur_bwmode = bwmode;
- cur_ch_offset = channel_offset;
- change_band = _FALSE;
-
- p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
- if( p && ie_len)
- {
- pht_info = (struct HT_info_element *)(p+2);
- }
-
-
- if(!check_buddy_fwstate(padapter, _FW_LINKED|_FW_UNDER_LINKING|_FW_UNDER_SURVEY))
- {
- set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
- }
- else if(check_buddy_fwstate(padapter, _FW_LINKED)==_TRUE)
- {
- _adapter *pbuddy_adapter = padapter->pbuddy_adapter;
- struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
-
- //To sync cur_channel/cur_bwmode/cur_ch_offset with buddy adapter
- DBG_871X(ADPT_FMT" is at linked state\n", ADPT_ARG(pbuddy_adapter));
- DBG_871X(ADPT_FMT": CH=%d, BW=%d, offset=%d\n", ADPT_ARG(pbuddy_adapter), pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_bwmode, pbuddy_mlmeext->cur_ch_offset);
- DBG_871X(ADPT_FMT": CH=%d, BW=%d, offset=%d\n", ADPT_ARG(padapter), cur_channel, cur_bwmode, cur_ch_offset);
-
- if((cur_channel <= 14 && pbuddy_mlmeext->cur_channel >= 36) ||
- (cur_channel >= 36 && pbuddy_mlmeext->cur_channel <= 14))
- change_band = _TRUE;
-
- cur_channel = pbuddy_mlmeext->cur_channel;
-
-#ifdef CONFIG_80211AC_VHT
- if(cur_bwmode == CHANNEL_WIDTH_80)
- {
- u8 *pvht_cap_ie, *pvht_op_ie;
- int vht_cap_ielen, vht_op_ielen;
-
- pvht_cap_ie = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), EID_VHTCapability, &vht_cap_ielen, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
- pvht_op_ie = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), EID_VHTOperation, &vht_op_ielen, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
-
- if(pbuddy_mlmeext->cur_channel <= 14) // downgrade to 20/40Mhz
- {
- //modify vht cap ie
- if( pvht_cap_ie && vht_cap_ielen)
- {
- SET_VHT_CAPABILITY_ELE_SHORT_GI80M(pvht_cap_ie+2, 0);
- }
-
- //modify vht op ie
- if( pvht_op_ie && vht_op_ielen)
- {
- SET_VHT_OPERATION_ELE_CHL_WIDTH(pvht_op_ie+2, 0); //change to 20/40Mhz
- SET_VHT_OPERATION_ELE_CHL_CENTER_FREQ1(pvht_op_ie+2, 0);
- SET_VHT_OPERATION_ELE_CHL_CENTER_FREQ2(pvht_op_ie+2, 0);
- //SET_VHT_OPERATION_ELE_BASIC_MCS_SET(p+2, 0xFFFF);
- cur_bwmode = CHANNEL_WIDTH_40;
- }
- }
- else
- {
- u8 center_freq;
-
- cur_bwmode = CHANNEL_WIDTH_80;
-
- if(pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_40 ||
- pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_80)
- {
- cur_ch_offset = pbuddy_mlmeext->cur_ch_offset;
- }
- else if(pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_20)
- {
- cur_ch_offset = rtw_get_offset_by_ch(cur_channel);
- }
-
- //modify ht info ie
- if(pht_info)
- pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
-
- switch(cur_ch_offset)
- {
- case HAL_PRIME_CHNL_OFFSET_LOWER:
- if(pht_info)
- pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
- //cur_bwmode = CHANNEL_WIDTH_40;
- break;
- case HAL_PRIME_CHNL_OFFSET_UPPER:
- if(pht_info)
- pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW;
- //cur_bwmode = CHANNEL_WIDTH_40;
- break;
- case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
- default:
- if(pht_info)
- pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
- cur_bwmode = CHANNEL_WIDTH_20;
- cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
- break;
- }
-
- //modify vht op ie
- center_freq = rtw_get_center_ch(cur_channel, cur_bwmode, HAL_PRIME_CHNL_OFFSET_LOWER);
- if( pvht_op_ie && vht_op_ielen)
- SET_VHT_OPERATION_ELE_CHL_CENTER_FREQ1(pvht_op_ie+2, center_freq);
-
- set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
-
- }
-
- }
-#endif //CONFIG_80211AC_VHT
-
- if(cur_bwmode == CHANNEL_WIDTH_40)
- {
- if(pht_info)
- pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
-
- if(pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_40 ||
- pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_80)
- {
- cur_ch_offset = pbuddy_mlmeext->cur_ch_offset;
-
- //to update cur_ch_offset value in beacon
- if(pht_info)
- {
- switch(cur_ch_offset)
- {
- case HAL_PRIME_CHNL_OFFSET_LOWER:
- pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
- break;
- case HAL_PRIME_CHNL_OFFSET_UPPER:
- pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW;
- break;
- case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
- default:
- break;
- }
- }
-
- }
- else if(pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_20)
- {
- cur_ch_offset = rtw_get_offset_by_ch(cur_channel);
-
- switch(cur_ch_offset)
- {
- case HAL_PRIME_CHNL_OFFSET_LOWER:
- if(pht_info)
- pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
- cur_bwmode = CHANNEL_WIDTH_40;
- break;
- case HAL_PRIME_CHNL_OFFSET_UPPER:
- if(pht_info)
- pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW;
- cur_bwmode = CHANNEL_WIDTH_40;
- break;
- case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
- default:
- if(pht_info)
- pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
- cur_bwmode = CHANNEL_WIDTH_20;
- cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
- break;
- }
-
- }
-
- set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
-
- }
- else
- {
- set_channel_bwmode(padapter, cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode);
- }
-
- // to update channel value in beacon
- pnetwork->Configuration.DSConfig = cur_channel;
- p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _DSSET_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
- if(p && ie_len>0)
- *(p + 2) = cur_channel;
-
- if(pht_info)
- pht_info->primary_channel = cur_channel;
- }
-
- DBG_871X(FUNC_ADPT_FMT" CH=%d, BW=%d, offset=%d\n", FUNC_ADPT_ARG(padapter), cur_channel, cur_bwmode, cur_ch_offset);
-
- pmlmeext->cur_channel = cur_channel;
- pmlmeext->cur_bwmode = cur_bwmode;
- pmlmeext->cur_ch_offset = cur_ch_offset;
-
- //buddy interface band is different from current interface, update ERP, support rate, ext support rate IE
- if(change_band == _TRUE)
- change_band_update_ie(padapter, pnetwork);
-
-}
-#endif //CONFIG_CONCURRENT_MODE
-
-#endif //CONFIG_AP_MODE
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTW_AP_C_
+
+#include <drv_types.h>
+
+
+#ifdef CONFIG_AP_MODE
+
+extern unsigned char RTW_WPA_OUI[];
+extern unsigned char WMM_OUI[];
+extern unsigned char WPS_OUI[];
+extern unsigned char P2P_OUI[];
+extern unsigned char WFD_OUI[];
+
+void init_mlme_ap_info(_adapter *padapter)
+{
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
+
+
+ _rtw_spinlock_init(&pmlmepriv->bcn_update_lock);
+
+ //for ACL
+ _rtw_init_queue(&pacl_list->acl_node_q);
+
+ //pmlmeext->bstart_bss = _FALSE;
+
+ start_ap_mode(padapter);
+}
+
+void free_mlme_ap_info(_adapter *padapter)
+{
+ _irqL irqL;
+ struct sta_info *psta=NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ //stop_ap_mode(padapter);
+
+ pmlmepriv->update_bcn = _FALSE;
+ pmlmeext->bstart_bss = _FALSE;
+
+ rtw_sta_flush(padapter);
+
+ pmlmeinfo->state = _HW_STATE_NOLINK_;
+
+ //free_assoc_sta_resources
+ rtw_free_all_stainfo(padapter);
+
+ //free bc/mc sta_info
+ psta = rtw_get_bcmc_stainfo(padapter);
+ //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+ rtw_free_stainfo(padapter, psta);
+ //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+
+
+ _rtw_spinlock_free(&pmlmepriv->bcn_update_lock);
+
+}
+
+static void update_BCNTIM(_adapter *padapter)
+{
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network);
+ unsigned char *pie = pnetwork_mlmeext->IEs;
+
+ //DBG_871X("%s\n", __FUNCTION__);
+
+ //update TIM IE
+ //if(pstapriv->tim_bitmap)
+ if(_TRUE)
+ {
+ u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
+ u16 tim_bitmap_le;
+ uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
+
+ tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);
+
+ p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
+ if (p != NULL && tim_ielen>0)
+ {
+ tim_ielen += 2;
+
+ premainder_ie = p+tim_ielen;
+
+ tim_ie_offset = (sint)(p -pie);
+
+ remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen;
+
+ //append TIM IE from dst_ie offset
+ dst_ie = p;
+ }
+ else
+ {
+ tim_ielen = 0;
+
+ //calucate head_len
+ offset = _FIXED_IE_LENGTH_;
+
+ /* get ssid_ie len */
+ p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SSID_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
+ if (p != NULL)
+ offset += tmp_len+2;
+
+ // get supported rates len
+ p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
+ if (p != NULL)
+ {
+ offset += tmp_len+2;
+ }
+
+ //DS Parameter Set IE, len=3
+ offset += 3;
+
+ premainder_ie = pie + offset;
+
+ remainder_ielen = pnetwork_mlmeext->IELength - offset - tim_ielen;
+
+ //append TIM IE from offset
+ dst_ie = pie + offset;
+
+ }
+
+
+ if(remainder_ielen>0)
+ {
+ pbackup_remainder_ie = rtw_malloc(remainder_ielen);
+ if(pbackup_remainder_ie && premainder_ie)
+ _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
+ }
+
+ *dst_ie++=_TIM_IE_;
+
+ if((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fe))
+ tim_ielen = 5;
+ else
+ tim_ielen = 4;
+
+ *dst_ie++= tim_ielen;
+
+ *dst_ie++=0;//DTIM count
+ *dst_ie++=1;//DTIM peroid
+
+ if(pstapriv->tim_bitmap&BIT(0))//for bc/mc frames
+ *dst_ie++ = BIT(0);//bitmap ctrl
+ else
+ *dst_ie++ = 0;
+
+ if(tim_ielen==4)
+ {
+ u8 pvb=0;
+
+ if(pstapriv->tim_bitmap&0x00fe)
+ pvb = (u8)tim_bitmap_le;
+ else if(pstapriv->tim_bitmap&0xff00)
+ pvb = (u8)(tim_bitmap_le>>8);
+ else
+ pvb = (u8)tim_bitmap_le;
+
+ *dst_ie++ = pvb;
+
+ }
+ else if(tim_ielen==5)
+ {
+ _rtw_memcpy(dst_ie, &tim_bitmap_le, 2);
+ dst_ie+=2;
+ }
+
+ //copy remainder IE
+ if(pbackup_remainder_ie)
+ {
+ _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
+
+ rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+ }
+
+ offset = (uint)(dst_ie - pie);
+ pnetwork_mlmeext->IELength = offset + remainder_ielen;
+
+ }
+}
+
+void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len)
+{
+ PNDIS_802_11_VARIABLE_IEs pIE;
+ u8 bmatch = _FALSE;
+ u8 *pie = pnetwork->IEs;
+ u8 *p=NULL, *dst_ie=NULL, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
+ u32 i, offset, ielen, ie_offset, remainder_ielen = 0;
+
+ for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;)
+ {
+ pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
+
+ if (pIE->ElementID > index)
+ {
+ break;
+ }
+ else if(pIE->ElementID == index) // already exist the same IE
+ {
+ p = (u8 *)pIE;
+ ielen = pIE->Length;
+ bmatch = _TRUE;
+ break;
+ }
+
+ p = (u8 *)pIE;
+ ielen = pIE->Length;
+ i += (pIE->Length + 2);
+ }
+
+ if (p != NULL && ielen>0)
+ {
+ ielen += 2;
+
+ premainder_ie = p+ielen;
+
+ ie_offset = (sint)(p -pie);
+
+ remainder_ielen = pnetwork->IELength - ie_offset - ielen;
+
+ if(bmatch)
+ dst_ie = p;
+ else
+ dst_ie = (p+ielen);
+ }
+
+ if(dst_ie == NULL)
+ return;
+
+ if(remainder_ielen>0)
+ {
+ pbackup_remainder_ie = rtw_malloc(remainder_ielen);
+ if(pbackup_remainder_ie && premainder_ie)
+ _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
+ }
+
+ *dst_ie++=index;
+ *dst_ie++=len;
+
+ _rtw_memcpy(dst_ie, data, len);
+ dst_ie+=len;
+
+ //copy remainder IE
+ if(pbackup_remainder_ie)
+ {
+ _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
+
+ rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+ }
+
+ offset = (uint)(dst_ie - pie);
+ pnetwork->IELength = offset + remainder_ielen;
+}
+
+void rtw_remove_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index)
+{
+ u8 *p, *dst_ie=NULL, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
+ uint offset, ielen, ie_offset, remainder_ielen = 0;
+ u8 *pie = pnetwork->IEs;
+
+ p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, index, &ielen, pnetwork->IELength - _FIXED_IE_LENGTH_);
+ if (p != NULL && ielen>0)
+ {
+ ielen += 2;
+
+ premainder_ie = p+ielen;
+
+ ie_offset = (sint)(p -pie);
+
+ remainder_ielen = pnetwork->IELength - ie_offset - ielen;
+
+ dst_ie = p;
+ }
+ else {
+ return;
+ }
+
+ if(remainder_ielen>0)
+ {
+ pbackup_remainder_ie = rtw_malloc(remainder_ielen);
+ if(pbackup_remainder_ie && premainder_ie)
+ _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
+ }
+
+ //copy remainder IE
+ if(pbackup_remainder_ie)
+ {
+ _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
+
+ rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+ }
+
+ offset = (uint)(dst_ie - pie);
+ pnetwork->IELength = offset + remainder_ielen;
+}
+
+
+u8 chk_sta_is_alive(struct sta_info *psta);
+u8 chk_sta_is_alive(struct sta_info *psta)
+{
+ u8 ret = _FALSE;
+ #ifdef DBG_EXPIRATION_CHK
+ DBG_871X("sta:"MAC_FMT", rssi:%d, rx:"STA_PKTS_FMT", expire_to:%u, %s%ssq_len:%u\n"
+ , MAC_ARG(psta->hwaddr)
+ , psta->rssi_stat.UndecoratedSmoothedPWDB
+ //, STA_RX_PKTS_ARG(psta)
+ , STA_RX_PKTS_DIFF_ARG(psta)
+ , psta->expire_to
+ , psta->state&WIFI_SLEEP_STATE?"PS, ":""
+ , psta->state&WIFI_STA_ALIVE_CHK_STATE?"SAC, ":""
+ , psta->sleepq_len
+ );
+ #endif
+
+ //if(sta_last_rx_pkts(psta) == sta_rx_pkts(psta))
+ if((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) == (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts))
+ {
+ #if 0
+ if(psta->state&WIFI_SLEEP_STATE)
+ ret = _TRUE;
+ #endif
+ }
+ else
+ {
+ ret = _TRUE;
+ }
+
+ sta_update_last_rx_pkts(psta);
+
+ return ret;
+}
+
+void expire_timeout_chk(_adapter *padapter)
+{
+ _irqL irqL;
+ _list *phead, *plist;
+ u8 updated = _FALSE;
+ struct sta_info *psta=NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ u8 chk_alive_num = 0;
+ char chk_alive_list[NUM_STA];
+ int i;
+
+
+ _enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
+
+ phead = &pstapriv->auth_list;
+ plist = get_next(phead);
+
+ //check auth_queue
+ #ifdef DBG_EXPIRATION_CHK
+ if (rtw_end_of_queue_search(phead, plist) == _FALSE) {
+ DBG_871X(FUNC_NDEV_FMT" auth_list, cnt:%u\n"
+ , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->auth_list_cnt);
+ }
+ #endif
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ psta = LIST_CONTAINOR(plist, struct sta_info, auth_list);
+
+ plist = get_next(plist);
+
+
+#ifdef CONFIG_ATMEL_RC_PATCH
+ if (_TRUE == _rtw_memcmp((void *)(pstapriv->atmel_rc_pattern), (void *)(psta->hwaddr), ETH_ALEN))
+ continue;
+ if (psta->flag_atmel_rc)
+ continue;
+#endif
+ if(psta->expire_to>0)
+ {
+ psta->expire_to--;
+ if (psta->expire_to == 0)
+ {
+ rtw_list_delete(&psta->auth_list);
+ pstapriv->auth_list_cnt--;
+
+ DBG_871X("auth expire %02X%02X%02X%02X%02X%02X\n",
+ psta->hwaddr[0],psta->hwaddr[1],psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5]);
+
+ _exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
+
+ //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+ rtw_free_stainfo(padapter, psta);
+ //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+
+ _enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
+ }
+ }
+
+ }
+
+ _exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
+ psta = NULL;
+
+
+ _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ phead = &pstapriv->asoc_list;
+ plist = get_next(phead);
+
+ //check asoc_queue
+ #ifdef DBG_EXPIRATION_CHK
+ if (rtw_end_of_queue_search(phead, plist) == _FALSE) {
+ DBG_871X(FUNC_NDEV_FMT" asoc_list, cnt:%u\n"
+ , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->asoc_list_cnt);
+ }
+ #endif
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
+ plist = get_next(plist);
+#ifdef CONFIG_ATMEL_RC_PATCH
+ DBG_871X("%s:%d psta=%p, %02x,%02x||%02x,%02x \n\n", __func__, __LINE__,
+ psta,pstapriv->atmel_rc_pattern[0], pstapriv->atmel_rc_pattern[5], psta->hwaddr[0], psta->hwaddr[5]);
+ if (_TRUE == _rtw_memcmp((void *)pstapriv->atmel_rc_pattern, (void *)(psta->hwaddr), ETH_ALEN))
+ continue;
+ if (psta->flag_atmel_rc)
+ continue;
+ DBG_871X("%s: debug line:%d \n", __func__, __LINE__);
+#endif
+#ifdef CONFIG_AUTO_AP_MODE
+ if(psta->isrc)
+ continue;
+#endif
+ if (chk_sta_is_alive(psta) || !psta->expire_to) {
+ psta->expire_to = pstapriv->expire_to;
+ psta->keep_alive_trycnt = 0;
+ #ifdef CONFIG_TX_MCAST2UNI
+ psta->under_exist_checking = 0;
+ #endif // CONFIG_TX_MCAST2UNI
+ } else {
+ psta->expire_to--;
+ }
+
+#ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+#ifdef CONFIG_80211N_HT
+#ifdef CONFIG_TX_MCAST2UNI
+ if ( (psta->flags & WLAN_STA_HT) && (psta->htpriv.agg_enable_bitmap || psta->under_exist_checking) ) {
+ // check sta by delba(addba) for 11n STA
+ // ToDo: use CCX report to check for all STAs
+ //DBG_871X("asoc check by DELBA/ADDBA! (pstapriv->expire_to=%d s)(psta->expire_to=%d s), [%02x, %d]\n", pstapriv->expire_to*2, psta->expire_to*2, psta->htpriv.agg_enable_bitmap, psta->under_exist_checking);
+
+ if ( psta->expire_to <= (pstapriv->expire_to - 50 ) ) {
+ DBG_871X("asoc expire by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2);
+ psta->under_exist_checking = 0;
+ psta->expire_to = 0;
+ } else if ( psta->expire_to <= (pstapriv->expire_to - 3) && (psta->under_exist_checking==0)) {
+ DBG_871X("asoc check by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2);
+ psta->under_exist_checking = 1;
+ //tear down TX AMPDU
+ send_delba(padapter, 1, psta->hwaddr);// // originator
+ psta->htpriv.agg_enable_bitmap = 0x0;//reset
+ psta->htpriv.candidate_tid_bitmap = 0x0;//reset
+ }
+ }
+#endif //CONFIG_TX_MCAST2UNI
+#endif //CONFIG_80211N_HT
+#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+
+ if (psta->expire_to <= 0)
+ {
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+
+ if (padapter->registrypriv.wifi_spec == 1)
+ {
+ psta->expire_to = pstapriv->expire_to;
+ continue;
+ }
+
+#ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+#ifdef CONFIG_80211N_HT
+
+#define KEEP_ALIVE_TRYCNT (3)
+
+ if(psta->keep_alive_trycnt > 0 && psta->keep_alive_trycnt <= KEEP_ALIVE_TRYCNT)
+ {
+ if(psta->state & WIFI_STA_ALIVE_CHK_STATE)
+ psta->state ^= WIFI_STA_ALIVE_CHK_STATE;
+ else
+ psta->keep_alive_trycnt = 0;
+
+ }
+ else if((psta->keep_alive_trycnt > KEEP_ALIVE_TRYCNT) && !(psta->state & WIFI_STA_ALIVE_CHK_STATE))
+ {
+ psta->keep_alive_trycnt = 0;
+ }
+ if((psta->htpriv.ht_option==_TRUE) && (psta->htpriv.ampdu_enable==_TRUE))
+ {
+ uint priority = 1; //test using BK
+ u8 issued=0;
+
+ //issued = (psta->htpriv.agg_enable_bitmap>>priority)&0x1;
+ issued |= (psta->htpriv.candidate_tid_bitmap>>priority)&0x1;
+
+ if(0==issued)
+ {
+ if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE))
+ {
+ psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority);
+
+ if (psta->state & WIFI_SLEEP_STATE)
+ psta->expire_to = 2; // 2x2=4 sec
+ else
+ psta->expire_to = 1; // 2 sec
+
+ psta->state |= WIFI_STA_ALIVE_CHK_STATE;
+
+ //add_ba_hdl(padapter, (u8*)paddbareq_parm);
+
+ DBG_871X("issue addba_req to check if sta alive, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);
+
+ issue_action_BA(padapter, psta->hwaddr, RTW_WLAN_ACTION_ADDBA_REQ, (u16)priority);
+
+ _set_timer(&psta->addba_retry_timer, ADDBA_TO);
+
+ psta->keep_alive_trycnt++;
+
+ continue;
+ }
+ }
+ }
+ if(psta->keep_alive_trycnt > 0 && psta->state & WIFI_STA_ALIVE_CHK_STATE)
+ {
+ psta->keep_alive_trycnt = 0;
+ psta->state ^= WIFI_STA_ALIVE_CHK_STATE;
+ DBG_871X("change to another methods to check alive if staion is at ps mode\n");
+ }
+
+#endif //CONFIG_80211N_HT
+#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+ if (psta->state & WIFI_SLEEP_STATE) {
+ if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE)) {
+ //to check if alive by another methods if staion is at ps mode.
+ psta->expire_to = pstapriv->expire_to;
+ psta->state |= WIFI_STA_ALIVE_CHK_STATE;
+
+ //DBG_871X("alive chk, sta:" MAC_FMT " is at ps mode!\n", MAC_ARG(psta->hwaddr));
+
+ //to update bcn with tim_bitmap for this station
+ pstapriv->tim_bitmap |= BIT(psta->aid);
+ update_beacon(padapter, _TIM_IE_, NULL, _TRUE);
+
+ if(!pmlmeext->active_keep_alive_check)
+ continue;
+ }
+ }
+ #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+ if (pmlmeext->active_keep_alive_check) {
+ int stainfo_offset;
+
+ stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
+ if (stainfo_offset_valid(stainfo_offset)) {
+ chk_alive_list[chk_alive_num++] = stainfo_offset;
+ }
+
+ continue;
+ }
+ #endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
+ rtw_list_delete(&psta->asoc_list);
+ pstapriv->asoc_list_cnt--;
+ DBG_871X("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state);
+ updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING);
+ }
+ else
+ {
+ /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */
+ if (psta->sleepq_len > (NR_XMITFRAME/pstapriv->asoc_list_cnt)
+ && padapter->xmitpriv.free_xmitframe_cnt < ((NR_XMITFRAME/pstapriv->asoc_list_cnt)/2)
+ ){
+ DBG_871X("%s sta:"MAC_FMT", sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__
+ , MAC_ARG(psta->hwaddr)
+ , psta->sleepq_len, padapter->xmitpriv.free_xmitframe_cnt, pstapriv->asoc_list_cnt);
+ wakeup_sta_to_xmit(padapter, psta);
+ }
+ }
+ }
+
+ _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+if (chk_alive_num) {
+
+ u8 backup_oper_channel=0;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ /* switch to correct channel of current network before issue keep-alive frames */
+ if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
+ backup_oper_channel = rtw_get_oper_ch(padapter);
+ SelectChannel(padapter, pmlmeext->cur_channel);
+ }
+
+ /* issue null data to check sta alive*/
+ for (i = 0; i < chk_alive_num; i++) {
+ int ret = _FAIL;
+
+ psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
+#ifdef CONFIG_ATMEL_RC_PATCH
+ if (_TRUE == _rtw_memcmp( pstapriv->atmel_rc_pattern, psta->hwaddr, ETH_ALEN))
+ continue;
+ if (psta->flag_atmel_rc)
+ continue;
+#endif
+ if(!(psta->state &_FW_LINKED))
+ continue;
+
+ if (psta->state & WIFI_SLEEP_STATE)
+ ret = issue_nulldata(padapter, psta->hwaddr, 0, 1, 50);
+ else
+ ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50);
+
+ psta->keep_alive_trycnt++;
+ if (ret == _SUCCESS)
+ {
+ DBG_871X("asoc check, sta(" MAC_FMT ") is alive\n", MAC_ARG(psta->hwaddr));
+ psta->expire_to = pstapriv->expire_to;
+ psta->keep_alive_trycnt = 0;
+ continue;
+ }
+ else if (psta->keep_alive_trycnt <= 3)
+ {
+ DBG_871X("ack check for asoc expire, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);
+ psta->expire_to = 1;
+ continue;
+ }
+
+ psta->keep_alive_trycnt = 0;
+ DBG_871X("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state);
+ _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+ if (rtw_is_list_empty(&psta->asoc_list)==_FALSE) {
+ rtw_list_delete(&psta->asoc_list);
+ pstapriv->asoc_list_cnt--;
+ updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING);
+ }
+ _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ }
+
+ if (backup_oper_channel>0) /* back to the original operation channel */
+ SelectChannel(padapter, backup_oper_channel);
+}
+#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
+
+ associated_clients_update(padapter, updated);
+}
+
+void add_RATid(_adapter *padapter, struct sta_info *psta, u8 rssi_level)
+{
+ int i;
+ u8 rf_type;
+ unsigned char sta_band = 0, shortGIrate = _FALSE;
+ unsigned int tx_ra_bitmap=0;
+ struct ht_priv *psta_ht = NULL;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+
+#ifdef CONFIG_80211N_HT
+ if(psta)
+ psta_ht = &psta->htpriv;
+ else
+ return;
+#endif //CONFIG_80211N_HT
+
+ if(!(psta->state & _FW_LINKED))
+ return;
+
+#if 0//gtest
+ if(get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R)
+ {
+ //is this a 2r STA?
+ if((pstat->tx_ra_bitmap & 0x0ff00000) != 0 && !(priv->pshare->has_2r_sta & BIT(pstat->aid)))
+ {
+ priv->pshare->has_2r_sta |= BIT(pstat->aid);
+ if(rtw_read16(padapter, 0x102501f6) != 0xffff)
+ {
+ rtw_write16(padapter, 0x102501f6, 0xffff);
+ reset_1r_sta_RA(priv, 0xffff);
+ Switch_1SS_Antenna(priv, 3);
+ }
+ }
+ else// bg or 1R STA?
+ {
+ if((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len && priv->pshare->has_2r_sta == 0)
+ {
+ if(rtw_read16(padapter, 0x102501f6) != 0x7777)
+ { // MCS7 SGI
+ rtw_write16(padapter, 0x102501f6,0x7777);
+ reset_1r_sta_RA(priv, 0x7777);
+ Switch_1SS_Antenna(priv, 2);
+ }
+ }
+ }
+
+ }
+
+ if ((pstat->rssi_level < 1) || (pstat->rssi_level > 3))
+ {
+ if (pstat->rssi >= priv->pshare->rf_ft_var.raGoDownUpper)
+ pstat->rssi_level = 1;
+ else if ((pstat->rssi >= priv->pshare->rf_ft_var.raGoDown20MLower) ||
+ ((priv->pshare->is_40m_bw) && (pstat->ht_cap_len) &&
+ (pstat->rssi >= priv->pshare->rf_ft_var.raGoDown40MLower) &&
+ (pstat->ht_cap_buf.ht_cap_info & cpu_to_le16(_HTCAP_SUPPORT_CH_WDTH_))))
+ pstat->rssi_level = 2;
+ else
+ pstat->rssi_level = 3;
+ }
+
+ // rate adaptive by rssi
+ if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len)
+ {
+ if ((get_rf_mimo_mode(priv) == MIMO_1T2R) || (get_rf_mimo_mode(priv) == MIMO_1T1R))
+ {
+ switch (pstat->rssi_level) {
+ case 1:
+ pstat->tx_ra_bitmap &= 0x100f0000;
+ break;
+ case 2:
+ pstat->tx_ra_bitmap &= 0x100ff000;
+ break;
+ case 3:
+ if (priv->pshare->is_40m_bw)
+ pstat->tx_ra_bitmap &= 0x100ff005;
+ else
+ pstat->tx_ra_bitmap &= 0x100ff001;
+
+ break;
+ }
+ }
+ else
+ {
+ switch (pstat->rssi_level) {
+ case 1:
+ pstat->tx_ra_bitmap &= 0x1f0f0000;
+ break;
+ case 2:
+ pstat->tx_ra_bitmap &= 0x1f0ff000;
+ break;
+ case 3:
+ if (priv->pshare->is_40m_bw)
+ pstat->tx_ra_bitmap &= 0x000ff005;
+ else
+ pstat->tx_ra_bitmap &= 0x000ff001;
+
+ break;
+ }
+
+ // Don't need to mask high rates due to new rate adaptive parameters
+ //if (pstat->is_broadcom_sta) // use MCS12 as the highest rate vs. Broadcom sta
+ // pstat->tx_ra_bitmap &= 0x81ffffff;
+
+ // NIC driver will report not supporting MCS15 and MCS14 in asoc req
+ //if (pstat->is_rtl8190_sta && !pstat->is_2t_mimo_sta)
+ // pstat->tx_ra_bitmap &= 0x83ffffff; // if Realtek 1x2 sta, don't use MCS15 and MCS14
+ }
+ }
+ else if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11G) && isErpSta(pstat))
+ {
+ switch (pstat->rssi_level) {
+ case 1:
+ pstat->tx_ra_bitmap &= 0x00000f00;
+ break;
+ case 2:
+ pstat->tx_ra_bitmap &= 0x00000ff0;
+ break;
+ case 3:
+ pstat->tx_ra_bitmap &= 0x00000ff5;
+ break;
+ }
+ }
+ else
+ {
+ pstat->tx_ra_bitmap &= 0x0000000d;
+ }
+
+ // disable tx short GI when station cannot rx MCS15(AP is 2T2R)
+ // disable tx short GI when station cannot rx MCS7 (AP is 1T2R or 1T1R)
+ // if there is only 1r STA and we are 2T2R, DO NOT mask SGI rate
+ if ((!(pstat->tx_ra_bitmap & 0x8000000) && (priv->pshare->has_2r_sta > 0) && (get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R)) ||
+ (!(pstat->tx_ra_bitmap & 0x80000) && (get_rf_mimo_mode(padapter) != RTL8712_RF_2T2R)))
+ {
+ pstat->tx_ra_bitmap &= ~BIT(28);
+ }
+#endif
+
+ rtw_hal_update_sta_rate_mask(padapter, psta);
+ tx_ra_bitmap = psta->ra_mask;
+
+ shortGIrate = query_ra_short_GI(psta);
+
+ if ( pcur_network->Configuration.DSConfig > 14 ) {
+
+ if (tx_ra_bitmap & 0xffff000)
+ sta_band |= WIRELESS_11_5N ;
+
+ if (tx_ra_bitmap & 0xff0)
+ sta_band |= WIRELESS_11A;
+
+ // 5G band
+ #ifdef CONFIG_80211AC_VHT
+ if (psta->vhtpriv.vht_option) {
+ sta_band = WIRELESS_11_5AC;
+ }
+ #endif
+
+ } else {
+ if (tx_ra_bitmap & 0xffff000)
+ sta_band |= WIRELESS_11_24N;
+
+ if (tx_ra_bitmap & 0xff0)
+ sta_band |= WIRELESS_11G;
+
+ if (tx_ra_bitmap & 0x0f)
+ sta_band |= WIRELESS_11B;
+ }
+
+ psta->wireless_mode = sta_band;
+ psta->raid = rtw_hal_networktype_to_raid(padapter, psta);
+
+ if (psta->aid < NUM_STA)
+ {
+ u8 arg[4] = {0};
+
+ arg[0] = psta->mac_id;
+ arg[1] = psta->raid;
+ arg[2] = shortGIrate;
+ arg[3] = psta->init_rate;
+
+ DBG_871X("%s=> mac_id:%d , raid:%d , shortGIrate=%d, bitmap=0x%x\n",
+ __FUNCTION__ , psta->mac_id, psta->raid ,shortGIrate, tx_ra_bitmap);
+
+ rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, rssi_level);
+ }
+ else
+ {
+ DBG_871X("station aid %d exceed the max number\n", psta->aid);
+ }
+
+}
+
+void update_bmc_sta(_adapter *padapter)
+{
+ _irqL irqL;
+ unsigned char network_type;
+ int supportRateNum = 0;
+ unsigned int tx_ra_bitmap=0;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+ struct sta_info *psta = rtw_get_bcmc_stainfo(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;
+
+ psta->qos_option = 0;
+#ifdef CONFIG_80211N_HT
+ psta->htpriv.ht_option = _FALSE;
+#endif //CONFIG_80211N_HT
+
+ psta->ieee8021x_blocked = 0;
+
+ _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
+
+ //psta->dot118021XPrivacy = _NO_PRIVACY_;//!!! remove it, because it has been set before this.
+
+ //prepare for add_RATid
+ supportRateNum = rtw_get_rateset_len((u8*)&pcur_network->SupportedRates);
+ network_type = rtw_check_network_type((u8*)&pcur_network->SupportedRates, supportRateNum, pcur_network->Configuration.DSConfig);
+ if (IsSupportedTxCCK(network_type)) {
+ network_type = WIRELESS_11B;
+ }
+ else if (network_type == WIRELESS_INVALID) { // error handling
+ if ( pcur_network->Configuration.DSConfig > 14 )
+ network_type = WIRELESS_11A;
+ else
+ network_type = WIRELESS_11B;
+ }
+ update_sta_basic_rate(psta, network_type);
+ psta->wireless_mode = network_type;
+
+ rtw_hal_update_sta_rate_mask(padapter, psta);
+ tx_ra_bitmap = psta->ra_mask;
+
+ psta->raid = rtw_hal_networktype_to_raid(padapter,psta);
+
+ //ap mode
+ rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, _TRUE);
+
+ //if(pHalData->fw_ractrl == _TRUE)
+ {
+ u8 arg[4] = {0};
+
+ arg[0] = psta->mac_id;
+ arg[1] = psta->raid;
+ arg[2] = 0;
+ arg[3] = psta->init_rate;
+
+ DBG_871X("%s=> mac_id:%d , raid:%d , bitmap=0x%x\n",
+ __FUNCTION__ , psta->mac_id, psta->raid , tx_ra_bitmap);
+
+ rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, 0);
+ }
+
+ rtw_sta_media_status_rpt(padapter, psta, 1);
+
+ _enter_critical_bh(&psta->lock, &irqL);
+ psta->state = _FW_LINKED;
+ _exit_critical_bh(&psta->lock, &irqL);
+
+ }
+ else
+ {
+ DBG_871X("add_RATid_bmc_sta error!\n");
+ }
+
+}
+
+//notes:
+//AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode
+//MAC_ID = AID+1 for sta in ap/adhoc mode
+//MAC_ID = 1 for bc/mc for sta/ap/adhoc
+//MAC_ID = 0 for bssid for sta/ap/adhoc
+//CAM_ID = //0~3 for default key, cmd_id=macid + 3, macid=aid+1;
+
+void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
+{
+ _irqL irqL;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+#ifdef CONFIG_80211N_HT
+ struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
+ struct ht_priv *phtpriv_sta = &psta->htpriv;
+#endif //CONFIG_80211N_HT
+ u8 cur_ldpc_cap=0, cur_stbc_cap=0, cur_beamform_cap=0;
+ //set intf_tag to if1
+ //psta->intf_tag = 0;
+
+ DBG_871X("%s\n",__FUNCTION__);
+
+ //psta->mac_id = psta->aid+4;
+ //psta->mac_id = psta->aid+1;//alloc macid when call rtw_alloc_stainfo(),
+ //release macid when call rtw_free_stainfo()
+
+ //ap mode
+ rtw_hal_set_odm_var(padapter,HAL_ODM_STA_INFO,psta,_TRUE);
+
+ if(psecuritypriv->dot11AuthAlgrthm==dot11AuthAlgrthm_8021X)
+ psta->ieee8021x_blocked = _TRUE;
+ else
+ psta->ieee8021x_blocked = _FALSE;
+
+
+ //update sta's cap
+
+ //ERP
+ VCS_update(padapter, psta);
+#ifdef CONFIG_80211N_HT
+ //HT related cap
+ if(phtpriv_sta->ht_option)
+ {
+ //check if sta supports rx ampdu
+ phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable;
+
+ //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
+ 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;
+ }
+
+ 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)))
+ {
+ 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);
+ }
+
+ // 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)))
+ {
+ 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);
+ }
+
+#ifdef CONFIG_BEAMFORMING
+ // Config Tx beamforming setting
+ if (TEST_FLAG(phtpriv_ap->beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE) &&
+ GET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP((u8 *)(&phtpriv_sta->ht_cap)))
+ {
+ SET_FLAG(cur_beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE);
+ }
+
+ if (TEST_FLAG(phtpriv_ap->beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE) &&
+ GET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP((u8 *)(&phtpriv_sta->ht_cap)))
+ {
+ SET_FLAG(cur_beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE);
+ }
+
+ if (cur_beamform_cap) {
+ DBG_871X("Client STA(%d) HT Beamforming Cap = 0x%02X\n", psta->aid, cur_beamform_cap);
+ }
+#endif //CONFIG_BEAMFORMING
+ }
+ else
+ {
+ phtpriv_sta->ampdu_enable = _FALSE;
+
+ phtpriv_sta->sgi_20m = _FALSE;
+ phtpriv_sta->sgi_40m = _FALSE;
+ psta->bw_mode = CHANNEL_WIDTH_20;
+ phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ }
+
+ phtpriv_sta->ldpc_cap = cur_ldpc_cap;
+ phtpriv_sta->stbc_cap = cur_stbc_cap;
+ phtpriv_sta->beamform_cap = cur_beamform_cap;
+
+ //Rx AMPDU
+ send_delba(padapter, 0, psta->hwaddr);// recipient
+
+ //TX AMPDU
+ send_delba(padapter, 1, psta->hwaddr);// // originator
+ phtpriv_sta->agg_enable_bitmap = 0x0;//reset
+ phtpriv_sta->candidate_tid_bitmap = 0x0;//reset
+#endif //CONFIG_80211N_HT
+
+#ifdef CONFIG_80211AC_VHT
+ update_sta_vht_info_apmode(padapter, psta);
+#endif
+
+ update_ldpc_stbc_cap(psta);
+
+ //todo: init other variables
+
+ _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
+
+
+ //add ratid
+ //add_RATid(padapter, psta);//move to ap_sta_info_defer_update()
+
+
+ _enter_critical_bh(&psta->lock, &irqL);
+ psta->state |= _FW_LINKED;
+ _exit_critical_bh(&psta->lock, &irqL);
+
+
+}
+
+static void update_ap_info(_adapter *padapter, struct sta_info *psta)
+{
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+#ifdef CONFIG_80211N_HT
+ struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
+#endif //CONFIG_80211N_HT
+
+
+ psta->wireless_mode = pmlmeext->cur_wireless_mode;
+
+ psta->bssratelen = rtw_get_rateset_len(pnetwork->SupportedRates);
+ _rtw_memcpy(psta->bssrateset, pnetwork->SupportedRates, psta->bssratelen);
+
+#ifdef CONFIG_80211N_HT
+ //HT related cap
+ if(phtpriv_ap->ht_option)
+ {
+ //check if sta supports rx ampdu
+ //phtpriv_ap->ampdu_enable = phtpriv_ap->ampdu_enable;
+
+ //check if sta support s Short GI 20M
+ if((phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20))
+ {
+ phtpriv_ap->sgi_20m = _TRUE;
+ }
+ //check if sta support s Short GI 40M
+ if((phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_40))
+ {
+ phtpriv_ap->sgi_40m = _TRUE;
+ }
+
+ psta->qos_option = _TRUE;
+ }
+ else
+ {
+ phtpriv_ap->ampdu_enable = _FALSE;
+
+ phtpriv_ap->sgi_20m = _FALSE;
+ phtpriv_ap->sgi_40m = _FALSE;
+ }
+
+ psta->bw_mode = pmlmeext->cur_bwmode;
+ phtpriv_ap->ch_offset = pmlmeext->cur_ch_offset;
+
+ phtpriv_ap->agg_enable_bitmap = 0x0;//reset
+ phtpriv_ap->candidate_tid_bitmap = 0x0;//reset
+
+ _rtw_memcpy(&psta->htpriv, &pmlmepriv->htpriv, sizeof(struct ht_priv));
+
+#ifdef CONFIG_80211AC_VHT
+ _rtw_memcpy(&psta->vhtpriv, &pmlmepriv->vhtpriv, sizeof(struct vht_priv));
+#endif //CONFIG_80211AC_VHT
+
+#endif //CONFIG_80211N_HT
+}
+
+static void update_hw_ht_param(_adapter *padapter)
+{
+ unsigned char max_AMPDU_len;
+ unsigned char min_MPDU_spacing;
+ struct registry_priv *pregpriv = &padapter->registrypriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ DBG_871X("%s\n", __FUNCTION__);
+
+
+ //handle A-MPDU parameter field
+ /*
+ AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
+ AMPDU_para [4:2]:Min MPDU Start Spacing
+ */
+ max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03;
+
+ min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;
+
+ rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing));
+
+ rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len));
+
+ //
+ // Config SM Power Save setting
+ //
+ pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & 0x0C) >> 2;
+ if(pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
+ {
+ /*u8 i;
+ //update the MCS rates
+ for (i = 0; i < 16; i++)
+ {
+ pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
+ }*/
+ DBG_871X("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__FUNCTION__);
+ }
+
+ //
+ // Config current HT Protection mode.
+ //
+ //pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3;
+
+}
+
+void start_bss_network(_adapter *padapter, u8 *pbuf)
+{
+ u8 *p;
+ u8 val8, cur_channel, cur_bwmode, cur_ch_offset;
+ u16 bcn_interval;
+ u32 acparm;
+ int ie_len;
+ struct registry_priv *pregpriv = &padapter->registrypriv;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct security_priv* psecuritypriv=&(padapter->securitypriv);
+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network);
+ struct HT_info_element *pht_info=NULL;
+#ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
+#endif //CONFIG_P2P
+ u8 cbw40_enable=0;
+ u8 change_band = _FALSE;
+
+ //DBG_871X("%s\n", __FUNCTION__);
+
+ bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod;
+ cur_channel = pnetwork->Configuration.DSConfig;
+ cur_bwmode = CHANNEL_WIDTH_20;
+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+
+
+ //check if there is wps ie,
+ //if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd,
+ //and at first time the security ie ( RSN/WPA IE) will not include in beacon.
+ if(NULL == rtw_get_wps_ie(pnetwork->IEs+_FIXED_IE_LENGTH_, pnetwork->IELength-_FIXED_IE_LENGTH_, NULL, NULL))
+ {
+ pmlmeext->bstart_bss = _TRUE;
+ }
+
+ //todo: update wmm, ht cap
+ //pmlmeinfo->WMM_enable;
+ //pmlmeinfo->HT_enable;
+ if(pmlmepriv->qospriv.qos_option)
+ pmlmeinfo->WMM_enable = _TRUE;
+#ifdef CONFIG_80211N_HT
+ if(pmlmepriv->htpriv.ht_option)
+ {
+ pmlmeinfo->WMM_enable = _TRUE;
+ pmlmeinfo->HT_enable = _TRUE;
+ //pmlmeinfo->HT_info_enable = _TRUE;
+ //pmlmeinfo->HT_caps_enable = _TRUE;
+
+ update_hw_ht_param(padapter);
+ }
+#endif //#CONFIG_80211N_HT
+
+#ifdef CONFIG_80211AC_VHT
+ if(pmlmepriv->vhtpriv.vht_option) {
+ pmlmeinfo->VHT_enable = _TRUE;
+ update_hw_vht_param(padapter);
+ }
+#endif //CONFIG_80211AC_VHT
+
+ if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time
+ {
+ //WEP Key will be set before this function, do not clear CAM.
+ if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_))
+ flush_all_cam_entry(padapter); //clear CAM
+ }
+
+ //set MSR to AP_Mode
+ Set_MSR(padapter, _HW_STATE_AP_);
+
+ //Set BSSID REG
+ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pnetwork->MacAddress);
+
+ //Set EDCA param reg
+#ifdef CONFIG_CONCURRENT_MODE
+ acparm = 0x005ea42b;
+#else
+ acparm = 0x002F3217; // VO
+#endif
+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm));
+ acparm = 0x005E4317; // VI
+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm));
+ //acparm = 0x00105320; // BE
+ acparm = 0x005ea42b;
+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
+ acparm = 0x0000A444; // BK
+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm));
+
+ //Set Security
+ val8 = (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf;
+ rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
+
+ //Beacon Control related register
+ rtw_hal_set_hwreg(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&bcn_interval));
+
+ rtw_hal_set_hwreg(padapter, HW_VAR_DO_IQK, NULL);
+
+ if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time
+ {
+ //u32 initialgain;
+
+ //initialgain = 0x1e;
+
+
+ //disable dynamic functions, such as high power, DIG
+ //Save_DM_Func_Flag(padapter);
+ //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
+
+ //turn on all dynamic functions
+ Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE);
+
+ //rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
+
+ }
+#ifdef CONFIG_80211N_HT
+ //set channel, bwmode
+ p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ if( p && ie_len)
+ {
+ pht_info = (struct HT_info_element *)(p+2);
+
+ if (cur_channel > 14) {
+ if ((pregpriv->bw_mode & 0xf0) > 0)
+ cbw40_enable = 1;
+ } else {
+ if ((pregpriv->bw_mode & 0x0f) > 0)
+ cbw40_enable = 1;
+ }
+
+ if ((cbw40_enable) && (pht_info->infos[0] & BIT(2)))
+ {
+ //switch to the 40M Hz mode
+ //pmlmeext->cur_bwmode = CHANNEL_WIDTH_40;
+ cur_bwmode = CHANNEL_WIDTH_40;
+ switch (pht_info->infos[0] & 0x3)
+ {
+ case 1:
+ //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
+ break;
+
+ case 3:
+ //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
+ break;
+
+ default:
+ //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ break;
+ }
+
+ }
+
+ }
+#endif //CONFIG_80211N_HT
+
+#ifdef CONFIG_80211AC_VHT
+ p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), EID_VHTOperation, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ if( p && ie_len)
+ {
+ if(GET_VHT_OPERATION_ELE_CHL_WIDTH(p+2) >= 1) {
+ cur_bwmode = CHANNEL_WIDTH_80;
+ }
+ }
+#endif
+
+#ifdef CONFIG_DUALMAC_CONCURRENT
+ dc_set_ap_channel_bandwidth(padapter, cur_channel, cur_ch_offset, cur_bwmode);
+#else //!CONFIG_DUALMAC_CONCURRENT
+#ifdef CONFIG_CONCURRENT_MODE
+ //TODO: need to judge the phy parameters on concurrent mode for single phy
+ concurrent_set_ap_chbw(padapter, cur_channel, cur_ch_offset, cur_bwmode);
+#else //!CONFIG_CONCURRENT_MODE
+ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
+ DBG_871X("CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset);
+ pmlmeext->cur_channel = cur_channel;
+ pmlmeext->cur_bwmode = cur_bwmode;
+ pmlmeext->cur_ch_offset = cur_ch_offset;
+#endif //!CONFIG_CONCURRENT_MODE
+#endif //!CONFIG_DUALMAC_CONCURRENT
+
+ pmlmeext->cur_wireless_mode = pmlmepriv->cur_network.network_type;
+
+ //let pnetwork_mlmeext == pnetwork_mlme.
+ _rtw_memcpy(pnetwork_mlmeext, pnetwork, pnetwork->Length);
+
+ //update cur_wireless_mode
+ update_wireless_mode(padapter);
+
+ //update RRSR after set channel and bandwidth
+ UpdateBrateTbl(padapter, pnetwork->SupportedRates);
+ rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates);
+
+ //udpate capability after cur_wireless_mode updated
+ update_capinfo(padapter, rtw_get_capability((WLAN_BSSID_EX *)pnetwork));
+
+
+#ifdef CONFIG_P2P
+ _rtw_memcpy(pwdinfo->p2p_group_ssid, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength);
+ pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength;
+#endif //CONFIG_P2P
+
+ if(_TRUE == pmlmeext->bstart_bss)
+ {
+ update_beacon(padapter, _TIM_IE_, NULL, _TRUE);
+
+#ifndef CONFIG_INTERRUPT_BASED_TXBCN //other case will tx beacon when bcn interrupt coming in.
+#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
+ //issue beacon frame
+ if(send_beacon(padapter)==_FAIL)
+ {
+ DBG_871X("issue_beacon, fail!\n");
+ }
+#endif
+#endif //!CONFIG_INTERRUPT_BASED_TXBCN
+
+ }
+
+
+ //update bc/mc sta_info
+ update_bmc_sta(padapter);
+
+ //pmlmeext->bstart_bss = _TRUE;
+
+}
+
+int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
+{
+ int ret=_SUCCESS;
+ u8 *p;
+ u8 *pHT_caps_ie=NULL;
+ u8 *pHT_info_ie=NULL;
+ struct sta_info *psta = NULL;
+ u16 cap, ht_cap=_FALSE;
+ uint ie_len = 0;
+ int group_cipher, pairwise_cipher;
+ u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX];
+ int supportRateNum = 0;
+ u8 OUI1[] = {0x00, 0x50, 0xf2,0x01};
+ u8 wps_oui[4]={0x0,0x50,0xf2,0x04};
+ u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01};
+ struct registry_priv *pregistrypriv = &padapter->registrypriv;
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ WLAN_BSSID_EX *pbss_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ u8 *ie = pbss_network->IEs;
+ u8 vht_cap=_FALSE;
+
+ /* SSID */
+ /* Supported rates */
+ /* DS Params */
+ /* WLAN_EID_COUNTRY */
+ /* ERP Information element */
+ /* Extended supported rates */
+ /* WPA/WPA2 */
+ /* Wi-Fi Wireless Multimedia Extensions */
+ /* ht_capab, ht_oper */
+ /* WPS IE */
+
+ DBG_871X("%s, len=%d\n", __FUNCTION__, len);
+
+ if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
+ return _FAIL;
+
+
+ if(len>MAX_IE_SZ)
+ return _FAIL;
+
+ pbss_network->IELength = len;
+
+ _rtw_memset(ie, 0, MAX_IE_SZ);
+
+ _rtw_memcpy(ie, pbuf, pbss_network->IELength);
+
+
+ if(pbss_network->InfrastructureMode!=Ndis802_11APMode)
+ return _FAIL;
+
+ pbss_network->Rssi = 0;
+
+ _rtw_memcpy(pbss_network->MacAddress, myid(&(padapter->eeprompriv)), ETH_ALEN);
+
+ //beacon interval
+ p = rtw_get_beacon_interval_from_ie(ie);//ie + 8; // 8: TimeStamp, 2: Beacon Interval 2:Capability
+ //pbss_network->Configuration.BeaconPeriod = le16_to_cpu(*(unsigned short*)p);
+ pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p);
+
+ //capability
+ //cap = *(unsigned short *)rtw_get_capability_from_ie(ie);
+ //cap = le16_to_cpu(cap);
+ cap = RTW_GET_LE16(ie);
+
+ //SSID
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength -_BEACON_IE_OFFSET_));
+ if(p && ie_len>0)
+ {
+ _rtw_memset(&pbss_network->Ssid, 0, sizeof(NDIS_802_11_SSID));
+ _rtw_memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len);
+ pbss_network->Ssid.SsidLength = ie_len;
+ }
+
+ //chnnel
+ channel = 0;
+ pbss_network->Configuration.Length = 0;
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _DSSET_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
+ if(p && ie_len>0)
+ channel = *(p + 2);
+
+ pbss_network->Configuration.DSConfig = channel;
+
+
+ _rtw_memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
+ // get supported rates
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
+ if (p != NULL)
+ {
+ _rtw_memcpy(supportRate, p+2, ie_len);
+ supportRateNum = ie_len;
+ }
+
+ //get ext_supported rates
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_);
+ if (p != NULL)
+ {
+ _rtw_memcpy(supportRate+supportRateNum, p+2, ie_len);
+ supportRateNum += ie_len;
+
+ }
+
+ network_type = rtw_check_network_type(supportRate, supportRateNum, channel);
+
+ rtw_set_supported_rate(pbss_network->SupportedRates, network_type);
+
+
+ //parsing ERP_IE
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
+ if(p && ie_len>0)
+ {
+ ERP_IE_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)p);
+ }
+
+ //update privacy/security
+ if (cap & BIT(4))
+ pbss_network->Privacy = 1;
+ else
+ pbss_network->Privacy = 0;
+
+ psecuritypriv->wpa_psk = 0;
+
+ //wpa2
+ group_cipher = 0; pairwise_cipher = 0;
+ psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
+ psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
+ if(p && ie_len>0)
+ {
+ if(rtw_parse_wpa2_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
+ {
+ psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
+
+ psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x
+ psecuritypriv->wpa_psk |= BIT(1);
+
+ psecuritypriv->wpa2_group_cipher = group_cipher;
+ psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher;
+#if 0
+ switch(group_cipher)
+ {
+ case WPA_CIPHER_NONE:
+ psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
+ break;
+ case WPA_CIPHER_WEP40:
+ psecuritypriv->wpa2_group_cipher = _WEP40_;
+ break;
+ case WPA_CIPHER_TKIP:
+ psecuritypriv->wpa2_group_cipher = _TKIP_;
+ break;
+ case WPA_CIPHER_CCMP:
+ psecuritypriv->wpa2_group_cipher = _AES_;
+ break;
+ case WPA_CIPHER_WEP104:
+ psecuritypriv->wpa2_group_cipher = _WEP104_;
+ break;
+ }
+
+ switch(pairwise_cipher)
+ {
+ case WPA_CIPHER_NONE:
+ psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
+ break;
+ case WPA_CIPHER_WEP40:
+ psecuritypriv->wpa2_pairwise_cipher = _WEP40_;
+ break;
+ case WPA_CIPHER_TKIP:
+ psecuritypriv->wpa2_pairwise_cipher = _TKIP_;
+ break;
+ case WPA_CIPHER_CCMP:
+ psecuritypriv->wpa2_pairwise_cipher = _AES_;
+ break;
+ case WPA_CIPHER_WEP104:
+ psecuritypriv->wpa2_pairwise_cipher = _WEP104_;
+ break;
+ }
+#endif
+ }
+
+ }
+
+ //wpa
+ ie_len = 0;
+ group_cipher = 0; pairwise_cipher = 0;
+ psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
+ psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
+ for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2))
+ {
+ p = rtw_get_ie(p, _SSN_IE_1_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
+ if ((p) && (_rtw_memcmp(p+2, OUI1, 4)))
+ {
+ if(rtw_parse_wpa_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
+ {
+ psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
+
+ psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x
+
+ psecuritypriv->wpa_psk |= BIT(0);
+
+ psecuritypriv->wpa_group_cipher = group_cipher;
+ psecuritypriv->wpa_pairwise_cipher = pairwise_cipher;
+
+#if 0
+ switch(group_cipher)
+ {
+ case WPA_CIPHER_NONE:
+ psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
+ break;
+ case WPA_CIPHER_WEP40:
+ psecuritypriv->wpa_group_cipher = _WEP40_;
+ break;
+ case WPA_CIPHER_TKIP:
+ psecuritypriv->wpa_group_cipher = _TKIP_;
+ break;
+ case WPA_CIPHER_CCMP:
+ psecuritypriv->wpa_group_cipher = _AES_;
+ break;
+ case WPA_CIPHER_WEP104:
+ psecuritypriv->wpa_group_cipher = _WEP104_;
+ break;
+ }
+
+ switch(pairwise_cipher)
+ {
+ case WPA_CIPHER_NONE:
+ psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
+ break;
+ case WPA_CIPHER_WEP40:
+ psecuritypriv->wpa_pairwise_cipher = _WEP40_;
+ break;
+ case WPA_CIPHER_TKIP:
+ psecuritypriv->wpa_pairwise_cipher = _TKIP_;
+ break;
+ case WPA_CIPHER_CCMP:
+ psecuritypriv->wpa_pairwise_cipher = _AES_;
+ break;
+ case WPA_CIPHER_WEP104:
+ psecuritypriv->wpa_pairwise_cipher = _WEP104_;
+ break;
+ }
+#endif
+ }
+
+ break;
+
+ }
+
+ if ((p == NULL) || (ie_len == 0))
+ {
+ break;
+ }
+
+ }
+
+ //wmm
+ ie_len = 0;
+ pmlmepriv->qospriv.qos_option = 0;
+ if(pregistrypriv->wmm_enable)
+ {
+ for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2))
+ {
+ p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
+ if((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6))
+ {
+ pmlmepriv->qospriv.qos_option = 1;
+
+ *(p+8) |= BIT(7);//QoS Info, support U-APSD
+
+ /* disable all ACM bits since the WMM admission control is not supported */
+ *(p + 10) &= ~BIT(4); /* BE */
+ *(p + 14) &= ~BIT(4); /* BK */
+ *(p + 18) &= ~BIT(4); /* VI */
+ *(p + 22) &= ~BIT(4); /* VO */
+
+ break;
+ }
+
+ if ((p == NULL) || (ie_len == 0))
+ {
+ break;
+ }
+ }
+ }
+#ifdef CONFIG_80211N_HT
+ //parsing HT_CAP_IE
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
+ if(p && ie_len>0)
+ {
+ u8 rf_type=0;
+ u32 max_rx_ampdu_factor=0;
+ struct rtw_ieee80211_ht_cap *pht_cap = (struct rtw_ieee80211_ht_cap *)(p+2);
+
+ pHT_caps_ie=p;
+
+ ht_cap = _TRUE;
+ network_type |= WIRELESS_11_24N;
+
+ rtw_ht_use_default_setting(padapter);
+
+ if (pmlmepriv->htpriv.sgi_20m == _FALSE)
+ pht_cap->cap_info &= ~(IEEE80211_HT_CAP_SGI_20);
+
+ if (pmlmepriv->htpriv.sgi_40m == _FALSE)
+ pht_cap->cap_info &= ~(IEEE80211_HT_CAP_SGI_40);
+
+ if (!TEST_FLAG(pmlmepriv->htpriv.ldpc_cap, LDPC_HT_ENABLE_RX))
+ {
+ pht_cap->cap_info &= ~(IEEE80211_HT_CAP_LDPC_CODING);
+ }
+
+ if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_TX))
+ {
+ pht_cap->cap_info &= ~(IEEE80211_HT_CAP_TX_STBC);
+ }
+
+ if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_RX))
+ {
+ pht_cap->cap_info &= ~(IEEE80211_HT_CAP_RX_STBC_3R);
+ }
+
+ 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))
+ {
+ pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2));
+ }
+ else
+ {
+ pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00);
+ }
+
+ 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;
+ }
+
+#ifdef CONFIG_BEAMFORMING
+ // Use registry value to enable HT Beamforming.
+ // ToDo: use configure file to set these capability.
+ pht_cap->tx_BF_cap_info = 0;
+
+ // HT Beamformer
+ if(TEST_FLAG(pmlmepriv->htpriv.beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE))
+ {
+ // Transmit NDP Capable
+ SET_HT_CAP_TXBF_TRANSMIT_NDP_CAP(pht_cap, 1);
+ // Explicit Compressed Steering Capable
+ SET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP(pht_cap, 1);
+ // Compressed Steering Number Antennas
+ SET_HT_CAP_TXBF_COMP_STEERING_NUM_ANTENNAS(pht_cap, 1);
+ }
+
+ // HT Beamformee
+ if(TEST_FLAG(pmlmepriv->htpriv.beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE))
+ {
+ // Receive NDP Capable
+ SET_HT_CAP_TXBF_RECEIVE_NDP_CAP(pht_cap, 1);
+ // Explicit Compressed Beamforming Feedback Capable
+ SET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP(pht_cap, 2);
+ }
+#endif //CONFIG_BEAMFORMING
+
+ _rtw_memcpy(&pmlmepriv->htpriv.ht_cap, p+2, ie_len);
+
+ }
+
+ //parsing HT_INFO_IE
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
+ if(p && ie_len>0)
+ {
+ pHT_info_ie=p;
+ }
+#endif //CONFIG_80211N_HT
+ switch(network_type)
+ {
+ case WIRELESS_11B:
+ pbss_network->NetworkTypeInUse = Ndis802_11DS;
+ break;
+ case WIRELESS_11G:
+ case WIRELESS_11BG:
+ case WIRELESS_11G_24N:
+ case WIRELESS_11BG_24N:
+ pbss_network->NetworkTypeInUse = Ndis802_11OFDM24;
+ break;
+ case WIRELESS_11A:
+ pbss_network->NetworkTypeInUse = Ndis802_11OFDM5;
+ break;
+ default :
+ pbss_network->NetworkTypeInUse = Ndis802_11OFDM24;
+ break;
+ }
+
+ pmlmepriv->cur_network.network_type = network_type;
+
+#ifdef CONFIG_80211N_HT
+ pmlmepriv->htpriv.ht_option = _FALSE;
+
+ if( (psecuritypriv->wpa2_pairwise_cipher&WPA_CIPHER_TKIP) ||
+ (psecuritypriv->wpa_pairwise_cipher&WPA_CIPHER_TKIP))
+ {
+ //todo:
+ //ht_cap = _FALSE;
+ }
+
+ //ht_cap
+ if(pregistrypriv->ht_enable && ht_cap==_TRUE)
+ {
+ pmlmepriv->htpriv.ht_option = _TRUE;
+ pmlmepriv->qospriv.qos_option = 1;
+
+ if(pregistrypriv->ampdu_enable==1)
+ {
+ pmlmepriv->htpriv.ampdu_enable = _TRUE;
+ }
+
+ HT_caps_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)pHT_caps_ie);
+
+ HT_info_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)pHT_info_ie);
+ }
+#endif
+
+#ifdef CONFIG_80211AC_VHT
+
+ //Parsing VHT CAP IE
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, EID_VHTCapability, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
+ if(p && ie_len>0)
+ {
+ vht_cap = _TRUE;
+ }
+ //Parsing VHT OPERATION IE
+
+
+ pmlmepriv->vhtpriv.vht_option = _FALSE;
+ // if channel in 5G band, then add vht ie .
+ if ((pbss_network->Configuration.DSConfig > 14) &&
+ (pmlmepriv->htpriv.ht_option == _TRUE) &&
+ (pregistrypriv->vht_enable))
+ {
+ if(vht_cap == _TRUE)
+ {
+ pmlmepriv->vhtpriv.vht_option = _TRUE;
+ }
+ else if(pregistrypriv->vht_enable == 2) // auto enabled
+ {
+ u8 cap_len, operation_len;
+
+ rtw_vht_use_default_setting(padapter);
+
+ // VHT Capabilities element
+ cap_len = rtw_build_vht_cap_ie(padapter, pbss_network->IEs + pbss_network->IELength);
+ pbss_network->IELength += cap_len;
+
+ // VHT Operation element
+ operation_len = rtw_build_vht_operation_ie(padapter, pbss_network->IEs + pbss_network->IELength, pbss_network->Configuration.DSConfig);
+ pbss_network->IELength += operation_len;
+
+ pmlmepriv->vhtpriv.vht_option = _TRUE;
+ }
+ }
+#endif //CONFIG_80211AC_VHT
+
+ pbss_network->Length = get_WLAN_BSSID_EX_sz((WLAN_BSSID_EX *)pbss_network);
+
+ //issue beacon to start bss network
+ //start_bss_network(padapter, (u8*)pbss_network);
+ rtw_startbss_cmd(padapter, RTW_CMDF_WAIT_ACK);
+
+
+ //alloc sta_info for ap itself
+ psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress);
+ if(!psta)
+ {
+ psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress);
+ if (psta == NULL)
+ {
+ return _FAIL;
+ }
+ }
+
+ // update AP's sta info
+ update_ap_info(padapter, psta);
+
+ psta->state |= WIFI_AP_STATE; //Aries, add,fix bug of flush_cam_entry at STOP AP mode , 0724
+ rtw_indicate_connect( padapter);
+
+ pmlmepriv->cur_network.join_res = _TRUE;//for check if already set beacon
+
+ //update bc/mc sta_info
+ //update_bmc_sta(padapter);
+
+ return ret;
+
+}
+
+void rtw_set_macaddr_acl(_adapter *padapter, int mode)
+{
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
+
+ DBG_871X("%s, mode=%d\n", __func__, mode);
+
+ pacl_list->mode = mode;
+}
+
+int rtw_acl_add_sta(_adapter *padapter, u8 *addr)
+{
+ _irqL irqL;
+ _list *plist, *phead;
+ u8 added = _FALSE;
+ int i, ret=0;
+ struct rtw_wlan_acl_node *paclnode;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
+ _queue *pacl_node_q =&pacl_list->acl_node_q;
+
+ DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr));
+
+ if((NUM_ACL-1) < pacl_list->num)
+ return (-1);
+
+
+ _enter_critical_bh(&(pacl_node_q->lock), &irqL);
+
+ phead = get_list_head(pacl_node_q);
+ plist = get_next(phead);
+
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
+ plist = get_next(plist);
+
+ if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN))
+ {
+ if(paclnode->valid == _TRUE)
+ {
+ added = _TRUE;
+ DBG_871X("%s, sta has been added\n", __func__);
+ break;
+ }
+ }
+ }
+
+ _exit_critical_bh(&(pacl_node_q->lock), &irqL);
+
+
+ if(added == _TRUE)
+ return ret;
+
+
+ _enter_critical_bh(&(pacl_node_q->lock), &irqL);
+
+ for(i=0; i< NUM_ACL; i++)
+ {
+ paclnode = &pacl_list->aclnode[i];
+
+ if(paclnode->valid == _FALSE)
+ {
+ _rtw_init_listhead(&paclnode->list);
+
+ _rtw_memcpy(paclnode->addr, addr, ETH_ALEN);
+
+ paclnode->valid = _TRUE;
+
+ rtw_list_insert_tail(&paclnode->list, get_list_head(pacl_node_q));
+
+ pacl_list->num++;
+
+ break;
+ }
+ }
+
+ DBG_871X("%s, acl_num=%d\n", __func__, pacl_list->num);
+
+ _exit_critical_bh(&(pacl_node_q->lock), &irqL);
+
+ return ret;
+}
+
+int rtw_acl_remove_sta(_adapter *padapter, u8 *addr)
+{
+ _irqL irqL;
+ _list *plist, *phead;
+ int i, ret=0;
+ struct rtw_wlan_acl_node *paclnode;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
+ _queue *pacl_node_q =&pacl_list->acl_node_q;
+ u8 baddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; //Baddr is used for clearing acl_list
+
+ DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr));
+
+ _enter_critical_bh(&(pacl_node_q->lock), &irqL);
+
+ phead = get_list_head(pacl_node_q);
+ plist = get_next(phead);
+
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
+ plist = get_next(plist);
+
+ if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN) || _rtw_memcmp(baddr, addr, ETH_ALEN))
+ {
+ if(paclnode->valid == _TRUE)
+ {
+ paclnode->valid = _FALSE;
+
+ rtw_list_delete(&paclnode->list);
+
+ pacl_list->num--;
+ }
+ }
+ }
+
+ _exit_critical_bh(&(pacl_node_q->lock), &irqL);
+
+ DBG_871X("%s, acl_num=%d\n", __func__, pacl_list->num);
+
+ return ret;
+
+}
+
+u8 rtw_ap_set_pairwise_key(_adapter *padapter, struct sta_info *psta)
+{
+ struct cmd_obj* ph2c;
+ struct set_stakey_parm *psetstakey_para;
+ struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
+ u8 res=_SUCCESS;
+
+ ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
+ if ( ph2c == NULL){
+ res= _FAIL;
+ goto exit;
+ }
+
+ psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm));
+ if(psetstakey_para==NULL){
+ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
+ res=_FAIL;
+ goto exit;
+ }
+
+ init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_);
+
+
+ psetstakey_para->algorithm = (u8)psta->dot118021XPrivacy;
+
+ _rtw_memcpy(psetstakey_para->addr, psta->hwaddr, ETH_ALEN);
+
+ _rtw_memcpy(psetstakey_para->key, &psta->dot118021x_UncstKey, 16);
+
+
+ res = rtw_enqueue_cmd(pcmdpriv, ph2c);
+
+exit:
+
+ return res;
+
+}
+
+static int rtw_ap_set_key(_adapter *padapter, u8 *key, u8 alg, int keyid, u8 set_tx)
+{
+ u8 keylen;
+ struct cmd_obj* pcmd;
+ struct setkey_parm *psetkeyparm;
+ struct cmd_priv *pcmdpriv=&(padapter->cmdpriv);
+ int res=_SUCCESS;
+
+ //DBG_871X("%s\n", __FUNCTION__);
+
+ pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
+ if(pcmd==NULL){
+ res= _FAIL;
+ goto exit;
+ }
+ psetkeyparm=(struct setkey_parm*)rtw_zmalloc(sizeof(struct setkey_parm));
+ if(psetkeyparm==NULL){
+ rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj));
+ res= _FAIL;
+ goto exit;
+ }
+
+ _rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm));
+
+ psetkeyparm->keyid=(u8)keyid;
+ if (is_wep_enc(alg))
+ padapter->securitypriv.key_mask |= BIT(psetkeyparm->keyid);
+
+ psetkeyparm->algorithm = alg;
+
+ psetkeyparm->set_tx = set_tx;
+
+ switch(alg)
+ {
+ case _WEP40_:
+ keylen = 5;
+ break;
+ case _WEP104_:
+ keylen = 13;
+ break;
+ case _TKIP_:
+ case _TKIP_WTMIC_:
+ case _AES_:
+ default:
+ keylen = 16;
+ }
+
+ _rtw_memcpy(&(psetkeyparm->key[0]), key, keylen);
+
+ pcmd->cmdcode = _SetKey_CMD_;
+ pcmd->parmbuf = (u8 *)psetkeyparm;
+ pcmd->cmdsz = (sizeof(struct setkey_parm));
+ pcmd->rsp = NULL;
+ pcmd->rspsz = 0;
+
+
+ _rtw_init_listhead(&pcmd->list);
+
+ res = rtw_enqueue_cmd(pcmdpriv, pcmd);
+
+exit:
+
+ return res;
+}
+
+int rtw_ap_set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid)
+{
+ DBG_871X("%s\n", __FUNCTION__);
+
+ return rtw_ap_set_key(padapter, key, alg, keyid, 1);
+}
+
+int rtw_ap_set_wep_key(_adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set_tx)
+{
+ u8 alg;
+
+ switch(keylen)
+ {
+ case 5:
+ alg =_WEP40_;
+ break;
+ case 13:
+ alg =_WEP104_;
+ break;
+ default:
+ alg =_NO_PRIVACY_;
+ }
+
+ DBG_871X("%s\n", __FUNCTION__);
+
+ return rtw_ap_set_key(padapter, key, alg, keyid, set_tx);
+}
+
+#ifdef CONFIG_NATIVEAP_MLME
+
+static void update_bcn_fixed_ie(_adapter *padapter)
+{
+ DBG_871X("%s\n", __FUNCTION__);
+
+}
+
+static void update_bcn_erpinfo_ie(_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 = &(pmlmeinfo->network);
+ unsigned char *p, *ie = pnetwork->IEs;
+ u32 len = 0;
+
+ DBG_871X("%s, ERP_enable=%d\n", __FUNCTION__, pmlmeinfo->ERP_enable);
+
+ if(!pmlmeinfo->ERP_enable)
+ return;
+
+ //parsing ERP_IE
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
+ if(p && len>0)
+ {
+ PNDIS_802_11_VARIABLE_IEs pIE = (PNDIS_802_11_VARIABLE_IEs)p;
+
+ if (pmlmepriv->num_sta_non_erp == 1)
+ pIE->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION;
+ else
+ pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION);
+
+ if(pmlmepriv->num_sta_no_short_preamble > 0)
+ pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE;
+ else
+ pIE->data[0] &= ~(RTW_ERP_INFO_BARKER_PREAMBLE_MODE);
+
+ ERP_IE_handler(padapter, pIE);
+ }
+
+}
+
+static void update_bcn_htcap_ie(_adapter *padapter)
+{
+ DBG_871X("%s\n", __FUNCTION__);
+
+}
+
+static void update_bcn_htinfo_ie(_adapter *padapter)
+{
+ DBG_871X("%s\n", __FUNCTION__);
+
+}
+
+static void update_bcn_rsn_ie(_adapter *padapter)
+{
+ DBG_871X("%s\n", __FUNCTION__);
+
+}
+
+static void update_bcn_wpa_ie(_adapter *padapter)
+{
+ DBG_871X("%s\n", __FUNCTION__);
+
+}
+
+static void update_bcn_wmm_ie(_adapter *padapter)
+{
+ DBG_871X("%s\n", __FUNCTION__);
+
+}
+
+static void update_bcn_wps_ie(_adapter *padapter)
+{
+ u8 *pwps_ie=NULL, *pwps_ie_src, *premainder_ie, *pbackup_remainder_ie=NULL;
+ uint wps_ielen=0, wps_offset, remainder_ielen;
+ 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 = &(pmlmeinfo->network);
+ unsigned char *ie = pnetwork->IEs;
+ u32 ielen = pnetwork->IELength;
+
+
+ DBG_871X("%s\n", __FUNCTION__);
+
+ pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen);
+
+ if(pwps_ie==NULL || wps_ielen==0)
+ return;
+
+ pwps_ie_src = pmlmepriv->wps_beacon_ie;
+ if(pwps_ie_src == NULL)
+ return;
+
+ wps_offset = (uint)(pwps_ie-ie);
+
+ premainder_ie = pwps_ie + wps_ielen;
+
+ remainder_ielen = ielen - wps_offset - wps_ielen;
+
+ if(remainder_ielen>0)
+ {
+ pbackup_remainder_ie = rtw_malloc(remainder_ielen);
+ if(pbackup_remainder_ie)
+ _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
+ }
+
+ wps_ielen = (uint)pwps_ie_src[1];//to get ie data len
+ if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ)
+ {
+ _rtw_memcpy(pwps_ie, pwps_ie_src, wps_ielen+2);
+ pwps_ie += (wps_ielen+2);
+
+ if(pbackup_remainder_ie)
+ _rtw_memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
+
+ //update IELength
+ pnetwork->IELength = wps_offset + (wps_ielen+2) + remainder_ielen;
+ }
+
+ if(pbackup_remainder_ie)
+ rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+
+ // deal with the case without set_tx_beacon_cmd() in update_beacon()
+#if defined( CONFIG_INTERRUPT_BASED_TXBCN ) || defined( CONFIG_PCI_HCI )
+ if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
+ {
+ u8 sr = 0;
+ rtw_get_wps_attr_content(pwps_ie_src, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL);
+
+ if( sr ) {
+ set_fwstate(pmlmepriv, WIFI_UNDER_WPS);
+ DBG_871X("%s, set WIFI_UNDER_WPS\n", __func__);
+ }
+ }
+#endif
+}
+
+static void update_bcn_p2p_ie(_adapter *padapter)
+{
+
+}
+
+static void update_bcn_vendor_spec_ie(_adapter *padapter, u8*oui)
+{
+ DBG_871X("%s\n", __FUNCTION__);
+
+ if(_rtw_memcmp(RTW_WPA_OUI, oui, 4))
+ {
+ update_bcn_wpa_ie(padapter);
+ }
+ else if(_rtw_memcmp(WMM_OUI, oui, 4))
+ {
+ update_bcn_wmm_ie(padapter);
+ }
+ else if(_rtw_memcmp(WPS_OUI, oui, 4))
+ {
+ update_bcn_wps_ie(padapter);
+ }
+ else if(_rtw_memcmp(P2P_OUI, oui, 4))
+ {
+ update_bcn_p2p_ie(padapter);
+ }
+ else
+ {
+ DBG_871X("unknown OUI type!\n");
+ }
+
+
+}
+
+void update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
+{
+ _irqL irqL;
+ struct mlme_priv *pmlmepriv;
+ struct mlme_ext_priv *pmlmeext;
+ //struct mlme_ext_info *pmlmeinfo;
+
+ //DBG_871X("%s\n", __FUNCTION__);
+
+ if(!padapter)
+ return;
+
+ pmlmepriv = &(padapter->mlmepriv);
+ pmlmeext = &(padapter->mlmeextpriv);
+ //pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ if(_FALSE == pmlmeext->bstart_bss)
+ return;
+
+ _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
+
+ switch(ie_id)
+ {
+ case 0xFF:
+
+ update_bcn_fixed_ie(padapter);//8: TimeStamp, 2: Beacon Interval 2:Capability
+
+ break;
+
+ case _TIM_IE_:
+
+ update_BCNTIM(padapter);
+
+ break;
+
+ case _ERPINFO_IE_:
+
+ update_bcn_erpinfo_ie(padapter);
+
+ break;
+
+ case _HT_CAPABILITY_IE_:
+
+ update_bcn_htcap_ie(padapter);
+
+ break;
+
+ case _RSN_IE_2_:
+
+ update_bcn_rsn_ie(padapter);
+
+ break;
+
+ case _HT_ADD_INFO_IE_:
+
+ update_bcn_htinfo_ie(padapter);
+
+ break;
+
+ case _VENDOR_SPECIFIC_IE_:
+
+ update_bcn_vendor_spec_ie(padapter, oui);
+
+ break;
+
+ default:
+ break;
+ }
+
+ pmlmepriv->update_bcn = _TRUE;
+
+ _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
+
+#ifndef CONFIG_INTERRUPT_BASED_TXBCN
+#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
+ if(tx)
+ {
+ //send_beacon(padapter);//send_beacon must execute on TSR level
+ set_tx_beacon_cmd(padapter);
+ }
+#else
+ {
+ //PCI will issue beacon when BCN interrupt occurs.
+ }
+#endif
+#endif //!CONFIG_INTERRUPT_BASED_TXBCN
+
+}
+
+#ifdef CONFIG_80211N_HT
+
+/*
+op_mode
+Set to 0 (HT pure) under the followign conditions
+ - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or
+ - all STAs in the BSS are 20 MHz HT in 20 MHz BSS
+Set to 1 (HT non-member protection) if there may be non-HT STAs
+ in both the primary and the secondary channel
+Set to 2 if only HT STAs are associated in BSS,
+ however and at least one 20 MHz HT STA is associated
+Set to 3 (HT mixed mode) when one or more non-HT STAs are associated
+ (currently non-GF HT station is considered as non-HT STA also)
+*/
+static int rtw_ht_operation_update(_adapter *padapter)
+{
+ u16 cur_op_mode, new_op_mode;
+ int op_mode_changes = 0;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
+
+ if(pmlmepriv->htpriv.ht_option == _TRUE)
+ return 0;
+
+ //if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed)
+ // return 0;
+
+ DBG_871X("%s current operation mode=0x%X\n",
+ __FUNCTION__, pmlmepriv->ht_op_mode);
+
+ if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT)
+ && pmlmepriv->num_sta_ht_no_gf) {
+ pmlmepriv->ht_op_mode |=
+ HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT;
+ op_mode_changes++;
+ } else if ((pmlmepriv->ht_op_mode &
+ HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) &&
+ pmlmepriv->num_sta_ht_no_gf == 0) {
+ pmlmepriv->ht_op_mode &=
+ ~HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT;
+ op_mode_changes++;
+ }
+
+ if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) &&
+ (pmlmepriv->num_sta_no_ht || pmlmepriv->olbc_ht)) {
+ pmlmepriv->ht_op_mode |= HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT;
+ op_mode_changes++;
+ } else if ((pmlmepriv->ht_op_mode &
+ HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) &&
+ (pmlmepriv->num_sta_no_ht == 0 && !pmlmepriv->olbc_ht)) {
+ pmlmepriv->ht_op_mode &=
+ ~HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT;
+ op_mode_changes++;
+ }
+
+ /* Note: currently we switch to the MIXED op mode if HT non-greenfield
+ * station is associated. Probably it's a theoretical case, since
+ * it looks like all known HT STAs support greenfield.
+ */
+ new_op_mode = 0;
+ if (pmlmepriv->num_sta_no_ht ||
+ (pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT))
+ new_op_mode = OP_MODE_MIXED;
+ else if ((phtpriv_ap->ht_cap.cap_info & IEEE80211_HT_CAP_SUP_WIDTH)
+ && pmlmepriv->num_sta_ht_20mhz)
+ new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED;
+ else if (pmlmepriv->olbc_ht)
+ new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS;
+ else
+ new_op_mode = OP_MODE_PURE;
+
+ cur_op_mode = pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_OP_MODE_MASK;
+ if (cur_op_mode != new_op_mode) {
+ pmlmepriv->ht_op_mode &= ~HT_INFO_OPERATION_MODE_OP_MODE_MASK;
+ pmlmepriv->ht_op_mode |= new_op_mode;
+ op_mode_changes++;
+ }
+
+ DBG_871X("%s new operation mode=0x%X changes=%d\n",
+ __FUNCTION__, pmlmepriv->ht_op_mode, op_mode_changes);
+
+ return op_mode_changes;
+
+}
+
+#endif /* CONFIG_80211N_HT */
+
+void associated_clients_update(_adapter *padapter, u8 updated)
+{
+ //update associcated stations cap.
+ if(updated == _TRUE)
+ {
+ _irqL irqL;
+ _list *phead, *plist;
+ struct sta_info *psta=NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+
+ _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ phead = &pstapriv->asoc_list;
+ plist = get_next(phead);
+
+ //check asoc_queue
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
+
+ plist = get_next(plist);
+
+ VCS_update(padapter, psta);
+ }
+
+ _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ }
+
+}
+
+/* called > TSR LEVEL for USB or SDIO Interface*/
+void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
+{
+ u8 beacon_updated = _FALSE;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+
+
+#if 0
+ if (!(psta->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) &&
+ !psta->no_short_preamble_set) {
+ psta->no_short_preamble_set = 1;
+ pmlmepriv->num_sta_no_short_preamble++;
+ if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
+ (pmlmepriv->num_sta_no_short_preamble == 1))
+ ieee802_11_set_beacons(hapd->iface);
+ }
+#endif
+
+
+ if(!(psta->flags & WLAN_STA_SHORT_PREAMBLE))
+ {
+ if(!psta->no_short_preamble_set)
+ {
+ psta->no_short_preamble_set = 1;
+
+ pmlmepriv->num_sta_no_short_preamble++;
+
+ if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
+ (pmlmepriv->num_sta_no_short_preamble == 1))
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, 0xFF, NULL, _TRUE);
+ }
+
+ }
+ }
+ else
+ {
+ if(psta->no_short_preamble_set)
+ {
+ psta->no_short_preamble_set = 0;
+
+ pmlmepriv->num_sta_no_short_preamble--;
+
+ if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
+ (pmlmepriv->num_sta_no_short_preamble == 0))
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, 0xFF, NULL, _TRUE);
+ }
+
+ }
+ }
+
+#if 0
+ if (psta->flags & WLAN_STA_NONERP && !psta->nonerp_set) {
+ psta->nonerp_set = 1;
+ pmlmepriv->num_sta_non_erp++;
+ if (pmlmepriv->num_sta_non_erp == 1)
+ ieee802_11_set_beacons(hapd->iface);
+ }
+#endif
+
+ if(psta->flags & WLAN_STA_NONERP)
+ {
+ if(!psta->nonerp_set)
+ {
+ psta->nonerp_set = 1;
+
+ pmlmepriv->num_sta_non_erp++;
+
+ if (pmlmepriv->num_sta_non_erp == 1)
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE);
+ }
+ }
+
+ }
+ else
+ {
+ if(psta->nonerp_set)
+ {
+ psta->nonerp_set = 0;
+
+ pmlmepriv->num_sta_non_erp--;
+
+ if (pmlmepriv->num_sta_non_erp == 0)
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE);
+ }
+ }
+
+ }
+
+
+#if 0
+ if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT) &&
+ !psta->no_short_slot_time_set) {
+ psta->no_short_slot_time_set = 1;
+ pmlmepriv->num_sta_no_short_slot_time++;
+ if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
+ (pmlmepriv->num_sta_no_short_slot_time == 1))
+ ieee802_11_set_beacons(hapd->iface);
+ }
+#endif
+
+ if(!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT))
+ {
+ if(!psta->no_short_slot_time_set)
+ {
+ psta->no_short_slot_time_set = 1;
+
+ pmlmepriv->num_sta_no_short_slot_time++;
+
+ if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
+ (pmlmepriv->num_sta_no_short_slot_time == 1))
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, 0xFF, NULL, _TRUE);
+ }
+
+ }
+ }
+ else
+ {
+ if(psta->no_short_slot_time_set)
+ {
+ psta->no_short_slot_time_set = 0;
+
+ pmlmepriv->num_sta_no_short_slot_time--;
+
+ if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
+ (pmlmepriv->num_sta_no_short_slot_time == 0))
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, 0xFF, NULL, _TRUE);
+ }
+ }
+ }
+
+#ifdef CONFIG_80211N_HT
+
+ if (psta->flags & WLAN_STA_HT)
+ {
+ u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info);
+
+ DBG_871X("HT: STA " MAC_FMT " HT Capabilities "
+ "Info: 0x%04x\n", MAC_ARG(psta->hwaddr), ht_capab);
+
+ if (psta->no_ht_set) {
+ psta->no_ht_set = 0;
+ pmlmepriv->num_sta_no_ht--;
+ }
+
+ if ((ht_capab & IEEE80211_HT_CAP_GRN_FLD) == 0) {
+ if (!psta->no_ht_gf_set) {
+ psta->no_ht_gf_set = 1;
+ pmlmepriv->num_sta_ht_no_gf++;
+ }
+ DBG_871X("%s STA " MAC_FMT " - no "
+ "greenfield, num of non-gf stations %d\n",
+ __FUNCTION__, MAC_ARG(psta->hwaddr),
+ pmlmepriv->num_sta_ht_no_gf);
+ }
+
+ if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH) == 0) {
+ if (!psta->ht_20mhz_set) {
+ psta->ht_20mhz_set = 1;
+ pmlmepriv->num_sta_ht_20mhz++;
+ }
+ DBG_871X("%s STA " MAC_FMT " - 20 MHz HT, "
+ "num of 20MHz HT STAs %d\n",
+ __FUNCTION__, MAC_ARG(psta->hwaddr),
+ pmlmepriv->num_sta_ht_20mhz);
+ }
+
+ }
+ else
+ {
+ if (!psta->no_ht_set) {
+ psta->no_ht_set = 1;
+ pmlmepriv->num_sta_no_ht++;
+ }
+ if(pmlmepriv->htpriv.ht_option == _TRUE) {
+ DBG_871X("%s STA " MAC_FMT
+ " - no HT, num of non-HT stations %d\n",
+ __FUNCTION__, MAC_ARG(psta->hwaddr),
+ pmlmepriv->num_sta_no_ht);
+ }
+ }
+
+ if (rtw_ht_operation_update(padapter) > 0)
+ {
+ update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE);
+ update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE);
+ }
+
+#endif /* CONFIG_80211N_HT */
+
+ //update associcated stations cap.
+ associated_clients_update(padapter, beacon_updated);
+
+ DBG_871X("%s, updated=%d\n", __func__, beacon_updated);
+
+}
+
+u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta)
+{
+ u8 beacon_updated = _FALSE;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+
+ if(!psta)
+ return beacon_updated;
+
+ if (psta->no_short_preamble_set) {
+ psta->no_short_preamble_set = 0;
+ pmlmepriv->num_sta_no_short_preamble--;
+ if (pmlmeext->cur_wireless_mode > WIRELESS_11B
+ && pmlmepriv->num_sta_no_short_preamble == 0)
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, 0xFF, NULL, _TRUE);
+ }
+ }
+
+ if (psta->nonerp_set) {
+ psta->nonerp_set = 0;
+ pmlmepriv->num_sta_non_erp--;
+ if (pmlmepriv->num_sta_non_erp == 0)
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE);
+ }
+ }
+
+ if (psta->no_short_slot_time_set) {
+ psta->no_short_slot_time_set = 0;
+ pmlmepriv->num_sta_no_short_slot_time--;
+ if (pmlmeext->cur_wireless_mode > WIRELESS_11B
+ && pmlmepriv->num_sta_no_short_slot_time == 0)
+ {
+ beacon_updated = _TRUE;
+ update_beacon(padapter, 0xFF, NULL, _TRUE);
+ }
+ }
+
+#ifdef CONFIG_80211N_HT
+
+ if (psta->no_ht_gf_set) {
+ psta->no_ht_gf_set = 0;
+ pmlmepriv->num_sta_ht_no_gf--;
+ }
+
+ if (psta->no_ht_set) {
+ psta->no_ht_set = 0;
+ pmlmepriv->num_sta_no_ht--;
+ }
+
+ if (psta->ht_20mhz_set) {
+ psta->ht_20mhz_set = 0;
+ pmlmepriv->num_sta_ht_20mhz--;
+ }
+
+ if (rtw_ht_operation_update(padapter) > 0)
+ {
+ update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE);
+ update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE);
+ }
+
+#endif /* CONFIG_80211N_HT */
+
+ //update associcated stations cap.
+ //associated_clients_update(padapter, beacon_updated); //move it to avoid deadlock
+
+ DBG_871X("%s, updated=%d\n", __func__, beacon_updated);
+
+ return beacon_updated;
+
+}
+
+u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reason)
+{
+ _irqL irqL;
+ u8 beacon_updated = _FALSE;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+
+ if(!psta)
+ return beacon_updated;
+
+ if (active == _TRUE)
+ {
+#ifdef CONFIG_80211N_HT
+ //tear down Rx AMPDU
+ send_delba(padapter, 0, psta->hwaddr);// recipient
+
+ //tear down TX AMPDU
+ send_delba(padapter, 1, psta->hwaddr);// // originator
+
+#endif //CONFIG_80211N_HT
+
+ issue_deauth(padapter, psta->hwaddr, reason);
+ }
+
+ psta->htpriv.agg_enable_bitmap = 0x0;//reset
+ psta->htpriv.candidate_tid_bitmap = 0x0;//reset
+
+
+ //report_del_sta_event(padapter, psta->hwaddr, reason);
+
+ //clear cam entry / key
+ rtw_clearstakey_cmd(padapter, psta, _TRUE);
+
+
+ _enter_critical_bh(&psta->lock, &irqL);
+ psta->state &= ~_FW_LINKED;
+ _exit_critical_bh(&psta->lock, &irqL);
+
+ #ifdef CONFIG_IOCTL_CFG80211
+ if (1) {
+ #ifdef COMPAT_KERNEL_RELEASE
+ rtw_cfg80211_indicate_sta_disassoc(padapter, psta->hwaddr, reason);
+ #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
+ rtw_cfg80211_indicate_sta_disassoc(padapter, psta->hwaddr, reason);
+ #else //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
+ /* will call rtw_cfg80211_indicate_sta_disassoc() in cmd_thread for old API context */
+ #endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
+ } else
+ #endif //CONFIG_IOCTL_CFG80211
+ {
+ rtw_indicate_sta_disassoc_event(padapter, psta);
+ }
+
+ report_del_sta_event(padapter, psta->hwaddr, reason);
+
+ beacon_updated = bss_cap_update_on_sta_leave(padapter, psta);
+
+ //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+ rtw_free_stainfo(padapter, psta);
+ //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+
+
+ return beacon_updated;
+
+}
+
+int rtw_ap_inform_ch_switch(_adapter *padapter, u8 new_ch, u8 ch_offset)
+{
+ _irqL irqL;
+ _list *phead, *plist;
+ int ret=0;
+ struct sta_info *psta = NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
+
+ if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
+ return ret;
+
+ DBG_871X(FUNC_NDEV_FMT" with ch:%u, offset:%u\n",
+ FUNC_NDEV_ARG(padapter->pnetdev), new_ch, ch_offset);
+
+ _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+ phead = &pstapriv->asoc_list;
+ plist = get_next(phead);
+
+ /* for each sta in asoc_queue */
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
+ plist = get_next(plist);
+
+ issue_action_spct_ch_switch(padapter, psta->hwaddr, new_ch, ch_offset);
+ psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
+ }
+ _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ issue_action_spct_ch_switch(padapter, bc_addr, new_ch, ch_offset);
+
+ return ret;
+}
+
+int rtw_sta_flush(_adapter *padapter)
+{
+ _irqL irqL;
+ _list *phead, *plist;
+ int ret=0;
+ struct sta_info *psta = NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
+
+ 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);
+
+ //free sta asoc_queue
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
+
+ plist = get_next(plist);
+
+ rtw_list_delete(&psta->asoc_list);
+ pstapriv->asoc_list_cnt--;
+
+ //_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+ ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING);
+ //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+ }
+ _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+
+ issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
+
+ associated_clients_update(padapter, _TRUE);
+
+ return ret;
+
+}
+
+/* called > TSR LEVEL for USB or SDIO Interface*/
+void sta_info_update(_adapter *padapter, struct sta_info *psta)
+{
+ int flags = psta->flags;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+
+
+ //update wmm cap.
+ if(WLAN_STA_WME&flags)
+ psta->qos_option = 1;
+ else
+ psta->qos_option = 0;
+
+ if(pmlmepriv->qospriv.qos_option == 0)
+ psta->qos_option = 0;
+
+
+#ifdef CONFIG_80211N_HT
+ //update 802.11n ht cap.
+ if(WLAN_STA_HT&flags)
+ {
+ psta->htpriv.ht_option = _TRUE;
+ psta->qos_option = 1;
+ }
+ else
+ {
+ psta->htpriv.ht_option = _FALSE;
+ }
+
+ if(pmlmepriv->htpriv.ht_option == _FALSE)
+ psta->htpriv.ht_option = _FALSE;
+#endif
+
+#ifdef CONFIG_80211AC_VHT
+ //update 802.11AC vht cap.
+ if(WLAN_STA_VHT&flags)
+ {
+ psta->vhtpriv.vht_option = _TRUE;
+ }
+ else
+ {
+ psta->vhtpriv.vht_option = _FALSE;
+ }
+
+ if(pmlmepriv->vhtpriv.vht_option == _FALSE)
+ psta->vhtpriv.vht_option = _FALSE;
+#endif
+
+
+ update_sta_info_apmode(padapter, psta);
+
+
+}
+
+/* called >= TSR LEVEL for USB or SDIO Interface*/
+void ap_sta_info_defer_update(_adapter *padapter, struct sta_info *psta)
+{
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ if(psta->state & _FW_LINKED)
+ {
+ pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
+
+ //add ratid
+ add_RATid(padapter, psta, 0);//DM_RATR_STA_INIT
+ }
+}
+/* restore hw setting from sw data structures */
+void rtw_ap_restore_network(_adapter *padapter)
+{
+ struct mlme_priv *mlmepriv = &padapter->mlmepriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct sta_priv * pstapriv = &padapter->stapriv;
+ struct sta_info *psta;
+ struct security_priv* psecuritypriv=&(padapter->securitypriv);
+ _irqL irqL;
+ _list *phead, *plist;
+ u8 chk_alive_num = 0;
+ char chk_alive_list[NUM_STA];
+ int i;
+
+ rtw_setopmode_cmd(padapter, Ndis802_11APMode,_FALSE);
+
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+
+ start_bss_network(padapter, (u8*)&mlmepriv->cur_network.network);
+
+ if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
+ (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
+ {
+ /* restore group key, WEP keys is restored in ips_leave() */
+ rtw_set_key(padapter, psecuritypriv, psecuritypriv->dot118021XGrpKeyid, 0,_FALSE);
+ }
+
+ _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)) {
+ chk_alive_list[chk_alive_num++] = stainfo_offset;
+ }
+ }
+
+ _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ for (i = 0; i < chk_alive_num; i++) {
+ psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
+
+ 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, psta, _TRUE,_FALSE);
+ }
+ }
+ }
+
+}
+
+void start_ap_mode(_adapter *padapter)
+{
+ int i;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
+
+ pmlmepriv->update_bcn = _FALSE;
+
+ //init_mlme_ap_info(padapter);
+ pmlmeext->bstart_bss = _FALSE;
+
+ pmlmepriv->num_sta_non_erp = 0;
+
+ pmlmepriv->num_sta_no_short_slot_time = 0;
+
+ pmlmepriv->num_sta_no_short_preamble = 0;
+
+ pmlmepriv->num_sta_ht_no_gf = 0;
+#ifdef CONFIG_80211N_HT
+ pmlmepriv->num_sta_no_ht = 0;
+#endif //CONFIG_80211N_HT
+ pmlmepriv->num_sta_ht_20mhz = 0;
+
+ pmlmepriv->olbc = _FALSE;
+
+ pmlmepriv->olbc_ht = _FALSE;
+
+#ifdef CONFIG_80211N_HT
+ pmlmepriv->ht_op_mode = 0;
+#endif
+
+ for(i=0; i<NUM_STA; i++)
+ pstapriv->sta_aid[i] = NULL;
+
+ 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));
+ pacl_list->num = 0;
+ pacl_list->mode = 0;
+ for(i = 0; i < NUM_ACL; i++)
+ {
+ _rtw_init_listhead(&pacl_list->aclnode[i].list);
+ pacl_list->aclnode[i].valid = _FALSE;
+ }
+
+}
+
+void stop_ap_mode(_adapter *padapter)
+{
+ _irqL irqL;
+ _list *phead, *plist;
+ struct rtw_wlan_acl_node *paclnode;
+ struct sta_info *psta=NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
+ _queue *pacl_node_q =&pacl_list->acl_node_q;
+
+ pmlmepriv->update_bcn = _FALSE;
+ pmlmeext->bstart_bss = _FALSE;
+ //_rtw_spinlock_free(&pmlmepriv->bcn_update_lock);
+
+ //reset and init security priv , this can refine with rtw_reset_securitypriv
+ _rtw_memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv));
+ padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;
+
+ //for ACL
+ _enter_critical_bh(&(pacl_node_q->lock), &irqL);
+ phead = get_list_head(pacl_node_q);
+ plist = get_next(phead);
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
+ plist = get_next(plist);
+
+ if(paclnode->valid == _TRUE)
+ {
+ paclnode->valid = _FALSE;
+
+ rtw_list_delete(&paclnode->list);
+
+ pacl_list->num--;
+ }
+ }
+ _exit_critical_bh(&(pacl_node_q->lock), &irqL);
+
+ DBG_871X("%s, free acl_node_queue, num=%d\n", __func__, pacl_list->num);
+
+ rtw_sta_flush(padapter);
+
+ //free_assoc_sta_resources
+ rtw_free_all_stainfo(padapter);
+
+ psta = rtw_get_bcmc_stainfo(padapter);
+ //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+ rtw_free_stainfo(padapter, psta);
+ //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+
+ rtw_init_bcmc_stainfo(padapter);
+
+ rtw_free_mlme_priv_ie_data(pmlmepriv);
+
+#ifdef CONFIG_BT_COEXIST
+ rtw_btcoex_MediaStatusNotify(padapter, 0); //disconnect
+#endif
+
+}
+
+#endif //CONFIG_NATIVEAP_MLME
+
+#ifdef CONFIG_CONCURRENT_MODE
+void concurrent_set_ap_chbw(_adapter *padapter, u8 channel, u8 channel_offset, u8 bwmode)
+{
+ u8 *p;
+ int ie_len=0;
+ u8 cur_channel, cur_bwmode, cur_ch_offset, change_band;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct HT_info_element *pht_info=NULL;
+
+ cur_channel = channel;
+ cur_bwmode = bwmode;
+ cur_ch_offset = channel_offset;
+ change_band = _FALSE;
+
+ p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ if( p && ie_len)
+ {
+ pht_info = (struct HT_info_element *)(p+2);
+ }
+
+
+ if(!check_buddy_fwstate(padapter, _FW_LINKED|_FW_UNDER_LINKING|_FW_UNDER_SURVEY))
+ {
+ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
+ }
+ else if(check_buddy_fwstate(padapter, _FW_LINKED)==_TRUE)
+ {
+ _adapter *pbuddy_adapter = padapter->pbuddy_adapter;
+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
+
+ //To sync cur_channel/cur_bwmode/cur_ch_offset with buddy adapter
+ DBG_871X(ADPT_FMT" is at linked state\n", ADPT_ARG(pbuddy_adapter));
+ DBG_871X(ADPT_FMT": CH=%d, BW=%d, offset=%d\n", ADPT_ARG(pbuddy_adapter), pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_bwmode, pbuddy_mlmeext->cur_ch_offset);
+ DBG_871X(ADPT_FMT": CH=%d, BW=%d, offset=%d\n", ADPT_ARG(padapter), cur_channel, cur_bwmode, cur_ch_offset);
+
+ if((cur_channel <= 14 && pbuddy_mlmeext->cur_channel >= 36) ||
+ (cur_channel >= 36 && pbuddy_mlmeext->cur_channel <= 14))
+ change_band = _TRUE;
+
+ cur_channel = pbuddy_mlmeext->cur_channel;
+
+#ifdef CONFIG_80211AC_VHT
+ if(cur_bwmode == CHANNEL_WIDTH_80)
+ {
+ u8 *pvht_cap_ie, *pvht_op_ie;
+ int vht_cap_ielen, vht_op_ielen;
+
+ pvht_cap_ie = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), EID_VHTCapability, &vht_cap_ielen, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ pvht_op_ie = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), EID_VHTOperation, &vht_op_ielen, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+
+ if(pbuddy_mlmeext->cur_channel <= 14) // downgrade to 20/40Mhz
+ {
+ //modify vht cap ie
+ if( pvht_cap_ie && vht_cap_ielen)
+ {
+ SET_VHT_CAPABILITY_ELE_SHORT_GI80M(pvht_cap_ie+2, 0);
+ }
+
+ //modify vht op ie
+ if( pvht_op_ie && vht_op_ielen)
+ {
+ SET_VHT_OPERATION_ELE_CHL_WIDTH(pvht_op_ie+2, 0); //change to 20/40Mhz
+ SET_VHT_OPERATION_ELE_CHL_CENTER_FREQ1(pvht_op_ie+2, 0);
+ SET_VHT_OPERATION_ELE_CHL_CENTER_FREQ2(pvht_op_ie+2, 0);
+ //SET_VHT_OPERATION_ELE_BASIC_MCS_SET(p+2, 0xFFFF);
+ cur_bwmode = CHANNEL_WIDTH_40;
+ }
+ }
+ else
+ {
+ u8 center_freq;
+
+ cur_bwmode = CHANNEL_WIDTH_80;
+
+ if(pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_40 ||
+ pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_80)
+ {
+ cur_ch_offset = pbuddy_mlmeext->cur_ch_offset;
+ }
+ else if(pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_20)
+ {
+ cur_ch_offset = rtw_get_offset_by_ch(cur_channel);
+ }
+
+ //modify ht info ie
+ if(pht_info)
+ pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
+
+ switch(cur_ch_offset)
+ {
+ case HAL_PRIME_CHNL_OFFSET_LOWER:
+ if(pht_info)
+ pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
+ //cur_bwmode = CHANNEL_WIDTH_40;
+ break;
+ case HAL_PRIME_CHNL_OFFSET_UPPER:
+ if(pht_info)
+ pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW;
+ //cur_bwmode = CHANNEL_WIDTH_40;
+ break;
+ case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
+ default:
+ if(pht_info)
+ pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
+ cur_bwmode = CHANNEL_WIDTH_20;
+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ break;
+ }
+
+ //modify vht op ie
+ center_freq = rtw_get_center_ch(cur_channel, cur_bwmode, HAL_PRIME_CHNL_OFFSET_LOWER);
+ if( pvht_op_ie && vht_op_ielen)
+ SET_VHT_OPERATION_ELE_CHL_CENTER_FREQ1(pvht_op_ie+2, center_freq);
+
+ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
+
+ }
+
+ }
+#endif //CONFIG_80211AC_VHT
+
+ if(cur_bwmode == CHANNEL_WIDTH_40)
+ {
+ if(pht_info)
+ pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
+
+ if(pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_40 ||
+ pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_80)
+ {
+ cur_ch_offset = pbuddy_mlmeext->cur_ch_offset;
+
+ //to update cur_ch_offset value in beacon
+ if(pht_info)
+ {
+ switch(cur_ch_offset)
+ {
+ case HAL_PRIME_CHNL_OFFSET_LOWER:
+ pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
+ break;
+ case HAL_PRIME_CHNL_OFFSET_UPPER:
+ pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW;
+ break;
+ case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
+ default:
+ break;
+ }
+ }
+
+ }
+ else if(pbuddy_mlmeext->cur_bwmode == CHANNEL_WIDTH_20)
+ {
+ cur_ch_offset = rtw_get_offset_by_ch(cur_channel);
+
+ switch(cur_ch_offset)
+ {
+ case HAL_PRIME_CHNL_OFFSET_LOWER:
+ if(pht_info)
+ pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
+ cur_bwmode = CHANNEL_WIDTH_40;
+ break;
+ case HAL_PRIME_CHNL_OFFSET_UPPER:
+ if(pht_info)
+ pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW;
+ cur_bwmode = CHANNEL_WIDTH_40;
+ break;
+ case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
+ default:
+ if(pht_info)
+ pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
+ cur_bwmode = CHANNEL_WIDTH_20;
+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ break;
+ }
+
+ }
+
+ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
+
+ }
+ else
+ {
+ set_channel_bwmode(padapter, cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode);
+ }
+
+ // to update channel value in beacon
+ pnetwork->Configuration.DSConfig = cur_channel;
+ p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _DSSET_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ if(p && ie_len>0)
+ *(p + 2) = cur_channel;
+
+ if(pht_info)
+ pht_info->primary_channel = cur_channel;
+ }
+
+ DBG_871X(FUNC_ADPT_FMT" CH=%d, BW=%d, offset=%d\n", FUNC_ADPT_ARG(padapter), cur_channel, cur_bwmode, cur_ch_offset);
+
+ pmlmeext->cur_channel = cur_channel;
+ pmlmeext->cur_bwmode = cur_bwmode;
+ pmlmeext->cur_ch_offset = cur_ch_offset;
+
+ //buddy interface band is different from current interface, update ERP, support rate, ext support rate IE
+ if(change_band == _TRUE)
+ change_band_update_ie(padapter, pnetwork);
+
+}
+#endif //CONFIG_CONCURRENT_MODE
+
+#endif //CONFIG_AP_MODE
+
diff --git a/rtl8xxx_EU/core/rtw_beamforming.c b/rtl8xxx_EU/core/rtw_beamforming.c
index a3b44c3..5e7e14a 100755
--- a/rtl8xxx_EU/core/rtw_beamforming.c
+++ b/rtl8xxx_EU/core/rtw_beamforming.c
@@ -1,1010 +1,1010 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#define _RTW_BEAMFORMING_C_
-
-#include <drv_types.h>
-#include <hal_data.h>
-
-#ifdef CONFIG_BEAMFORMING
-
-struct beamforming_entry *beamforming_get_entry_by_addr(struct mlme_priv *pmlmepriv, u8* ra,u8* idx)
-{
- u8 i = 0;
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
-
- for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
- {
- if( pBeamInfo->beamforming_entry[i].bUsed &&
- (_rtw_memcmp(ra,pBeamInfo->beamforming_entry[i].mac_addr, ETH_ALEN)))
- {
- *idx = i;
- return &(pBeamInfo->beamforming_entry[i]);
- }
- }
-
- return NULL;
-}
-
-BEAMFORMING_CAP beamforming_get_entry_beam_cap_by_mac_id(PVOID pmlmepriv ,u8 mac_id)
-{
- u8 i = 0;
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO((struct mlme_priv *)pmlmepriv);
- BEAMFORMING_CAP BeamformEntryCap = BEAMFORMING_CAP_NONE;
-
- for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
- {
- if( pBeamInfo->beamforming_entry[i].bUsed &&
- (mac_id == pBeamInfo->beamforming_entry[i].mac_id))
- {
- BeamformEntryCap = pBeamInfo->beamforming_entry[i].beamforming_entry_cap;
- i = BEAMFORMING_ENTRY_NUM;
- }
- }
-
- return BeamformEntryCap;
-}
-
-struct beamforming_entry *beamforming_get_free_entry(struct mlme_priv *pmlmepriv, u8* idx)
-{
- u8 i = 0;
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
-
- for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
- {
- if(pBeamInfo->beamforming_entry[i].bUsed == _FALSE)
- {
- *idx = i;
- return &(pBeamInfo->beamforming_entry[i]);
- }
- }
- return NULL;
-}
-
-
-struct beamforming_entry *beamforming_add_entry(PADAPTER adapter, u8* ra, u16 aid,
- u16 mac_id, CHANNEL_WIDTH bw, BEAMFORMING_CAP beamfrom_cap, u8* idx)
-{
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- struct beamforming_entry *pEntry = beamforming_get_free_entry(pmlmepriv, idx);
-
- if(pEntry != NULL)
- {
- pEntry->bUsed = _TRUE;
- pEntry->aid = aid;
- pEntry->mac_id = mac_id;
- pEntry->sound_bw = bw;
- if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
- {
- u16 BSSID = ((adapter->eeprompriv.mac_addr[5] & 0xf0) >> 4) ^
- (adapter->eeprompriv.mac_addr[5] & 0xf); // BSSID[44:47] xor BSSID[40:43]
- pEntry->p_aid = (aid + BSSID * 32) & 0x1ff; // (dec(A) + dec(B)*32) mod 512
- }
- else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
- {
- pEntry->p_aid = 0;
- }
- else
- {
- pEntry->p_aid = ra[5]; // BSSID[39:47]
- pEntry->p_aid = (pEntry->p_aid << 1) | (ra[4] >> 7 );
- }
- _rtw_memcpy(pEntry->mac_addr, ra, ETH_ALEN);
- pEntry->bSound = _FALSE;
-
- //3 TODO SW/FW sound period
- pEntry->sound_period = 200;
- pEntry->beamforming_entry_cap = beamfrom_cap;
- pEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
-
- pEntry->LogSeq = 0xff;
- pEntry->LogRetryCnt = 0;
- pEntry->LogSuccessCnt = 0;
- pEntry->LogStatusFailCnt = 0;
-
- return pEntry;
- }
- else
- return NULL;
-}
-
-BOOLEAN beamforming_remove_entry(struct mlme_priv *pmlmepriv, u8* ra, u8* idx)
-{
- struct beamforming_entry *pEntry = beamforming_get_entry_by_addr(pmlmepriv, ra, idx);
-
- if(pEntry != NULL)
- {
- pEntry->bUsed = _FALSE;
- pEntry->beamforming_entry_cap = BEAMFORMING_CAP_NONE;
- pEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
- return _TRUE;
- }
- else
- return _FALSE;
-}
-
-/* Used for BeamformingStart_V1 */
-void beamforming_dym_ndpa_rate(PADAPTER adapter)
-{
- u16 NDPARate = MGN_6M;
- PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter);
-
- if(pHalData->dmpriv.MinUndecoratedPWDBForDM > 30) // link RSSI > 30%
- NDPARate = MGN_24M;
- else
- NDPARate = MGN_6M;
-
- //BW = CHANNEL_WIDTH_20;
- NDPARate = NDPARate << 8;
- rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_RATE, (u8 *)&NDPARate);
-}
-
-void beamforming_dym_period(PADAPTER Adapter)
-{
- u8 Idx;
- BOOLEAN bChangePeriod = _FALSE;
- u16 SoundPeriod_SW, SoundPeriod_FW;
- PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
- struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter);
- struct beamforming_entry *pBeamformEntry;
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(( &Adapter->mlmepriv));
- struct sounding_info *pSoundInfo = &(pBeamInfo->sounding_info);
-
- //3 TODO per-client throughput caculation.
-
- if(pdvobjpriv->traffic_stat.cur_tx_tp + pdvobjpriv->traffic_stat.cur_rx_tp > 2)
- {
- SoundPeriod_SW = 32*20;
- SoundPeriod_FW = 2;
- }
- else
- {
- SoundPeriod_SW = 32*2000;
- SoundPeriod_FW = 200;
- }
-
- for(Idx = 0; Idx < BEAMFORMING_ENTRY_NUM; Idx++)
- {
- pBeamformEntry = pBeamInfo->beamforming_entry+Idx;
- if(pBeamformEntry->bDefaultCSI)
- {
- SoundPeriod_SW = 32*2000;
- SoundPeriod_FW = 200;
- }
-
- if(pBeamformEntry->beamforming_entry_cap & (BEAMFORMER_CAP_HT_EXPLICIT |BEAMFORMER_CAP_VHT_SU))
- {
- if(pSoundInfo->sound_mode == SOUNDING_FW_VHT_TIMER || pSoundInfo->sound_mode == SOUNDING_FW_HT_TIMER)
- {
- if(pBeamformEntry->sound_period != SoundPeriod_FW)
- {
- pBeamformEntry->sound_period = SoundPeriod_FW;
- bChangePeriod = _TRUE; // Only FW sounding need to send H2C packet to change sound period.
- }
- }
- else if(pBeamformEntry->sound_period != SoundPeriod_SW)
- {
- pBeamformEntry->sound_period = SoundPeriod_SW;
- }
- }
- }
-
- if(bChangePeriod)
- rtw_hal_set_hwreg(Adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&Idx);
-}
-
-u32 beamforming_get_report_frame(PADAPTER Adapter, union recv_frame *precv_frame)
-{
- u32 ret = _SUCCESS;
- struct beamforming_entry *pBeamformEntry = NULL;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- u8 *pframe = precv_frame->u.hdr.rx_data;
- u32 frame_len = precv_frame->u.hdr.len;
- u8 *ta;
- u8 idx, offset;
-
- //DBG_871X("beamforming_get_report_frame\n");
-
- //Memory comparison to see if CSI report is the same with previous one
- ta = GetAddr2Ptr(pframe);
- pBeamformEntry = beamforming_get_entry_by_addr(pmlmepriv, ta, &idx);
- if(pBeamformEntry->beamforming_entry_cap & BEAMFORMER_CAP_VHT_SU)
- offset = 31; //24+(1+1+3)+2 MAC header+(Category+ActionCode+MIMOControlField)+SNR(Nc=2)
- else if(pBeamformEntry->beamforming_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT)
- offset = 34; //24+(1+1+6)+2 MAC header+(Category+ActionCode+MIMOControlField)+SNR(Nc=2)
- else
- return ret;
-
- //DBG_871X("%s MacId %d offset=%d\n", __FUNCTION__, pBeamformEntry->mac_id, offset);
-
- if(_rtw_memcmp(pBeamformEntry->PreCsiReport + offset, pframe+offset, frame_len-offset) == _FALSE)
- {
- pBeamformEntry->DefaultCsiCnt = 0;
- //DBG_871X("%s CSI report is NOT the same with previos one\n", __FUNCTION__);
- }
- else
- {
- pBeamformEntry->DefaultCsiCnt ++;
- //DBG_871X("%s CSI report is the SAME with previos one\n", __FUNCTION__);
- }
- _rtw_memcpy(&pBeamformEntry->PreCsiReport, pframe, frame_len);
-
- pBeamformEntry->bDefaultCSI = _FALSE;
-
- if(pBeamformEntry->DefaultCsiCnt > 20)
- pBeamformEntry->bDefaultCSI = _TRUE;
- else
- pBeamformEntry->bDefaultCSI = _FALSE;
-
- return ret;
-}
-
-void beamforming_get_ndpa_frame(PADAPTER Adapter, union recv_frame *precv_frame)
-{
- u8 *ta;
- u8 idx, Sequence;
- u8 *pframe = precv_frame->u.hdr.rx_data;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- struct beamforming_entry *pBeamformEntry = NULL;
-
- //DBG_871X("beamforming_get_ndpa_frame\n");
-
- if(IS_HARDWARE_TYPE_8812(Adapter) == _FALSE)
- return;
- else if(GetFrameSubType(pframe) != WIFI_NDPA)
- return;
-
- ta = GetAddr2Ptr(pframe);
- // Remove signaling TA.
- ta[0] = ta[0] & 0xFE;
-
- pBeamformEntry = beamforming_get_entry_by_addr(pmlmepriv, ta, &idx);
-
- if(pBeamformEntry == NULL)
- return;
- else if(!(pBeamformEntry->beamforming_entry_cap & BEAMFORMEE_CAP_VHT_SU))
- return;
- else if(pBeamformEntry->LogSuccessCnt > 1)
- return;
-
- Sequence = (pframe[16]) >> 2;
-
- if(pBeamformEntry->LogSeq != Sequence)
- {
- /* Previous frame doesn't retry when meet new sequence number */
- if(pBeamformEntry->LogSeq != 0xff && pBeamformEntry->LogRetryCnt == 0)
- pBeamformEntry->LogSuccessCnt++;
-
- pBeamformEntry->LogSeq = Sequence;
- pBeamformEntry->LogRetryCnt = 0;
- }
- else
- {
- if(pBeamformEntry->LogRetryCnt == 3)
- beamforming_wk_cmd(Adapter, BEAMFORMING_CTRL_SOUNDING_CLK, NULL, 0, 1);
-
- pBeamformEntry->LogRetryCnt++;
- }
-
- DBG_871X("%s LogSeq %d LogRetryCnt %d LogSuccessCnt %d\n",
- __FUNCTION__, pBeamformEntry->LogSeq, pBeamformEntry->LogRetryCnt, pBeamformEntry->LogSuccessCnt);
-}
-
-BOOLEAN issue_ht_ndpa_packet(PADAPTER Adapter, u8 *ra, CHANNEL_WIDTH bw, u8 qidx)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct rtw_ieee80211_hdr *pwlanhdr;
- struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv);
- struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- u8 ActionHdr[4] = {ACT_CAT_VENDOR, 0x00, 0xe0, 0x4c};
- u8 *pframe;
- u16 *fctrl;
- u16 duration = 0;
- u8 aSifsTime = 0;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- return _FALSE;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(Adapter, pattrib);
-
- if (qidx == BCN_QUEUE_INX)
- pattrib->qsel = 0x10;
- pattrib->rate = MGN_MCS8;
- pattrib->bwmode = bw;
- pattrib->order = 1;
- pattrib->subtype = WIFI_ACTION_NOACK;
-
- _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;
-
- SetOrderBit(pframe);
- SetFrameSubType(pframe, WIFI_ACTION_NOACK);
-
- _rtw_memcpy(pwlanhdr->addr1, ra, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&(Adapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-
- if( pmlmeext->cur_wireless_mode == WIRELESS_11B)
- aSifsTime = 10;
- else
- aSifsTime = 16;
-
- duration = 2*aSifsTime + 40;
-
- if(bw == CHANNEL_WIDTH_40)
- duration+= 87;
- else
- duration+= 180;
-
- SetDuration(pframe, duration);
-
- //HT control field
- SET_HT_CTRL_CSI_STEERING(pframe+24, 3);
- SET_HT_CTRL_NDP_ANNOUNCEMENT(pframe+24, 1);
-
- _rtw_memcpy(pframe+28, ActionHdr, 4);
-
- pattrib->pktlen = 32;
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- dump_mgntframe(Adapter, pmgntframe);
-
- return _TRUE;
-}
-
-BOOLEAN beamforming_send_ht_ndpa_packet(PADAPTER Adapter, u8 *ra, CHANNEL_WIDTH bw, u8 qidx)
-{
- return issue_ht_ndpa_packet(Adapter, ra, bw, qidx);
-}
-
-BOOLEAN issue_vht_ndpa_packet(PADAPTER Adapter, u8 *ra, u16 aid, CHANNEL_WIDTH bw, u8 qidx)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct rtw_ieee80211_hdr *pwlanhdr;
- struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv);
- struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
- struct rtw_ndpa_sta_info sta_info;
- u8 *pframe;
- u16 *fctrl;
- u16 duration = 0;
- u8 sequence = 0, aSifsTime = 0;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- return _FALSE;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(Adapter, pattrib);
-
- if (qidx == BCN_QUEUE_INX)
- pattrib->qsel = 0x10;
- pattrib->rate = MGN_VHT2SS_MCS0;
- pattrib->bwmode = bw;
- pattrib->subtype = WIFI_NDPA;
-
- _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;
-
- SetFrameSubType(pframe, WIFI_NDPA);
-
- _rtw_memcpy(pwlanhdr->addr1, ra, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&(Adapter->eeprompriv)), ETH_ALEN);
-
- if (IsSupported5G(pmlmeext->cur_wireless_mode) || IsSupportedHT(pmlmeext->cur_wireless_mode))
- aSifsTime = 16;
- else
- aSifsTime = 10;
-
- duration = 2*aSifsTime + 44;
-
- if(bw == CHANNEL_WIDTH_80)
- duration += 40;
- else if(bw == CHANNEL_WIDTH_40)
- duration+= 87;
- else
- duration+= 180;
-
- SetDuration(pframe, duration);
-
- sequence = pBeamInfo->sounding_sequence<< 2;
- if (pBeamInfo->sounding_sequence >= 0x3f)
- pBeamInfo->sounding_sequence = 0;
- else
- pBeamInfo->sounding_sequence++;
-
- _rtw_memcpy(pframe+16, &sequence,1);
-
- if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
- aid = 0;
-
- sta_info.aid = aid;
- sta_info.feedback_type = 0;
- sta_info.nc_index= 0;
-
- _rtw_memcpy(pframe+17, (u8 *)&sta_info, 2);
-
- pattrib->pktlen = 19;
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- dump_mgntframe(Adapter, pmgntframe);
-
- return _TRUE;
-}
-
-BOOLEAN beamforming_send_vht_ndpa_packet(PADAPTER Adapter, u8 *ra, u16 aid, CHANNEL_WIDTH bw, u8 qidx)
-{
- return issue_vht_ndpa_packet(Adapter, ra, aid, bw, qidx);
-}
-
-BOOLEAN beamfomring_bSounding(struct beamforming_info *pBeamInfo)
-{
- BOOLEAN bSounding = _FALSE;
-
- if(( beamforming_get_beamform_cap(pBeamInfo) & BEAMFORMER_CAP) == 0)
- bSounding = _FALSE;
- else
- bSounding = _TRUE;
-
- return bSounding;
-}
-
-u8 beamforming_sounding_idx(struct beamforming_info *pBeamInfo)
-{
- u8 idx = 0;
- u8 i;
-
- for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
- {
- if (pBeamInfo->beamforming_entry[i].bUsed &&
- (_FALSE == pBeamInfo->beamforming_entry[i].bSound))
- {
- idx = i;
- break;
- }
- }
-
- return idx;
-}
-
-SOUNDING_MODE beamforming_sounding_mode(struct beamforming_info *pBeamInfo, u8 idx)
-{
- struct beamforming_entry BeamEntry = pBeamInfo->beamforming_entry[idx];
- SOUNDING_MODE mode;
-
- if(BeamEntry.beamforming_entry_cap & BEAMFORMER_CAP_VHT_SU)
- {
- mode = SOUNDING_FW_VHT_TIMER;
- }
- else if(BeamEntry.beamforming_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT)
- {
- mode = SOUNDING_FW_HT_TIMER;
- }
- else
- {
- mode = SOUNDING_STOP_All_TIMER;
- }
-
- return mode;
-}
-
-u16 beamforming_sounding_time(struct beamforming_info *pBeamInfo, SOUNDING_MODE mode, u8 idx)
-{
- u16 sounding_time = 0xffff;
- struct beamforming_entry BeamEntry = pBeamInfo->beamforming_entry[idx];
-
- sounding_time = BeamEntry.sound_period;
-
- return sounding_time;
-}
-
-CHANNEL_WIDTH beamforming_sounding_bw(struct beamforming_info *pBeamInfo, SOUNDING_MODE mode, u8 idx)
-{
- CHANNEL_WIDTH sounding_bw = CHANNEL_WIDTH_20;
- struct beamforming_entry BeamEntry = pBeamInfo->beamforming_entry[idx];
-
- sounding_bw = BeamEntry.sound_bw;
-
- return sounding_bw;
-}
-
-BOOLEAN beamforming_select_beam_entry(struct beamforming_info *pBeamInfo)
-{
- struct sounding_info *pSoundInfo = &(pBeamInfo->sounding_info);
-
- pSoundInfo->sound_idx = beamforming_sounding_idx(pBeamInfo);
-
- if(pSoundInfo->sound_idx < BEAMFORMING_ENTRY_NUM)
- pSoundInfo->sound_mode = beamforming_sounding_mode(pBeamInfo, pSoundInfo->sound_idx);
- else
- pSoundInfo->sound_mode = SOUNDING_STOP_All_TIMER;
-
- if(SOUNDING_STOP_All_TIMER == pSoundInfo->sound_mode)
- {
- return _FALSE;
- }
- else
- {
- pSoundInfo->sound_bw = beamforming_sounding_bw(pBeamInfo, pSoundInfo->sound_mode, pSoundInfo->sound_idx );
- pSoundInfo->sound_period = beamforming_sounding_time(pBeamInfo, pSoundInfo->sound_mode, pSoundInfo->sound_idx );
- return _TRUE;
- }
-}
-
-BOOLEAN beamforming_start_fw(PADAPTER adapter, u8 idx)
-{
- u8 *RA = NULL;
- struct beamforming_entry *pEntry;
- BOOLEAN ret = _TRUE;
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
-
- pEntry = &(pBeamInfo->beamforming_entry[idx]);
- if(pEntry->bUsed == _FALSE)
- {
- DBG_871X("Skip Beamforming, no entry for Idx =%d\n", idx);
- return _FALSE;
- }
-
- pEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_PROGRESSING;
- pEntry->bSound = _TRUE;
- rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&idx);
-
- return _TRUE;
-}
-
-void beamforming_end_fw(PADAPTER adapter)
-{
- u8 idx = 0;
-
- rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&idx);
-
- DBG_871X("%s\n", __FUNCTION__);
-}
-
-BOOLEAN beamforming_start_period(PADAPTER adapter)
-{
- BOOLEAN ret = _TRUE;
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
- struct sounding_info *pSoundInfo = &(pBeamInfo->sounding_info);
-
- beamforming_dym_ndpa_rate(adapter);
-
- beamforming_select_beam_entry(pBeamInfo);
-
- if(pSoundInfo->sound_mode == SOUNDING_FW_VHT_TIMER || pSoundInfo->sound_mode == SOUNDING_FW_HT_TIMER)
- {
- ret = beamforming_start_fw(adapter, pSoundInfo->sound_idx);
- }
- else
- {
- ret = _FALSE;
- }
-
- DBG_871X("%s Idx %d Mode %d BW %d Period %d\n", __FUNCTION__,
- pSoundInfo->sound_idx, pSoundInfo->sound_mode, pSoundInfo->sound_bw, pSoundInfo->sound_period);
-
- return ret;
-}
-
-void beamforming_end_period(PADAPTER adapter)
-{
- u8 idx = 0;
- struct beamforming_entry *pBeamformEntry;
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
- struct sounding_info *pSoundInfo = &(pBeamInfo->sounding_info);
-
-
- if(pSoundInfo->sound_mode == SOUNDING_FW_VHT_TIMER || pSoundInfo->sound_mode == SOUNDING_FW_HT_TIMER)
- {
- beamforming_end_fw(adapter);
- }
-}
-
-void beamforming_notify(PADAPTER adapter)
-{
- BOOLEAN bSounding = _FALSE;
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(&(adapter->mlmepriv));
-
- bSounding = beamfomring_bSounding(pBeamInfo);
-
- if(pBeamInfo->beamforming_state == BEAMFORMING_STATE_IDLE)
- {
- if(bSounding)
- {
- if(beamforming_start_period(adapter) == _TRUE)
- pBeamInfo->beamforming_state = BEAMFORMING_STATE_START;
- }
- }
- else if(pBeamInfo->beamforming_state == BEAMFORMING_STATE_START)
- {
- if(bSounding)
- {
- if(beamforming_start_period(adapter) == _FALSE)
- pBeamInfo->beamforming_state = BEAMFORMING_STATE_END;
- }
- else
- {
- beamforming_end_period(adapter);
- pBeamInfo->beamforming_state = BEAMFORMING_STATE_END;
- }
- }
- else if(pBeamInfo->beamforming_state == BEAMFORMING_STATE_END)
- {
- if(bSounding)
- {
- if(beamforming_start_period(adapter) == _TRUE)
- pBeamInfo->beamforming_state = BEAMFORMING_STATE_START;
- }
- }
- else
- {
- DBG_871X("%s BeamformState %d\n", __FUNCTION__, pBeamInfo->beamforming_state);
- }
-
- DBG_871X("%s BeamformState %d bSounding %d\n", __FUNCTION__, pBeamInfo->beamforming_state, bSounding);
-}
-
-BOOLEAN beamforming_init_entry(PADAPTER adapter, struct sta_info *psta, u8* idx)
-{
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- struct ht_priv *phtpriv = &(pmlmepriv->htpriv);
-#ifdef CONFIG_80211AC_VHT
- struct vht_priv *pvhtpriv = &(pmlmepriv->vhtpriv);
-#endif
- struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct beamforming_entry *pBeamformEntry = NULL;
- u8 *ra;
- u16 aid, mac_id;
- u8 wireless_mode;
- CHANNEL_WIDTH bw = CHANNEL_WIDTH_20;
- BEAMFORMING_CAP beamform_cap = BEAMFORMING_CAP_NONE;
-
- // The current setting does not support Beaforming
- if (0 == phtpriv->beamform_cap
-#ifdef CONFIG_80211AC_VHT
- && 0 == pvhtpriv->beamform_cap
-#endif
- ) {
- DBG_871X("The configuration disabled Beamforming! Skip...\n");
- return _FALSE;
- }
-
- aid = psta->aid;
- ra = psta->hwaddr;
- mac_id = psta->mac_id;
- wireless_mode = psta->wireless_mode;
- bw = psta->bw_mode;
-
- if (IsSupportedHT(wireless_mode) || IsSupportedVHT(wireless_mode)) {
- //3 // HT
- u8 cur_beamform;
-
- cur_beamform = psta->htpriv.beamform_cap;
-
- // We are Beamformee because the STA is Beamformer
- if(TEST_FLAG(cur_beamform, BEAMFORMING_HT_BEAMFORMER_ENABLE))
- beamform_cap =(BEAMFORMING_CAP)(beamform_cap |BEAMFORMEE_CAP_HT_EXPLICIT);
-
- // We are Beamformer because the STA is Beamformee
- if(TEST_FLAG(cur_beamform, BEAMFORMING_HT_BEAMFORMEE_ENABLE))
- beamform_cap =(BEAMFORMING_CAP)(beamform_cap | BEAMFORMER_CAP_HT_EXPLICIT);
-#ifdef CONFIG_80211AC_VHT
- if (IsSupportedVHT(wireless_mode)) {
- //3 // VHT
- cur_beamform = psta->vhtpriv.beamform_cap;
-
- // We are Beamformee because the STA is Beamformer
- if(TEST_FLAG(cur_beamform, BEAMFORMING_VHT_BEAMFORMER_ENABLE))
- beamform_cap =(BEAMFORMING_CAP)(beamform_cap |BEAMFORMEE_CAP_VHT_SU);
- // We are Beamformer because the STA is Beamformee
- if(TEST_FLAG(cur_beamform, BEAMFORMING_VHT_BEAMFORMEE_ENABLE))
- beamform_cap =(BEAMFORMING_CAP)(beamform_cap |BEAMFORMER_CAP_VHT_SU);
- }
-#endif //CONFIG_80211AC_VHT
-
- if(beamform_cap == BEAMFORMING_CAP_NONE)
- return _FALSE;
-
- DBG_871X("Beamforming Config Capability = 0x%02X\n", beamform_cap);
-
- pBeamformEntry = beamforming_get_entry_by_addr(pmlmepriv, ra, idx);
- if (pBeamformEntry == NULL) {
- pBeamformEntry = beamforming_add_entry(adapter, ra, aid, mac_id, bw, beamform_cap, idx);
- if(pBeamformEntry == NULL)
- return _FALSE;
- else
- pBeamformEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZEING;
- } else {
- // Entry has been created. If entry is initialing or progressing then errors occur.
- if (pBeamformEntry->beamforming_entry_state != BEAMFORMING_ENTRY_STATE_INITIALIZED &&
- pBeamformEntry->beamforming_entry_state != BEAMFORMING_ENTRY_STATE_PROGRESSED) {
- DBG_871X("Error State of Beamforming");
- return _FALSE;
- } else {
- pBeamformEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZEING;
- }
- }
-
- pBeamformEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZED;
-
- DBG_871X("%s Idx %d\n", __FUNCTION__, *idx);
- } else {
- return _FALSE;
- }
-
- return _SUCCESS;
-}
-
-void beamforming_deinit_entry(PADAPTER adapter, u8* ra)
-{
- u8 idx = 0;
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
-
- if(beamforming_remove_entry(pmlmepriv, ra, &idx) == _TRUE)
- {
- rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_LEAVE, (u8 *)&idx);
- }
-
- DBG_871X("%s Idx %d\n", __FUNCTION__, idx);
-}
-
-void beamforming_reset(PADAPTER adapter)
-{
- u8 idx = 0;
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
-
- for(idx = 0; idx < BEAMFORMING_ENTRY_NUM; idx++)
- {
- if(pBeamInfo->beamforming_entry[idx].bUsed == _TRUE)
- {
- pBeamInfo->beamforming_entry[idx].bUsed = _FALSE;
- pBeamInfo->beamforming_entry[idx].beamforming_entry_cap = BEAMFORMING_CAP_NONE;
- pBeamInfo->beamforming_entry[idx].beamforming_entry_state= BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
- rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_LEAVE, (u8 *)&idx);
- }
- }
-
- DBG_871X("%s\n", __FUNCTION__);
-}
-
-void beamforming_sounding_fail(PADAPTER Adapter)
-{
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
- struct beamforming_entry *pEntry = &(pBeamInfo->beamforming_entry[pBeamInfo->beamforming_cur_idx]);
-
- pEntry->bSound = _FALSE;
- rtw_hal_set_hwreg(Adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&pBeamInfo->beamforming_cur_idx);
- beamforming_deinit_entry(Adapter, pEntry->mac_addr);
-}
-
-void beamforming_check_sounding_success(PADAPTER Adapter,BOOLEAN status)
-{
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
- struct beamforming_entry *pEntry = &(pBeamInfo->beamforming_entry[pBeamInfo->beamforming_cur_idx]);
-
- if(status == 1)
- {
- pEntry->LogStatusFailCnt = 0;
- }
- else
- {
- pEntry->LogStatusFailCnt++;
- DBG_871X("%s LogStatusFailCnt %d\n", __FUNCTION__, pEntry->LogStatusFailCnt);
- }
- if(pEntry->LogStatusFailCnt > 20)
- {
- DBG_871X("%s LogStatusFailCnt > 20, Stop SOUNDING\n", __FUNCTION__);
- //pEntry->bSound = _FALSE;
- //rtw_hal_set_hwreg(Adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&pBeamInfo->beamforming_cur_idx);
- //beamforming_deinit_entry(Adapter, pEntry->mac_addr);
- beamforming_wk_cmd(Adapter, BEAMFORMING_CTRL_SOUNDING_FAIL, NULL, 0, 1);
- }
-}
-
-void beamforming_enter(PADAPTER adapter, PVOID psta)
-{
- u8 idx = 0xff;
-
- if(beamforming_init_entry(adapter, (struct sta_info *)psta, &idx))
- rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_ENTER, (u8 *)&idx);
-
- //DBG_871X("%s Idx %d\n", __FUNCTION__, idx);
-}
-
-void beamforming_leave(PADAPTER adapter,u8* ra)
-{
- if(ra == NULL)
- beamforming_reset(adapter);
- else
- beamforming_deinit_entry(adapter, ra);
-
- beamforming_notify(adapter);
-}
-
-BEAMFORMING_CAP beamforming_get_beamform_cap(struct beamforming_info *pBeamInfo)
-{
- u8 i;
- BOOLEAN bSelfBeamformer = _FALSE;
- BOOLEAN bSelfBeamformee = _FALSE;
- struct beamforming_entry beamforming_entry;
- BEAMFORMING_CAP beamform_cap = BEAMFORMING_CAP_NONE;
-
- for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
- {
- beamforming_entry = pBeamInfo->beamforming_entry[i];
-
- if(beamforming_entry.bUsed)
- {
- if( (beamforming_entry.beamforming_entry_cap & BEAMFORMEE_CAP_VHT_SU) ||
- (beamforming_entry.beamforming_entry_cap & BEAMFORMEE_CAP_HT_EXPLICIT))
- bSelfBeamformee = _TRUE;
- if( (beamforming_entry.beamforming_entry_cap & BEAMFORMER_CAP_VHT_SU) ||
- (beamforming_entry.beamforming_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT))
- bSelfBeamformer = _TRUE;
- }
-
- if(bSelfBeamformer && bSelfBeamformee)
- i = BEAMFORMING_ENTRY_NUM;
- }
-
- if(bSelfBeamformer)
- beamform_cap |= BEAMFORMER_CAP;
- if(bSelfBeamformee)
- beamform_cap |= BEAMFORMEE_CAP;
-
- return beamform_cap;
-}
-
-void beamforming_watchdog(PADAPTER Adapter)
-{
- struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(( &(Adapter->mlmepriv)));
-
- if(pBeamInfo->beamforming_state != BEAMFORMING_STATE_START)
- return;
-
- beamforming_dym_period(Adapter);
- beamforming_dym_ndpa_rate(Adapter);
-}
-
-void beamforming_wk_hdl(_adapter *padapter, u8 type, u8 *pbuf)
-{
-
-_func_enter_;
-
- switch(type)
- {
- case BEAMFORMING_CTRL_ENTER:
- beamforming_enter(padapter, (PVOID)pbuf);
- break;
-
- case BEAMFORMING_CTRL_LEAVE:
- beamforming_leave(padapter, pbuf);
- break;
-
- case BEAMFORMING_CTRL_SOUNDING_FAIL:
- beamforming_sounding_fail(padapter);
- break;
-
- case BEAMFORMING_CTRL_SOUNDING_CLK:
- rtw_hal_set_hwreg(padapter, HW_VAR_SOUNDING_CLK, NULL);
- break;
-
- default:
- break;
- }
-
-_func_exit_;
-}
-
-u8 beamforming_wk_cmd(_adapter*padapter, s32 type, u8 *pbuf, s32 size, u8 enqueue)
-{
- struct cmd_obj *ph2c;
- struct drvextra_cmd_parm *pdrvextra_cmd_parm;
- struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
- u8 res = _SUCCESS;
-
-_func_enter_;
-
- if(enqueue)
- {
- u8 *wk_buf;
-
- 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((unsigned char *)ph2c, sizeof(struct cmd_obj));
- res= _FAIL;
- goto exit;
- }
-
- if (pbuf != NULL) {
- wk_buf = rtw_zmalloc(size);
- if(wk_buf==NULL){
- rtw_mfree((u8 *)ph2c, sizeof(struct cmd_obj));
- rtw_mfree((u8 *)pdrvextra_cmd_parm, sizeof(struct drvextra_cmd_parm));
- res= _FAIL;
- goto exit;
- }
-
- _rtw_memcpy(wk_buf, pbuf, size);
- } else {
- wk_buf = NULL;
- size = 0;
- }
-
- pdrvextra_cmd_parm->ec_id = BEAMFORMING_WK_CID;
- pdrvextra_cmd_parm->type = type;
- pdrvextra_cmd_parm->size = size;
- pdrvextra_cmd_parm->pbuf = wk_buf;
-
- init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
-
- res = rtw_enqueue_cmd(pcmdpriv, ph2c);
- }
- else
- {
- beamforming_wk_hdl(padapter, type, pbuf);
- }
-
-exit:
-
-_func_exit_;
-
- return res;
-}
-
-#endif //CONFIG_BEAMFORMING
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTW_BEAMFORMING_C_
+
+#include <drv_types.h>
+#include <hal_data.h>
+
+#ifdef CONFIG_BEAMFORMING
+
+struct beamforming_entry *beamforming_get_entry_by_addr(struct mlme_priv *pmlmepriv, u8* ra,u8* idx)
+{
+ u8 i = 0;
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+
+ for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
+ {
+ if( pBeamInfo->beamforming_entry[i].bUsed &&
+ (_rtw_memcmp(ra,pBeamInfo->beamforming_entry[i].mac_addr, ETH_ALEN)))
+ {
+ *idx = i;
+ return &(pBeamInfo->beamforming_entry[i]);
+ }
+ }
+
+ return NULL;
+}
+
+BEAMFORMING_CAP beamforming_get_entry_beam_cap_by_mac_id(PVOID pmlmepriv ,u8 mac_id)
+{
+ u8 i = 0;
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO((struct mlme_priv *)pmlmepriv);
+ BEAMFORMING_CAP BeamformEntryCap = BEAMFORMING_CAP_NONE;
+
+ for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
+ {
+ if( pBeamInfo->beamforming_entry[i].bUsed &&
+ (mac_id == pBeamInfo->beamforming_entry[i].mac_id))
+ {
+ BeamformEntryCap = pBeamInfo->beamforming_entry[i].beamforming_entry_cap;
+ i = BEAMFORMING_ENTRY_NUM;
+ }
+ }
+
+ return BeamformEntryCap;
+}
+
+struct beamforming_entry *beamforming_get_free_entry(struct mlme_priv *pmlmepriv, u8* idx)
+{
+ u8 i = 0;
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+
+ for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
+ {
+ if(pBeamInfo->beamforming_entry[i].bUsed == _FALSE)
+ {
+ *idx = i;
+ return &(pBeamInfo->beamforming_entry[i]);
+ }
+ }
+ return NULL;
+}
+
+
+struct beamforming_entry *beamforming_add_entry(PADAPTER adapter, u8* ra, u16 aid,
+ u16 mac_id, CHANNEL_WIDTH bw, BEAMFORMING_CAP beamfrom_cap, u8* idx)
+{
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ struct beamforming_entry *pEntry = beamforming_get_free_entry(pmlmepriv, idx);
+
+ if(pEntry != NULL)
+ {
+ pEntry->bUsed = _TRUE;
+ pEntry->aid = aid;
+ pEntry->mac_id = mac_id;
+ pEntry->sound_bw = bw;
+ if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
+ {
+ u16 BSSID = ((adapter->eeprompriv.mac_addr[5] & 0xf0) >> 4) ^
+ (adapter->eeprompriv.mac_addr[5] & 0xf); // BSSID[44:47] xor BSSID[40:43]
+ pEntry->p_aid = (aid + BSSID * 32) & 0x1ff; // (dec(A) + dec(B)*32) mod 512
+ }
+ else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
+ {
+ pEntry->p_aid = 0;
+ }
+ else
+ {
+ pEntry->p_aid = ra[5]; // BSSID[39:47]
+ pEntry->p_aid = (pEntry->p_aid << 1) | (ra[4] >> 7 );
+ }
+ _rtw_memcpy(pEntry->mac_addr, ra, ETH_ALEN);
+ pEntry->bSound = _FALSE;
+
+ //3 TODO SW/FW sound period
+ pEntry->sound_period = 200;
+ pEntry->beamforming_entry_cap = beamfrom_cap;
+ pEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
+
+ pEntry->LogSeq = 0xff;
+ pEntry->LogRetryCnt = 0;
+ pEntry->LogSuccessCnt = 0;
+ pEntry->LogStatusFailCnt = 0;
+
+ return pEntry;
+ }
+ else
+ return NULL;
+}
+
+BOOLEAN beamforming_remove_entry(struct mlme_priv *pmlmepriv, u8* ra, u8* idx)
+{
+ struct beamforming_entry *pEntry = beamforming_get_entry_by_addr(pmlmepriv, ra, idx);
+
+ if(pEntry != NULL)
+ {
+ pEntry->bUsed = _FALSE;
+ pEntry->beamforming_entry_cap = BEAMFORMING_CAP_NONE;
+ pEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
+ return _TRUE;
+ }
+ else
+ return _FALSE;
+}
+
+/* Used for BeamformingStart_V1 */
+void beamforming_dym_ndpa_rate(PADAPTER adapter)
+{
+ u16 NDPARate = MGN_6M;
+ PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter);
+
+ if(pHalData->dmpriv.MinUndecoratedPWDBForDM > 30) // link RSSI > 30%
+ NDPARate = MGN_24M;
+ else
+ NDPARate = MGN_6M;
+
+ //BW = CHANNEL_WIDTH_20;
+ NDPARate = NDPARate << 8;
+ rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_RATE, (u8 *)&NDPARate);
+}
+
+void beamforming_dym_period(PADAPTER Adapter)
+{
+ u8 Idx;
+ BOOLEAN bChangePeriod = _FALSE;
+ u16 SoundPeriod_SW, SoundPeriod_FW;
+ PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
+ struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter);
+ struct beamforming_entry *pBeamformEntry;
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(( &Adapter->mlmepriv));
+ struct sounding_info *pSoundInfo = &(pBeamInfo->sounding_info);
+
+ //3 TODO per-client throughput caculation.
+
+ if(pdvobjpriv->traffic_stat.cur_tx_tp + pdvobjpriv->traffic_stat.cur_rx_tp > 2)
+ {
+ SoundPeriod_SW = 32*20;
+ SoundPeriod_FW = 2;
+ }
+ else
+ {
+ SoundPeriod_SW = 32*2000;
+ SoundPeriod_FW = 200;
+ }
+
+ for(Idx = 0; Idx < BEAMFORMING_ENTRY_NUM; Idx++)
+ {
+ pBeamformEntry = pBeamInfo->beamforming_entry+Idx;
+ if(pBeamformEntry->bDefaultCSI)
+ {
+ SoundPeriod_SW = 32*2000;
+ SoundPeriod_FW = 200;
+ }
+
+ if(pBeamformEntry->beamforming_entry_cap & (BEAMFORMER_CAP_HT_EXPLICIT |BEAMFORMER_CAP_VHT_SU))
+ {
+ if(pSoundInfo->sound_mode == SOUNDING_FW_VHT_TIMER || pSoundInfo->sound_mode == SOUNDING_FW_HT_TIMER)
+ {
+ if(pBeamformEntry->sound_period != SoundPeriod_FW)
+ {
+ pBeamformEntry->sound_period = SoundPeriod_FW;
+ bChangePeriod = _TRUE; // Only FW sounding need to send H2C packet to change sound period.
+ }
+ }
+ else if(pBeamformEntry->sound_period != SoundPeriod_SW)
+ {
+ pBeamformEntry->sound_period = SoundPeriod_SW;
+ }
+ }
+ }
+
+ if(bChangePeriod)
+ rtw_hal_set_hwreg(Adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&Idx);
+}
+
+u32 beamforming_get_report_frame(PADAPTER Adapter, union recv_frame *precv_frame)
+{
+ u32 ret = _SUCCESS;
+ struct beamforming_entry *pBeamformEntry = NULL;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ u8 *pframe = precv_frame->u.hdr.rx_data;
+ u32 frame_len = precv_frame->u.hdr.len;
+ u8 *ta;
+ u8 idx, offset;
+
+ //DBG_871X("beamforming_get_report_frame\n");
+
+ //Memory comparison to see if CSI report is the same with previous one
+ ta = GetAddr2Ptr(pframe);
+ pBeamformEntry = beamforming_get_entry_by_addr(pmlmepriv, ta, &idx);
+ if(pBeamformEntry->beamforming_entry_cap & BEAMFORMER_CAP_VHT_SU)
+ offset = 31; //24+(1+1+3)+2 MAC header+(Category+ActionCode+MIMOControlField)+SNR(Nc=2)
+ else if(pBeamformEntry->beamforming_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT)
+ offset = 34; //24+(1+1+6)+2 MAC header+(Category+ActionCode+MIMOControlField)+SNR(Nc=2)
+ else
+ return ret;
+
+ //DBG_871X("%s MacId %d offset=%d\n", __FUNCTION__, pBeamformEntry->mac_id, offset);
+
+ if(_rtw_memcmp(pBeamformEntry->PreCsiReport + offset, pframe+offset, frame_len-offset) == _FALSE)
+ {
+ pBeamformEntry->DefaultCsiCnt = 0;
+ //DBG_871X("%s CSI report is NOT the same with previos one\n", __FUNCTION__);
+ }
+ else
+ {
+ pBeamformEntry->DefaultCsiCnt ++;
+ //DBG_871X("%s CSI report is the SAME with previos one\n", __FUNCTION__);
+ }
+ _rtw_memcpy(&pBeamformEntry->PreCsiReport, pframe, frame_len);
+
+ pBeamformEntry->bDefaultCSI = _FALSE;
+
+ if(pBeamformEntry->DefaultCsiCnt > 20)
+ pBeamformEntry->bDefaultCSI = _TRUE;
+ else
+ pBeamformEntry->bDefaultCSI = _FALSE;
+
+ return ret;
+}
+
+void beamforming_get_ndpa_frame(PADAPTER Adapter, union recv_frame *precv_frame)
+{
+ u8 *ta;
+ u8 idx, Sequence;
+ u8 *pframe = precv_frame->u.hdr.rx_data;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ struct beamforming_entry *pBeamformEntry = NULL;
+
+ //DBG_871X("beamforming_get_ndpa_frame\n");
+
+ if(IS_HARDWARE_TYPE_8812(Adapter) == _FALSE)
+ return;
+ else if(GetFrameSubType(pframe) != WIFI_NDPA)
+ return;
+
+ ta = GetAddr2Ptr(pframe);
+ // Remove signaling TA.
+ ta[0] = ta[0] & 0xFE;
+
+ pBeamformEntry = beamforming_get_entry_by_addr(pmlmepriv, ta, &idx);
+
+ if(pBeamformEntry == NULL)
+ return;
+ else if(!(pBeamformEntry->beamforming_entry_cap & BEAMFORMEE_CAP_VHT_SU))
+ return;
+ else if(pBeamformEntry->LogSuccessCnt > 1)
+ return;
+
+ Sequence = (pframe[16]) >> 2;
+
+ if(pBeamformEntry->LogSeq != Sequence)
+ {
+ /* Previous frame doesn't retry when meet new sequence number */
+ if(pBeamformEntry->LogSeq != 0xff && pBeamformEntry->LogRetryCnt == 0)
+ pBeamformEntry->LogSuccessCnt++;
+
+ pBeamformEntry->LogSeq = Sequence;
+ pBeamformEntry->LogRetryCnt = 0;
+ }
+ else
+ {
+ if(pBeamformEntry->LogRetryCnt == 3)
+ beamforming_wk_cmd(Adapter, BEAMFORMING_CTRL_SOUNDING_CLK, NULL, 0, 1);
+
+ pBeamformEntry->LogRetryCnt++;
+ }
+
+ DBG_871X("%s LogSeq %d LogRetryCnt %d LogSuccessCnt %d\n",
+ __FUNCTION__, pBeamformEntry->LogSeq, pBeamformEntry->LogRetryCnt, pBeamformEntry->LogSuccessCnt);
+}
+
+BOOLEAN issue_ht_ndpa_packet(PADAPTER Adapter, u8 *ra, CHANNEL_WIDTH bw, u8 qidx)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv);
+ struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ u8 ActionHdr[4] = {ACT_CAT_VENDOR, 0x00, 0xe0, 0x4c};
+ u8 *pframe;
+ u16 *fctrl;
+ u16 duration = 0;
+ u8 aSifsTime = 0;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ return _FALSE;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ update_mgntframe_attrib(Adapter, pattrib);
+
+ if (qidx == BCN_QUEUE_INX)
+ pattrib->qsel = 0x10;
+ pattrib->rate = MGN_MCS8;
+ pattrib->bwmode = bw;
+ pattrib->order = 1;
+ pattrib->subtype = WIFI_ACTION_NOACK;
+
+ _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;
+
+ SetOrderBit(pframe);
+ SetFrameSubType(pframe, WIFI_ACTION_NOACK);
+
+ _rtw_memcpy(pwlanhdr->addr1, ra, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(Adapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+
+ if( pmlmeext->cur_wireless_mode == WIRELESS_11B)
+ aSifsTime = 10;
+ else
+ aSifsTime = 16;
+
+ duration = 2*aSifsTime + 40;
+
+ if(bw == CHANNEL_WIDTH_40)
+ duration+= 87;
+ else
+ duration+= 180;
+
+ SetDuration(pframe, duration);
+
+ //HT control field
+ SET_HT_CTRL_CSI_STEERING(pframe+24, 3);
+ SET_HT_CTRL_NDP_ANNOUNCEMENT(pframe+24, 1);
+
+ _rtw_memcpy(pframe+28, ActionHdr, 4);
+
+ pattrib->pktlen = 32;
+
+ pattrib->last_txcmdsz = pattrib->pktlen;
+
+ dump_mgntframe(Adapter, pmgntframe);
+
+ return _TRUE;
+}
+
+BOOLEAN beamforming_send_ht_ndpa_packet(PADAPTER Adapter, u8 *ra, CHANNEL_WIDTH bw, u8 qidx)
+{
+ return issue_ht_ndpa_packet(Adapter, ra, bw, qidx);
+}
+
+BOOLEAN issue_vht_ndpa_packet(PADAPTER Adapter, u8 *ra, u16 aid, CHANNEL_WIDTH bw, u8 qidx)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv);
+ struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+ struct rtw_ndpa_sta_info sta_info;
+ u8 *pframe;
+ u16 *fctrl;
+ u16 duration = 0;
+ u8 sequence = 0, aSifsTime = 0;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ return _FALSE;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ update_mgntframe_attrib(Adapter, pattrib);
+
+ if (qidx == BCN_QUEUE_INX)
+ pattrib->qsel = 0x10;
+ pattrib->rate = MGN_VHT2SS_MCS0;
+ pattrib->bwmode = bw;
+ pattrib->subtype = WIFI_NDPA;
+
+ _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;
+
+ SetFrameSubType(pframe, WIFI_NDPA);
+
+ _rtw_memcpy(pwlanhdr->addr1, ra, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(Adapter->eeprompriv)), ETH_ALEN);
+
+ if (IsSupported5G(pmlmeext->cur_wireless_mode) || IsSupportedHT(pmlmeext->cur_wireless_mode))
+ aSifsTime = 16;
+ else
+ aSifsTime = 10;
+
+ duration = 2*aSifsTime + 44;
+
+ if(bw == CHANNEL_WIDTH_80)
+ duration += 40;
+ else if(bw == CHANNEL_WIDTH_40)
+ duration+= 87;
+ else
+ duration+= 180;
+
+ SetDuration(pframe, duration);
+
+ sequence = pBeamInfo->sounding_sequence<< 2;
+ if (pBeamInfo->sounding_sequence >= 0x3f)
+ pBeamInfo->sounding_sequence = 0;
+ else
+ pBeamInfo->sounding_sequence++;
+
+ _rtw_memcpy(pframe+16, &sequence,1);
+
+ if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
+ aid = 0;
+
+ sta_info.aid = aid;
+ sta_info.feedback_type = 0;
+ sta_info.nc_index= 0;
+
+ _rtw_memcpy(pframe+17, (u8 *)&sta_info, 2);
+
+ pattrib->pktlen = 19;
+
+ pattrib->last_txcmdsz = pattrib->pktlen;
+
+ dump_mgntframe(Adapter, pmgntframe);
+
+ return _TRUE;
+}
+
+BOOLEAN beamforming_send_vht_ndpa_packet(PADAPTER Adapter, u8 *ra, u16 aid, CHANNEL_WIDTH bw, u8 qidx)
+{
+ return issue_vht_ndpa_packet(Adapter, ra, aid, bw, qidx);
+}
+
+BOOLEAN beamfomring_bSounding(struct beamforming_info *pBeamInfo)
+{
+ BOOLEAN bSounding = _FALSE;
+
+ if(( beamforming_get_beamform_cap(pBeamInfo) & BEAMFORMER_CAP) == 0)
+ bSounding = _FALSE;
+ else
+ bSounding = _TRUE;
+
+ return bSounding;
+}
+
+u8 beamforming_sounding_idx(struct beamforming_info *pBeamInfo)
+{
+ u8 idx = 0;
+ u8 i;
+
+ for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
+ {
+ if (pBeamInfo->beamforming_entry[i].bUsed &&
+ (_FALSE == pBeamInfo->beamforming_entry[i].bSound))
+ {
+ idx = i;
+ break;
+ }
+ }
+
+ return idx;
+}
+
+SOUNDING_MODE beamforming_sounding_mode(struct beamforming_info *pBeamInfo, u8 idx)
+{
+ struct beamforming_entry BeamEntry = pBeamInfo->beamforming_entry[idx];
+ SOUNDING_MODE mode;
+
+ if(BeamEntry.beamforming_entry_cap & BEAMFORMER_CAP_VHT_SU)
+ {
+ mode = SOUNDING_FW_VHT_TIMER;
+ }
+ else if(BeamEntry.beamforming_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT)
+ {
+ mode = SOUNDING_FW_HT_TIMER;
+ }
+ else
+ {
+ mode = SOUNDING_STOP_All_TIMER;
+ }
+
+ return mode;
+}
+
+u16 beamforming_sounding_time(struct beamforming_info *pBeamInfo, SOUNDING_MODE mode, u8 idx)
+{
+ u16 sounding_time = 0xffff;
+ struct beamforming_entry BeamEntry = pBeamInfo->beamforming_entry[idx];
+
+ sounding_time = BeamEntry.sound_period;
+
+ return sounding_time;
+}
+
+CHANNEL_WIDTH beamforming_sounding_bw(struct beamforming_info *pBeamInfo, SOUNDING_MODE mode, u8 idx)
+{
+ CHANNEL_WIDTH sounding_bw = CHANNEL_WIDTH_20;
+ struct beamforming_entry BeamEntry = pBeamInfo->beamforming_entry[idx];
+
+ sounding_bw = BeamEntry.sound_bw;
+
+ return sounding_bw;
+}
+
+BOOLEAN beamforming_select_beam_entry(struct beamforming_info *pBeamInfo)
+{
+ struct sounding_info *pSoundInfo = &(pBeamInfo->sounding_info);
+
+ pSoundInfo->sound_idx = beamforming_sounding_idx(pBeamInfo);
+
+ if(pSoundInfo->sound_idx < BEAMFORMING_ENTRY_NUM)
+ pSoundInfo->sound_mode = beamforming_sounding_mode(pBeamInfo, pSoundInfo->sound_idx);
+ else
+ pSoundInfo->sound_mode = SOUNDING_STOP_All_TIMER;
+
+ if(SOUNDING_STOP_All_TIMER == pSoundInfo->sound_mode)
+ {
+ return _FALSE;
+ }
+ else
+ {
+ pSoundInfo->sound_bw = beamforming_sounding_bw(pBeamInfo, pSoundInfo->sound_mode, pSoundInfo->sound_idx );
+ pSoundInfo->sound_period = beamforming_sounding_time(pBeamInfo, pSoundInfo->sound_mode, pSoundInfo->sound_idx );
+ return _TRUE;
+ }
+}
+
+BOOLEAN beamforming_start_fw(PADAPTER adapter, u8 idx)
+{
+ u8 *RA = NULL;
+ struct beamforming_entry *pEntry;
+ BOOLEAN ret = _TRUE;
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+
+ pEntry = &(pBeamInfo->beamforming_entry[idx]);
+ if(pEntry->bUsed == _FALSE)
+ {
+ DBG_871X("Skip Beamforming, no entry for Idx =%d\n", idx);
+ return _FALSE;
+ }
+
+ pEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_PROGRESSING;
+ pEntry->bSound = _TRUE;
+ rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&idx);
+
+ return _TRUE;
+}
+
+void beamforming_end_fw(PADAPTER adapter)
+{
+ u8 idx = 0;
+
+ rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&idx);
+
+ DBG_871X("%s\n", __FUNCTION__);
+}
+
+BOOLEAN beamforming_start_period(PADAPTER adapter)
+{
+ BOOLEAN ret = _TRUE;
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+ struct sounding_info *pSoundInfo = &(pBeamInfo->sounding_info);
+
+ beamforming_dym_ndpa_rate(adapter);
+
+ beamforming_select_beam_entry(pBeamInfo);
+
+ if(pSoundInfo->sound_mode == SOUNDING_FW_VHT_TIMER || pSoundInfo->sound_mode == SOUNDING_FW_HT_TIMER)
+ {
+ ret = beamforming_start_fw(adapter, pSoundInfo->sound_idx);
+ }
+ else
+ {
+ ret = _FALSE;
+ }
+
+ DBG_871X("%s Idx %d Mode %d BW %d Period %d\n", __FUNCTION__,
+ pSoundInfo->sound_idx, pSoundInfo->sound_mode, pSoundInfo->sound_bw, pSoundInfo->sound_period);
+
+ return ret;
+}
+
+void beamforming_end_period(PADAPTER adapter)
+{
+ u8 idx = 0;
+ struct beamforming_entry *pBeamformEntry;
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+ struct sounding_info *pSoundInfo = &(pBeamInfo->sounding_info);
+
+
+ if(pSoundInfo->sound_mode == SOUNDING_FW_VHT_TIMER || pSoundInfo->sound_mode == SOUNDING_FW_HT_TIMER)
+ {
+ beamforming_end_fw(adapter);
+ }
+}
+
+void beamforming_notify(PADAPTER adapter)
+{
+ BOOLEAN bSounding = _FALSE;
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(&(adapter->mlmepriv));
+
+ bSounding = beamfomring_bSounding(pBeamInfo);
+
+ if(pBeamInfo->beamforming_state == BEAMFORMING_STATE_IDLE)
+ {
+ if(bSounding)
+ {
+ if(beamforming_start_period(adapter) == _TRUE)
+ pBeamInfo->beamforming_state = BEAMFORMING_STATE_START;
+ }
+ }
+ else if(pBeamInfo->beamforming_state == BEAMFORMING_STATE_START)
+ {
+ if(bSounding)
+ {
+ if(beamforming_start_period(adapter) == _FALSE)
+ pBeamInfo->beamforming_state = BEAMFORMING_STATE_END;
+ }
+ else
+ {
+ beamforming_end_period(adapter);
+ pBeamInfo->beamforming_state = BEAMFORMING_STATE_END;
+ }
+ }
+ else if(pBeamInfo->beamforming_state == BEAMFORMING_STATE_END)
+ {
+ if(bSounding)
+ {
+ if(beamforming_start_period(adapter) == _TRUE)
+ pBeamInfo->beamforming_state = BEAMFORMING_STATE_START;
+ }
+ }
+ else
+ {
+ DBG_871X("%s BeamformState %d\n", __FUNCTION__, pBeamInfo->beamforming_state);
+ }
+
+ DBG_871X("%s BeamformState %d bSounding %d\n", __FUNCTION__, pBeamInfo->beamforming_state, bSounding);
+}
+
+BOOLEAN beamforming_init_entry(PADAPTER adapter, struct sta_info *psta, u8* idx)
+{
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ struct ht_priv *phtpriv = &(pmlmepriv->htpriv);
+#ifdef CONFIG_80211AC_VHT
+ struct vht_priv *pvhtpriv = &(pmlmepriv->vhtpriv);
+#endif
+ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct beamforming_entry *pBeamformEntry = NULL;
+ u8 *ra;
+ u16 aid, mac_id;
+ u8 wireless_mode;
+ CHANNEL_WIDTH bw = CHANNEL_WIDTH_20;
+ BEAMFORMING_CAP beamform_cap = BEAMFORMING_CAP_NONE;
+
+ // The current setting does not support Beaforming
+ if (0 == phtpriv->beamform_cap
+#ifdef CONFIG_80211AC_VHT
+ && 0 == pvhtpriv->beamform_cap
+#endif
+ ) {
+ DBG_871X("The configuration disabled Beamforming! Skip...\n");
+ return _FALSE;
+ }
+
+ aid = psta->aid;
+ ra = psta->hwaddr;
+ mac_id = psta->mac_id;
+ wireless_mode = psta->wireless_mode;
+ bw = psta->bw_mode;
+
+ if (IsSupportedHT(wireless_mode) || IsSupportedVHT(wireless_mode)) {
+ //3 // HT
+ u8 cur_beamform;
+
+ cur_beamform = psta->htpriv.beamform_cap;
+
+ // We are Beamformee because the STA is Beamformer
+ if(TEST_FLAG(cur_beamform, BEAMFORMING_HT_BEAMFORMER_ENABLE))
+ beamform_cap =(BEAMFORMING_CAP)(beamform_cap |BEAMFORMEE_CAP_HT_EXPLICIT);
+
+ // We are Beamformer because the STA is Beamformee
+ if(TEST_FLAG(cur_beamform, BEAMFORMING_HT_BEAMFORMEE_ENABLE))
+ beamform_cap =(BEAMFORMING_CAP)(beamform_cap | BEAMFORMER_CAP_HT_EXPLICIT);
+#ifdef CONFIG_80211AC_VHT
+ if (IsSupportedVHT(wireless_mode)) {
+ //3 // VHT
+ cur_beamform = psta->vhtpriv.beamform_cap;
+
+ // We are Beamformee because the STA is Beamformer
+ if(TEST_FLAG(cur_beamform, BEAMFORMING_VHT_BEAMFORMER_ENABLE))
+ beamform_cap =(BEAMFORMING_CAP)(beamform_cap |BEAMFORMEE_CAP_VHT_SU);
+ // We are Beamformer because the STA is Beamformee
+ if(TEST_FLAG(cur_beamform, BEAMFORMING_VHT_BEAMFORMEE_ENABLE))
+ beamform_cap =(BEAMFORMING_CAP)(beamform_cap |BEAMFORMER_CAP_VHT_SU);
+ }
+#endif //CONFIG_80211AC_VHT
+
+ if(beamform_cap == BEAMFORMING_CAP_NONE)
+ return _FALSE;
+
+ DBG_871X("Beamforming Config Capability = 0x%02X\n", beamform_cap);
+
+ pBeamformEntry = beamforming_get_entry_by_addr(pmlmepriv, ra, idx);
+ if (pBeamformEntry == NULL) {
+ pBeamformEntry = beamforming_add_entry(adapter, ra, aid, mac_id, bw, beamform_cap, idx);
+ if(pBeamformEntry == NULL)
+ return _FALSE;
+ else
+ pBeamformEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZEING;
+ } else {
+ // Entry has been created. If entry is initialing or progressing then errors occur.
+ if (pBeamformEntry->beamforming_entry_state != BEAMFORMING_ENTRY_STATE_INITIALIZED &&
+ pBeamformEntry->beamforming_entry_state != BEAMFORMING_ENTRY_STATE_PROGRESSED) {
+ DBG_871X("Error State of Beamforming");
+ return _FALSE;
+ } else {
+ pBeamformEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZEING;
+ }
+ }
+
+ pBeamformEntry->beamforming_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZED;
+
+ DBG_871X("%s Idx %d\n", __FUNCTION__, *idx);
+ } else {
+ return _FALSE;
+ }
+
+ return _SUCCESS;
+}
+
+void beamforming_deinit_entry(PADAPTER adapter, u8* ra)
+{
+ u8 idx = 0;
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+
+ if(beamforming_remove_entry(pmlmepriv, ra, &idx) == _TRUE)
+ {
+ rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_LEAVE, (u8 *)&idx);
+ }
+
+ DBG_871X("%s Idx %d\n", __FUNCTION__, idx);
+}
+
+void beamforming_reset(PADAPTER adapter)
+{
+ u8 idx = 0;
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+
+ for(idx = 0; idx < BEAMFORMING_ENTRY_NUM; idx++)
+ {
+ if(pBeamInfo->beamforming_entry[idx].bUsed == _TRUE)
+ {
+ pBeamInfo->beamforming_entry[idx].bUsed = _FALSE;
+ pBeamInfo->beamforming_entry[idx].beamforming_entry_cap = BEAMFORMING_CAP_NONE;
+ pBeamInfo->beamforming_entry[idx].beamforming_entry_state= BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
+ rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_LEAVE, (u8 *)&idx);
+ }
+ }
+
+ DBG_871X("%s\n", __FUNCTION__);
+}
+
+void beamforming_sounding_fail(PADAPTER Adapter)
+{
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+ struct beamforming_entry *pEntry = &(pBeamInfo->beamforming_entry[pBeamInfo->beamforming_cur_idx]);
+
+ pEntry->bSound = _FALSE;
+ rtw_hal_set_hwreg(Adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&pBeamInfo->beamforming_cur_idx);
+ beamforming_deinit_entry(Adapter, pEntry->mac_addr);
+}
+
+void beamforming_check_sounding_success(PADAPTER Adapter,BOOLEAN status)
+{
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(pmlmepriv);
+ struct beamforming_entry *pEntry = &(pBeamInfo->beamforming_entry[pBeamInfo->beamforming_cur_idx]);
+
+ if(status == 1)
+ {
+ pEntry->LogStatusFailCnt = 0;
+ }
+ else
+ {
+ pEntry->LogStatusFailCnt++;
+ DBG_871X("%s LogStatusFailCnt %d\n", __FUNCTION__, pEntry->LogStatusFailCnt);
+ }
+ if(pEntry->LogStatusFailCnt > 20)
+ {
+ DBG_871X("%s LogStatusFailCnt > 20, Stop SOUNDING\n", __FUNCTION__);
+ //pEntry->bSound = _FALSE;
+ //rtw_hal_set_hwreg(Adapter, HW_VAR_SOUNDING_FW_NDPA, (u8 *)&pBeamInfo->beamforming_cur_idx);
+ //beamforming_deinit_entry(Adapter, pEntry->mac_addr);
+ beamforming_wk_cmd(Adapter, BEAMFORMING_CTRL_SOUNDING_FAIL, NULL, 0, 1);
+ }
+}
+
+void beamforming_enter(PADAPTER adapter, PVOID psta)
+{
+ u8 idx = 0xff;
+
+ if(beamforming_init_entry(adapter, (struct sta_info *)psta, &idx))
+ rtw_hal_set_hwreg(adapter, HW_VAR_SOUNDING_ENTER, (u8 *)&idx);
+
+ //DBG_871X("%s Idx %d\n", __FUNCTION__, idx);
+}
+
+void beamforming_leave(PADAPTER adapter,u8* ra)
+{
+ if(ra == NULL)
+ beamforming_reset(adapter);
+ else
+ beamforming_deinit_entry(adapter, ra);
+
+ beamforming_notify(adapter);
+}
+
+BEAMFORMING_CAP beamforming_get_beamform_cap(struct beamforming_info *pBeamInfo)
+{
+ u8 i;
+ BOOLEAN bSelfBeamformer = _FALSE;
+ BOOLEAN bSelfBeamformee = _FALSE;
+ struct beamforming_entry beamforming_entry;
+ BEAMFORMING_CAP beamform_cap = BEAMFORMING_CAP_NONE;
+
+ for(i = 0; i < BEAMFORMING_ENTRY_NUM; i++)
+ {
+ beamforming_entry = pBeamInfo->beamforming_entry[i];
+
+ if(beamforming_entry.bUsed)
+ {
+ if( (beamforming_entry.beamforming_entry_cap & BEAMFORMEE_CAP_VHT_SU) ||
+ (beamforming_entry.beamforming_entry_cap & BEAMFORMEE_CAP_HT_EXPLICIT))
+ bSelfBeamformee = _TRUE;
+ if( (beamforming_entry.beamforming_entry_cap & BEAMFORMER_CAP_VHT_SU) ||
+ (beamforming_entry.beamforming_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT))
+ bSelfBeamformer = _TRUE;
+ }
+
+ if(bSelfBeamformer && bSelfBeamformee)
+ i = BEAMFORMING_ENTRY_NUM;
+ }
+
+ if(bSelfBeamformer)
+ beamform_cap |= BEAMFORMER_CAP;
+ if(bSelfBeamformee)
+ beamform_cap |= BEAMFORMEE_CAP;
+
+ return beamform_cap;
+}
+
+void beamforming_watchdog(PADAPTER Adapter)
+{
+ struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(( &(Adapter->mlmepriv)));
+
+ if(pBeamInfo->beamforming_state != BEAMFORMING_STATE_START)
+ return;
+
+ beamforming_dym_period(Adapter);
+ beamforming_dym_ndpa_rate(Adapter);
+}
+
+void beamforming_wk_hdl(_adapter *padapter, u8 type, u8 *pbuf)
+{
+
+_func_enter_;
+
+ switch(type)
+ {
+ case BEAMFORMING_CTRL_ENTER:
+ beamforming_enter(padapter, (PVOID)pbuf);
+ break;
+
+ case BEAMFORMING_CTRL_LEAVE:
+ beamforming_leave(padapter, pbuf);
+ break;
+
+ case BEAMFORMING_CTRL_SOUNDING_FAIL:
+ beamforming_sounding_fail(padapter);
+ break;
+
+ case BEAMFORMING_CTRL_SOUNDING_CLK:
+ rtw_hal_set_hwreg(padapter, HW_VAR_SOUNDING_CLK, NULL);
+ break;
+
+ default:
+ break;
+ }
+
+_func_exit_;
+}
+
+u8 beamforming_wk_cmd(_adapter*padapter, s32 type, u8 *pbuf, s32 size, u8 enqueue)
+{
+ struct cmd_obj *ph2c;
+ struct drvextra_cmd_parm *pdrvextra_cmd_parm;
+ struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
+ u8 res = _SUCCESS;
+
+_func_enter_;
+
+ if(enqueue)
+ {
+ u8 *wk_buf;
+
+ 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((unsigned char *)ph2c, sizeof(struct cmd_obj));
+ res= _FAIL;
+ goto exit;
+ }
+
+ if (pbuf != NULL) {
+ wk_buf = rtw_zmalloc(size);
+ if(wk_buf==NULL){
+ rtw_mfree((u8 *)ph2c, sizeof(struct cmd_obj));
+ rtw_mfree((u8 *)pdrvextra_cmd_parm, sizeof(struct drvextra_cmd_parm));
+ res= _FAIL;
+ goto exit;
+ }
+
+ _rtw_memcpy(wk_buf, pbuf, size);
+ } else {
+ wk_buf = NULL;
+ size = 0;
+ }
+
+ pdrvextra_cmd_parm->ec_id = BEAMFORMING_WK_CID;
+ pdrvextra_cmd_parm->type = type;
+ pdrvextra_cmd_parm->size = size;
+ pdrvextra_cmd_parm->pbuf = wk_buf;
+
+ init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
+
+ res = rtw_enqueue_cmd(pcmdpriv, ph2c);
+ }
+ else
+ {
+ beamforming_wk_hdl(padapter, type, pbuf);
+ }
+
+exit:
+
+_func_exit_;
+
+ return res;
+}
+
+#endif //CONFIG_BEAMFORMING
+
diff --git a/rtl8xxx_EU/core/rtw_br_ext.c b/rtl8xxx_EU/core/rtw_br_ext.c
index 88a517a..827095a 100755
--- a/rtl8xxx_EU/core/rtw_br_ext.c
+++ b/rtl8xxx_EU/core/rtw_br_ext.c
@@ -19,6 +19,7 @@
******************************************************************************/
#define _RTW_BR_EXT_C_
+#include <net/ip6_checksum.h>
#ifdef __KERNEL__
#include <linux/if_arp.h>
#include <net/ip.h>
diff --git a/rtl8xxx_EU/core/rtw_bt_mp.c b/rtl8xxx_EU/core/rtw_bt_mp.c
index 63fbf9e..0f74248 100755
--- a/rtl8xxx_EU/core/rtw_bt_mp.c
+++ b/rtl8xxx_EU/core/rtw_bt_mp.c
@@ -1,1779 +1,1779 @@
-/******************************************************************************
- *
- * 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 <drv_types.h>
-#include <rtw_bt_mp.h>
-
-#ifdef CONFIG_RTL8723A
-#include <rtl8723a_hal.h>
-#elif defined(CONFIG_RTL8723B)
-#include <rtl8723b_hal.h>
-#endif
-
-#if defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8821A)
-void MPh2c_timeout_handle(void *FunctionContext)
-{
- PADAPTER pAdapter;
- PMPT_CONTEXT pMptCtx;
-
-
- DBG_8192C("[MPT], MPh2c_timeout_handle \n");
-
- pAdapter = (PADAPTER)FunctionContext;
- pMptCtx = &pAdapter->mppriv.MptCtx;
-
- pMptCtx->bMPh2c_timeout = _TRUE;
-
- if ((_FALSE == pMptCtx->MptH2cRspEvent)
- || ((_TRUE == pMptCtx->MptH2cRspEvent)
- && (_FALSE == pMptCtx->MptBtC2hEvent)))
- {
- _rtw_up_sema(&pMptCtx->MPh2c_Sema);
- }
-}
-
-u32 WaitC2Hevent(PADAPTER pAdapter, u8 *C2H_event, u32 delay_time)
-{
- PMPT_CONTEXT pMptCtx=&(pAdapter->mppriv.MptCtx);
- pMptCtx->bMPh2c_timeout=_FALSE;
-
- if( pAdapter->registrypriv.mp_mode == 0 )
- {
- DBG_8192C("[MPT], Error!! WaitC2Hevent mp_mode == 0!!\n");
- return _FALSE;
- }
-
- _set_timer( &pMptCtx->MPh2c_timeout_timer, delay_time );
-
- _rtw_down_sema(&pMptCtx->MPh2c_Sema);
-
- if (pMptCtx->bMPh2c_timeout == _TRUE)
- {
- *C2H_event = _FALSE;
-
- return _FALSE;
- }
-
- // for safty, cancel timer here again
- _cancel_timer_ex(&pMptCtx->MPh2c_timeout_timer);
-
- return _TRUE;
-}
-
-BT_CTRL_STATUS
-mptbt_CheckC2hFrame(
- PADAPTER Adapter,
- PBT_H2C pH2c,
- PBT_EXT_C2H pExtC2h
- )
-{
- BT_CTRL_STATUS c2hStatus = BT_STATUS_C2H_SUCCESS;
-
- //DBG_8192C("[MPT], MPT rsp C2H hex: %x %x %x %x %x %x \n"), pExtC2h , pExtC2h+1 ,pExtC2h+2 ,pExtC2h+3 ,pExtC2h+4 ,pExtC2h+5);
-
- DBG_8192C("[MPT], statusCode = 0x%x\n", pExtC2h->statusCode);
- DBG_8192C("[MPT], retLen = %d\n", pExtC2h->retLen);
- DBG_8192C("[MPT], opCodeVer : req/rsp=%d/%d\n", pH2c->opCodeVer, pExtC2h->opCodeVer);
- DBG_8192C("[MPT], reqNum : req/rsp=%d/%d\n", pH2c->reqNum, pExtC2h->reqNum);
- if(pExtC2h->reqNum != pH2c->reqNum)
- {
- c2hStatus = BT_STATUS_C2H_REQNUM_MISMATCH;
- DBG_8192C("[MPT], Error!! C2H reqNum Mismatch!!\n");
- }
- else if(pExtC2h->opCodeVer != pH2c->opCodeVer)
- {
- c2hStatus = BT_STATUS_OPCODE_L_VERSION_MISMATCH;
- DBG_8192C("[MPT], Error!! OPCode version L mismatch!!\n");
- }
-
- 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,
- PBT_H2C pH2c,
- u2Byte h2cCmdLen
- )
-{
- //KIRQL OldIrql = KeGetCurrentIrql();
- BT_CTRL_STATUS h2cStatus=BT_STATUS_H2C_SUCCESS;
- PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
- u1Byte i;
-
- DBG_8192C("[MPT], mptbt_SendH2c()=========>\n");
-
- //PlatformResetEvent(&pMptCtx->MptH2cRspEvent);
- //PlatformResetEvent(&pMptCtx->MptBtC2hEvent);
-
-// if(OldIrql == PASSIVE_LEVEL)
-// {
- //RTPRINT_DATA(FMPBT, FMPBT_H2C_CONTENT, ("[MPT], MPT H2C hex: \n"), pH2c, h2cCmdLen);
-
- for(i=0; i<BT_H2C_MAX_RETRY; i++)
- {
- DBG_8192C("[MPT], Send H2C command to wifi!!!\n");
-
- pMptCtx->MptH2cRspEvent = _FALSE;
- pMptCtx->MptBtC2hEvent = _FALSE;
-
-#if defined(CONFIG_RTL8723A)
- FillH2CCmd(Adapter, 70, h2cCmdLen, (pu1Byte)pH2c);
-#elif defined(CONFIG_RTL8723B)
- rtl8723b_set_FwBtMpOper_cmd(Adapter, pH2c->opCode, pH2c->opCodeVer, pH2c->reqNum, pH2c->buf);
-#endif
- pMptCtx->h2cReqNum++;
- pMptCtx->h2cReqNum %= 16;
-
- if(WaitC2Hevent(Adapter, &pMptCtx->MptH2cRspEvent, 100))
- {
- DBG_8192C("[MPT], Received WiFi MptH2cRspEvent!!!\n");
- if(WaitC2Hevent(Adapter, &pMptCtx->MptBtC2hEvent, 400))
- {
- DBG_8192C("[MPT], Received MptBtC2hEvent!!!\n");
- break;
- }
- else
- {
- DBG_8192C("[MPT], Error!!BT MptBtC2hEvent timeout!!\n");
- h2cStatus = BT_STATUS_H2C_BT_NO_RSP;
- }
- }
- else
- {
- DBG_8192C("[MPT], Error!!WiFi MptH2cRspEvent timeout!!\n");
- h2cStatus = BT_STATUS_H2C_TIMTOUT;
- }
- }
-// }
-// else
-// {
-// RT_ASSERT(FALSE, ("[MPT], mptbt_SendH2c() can only run under PASSIVE_LEVEL!!\n"));
-// h2cStatus = BT_STATUS_WRONG_LEVEL;
-// }
-
- DBG_8192C("[MPT], mptbt_SendH2c()<=========\n");
- return h2cStatus;
-}
-
-
-
-BT_CTRL_STATUS
-mptbt_CheckBtRspStatus(
- PADAPTER Adapter,
- PBT_EXT_C2H pExtC2h
- )
-{
- BT_CTRL_STATUS retStatus=BT_OP_STATUS_SUCCESS;
-
- switch(pExtC2h->statusCode)
- {
- case BT_OP_STATUS_SUCCESS:
- retStatus = BT_STATUS_BT_OP_SUCCESS;
- DBG_8192C("[MPT], BT status : BT_STATUS_SUCCESS\n");
- break;
- case BT_OP_STATUS_VERSION_MISMATCH:
- retStatus = BT_STATUS_OPCODE_L_VERSION_MISMATCH;
- DBG_8192C("[MPT], BT status : BT_STATUS_OPCODE_L_VERSION_MISMATCH\n");
- break;
- case BT_OP_STATUS_UNKNOWN_OPCODE:
- retStatus = BT_STATUS_UNKNOWN_OPCODE_L;
- DBG_8192C("[MPT], BT status : BT_STATUS_UNKNOWN_OPCODE_L\n");
- break;
- case BT_OP_STATUS_ERROR_PARAMETER:
- retStatus = BT_STATUS_PARAMETER_FORMAT_ERROR_L;
- DBG_8192C("[MPT], BT status : BT_STATUS_PARAMETER_FORMAT_ERROR_L\n");
- break;
- default:
- retStatus = BT_STATUS_UNKNOWN_STATUS_L;
- DBG_8192C("[MPT], BT status : BT_STATUS_UNKNOWN_STATUS_L\n");
- break;
- }
-
- return retStatus;
-}
-
-
-
-BT_CTRL_STATUS
-mptbt_BtFwOpCodeProcess(
- PADAPTER Adapter,
- u1Byte btFwOpCode,
- u1Byte opCodeVer,
- pu1Byte pH2cPar,
- u1Byte h2cParaLen
- )
-{
- u1Byte H2C_Parameter[6] ={0};
- PBT_H2C pH2c=(PBT_H2C)&H2C_Parameter[0];
- PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
- PBT_EXT_C2H pExtC2h=(PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
- u2Byte paraLen=0,i;
- BT_CTRL_STATUS h2cStatus=BT_STATUS_H2C_SUCCESS, c2hStatus=BT_STATUS_C2H_SUCCESS;
- BT_CTRL_STATUS retStatus=BT_STATUS_H2C_BT_NO_RSP;
-
- if( Adapter->registrypriv.mp_mode == 0 )
- {
- DBG_8192C("[MPT], Error!! mptbt_BtFwOpCodeProces mp_mode == 0!!\n");
- return _FALSE;
- }
-
- pH2c->opCode = btFwOpCode;
- pH2c->opCodeVer = opCodeVer;
- pH2c->reqNum = pMptCtx->h2cReqNum;
- //PlatformMoveMemory(&pH2c->buf[0], pH2cPar, h2cParaLen);
- //_rtw_memcpy(&pH2c->buf[0], pH2cPar, h2cParaLen);
- _rtw_memcpy(pH2c->buf, pH2cPar, h2cParaLen);
-
- DBG_8192C("[MPT], pH2c->opCode=%d\n", pH2c->opCode);
- DBG_8192C("[MPT], pH2c->opCodeVer=%d\n", pH2c->opCodeVer);
- DBG_8192C("[MPT], pH2c->reqNum=%d\n", pH2c->reqNum);
- DBG_8192C("[MPT], h2c parameter length=%d\n", h2cParaLen);
- for (i=0; i<h2cParaLen; i++)
- {
- DBG_8192C("[MPT], parameter[%d]=0x%02x\n", i, pH2c->buf[i]);
- }
-
- h2cStatus = mptbt_SendH2c(Adapter, pH2c, h2cParaLen+2);
- if(BT_STATUS_H2C_SUCCESS == h2cStatus)
- {
- // if reach here, it means H2C get the correct c2h response,
- c2hStatus = mptbt_CheckC2hFrame(Adapter, pH2c, pExtC2h);
- if(BT_STATUS_C2H_SUCCESS == c2hStatus)
- {
- retStatus = mptbt_CheckBtRspStatus(Adapter, pExtC2h);
- }
- else
- {
- DBG_8192C("[MPT], Error!! C2H failed for pH2c->opCode=%d\n", pH2c->opCode);
- // check c2h status error, return error status code to upper layer.
- retStatus = c2hStatus;
- }
- }
- else
- {
- DBG_8192C("[MPT], Error!! H2C failed for pH2c->opCode=%d\n", pH2c->opCode);
- // check h2c status error, return error status code to upper layer.
- retStatus = h2cStatus;
- }
-
- return retStatus;
-}
-
-
-
-
-u2Byte
-mptbt_BtReady(
- PADAPTER Adapter,
- PBT_REQ_CMD pBtReq,
- PBT_RSP_CMD pBtRsp
- )
-{
- u1Byte h2cParaBuf[6] ={0};
- u1Byte h2cParaLen=0;
- u2Byte paraLen=0;
- u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
- u1Byte btOpcode;
- u1Byte btOpcodeVer=0;
- PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
- PBT_EXT_C2H pExtC2h=(PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
- u1Byte i;
- u1Byte btFwVer=0, bdAddr[6]={0};
- u2Byte btRealFwVer=0;
- pu2Byte pu2Tmp=NULL;
-
- //
- // check upper layer parameters
- //
-
- // 1. check upper layer opcode version
- if(pBtReq->opCodeVer != 1)
- {
- DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
- pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
- return paraLen;
- }
-
- pBtRsp->pParamStart[0] = MP_BT_NOT_READY;
- paraLen = 10;
- //
- // execute lower layer opcodes
- //
-
- // Get BT FW version
- // fill h2c parameters
- btOpcode = BT_LO_OP_GET_BT_VERSION;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- else
- {
- pu2Tmp = (pu2Byte)&pExtC2h->buf[0];
- btRealFwVer = *pu2Tmp;
- btFwVer = pExtC2h->buf[1];
- DBG_8192C("[MPT], btRealFwVer=0x%x, btFwVer=0x%x\n", btRealFwVer, btFwVer);
- }
-
- // Get BD Address
- // fill h2c parameters
- btOpcode = BT_LO_OP_GET_BD_ADDR_L;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- else
- {
- bdAddr[5] = pExtC2h->buf[0];
- bdAddr[4] = pExtC2h->buf[1];
- bdAddr[3] = pExtC2h->buf[2];
- }
-
- // fill h2c parameters
- btOpcode = BT_LO_OP_GET_BD_ADDR_H;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- else
- {
- bdAddr[2] = pExtC2h->buf[0];
- bdAddr[1] = pExtC2h->buf[1];
- bdAddr[0] = pExtC2h->buf[2];
- }
- DBG_8192C("[MPT], Local BDAddr:");
- for(i=0; i<6; i++)
- {
- DBG_8192C(" 0x%x ", bdAddr[i]);
- }
- pBtRsp->status = BT_STATUS_SUCCESS;
- pBtRsp->pParamStart[0] = MP_BT_READY;
- pu2Tmp = (pu2Byte)&pBtRsp->pParamStart[1];
- *pu2Tmp = btRealFwVer;
- pBtRsp->pParamStart[3] = btFwVer;
- for(i=0; i<6; i++)
- {
- pBtRsp->pParamStart[4+i] = bdAddr[5-i];
- }
-
- return paraLen;
-}
-
-void mptbt_close_WiFiRF(PADAPTER Adapter)
-{
- PHY_SetBBReg(Adapter, 0x824, 0xF, 0x0);
- PHY_SetBBReg(Adapter, 0x824, 0x700000, 0x0);
- PHY_SetRFReg(Adapter, RF90_PATH_A, 0x0, 0xF0000, 0x0);
-}
-
-void mptbt_open_WiFiRF(PADAPTER Adapter)
-{
- PHY_SetBBReg(Adapter, 0x824, 0x700000, 0x3);
- PHY_SetBBReg(Adapter, 0x824, 0xF, 0x2);
- PHY_SetRFReg(Adapter, RF90_PATH_A, 0x0, 0xF0000, 0x3);
-}
-
-u4Byte mptbt_switch_RF(PADAPTER Adapter, u1Byte Enter)
-{
- u2Byte tmp_2byte = 0;
-
- //Enter test mode
- if (Enter) {
- ////1>. close WiFi RF
- mptbt_close_WiFiRF(Adapter);
-
- ////2>. change ant switch to BT
- tmp_2byte = rtw_read16(Adapter, 0x860);
- tmp_2byte = tmp_2byte | BIT(9);
- tmp_2byte = tmp_2byte & (~BIT(8));
- rtw_write16(Adapter, 0x860, tmp_2byte);
- rtw_write16(Adapter, 0x870, 0x300);
- } else {
- ////1>. Open WiFi RF
- mptbt_open_WiFiRF(Adapter);
-
- ////2>. change ant switch back
- tmp_2byte = rtw_read16(Adapter, 0x860);
- tmp_2byte = tmp_2byte | BIT(8);
- tmp_2byte = tmp_2byte & (~BIT(9));
- rtw_write16(Adapter, 0x860, tmp_2byte);
- rtw_write16(Adapter, 0x870, 0x300);
- }
-
- return 0;
-}
-
-u2Byte
-mptbt_BtSetMode(
- PADAPTER Adapter,
- PBT_REQ_CMD pBtReq,
- PBT_RSP_CMD pBtRsp
- )
-{
- u1Byte h2cParaBuf[6] ={0};
- u1Byte h2cParaLen=0;
- u2Byte paraLen=0;
- u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
- u1Byte btOpcode;
- u1Byte btOpcodeVer=0;
- u1Byte btModeToSet=0;
-
- //
- // check upper layer parameters
- //
- // 1. check upper layer opcode version
- if(pBtReq->opCodeVer != 1)
- {
- DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
- pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
- return paraLen;
- }
- // 2. check upper layer parameter length
- if(1 == pBtReq->paraLength)
- {
- btModeToSet = pBtReq->pParamStart[0];
- DBG_8192C("[MPT], BtTestMode=%d \n", btModeToSet);
- }
- else
- {
- DBG_8192C("[MPT], Error!! wrong parameter length=%d (should be 1)\n", pBtReq->paraLength);
- pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
- return paraLen;
- }
-
- //
- // execute lower layer opcodes
- //
-
- // 1. fill h2c parameters
- // check bt mode
- btOpcode = BT_LO_OP_SET_BT_MODE;
- if(btModeToSet >= MP_BT_MODE_MAX)
- {
- pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- else
- {
- mptbt_switch_RF(Adapter, 1);
-
- h2cParaBuf[0] = btModeToSet;
- h2cParaLen = 1;
- // 2. execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
-
- // 3. construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS == retStatus)
- {
- pBtRsp->status = BT_STATUS_SUCCESS;
- }
- else
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- }
-
- return paraLen;
-}
-
-
-VOID
-MPTBT_FwC2hBtMpCtrl(
- PADAPTER Adapter,
- pu1Byte tmpBuf,
- u1Byte length
- )
-{
- u32 i;
- PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
- PBT_EXT_C2H pExtC2h=(PBT_EXT_C2H)tmpBuf;
-
- if(Adapter->bBTFWReady == _FALSE || Adapter->registrypriv.mp_mode == 0 )
- {
- DBG_8192C("Ignore C2H BT MP Info since not in MP mode \n");
- return;
- }
- if( length > 32 || length < 3 )
- {
- DBG_8192C("\n [MPT], pExtC2h->buf hex: length=%d > 32 || < 3\n",length);
- return;
- }
-
- //cancel_timeout for h2c handle
- _cancel_timer_ex(&pMptCtx->MPh2c_timeout_timer);
-
- for (i=0; i<length; i++)
- {
- DBG_8192C("[MPT], %s, buf[%d]=0x%02x ", __FUNCTION__, i, tmpBuf[i]);
- }
- DBG_8192C("[MPT], pExtC2h->extendId=0x%x\n", pExtC2h->extendId);
-
- switch(pExtC2h->extendId)
- {
- case EXT_C2H_WIFI_FW_ACTIVE_RSP:
- DBG_8192C("[MPT], EXT_C2H_WIFI_FW_ACTIVE_RSP\n");
-#if 0
- DBG_8192C("[MPT], pExtC2h->buf hex: \n");
- for (i=0; i<(length-3); i++)
- {
- DBG_8192C(" 0x%x ", pExtC2h->buf[i]);
- }
-#endif
- if ((_FALSE == pMptCtx->bMPh2c_timeout)
- && (_FALSE == pMptCtx->MptH2cRspEvent))
- {
- pMptCtx->MptH2cRspEvent = _TRUE;
- _rtw_up_sema(&pMptCtx->MPh2c_Sema);
- }
- break;
-
- case EXT_C2H_TRIG_BY_BT_FW:
- DBG_8192C("[MPT], EXT_C2H_TRIG_BY_BT_FW\n");
- _rtw_memcpy(&pMptCtx->c2hBuf[0], tmpBuf, length);
- DBG_8192C("[MPT], pExtC2h->statusCode=0x%x\n", pExtC2h->statusCode);
- DBG_8192C("[MPT], pExtC2h->retLen=0x%x\n", pExtC2h->retLen);
- DBG_8192C("[MPT], pExtC2h->opCodeVer=0x%x\n", pExtC2h->opCodeVer);
- DBG_8192C("[MPT], pExtC2h->reqNum=0x%x\n", pExtC2h->reqNum);
- for (i=0; i<(length-3); i++)
- {
- DBG_8192C("[MPT], pExtC2h->buf[%d]=0x%02x\n", i, pExtC2h->buf[i]);
- }
-
- if ((_FALSE == pMptCtx->bMPh2c_timeout)
- && (_TRUE == pMptCtx->MptH2cRspEvent)
- && (_FALSE == pMptCtx->MptBtC2hEvent))
- {
- pMptCtx->MptBtC2hEvent = _TRUE;
- _rtw_up_sema(&pMptCtx->MPh2c_Sema);
- }
- break;
-
- default:
- DBG_8192C("[MPT], EXT_C2H Target not found,pExtC2h->extendId =%d ,pExtC2h->reqNum=%d\n",pExtC2h->extendId,pExtC2h->reqNum);
- break;
- }
-
-
-
-}
-
-
-u2Byte
-mptbt_BtGetGeneral(
- IN PADAPTER Adapter,
- IN PBT_REQ_CMD pBtReq,
- IN PBT_RSP_CMD pBtRsp
- )
-{
- PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
- PBT_EXT_C2H pExtC2h=(PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
- u1Byte h2cParaBuf[6] ={0};
- u1Byte h2cParaLen=0;
- u2Byte paraLen=0;
- u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
- u1Byte btOpcode, bdAddr[6]={0};
- u1Byte btOpcodeVer=0;
- u1Byte getType=0, i;
- u2Byte getParaLen=0, validParaLen=0;
- u1Byte regType=0, reportType=0;
- u4Byte regAddr=0, regValue=0;
- pu4Byte pu4Tmp;
- pu2Byte pu2Tmp;
- pu1Byte pu1Tmp;
-
- //
- // check upper layer parameters
- //
-
- // check upper layer opcode version
- if(pBtReq->opCodeVer != 1)
- {
- DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
- pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
- return paraLen;
- }
- // check upper layer parameter length
- if(pBtReq->paraLength < 1)
- {
- DBG_8192C("[MPT], Error!! wrong parameter length=%d (should larger than 1)\n", pBtReq->paraLength);
- pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
- return paraLen;
- }
- getParaLen = pBtReq->paraLength - 1;
- getType = pBtReq->pParamStart[0];
-
- DBG_8192C("[MPT], getType=%d, getParaLen=%d\n", getType, getParaLen);
-
- // check parameter first
- switch(getType)
- {
- case BT_GGET_REG:
- DBG_8192C("[MPT], [BT_GGET_REG]\n");
- validParaLen = 5;
- if(getParaLen == validParaLen)
- {
- btOpcode = BT_LO_OP_READ_REG;
- regType = pBtReq->pParamStart[1];
- pu4Tmp = (pu4Byte)&pBtReq->pParamStart[2];
- regAddr = *pu4Tmp;
- DBG_8192C("[MPT], BT_GGET_REG regType=0x%02x, regAddr=0x%08x!!\n",
- regType, regAddr);
- if(regType >= BT_REG_MAX)
- {
- pBtRsp->status = (btOpcode<<8)| BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- else
- {
- if( ((BT_REG_RF==regType)&&(regAddr>0x7f)) ||
- ((BT_REG_MODEM==regType)&&(regAddr>0x1ff)) ||
- ((BT_REG_BLUEWIZE==regType)&&(regAddr>0xfff)) ||
- ((BT_REG_VENDOR==regType)&&(regAddr>0xfff)) ||
- ((BT_REG_LE==regType)&&(regAddr>0xfff)) )
- {
- pBtRsp->status = (btOpcode<<8)| BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- }
- }
- break;
- case BT_GGET_STATUS:
- DBG_8192C("[MPT], [BT_GGET_STATUS]\n");
- validParaLen = 0;
- break;
- case BT_GGET_REPORT:
- DBG_8192C("[MPT], [BT_GGET_REPORT]\n");
- validParaLen = 1;
- if(getParaLen == validParaLen)
- {
- reportType = pBtReq->pParamStart[1];
- DBG_8192C("[MPT], BT_GGET_REPORT reportType=0x%x!!\n", reportType);
- if(reportType >= BT_REPORT_MAX)
- {
- pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- }
- break;
- default:
- {
- DBG_8192C("[MPT], Error!! getType=%d, out of range\n", getType);
- pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- break;
- }
- if(getParaLen != validParaLen)
- {
- DBG_8192C("[MPT], Error!! wrong parameter length=%d for BT_GET_GEN_CMD cmd id=0x%x, paraLen should=0x%x\n",
- getParaLen, getType, validParaLen);
- pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
- return paraLen;
- }
-
- //
- // execute lower layer opcodes
- //
- if(BT_GGET_REG == getType)
- {
- // fill h2c parameters
- // here we should write reg value first then write the address, adviced by Austin
- btOpcode = BT_LO_OP_READ_REG;
- h2cParaBuf[0] = regType;
- h2cParaBuf[1] = pBtReq->pParamStart[2];
- h2cParaBuf[2] = pBtReq->pParamStart[3];
- h2cParaLen = 3;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- pu2Tmp = (pu2Byte)&pExtC2h->buf[0];
- regValue = *pu2Tmp;
- DBG_8192C("[MPT], read reg regType=0x%02x, regAddr=0x%08x, regValue=0x%04x\n",
- regType, regAddr, regValue);
-
- pu4Tmp = (pu4Byte)&pBtRsp->pParamStart[0];
- *pu4Tmp = regValue;
- paraLen = 4;
- }
- else if(BT_GGET_STATUS == getType)
- {
- btOpcode = BT_LO_OP_GET_BT_STATUS;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- pBtRsp->pParamStart[0] = pExtC2h->buf[0];
- pBtRsp->pParamStart[1] = pExtC2h->buf[1];
- DBG_8192C("[MPT], read bt status, testMode=0x%x, testStatus=0x%x\n",
- pBtRsp->pParamStart[0], pBtRsp->pParamStart[1]);
- paraLen = 2;
- }
- else if(BT_GGET_REPORT == getType)
- {
- switch(reportType)
- {
- case BT_REPORT_RX_PACKET_CNT:
- {
- DBG_8192C("[MPT], [Rx Packet Counts]\n");
- btOpcode = BT_LO_OP_GET_RX_PKT_CNT_L;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- pBtRsp->pParamStart[0] = pExtC2h->buf[0];
- pBtRsp->pParamStart[1] = pExtC2h->buf[1];
-
- btOpcode = BT_LO_OP_GET_RX_PKT_CNT_H;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- pBtRsp->pParamStart[2] = pExtC2h->buf[0];
- pBtRsp->pParamStart[3] = pExtC2h->buf[1];
- paraLen = 4;
- }
- break;
- case BT_REPORT_RX_ERROR_BITS:
- {
- DBG_8192C("[MPT], [Rx Error Bits]\n");
- btOpcode = BT_LO_OP_GET_RX_ERROR_BITS_L;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- pBtRsp->pParamStart[0] = pExtC2h->buf[0];
- pBtRsp->pParamStart[1] = pExtC2h->buf[1];
-
- btOpcode = BT_LO_OP_GET_RX_ERROR_BITS_H;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- pBtRsp->pParamStart[2] = pExtC2h->buf[0];
- pBtRsp->pParamStart[3] = pExtC2h->buf[1];
- paraLen = 4;
- }
- break;
- case BT_REPORT_RSSI:
- {
- DBG_8192C("[MPT], [RSSI]\n");
- btOpcode = BT_LO_OP_GET_RSSI;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- pBtRsp->pParamStart[0] = pExtC2h->buf[0];
- pBtRsp->pParamStart[1] = pExtC2h->buf[1];
- paraLen = 2;
- }
- break;
- case BT_REPORT_CFO_HDR_QUALITY:
- {
- DBG_8192C("[MPT], [CFO & Header Quality]\n");
- btOpcode = BT_LO_OP_GET_CFO_HDR_QUALITY_L;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- pBtRsp->pParamStart[0] = pExtC2h->buf[0];
- pBtRsp->pParamStart[1] = pExtC2h->buf[1];
-
- btOpcode = BT_LO_OP_GET_CFO_HDR_QUALITY_H;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- pBtRsp->pParamStart[2] = pExtC2h->buf[0];
- pBtRsp->pParamStart[3] = pExtC2h->buf[1];
- paraLen = 4;
- }
- break;
- case BT_REPORT_CONNECT_TARGET_BD_ADDR:
- {
- DBG_8192C("[MPT], [Connected Target BD ADDR]\n");
- btOpcode = BT_LO_OP_GET_TARGET_BD_ADDR_L;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- bdAddr[5] = pExtC2h->buf[0];
- bdAddr[4] = pExtC2h->buf[1];
- bdAddr[3] = pExtC2h->buf[2];
-
- btOpcode = BT_LO_OP_GET_TARGET_BD_ADDR_H;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- bdAddr[2] = pExtC2h->buf[0];
- bdAddr[1] = pExtC2h->buf[1];
- bdAddr[0] = pExtC2h->buf[2];
-
- DBG_8192C("[MPT], Connected Target BDAddr:%s", bdAddr);
- for(i=0; i<6; i++)
- {
- pBtRsp->pParamStart[i] = bdAddr[5-i];
- }
- paraLen = 6;
- }
- break;
- default:
- pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- break;
- }
- }
-
- pBtRsp->status = BT_STATUS_SUCCESS;
- return paraLen;
-}
-
-
-
-u2Byte
-mptbt_BtSetGeneral(
- IN PADAPTER Adapter,
- IN PBT_REQ_CMD pBtReq,
- IN PBT_RSP_CMD pBtRsp
- )
-{
- u1Byte h2cParaBuf[6] ={0};
- u1Byte h2cParaLen=0;
- u2Byte paraLen=0;
- u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
- u1Byte btOpcode;
- u1Byte btOpcodeVer=0;
- u1Byte setType=0;
- u2Byte setParaLen=0, validParaLen=0;
- u1Byte regType=0, bdAddr[6]={0}, calVal=0;
- u4Byte regAddr=0, regValue=0;
- pu4Byte pu4Tmp;
- pu2Byte pu2Tmp;
- pu1Byte pu1Tmp;
-
- //
- // check upper layer parameters
- //
-
- // check upper layer opcode version
- if(pBtReq->opCodeVer != 1)
- {
- DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
- pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
- return paraLen;
- }
- // check upper layer parameter length
- if(pBtReq->paraLength < 1)
- {
- DBG_8192C("[MPT], Error!! wrong parameter length=%d (should larger than 1)\n", pBtReq->paraLength);
- pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
- return paraLen;
- }
- setParaLen = pBtReq->paraLength - 1;
- setType = pBtReq->pParamStart[0];
-
- DBG_8192C("[MPT], setType=%d, setParaLen=%d\n", setType, setParaLen);
-
- // check parameter first
- switch(setType)
- {
- case BT_GSET_REG:
- DBG_8192C ("[MPT], [BT_GSET_REG]\n");
- validParaLen = 9;
- if(setParaLen == validParaLen)
- {
- btOpcode = BT_LO_OP_WRITE_REG_VALUE;
- regType = pBtReq->pParamStart[1];
- pu4Tmp = (pu4Byte)&pBtReq->pParamStart[2];
- regAddr = *pu4Tmp;
- pu4Tmp = (pu4Byte)&pBtReq->pParamStart[6];
- regValue = *pu4Tmp;
- DBG_8192C("[MPT], BT_GSET_REG regType=0x%x, regAddr=0x%x, regValue=0x%x!!\n",
- regType, regAddr, regValue);
- if(regType >= BT_REG_MAX)
- {
- pBtRsp->status = (btOpcode<<8)| BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- else
- {
- if( ((BT_REG_RF==regType)&&(regAddr>0x7f)) ||
- ((BT_REG_MODEM==regType)&&(regAddr>0x1ff)) ||
- ((BT_REG_BLUEWIZE==regType)&&(regAddr>0xfff)) ||
- ((BT_REG_VENDOR==regType)&&(regAddr>0xfff)) ||
- ((BT_REG_LE==regType)&&(regAddr>0xfff)) )
- {
- pBtRsp->status = (btOpcode<<8)| BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- }
- }
- break;
- case BT_GSET_RESET:
- DBG_8192C("[MPT], [BT_GSET_RESET]\n");
- validParaLen = 0;
- break;
- case BT_GSET_TARGET_BD_ADDR:
- DBG_8192C("[MPT], [BT_GSET_TARGET_BD_ADDR]\n");
- validParaLen = 6;
- if(setParaLen == validParaLen)
- {
- btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_H;
- if( (pBtReq->pParamStart[1]==0) &&
- (pBtReq->pParamStart[2]==0) &&
- (pBtReq->pParamStart[3]==0) &&
- (pBtReq->pParamStart[4]==0) &&
- (pBtReq->pParamStart[5]==0) &&
- (pBtReq->pParamStart[6]==0) )
- {
- DBG_8192C("[MPT], Error!! targetBDAddr=all zero\n");
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- if( (pBtReq->pParamStart[1]==0xff) &&
- (pBtReq->pParamStart[2]==0xff) &&
- (pBtReq->pParamStart[3]==0xff) &&
- (pBtReq->pParamStart[4]==0xff) &&
- (pBtReq->pParamStart[5]==0xff) &&
- (pBtReq->pParamStart[6]==0xff) )
- {
- DBG_8192C("[MPT], Error!! targetBDAddr=all 0xf\n");
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- bdAddr[0] = pBtReq->pParamStart[6];
- bdAddr[1] = pBtReq->pParamStart[5];
- bdAddr[2] = pBtReq->pParamStart[4];
- bdAddr[3] = pBtReq->pParamStart[3];
- bdAddr[4] = pBtReq->pParamStart[2];
- bdAddr[5] = pBtReq->pParamStart[1];
- DBG_8192C ("[MPT], target BDAddr:%x,%x,%x,%x,%x,%x\n",
- bdAddr[0],bdAddr[1],bdAddr[2],bdAddr[3],bdAddr[4],bdAddr[5]);
- }
- break;
- case BT_GSET_TX_PWR_FINETUNE:
- DBG_8192C("[MPT], [BT_GSET_TX_PWR_FINETUNE]\n");
- validParaLen = 1;
- if(setParaLen == validParaLen)
- {
- btOpcode = BT_LO_OP_SET_TX_POWER_CALIBRATION;
- calVal = pBtReq->pParamStart[1];
- if( (calVal<1) || (calVal>9) )
- {
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- DBG_8192C ("[MPT], calVal=%d\n", calVal);
- }
- break;
- case BT_SET_TRACKING_INTERVAL:
- DBG_871X("[MPT], [BT_SET_TRACKING_INTERVAL] setParaLen =%d \n",setParaLen);
-
- validParaLen = 1;
- if(setParaLen == validParaLen)
- calVal = pBtReq->pParamStart[1];
- break;
- case BT_SET_THERMAL_METER:
- DBG_871X("[MPT], [BT_SET_THERMAL_METER] setParaLen =%d \n",setParaLen);
- validParaLen = 1;
- if(setParaLen == validParaLen)
- calVal = pBtReq->pParamStart[1];
- break;
- case BT_ENABLE_CFO_TRACKING:
- DBG_871X("[MPT], [BT_ENABLE_CFO_TRACKING] setParaLen =%d \n",setParaLen);
- validParaLen = 1;
- if(setParaLen == validParaLen)
- calVal = pBtReq->pParamStart[1];
- break;
- case BT_GSET_UPDATE_BT_PATCH:
- if(IS_HARDWARE_TYPE_8723AE(Adapter) && Adapter->bFWReady)
- {
- u1Byte i;
- DBG_8192C ("[MPT], write regs for load patch\n");
- //BTFwPatch8723A(Adapter);
- PlatformEFIOWrite1Byte(Adapter, 0xCC, 0x2d);
- rtw_msleep_os(50);
- PlatformEFIOWrite4Byte(Adapter, 0x68, 0xa005000c);
- rtw_msleep_os(50);
- PlatformEFIOWrite4Byte(Adapter, 0x68, 0xb005000c);
- rtw_msleep_os(50);
- PlatformEFIOWrite1Byte(Adapter, 0xCC, 0x29);
- for(i=0; i<12; i++)
- rtw_msleep_os(100);
-//#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
-// BTFwPatch8723A(Adapter);
-//#endif
- DBG_8192C("[MPT], load BT FW Patch finished!!!\n");
- }
- break;
- default:
- {
- DBG_8192C ("[MPT], Error!! setType=%d, out of range\n", setType);
- pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- break;
- }
- if(setParaLen != validParaLen)
- {
- DBG_8192C("[MPT], Error!! wrong parameter length=%d for BT_SET_GEN_CMD cmd id=0x%x, paraLen should=0x%x\n",
- setParaLen, setType, validParaLen);
- pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
- return paraLen;
- }
-
- //
- // execute lower layer opcodes
- //
- if(BT_GSET_REG == setType)
- {
- // fill h2c parameters
- // here we should write reg value first then write the address, adviced by Austin
- btOpcode = BT_LO_OP_WRITE_REG_VALUE;
- h2cParaBuf[0] = pBtReq->pParamStart[6];
- h2cParaBuf[1] = pBtReq->pParamStart[7];
- h2cParaBuf[2] = pBtReq->pParamStart[8];
- h2cParaLen = 3;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- // write reg address
- btOpcode = BT_LO_OP_WRITE_REG_ADDR;
- h2cParaBuf[0] = regType;
- h2cParaBuf[1] = pBtReq->pParamStart[2];
- h2cParaBuf[2] = pBtReq->pParamStart[3];
- h2cParaLen = 3;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- }
- else if(BT_GSET_RESET == setType)
- {
- btOpcode = BT_LO_OP_RESET;
- h2cParaLen = 0;
- // execute h2c and check respond c2h from bt fw is correct or not
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- }
- else if(BT_GSET_TARGET_BD_ADDR == setType)
- {
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_L;
- h2cParaBuf[0] = pBtReq->pParamStart[1];
- h2cParaBuf[1] = pBtReq->pParamStart[2];
- h2cParaBuf[2] = pBtReq->pParamStart[3];
- h2cParaLen = 3;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_H;
- h2cParaBuf[0] = pBtReq->pParamStart[4];
- h2cParaBuf[1] = pBtReq->pParamStart[5];
- h2cParaBuf[2] = pBtReq->pParamStart[6];
- h2cParaLen = 3;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- }
- else if(BT_GSET_TX_PWR_FINETUNE == setType)
- {
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_TX_POWER_CALIBRATION;
- h2cParaBuf[0] = calVal;
- h2cParaLen = 1;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- }
- else if(BT_SET_TRACKING_INTERVAL == setType)
- {
- // BT_LO_OP_SET_TRACKING_INTERVAL = 0x22,
- // BT_LO_OP_SET_THERMAL_METER = 0x23,
- // BT_LO_OP_ENABLE_CFO_TRACKING = 0x24,
- btOpcode = BT_LO_OP_SET_TRACKING_INTERVAL;
- h2cParaBuf[0] = calVal;
- h2cParaLen = 1;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- }
- else if(BT_SET_THERMAL_METER == setType)
- {
- btOpcode = BT_LO_OP_SET_THERMAL_METER;
- h2cParaBuf[0] = calVal;
- h2cParaLen = 1;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- }
- else if(BT_ENABLE_CFO_TRACKING == setType)
- {
- btOpcode = BT_LO_OP_ENABLE_CFO_TRACKING;
- h2cParaBuf[0] = calVal;
- h2cParaLen = 1;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
- }
-
- pBtRsp->status = BT_STATUS_SUCCESS;
- return paraLen;
-}
-
-
-
-u2Byte
-mptbt_BtSetTxRxPars(
- IN PADAPTER Adapter,
- IN PBT_REQ_CMD pBtReq,
- IN PBT_RSP_CMD pBtRsp
- )
-{
- u1Byte h2cParaBuf[6] ={0};
- u1Byte h2cParaLen=0;
- u2Byte paraLen=0;
- u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
- u1Byte btOpcode;
- u1Byte btOpcodeVer=0;
- PBT_TXRX_PARAMETERS pTxRxPars=(PBT_TXRX_PARAMETERS)&pBtReq->pParamStart[0];
- u2Byte lenTxRx=sizeof(BT_TXRX_PARAMETERS);
- u1Byte i;
- u1Byte bdAddr[6]={0};
-
- //
- // check upper layer parameters
- //
-
- // 1. check upper layer opcode version
- if(pBtReq->opCodeVer != 1)
- {
- DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
- pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
- return paraLen;
- }
- // 2. check upper layer parameter length
- if(pBtReq->paraLength == sizeof(BT_TXRX_PARAMETERS))
- {
- DBG_8192C ("[MPT], pTxRxPars->txrxChannel=0x%x \n", pTxRxPars->txrxChannel);
- DBG_8192C ("[MPT], pTxRxPars->txrxTxPktCnt=0x%8x \n", pTxRxPars->txrxTxPktCnt);
- DBG_8192C ("[MPT], pTxRxPars->txrxTxPktInterval=0x%x \n", pTxRxPars->txrxTxPktInterval);
- DBG_8192C ("[MPT], pTxRxPars->txrxPayloadType=0x%x \n", pTxRxPars->txrxPayloadType);
- DBG_8192C ("[MPT], pTxRxPars->txrxPktType=0x%x \n", pTxRxPars->txrxPktType);
- DBG_8192C ("[MPT], pTxRxPars->txrxPayloadLen=0x%x \n", pTxRxPars->txrxPayloadLen);
- DBG_8192C ("[MPT], pTxRxPars->txrxPktHeader=0x%x \n", pTxRxPars->txrxPktHeader);
- DBG_8192C ("[MPT], pTxRxPars->txrxWhitenCoeff=0x%x \n", pTxRxPars->txrxWhitenCoeff);
- bdAddr[0] = pTxRxPars->txrxBdaddr[5];
- bdAddr[1] = pTxRxPars->txrxBdaddr[4];
- bdAddr[2] = pTxRxPars->txrxBdaddr[3];
- bdAddr[3] = pTxRxPars->txrxBdaddr[2];
- bdAddr[4] = pTxRxPars->txrxBdaddr[1];
- bdAddr[5] = pTxRxPars->txrxBdaddr[0];
- DBG_8192C ("[MPT], pTxRxPars->txrxBdaddr: %s", &bdAddr[0]);
- DBG_8192C ("[MPT], pTxRxPars->txrxTxGainIndex=0x%x \n", pTxRxPars->txrxTxGainIndex);
- }
- else
- {
- DBG_8192C ("[MPT], Error!! pBtReq->paraLength=%d, correct Len=%d\n", pBtReq->paraLength, lenTxRx);
- pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
- return paraLen;
- }
-
- //
- // execute lower layer opcodes
- //
-
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_PKT_HEADER;
- if(pTxRxPars->txrxPktHeader > 0x3ffff)
- {
- DBG_8192C ("[MPT], Error!! pTxRxPars->txrxPktHeader=0x%x is out of range, (should be between 0x0~0x3ffff)\n", pTxRxPars->txrxPktHeader);
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- else
- {
- h2cParaBuf[0] = (u1Byte)(pTxRxPars->txrxPktHeader&0xff);
- h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxPktHeader&0xff00)>>8);
- h2cParaBuf[2] = (u1Byte)((pTxRxPars->txrxPktHeader&0xff0000)>>16);
- h2cParaLen = 3;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
-
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_PKT_TYPE_LEN;
- {
- u2Byte payloadLenLimit=0;
- switch(pTxRxPars->txrxPktType)
- {
- case MP_BT_PKT_DH1:
- payloadLenLimit = 27*8;
- break;
- case MP_BT_PKT_DH3:
- payloadLenLimit = 183*8;
- break;
- case MP_BT_PKT_DH5:
- payloadLenLimit = 339*8;
- break;
- case MP_BT_PKT_2DH1:
- payloadLenLimit = 54*8;
- break;
- case MP_BT_PKT_2DH3:
- payloadLenLimit = 367*8;
- break;
- case MP_BT_PKT_2DH5:
- payloadLenLimit = 679*8;
- break;
- case MP_BT_PKT_3DH1:
- payloadLenLimit = 83*8;
- break;
- case MP_BT_PKT_3DH3:
- payloadLenLimit = 552*8;
- break;
- case MP_BT_PKT_3DH5:
- payloadLenLimit = 1021*8;
- break;
- case MP_BT_PKT_LE:
- payloadLenLimit = 39*8;
- break;
- default:
- {
- DBG_8192C ("[MPT], Error!! Unknown pTxRxPars->txrxPktType=0x%x\n", pTxRxPars->txrxPktType);
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- break;
- }
-
- if(pTxRxPars->txrxPayloadLen > payloadLenLimit)
- {
- DBG_8192C ("[MPT], Error!! pTxRxPars->txrxPayloadLen=0x%x, (should smaller than %d)\n",
- pTxRxPars->txrxPayloadLen, payloadLenLimit);
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
-
- h2cParaBuf[0] = pTxRxPars->txrxPktType;
- h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxPayloadLen&0xff));
- h2cParaBuf[2] = (u1Byte)((pTxRxPars->txrxPayloadLen&0xff00)>>8);
- h2cParaLen = 3;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
-
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_PKT_CNT_L_PL_TYPE;
- if(pTxRxPars->txrxPayloadType > MP_BT_PAYLOAD_MAX)
- {
- DBG_8192C ("[MPT], Error!! pTxRxPars->txrxPayloadType=0x%x, (should be between 0~4)\n", pTxRxPars->txrxPayloadType);
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- else
- {
- h2cParaBuf[0] = (u1Byte)((pTxRxPars->txrxTxPktCnt&0xff));
- h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxTxPktCnt&0xff00)>>8);
- h2cParaBuf[2] = pTxRxPars->txrxPayloadType;
- h2cParaLen = 3;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
-
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_PKT_CNT_H_PKT_INTV;
- if(pTxRxPars->txrxTxPktInterval > 15)
- {
- DBG_8192C ("[MPT], Error!! pTxRxPars->txrxTxPktInterval=0x%x, (should be between 0~15)\n", pTxRxPars->txrxTxPktInterval);
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- else
- {
- h2cParaBuf[0] = (u1Byte)((pTxRxPars->txrxTxPktCnt&0xff0000)>>16);
- h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxTxPktCnt&0xff000000)>>24);
- h2cParaBuf[2] = pTxRxPars->txrxTxPktInterval;
- h2cParaLen = 3;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
-
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_WHITENCOEFF;
- {
- h2cParaBuf[0] = pTxRxPars->txrxWhitenCoeff;
- h2cParaLen = 1;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
-
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
-
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_CHNL_TX_GAIN;
- if( (pTxRxPars->txrxChannel > 78) ||
- (pTxRxPars->txrxTxGainIndex > 7) )
- {
- DBG_8192C ("[MPT], Error!! pTxRxPars->txrxChannel=0x%x, (should be between 0~78)\n", pTxRxPars->txrxChannel);
- DBG_8192C ("[MPT], Error!! pTxRxPars->txrxTxGainIndex=0x%x, (should be between 0~7)\n", pTxRxPars->txrxTxGainIndex);
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- else
- {
- h2cParaBuf[0] = pTxRxPars->txrxChannel;
- h2cParaBuf[1] = pTxRxPars->txrxTxGainIndex;
- h2cParaLen = 2;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
-
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- // fill h2c parameters
- btOpcode = BT_LO_OP_SET_BD_ADDR_L;
- if( (pTxRxPars->txrxBdaddr[0]==0) &&
- (pTxRxPars->txrxBdaddr[1]==0) &&
- (pTxRxPars->txrxBdaddr[2]==0) &&
- (pTxRxPars->txrxBdaddr[3]==0) &&
- (pTxRxPars->txrxBdaddr[4]==0) &&
- (pTxRxPars->txrxBdaddr[5]==0) )
- {
- DBG_8192C ("[MPT], Error!! pTxRxPars->txrxBdaddr=all zero\n");
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- if( (pTxRxPars->txrxBdaddr[0]==0xff) &&
- (pTxRxPars->txrxBdaddr[1]==0xff) &&
- (pTxRxPars->txrxBdaddr[2]==0xff) &&
- (pTxRxPars->txrxBdaddr[3]==0xff) &&
- (pTxRxPars->txrxBdaddr[4]==0xff) &&
- (pTxRxPars->txrxBdaddr[5]==0xff) )
- {
- DBG_8192C ("[MPT], Error!! pTxRxPars->txrxBdaddr=all 0xf\n");
- pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
-
- {
- h2cParaBuf[0] = pTxRxPars->txrxBdaddr[0];
- h2cParaBuf[1] = pTxRxPars->txrxBdaddr[1];
- h2cParaBuf[2] = pTxRxPars->txrxBdaddr[2];
- h2cParaLen = 3;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- btOpcode = BT_LO_OP_SET_BD_ADDR_H;
- {
- h2cParaBuf[0] = pTxRxPars->txrxBdaddr[3];
- h2cParaBuf[1] = pTxRxPars->txrxBdaddr[4];
- h2cParaBuf[2] = pTxRxPars->txrxBdaddr[5];
- h2cParaLen = 3;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
- // ckeck bt return status.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- pBtRsp->status = BT_STATUS_SUCCESS;
- return paraLen;
-}
-
-
-
-u2Byte
-mptbt_BtTestCtrl(
- IN PADAPTER Adapter,
- IN PBT_REQ_CMD pBtReq,
- IN PBT_RSP_CMD pBtRsp
- )
-{
- u1Byte h2cParaBuf[6] ={0};
- u1Byte h2cParaLen=0;
- u2Byte paraLen=0;
- u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
- u1Byte btOpcode;
- u1Byte btOpcodeVer=0;
- u1Byte testCtrl=0;
-
- //
- // check upper layer parameters
- //
-
- // 1. check upper layer opcode version
- if(pBtReq->opCodeVer != 1)
- {
- DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
- pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
- return paraLen;
- }
- // 2. check upper layer parameter length
- if(1 == pBtReq->paraLength)
- {
- testCtrl = pBtReq->pParamStart[0];
- DBG_8192C("[MPT], testCtrl=%d \n", testCtrl);
- }
- else
- {
- DBG_8192C("[MPT], Error!! wrong parameter length=%d (should be 1)\n", pBtReq->paraLength);
- pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
- return paraLen;
- }
-
- //
- // execute lower layer opcodes
- //
-
- // 1. fill h2c parameters
- // check bt mode
- btOpcode = BT_LO_OP_TEST_CTRL;
- if(testCtrl >= MP_BT_TEST_MAX)
- {
- DBG_8192C("[MPT], Error!! testCtrl=0x%x, (should be between smaller or equal to 0x%x)\n",
- testCtrl, MP_BT_TEST_MAX-1);
- pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
- return paraLen;
- }
- else
- {
- h2cParaBuf[0] = testCtrl;
- h2cParaLen = 1;
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- }
-
- // 3. construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- pBtRsp->status = BT_STATUS_SUCCESS;
- return paraLen;
-}
-
-
-u2Byte
-mptbt_TestBT(
- IN PADAPTER Adapter,
- IN PBT_REQ_CMD pBtReq,
- IN PBT_RSP_CMD pBtRsp
- )
-{
-
- u1Byte h2cParaBuf[6] ={0};
- u1Byte h2cParaLen=0;
- u2Byte paraLen=0;
- u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
- u1Byte btOpcode;
- u1Byte btOpcodeVer=0;
- u1Byte testCtrl=0;
-
- // 1. fill h2c parameters
- btOpcode = 0x11;
- h2cParaBuf[0] = 0x11;
- h2cParaBuf[1] = 0x0;
- h2cParaBuf[2] = 0x0;
- h2cParaBuf[3] = 0x0;
- h2cParaBuf[4] = 0x0;
- h2cParaLen = 1;
- // retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
- retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, h2cParaBuf, h2cParaLen);
-
-
- // 3. construct respond status code and data.
- if(BT_STATUS_BT_OP_SUCCESS != retStatus)
- {
- pBtRsp->status = ((btOpcode<<8)|retStatus);
- DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
- return paraLen;
- }
-
- pBtRsp->status = BT_STATUS_SUCCESS;
- return paraLen;
-}
-
-VOID
-mptbt_BtControlProcess(
- PADAPTER Adapter,
- PVOID pInBuf
- )
-{
- u1Byte H2C_Parameter[6] ={0};
- PBT_H2C pH2c=(PBT_H2C)&H2C_Parameter[0];
- PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
- PBT_REQ_CMD pBtReq=(PBT_REQ_CMD)pInBuf;
- PBT_RSP_CMD pBtRsp;
- u1Byte i;
-
-
- DBG_8192C("[MPT], mptbt_BtControlProcess()=========>\n");
-
- DBG_8192C("[MPT], input opCodeVer=%d\n", pBtReq->opCodeVer);
- DBG_8192C("[MPT], input OpCode=%d\n", pBtReq->OpCode);
- DBG_8192C("[MPT], paraLength=%d \n", pBtReq->paraLength);
- if(pBtReq->paraLength)
- {
- //DBG_8192C("[MPT], parameters(hex):0x%x %d \n",&pBtReq->pParamStart[0], pBtReq->paraLength);
- }
-
- _rtw_memset((void*)pMptCtx->mptOutBuf, 0, 100);
- pMptCtx->mptOutLen = 4; //length of (BT_RSP_CMD.status+BT_RSP_CMD.paraLength)
-
- pBtRsp = (PBT_RSP_CMD)pMptCtx->mptOutBuf;
- pBtRsp->status = BT_STATUS_SUCCESS;
- pBtRsp->paraLength = 0x0;
-
- // The following we should maintain the User OP codes sent by upper layer
- switch(pBtReq->OpCode)
- {
- case BT_UP_OP_BT_READY:
- DBG_8192C("[MPT], OPcode : [BT_READY]\n");
- pBtRsp->paraLength = mptbt_BtReady(Adapter, pBtReq, pBtRsp);
- break;
- case BT_UP_OP_BT_SET_MODE:
- DBG_8192C("[MPT], OPcode : [BT_SET_MODE]\n");
- pBtRsp->paraLength = mptbt_BtSetMode(Adapter, pBtReq, pBtRsp);
- break;
- case BT_UP_OP_BT_SET_TX_RX_PARAMETER:
- DBG_8192C("[MPT], OPcode : [BT_SET_TXRX_PARAMETER]\n");
- pBtRsp->paraLength = mptbt_BtSetTxRxPars(Adapter, pBtReq, pBtRsp);
- break;
- case BT_UP_OP_BT_SET_GENERAL:
- DBG_8192C("[MPT], OPcode : [BT_SET_GENERAL]\n");
- pBtRsp->paraLength = mptbt_BtSetGeneral(Adapter, pBtReq, pBtRsp);
- break;
- case BT_UP_OP_BT_GET_GENERAL:
- DBG_8192C("[MPT], OPcode : [BT_GET_GENERAL]\n");
- pBtRsp->paraLength = mptbt_BtGetGeneral(Adapter, pBtReq, pBtRsp);
- break;
- case BT_UP_OP_BT_TEST_CTRL:
- DBG_8192C("[MPT], OPcode : [BT_TEST_CTRL]\n");
- pBtRsp->paraLength = mptbt_BtTestCtrl(Adapter, pBtReq, pBtRsp);
- break;
- case BT_UP_OP_TEST_BT:
- DBG_8192C("[MPT], OPcode : [TEST_BT]\n");
- pBtRsp->paraLength = mptbt_TestBT(Adapter, pBtReq, pBtRsp);
- break;
- default:
- DBG_8192C("[MPT], Error!! OPcode : UNDEFINED!!!!\n");
- pBtRsp->status = BT_STATUS_UNKNOWN_OPCODE_U;
- pBtRsp->paraLength = 0x0;
- break;
- }
-
- pMptCtx->mptOutLen += pBtRsp->paraLength;
-
- DBG_8192C("[MPT], pMptCtx->mptOutLen=%d, pBtRsp->paraLength=%d\n", pMptCtx->mptOutLen, pBtRsp->paraLength);
- DBG_8192C("[MPT], mptbt_BtControlProcess()<=========\n");
-}
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 <drv_types.h>
+#include <rtw_bt_mp.h>
+
+#ifdef CONFIG_RTL8723A
+#include <rtl8723a_hal.h>
+#elif defined(CONFIG_RTL8723B)
+#include <rtl8723b_hal.h>
+#endif
+
+#if defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8821A)
+void MPh2c_timeout_handle(void *FunctionContext)
+{
+ PADAPTER pAdapter;
+ PMPT_CONTEXT pMptCtx;
+
+
+ DBG_8192C("[MPT], MPh2c_timeout_handle \n");
+
+ pAdapter = (PADAPTER)FunctionContext;
+ pMptCtx = &pAdapter->mppriv.MptCtx;
+
+ pMptCtx->bMPh2c_timeout = _TRUE;
+
+ if ((_FALSE == pMptCtx->MptH2cRspEvent)
+ || ((_TRUE == pMptCtx->MptH2cRspEvent)
+ && (_FALSE == pMptCtx->MptBtC2hEvent)))
+ {
+ _rtw_up_sema(&pMptCtx->MPh2c_Sema);
+ }
+}
+
+u32 WaitC2Hevent(PADAPTER pAdapter, u8 *C2H_event, u32 delay_time)
+{
+ PMPT_CONTEXT pMptCtx=&(pAdapter->mppriv.MptCtx);
+ pMptCtx->bMPh2c_timeout=_FALSE;
+
+ if( pAdapter->registrypriv.mp_mode == 0 )
+ {
+ DBG_8192C("[MPT], Error!! WaitC2Hevent mp_mode == 0!!\n");
+ return _FALSE;
+ }
+
+ _set_timer( &pMptCtx->MPh2c_timeout_timer, delay_time );
+
+ _rtw_down_sema(&pMptCtx->MPh2c_Sema);
+
+ if (pMptCtx->bMPh2c_timeout == _TRUE)
+ {
+ *C2H_event = _FALSE;
+
+ return _FALSE;
+ }
+
+ // for safty, cancel timer here again
+ _cancel_timer_ex(&pMptCtx->MPh2c_timeout_timer);
+
+ return _TRUE;
+}
+
+BT_CTRL_STATUS
+mptbt_CheckC2hFrame(
+ PADAPTER Adapter,
+ PBT_H2C pH2c,
+ PBT_EXT_C2H pExtC2h
+ )
+{
+ BT_CTRL_STATUS c2hStatus = BT_STATUS_C2H_SUCCESS;
+
+ //DBG_8192C("[MPT], MPT rsp C2H hex: %x %x %x %x %x %x \n"), pExtC2h , pExtC2h+1 ,pExtC2h+2 ,pExtC2h+3 ,pExtC2h+4 ,pExtC2h+5);
+
+ DBG_8192C("[MPT], statusCode = 0x%x\n", pExtC2h->statusCode);
+ DBG_8192C("[MPT], retLen = %d\n", pExtC2h->retLen);
+ DBG_8192C("[MPT], opCodeVer : req/rsp=%d/%d\n", pH2c->opCodeVer, pExtC2h->opCodeVer);
+ DBG_8192C("[MPT], reqNum : req/rsp=%d/%d\n", pH2c->reqNum, pExtC2h->reqNum);
+ if(pExtC2h->reqNum != pH2c->reqNum)
+ {
+ c2hStatus = BT_STATUS_C2H_REQNUM_MISMATCH;
+ DBG_8192C("[MPT], Error!! C2H reqNum Mismatch!!\n");
+ }
+ else if(pExtC2h->opCodeVer != pH2c->opCodeVer)
+ {
+ c2hStatus = BT_STATUS_OPCODE_L_VERSION_MISMATCH;
+ DBG_8192C("[MPT], Error!! OPCode version L mismatch!!\n");
+ }
+
+ 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,
+ PBT_H2C pH2c,
+ u2Byte h2cCmdLen
+ )
+{
+ //KIRQL OldIrql = KeGetCurrentIrql();
+ BT_CTRL_STATUS h2cStatus=BT_STATUS_H2C_SUCCESS;
+ PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
+ u1Byte i;
+
+ DBG_8192C("[MPT], mptbt_SendH2c()=========>\n");
+
+ //PlatformResetEvent(&pMptCtx->MptH2cRspEvent);
+ //PlatformResetEvent(&pMptCtx->MptBtC2hEvent);
+
+// if(OldIrql == PASSIVE_LEVEL)
+// {
+ //RTPRINT_DATA(FMPBT, FMPBT_H2C_CONTENT, ("[MPT], MPT H2C hex: \n"), pH2c, h2cCmdLen);
+
+ for(i=0; i<BT_H2C_MAX_RETRY; i++)
+ {
+ DBG_8192C("[MPT], Send H2C command to wifi!!!\n");
+
+ pMptCtx->MptH2cRspEvent = _FALSE;
+ pMptCtx->MptBtC2hEvent = _FALSE;
+
+#if defined(CONFIG_RTL8723A)
+ FillH2CCmd(Adapter, 70, h2cCmdLen, (pu1Byte)pH2c);
+#elif defined(CONFIG_RTL8723B)
+ rtl8723b_set_FwBtMpOper_cmd(Adapter, pH2c->opCode, pH2c->opCodeVer, pH2c->reqNum, pH2c->buf);
+#endif
+ pMptCtx->h2cReqNum++;
+ pMptCtx->h2cReqNum %= 16;
+
+ if(WaitC2Hevent(Adapter, &pMptCtx->MptH2cRspEvent, 100))
+ {
+ DBG_8192C("[MPT], Received WiFi MptH2cRspEvent!!!\n");
+ if(WaitC2Hevent(Adapter, &pMptCtx->MptBtC2hEvent, 400))
+ {
+ DBG_8192C("[MPT], Received MptBtC2hEvent!!!\n");
+ break;
+ }
+ else
+ {
+ DBG_8192C("[MPT], Error!!BT MptBtC2hEvent timeout!!\n");
+ h2cStatus = BT_STATUS_H2C_BT_NO_RSP;
+ }
+ }
+ else
+ {
+ DBG_8192C("[MPT], Error!!WiFi MptH2cRspEvent timeout!!\n");
+ h2cStatus = BT_STATUS_H2C_TIMTOUT;
+ }
+ }
+// }
+// else
+// {
+// RT_ASSERT(FALSE, ("[MPT], mptbt_SendH2c() can only run under PASSIVE_LEVEL!!\n"));
+// h2cStatus = BT_STATUS_WRONG_LEVEL;
+// }
+
+ DBG_8192C("[MPT], mptbt_SendH2c()<=========\n");
+ return h2cStatus;
+}
+
+
+
+BT_CTRL_STATUS
+mptbt_CheckBtRspStatus(
+ PADAPTER Adapter,
+ PBT_EXT_C2H pExtC2h
+ )
+{
+ BT_CTRL_STATUS retStatus=BT_OP_STATUS_SUCCESS;
+
+ switch(pExtC2h->statusCode)
+ {
+ case BT_OP_STATUS_SUCCESS:
+ retStatus = BT_STATUS_BT_OP_SUCCESS;
+ DBG_8192C("[MPT], BT status : BT_STATUS_SUCCESS\n");
+ break;
+ case BT_OP_STATUS_VERSION_MISMATCH:
+ retStatus = BT_STATUS_OPCODE_L_VERSION_MISMATCH;
+ DBG_8192C("[MPT], BT status : BT_STATUS_OPCODE_L_VERSION_MISMATCH\n");
+ break;
+ case BT_OP_STATUS_UNKNOWN_OPCODE:
+ retStatus = BT_STATUS_UNKNOWN_OPCODE_L;
+ DBG_8192C("[MPT], BT status : BT_STATUS_UNKNOWN_OPCODE_L\n");
+ break;
+ case BT_OP_STATUS_ERROR_PARAMETER:
+ retStatus = BT_STATUS_PARAMETER_FORMAT_ERROR_L;
+ DBG_8192C("[MPT], BT status : BT_STATUS_PARAMETER_FORMAT_ERROR_L\n");
+ break;
+ default:
+ retStatus = BT_STATUS_UNKNOWN_STATUS_L;
+ DBG_8192C("[MPT], BT status : BT_STATUS_UNKNOWN_STATUS_L\n");
+ break;
+ }
+
+ return retStatus;
+}
+
+
+
+BT_CTRL_STATUS
+mptbt_BtFwOpCodeProcess(
+ PADAPTER Adapter,
+ u1Byte btFwOpCode,
+ u1Byte opCodeVer,
+ pu1Byte pH2cPar,
+ u1Byte h2cParaLen
+ )
+{
+ u1Byte H2C_Parameter[6] ={0};
+ PBT_H2C pH2c=(PBT_H2C)&H2C_Parameter[0];
+ PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
+ PBT_EXT_C2H pExtC2h=(PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
+ u2Byte paraLen=0,i;
+ BT_CTRL_STATUS h2cStatus=BT_STATUS_H2C_SUCCESS, c2hStatus=BT_STATUS_C2H_SUCCESS;
+ BT_CTRL_STATUS retStatus=BT_STATUS_H2C_BT_NO_RSP;
+
+ if( Adapter->registrypriv.mp_mode == 0 )
+ {
+ DBG_8192C("[MPT], Error!! mptbt_BtFwOpCodeProces mp_mode == 0!!\n");
+ return _FALSE;
+ }
+
+ pH2c->opCode = btFwOpCode;
+ pH2c->opCodeVer = opCodeVer;
+ pH2c->reqNum = pMptCtx->h2cReqNum;
+ //PlatformMoveMemory(&pH2c->buf[0], pH2cPar, h2cParaLen);
+ //_rtw_memcpy(&pH2c->buf[0], pH2cPar, h2cParaLen);
+ _rtw_memcpy(pH2c->buf, pH2cPar, h2cParaLen);
+
+ DBG_8192C("[MPT], pH2c->opCode=%d\n", pH2c->opCode);
+ DBG_8192C("[MPT], pH2c->opCodeVer=%d\n", pH2c->opCodeVer);
+ DBG_8192C("[MPT], pH2c->reqNum=%d\n", pH2c->reqNum);
+ DBG_8192C("[MPT], h2c parameter length=%d\n", h2cParaLen);
+ for (i=0; i<h2cParaLen; i++)
+ {
+ DBG_8192C("[MPT], parameter[%d]=0x%02x\n", i, pH2c->buf[i]);
+ }
+
+ h2cStatus = mptbt_SendH2c(Adapter, pH2c, h2cParaLen+2);
+ if(BT_STATUS_H2C_SUCCESS == h2cStatus)
+ {
+ // if reach here, it means H2C get the correct c2h response,
+ c2hStatus = mptbt_CheckC2hFrame(Adapter, pH2c, pExtC2h);
+ if(BT_STATUS_C2H_SUCCESS == c2hStatus)
+ {
+ retStatus = mptbt_CheckBtRspStatus(Adapter, pExtC2h);
+ }
+ else
+ {
+ DBG_8192C("[MPT], Error!! C2H failed for pH2c->opCode=%d\n", pH2c->opCode);
+ // check c2h status error, return error status code to upper layer.
+ retStatus = c2hStatus;
+ }
+ }
+ else
+ {
+ DBG_8192C("[MPT], Error!! H2C failed for pH2c->opCode=%d\n", pH2c->opCode);
+ // check h2c status error, return error status code to upper layer.
+ retStatus = h2cStatus;
+ }
+
+ return retStatus;
+}
+
+
+
+
+u2Byte
+mptbt_BtReady(
+ PADAPTER Adapter,
+ PBT_REQ_CMD pBtReq,
+ PBT_RSP_CMD pBtRsp
+ )
+{
+ u1Byte h2cParaBuf[6] ={0};
+ u1Byte h2cParaLen=0;
+ u2Byte paraLen=0;
+ u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
+ u1Byte btOpcode;
+ u1Byte btOpcodeVer=0;
+ PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
+ PBT_EXT_C2H pExtC2h=(PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
+ u1Byte i;
+ u1Byte btFwVer=0, bdAddr[6]={0};
+ u2Byte btRealFwVer=0;
+ pu2Byte pu2Tmp=NULL;
+
+ //
+ // check upper layer parameters
+ //
+
+ // 1. check upper layer opcode version
+ if(pBtReq->opCodeVer != 1)
+ {
+ DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
+ pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
+ return paraLen;
+ }
+
+ pBtRsp->pParamStart[0] = MP_BT_NOT_READY;
+ paraLen = 10;
+ //
+ // execute lower layer opcodes
+ //
+
+ // Get BT FW version
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_GET_BT_VERSION;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ else
+ {
+ pu2Tmp = (pu2Byte)&pExtC2h->buf[0];
+ btRealFwVer = *pu2Tmp;
+ btFwVer = pExtC2h->buf[1];
+ DBG_8192C("[MPT], btRealFwVer=0x%x, btFwVer=0x%x\n", btRealFwVer, btFwVer);
+ }
+
+ // Get BD Address
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_GET_BD_ADDR_L;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ else
+ {
+ bdAddr[5] = pExtC2h->buf[0];
+ bdAddr[4] = pExtC2h->buf[1];
+ bdAddr[3] = pExtC2h->buf[2];
+ }
+
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_GET_BD_ADDR_H;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ else
+ {
+ bdAddr[2] = pExtC2h->buf[0];
+ bdAddr[1] = pExtC2h->buf[1];
+ bdAddr[0] = pExtC2h->buf[2];
+ }
+ DBG_8192C("[MPT], Local BDAddr:");
+ for(i=0; i<6; i++)
+ {
+ DBG_8192C(" 0x%x ", bdAddr[i]);
+ }
+ pBtRsp->status = BT_STATUS_SUCCESS;
+ pBtRsp->pParamStart[0] = MP_BT_READY;
+ pu2Tmp = (pu2Byte)&pBtRsp->pParamStart[1];
+ *pu2Tmp = btRealFwVer;
+ pBtRsp->pParamStart[3] = btFwVer;
+ for(i=0; i<6; i++)
+ {
+ pBtRsp->pParamStart[4+i] = bdAddr[5-i];
+ }
+
+ return paraLen;
+}
+
+void mptbt_close_WiFiRF(PADAPTER Adapter)
+{
+ PHY_SetBBReg(Adapter, 0x824, 0xF, 0x0);
+ PHY_SetBBReg(Adapter, 0x824, 0x700000, 0x0);
+ PHY_SetRFReg(Adapter, RF90_PATH_A, 0x0, 0xF0000, 0x0);
+}
+
+void mptbt_open_WiFiRF(PADAPTER Adapter)
+{
+ PHY_SetBBReg(Adapter, 0x824, 0x700000, 0x3);
+ PHY_SetBBReg(Adapter, 0x824, 0xF, 0x2);
+ PHY_SetRFReg(Adapter, RF90_PATH_A, 0x0, 0xF0000, 0x3);
+}
+
+u4Byte mptbt_switch_RF(PADAPTER Adapter, u1Byte Enter)
+{
+ u2Byte tmp_2byte = 0;
+
+ //Enter test mode
+ if (Enter) {
+ ////1>. close WiFi RF
+ mptbt_close_WiFiRF(Adapter);
+
+ ////2>. change ant switch to BT
+ tmp_2byte = rtw_read16(Adapter, 0x860);
+ tmp_2byte = tmp_2byte | BIT(9);
+ tmp_2byte = tmp_2byte & (~BIT(8));
+ rtw_write16(Adapter, 0x860, tmp_2byte);
+ rtw_write16(Adapter, 0x870, 0x300);
+ } else {
+ ////1>. Open WiFi RF
+ mptbt_open_WiFiRF(Adapter);
+
+ ////2>. change ant switch back
+ tmp_2byte = rtw_read16(Adapter, 0x860);
+ tmp_2byte = tmp_2byte | BIT(8);
+ tmp_2byte = tmp_2byte & (~BIT(9));
+ rtw_write16(Adapter, 0x860, tmp_2byte);
+ rtw_write16(Adapter, 0x870, 0x300);
+ }
+
+ return 0;
+}
+
+u2Byte
+mptbt_BtSetMode(
+ PADAPTER Adapter,
+ PBT_REQ_CMD pBtReq,
+ PBT_RSP_CMD pBtRsp
+ )
+{
+ u1Byte h2cParaBuf[6] ={0};
+ u1Byte h2cParaLen=0;
+ u2Byte paraLen=0;
+ u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
+ u1Byte btOpcode;
+ u1Byte btOpcodeVer=0;
+ u1Byte btModeToSet=0;
+
+ //
+ // check upper layer parameters
+ //
+ // 1. check upper layer opcode version
+ if(pBtReq->opCodeVer != 1)
+ {
+ DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
+ pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
+ return paraLen;
+ }
+ // 2. check upper layer parameter length
+ if(1 == pBtReq->paraLength)
+ {
+ btModeToSet = pBtReq->pParamStart[0];
+ DBG_8192C("[MPT], BtTestMode=%d \n", btModeToSet);
+ }
+ else
+ {
+ DBG_8192C("[MPT], Error!! wrong parameter length=%d (should be 1)\n", pBtReq->paraLength);
+ pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
+ return paraLen;
+ }
+
+ //
+ // execute lower layer opcodes
+ //
+
+ // 1. fill h2c parameters
+ // check bt mode
+ btOpcode = BT_LO_OP_SET_BT_MODE;
+ if(btModeToSet >= MP_BT_MODE_MAX)
+ {
+ pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ else
+ {
+ mptbt_switch_RF(Adapter, 1);
+
+ h2cParaBuf[0] = btModeToSet;
+ h2cParaLen = 1;
+ // 2. execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+
+ // 3. construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS == retStatus)
+ {
+ pBtRsp->status = BT_STATUS_SUCCESS;
+ }
+ else
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ }
+
+ return paraLen;
+}
+
+
+VOID
+MPTBT_FwC2hBtMpCtrl(
+ PADAPTER Adapter,
+ pu1Byte tmpBuf,
+ u1Byte length
+ )
+{
+ u32 i;
+ PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
+ PBT_EXT_C2H pExtC2h=(PBT_EXT_C2H)tmpBuf;
+
+ if(Adapter->bBTFWReady == _FALSE || Adapter->registrypriv.mp_mode == 0 )
+ {
+ DBG_8192C("Ignore C2H BT MP Info since not in MP mode \n");
+ return;
+ }
+ if( length > 32 || length < 3 )
+ {
+ DBG_8192C("\n [MPT], pExtC2h->buf hex: length=%d > 32 || < 3\n",length);
+ return;
+ }
+
+ //cancel_timeout for h2c handle
+ _cancel_timer_ex(&pMptCtx->MPh2c_timeout_timer);
+
+ for (i=0; i<length; i++)
+ {
+ DBG_8192C("[MPT], %s, buf[%d]=0x%02x ", __FUNCTION__, i, tmpBuf[i]);
+ }
+ DBG_8192C("[MPT], pExtC2h->extendId=0x%x\n", pExtC2h->extendId);
+
+ switch(pExtC2h->extendId)
+ {
+ case EXT_C2H_WIFI_FW_ACTIVE_RSP:
+ DBG_8192C("[MPT], EXT_C2H_WIFI_FW_ACTIVE_RSP\n");
+#if 0
+ DBG_8192C("[MPT], pExtC2h->buf hex: \n");
+ for (i=0; i<(length-3); i++)
+ {
+ DBG_8192C(" 0x%x ", pExtC2h->buf[i]);
+ }
+#endif
+ if ((_FALSE == pMptCtx->bMPh2c_timeout)
+ && (_FALSE == pMptCtx->MptH2cRspEvent))
+ {
+ pMptCtx->MptH2cRspEvent = _TRUE;
+ _rtw_up_sema(&pMptCtx->MPh2c_Sema);
+ }
+ break;
+
+ case EXT_C2H_TRIG_BY_BT_FW:
+ DBG_8192C("[MPT], EXT_C2H_TRIG_BY_BT_FW\n");
+ _rtw_memcpy(&pMptCtx->c2hBuf[0], tmpBuf, length);
+ DBG_8192C("[MPT], pExtC2h->statusCode=0x%x\n", pExtC2h->statusCode);
+ DBG_8192C("[MPT], pExtC2h->retLen=0x%x\n", pExtC2h->retLen);
+ DBG_8192C("[MPT], pExtC2h->opCodeVer=0x%x\n", pExtC2h->opCodeVer);
+ DBG_8192C("[MPT], pExtC2h->reqNum=0x%x\n", pExtC2h->reqNum);
+ for (i=0; i<(length-3); i++)
+ {
+ DBG_8192C("[MPT], pExtC2h->buf[%d]=0x%02x\n", i, pExtC2h->buf[i]);
+ }
+
+ if ((_FALSE == pMptCtx->bMPh2c_timeout)
+ && (_TRUE == pMptCtx->MptH2cRspEvent)
+ && (_FALSE == pMptCtx->MptBtC2hEvent))
+ {
+ pMptCtx->MptBtC2hEvent = _TRUE;
+ _rtw_up_sema(&pMptCtx->MPh2c_Sema);
+ }
+ break;
+
+ default:
+ DBG_8192C("[MPT], EXT_C2H Target not found,pExtC2h->extendId =%d ,pExtC2h->reqNum=%d\n",pExtC2h->extendId,pExtC2h->reqNum);
+ break;
+ }
+
+
+
+}
+
+
+u2Byte
+mptbt_BtGetGeneral(
+ IN PADAPTER Adapter,
+ IN PBT_REQ_CMD pBtReq,
+ IN PBT_RSP_CMD pBtRsp
+ )
+{
+ PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
+ PBT_EXT_C2H pExtC2h=(PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
+ u1Byte h2cParaBuf[6] ={0};
+ u1Byte h2cParaLen=0;
+ u2Byte paraLen=0;
+ u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
+ u1Byte btOpcode, bdAddr[6]={0};
+ u1Byte btOpcodeVer=0;
+ u1Byte getType=0, i;
+ u2Byte getParaLen=0, validParaLen=0;
+ u1Byte regType=0, reportType=0;
+ u4Byte regAddr=0, regValue=0;
+ pu4Byte pu4Tmp;
+ pu2Byte pu2Tmp;
+ pu1Byte pu1Tmp;
+
+ //
+ // check upper layer parameters
+ //
+
+ // check upper layer opcode version
+ if(pBtReq->opCodeVer != 1)
+ {
+ DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
+ pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
+ return paraLen;
+ }
+ // check upper layer parameter length
+ if(pBtReq->paraLength < 1)
+ {
+ DBG_8192C("[MPT], Error!! wrong parameter length=%d (should larger than 1)\n", pBtReq->paraLength);
+ pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
+ return paraLen;
+ }
+ getParaLen = pBtReq->paraLength - 1;
+ getType = pBtReq->pParamStart[0];
+
+ DBG_8192C("[MPT], getType=%d, getParaLen=%d\n", getType, getParaLen);
+
+ // check parameter first
+ switch(getType)
+ {
+ case BT_GGET_REG:
+ DBG_8192C("[MPT], [BT_GGET_REG]\n");
+ validParaLen = 5;
+ if(getParaLen == validParaLen)
+ {
+ btOpcode = BT_LO_OP_READ_REG;
+ regType = pBtReq->pParamStart[1];
+ pu4Tmp = (pu4Byte)&pBtReq->pParamStart[2];
+ regAddr = *pu4Tmp;
+ DBG_8192C("[MPT], BT_GGET_REG regType=0x%02x, regAddr=0x%08x!!\n",
+ regType, regAddr);
+ if(regType >= BT_REG_MAX)
+ {
+ pBtRsp->status = (btOpcode<<8)| BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ else
+ {
+ if( ((BT_REG_RF==regType)&&(regAddr>0x7f)) ||
+ ((BT_REG_MODEM==regType)&&(regAddr>0x1ff)) ||
+ ((BT_REG_BLUEWIZE==regType)&&(regAddr>0xfff)) ||
+ ((BT_REG_VENDOR==regType)&&(regAddr>0xfff)) ||
+ ((BT_REG_LE==regType)&&(regAddr>0xfff)) )
+ {
+ pBtRsp->status = (btOpcode<<8)| BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ }
+ }
+ break;
+ case BT_GGET_STATUS:
+ DBG_8192C("[MPT], [BT_GGET_STATUS]\n");
+ validParaLen = 0;
+ break;
+ case BT_GGET_REPORT:
+ DBG_8192C("[MPT], [BT_GGET_REPORT]\n");
+ validParaLen = 1;
+ if(getParaLen == validParaLen)
+ {
+ reportType = pBtReq->pParamStart[1];
+ DBG_8192C("[MPT], BT_GGET_REPORT reportType=0x%x!!\n", reportType);
+ if(reportType >= BT_REPORT_MAX)
+ {
+ pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ }
+ break;
+ default:
+ {
+ DBG_8192C("[MPT], Error!! getType=%d, out of range\n", getType);
+ pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ break;
+ }
+ if(getParaLen != validParaLen)
+ {
+ DBG_8192C("[MPT], Error!! wrong parameter length=%d for BT_GET_GEN_CMD cmd id=0x%x, paraLen should=0x%x\n",
+ getParaLen, getType, validParaLen);
+ pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
+ return paraLen;
+ }
+
+ //
+ // execute lower layer opcodes
+ //
+ if(BT_GGET_REG == getType)
+ {
+ // fill h2c parameters
+ // here we should write reg value first then write the address, adviced by Austin
+ btOpcode = BT_LO_OP_READ_REG;
+ h2cParaBuf[0] = regType;
+ h2cParaBuf[1] = pBtReq->pParamStart[2];
+ h2cParaBuf[2] = pBtReq->pParamStart[3];
+ h2cParaLen = 3;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ pu2Tmp = (pu2Byte)&pExtC2h->buf[0];
+ regValue = *pu2Tmp;
+ DBG_8192C("[MPT], read reg regType=0x%02x, regAddr=0x%08x, regValue=0x%04x\n",
+ regType, regAddr, regValue);
+
+ pu4Tmp = (pu4Byte)&pBtRsp->pParamStart[0];
+ *pu4Tmp = regValue;
+ paraLen = 4;
+ }
+ else if(BT_GGET_STATUS == getType)
+ {
+ btOpcode = BT_LO_OP_GET_BT_STATUS;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ pBtRsp->pParamStart[0] = pExtC2h->buf[0];
+ pBtRsp->pParamStart[1] = pExtC2h->buf[1];
+ DBG_8192C("[MPT], read bt status, testMode=0x%x, testStatus=0x%x\n",
+ pBtRsp->pParamStart[0], pBtRsp->pParamStart[1]);
+ paraLen = 2;
+ }
+ else if(BT_GGET_REPORT == getType)
+ {
+ switch(reportType)
+ {
+ case BT_REPORT_RX_PACKET_CNT:
+ {
+ DBG_8192C("[MPT], [Rx Packet Counts]\n");
+ btOpcode = BT_LO_OP_GET_RX_PKT_CNT_L;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ pBtRsp->pParamStart[0] = pExtC2h->buf[0];
+ pBtRsp->pParamStart[1] = pExtC2h->buf[1];
+
+ btOpcode = BT_LO_OP_GET_RX_PKT_CNT_H;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ pBtRsp->pParamStart[2] = pExtC2h->buf[0];
+ pBtRsp->pParamStart[3] = pExtC2h->buf[1];
+ paraLen = 4;
+ }
+ break;
+ case BT_REPORT_RX_ERROR_BITS:
+ {
+ DBG_8192C("[MPT], [Rx Error Bits]\n");
+ btOpcode = BT_LO_OP_GET_RX_ERROR_BITS_L;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ pBtRsp->pParamStart[0] = pExtC2h->buf[0];
+ pBtRsp->pParamStart[1] = pExtC2h->buf[1];
+
+ btOpcode = BT_LO_OP_GET_RX_ERROR_BITS_H;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ pBtRsp->pParamStart[2] = pExtC2h->buf[0];
+ pBtRsp->pParamStart[3] = pExtC2h->buf[1];
+ paraLen = 4;
+ }
+ break;
+ case BT_REPORT_RSSI:
+ {
+ DBG_8192C("[MPT], [RSSI]\n");
+ btOpcode = BT_LO_OP_GET_RSSI;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ pBtRsp->pParamStart[0] = pExtC2h->buf[0];
+ pBtRsp->pParamStart[1] = pExtC2h->buf[1];
+ paraLen = 2;
+ }
+ break;
+ case BT_REPORT_CFO_HDR_QUALITY:
+ {
+ DBG_8192C("[MPT], [CFO & Header Quality]\n");
+ btOpcode = BT_LO_OP_GET_CFO_HDR_QUALITY_L;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ pBtRsp->pParamStart[0] = pExtC2h->buf[0];
+ pBtRsp->pParamStart[1] = pExtC2h->buf[1];
+
+ btOpcode = BT_LO_OP_GET_CFO_HDR_QUALITY_H;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ pBtRsp->pParamStart[2] = pExtC2h->buf[0];
+ pBtRsp->pParamStart[3] = pExtC2h->buf[1];
+ paraLen = 4;
+ }
+ break;
+ case BT_REPORT_CONNECT_TARGET_BD_ADDR:
+ {
+ DBG_8192C("[MPT], [Connected Target BD ADDR]\n");
+ btOpcode = BT_LO_OP_GET_TARGET_BD_ADDR_L;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ bdAddr[5] = pExtC2h->buf[0];
+ bdAddr[4] = pExtC2h->buf[1];
+ bdAddr[3] = pExtC2h->buf[2];
+
+ btOpcode = BT_LO_OP_GET_TARGET_BD_ADDR_H;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ bdAddr[2] = pExtC2h->buf[0];
+ bdAddr[1] = pExtC2h->buf[1];
+ bdAddr[0] = pExtC2h->buf[2];
+
+ DBG_8192C("[MPT], Connected Target BDAddr:%s", bdAddr);
+ for(i=0; i<6; i++)
+ {
+ pBtRsp->pParamStart[i] = bdAddr[5-i];
+ }
+ paraLen = 6;
+ }
+ break;
+ default:
+ pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ break;
+ }
+ }
+
+ pBtRsp->status = BT_STATUS_SUCCESS;
+ return paraLen;
+}
+
+
+
+u2Byte
+mptbt_BtSetGeneral(
+ IN PADAPTER Adapter,
+ IN PBT_REQ_CMD pBtReq,
+ IN PBT_RSP_CMD pBtRsp
+ )
+{
+ u1Byte h2cParaBuf[6] ={0};
+ u1Byte h2cParaLen=0;
+ u2Byte paraLen=0;
+ u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
+ u1Byte btOpcode;
+ u1Byte btOpcodeVer=0;
+ u1Byte setType=0;
+ u2Byte setParaLen=0, validParaLen=0;
+ u1Byte regType=0, bdAddr[6]={0}, calVal=0;
+ u4Byte regAddr=0, regValue=0;
+ pu4Byte pu4Tmp;
+ pu2Byte pu2Tmp;
+ pu1Byte pu1Tmp;
+
+ //
+ // check upper layer parameters
+ //
+
+ // check upper layer opcode version
+ if(pBtReq->opCodeVer != 1)
+ {
+ DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
+ pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
+ return paraLen;
+ }
+ // check upper layer parameter length
+ if(pBtReq->paraLength < 1)
+ {
+ DBG_8192C("[MPT], Error!! wrong parameter length=%d (should larger than 1)\n", pBtReq->paraLength);
+ pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
+ return paraLen;
+ }
+ setParaLen = pBtReq->paraLength - 1;
+ setType = pBtReq->pParamStart[0];
+
+ DBG_8192C("[MPT], setType=%d, setParaLen=%d\n", setType, setParaLen);
+
+ // check parameter first
+ switch(setType)
+ {
+ case BT_GSET_REG:
+ DBG_8192C ("[MPT], [BT_GSET_REG]\n");
+ validParaLen = 9;
+ if(setParaLen == validParaLen)
+ {
+ btOpcode = BT_LO_OP_WRITE_REG_VALUE;
+ regType = pBtReq->pParamStart[1];
+ pu4Tmp = (pu4Byte)&pBtReq->pParamStart[2];
+ regAddr = *pu4Tmp;
+ pu4Tmp = (pu4Byte)&pBtReq->pParamStart[6];
+ regValue = *pu4Tmp;
+ DBG_8192C("[MPT], BT_GSET_REG regType=0x%x, regAddr=0x%x, regValue=0x%x!!\n",
+ regType, regAddr, regValue);
+ if(regType >= BT_REG_MAX)
+ {
+ pBtRsp->status = (btOpcode<<8)| BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ else
+ {
+ if( ((BT_REG_RF==regType)&&(regAddr>0x7f)) ||
+ ((BT_REG_MODEM==regType)&&(regAddr>0x1ff)) ||
+ ((BT_REG_BLUEWIZE==regType)&&(regAddr>0xfff)) ||
+ ((BT_REG_VENDOR==regType)&&(regAddr>0xfff)) ||
+ ((BT_REG_LE==regType)&&(regAddr>0xfff)) )
+ {
+ pBtRsp->status = (btOpcode<<8)| BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ }
+ }
+ break;
+ case BT_GSET_RESET:
+ DBG_8192C("[MPT], [BT_GSET_RESET]\n");
+ validParaLen = 0;
+ break;
+ case BT_GSET_TARGET_BD_ADDR:
+ DBG_8192C("[MPT], [BT_GSET_TARGET_BD_ADDR]\n");
+ validParaLen = 6;
+ if(setParaLen == validParaLen)
+ {
+ btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_H;
+ if( (pBtReq->pParamStart[1]==0) &&
+ (pBtReq->pParamStart[2]==0) &&
+ (pBtReq->pParamStart[3]==0) &&
+ (pBtReq->pParamStart[4]==0) &&
+ (pBtReq->pParamStart[5]==0) &&
+ (pBtReq->pParamStart[6]==0) )
+ {
+ DBG_8192C("[MPT], Error!! targetBDAddr=all zero\n");
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ if( (pBtReq->pParamStart[1]==0xff) &&
+ (pBtReq->pParamStart[2]==0xff) &&
+ (pBtReq->pParamStart[3]==0xff) &&
+ (pBtReq->pParamStart[4]==0xff) &&
+ (pBtReq->pParamStart[5]==0xff) &&
+ (pBtReq->pParamStart[6]==0xff) )
+ {
+ DBG_8192C("[MPT], Error!! targetBDAddr=all 0xf\n");
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ bdAddr[0] = pBtReq->pParamStart[6];
+ bdAddr[1] = pBtReq->pParamStart[5];
+ bdAddr[2] = pBtReq->pParamStart[4];
+ bdAddr[3] = pBtReq->pParamStart[3];
+ bdAddr[4] = pBtReq->pParamStart[2];
+ bdAddr[5] = pBtReq->pParamStart[1];
+ DBG_8192C ("[MPT], target BDAddr:%x,%x,%x,%x,%x,%x\n",
+ bdAddr[0],bdAddr[1],bdAddr[2],bdAddr[3],bdAddr[4],bdAddr[5]);
+ }
+ break;
+ case BT_GSET_TX_PWR_FINETUNE:
+ DBG_8192C("[MPT], [BT_GSET_TX_PWR_FINETUNE]\n");
+ validParaLen = 1;
+ if(setParaLen == validParaLen)
+ {
+ btOpcode = BT_LO_OP_SET_TX_POWER_CALIBRATION;
+ calVal = pBtReq->pParamStart[1];
+ if( (calVal<1) || (calVal>9) )
+ {
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ DBG_8192C ("[MPT], calVal=%d\n", calVal);
+ }
+ break;
+ case BT_SET_TRACKING_INTERVAL:
+ DBG_871X("[MPT], [BT_SET_TRACKING_INTERVAL] setParaLen =%d \n",setParaLen);
+
+ validParaLen = 1;
+ if(setParaLen == validParaLen)
+ calVal = pBtReq->pParamStart[1];
+ break;
+ case BT_SET_THERMAL_METER:
+ DBG_871X("[MPT], [BT_SET_THERMAL_METER] setParaLen =%d \n",setParaLen);
+ validParaLen = 1;
+ if(setParaLen == validParaLen)
+ calVal = pBtReq->pParamStart[1];
+ break;
+ case BT_ENABLE_CFO_TRACKING:
+ DBG_871X("[MPT], [BT_ENABLE_CFO_TRACKING] setParaLen =%d \n",setParaLen);
+ validParaLen = 1;
+ if(setParaLen == validParaLen)
+ calVal = pBtReq->pParamStart[1];
+ break;
+ case BT_GSET_UPDATE_BT_PATCH:
+ if(IS_HARDWARE_TYPE_8723AE(Adapter) && Adapter->bFWReady)
+ {
+ u1Byte i;
+ DBG_8192C ("[MPT], write regs for load patch\n");
+ //BTFwPatch8723A(Adapter);
+ PlatformEFIOWrite1Byte(Adapter, 0xCC, 0x2d);
+ rtw_msleep_os(50);
+ PlatformEFIOWrite4Byte(Adapter, 0x68, 0xa005000c);
+ rtw_msleep_os(50);
+ PlatformEFIOWrite4Byte(Adapter, 0x68, 0xb005000c);
+ rtw_msleep_os(50);
+ PlatformEFIOWrite1Byte(Adapter, 0xCC, 0x29);
+ for(i=0; i<12; i++)
+ rtw_msleep_os(100);
+//#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
+// BTFwPatch8723A(Adapter);
+//#endif
+ DBG_8192C("[MPT], load BT FW Patch finished!!!\n");
+ }
+ break;
+ default:
+ {
+ DBG_8192C ("[MPT], Error!! setType=%d, out of range\n", setType);
+ pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ break;
+ }
+ if(setParaLen != validParaLen)
+ {
+ DBG_8192C("[MPT], Error!! wrong parameter length=%d for BT_SET_GEN_CMD cmd id=0x%x, paraLen should=0x%x\n",
+ setParaLen, setType, validParaLen);
+ pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
+ return paraLen;
+ }
+
+ //
+ // execute lower layer opcodes
+ //
+ if(BT_GSET_REG == setType)
+ {
+ // fill h2c parameters
+ // here we should write reg value first then write the address, adviced by Austin
+ btOpcode = BT_LO_OP_WRITE_REG_VALUE;
+ h2cParaBuf[0] = pBtReq->pParamStart[6];
+ h2cParaBuf[1] = pBtReq->pParamStart[7];
+ h2cParaBuf[2] = pBtReq->pParamStart[8];
+ h2cParaLen = 3;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ // write reg address
+ btOpcode = BT_LO_OP_WRITE_REG_ADDR;
+ h2cParaBuf[0] = regType;
+ h2cParaBuf[1] = pBtReq->pParamStart[2];
+ h2cParaBuf[2] = pBtReq->pParamStart[3];
+ h2cParaLen = 3;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ }
+ else if(BT_GSET_RESET == setType)
+ {
+ btOpcode = BT_LO_OP_RESET;
+ h2cParaLen = 0;
+ // execute h2c and check respond c2h from bt fw is correct or not
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ }
+ else if(BT_GSET_TARGET_BD_ADDR == setType)
+ {
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_L;
+ h2cParaBuf[0] = pBtReq->pParamStart[1];
+ h2cParaBuf[1] = pBtReq->pParamStart[2];
+ h2cParaBuf[2] = pBtReq->pParamStart[3];
+ h2cParaLen = 3;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_H;
+ h2cParaBuf[0] = pBtReq->pParamStart[4];
+ h2cParaBuf[1] = pBtReq->pParamStart[5];
+ h2cParaBuf[2] = pBtReq->pParamStart[6];
+ h2cParaLen = 3;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ }
+ else if(BT_GSET_TX_PWR_FINETUNE == setType)
+ {
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_TX_POWER_CALIBRATION;
+ h2cParaBuf[0] = calVal;
+ h2cParaLen = 1;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ }
+ else if(BT_SET_TRACKING_INTERVAL == setType)
+ {
+ // BT_LO_OP_SET_TRACKING_INTERVAL = 0x22,
+ // BT_LO_OP_SET_THERMAL_METER = 0x23,
+ // BT_LO_OP_ENABLE_CFO_TRACKING = 0x24,
+ btOpcode = BT_LO_OP_SET_TRACKING_INTERVAL;
+ h2cParaBuf[0] = calVal;
+ h2cParaLen = 1;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ }
+ else if(BT_SET_THERMAL_METER == setType)
+ {
+ btOpcode = BT_LO_OP_SET_THERMAL_METER;
+ h2cParaBuf[0] = calVal;
+ h2cParaLen = 1;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ }
+ else if(BT_ENABLE_CFO_TRACKING == setType)
+ {
+ btOpcode = BT_LO_OP_ENABLE_CFO_TRACKING;
+ h2cParaBuf[0] = calVal;
+ h2cParaLen = 1;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+ }
+
+ pBtRsp->status = BT_STATUS_SUCCESS;
+ return paraLen;
+}
+
+
+
+u2Byte
+mptbt_BtSetTxRxPars(
+ IN PADAPTER Adapter,
+ IN PBT_REQ_CMD pBtReq,
+ IN PBT_RSP_CMD pBtRsp
+ )
+{
+ u1Byte h2cParaBuf[6] ={0};
+ u1Byte h2cParaLen=0;
+ u2Byte paraLen=0;
+ u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
+ u1Byte btOpcode;
+ u1Byte btOpcodeVer=0;
+ PBT_TXRX_PARAMETERS pTxRxPars=(PBT_TXRX_PARAMETERS)&pBtReq->pParamStart[0];
+ u2Byte lenTxRx=sizeof(BT_TXRX_PARAMETERS);
+ u1Byte i;
+ u1Byte bdAddr[6]={0};
+
+ //
+ // check upper layer parameters
+ //
+
+ // 1. check upper layer opcode version
+ if(pBtReq->opCodeVer != 1)
+ {
+ DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
+ pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
+ return paraLen;
+ }
+ // 2. check upper layer parameter length
+ if(pBtReq->paraLength == sizeof(BT_TXRX_PARAMETERS))
+ {
+ DBG_8192C ("[MPT], pTxRxPars->txrxChannel=0x%x \n", pTxRxPars->txrxChannel);
+ DBG_8192C ("[MPT], pTxRxPars->txrxTxPktCnt=0x%8x \n", pTxRxPars->txrxTxPktCnt);
+ DBG_8192C ("[MPT], pTxRxPars->txrxTxPktInterval=0x%x \n", pTxRxPars->txrxTxPktInterval);
+ DBG_8192C ("[MPT], pTxRxPars->txrxPayloadType=0x%x \n", pTxRxPars->txrxPayloadType);
+ DBG_8192C ("[MPT], pTxRxPars->txrxPktType=0x%x \n", pTxRxPars->txrxPktType);
+ DBG_8192C ("[MPT], pTxRxPars->txrxPayloadLen=0x%x \n", pTxRxPars->txrxPayloadLen);
+ DBG_8192C ("[MPT], pTxRxPars->txrxPktHeader=0x%x \n", pTxRxPars->txrxPktHeader);
+ DBG_8192C ("[MPT], pTxRxPars->txrxWhitenCoeff=0x%x \n", pTxRxPars->txrxWhitenCoeff);
+ bdAddr[0] = pTxRxPars->txrxBdaddr[5];
+ bdAddr[1] = pTxRxPars->txrxBdaddr[4];
+ bdAddr[2] = pTxRxPars->txrxBdaddr[3];
+ bdAddr[3] = pTxRxPars->txrxBdaddr[2];
+ bdAddr[4] = pTxRxPars->txrxBdaddr[1];
+ bdAddr[5] = pTxRxPars->txrxBdaddr[0];
+ DBG_8192C ("[MPT], pTxRxPars->txrxBdaddr: %s", &bdAddr[0]);
+ DBG_8192C ("[MPT], pTxRxPars->txrxTxGainIndex=0x%x \n", pTxRxPars->txrxTxGainIndex);
+ }
+ else
+ {
+ DBG_8192C ("[MPT], Error!! pBtReq->paraLength=%d, correct Len=%d\n", pBtReq->paraLength, lenTxRx);
+ pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
+ return paraLen;
+ }
+
+ //
+ // execute lower layer opcodes
+ //
+
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_PKT_HEADER;
+ if(pTxRxPars->txrxPktHeader > 0x3ffff)
+ {
+ DBG_8192C ("[MPT], Error!! pTxRxPars->txrxPktHeader=0x%x is out of range, (should be between 0x0~0x3ffff)\n", pTxRxPars->txrxPktHeader);
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ else
+ {
+ h2cParaBuf[0] = (u1Byte)(pTxRxPars->txrxPktHeader&0xff);
+ h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxPktHeader&0xff00)>>8);
+ h2cParaBuf[2] = (u1Byte)((pTxRxPars->txrxPktHeader&0xff0000)>>16);
+ h2cParaLen = 3;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_PKT_TYPE_LEN;
+ {
+ u2Byte payloadLenLimit=0;
+ switch(pTxRxPars->txrxPktType)
+ {
+ case MP_BT_PKT_DH1:
+ payloadLenLimit = 27*8;
+ break;
+ case MP_BT_PKT_DH3:
+ payloadLenLimit = 183*8;
+ break;
+ case MP_BT_PKT_DH5:
+ payloadLenLimit = 339*8;
+ break;
+ case MP_BT_PKT_2DH1:
+ payloadLenLimit = 54*8;
+ break;
+ case MP_BT_PKT_2DH3:
+ payloadLenLimit = 367*8;
+ break;
+ case MP_BT_PKT_2DH5:
+ payloadLenLimit = 679*8;
+ break;
+ case MP_BT_PKT_3DH1:
+ payloadLenLimit = 83*8;
+ break;
+ case MP_BT_PKT_3DH3:
+ payloadLenLimit = 552*8;
+ break;
+ case MP_BT_PKT_3DH5:
+ payloadLenLimit = 1021*8;
+ break;
+ case MP_BT_PKT_LE:
+ payloadLenLimit = 39*8;
+ break;
+ default:
+ {
+ DBG_8192C ("[MPT], Error!! Unknown pTxRxPars->txrxPktType=0x%x\n", pTxRxPars->txrxPktType);
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ break;
+ }
+
+ if(pTxRxPars->txrxPayloadLen > payloadLenLimit)
+ {
+ DBG_8192C ("[MPT], Error!! pTxRxPars->txrxPayloadLen=0x%x, (should smaller than %d)\n",
+ pTxRxPars->txrxPayloadLen, payloadLenLimit);
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+
+ h2cParaBuf[0] = pTxRxPars->txrxPktType;
+ h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxPayloadLen&0xff));
+ h2cParaBuf[2] = (u1Byte)((pTxRxPars->txrxPayloadLen&0xff00)>>8);
+ h2cParaLen = 3;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_PKT_CNT_L_PL_TYPE;
+ if(pTxRxPars->txrxPayloadType > MP_BT_PAYLOAD_MAX)
+ {
+ DBG_8192C ("[MPT], Error!! pTxRxPars->txrxPayloadType=0x%x, (should be between 0~4)\n", pTxRxPars->txrxPayloadType);
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ else
+ {
+ h2cParaBuf[0] = (u1Byte)((pTxRxPars->txrxTxPktCnt&0xff));
+ h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxTxPktCnt&0xff00)>>8);
+ h2cParaBuf[2] = pTxRxPars->txrxPayloadType;
+ h2cParaLen = 3;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_PKT_CNT_H_PKT_INTV;
+ if(pTxRxPars->txrxTxPktInterval > 15)
+ {
+ DBG_8192C ("[MPT], Error!! pTxRxPars->txrxTxPktInterval=0x%x, (should be between 0~15)\n", pTxRxPars->txrxTxPktInterval);
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ else
+ {
+ h2cParaBuf[0] = (u1Byte)((pTxRxPars->txrxTxPktCnt&0xff0000)>>16);
+ h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxTxPktCnt&0xff000000)>>24);
+ h2cParaBuf[2] = pTxRxPars->txrxTxPktInterval;
+ h2cParaLen = 3;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_WHITENCOEFF;
+ {
+ h2cParaBuf[0] = pTxRxPars->txrxWhitenCoeff;
+ h2cParaLen = 1;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_CHNL_TX_GAIN;
+ if( (pTxRxPars->txrxChannel > 78) ||
+ (pTxRxPars->txrxTxGainIndex > 7) )
+ {
+ DBG_8192C ("[MPT], Error!! pTxRxPars->txrxChannel=0x%x, (should be between 0~78)\n", pTxRxPars->txrxChannel);
+ DBG_8192C ("[MPT], Error!! pTxRxPars->txrxTxGainIndex=0x%x, (should be between 0~7)\n", pTxRxPars->txrxTxGainIndex);
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ else
+ {
+ h2cParaBuf[0] = pTxRxPars->txrxChannel;
+ h2cParaBuf[1] = pTxRxPars->txrxTxGainIndex;
+ h2cParaLen = 2;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ // fill h2c parameters
+ btOpcode = BT_LO_OP_SET_BD_ADDR_L;
+ if( (pTxRxPars->txrxBdaddr[0]==0) &&
+ (pTxRxPars->txrxBdaddr[1]==0) &&
+ (pTxRxPars->txrxBdaddr[2]==0) &&
+ (pTxRxPars->txrxBdaddr[3]==0) &&
+ (pTxRxPars->txrxBdaddr[4]==0) &&
+ (pTxRxPars->txrxBdaddr[5]==0) )
+ {
+ DBG_8192C ("[MPT], Error!! pTxRxPars->txrxBdaddr=all zero\n");
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ if( (pTxRxPars->txrxBdaddr[0]==0xff) &&
+ (pTxRxPars->txrxBdaddr[1]==0xff) &&
+ (pTxRxPars->txrxBdaddr[2]==0xff) &&
+ (pTxRxPars->txrxBdaddr[3]==0xff) &&
+ (pTxRxPars->txrxBdaddr[4]==0xff) &&
+ (pTxRxPars->txrxBdaddr[5]==0xff) )
+ {
+ DBG_8192C ("[MPT], Error!! pTxRxPars->txrxBdaddr=all 0xf\n");
+ pBtRsp->status = (btOpcode<<8)|BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+
+ {
+ h2cParaBuf[0] = pTxRxPars->txrxBdaddr[0];
+ h2cParaBuf[1] = pTxRxPars->txrxBdaddr[1];
+ h2cParaBuf[2] = pTxRxPars->txrxBdaddr[2];
+ h2cParaLen = 3;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ btOpcode = BT_LO_OP_SET_BD_ADDR_H;
+ {
+ h2cParaBuf[0] = pTxRxPars->txrxBdaddr[3];
+ h2cParaBuf[1] = pTxRxPars->txrxBdaddr[4];
+ h2cParaBuf[2] = pTxRxPars->txrxBdaddr[5];
+ h2cParaLen = 3;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+ // ckeck bt return status.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C ("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ pBtRsp->status = BT_STATUS_SUCCESS;
+ return paraLen;
+}
+
+
+
+u2Byte
+mptbt_BtTestCtrl(
+ IN PADAPTER Adapter,
+ IN PBT_REQ_CMD pBtReq,
+ IN PBT_RSP_CMD pBtRsp
+ )
+{
+ u1Byte h2cParaBuf[6] ={0};
+ u1Byte h2cParaLen=0;
+ u2Byte paraLen=0;
+ u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
+ u1Byte btOpcode;
+ u1Byte btOpcodeVer=0;
+ u1Byte testCtrl=0;
+
+ //
+ // check upper layer parameters
+ //
+
+ // 1. check upper layer opcode version
+ if(pBtReq->opCodeVer != 1)
+ {
+ DBG_8192C("[MPT], Error!! Upper OP code version not match!!!\n");
+ pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
+ return paraLen;
+ }
+ // 2. check upper layer parameter length
+ if(1 == pBtReq->paraLength)
+ {
+ testCtrl = pBtReq->pParamStart[0];
+ DBG_8192C("[MPT], testCtrl=%d \n", testCtrl);
+ }
+ else
+ {
+ DBG_8192C("[MPT], Error!! wrong parameter length=%d (should be 1)\n", pBtReq->paraLength);
+ pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
+ return paraLen;
+ }
+
+ //
+ // execute lower layer opcodes
+ //
+
+ // 1. fill h2c parameters
+ // check bt mode
+ btOpcode = BT_LO_OP_TEST_CTRL;
+ if(testCtrl >= MP_BT_TEST_MAX)
+ {
+ DBG_8192C("[MPT], Error!! testCtrl=0x%x, (should be between smaller or equal to 0x%x)\n",
+ testCtrl, MP_BT_TEST_MAX-1);
+ pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
+ return paraLen;
+ }
+ else
+ {
+ h2cParaBuf[0] = testCtrl;
+ h2cParaLen = 1;
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ }
+
+ // 3. construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ pBtRsp->status = BT_STATUS_SUCCESS;
+ return paraLen;
+}
+
+
+u2Byte
+mptbt_TestBT(
+ IN PADAPTER Adapter,
+ IN PBT_REQ_CMD pBtReq,
+ IN PBT_RSP_CMD pBtRsp
+ )
+{
+
+ u1Byte h2cParaBuf[6] ={0};
+ u1Byte h2cParaLen=0;
+ u2Byte paraLen=0;
+ u1Byte retStatus=BT_STATUS_BT_OP_SUCCESS;
+ u1Byte btOpcode;
+ u1Byte btOpcodeVer=0;
+ u1Byte testCtrl=0;
+
+ // 1. fill h2c parameters
+ btOpcode = 0x11;
+ h2cParaBuf[0] = 0x11;
+ h2cParaBuf[1] = 0x0;
+ h2cParaBuf[2] = 0x0;
+ h2cParaBuf[3] = 0x0;
+ h2cParaBuf[4] = 0x0;
+ h2cParaLen = 1;
+ // retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
+ retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, h2cParaBuf, h2cParaLen);
+
+
+ // 3. construct respond status code and data.
+ if(BT_STATUS_BT_OP_SUCCESS != retStatus)
+ {
+ pBtRsp->status = ((btOpcode<<8)|retStatus);
+ DBG_8192C("[MPT], Error!! status code=0x%x \n", pBtRsp->status);
+ return paraLen;
+ }
+
+ pBtRsp->status = BT_STATUS_SUCCESS;
+ return paraLen;
+}
+
+VOID
+mptbt_BtControlProcess(
+ PADAPTER Adapter,
+ PVOID pInBuf
+ )
+{
+ u1Byte H2C_Parameter[6] ={0};
+ PBT_H2C pH2c=(PBT_H2C)&H2C_Parameter[0];
+ PMPT_CONTEXT pMptCtx=&(Adapter->mppriv.MptCtx);
+ PBT_REQ_CMD pBtReq=(PBT_REQ_CMD)pInBuf;
+ PBT_RSP_CMD pBtRsp;
+ u1Byte i;
+
+
+ DBG_8192C("[MPT], mptbt_BtControlProcess()=========>\n");
+
+ DBG_8192C("[MPT], input opCodeVer=%d\n", pBtReq->opCodeVer);
+ DBG_8192C("[MPT], input OpCode=%d\n", pBtReq->OpCode);
+ DBG_8192C("[MPT], paraLength=%d \n", pBtReq->paraLength);
+ if(pBtReq->paraLength)
+ {
+ //DBG_8192C("[MPT], parameters(hex):0x%x %d \n",&pBtReq->pParamStart[0], pBtReq->paraLength);
+ }
+
+ _rtw_memset((void*)pMptCtx->mptOutBuf, 0, 100);
+ pMptCtx->mptOutLen = 4; //length of (BT_RSP_CMD.status+BT_RSP_CMD.paraLength)
+
+ pBtRsp = (PBT_RSP_CMD)pMptCtx->mptOutBuf;
+ pBtRsp->status = BT_STATUS_SUCCESS;
+ pBtRsp->paraLength = 0x0;
+
+ // The following we should maintain the User OP codes sent by upper layer
+ switch(pBtReq->OpCode)
+ {
+ case BT_UP_OP_BT_READY:
+ DBG_8192C("[MPT], OPcode : [BT_READY]\n");
+ pBtRsp->paraLength = mptbt_BtReady(Adapter, pBtReq, pBtRsp);
+ break;
+ case BT_UP_OP_BT_SET_MODE:
+ DBG_8192C("[MPT], OPcode : [BT_SET_MODE]\n");
+ pBtRsp->paraLength = mptbt_BtSetMode(Adapter, pBtReq, pBtRsp);
+ break;
+ case BT_UP_OP_BT_SET_TX_RX_PARAMETER:
+ DBG_8192C("[MPT], OPcode : [BT_SET_TXRX_PARAMETER]\n");
+ pBtRsp->paraLength = mptbt_BtSetTxRxPars(Adapter, pBtReq, pBtRsp);
+ break;
+ case BT_UP_OP_BT_SET_GENERAL:
+ DBG_8192C("[MPT], OPcode : [BT_SET_GENERAL]\n");
+ pBtRsp->paraLength = mptbt_BtSetGeneral(Adapter, pBtReq, pBtRsp);
+ break;
+ case BT_UP_OP_BT_GET_GENERAL:
+ DBG_8192C("[MPT], OPcode : [BT_GET_GENERAL]\n");
+ pBtRsp->paraLength = mptbt_BtGetGeneral(Adapter, pBtReq, pBtRsp);
+ break;
+ case BT_UP_OP_BT_TEST_CTRL:
+ DBG_8192C("[MPT], OPcode : [BT_TEST_CTRL]\n");
+ pBtRsp->paraLength = mptbt_BtTestCtrl(Adapter, pBtReq, pBtRsp);
+ break;
+ case BT_UP_OP_TEST_BT:
+ DBG_8192C("[MPT], OPcode : [TEST_BT]\n");
+ pBtRsp->paraLength = mptbt_TestBT(Adapter, pBtReq, pBtRsp);
+ break;
+ default:
+ DBG_8192C("[MPT], Error!! OPcode : UNDEFINED!!!!\n");
+ pBtRsp->status = BT_STATUS_UNKNOWN_OPCODE_U;
+ pBtRsp->paraLength = 0x0;
+ break;
+ }
+
+ pMptCtx->mptOutLen += pBtRsp->paraLength;
+
+ DBG_8192C("[MPT], pMptCtx->mptOutLen=%d, pBtRsp->paraLength=%d\n", pMptCtx->mptOutLen, pBtRsp->paraLength);
+ DBG_8192C("[MPT], mptbt_BtControlProcess()<=========\n");
+}
+
+#endif
+
diff --git a/rtl8xxx_EU/core/rtw_cmd.c b/rtl8xxx_EU/core/rtw_cmd.c
index 00dbcf5..ca1ac28 100644..100755
--- a/rtl8xxx_EU/core/rtw_cmd.c
+++ b/rtl8xxx_EU/core/rtw_cmd.c
@@ -524,8 +524,6 @@ _next:
pcmdpriv->cmd_issued_cnt++;
- pcmd->cmdsz = _RND4((pcmd->cmdsz));//_RND4
-
_rtw_memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
if(pcmd->cmdcode < (sizeof(wlancmds) /sizeof(struct cmd_hdl)))
@@ -846,7 +844,7 @@ _func_enter_;
#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
if((padapter->pbuddy_adapter->mlmeextpriv.mlmext_info.state&0x03) == WIFI_FW_AP_STATE)
{
- if(IsSupported5G(padapter->registrypriv.wireless_mode)
+ if(IsSupported5G(padapter->registrypriv.wireless_mode)
&& IsSupported24G(padapter->registrypriv.wireless_mode)) //dual band
mlme_set_scan_to_timer(pmlmepriv, CONC_SCANNING_TIMEOUT_DUAL_BAND);
else //single band
@@ -1345,6 +1343,7 @@ _func_enter_;
case Ndis802_11APMode:
case Ndis802_11AutoUnknown:
case Ndis802_11InfrastructureMax:
+ case Ndis802_11Monitor:
break;
}
diff --git a/rtl8xxx_EU/core/rtw_debug.c b/rtl8xxx_EU/core/rtw_debug.c
index b63b779..2d27ee8 100644..100755
--- a/rtl8xxx_EU/core/rtw_debug.c
+++ b/rtl8xxx_EU/core/rtw_debug.c
@@ -63,7 +63,7 @@ u32 GlobalDebugLevel = _drv_err_;
void dump_drv_version(void *sel)
{
DBG_871X_SEL_NL(sel, "%s %s\n", DRV_NAME, DRIVERVERSION);
- DBG_871X_SEL_NL(sel, "build time: %s %s\n", __DATE__, __TIME__);
+ //DBG_871X_SEL_NL(sel, "build time: %s %s\n", __DATE__, __TIME__);
}
void dump_log_level(void *sel)
@@ -151,6 +151,49 @@ void rf_reg_dump(void *sel, _adapter *adapter)
}
}
+void dump_adapters_status(void *sel, struct dvobj_priv *dvobj)
+{
+ int i;
+ _adapter *iface;
+ u8 u_ch, u_bw, u_offset;
+
+ DBG_871X_SEL_NL(sel, "%-2s %-8s %-4s %-7s %s\n"
+ , "id", "ifname", "port", "ch", "status");
+
+ DBG_871X_SEL_NL(sel, "------------------------\n");
+
+ for (i = 0; i < dvobj->iface_nums; i++) {
+ iface = dvobj->padapters[i];
+ if (iface) {
+ DBG_871X_SEL_NL(sel, "%2d %-8s %4hhu %3u,%u,%u "MLME_STATE_FMT" %s%s\n"
+ , i, ADPT_ARG(iface)
+ , get_iface_type(iface)
+ , iface->mlmeextpriv.cur_channel
+ , iface->mlmeextpriv.cur_bwmode
+ , iface->mlmeextpriv.cur_ch_offset
+ , ADPT_MLME_S_ARG(iface)
+ , iface->bSurpriseRemoved?" SR":""
+ , iface->bDriverStopped?" DS":""
+ );
+ }
+ }
+
+ DBG_871X_SEL_NL(sel, "------------------------\n");
+
+ rtw_get_ch_setting_union(dvobj->padapters[IFACE_ID0], &u_ch, &u_bw, &u_offset);
+ DBG_871X_SEL_NL(sel, "%16s %3u,%u,%u\n"
+ , "union:"
+ , u_ch, u_bw, u_offset
+ );
+
+ DBG_871X_SEL_NL(sel, "%16s %3u,%u,%u\n"
+ , "oper:"
+ , dvobj->oper_channel
+ , dvobj->oper_bwmode
+ , dvobj->oper_ch_offset
+ );
+}
+
#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)
{
@@ -466,15 +509,23 @@ int proc_get_survey_info(struct seq_file *m, void *v)
struct wlan_network *pnetwork = NULL;
_list *plist, *phead;
s32 notify_signal;
- u16 index = 0;
+ s16 notify_noise = 0;
+ u16 index = 0, ie_cap = 0;
+ unsigned char *ie_wpa = NULL, *ie_wpa2 = NULL, *ie_wps = NULL;
+ unsigned char *ie_p2p = NULL, *ssid = NULL;
+ char flag_str[64];
+ int ielen = 0;
+ u32 wpsielen = 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 %32s %32s\n", "index", "bssid", "ch", "RSSI", "SdBm", "Noise", "age", "flag", "ssid");
while(1)
{
if (rtw_end_of_queue_search(phead,plist)== _TRUE)
@@ -490,15 +541,34 @@ 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",
+ ie_wpa = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &ielen, pnetwork->network.IELength-12);
+ ie_wpa2 = rtw_get_wpa2_ie(&pnetwork->network.IEs[12], &ielen, pnetwork->network.IELength-12);
+ ie_cap = rtw_get_capability(&pnetwork->network);
+ ie_wps = rtw_get_wps_ie(&pnetwork->network.IEs[12], pnetwork->network.IELength-12, NULL, &wpsielen);
+ ie_p2p = rtw_get_p2p_ie(&pnetwork->network.IEs[12], pnetwork->network.IELength-12, NULL, &ielen);
+ ssid = pnetwork->network.Ssid.Ssid;
+ sprintf(flag_str, "%s%s%s%s%s%s%s",
+ (ie_wpa) ? "[WPA]":"",
+ (ie_wpa2) ? "[WPA2]":"",
+ (!ie_wpa && !ie_wpa && ie_cap & BIT(4)) ? "[WEP]":"",
+ (ie_wps) ? "[WPS]":"",
+ (pnetwork->network.InfrastructureMode == Ndis802_11IBSS) ? "[IBSS]":"",
+ (ie_cap & BIT(0)) ? "[ESS]":"",
+ (ie_p2p) ? "[P2P]":"");
+ DBG_871X_SEL_NL(m, "%5d "MAC_FMT" %3d %3d %4d %4d %5d %32s %32s\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),
+ flag_str,
pnetwork->network.Ssid.Ssid);
plist = get_next(plist);
}
@@ -507,6 +577,82 @@ int proc_get_survey_info(struct seq_file *m, void *v)
return 0;
}
+ssize_t proc_set_survey_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
+{
+ _irqL irqL;
+ struct net_device *dev = data;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ bool need_indicate_scan_done = _FALSE;
+ u8 _status = _FALSE;
+ NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
+
+ if (count < 1)
+ return -EFAULT;
+
+#ifdef CONFIG_MP_INCLUDED
+ if ((padapter->registrypriv.mp_mode == 1)
+#ifdef CONFIG_CONCURRENT_MODE
+ || ((padapter->pbuddy_adapter) && (padapter->pbuddy_adapter->registrypriv.mp_mode == 1))
+#endif
+ ){
+ DBG_871X(FUNC_ADPT_FMT ": MP mode block Scan request\n", FUNC_ADPT_ARG(padapter));
+ goto exit;
+ }
+#endif
+ rtw_ps_deny(padapter, PS_DENY_SCAN);
+ if (_FAIL == rtw_pwr_wakeup(padapter))
+ goto exit;
+
+ if (padapter->bDriverStopped) {
+ DBG_871X("scan abort!! bDriverStopped=%d\n", padapter->bDriverStopped);
+ goto exit;
+ }
+
+ if (!padapter->bup) {
+ DBG_871X("scan abort!! bup=%d\n", padapter->bup);
+ goto exit;
+ }
+
+ if (padapter->hw_init_completed == _FALSE) {
+ DBG_871X("scan abort!! hw_init_completed=FALSE\n");
+ goto exit;
+ }
+
+ if (rtw_is_scan_deny(padapter)) {
+ DBG_871X(FUNC_ADPT_FMT ": scan deny\n", FUNC_ADPT_ARG(padapter));
+ goto exit;
+ }
+
+ if ((pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)
+#ifdef CONFIG_CONCURRENT_MODE
+ || (rtw_get_buddy_bBusyTraffic(padapter) == _TRUE)
+#endif
+ ) {
+ DBG_871X("scan abort!! BusyTraffic == _TRUE\n");
+ goto exit;
+ }
+
+ if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) {
+ DBG_8192C("scan abort!! fwstate=0x%x\n", pmlmepriv->fw_state);
+ goto exit;
+ }
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if (check_buddy_fwstate(padapter,
+ _FW_UNDER_SURVEY|_FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE) {
+ DBG_871X("scan abort!! buddy_fwstate=0x%x\n",
+ get_fwstate(&(padapter->pbuddy_adapter->mlmepriv)));
+ goto exit;
+ }
+#endif
+ _status = rtw_set_802_11_bssid_list_scan(padapter, NULL, 0);
+
+exit:
+ rtw_ps_deny_cancel(padapter, PS_DENY_SCAN);
+ return count;
+}
+
int proc_get_ap_info(struct seq_file *m, void *v)
{
struct net_device *dev = m->private;
@@ -558,17 +704,6 @@ int proc_get_ap_info(struct seq_file *m, void *v)
return 0;
}
-
-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);
-
- return 0;
-}
int proc_get_trx_info(struct seq_file *m, void *v)
{
@@ -1405,5 +1540,51 @@ ssize_t proc_set_sreset(struct file *file, const char __user *buffer, size_t cou
}
#endif /* DBG_CONFIG_ERROR_DETECT */
+int proc_get_monitor(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 mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+
+ if (WIFI_MONITOR_STATE == get_fwstate(pmlmepriv)) {
+ DBG_871X_SEL_NL(m, "Monitor mode : Enable\n");
+
+ DBG_871X_SEL_NL(m, "ch=%d, ch_offset=%d, bw=%d\n",
+ rtw_get_oper_ch(padapter), rtw_get_oper_choffset(padapter), rtw_get_oper_bw(padapter));
+ } else {
+ DBG_871X_SEL_NL(m, "Monitor mode : Disable\n");
+ }
+
+ return 0;
+}
+
+ssize_t proc_set_monitor(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
+{
+ char tmp[32];
+ struct net_device *dev = data;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+ u8 target_chan, target_offset, target_bw;
+
+ if (count < 3) {
+ DBG_871X("argument size is less than 3\n");
+ return -EFAULT;
+ }
+
+ if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
+ int num = sscanf(tmp, "%hhu %hhu %hhu", &target_chan, &target_offset, &target_bw);
+
+ if (num != 3) {
+ DBG_871X("invalid write_reg parameter!\n");
+ return count;
+ }
+
+ padapter->mlmeextpriv.cur_channel = target_chan;
+ set_channel_bwmode(padapter, target_chan, target_offset, target_bw);
+ }
+
+ return count;
+}
+
#endif
diff --git a/rtl8xxx_EU/core/rtw_ieee80211.c b/rtl8xxx_EU/core/rtw_ieee80211.c
index 97eba25..f0192d1 100755
--- a/rtl8xxx_EU/core/rtw_ieee80211.c
+++ b/rtl8xxx_EU/core/rtw_ieee80211.c
@@ -932,41 +932,45 @@ u8 *rtw_get_wps_ie_from_scan_queue(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps
u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
{
uint cnt;
- u8 *wpsie_ptr=NULL;
- u8 eid, wps_oui[4]={0x0,0x50,0xf2,0x04};
+ u8 *wpsie_ptr = NULL;
+ u8 eid, wps_oui[4] = {0x00, 0x50, 0xf2, 0x04};
- if(wps_ielen)
+ if (wps_ielen)
*wps_ielen = 0;
- if(!in_ie || in_len<=0)
+ if (!in_ie) {
+ rtw_warn_on(1);
+ return wpsie_ptr;
+ }
+
+ if (in_len <= 0)
return wpsie_ptr;
cnt = 0;
- while(cnt<in_len)
- {
+ while (cnt + 1 + 4 < in_len) {
eid = in_ie[cnt];
- if((eid==_WPA_IE_ID_)&&(_rtw_memcmp(&in_ie[cnt+2], wps_oui, 4)==_TRUE))
- {
- wpsie_ptr = &in_ie[cnt];
+ if (cnt + 1 + 4 >= MAX_IE_SZ) {
+ rtw_warn_on(1);
+ return NULL;
+ }
- if(wps_ie)
- _rtw_memcpy(wps_ie, &in_ie[cnt], in_ie[cnt+1]+2);
-
- if(wps_ielen)
- *wps_ielen = in_ie[cnt+1]+2;
-
- cnt+=in_ie[cnt+1]+2;
+ if (eid == WLAN_EID_VENDOR_SPECIFIC && _rtw_memcmp(&in_ie[cnt + 2], wps_oui, 4) == _TRUE) {
+ wpsie_ptr = in_ie + cnt;
+
+ if (wps_ie)
+ _rtw_memcpy(wps_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
+
+ if (wps_ielen)
+ *wps_ielen = in_ie[cnt + 1] + 2;
break;
+ } else {
+ cnt += in_ie[cnt + 1] + 2;
}
- else
- {
- cnt+=in_ie[cnt+1]+2; //goto next
- }
- }
+ }
return wpsie_ptr;
}
@@ -1561,47 +1565,48 @@ u8 *rtw_get_p2p_ie_from_scan_queue(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_
*/
u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen)
{
- uint cnt = 0;
- u8 *p2p_ie_ptr;
- u8 eid, p2p_oui[4]={0x50,0x6F,0x9A,0x09};
+ uint cnt;
+ u8 *p2p_ie_ptr = NULL;
+ u8 eid, p2p_oui[4] = {0x50, 0x6F, 0x9A, 0x09};
- if ( p2p_ielen != NULL )
+ if (p2p_ielen)
*p2p_ielen = 0;
- while(cnt<in_len)
- {
+ if (!in_ie || in_len < 0) {
+ rtw_warn_on(1);
+ return p2p_ie_ptr;
+ }
+
+ if (in_len <= 0)
+ return p2p_ie_ptr;
+
+ cnt = 0;
+
+ while (cnt + 1 + 4 < in_len) {
eid = in_ie[cnt];
- if ((in_len < 0) || (cnt > MAX_IE_SZ)) {
- rtw_dump_stack();
+
+ if (cnt + 1 + 4 >= MAX_IE_SZ) {
+ rtw_warn_on(1);
return NULL;
- }
- if( ( eid == _VENDOR_SPECIFIC_IE_ ) && ( _rtw_memcmp( &in_ie[cnt+2], p2p_oui, 4) == _TRUE ) )
- {
+ }
+
+ if (eid == WLAN_EID_VENDOR_SPECIFIC && _rtw_memcmp(&in_ie[cnt + 2], p2p_oui, 4) == _TRUE) {
p2p_ie_ptr = in_ie + cnt;
-
- if ( p2p_ie != NULL )
- {
- _rtw_memcpy( p2p_ie, &in_ie[ cnt ], in_ie[ cnt + 1 ] + 2 );
- }
- if ( p2p_ielen != NULL )
- {
- *p2p_ielen = in_ie[ cnt + 1 ] + 2;
- }
-
- return p2p_ie_ptr;
+ if (p2p_ie)
+ _rtw_memcpy(p2p_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
+
+ if (p2p_ielen)
+ *p2p_ielen = in_ie[cnt + 1] + 2;
break;
+ } else {
+ cnt += in_ie[cnt + 1] + 2;
}
- else
- {
- cnt += in_ie[ cnt + 1 ] +2; //goto next
- }
-
- }
- return NULL;
+ }
+ return p2p_ie_ptr;
}
/**
diff --git a/rtl8xxx_EU/core/rtw_ioctl_set.c b/rtl8xxx_EU/core/rtw_ioctl_set.c
index 59b88f4..c8ad426 100755
--- a/rtl8xxx_EU/core/rtw_ioctl_set.c
+++ b/rtl8xxx_EU/core/rtw_ioctl_set.c
@@ -673,7 +673,10 @@ _func_enter_;
case Ndis802_11AutoUnknown:
case Ndis802_11InfrastructureMax:
- break;
+ break;
+ case Ndis802_11Monitor:
+ set_fwstate(pmlmepriv, WIFI_MONITOR_STATE);
+ break;
}
//SecClearAllKeys(adapter);
diff --git a/rtl8xxx_EU/core/rtw_mlme.c b/rtl8xxx_EU/core/rtw_mlme.c
index fde6566..f88ad4e 100644..100755
--- a/rtl8xxx_EU/core/rtw_mlme.c
+++ b/rtl8xxx_EU/core/rtw_mlme.c
@@ -1265,7 +1265,7 @@ _func_enter_;
rtw_update_registrypriv_dev_network(adapter);
rtw_generate_random_ibss(pibss);
- pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
+ pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
if(rtw_createbss_cmd(adapter)!=_SUCCESS)
{
@@ -1471,16 +1471,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);
}
@@ -1491,9 +1491,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);
}
@@ -1501,7 +1501,7 @@ _func_enter_;
if(lock_scanned_queue)
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
- pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress);
+ pwlan = _rtw_find_same_network(&pmlmepriv->scanned_queue, tgt_network);
if(pwlan)
{
pwlan->fixed = _FALSE;
@@ -1543,7 +1543,8 @@ _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);
+ if (pwlan)
+ rtw_free_network_nolock(pmlmepriv, pwlan);
}
if(lock_scanned_queue)
@@ -1721,17 +1722,17 @@ inline void rtw_indicate_scan_done( _adapter *padapter, bool aborted)
#endif // CONFIG_IPS
}
-void rtw_scan_abort(_adapter *adapter)
+u32 rtw_scan_abort_timeout(_adapter *adapter, u32 timeout_ms)
{
- u32 cnt=0;
u32 start;
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
+ u32 pass_ms;
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
start = rtw_get_current_time();
pmlmeext->scan_abort = _TRUE;
while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)
- && rtw_get_passing_time_ms(start) <= 200) {
+ && rtw_get_passing_time_ms(start) <= timeout_ms) {
if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
break;
@@ -1751,6 +1752,23 @@ void rtw_scan_abort(_adapter *adapter)
rtw_indicate_scan_done(adapter, _TRUE);
}
pmlmeext->scan_abort = _FALSE;
+ pass_ms = rtw_get_passing_time_ms(start);
+
+ return pass_ms;
+}
+
+void rtw_scan_abort_no_wait(_adapter *adapter)
+{
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
+
+ if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
+ pmlmeext->scan_abort = _TRUE;
+}
+
+void rtw_scan_abort(_adapter *adapter)
+{
+ rtw_scan_abort_timeout(adapter, 200);
}
static struct sta_info *rtw_joinbss_update_stainfo(_adapter *padapter, struct wlan_network *pnetwork)
@@ -2036,9 +2054,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);
@@ -2502,9 +2520,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)
{
@@ -3650,6 +3668,7 @@ void rtw_update_registrypriv_dev_network(_adapter* adapter)
struct security_priv* psecuritypriv = &adapter->securitypriv;
struct wlan_network *cur_network = &adapter->mlmepriv.cur_network;
//struct xmit_priv *pxmitpriv = &adapter->xmitpriv;
+ struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
_func_enter_;
@@ -3697,9 +3716,15 @@ _func_enter_;
pdev_network->Configuration.DSConfig = (pregistrypriv->channel);
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("pregistrypriv->channel=%d, pdev_network->Configuration.DSConfig=0x%x\n", pregistrypriv->channel, pdev_network->Configuration.DSConfig));
- if(cur_network->network.InfrastructureMode == Ndis802_11IBSS)
+ if (cur_network->network.InfrastructureMode == Ndis802_11IBSS) {
pdev_network->Configuration.ATIMWindow = (0);
+ if (pmlmeext->cur_channel != 0)
+ pdev_network->Configuration.DSConfig = pmlmeext->cur_channel;
+ else
+ pdev_network->Configuration.DSConfig = 1;
+ }
+
pdev_network->InfrastructureMode = (cur_network->network.InfrastructureMode);
// 1. Supported rates
@@ -4495,3 +4520,19 @@ u8 rtw_get_buddy_bBusyTraffic(_adapter *padapter)
}
#endif //CONFIG_CONCURRENT_MODE
+
+static const char *miracast_mode_str[] = {
+ "DISABLED",
+ "SOURCE",
+ "SINK",
+ "INVALID",
+};
+
+const char *get_miracast_mode_str(int mode)
+{
+ if (mode < MIRACAST_DISABLED || mode >= MIRACAST_INVALID)
+ mode = MIRACAST_INVALID;
+
+ return miracast_mode_str[mode];
+}
+
diff --git a/rtl8xxx_EU/core/rtw_mlme_ext.c b/rtl8xxx_EU/core/rtw_mlme_ext.c
index 3fcef9e..00aff03 100644..100755
--- a/rtl8xxx_EU/core/rtw_mlme_ext.c
+++ b/rtl8xxx_EU/core/rtw_mlme_ext.c
@@ -2574,8 +2574,6 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame)
reason = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN));
- DBG_871X("%s Reason code(%d)\n", __FUNCTION__,reason);
-
rtw_lock_rx_suspend_timeout(8000);
#ifdef CONFIG_AP_MODE
@@ -2589,8 +2587,8 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame)
//rtw_free_stainfo(padapter, psta);
//_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- DBG_871X_LEVEL(_drv_always_, "ap recv deauth reason code(%d) sta:%pM\n",
- reason, GetAddr2Ptr(pframe));
+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" reason=%u, ta=%pM\n"
+ , FUNC_ADPT_ARG(padapter), reason, GetAddr2Ptr(pframe));
psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe));
if(psta)
@@ -2635,12 +2633,12 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame)
}
}
- DBG_871X_LEVEL(_drv_always_, "sta recv deauth reason code(%d) sta:%pM, ignore = %d\n",
- reason, GetAddr3Ptr(pframe), ignore_received_deauth);
-
+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" reason=%u, ta=%pM, ignore=%d\n"
+ , FUNC_ADPT_ARG(padapter), reason, GetAddr2Ptr(pframe), ignore_received_deauth);
+
if ( 0 == ignore_received_deauth )
{
- receive_disconnect(padapter, GetAddr3Ptr(pframe) ,reason);
+ receive_disconnect(padapter, GetAddr2Ptr(pframe), reason);
}
}
pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE;
@@ -2673,8 +2671,6 @@ unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
reason = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN));
- DBG_871X("%s Reason code(%d)\n", __FUNCTION__,reason);
-
rtw_lock_rx_suspend_timeout(8000);
#ifdef CONFIG_AP_MODE
@@ -2688,8 +2684,8 @@ unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
//rtw_free_stainfo(padapter, psta);
//_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- DBG_871X_LEVEL(_drv_always_, "ap recv disassoc reason code(%d) sta:%pM\n",
- reason, GetAddr2Ptr(pframe));
+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" reason=%u, ta=%pM\n"
+ , FUNC_ADPT_ARG(padapter), reason, GetAddr2Ptr(pframe));
psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe));
if(psta)
@@ -2714,10 +2710,10 @@ unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
else
#endif
{
- DBG_871X_LEVEL(_drv_always_, "sta recv disassoc reason code(%d) sta:%pM\n",
- reason, GetAddr3Ptr(pframe));
-
- receive_disconnect(padapter, GetAddr3Ptr(pframe), reason);
+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" reason=%u, ta=%pM\n"
+ , FUNC_ADPT_ARG(padapter), reason, GetAddr2Ptr(pframe));
+
+ receive_disconnect(padapter, GetAddr2Ptr(pframe), reason);
}
pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE;
return _SUCCESS;
@@ -9431,20 +9427,33 @@ void site_survey(_adapter *padapter)
//val8 |= 0x0f;
//rtw_hal_set_hwreg(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
#if defined(CONFIG_STA_MODE_SCAN_UNDER_AP_MODE) || defined(CONFIG_ATMEL_RC_PATCH)
- if((padapter->pbuddy_adapter->mlmeextpriv.mlmext_info.state&0x03) == WIFI_FW_AP_STATE)
- {
- if( pmlmeinfo->scan_cnt == RTW_SCAN_NUM_OF_CH )
- {
- pmlmeinfo->scan_cnt = 0;
- survey_channel = pbuddy_mlmeext->cur_channel;
- stay_buddy_ch = 1;
- }
- else
- {
- if( pmlmeinfo->scan_cnt == 0 )
+ if ((padapter->pbuddy_adapter->mlmeextpriv.mlmext_info.state&0x03) == WIFI_FW_AP_STATE) {
+ if (pmlmeinfo->scan_cnt == RTW_SCAN_NUM_OF_CH) {
+ if (pmlmeinfo->backop_cnt == 0)
+ stay_buddy_ch = 1;
+ else if (pmlmeinfo->backop_cnt == RTW_STAY_AP_CH_MILLISECOND)
stay_buddy_ch = 2;
+
+ if (stay_buddy_ch == 2) {
+ pmlmeinfo->scan_cnt = 1;
+ pmlmeinfo->backop_cnt = 0;
+ } else if (stay_buddy_ch == 1) {
+ pmlmeinfo->backop_cnt++;
+ survey_channel = pbuddy_mlmeext->cur_channel;
+ } else {
+ pmlmeinfo->backop_cnt++;
+ set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
+ return;
+ }
+ } else {
pmlmeinfo->scan_cnt++;
}
+ } else {
+ if (pmlmeinfo->backop_cnt > 0) {
+ stay_buddy_ch = 2;
+ pmlmeinfo->scan_cnt = 1;
+ pmlmeinfo->backop_cnt = 0;
+ }
}
#endif
if(pmlmeext->sitesurvey_res.channel_idx == 0)
@@ -9527,21 +9536,12 @@ void site_survey(_adapter *padapter)
// 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 );
- else {
- if( check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
- set_survey_timer(pmlmeext, 20);
- else
- set_survey_timer(pmlmeext, 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 );
+ if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
+ set_survey_timer(pmlmeext, 20);
else
- set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
+ set_survey_timer(pmlmeext, 40);
#else
- set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
+ set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
#endif
}
else
@@ -9616,6 +9616,7 @@ void site_survey(_adapter *padapter)
#if defined(CONFIG_STA_MODE_SCAN_UNDER_AP_MODE) || defined(CONFIG_ATMEL_RC_PATCH)
pmlmeinfo->scan_cnt = 0;
+ pmlmeinfo->backop_cnt = 0;
#endif
#ifdef CONFIG_ANTENNA_DIVERSITY
@@ -10208,7 +10209,6 @@ unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsi
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- //check A3
if (!(_rtw_memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
return _SUCCESS;
@@ -11645,7 +11645,8 @@ void survey_timer_hdl(_adapter *padapter)
if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS)
{
#if defined(CONFIG_STA_MODE_SCAN_UNDER_AP_MODE) || defined(CONFIG_ATMEL_RC_PATCH)
- if( padapter->mlmeextpriv.mlmext_info.scan_cnt != RTW_SCAN_NUM_OF_CH )
+ if (padapter->mlmeextpriv.mlmext_info.scan_cnt != RTW_SCAN_NUM_OF_CH
+ || padapter->mlmeextpriv.mlmext_info.backop_cnt == RTW_STAY_AP_CH_MILLISECOND)
#endif
pmlmeext->sitesurvey_res.channel_idx++;
}
@@ -11995,6 +11996,8 @@ u8 setopmode_hdl(_adapter *padapter, u8 *pbuf)
else if(psetop->mode == Ndis802_11IBSS)
{
type = _HW_STATE_ADHOC_;
+ } else if (psetop->mode == Ndis802_11Monitor) {
+ type = _HW_STATE_MONITOR_;
}
else
{
@@ -12208,7 +12211,11 @@ u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf)
if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength
return H2C_PARAMETERS_ERROR;
-
+
+ if (pnetwork->IELength < 2) {
+ report_join_res(padapter, (-4));
+ return H2C_SUCCESS;
+ }
_rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength);
pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
@@ -12218,8 +12225,7 @@ u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf)
//pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->IEs, pnetwork->IELength);
//sizeof(NDIS_802_11_FIXED_IEs)
- for (i = _FIXED_IE_LENGTH_; i < pnetwork->IELength;)
- {
+ for (i = _FIXED_IE_LENGTH_ ; i < pnetwork->IELength - 2 ;) {
pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
switch (pIE->ElementID)
@@ -12421,7 +12427,107 @@ u8 disconnect_hdl(_adapter *padapter, unsigned char *pbuf)
return H2C_SUCCESS;
}
-int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out,
+u8 rtw_scan_sparse(_adapter *adapter, struct rtw_ieee80211_channel *ch, u8 ch_num)
+{
+/* interval larger than this is treated as backgroud scan */
+#ifndef RTW_SCAN_SPARSE_BG_INTERVAL_MS
+#define RTW_SCAN_SPARSE_BG_INTERVAL_MS 12000
+#endif
+
+#ifndef RTW_SCAN_SPARSE_CH_NUM_MIRACAST
+#define RTW_SCAN_SPARSE_CH_NUM_MIRACAST 1
+#endif
+#ifndef RTW_SCAN_SPARSE_CH_NUM_BG
+#define RTW_SCAN_SPARSE_CH_NUM_BG 4
+#endif
+
+#define SCAN_SPARSE_CH_NUM_INVALID 255
+
+ static u8 token = 255;
+ u32 interval;
+ bool busy_traffic = _FALSE;
+ bool miracast_enabled = _FALSE;
+ bool bg_scan = _FALSE;
+ u8 max_allow_ch = SCAN_SPARSE_CH_NUM_INVALID;
+ u8 scan_division_num;
+ u8 ret_num = ch_num;
+ struct registry_priv *regsty = dvobj_to_regsty(adapter_to_dvobj(adapter));
+ struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv;
+
+ if (regsty->wifi_spec)
+ goto exit;
+
+ /* assume ch_num > 6 is normal scan */
+ if (ch_num <= 6)
+ goto exit;
+
+ if (mlmeext->last_scan_time == 0)
+ mlmeext->last_scan_time = rtw_get_current_time();
+
+ interval = rtw_get_passing_time_ms(mlmeext->last_scan_time);
+
+ if (adapter->mlmepriv.LinkDetectInfo.bBusyTraffic == _TRUE
+ #ifdef CONFIG_CONCURRENT_MODE
+ || (adapter->pbuddy_adapter && adapter->pbuddy_adapter->mlmepriv.LinkDetectInfo.bBusyTraffic == _TRUE)
+ #endif
+ )
+ busy_traffic = _TRUE;
+
+ #ifdef CONFIG_WFD
+ if (is_miracast_enabled(adapter->wfd_info.stack_wfd_mode)
+ #ifdef CONFIG_CONCURRENT_MODE
+ || (adapter->pbuddy_adapter && is_miracast_enabled(adapter->pbuddy_adapter->wfd_info.stack_wfd_mode))
+ #endif
+ )
+ miracast_enabled = _TRUE;
+ #endif
+
+ if (interval > RTW_SCAN_SPARSE_BG_INTERVAL_MS)
+ bg_scan = _TRUE;
+
+ /* max_allow_ch by conditions*/
+
+ #if RTW_SCAN_SPARSE_MIRACAST
+ if (miracast_enabled == _TRUE && busy_traffic == _TRUE)
+ max_allow_ch = rtw_min(max_allow_ch, RTW_SCAN_SPARSE_CH_NUM_MIRACAST);
+ #endif
+
+ #if RTW_SCAN_SPARSE_BG
+ if (bg_scan == _TRUE)
+ max_allow_ch = rtw_min(max_allow_ch, RTW_SCAN_SPARSE_CH_NUM_BG);
+ #endif
+
+
+ if (max_allow_ch != SCAN_SPARSE_CH_NUM_INVALID) {
+ int i;
+ int k = 0;
+
+ scan_division_num = (ch_num / max_allow_ch) + ((ch_num % max_allow_ch)?1:0);
+ token = (token + 1) % scan_division_num;
+
+ if (0)
+ DBG_871X("scan_division_num:%u, token:%u\n", scan_division_num, token);
+
+ for (i = 0; i < ch_num; i++) {
+ if (ch[i].hw_value && (i % scan_division_num) == token
+ ) {
+ if (i != k)
+ _rtw_memcpy(&ch[k], &ch[i], sizeof(struct rtw_ieee80211_channel));
+ k++;
+ }
+ }
+
+ _rtw_memset(&ch[k], 0, sizeof(struct rtw_ieee80211_channel));
+
+ ret_num = k;
+ mlmeext->last_scan_time = rtw_get_current_time();
+ }
+
+exit:
+ return ret_num;
+}
+
+static int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out,
u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num)
{
int i, j;
@@ -12486,49 +12592,8 @@ int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out,
}
}
-#ifdef CONFIG_SCAN_SPARSE //partial scan, ASUS RK3188 use the feature
- /* assume j>6 is normal scan */
- if ((j > 6) && (padapter->registrypriv.wifi_spec != 1))
- {
- static u8 token = 0;
- u32 interval;
-
- if (pmlmeext->last_scan_time == 0)
- pmlmeext->last_scan_time = rtw_get_current_time();
-
- interval = rtw_get_passing_time_ms(pmlmeext->last_scan_time);
- if ((interval > ALLOW_SCAN_INTERVAL)
-#if 0 // Miracast can't do AP scan
- || (padapter->mlmepriv.LinkDetectInfo.bBusyTraffic == _TRUE)
-#ifdef CONFIG_CONCURRENT_MODE
- || (padapter->pbuddy_adapter
- && (padapter->pbuddy_adapter->mlmepriv.LinkDetectInfo.bBusyTraffic == _TRUE))
-#endif // CONFIG_CONCURRENT_MODE
-#endif
- )
- {
- // modify scan plan
- int k = 0;
- _rtw_memset(in, 0, sizeof(struct rtw_ieee80211_channel)*in_num);
- _rtw_memcpy(in, out, sizeof(struct rtw_ieee80211_channel)*j);
- _rtw_memset(out, 0, sizeof(struct rtw_ieee80211_channel)*j);
-
- for (i=0;i<j;i++) {
- if (in[i].hw_value && (i%SCAN_DIVISION_NUM) == token) {
- _rtw_memcpy(&out[k], &in[i], sizeof(struct rtw_ieee80211_channel));
- k++;
- }
- if(k>=out_num)
- break;
- }
-
- j = k;
- token = (token+1)%SCAN_DIVISION_NUM;
- }
-
- pmlmeext->last_scan_time = rtw_get_current_time();
- }
-#endif //CONFIG_SCAN_SPARSE
+ /* scan_sparse */
+ j = rtw_scan_sparse(padapter, out, j);
return j;
}
@@ -12640,7 +12705,8 @@ u8 sitesurvey_cmd_hdl(_adapter *padapter, u8 *pbuf)
//disable dynamic functions, such as high power, DIG
Save_DM_Func_Flag(padapter);
- Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
+ //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
+ ctrl_dm_func_for_offchannel(padapter,BIT13); /* BIT13 = ODM_BB_ADAPTIVITY */
//config the initial gain under scaning, need to write the BB registers
#ifdef CONFIG_P2P
diff --git a/rtl8xxx_EU/core/rtw_mp_ioctl.c b/rtl8xxx_EU/core/rtw_mp_ioctl.c
index b2c5a28..32b7c73 100755
--- a/rtl8xxx_EU/core/rtw_mp_ioctl.c
+++ b/rtl8xxx_EU/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/rtl8xxx_EU/core/rtw_odm.c b/rtl8xxx_EU/core/rtw_odm.c
index 75beea8..e68b033 100755
--- a/rtl8xxx_EU/core/rtw_odm.c
+++ b/rtl8xxx_EU/core/rtw_odm.c
@@ -38,20 +38,20 @@ const char *odm_comp_str[] = {
/* BIT13 */"ODM_COMP_RXHP",
/* BIT14 */"ODM_COMP_MP",
/* BIT15 */"ODM_COMP_DYNAMIC_ATC",
- /* BIT16 */"ODM_COMP_EDCA_TURBO",
- /* BIT17 */"ODM_COMP_EARLY_MODE",
- /* BIT18 */NULL,
- /* BIT19 */NULL,
- /* BIT20 */NULL,
- /* BIT21 */NULL,
- /* BIT22 */NULL,
+ /* BIT16 */"ODM_COMP_ACS",
+ /* BIT17 */"PHYDM_COMP_ADAPTIVITY",
+ /* BIT18 */"PHYDM_COMP_RA_DBG",
+ /* BIT19 */"PHYDM_COMP_TXBF",
+ /* BIT20 */"ODM_COMP_EDCA_TURBO",
+ /* BIT21 */"ODM_COMP_EARLY_MODE",
+ /* BIT22 */"ODM_FW_DEBUG_TRACE",
/* BIT23 */NULL,
/* BIT24 */"ODM_COMP_TX_PWR_TRACK",
/* BIT25 */"ODM_COMP_RX_GAIN_TRACK",
/* BIT26 */"ODM_COMP_CALIBRATION",
/* BIT27 */NULL,
/* BIT28 */NULL,
- /* BIT29 */NULL,
+ /* BIT29 */"BEAMFORMING_DEBUG",
/* BIT30 */"ODM_COMP_COMMON",
/* BIT31 */"ODM_COMP_INIT",
};
@@ -74,13 +74,13 @@ const char *odm_ability_str[] = {
/* 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",
+ /* BIT15 */"ODM_BB_NHM_CNT",
+ /* BIT16 */"ODM_BB_PRIMARY_CCA",
+ /* BIT17 */"ODM_BB_TXBF",
/* 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",
@@ -106,15 +106,15 @@ void rtw_odm_dbg_comp_msg(void *sel, _adapter *adapter)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
DM_ODM_T *odm = &pHalData->odmpriv;
int cnt = 0;
- u64 dbg_comp;
+ u64 dbg_comp = 0;
int i;
rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_FLAG, &dbg_comp);
DBG_871X_SEL_NL(sel, "odm.DebugComponents = 0x%016llx \n", dbg_comp);
for (i=0;i<RTW_ODM_COMP_MAX;i++) {
if (odm_comp_str[i])
- DBG_871X_SEL_NL(sel, "%cBIT%-2d %s\n",
- (BIT0 << i) & dbg_comp ? '+' : ' ', i, odm_comp_str[i]);
+ DBG_871X_SEL_NL(sel, "%cBIT%-2d %s\n",
+ (BIT0 << i) & dbg_comp ? '+' : ' ', i, odm_comp_str[i]);
}
}
@@ -128,11 +128,11 @@ void rtw_odm_dbg_level_msg(void *sel, _adapter *adapter)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
DM_ODM_T *odm = &pHalData->odmpriv;
int cnt = 0;
- u32 dbg_level;
+ u32 dbg_level = 0;
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;i<RTW_ODM_DBG_LEVEL_NUM;i++) {
if (odm_dbg_level_str[i])
DBG_871X_SEL_NL(sel, "%u %s\n", i, odm_dbg_level_str[i]);
@@ -156,8 +156,8 @@ void rtw_odm_ability_msg(void *sel, _adapter *adapter)
DBG_871X_SEL_NL(sel, "odm.SupportAbility = 0x%08x\n", ability);
for (i=0;i<RTW_ODM_ABILITY_MAX;i++) {
if (odm_ability_str[i])
- DBG_871X_SEL_NL(sel, "%cBIT%-2d %s\n",
- (BIT0 << i) & ability ? '+' : ' ', i, odm_ability_str[i]);
+ DBG_871X_SEL_NL(sel, "%cBIT%-2d %s\n",
+ (BIT0 << i) & ability ? '+' : ' ', i, odm_ability_str[i]);
}
}
@@ -166,35 +166,126 @@ inline void rtw_odm_ability_set(_adapter *adapter, u32 ability)
rtw_hal_set_hwreg(adapter, HW_VAR_DM_FLAG, (u8*)&ability);
}
+void rtw_odm_adaptivity_ver_msg(void *sel, _adapter *adapter)
+{
+ DBG_871X_SEL_NL(sel, "ADAPTIVITY_VERSION "ADAPTIVITY_VERSION"\n");
+}
+
+#define RTW_ADAPTIVITY_EN_DISABLE 0
+#define RTW_ADAPTIVITY_EN_ENABLE 1
+
+void rtw_odm_adaptivity_en_msg(void *sel, _adapter *adapter)
+{
+ struct registry_priv *regsty = &adapter->registrypriv;
+ struct mlme_priv *mlme = &adapter->mlmepriv;
+ HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
+ 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 {
+ 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_ADAPTIVITY_DML_DISABLE 0
+#define RTW_ADAPTIVITY_DML_ENABLE 1
+
+void rtw_odm_adaptivity_dml_msg(void *sel, _adapter *adapter)
+{
+ struct registry_priv *regsty = &adapter->registrypriv;
+
+ DBG_871X_SEL_NL(sel, "RTW_ADAPTIVITY_DML_");
+
+ if (regsty->adaptivity_dml == RTW_ADAPTIVITY_DML_DISABLE) {
+ DBG_871X_SEL(sel, "DISABLE\n");
+ } else if (regsty->adaptivity_dml == RTW_ADAPTIVITY_DML_ENABLE) {
+ DBG_871X_SEL(sel, "ENABLE\n");
+ } else {
+ DBG_871X_SEL(sel, "INVALID\n");
+ }
+}
+
+void rtw_odm_adaptivity_dc_backoff_msg(void *sel, _adapter *adapter)
+{
+ struct registry_priv *regsty = &adapter->registrypriv;
+
+ DBG_871X_SEL_NL(sel, "RTW_ADAPTIVITY_DC_BACKOFF:%u\n", regsty->adaptivity_dc_backoff);
+}
+
+void rtw_odm_adaptivity_config_msg(void *sel, _adapter *adapter)
+{
+ rtw_odm_adaptivity_ver_msg(sel, adapter);
+ rtw_odm_adaptivity_en_msg(sel, adapter);
+ rtw_odm_adaptivity_mode_msg(sel, adapter);
+ rtw_odm_adaptivity_dml_msg(sel, adapter);
+ rtw_odm_adaptivity_dc_backoff_msg(sel, adapter);
+}
+
+bool rtw_odm_adaptivity_needed(_adapter *adapter)
+{
+ struct registry_priv *regsty = &adapter->registrypriv;
+ struct mlme_priv *mlme = &adapter->mlmepriv;
+ bool ret = _FALSE;
+
+ if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_ENABLE)
+ ret = _TRUE;
+
+ return ret;
+}
+
void rtw_odm_adaptivity_parm_msg(void *sel, _adapter *adapter)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
DM_ODM_T *odm = &pHalData->odmpriv;
- 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"
+ rtw_odm_adaptivity_config_msg(sel, adapter);
+
+ DBG_871X_SEL_NL(sel, "%10s %16s\n"
+ , "TH_L2H_ini", "TH_EDCCA_HL_diff");
+ DBG_871X_SEL_NL(sel, "0x%-8x %-16d\n"
, (u8)odm->TH_L2H_ini
, odm->TH_EDCCA_HL_diff
- , odm->IGI_Base
- , odm->ForceEDCCA
- , odm->AdapEn_RSSI
- , odm->IGI_LowerBound
);
+
+ DBG_871X_SEL_NL(sel, "%15s %9s\n", "AdapEnableState","Adap_Flag");
+ DBG_871X_SEL_NL(sel, "%-15x %-9x \n"
+ , odm->Adaptivity_enable
+ , odm->adaptivity_flag
+ );
+
+
}
-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_adaptivity_parm_set(_adapter *adapter, s8 TH_L2H_ini, s8 TH_EDCCA_HL_diff)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
DM_ODM_T *odm = &pHalData->odmpriv;
odm->TH_L2H_ini = TH_L2H_ini;
odm->TH_EDCCA_HL_diff = TH_EDCCA_HL_diff;
- odm->IGI_Base = IGI_Base;
- odm->ForceEDCCA = ForceEDCCA;
- odm->AdapEn_RSSI = AdapEn_RSSI;
- odm->IGI_LowerBound = IGI_LowerBound;
}
void rtw_odm_get_perpkt_rssi(void *sel, _adapter *adapter)
diff --git a/rtl8xxx_EU/core/rtw_p2p.c b/rtl8xxx_EU/core/rtw_p2p.c
index 2ec802d..d729c84 100644..100755
--- a/rtl8xxx_EU/core/rtw_p2p.c
+++ b/rtl8xxx_EU/core/rtw_p2p.c
@@ -3613,13 +3613,9 @@ _func_enter_;
pcfg80211_wdinfo->is_ro_ch = _FALSE;
pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time();
-#ifndef CONFIG_RADIO_WORK
- if (pcfg80211_wdinfo->not_indic_ro_ch_exp == _TRUE)
- return;
-#endif
-
- 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));
+ DBG_871X("cfg80211_remain_on_channel_expired cookie:0x%llx, ch=%d, bw=%d, offset=%d\n"
+ , pcfg80211_wdinfo->remain_on_ch_cookie
+ , rtw_get_oper_ch(padapter), rtw_get_oper_bw(padapter), rtw_get_oper_choffset(padapter));
rtw_cfg80211_remain_on_channel_expired(padapter,
pcfg80211_wdinfo->remain_on_ch_cookie,
diff --git a/rtl8xxx_EU/core/rtw_pwrctrl.c b/rtl8xxx_EU/core/rtw_pwrctrl.c
index b2c24fa..3fd1240 100755
--- a/rtl8xxx_EU/core/rtw_pwrctrl.c
+++ b/rtl8xxx_EU/core/rtw_pwrctrl.c
@@ -158,7 +158,8 @@ int ips_leave(_adapter * padapter)
}
#endif //DBG_CHECK_FW_PS_STATE
_exit_pwrlock(&pwrpriv->lock);
-
+ DBG_871X("Run rtw_hal_dm_watchdog 20150724!!\n");
+ rtw_hal_dm_watchdog(padapter);
#ifdef CONFIG_BT_COEXIST
if (_SUCCESS == ret)
rtw_btcoex_IpsNotify(padapter, IPS_NONE);
diff --git a/rtl8xxx_EU/core/rtw_recv.c b/rtl8xxx_EU/core/rtw_recv.c
index 1fd632d..1aa6304 100755
--- a/rtl8xxx_EU/core/rtw_recv.c
+++ b/rtl8xxx_EU/core/rtw_recv.c
@@ -20,6 +20,7 @@
#define _RTW_RECV_C_
#include <drv_types.h>
+#include <hal_data.h>
#if defined (PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
@@ -30,8 +31,23 @@
#ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS
void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS);
-#endif //CONFIG_NEW_SIGNAL_STAT_PROCESS
+enum {
+ SIGNAL_STAT_CALC_PROFILE_0 = 0,
+ SIGNAL_STAT_CALC_PROFILE_1,
+ SIGNAL_STAT_CALC_PROFILE_MAX
+};
+
+u8 signal_stat_calc_profile[SIGNAL_STAT_CALC_PROFILE_MAX][2] = {
+ {4, 1}, /* Profile 0 => pre_stat : curr_stat = 4 : 1 */
+ {3, 7} /* Profile 1 => pre_stat : curr_stat = 3 : 7 */
+};
+
+#ifndef RTW_SIGNAL_STATE_CALC_PROFILE
+#define RTW_SIGNAL_STATE_CALC_PROFILE SIGNAL_STAT_CALC_PROFILE_0
+#endif
+
+#endif //CONFIG_NEW_SIGNAL_STAT_PROCESS
void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
{
@@ -3699,6 +3715,357 @@ _func_exit_;
}
+static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, u8 *buf)
+{
+#define CHAN2FREQ(a) ((a < 14)?(2407+5*a):(5000+5*a))
+
+#if 0
+#define RTW_RX_RADIOTAP_PRESENT ( \
+ (1 << IEEE80211_RADIOTAP_TSFT) | \
+ (1 << IEEE80211_RADIOTAP_FLAGS) | \
+ (1 << IEEE80211_RADIOTAP_RATE) | \
+ (1 << IEEE80211_RADIOTAP_CHANNEL) | \
+ (0 << IEEE80211_RADIOTAP_FHSS) | \
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \
+ (0 << IEEE80211_RADIOTAP_LOCK_QUALITY) | \
+ (0 << IEEE80211_RADIOTAP_TX_ATTENUATION) | \
+ (0 << IEEE80211_RADIOTAP_DB_TX_ATTENUATION) | \
+ (0 << IEEE80211_RADIOTAP_DBM_TX_POWER) | \
+ (1 << IEEE80211_RADIOTAP_ANTENNA) | \
+ (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
+ (0 << IEEE80211_RADIOTAP_DB_ANTNOISE) | \
+ (0 << IEEE80211_RADIOTAP_RX_FLAGS) | \
+ (0 << IEEE80211_RADIOTAP_TX_FLAGS) | \
+ (0 << IEEE80211_RADIOTAP_RTS_RETRIES) | \
+ (0 << IEEE80211_RADIOTAP_DATA_RETRIES) | \
+ (0 << IEEE80211_RADIOTAP_MCS) | \
+ (0 << IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE)| \
+ (0 << IEEE80211_RADIOTAP_VENDOR_NAMESPACE) | \
+ (0 << IEEE80211_RADIOTAP_EXT) | \
+ 0)
+
+ /* (0 << IEEE80211_RADIOTAP_AMPDU_STATUS) | \ */
+ /* (0 << IEEE80211_RADIOTAP_VHT) | \ */
+#endif
+#ifndef IEEE80211_RADIOTAP_MCS
+#define IEEE80211_RADIOTAP_MCS 19
+#endif
+#ifndef IEEE80211_RADIOTAP_VHT
+#define IEEE80211_RADIOTAP_VHT 21
+#endif
+
+#ifndef IEEE80211_RADIOTAP_F_BADFCS
+#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */
+#endif
+
+ sint ret = _SUCCESS;
+ _adapter *adapter = precvframe->u.hdr.adapter;
+ struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
+ struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib;
+
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+
+ u16 tmp_16bit = 0;
+
+ u8 data_rate[] = {
+ 2, 4, 11, 22, /* CCK */
+ 12, 18, 24, 36, 48, 72, 93, 108, /* OFDM */
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* HT MCS index */
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* VHT Nss 1 */
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* VHT Nss 2 */
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* VHT Nss 3 */
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* VHT Nss 4 */
+ };
+
+ _pkt *pskb = NULL;
+
+ struct ieee80211_radiotap_header *rtap_hdr = NULL;
+ u8 *ptr = NULL;
+
+ u8 hdr_buf[64] = {0};
+ u16 rt_len = 8;
+
+ /* create header */
+ rtap_hdr = (struct ieee80211_radiotap_header *)&hdr_buf[0];
+ rtap_hdr->it_version = PKTHDR_RADIOTAP_VERSION;
+
+ /* tsft */
+ if (pattrib->tsfl) {
+ u64 tmp_64bit;
+
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_TSFT);
+ tmp_64bit = cpu_to_le64(pattrib->tsfl);
+ memcpy(&hdr_buf[rt_len], &tmp_64bit, 8);
+ rt_len += 8;
+ }
+
+ /* flags */
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_FLAGS);
+ if (0)
+ hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_CFP;
+
+ if (0)
+ hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_SHORTPRE;
+
+ if ((pattrib->encrypt == 1) || (pattrib->encrypt == 5))
+ hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_WEP;
+
+ if (pattrib->mfrag)
+ hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_FRAG;
+
+#ifndef CONFIG_RX_PACKET_APPEND_FCS
+ hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_FCS;
+#endif
+
+ if (0)
+ hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_DATAPAD;
+
+ if (pattrib->crc_err)
+ hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_BADFCS;
+
+ if (pattrib->sgi) {
+ /* Currently unspecified but used */
+ hdr_buf[rt_len] |= 0x80;
+ }
+ rt_len += 1;
+
+ /* rate */
+ if (pattrib->data_rate < 12) {
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_RATE);
+ if (pattrib->data_rate < 4) {
+ /* CCK */
+ hdr_buf[rt_len] = data_rate[pattrib->data_rate];
+ } else {
+ /* OFDM */
+ hdr_buf[rt_len] = data_rate[pattrib->data_rate];
+ }
+ }
+ rt_len += 1; /* force padding 1 byte for aligned */
+
+ /* channel */
+ tmp_16bit = 0;
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_CHANNEL);
+ tmp_16bit = CHAN2FREQ(rtw_get_oper_ch(padapter));
+ /*tmp_16bit = CHAN2FREQ(pHalData->CurrentChannel);*/
+ memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
+ rt_len += 2;
+
+ /* channel flags */
+ tmp_16bit = 0;
+ if (pHalData->CurrentBandType == 0)
+ tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_2GHZ);
+ else
+ tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_5GHZ);
+
+ if (pattrib->data_rate < 12) {
+ if (pattrib->data_rate < 4) {
+ /* CCK */
+ tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_CCK);
+ } else {
+ /* OFDM */
+ tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_OFDM);
+ }
+ } else {
+ tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_DYN);
+ }
+ memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
+ rt_len += 2;
+
+ /* dBm Antenna Signal */
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL);
+ hdr_buf[rt_len] = pattrib->phy_info.RecvSignalPower;
+ rt_len += 1;
+
+#if 0
+ /* dBm Antenna Noise */
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE);
+ hdr_buf[rt_len] = 0;
+ rt_len += 1;
+
+ /* Signal Quality */
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_LOCK_QUALITY);
+ hdr_buf[rt_len] = pattrib->phy_info.SignalQuality;
+ rt_len += 1;
+#endif
+
+ /* Antenna */
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_ANTENNA);
+ hdr_buf[rt_len] = 0; /* pHalData->rf_type; */
+ rt_len += 1;
+
+ /* RX flags */
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_RX_FLAGS);
+#if 0
+ tmp_16bit = cpu_to_le16(0);
+ memcpy(ptr, &tmp_16bit, 1);
+#endif
+ rt_len += 2;
+
+ /* MCS information */
+ if (pattrib->data_rate >= 12 && pattrib->data_rate < 44) {
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_MCS);
+ /* known, flag */
+ hdr_buf[rt_len] |= BIT1; /* MCS index known */
+
+ /* bandwidth */
+ hdr_buf[rt_len] |= BIT0;
+ hdr_buf[rt_len+1] |= (pattrib->bw & 0x03);
+
+ /* guard interval */
+ hdr_buf[rt_len] |= BIT2;
+ hdr_buf[rt_len+1] |= (pattrib->sgi & 0x01) << 2;
+
+ /* STBC */
+ hdr_buf[rt_len] |= BIT5;
+ hdr_buf[rt_len+1] |= (pattrib->stbc & 0x03) << 5;
+
+ rt_len += 2;
+
+ /* MCS rate index */
+ hdr_buf[rt_len] = data_rate[pattrib->data_rate];
+ rt_len += 1;
+ }
+
+ /* VHT */
+ if (pattrib->data_rate >= 44 && pattrib->data_rate < 84) {
+ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_VHT);
+
+ /* known 16 bit, flag 8 bit */
+ tmp_16bit = 0;
+
+ /* Bandwidth */
+ tmp_16bit |= BIT6;
+
+ /* Group ID */
+ tmp_16bit |= BIT7;
+
+ /* Partial AID */
+ tmp_16bit |= BIT8;
+
+ /* STBC */
+ tmp_16bit |= BIT0;
+ hdr_buf[rt_len+2] |= (pattrib->stbc & 0x01);
+
+ /* Guard interval */
+ tmp_16bit |= BIT2;
+ hdr_buf[rt_len+2] |= (pattrib->sgi & 0x01) << 2;
+
+ /* LDPC extra OFDM symbol */
+ tmp_16bit |= BIT4;
+ hdr_buf[rt_len+2] |= (pattrib->ldpc & 0x01) << 4;
+
+ memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
+ rt_len += 3;
+
+ /* bandwidth */
+ if (pattrib->bw == 0)
+ hdr_buf[rt_len] |= 0;
+ else if (pattrib->bw == 1)
+ hdr_buf[rt_len] |= 1;
+ else if (pattrib->bw == 2)
+ hdr_buf[rt_len] |= 4;
+ else if (pattrib->bw == 3)
+ hdr_buf[rt_len] |= 11;
+ rt_len += 1;
+
+ /* mcs_nss */
+ if (pattrib->data_rate >= 44 && pattrib->data_rate < 54) {
+ hdr_buf[rt_len] |= 1;
+ hdr_buf[rt_len] |= data_rate[pattrib->data_rate] << 4;
+ } else if (pattrib->data_rate >= 54 && pattrib->data_rate < 64) {
+ hdr_buf[rt_len + 1] |= 2;
+ hdr_buf[rt_len + 1] |= data_rate[pattrib->data_rate] << 4;
+ } else if (pattrib->data_rate >= 64 && pattrib->data_rate < 74) {
+ hdr_buf[rt_len + 2] |= 3;
+ hdr_buf[rt_len + 2] |= data_rate[pattrib->data_rate] << 4;
+ } else if (pattrib->data_rate >= 74 && pattrib->data_rate < 84) {
+ hdr_buf[rt_len + 3] |= 4;
+ hdr_buf[rt_len + 3] |= data_rate[pattrib->data_rate] << 4;
+ }
+ rt_len += 4;
+
+ /* coding */
+ hdr_buf[rt_len] = 0;
+ rt_len += 1;
+
+ /* group_id */
+ hdr_buf[rt_len] = 0;
+ rt_len += 1;
+
+ /* partial_aid */
+ tmp_16bit = 0;
+ memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
+ rt_len += 2;
+ }
+
+ /* push to skb */
+ pskb = (_pkt *)buf;
+ if (skb_headroom(pskb) < rt_len) {
+ DBG_871X("%s:%d %s headroom is too small.\n", __FILE__, __LINE__, __func__);
+ ret = _FAIL;
+ return ret;
+ }
+
+ ptr = skb_push(pskb, rt_len);
+ if (ptr) {
+ rtap_hdr->it_len = cpu_to_le16(rt_len);
+ memcpy(ptr, rtap_hdr, rt_len);
+ } else {
+ ret = _FAIL;
+ }
+
+ return ret;
+
+}
+
+int recv_frame_monitor(_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;
+ _pkt *pskb = NULL;
+
+ /* read skb information from recv frame */
+ pskb = rframe->u.hdr.pkt;
+ pskb->len = rframe->u.hdr.len;
+ pskb->data = rframe->u.hdr.rx_data;
+ skb_set_tail_pointer(pskb, rframe->u.hdr.len);
+
+ /* fill radiotap header */
+ if (fill_radiotap_hdr(padapter, rframe, (u8 *)pskb) == _FAIL) {
+ ret = _FAIL;
+ rtw_free_recvframe(rframe, pfree_recv_queue); /* free this recv_frame */
+ goto exit;
+ }
+
+ /* write skb information to recv frame */
+ skb_reset_mac_header(pskb);
+ rframe->u.hdr.len = pskb->len;
+ rframe->u.hdr.rx_data = pskb->data;
+ rframe->u.hdr.rx_head = pskb->head;
+ rframe->u.hdr.rx_tail = skb_tail_pointer(pskb);
+ rframe->u.hdr.rx_end = skb_end_pointer(pskb);
+
+ if ((padapter->bDriverStopped == _FALSE) && (padapter->bSurpriseRemoved == _FALSE)) {
+ /* indicate this recv_frame */
+ ret = rtw_recv_monitor(padapter, rframe);
+ if (ret != _SUCCESS) {
+ ret = _FAIL;
+ rtw_free_recvframe(rframe, pfree_recv_queue); /* free this recv_frame */
+ goto exit;
+ }
+ } else {
+ ret = _FAIL;
+ rtw_free_recvframe(rframe, pfree_recv_queue); /* free this recv_frame */
+ goto exit;
+ }
+
+exit:
+ return ret;
+}
int recv_func_prehandle(_adapter *padapter, union recv_frame *rframe)
{
@@ -4039,6 +4406,13 @@ int recv_func(_adapter *padapter, union recv_frame *rframe)
struct security_priv *psecuritypriv=&padapter->securitypriv;
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
+ if (check_fwstate(mlmepriv, WIFI_MONITOR_STATE)) {
+ /* monitor mode */
+ recv_frame_monitor(padapter, rframe);
+ ret = _SUCCESS;
+ goto exit;
+ } else
+
/* check if need to handle uc_swdec_pending_queue*/
if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && psecuritypriv->busetkipkey)
{
@@ -4139,7 +4513,7 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){
u8 avg_signal_qual = 0;
u32 num_signal_strength = 0;
u32 num_signal_qual = 0;
- u8 _alpha = 5; // this value is based on converging_constant = 5000 and sampling_interval = 1000
+ u8 ratio_pre_stat = 0, ratio_curr_stat = 0, ratio_total = 0, ratio_profile = SIGNAL_STAT_CALC_PROFILE_0;
if(adapter->recvpriv.is_signal_dbg) {
//update the user specific value, signal_strength_dbg, to signal_strength, rssi
@@ -4180,21 +4554,28 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){
goto set_timer;
#endif
+ if (RTW_SIGNAL_STATE_CALC_PROFILE < SIGNAL_STAT_CALC_PROFILE_MAX)
+ ratio_profile = RTW_SIGNAL_STATE_CALC_PROFILE;
+
+ ratio_pre_stat = signal_stat_calc_profile[ratio_profile][0];
+ ratio_curr_stat = signal_stat_calc_profile[ratio_profile][1];
+ ratio_total = ratio_pre_stat + ratio_curr_stat;
+
//update value of signal_strength, rssi, signal_qual
- tmp_s = (avg_signal_strength+(_alpha-1)*recvpriv->signal_strength);
- if(tmp_s %_alpha)
- tmp_s = tmp_s/_alpha + 1;
+ tmp_s = (ratio_curr_stat * avg_signal_strength + ratio_pre_stat * recvpriv->signal_strength);
+ if (tmp_s % ratio_total)
+ tmp_s = tmp_s / ratio_total + 1;
else
- tmp_s = tmp_s/_alpha;
- if(tmp_s>100)
+ tmp_s = tmp_s / ratio_total;
+ if (tmp_s > 100)
tmp_s = 100;
- tmp_q = (avg_signal_qual+(_alpha-1)*recvpriv->signal_qual);
- if(tmp_q %_alpha)
- tmp_q = tmp_q/_alpha + 1;
+ tmp_q = (ratio_curr_stat * avg_signal_qual + ratio_pre_stat * recvpriv->signal_qual);
+ if (tmp_q % ratio_total)
+ tmp_q = tmp_q / ratio_total + 1;
else
- tmp_q = tmp_q/_alpha;
- if(tmp_q>100)
+ tmp_q = tmp_q / ratio_total;
+ if (tmp_q > 100)
tmp_q = 100;
recvpriv->signal_strength = tmp_s;
diff --git a/rtl8xxx_EU/core/rtw_sreset.c b/rtl8xxx_EU/core/rtw_sreset.c
index e901047..61fb62d 100644..100755
--- a/rtl8xxx_EU/core/rtw_sreset.c
+++ b/rtl8xxx_EU/core/rtw_sreset.c
@@ -1,365 +1,365 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-#include <drv_types.h>
-#include <hal_data.h>
-#include <rtw_sreset.h>
-
-void sreset_init_value(_adapter *padapter)
-{
-#if defined(DBG_CONFIG_ERROR_DETECT)
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- struct sreset_priv *psrtpriv = &pHalData->srestpriv;
-
- _rtw_mutex_init(&psrtpriv->silentreset_mutex);
- psrtpriv->silent_reset_inprogress = _FALSE;
- psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
- psrtpriv->last_tx_time =0;
- psrtpriv->last_tx_complete_time =0;
-#endif
-}
-void sreset_reset_value(_adapter *padapter)
-{
-#if defined(DBG_CONFIG_ERROR_DETECT)
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- struct sreset_priv *psrtpriv = &pHalData->srestpriv;
-
- psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
- psrtpriv->last_tx_time =0;
- psrtpriv->last_tx_complete_time =0;
-#endif
-}
-
-u8 sreset_get_wifi_status(_adapter *padapter)
-{
-#if defined(DBG_CONFIG_ERROR_DETECT)
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- struct sreset_priv *psrtpriv = &pHalData->srestpriv;
-
- u8 status = WIFI_STATUS_SUCCESS;
- u32 val32 = 0;
- _irqL irqL;
- if(psrtpriv->silent_reset_inprogress == _TRUE)
- {
- return status;
- }
- val32 =rtw_read32(padapter,REG_TXDMA_STATUS);
- if(val32==0xeaeaeaea){
- psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST;
- }
- else if(val32!=0){
- DBG_8192C("txdmastatu(%x)\n",val32);
- psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR;
- }
-
- if(WIFI_STATUS_SUCCESS !=psrtpriv->Wifi_Error_Status)
- {
- DBG_8192C("==>%s error_status(0x%x) \n",__FUNCTION__,psrtpriv->Wifi_Error_Status);
- status = (psrtpriv->Wifi_Error_Status &( ~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL)));
- }
- DBG_8192C("==> %s wifi_status(0x%x)\n",__FUNCTION__,status);
-
- //status restore
- psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
-
- return status;
-#else
- return WIFI_STATUS_SUCCESS;
-#endif
-}
-
-void sreset_set_wifi_error_status(_adapter *padapter, u32 status)
-{
-#if defined(DBG_CONFIG_ERROR_DETECT)
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- pHalData->srestpriv.Wifi_Error_Status = status;
-#endif
-}
-
-void sreset_set_trigger_point(_adapter *padapter, s32 tgp)
-{
-#if defined(DBG_CONFIG_ERROR_DETECT)
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- pHalData->srestpriv.dbg_trigger_point = tgp;
-#endif
-}
-
-bool sreset_inprogress(_adapter *padapter)
-{
-#if defined(DBG_CONFIG_ERROR_RESET)
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- return pHalData->srestpriv.silent_reset_inprogress;
-#else
- return _FALSE;
-#endif
-}
-
-void sreset_restore_security_station(_adapter *padapter)
-{
- u8 EntryId = 0;
- struct mlme_priv *mlmepriv = &padapter->mlmepriv;
- struct sta_priv * pstapriv = &padapter->stapriv;
- struct sta_info *psta;
- struct security_priv* psecuritypriv=&(padapter->securitypriv);
- struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
-
- {
- u8 val8;
-
- if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) {
- val8 = 0xcc;
- #ifdef CONFIG_WAPI_SUPPORT
- } else if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI) {
- //Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey.
- val8 = 0x4c;
- #endif
- } else {
- val8 = 0xcf;
- }
- rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
- }
-
- #if 0
- if ( ( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP40_ ) ||
- ( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP104_ ))
- {
-
- for(EntryId=0; EntryId<4; EntryId++)
- {
- if(EntryId == psecuritypriv->dot11PrivacyKeyIndex)
- rtw_set_key(padapter,&padapter->securitypriv, EntryId, 1,_FALSE);
- else
- rtw_set_key(padapter,&padapter->securitypriv, EntryId, 0,_FALSE);
- }
-
- }
- else
- #endif
- if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
- (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
- {
- psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv));
- if (psta == NULL) {
- //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n"));
- }
- else
- {
- //pairwise key
- rtw_setstakey_cmd(padapter, psta, _TRUE,_FALSE);
- //group key
- rtw_set_key(padapter,&padapter->securitypriv,padapter->securitypriv.dot118021XGrpKeyid, 0,_FALSE);
- }
- }
-}
-
-void sreset_restore_network_station(_adapter *padapter)
-{
- struct mlme_priv *mlmepriv = &padapter->mlmepriv;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- #if 0
- {
- //=======================================================
- // reset related register of Beacon control
-
- //set MSR to nolink
- Set_MSR(padapter, _HW_STATE_NOLINK_);
- // reject all data frame
- rtw_write16(padapter, REG_RXFLTMAP2,0x00);
- //reset TSF
- rtw_write8(padapter, REG_DUAL_TSF_RST, (BIT(0)|BIT(1)));
-
- // disable update TSF
- SetBcnCtrlReg(padapter, BIT(4), 0);
-
- //=======================================================
- }
- #endif
-
- rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure,_FALSE);
-
- {
- u8 threshold;
- #ifdef CONFIG_USB_HCI
- // TH=1 => means that invalidate usb rx aggregation
- // TH=0 => means that validate usb rx aggregation, use init value.
- if(mlmepriv->htpriv.ht_option) {
- if(padapter->registrypriv.wifi_spec==1)
- threshold = 1;
- else
- threshold = 0;
- rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
- } else {
- threshold = 1;
- rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
- }
- #endif
- }
-
- rtw_hal_set_hwreg(padapter, HW_VAR_DO_IQK, NULL);
-
- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-
- //disable dynamic functions, such as high power, DIG
- //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-
- rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
-
- {
- u8 join_type = 0;
- rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
- }
-
- Set_MSR(padapter, (pmlmeinfo->state & 0x3));
-
- mlmeext_joinbss_event_callback(padapter, 1);
- //restore Sequence No.
- rtw_write8(padapter,0x4dc,padapter->xmitpriv.nqos_ssn);
-
- sreset_restore_security_station(padapter);
-}
-
-
-void sreset_restore_network_status(_adapter *padapter)
-{
- struct mlme_priv *mlmepriv = &padapter->mlmepriv;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) {
- DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
- sreset_restore_network_station(padapter);
- } else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) {
- DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
- rtw_ap_restore_network(padapter);
- } else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE)) {
- DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
- } else {
- DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
- }
-}
-
-void sreset_stop_adapter(_adapter *padapter)
-{
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-
- if (padapter == NULL)
- return;
-
- DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
-
- rtw_netif_stop_queue(padapter->pnetdev);
-
- rtw_cancel_all_timer(padapter);
-
- /* TODO: OS and HCI independent */
- #if defined(PLATFORM_LINUX) && defined(CONFIG_USB_HCI)
- tasklet_kill(&pxmitpriv->xmit_tasklet);
- #endif
-
- if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
- rtw_scan_abort(padapter);
-
- if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
- {
- rtw_set_to_roam(padapter, 0);
- _rtw_join_timeout_handler(padapter);
- }
-
-}
-
-void sreset_start_adapter(_adapter *padapter)
-{
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-
- if (padapter == NULL)
- return;
-
- DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
-
- if (check_fwstate(pmlmepriv, _FW_LINKED)) {
- sreset_restore_network_status(padapter);
- }
-
- /* TODO: OS and HCI independent */
- #if defined(PLATFORM_LINUX) && defined(CONFIG_USB_HCI)
- tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
- #endif
-
- if (is_primary_adapter(padapter))
- _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000);
-
- rtw_netif_wake_queue(padapter->pnetdev);
-}
-
-void sreset_reset(_adapter *padapter)
-{
-#ifdef DBG_CONFIG_ERROR_RESET
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- struct sreset_priv *psrtpriv = &pHalData->srestpriv;
- struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- _irqL irqL;
- u32 start = rtw_get_current_time();
- struct dvobj_priv *psdpriv = padapter->dvobj;
- struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
-
- DBG_871X("%s\n", __FUNCTION__);
-
- psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
-
-
-#ifdef CONFIG_POWER_SAVING
- rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "SRESET");
-#endif
-
- _enter_pwrlock(&pwrpriv->lock);
-
- psrtpriv->silent_reset_inprogress = _TRUE;
- pwrpriv->change_rfpwrstate = rf_off;
-
- sreset_stop_adapter(padapter);
- #ifdef CONFIG_CONCURRENT_MODE
- sreset_stop_adapter(padapter->pbuddy_adapter);
- #endif
-
- #ifdef CONFIG_IPS
- _ips_enter(padapter);
- _ips_leave(padapter);
- #endif
-
- sreset_start_adapter(padapter);
- #ifdef CONFIG_CONCURRENT_MODE
- sreset_start_adapter(padapter->pbuddy_adapter);
- #endif
-
- psrtpriv->silent_reset_inprogress = _FALSE;
-
- _exit_pwrlock(&pwrpriv->lock);
-
- DBG_871X("%s done in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start));
- pdbgpriv->dbg_sreset_cnt++;
-#endif
-}
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+
+#include <drv_types.h>
+#include <hal_data.h>
+#include <rtw_sreset.h>
+
+void sreset_init_value(_adapter *padapter)
+{
+#if defined(DBG_CONFIG_ERROR_DETECT)
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ struct sreset_priv *psrtpriv = &pHalData->srestpriv;
+
+ _rtw_mutex_init(&psrtpriv->silentreset_mutex);
+ psrtpriv->silent_reset_inprogress = _FALSE;
+ psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
+ psrtpriv->last_tx_time =0;
+ psrtpriv->last_tx_complete_time =0;
+#endif
+}
+void sreset_reset_value(_adapter *padapter)
+{
+#if defined(DBG_CONFIG_ERROR_DETECT)
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ struct sreset_priv *psrtpriv = &pHalData->srestpriv;
+
+ psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
+ psrtpriv->last_tx_time =0;
+ psrtpriv->last_tx_complete_time =0;
+#endif
+}
+
+u8 sreset_get_wifi_status(_adapter *padapter)
+{
+#if defined(DBG_CONFIG_ERROR_DETECT)
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ struct sreset_priv *psrtpriv = &pHalData->srestpriv;
+
+ u8 status = WIFI_STATUS_SUCCESS;
+ u32 val32 = 0;
+ _irqL irqL;
+ if(psrtpriv->silent_reset_inprogress == _TRUE)
+ {
+ return status;
+ }
+ val32 =rtw_read32(padapter,REG_TXDMA_STATUS);
+ if(val32==0xeaeaeaea){
+ psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST;
+ }
+ else if(val32!=0){
+ DBG_8192C("txdmastatu(%x)\n",val32);
+ psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR;
+ }
+
+ if(WIFI_STATUS_SUCCESS !=psrtpriv->Wifi_Error_Status)
+ {
+ DBG_8192C("==>%s error_status(0x%x) \n",__FUNCTION__,psrtpriv->Wifi_Error_Status);
+ status = (psrtpriv->Wifi_Error_Status &( ~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL)));
+ }
+ DBG_8192C("==> %s wifi_status(0x%x)\n",__FUNCTION__,status);
+
+ //status restore
+ psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
+
+ return status;
+#else
+ return WIFI_STATUS_SUCCESS;
+#endif
+}
+
+void sreset_set_wifi_error_status(_adapter *padapter, u32 status)
+{
+#if defined(DBG_CONFIG_ERROR_DETECT)
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ pHalData->srestpriv.Wifi_Error_Status = status;
+#endif
+}
+
+void sreset_set_trigger_point(_adapter *padapter, s32 tgp)
+{
+#if defined(DBG_CONFIG_ERROR_DETECT)
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ pHalData->srestpriv.dbg_trigger_point = tgp;
+#endif
+}
+
+bool sreset_inprogress(_adapter *padapter)
+{
+#if defined(DBG_CONFIG_ERROR_RESET)
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ return pHalData->srestpriv.silent_reset_inprogress;
+#else
+ return _FALSE;
+#endif
+}
+
+void sreset_restore_security_station(_adapter *padapter)
+{
+ u8 EntryId = 0;
+ struct mlme_priv *mlmepriv = &padapter->mlmepriv;
+ struct sta_priv * pstapriv = &padapter->stapriv;
+ struct sta_info *psta;
+ struct security_priv* psecuritypriv=&(padapter->securitypriv);
+ struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
+
+ {
+ u8 val8;
+
+ if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) {
+ val8 = 0xcc;
+ #ifdef CONFIG_WAPI_SUPPORT
+ } else if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI) {
+ //Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey.
+ val8 = 0x4c;
+ #endif
+ } else {
+ val8 = 0xcf;
+ }
+ rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
+ }
+
+ #if 0
+ if ( ( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP40_ ) ||
+ ( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP104_ ))
+ {
+
+ for(EntryId=0; EntryId<4; EntryId++)
+ {
+ if(EntryId == psecuritypriv->dot11PrivacyKeyIndex)
+ rtw_set_key(padapter,&padapter->securitypriv, EntryId, 1,_FALSE);
+ else
+ rtw_set_key(padapter,&padapter->securitypriv, EntryId, 0,_FALSE);
+ }
+
+ }
+ else
+ #endif
+ if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
+ (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
+ {
+ psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv));
+ if (psta == NULL) {
+ //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n"));
+ }
+ else
+ {
+ //pairwise key
+ rtw_setstakey_cmd(padapter, psta, _TRUE,_FALSE);
+ //group key
+ rtw_set_key(padapter,&padapter->securitypriv,padapter->securitypriv.dot118021XGrpKeyid, 0,_FALSE);
+ }
+ }
+}
+
+void sreset_restore_network_station(_adapter *padapter)
+{
+ struct mlme_priv *mlmepriv = &padapter->mlmepriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ #if 0
+ {
+ //=======================================================
+ // reset related register of Beacon control
+
+ //set MSR to nolink
+ Set_MSR(padapter, _HW_STATE_NOLINK_);
+ // reject all data frame
+ rtw_write16(padapter, REG_RXFLTMAP2,0x00);
+ //reset TSF
+ rtw_write8(padapter, REG_DUAL_TSF_RST, (BIT(0)|BIT(1)));
+
+ // disable update TSF
+ SetBcnCtrlReg(padapter, BIT(4), 0);
+
+ //=======================================================
+ }
+ #endif
+
+ rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure,_FALSE);
+
+ {
+ u8 threshold;
+ #ifdef CONFIG_USB_HCI
+ // TH=1 => means that invalidate usb rx aggregation
+ // TH=0 => means that validate usb rx aggregation, use init value.
+ if(mlmepriv->htpriv.ht_option) {
+ if(padapter->registrypriv.wifi_spec==1)
+ threshold = 1;
+ else
+ threshold = 0;
+ rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
+ } else {
+ threshold = 1;
+ rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
+ }
+ #endif
+ }
+
+ rtw_hal_set_hwreg(padapter, HW_VAR_DO_IQK, NULL);
+
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+
+ //disable dynamic functions, such as high power, DIG
+ //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
+
+ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
+
+ {
+ u8 join_type = 0;
+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
+ }
+
+ Set_MSR(padapter, (pmlmeinfo->state & 0x3));
+
+ mlmeext_joinbss_event_callback(padapter, 1);
+ //restore Sequence No.
+ rtw_write8(padapter,0x4dc,padapter->xmitpriv.nqos_ssn);
+
+ sreset_restore_security_station(padapter);
+}
+
+
+void sreset_restore_network_status(_adapter *padapter)
+{
+ struct mlme_priv *mlmepriv = &padapter->mlmepriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) {
+ DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
+ sreset_restore_network_station(padapter);
+ } else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) {
+ DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
+ rtw_ap_restore_network(padapter);
+ } else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE)) {
+ DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
+ } else {
+ DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
+ }
+}
+
+void sreset_stop_adapter(_adapter *padapter)
+{
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+
+ if (padapter == NULL)
+ return;
+
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+
+ rtw_netif_stop_queue(padapter->pnetdev);
+
+ rtw_cancel_all_timer(padapter);
+
+ /* TODO: OS and HCI independent */
+ #if defined(PLATFORM_LINUX) && defined(CONFIG_USB_HCI)
+ tasklet_kill(&pxmitpriv->xmit_tasklet);
+ #endif
+
+ if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
+ rtw_scan_abort(padapter);
+
+ if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
+ {
+ rtw_set_to_roam(padapter, 0);
+ _rtw_join_timeout_handler(padapter);
+ }
+
+}
+
+void sreset_start_adapter(_adapter *padapter)
+{
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+
+ if (padapter == NULL)
+ return;
+
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+
+ if (check_fwstate(pmlmepriv, _FW_LINKED)) {
+ sreset_restore_network_status(padapter);
+ }
+
+ /* TODO: OS and HCI independent */
+ #if defined(PLATFORM_LINUX) && defined(CONFIG_USB_HCI)
+ tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
+ #endif
+
+ if (is_primary_adapter(padapter))
+ _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000);
+
+ rtw_netif_wake_queue(padapter->pnetdev);
+}
+
+void sreset_reset(_adapter *padapter)
+{
+#ifdef DBG_CONFIG_ERROR_RESET
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ struct sreset_priv *psrtpriv = &pHalData->srestpriv;
+ struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+ _irqL irqL;
+ u32 start = rtw_get_current_time();
+ struct dvobj_priv *psdpriv = padapter->dvobj;
+ struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
+
+ DBG_871X("%s\n", __FUNCTION__);
+
+ psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
+
+
+#ifdef CONFIG_POWER_SAVING
+ rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "SRESET");
+#endif
+
+ _enter_pwrlock(&pwrpriv->lock);
+
+ psrtpriv->silent_reset_inprogress = _TRUE;
+ pwrpriv->change_rfpwrstate = rf_off;
+
+ sreset_stop_adapter(padapter);
+ #ifdef CONFIG_CONCURRENT_MODE
+ sreset_stop_adapter(padapter->pbuddy_adapter);
+ #endif
+
+ #ifdef CONFIG_IPS
+ _ips_enter(padapter);
+ _ips_leave(padapter);
+ #endif
+
+ sreset_start_adapter(padapter);
+ #ifdef CONFIG_CONCURRENT_MODE
+ sreset_start_adapter(padapter->pbuddy_adapter);
+ #endif
+
+ psrtpriv->silent_reset_inprogress = _FALSE;
+
+ _exit_pwrlock(&pwrpriv->lock);
+
+ DBG_871X("%s done in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start));
+ pdbgpriv->dbg_sreset_cnt++;
+#endif
+}
+
diff --git a/rtl8xxx_EU/core/rtw_sta_mgt.c b/rtl8xxx_EU/core/rtw_sta_mgt.c
index 2d266a2..d62976c 100644..100755
--- a/rtl8xxx_EU/core/rtw_sta_mgt.c
+++ b/rtl8xxx_EU/core/rtw_sta_mgt.c
@@ -463,6 +463,11 @@ _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;
@@ -526,11 +531,6 @@ _func_enter_;
_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);
//_rtw_init_sta_recv_priv(&psta->sta_recvpriv);
@@ -637,7 +637,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:
@@ -657,6 +659,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_;
@@ -676,13 +681,25 @@ _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:
diff --git a/rtl8xxx_EU/core/rtw_tdls.c b/rtl8xxx_EU/core/rtw_tdls.c
index 59c41ad..6e12ddf 100755
--- a/rtl8xxx_EU/core/rtw_tdls.c
+++ b/rtl8xxx_EU/core/rtw_tdls.c
@@ -1,2969 +1,2969 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#define _RTW_TDLS_C_
-
-#include <drv_types.h>
-
-#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)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
-
- ptdlsinfo->ap_prohibited = _FALSE;
- ptdlsinfo->link_established = _FALSE;
- ptdlsinfo->sta_cnt = 0;
- ptdlsinfo->sta_maximum = _FALSE;
- ptdlsinfo->ch_sensing = 0;
- ptdlsinfo->cur_channel = 0;
- ptdlsinfo->candidate_ch = 1; //when inplement channel switching, default candidate channel is 1
- ptdlsinfo->watchdog_count = 0;
- ptdlsinfo->dev_discovered = 0;
-
-#ifdef CONFIG_WFD
- ptdlsinfo->wfd_info = &padapter->wfd_info;
-#endif //CONFIG_WFD
-}
-
-int rtw_init_tdls_info(_adapter* padapter)
-{
- int res = _SUCCESS;
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
-
- ptdlsinfo->tdls_enable = _TRUE;
- rtw_reset_tdls_info(padapter);
-
- _rtw_spinlock_init(&ptdlsinfo->cmd_lock);
- _rtw_spinlock_init(&ptdlsinfo->hdl_lock);
-
- return res;
-
-}
-
-void rtw_free_tdls_info(struct tdls_info *ptdlsinfo)
-{
- _rtw_spinlock_free(&ptdlsinfo->cmd_lock);
- _rtw_spinlock_free(&ptdlsinfo->hdl_lock);
-
- _rtw_memset(ptdlsinfo, 0, sizeof(struct tdls_info) );
-
-}
-
-int _issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsigned int power_mode, int wait_ack)
-{
- int ret = _FAIL;
- 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);
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(padapter, pattrib);
- pattrib->retry_ctrl = _FALSE;
-
- _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;
-
- // SetToDs(fctrl);
-
- if (power_mode)
- {
- SetPwrMgt(fctrl);
- }
-
- _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-
- SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
- pmlmeext->mgnt_seq++;
- SetFrameSubType(pframe, WIFI_DATA_NULL);
-
- pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
- pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- if(wait_ack)
- {
- ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
- }
- else
- {
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
- }
-
-exit:
- return ret;
-
-}
-
-int issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms)
-{
- int ret;
- int i = 0;
- u32 start = rtw_get_current_time();
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- //[TDLS] UAPSD : merge this from issue_nulldata() and mark it first.
- #if 0
- psta = rtw_get_stainfo(&padapter->stapriv, da);
- if (psta) {
- if (power_mode)
- rtw_hal_macid_sleep(padapter, psta->mac_id);
- else
- rtw_hal_macid_wakeup(padapter, psta->mac_id);
- } else {
- DBG_871X(FUNC_ADPT_FMT ": Can't find sta info for " MAC_FMT ", skip macid %s!!\n",
- FUNC_ADPT_ARG(padapter), MAC_ARG(da), power_mode?"sleep":"wakeup");
- rtw_warn_on(1);
- }
- #endif
-
- do
- {
- ret = _issue_nulldata_to_TDLS_peer_STA(padapter, da, power_mode, 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((i<try_cnt) && ((ret==_FAIL)||(wait_ms==0)));
-
- if (ret != _FAIL) {
- ret = _SUCCESS;
- #ifndef DBG_XMIT_ACK
- goto exit;
- #endif
- }
-
- if (try_cnt && wait_ms) {
- if (da)
- DBG_871X(FUNC_ADPT_FMT" to "MAC_FMT", ch:%u%s, %d/%d in %u ms\n",
- FUNC_ADPT_ARG(padapter), MAC_ARG(da), rtw_get_oper_ch(padapter),
- ret==_SUCCESS?", acked":"", i, try_cnt, rtw_get_passing_time_ms(start));
- else
- DBG_871X(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n",
- FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter),
- ret==_SUCCESS?", acked":"", i, try_cnt, rtw_get_passing_time_ms(start));
- }
-exit:
- return ret;
-}
-
-void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- struct sta_priv *pstapriv = &padapter->stapriv;
- _irqL irqL;
-
- //free peer sta_info
- _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- if(ptdlsinfo->sta_cnt != 0)
- ptdlsinfo->sta_cnt--;
- _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- if( ptdlsinfo->sta_cnt < (NUM_STA - 2 - 4) ) // -2: AP + BC/MC sta, -4: default key
- {
- ptdlsinfo->sta_maximum = _FALSE;
- _rtw_memset( &ptdlsinfo->ss_record, 0x00, sizeof(struct tdls_ss_record) );
- }
-
- //clear cam
- rtw_clearstakey_cmd(padapter, ptdls_sta, _TRUE);
-
- if(ptdlsinfo->sta_cnt==0){
- rtw_tdls_cmd(padapter, myid(&(padapter->eeprompriv)), TDLS_RS_RCR);
- ptdlsinfo->link_established = _FALSE;
- }
- else
- DBG_871X("Remain tdls sta:%02x\n", ptdlsinfo->sta_cnt);
-
- rtw_free_stainfo(padapter, ptdls_sta);
-
-}
-
-
-//TDLS encryption(if needed) will always be CCMP
-void rtw_tdls_set_key(_adapter *padapter, struct rx_pkt_attrib *prx_pkt_attrib, struct sta_info *ptdls_sta)
-{
- if(prx_pkt_attrib->encrypt)
- {
- ptdls_sta->dot118021XPrivacy=_AES_;
- rtw_setstakey_cmd(padapter, ptdls_sta, _TRUE, _TRUE);
- }
-}
-
-void rtw_tdls_process_ht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8 *data, u8 Length)
-{
- /* save HT capabilities in the sta object */
- _rtw_memset(&ptdls_sta->htpriv.ht_cap, 0, sizeof(struct rtw_ieee80211_ht_cap));
- if (data && Length >= sizeof(struct rtw_ieee80211_ht_cap) )
- {
- ptdls_sta->flags |= WLAN_STA_HT;
-
- ptdls_sta->flags |= WLAN_STA_WME;
-
- _rtw_memcpy(&ptdls_sta->htpriv.ht_cap, data, sizeof(struct rtw_ieee80211_ht_cap));
-
- } else
- ptdls_sta->flags &= ~WLAN_STA_HT;
-
- if(ptdls_sta->flags & WLAN_STA_HT)
- {
- if(padapter->registrypriv.ht_enable == _TRUE)
- {
- ptdls_sta->htpriv.ht_option = _TRUE;
- }
- else
- {
- ptdls_sta->htpriv.ht_option = _FALSE;
- ptdls_sta->stat_code = _STATS_FAILURE_;
- }
- }
-
- //HT related cap
- if(ptdls_sta->htpriv.ht_option)
- {
- //check if sta supports rx ampdu
- if(padapter->registrypriv.ampdu_enable==1)
- ptdls_sta->htpriv.ampdu_enable = _TRUE;
-
- //check if sta support s Short GI 20M
- if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_20))
- {
- ptdls_sta->htpriv.sgi_20m = _TRUE;
- }
- //check if sta support s Short GI 40M
- if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_40))
- {
- ptdls_sta->htpriv.sgi_40m = _TRUE;
- }
-
- // bwmode would still followed AP's setting
- if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH))
- {
- if (padapter->mlmeextpriv.cur_bwmode >= CHANNEL_WIDTH_40)
- ptdls_sta->bw_mode = CHANNEL_WIDTH_40;
- ptdls_sta->htpriv.ch_offset = padapter->mlmeextpriv.cur_ch_offset;
- }
- }
-
-}
-
-int rtw_tdls_set_ht_cap(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
-{
- int tmplen;
-
- rtw_ht_use_default_setting(padapter);
-
- tmplen = pattrib->pktlen;
- rtw_restructure_ht_ie(padapter, NULL, pframe, 0, &(pattrib->pktlen), padapter->mlmeextpriv.cur_channel);
-
- return (pattrib->pktlen - tmplen);
-
-}
-
-u8 *rtw_tdls_set_sup_ch(struct mlme_ext_priv *pmlmeext, u8 *pframe, struct pkt_attrib *pattrib)
-{
- u8 sup_ch[ 30 * 2 ] = { 0x00 }, ch_set_idx = 0; //For supported channel
- u8 ch_24g = 0, b1 = 0, b4 = 0;
- u8 bit_table = 0, sup_ch_idx = 0;
-
- do{
- if( pmlmeext->channel_set[ch_set_idx].ChannelNum >= 1 &&
- pmlmeext->channel_set[ch_set_idx].ChannelNum <= 14 )
- {
- ch_24g = 1; // 2.4 G channels
- }
- else if( pmlmeext->channel_set[ch_set_idx].ChannelNum >= 36 &&
- pmlmeext->channel_set[ch_set_idx].ChannelNum <= 48)
- {
- b1 = 1; // 5 G band1
- }
- else if( pmlmeext->channel_set[ch_set_idx].ChannelNum >= 149 &&
- pmlmeext->channel_set[ch_set_idx].ChannelNum <= 165)
- {
- b4 = 1; // 5 G band4
- }
- else
- {
- ch_set_idx++; // We don't claim that we support DFS channels.
- continue;
- }
-
- sup_ch_idx = (ch_24g + b1 + b4 - 1) * 2;
- if( sup_ch_idx >= 0)
- {
- if(sup_ch[sup_ch_idx] == 0)
- sup_ch[sup_ch_idx] = pmlmeext->channel_set[ch_set_idx].ChannelNum;
- sup_ch[sup_ch_idx+1]++; //Number of channel
- }
-
- ch_set_idx++;
- }
- while( pmlmeext->channel_set[ch_set_idx].ChannelNum != 0 && ch_set_idx < MAX_CHANNEL_NUM );
-
- return(rtw_set_ie(pframe, _SUPPORTED_CH_IE_, sup_ch_idx+2, sup_ch, &(pattrib->pktlen)));
-}
-
-#ifdef CONFIG_WFD
-void rtw_tdls_process_wfd_ie(struct tdls_info *ptdlsinfo, u8 *ptr, u8 length)
-{
- u8 wfd_ie[ 128 ] = { 0x00 };
- u32 wfd_ielen = 0;
- u32 wfd_offset = 0;
- // Try to get the TCP port information when receiving the negotiation response.
- //
-
- wfd_offset = 0;
- wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen );
- while( wfd_offset )
- {
- u8 attr_content[ 10 ] = { 0x00 };
- u32 attr_contentlen = 0;
- int i;
-
- DBG_871X( "[%s] WFD IE Found!!\n", __FUNCTION__ );
- rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen);
- if ( attr_contentlen )
- {
- ptdlsinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16( attr_content + 2 );
- DBG_871X( "[%s] Peer PORT NUM = %d\n", __FUNCTION__, ptdlsinfo->wfd_info->peer_rtsp_ctrlport );
- }
-
- _rtw_memset( attr_content, 0x00, 10);
- attr_contentlen = 0;
- rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_LOCAL_IP_ADDR, attr_content, &attr_contentlen);
- if ( attr_contentlen )
- {
- _rtw_memcpy(ptdlsinfo->wfd_info->peer_ip_address, ( attr_content + 1 ), 4);
- DBG_871X( "[%s] Peer IP = %02u.%02u.%02u.%02u \n", __FUNCTION__,
- ptdlsinfo->wfd_info->peer_ip_address[0], ptdlsinfo->wfd_info->peer_ip_address[1],
- ptdlsinfo->wfd_info->peer_ip_address[2], ptdlsinfo->wfd_info->peer_ip_address[3]
- );
- }
- wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen );
- }
-}
-
-int issue_tunneled_probe_req(_adapter *padapter)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
- struct tdls_txmgmt txmgmt;
- int ret = _FAIL;
-
- DBG_871X("[%s]\n", __FUNCTION__);
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- txmgmt.action_code = TUNNELED_PROBE_REQ;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
-
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, baddr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) != _SUCCESS) {
- rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
-exit:
-
- return ret;
-}
-
-int issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct tdls_txmgmt txmgmt;
- int ret = _FAIL;
-
- DBG_871X("[%s]\n", __FUNCTION__);
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- txmgmt.action_code = TUNNELED_PROBE_RSP;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
-
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, precv_frame->u.hdr.attrib.src, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) != _SUCCESS) {
- rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
-exit:
-
- return ret;
-}
-#endif //CONFIG_WFD
-
-int issue_tdls_setup_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, int wait_ack)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *ptdls_sta= NULL;
- _irqL irqL;
- static u8 dialogtoken = 0;
- int ret = _FAIL;
- u32 timeout_interval= TPK_RESEND_COUNT * 1000; //retry timer should set at least 301 sec, using TPK_count counting 301 times.
-
- ptxmgmt->action_code = TDLS_SETUP_REQUEST;
- if(ptdlsinfo->ap_prohibited == _TRUE)
- goto exit;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
-
- //init peer sta_info
- ptdls_sta = rtw_get_stainfo(pstapriv, ptxmgmt->peer);
- if(ptdls_sta==NULL)
- {
- ptdls_sta = rtw_alloc_stainfo(pstapriv, ptxmgmt->peer);
- if(ptdls_sta==NULL)
- {
- DBG_871X("[%s] rtw_alloc_stainfo fail\n", __FUNCTION__);
- rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
- }
-
- if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE))
- ptdlsinfo->sta_cnt++;
- if( ptdlsinfo->sta_cnt == (NUM_STA - 2 - 4) ) // -2: AP + BC/MC sta, -4: default key
- {
- ptdlsinfo->sta_maximum = _TRUE;
- }
-
- ptdls_sta->tdls_sta_state |= TDLS_RESPONDER_STATE;
- //for tdls; ptdls_sta->aid is used to fill dialogtoken
- ptdls_sta->dialog = dialogtoken;
- dialogtoken = (dialogtoken+1)%256;
- ptdls_sta->TDLS_PeerKey_Lifetime = timeout_interval;
- _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME );
-
- pattrib->qsel = pattrib->priority;
-
- if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) !=_SUCCESS ){
- rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
-
- if (wait_ack) {
- ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
- } else {
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
- }
-
- ret = _SUCCESS;
-
-exit:
-
- return ret;
-}
-
-int issue_tdls_teardown(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, u8 wait_ack)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *ptdls_sta=NULL;
- _irqL irqL;
- int ret = _FAIL;
-
- ptxmgmt->action_code = TDLS_TEARDOWN;
- ptdls_sta = rtw_get_stainfo(pstapriv, ptxmgmt->peer);
- if(ptdls_sta==NULL){
- DBG_871X("Np tdls_sta for tearing down\n");
- goto exit;
- }
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
-
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) != _SUCCESS) {
- rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
-
- if (wait_ack) {
- ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
- } else {
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
- }
-
- if(ret == _SUCCESS)
- {
- if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
- }
-
- if( ptdls_sta->timer_flag == 1 )
- {
- _enter_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL);
- ptdls_sta->timer_flag = 2;
- _exit_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL);
- }
- else
- rtw_tdls_cmd(padapter, ptxmgmt->peer, TDLS_TEAR_STA );
- }
-
-exit:
-
- return ret;
-}
-
-int issue_tdls_dis_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- int ret = _FAIL;
-
- ptxmgmt->action_code = TDLS_DISCOVERY_REQUEST;
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) != _SUCCESS) {
- rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
- dump_mgntframe(padapter, pmgntframe);
- DBG_871X("issue tdls dis req\n");
-
- ret = _SUCCESS;
-exit:
-
- return ret;
-}
-
-int issue_tdls_setup_rsp(_adapter *padapter, struct tdls_txmgmt *ptxmgmt)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- int ret = _FAIL;
-
- ptxmgmt->action_code = TDLS_SETUP_RESPONSE;
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(&(padapter->mlmepriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) != _SUCCESS) {
- rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
-
- dump_mgntframe(padapter, pmgntframe);
-
- ret = _SUCCESS;
-exit:
-
- return ret;
-
-}
-
-int issue_tdls_setup_cfm(_adapter *padapter, struct tdls_txmgmt *ptxmgmt)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- int ret = _FAIL;
-
- ptxmgmt->action_code = TDLS_SETUP_CONFIRM;
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&padapter->eeprompriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(&padapter->mlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) != _SUCCESS) {
- rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
-
- dump_mgntframe(padapter, pmgntframe);
-
- ret = _SUCCESS;
-exit:
-
- return ret;
-
-}
-
-//TDLS Discovery Response frame is a management action frame
-int issue_tdls_dis_rsp(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, u8 privacy)
-{
- 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);
- int ret = _FAIL;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //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;
-
- // unicast probe request frame
- _rtw_memcpy(pwlanhdr->addr1, ptxmgmt->peer, ETH_ALEN);
- _rtw_memcpy(pattrib->dst, pwlanhdr->addr1, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
- _rtw_memcpy(pattrib->src, pwlanhdr->addr2, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_bssid(&padapter->mlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, pwlanhdr->addr3, ETH_ALEN);
-
- 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);
-
- rtw_build_tdls_dis_rsp_ies(padapter, pmgntframe, pframe, ptxmgmt->dialog_token, privacy);
-
- pattrib->nr_frags = 1;
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
-
-exit:
- return ret;
-}
-
-int issue_tdls_peer_traffic_rsp(_adapter *padapter, struct sta_info *ptdls_sta)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct tdls_txmgmt txmgmt;
- int ret = _FAIL;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- txmgmt.action_code = TDLS_PEER_TRAFFIC_RESPONSE;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
-
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, ptdls_sta->hwaddr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
-
- if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) !=_SUCCESS ){
- rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
-
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
-
-exit:
-
- return ret;
-}
-
-int issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *ptdls_sta)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct tdls_txmgmt txmgmt;
- int ret = _FAIL;
- static u8 dialogtoken=0;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- txmgmt.action_code = TDLS_PEER_TRAFFIC_INDICATION;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
-
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, ptdls_sta->hwaddr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- //for tdls; pattrib->nr_frags is used to fill dialogtoken
- ptdls_sta->dialog = dialogtoken;
- dialogtoken = (dialogtoken+1)%256;
- //PTI frame's priority should be AC_VO
- pattrib->priority = 7;
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) != _SUCCESS) {
- rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
-
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
-
-exit:
-
- return ret;
-}
-
-int issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct tdls_txmgmt txmgmt;
- int ret = _FAIL;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- txmgmt.action_code = TDLS_CHANNEL_SWITCH_REQUEST;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
-
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
- if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) !=_SUCCESS ){
- rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
-
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
-exit:
-
- return ret;
-}
-
-int issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct tdls_txmgmt txmgmt;
- int ret = _FAIL;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- txmgmt.action_code = TDLS_CHANNEL_SWITCH_RESPONSE;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
-
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
-
- _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel = pattrib->priority;
-/*
- _enter_critical_bh(&pxmitpriv->lock, &irqL);
- if(xmitframe_enqueue_for_tdls_sleeping_sta(padapter, pmgntframe)==_TRUE){
- _exit_critical_bh(&pxmitpriv->lock, &irqL);
- return _FALSE;
- }
-*/
- if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) !=_SUCCESS ){
- rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
- rtw_free_xmitframe(pxmitpriv, pmgntframe);
- goto exit;
- }
- dump_mgntframe(padapter, pmgntframe);
- ret = _SUCCESS;
-exit:
-
- return ret;
-}
-
-int On_TDLS_Dis_Rsp(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct sta_info *ptdls_sta = NULL, *psta = rtw_get_stainfo(&(padapter->stapriv), get_bssid(&(padapter->mlmepriv)));
- struct recv_priv *precvpriv = &(padapter->recvpriv);
- u8 *ptr = precv_frame->u.hdr.rx_data, *psa;
- struct rx_pkt_attrib *pattrib = &(precv_frame->u.hdr.attrib);
- struct tdls_info *ptdlsinfo = &(padapter->tdlsinfo);
- u8 empty_addr[ETH_ALEN] = { 0x00 };
- int UndecoratedSmoothedPWDB;
- struct tdls_txmgmt txmgmt;
- int ret = _SUCCESS;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- //WFDTDLS: for sigma test, not to setup direct link automatically
- ptdlsinfo->dev_discovered = 1;
-
-#ifdef CONFIG_TDLS_AUTOSETUP
- psa = get_sa(ptr);
- ptdls_sta = rtw_get_stainfo(&(padapter->stapriv), psa);
-
- if(ptdls_sta != NULL)
- {
- ptdls_sta->tdls_sta_state |= TDLS_ALIVE_STATE;
-
- //Record the tdls sta with lowest signal strength
- if( (ptdlsinfo->sta_maximum == _TRUE) && (ptdls_sta->alive_count >= 1) )
- {
- if( _rtw_memcmp(ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN) )
- {
- _rtw_memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN);
- ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll;
- }
- else
- {
- if( ptdlsinfo->ss_record.RxPWDBAll < pattrib->RxPWDBAll )
- {
- _rtw_memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN);
- ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll;
- }
- }
- }
-
- }
- else
- {
- if( ptdlsinfo->sta_maximum == _TRUE)
- {
- if( _rtw_memcmp( ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN ) )
- {
- //All traffics are busy, do not set up another direct link.
- ret = _FAIL;
- goto exit;
- }
- else
- {
- if( pattrib->RxPWDBAll > ptdlsinfo->ss_record.RxPWDBAll )
- {
- _rtw_memcpy(txmgmt.peer, ptdlsinfo->ss_record.macaddr, ETH_ALEN);
- //issue_tdls_teardown(padapter, ptdlsinfo->ss_record.macaddr, _FALSE);
- }
- else
- {
- ret = _FAIL;
- goto exit;
- }
- }
- }
-
- padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
-
- if( pattrib->RxPWDBAll + TDLS_SIGNAL_THRESH >= UndecoratedSmoothedPWDB);
- {
- DBG_871X("pattrib->RxPWDBAll=%d, pdmpriv->UndecoratedSmoothedPWDB=%d\n", pattrib->RxPWDBAll, UndecoratedSmoothedPWDB);
- _rtw_memcpy(txmgmt.peer, psa, ETH_ALEN);
- issue_tdls_setup_req(padapter, &txmgmt, _FALSE);
- }
- }
-#endif //CONFIG_TDLS_AUTOSETUP
-
-exit:
- return ret;
-
-}
-
-sint On_TDLS_Setup_Req(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- u8 *psa, *pmyid;
- struct sta_info *ptdls_sta= NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct security_priv *psecuritypriv = &padapter->securitypriv;
- _irqL irqL;
- struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
- u8 *prsnie, *ppairwise_cipher;
- u8 i, k;
- u8 ccmp_included=0, rsnie_included=0;
- u16 j, pairwise_count;
- u8 SNonce[32];
- u32 *timeout_interval=NULL;
- sint parsing_length; //frame body length, without icv_len
- PNDIS_802_11_VARIABLE_IEs pIE;
- u8 FIXED_IE = 5;
- unsigned char supportRate[16];
- int supportRateNum = 0;
- struct tdls_txmgmt txmgmt;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- psa = get_sa(ptr);
- ptdls_sta = rtw_get_stainfo(pstapriv, psa);
-
- pmyid=myid(&(padapter->eeprompriv));
- ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
- parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
- -prx_pkt_attrib->hdrlen
- -prx_pkt_attrib->iv_len
- -prx_pkt_attrib->icv_len
- -LLC_HEADER_SIZE
- -ETH_TYPE_LEN
- -PAYLOAD_TYPE_LEN
- -FIXED_IE;
-
- if(ptdlsinfo->ap_prohibited == _TRUE)
- {
- goto exit;
- }
-
- if(ptdls_sta==NULL){
- ptdls_sta = rtw_alloc_stainfo(pstapriv, psa);
- }else{
- if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){
- //If the direct link is already set up
- //Process as re-setup after tear down
- DBG_871X("re-setup a direct link\n");
- }
- //already receiving TDLS setup request
- else if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
- DBG_871X("receive duplicated TDLS setup request frame in handshaking\n");
- goto exit;
- }
- //When receiving and sending setup_req to the same link at the same time, STA with higher MAC_addr would be initiator
- //following is to check out MAC_addr
- else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
- DBG_871X("receive setup_req after sending setup_req\n");
- for (i=0;i<6;i++){
- if(*(pmyid+i)==*(psa+i)){
- }
- else if(*(pmyid+i)>*(psa+i)){
- ptdls_sta->tdls_sta_state=TDLS_INITIATOR_STATE;
- break;
- }else if(*(pmyid+i)<*(psa+i)){
- goto exit;
- }
- }
- }
- }
-
- if(ptdls_sta)
- {
- ptdls_sta->dialog = *(ptr+2); //copy dialog token
- ptdls_sta->stat_code = 0;
-
- //parsing information element
- for(j=FIXED_IE; j<parsing_length;){
-
- pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
-
- switch (pIE->ElementID)
- {
- case _SUPPORTEDRATES_IE_:
- _rtw_memcpy(supportRate, pIE->data, pIE->Length);
- supportRateNum = pIE->Length;
- break;
- case _COUNTRY_IE_:
- break;
- case _EXT_SUPPORTEDRATES_IE_:
- if(supportRateNum<=sizeof(supportRate))
- {
- _rtw_memcpy(supportRate+supportRateNum, pIE->data, pIE->Length);
- supportRateNum += pIE->Length;
- }
- break;
- case _SUPPORTED_CH_IE_:
- break;
- case _RSN_IE_2_:
- rsnie_included=1;
- if(prx_pkt_attrib->encrypt){
- prsnie=(u8*)pIE;
- //check whether initiator STA has CCMP pairwise_cipher.
- ppairwise_cipher=prsnie+10;
- _rtw_memcpy(ptdls_sta->TDLS_RSNIE, pIE->data, pIE->Length);
- pairwise_count = *(u16*)(ppairwise_cipher-2);
- for(k=0;k<pairwise_count;k++){
- if(_rtw_memcmp( ppairwise_cipher+4*k, RSN_CIPHER_SUITE_CCMP, 4)==_TRUE)
- ccmp_included=1;
- }
- if(ccmp_included==0){
- //invalid contents of RSNIE
- ptdls_sta->stat_code=72;
- }
- }
- break;
- case _EXT_CAP_IE_:
- break;
- case _VENDOR_SPECIFIC_IE_:
- break;
- case _FTIE_:
- if(prx_pkt_attrib->encrypt)
- _rtw_memcpy(SNonce, (ptr+j+52), 32);
- break;
- case _TIMEOUT_ITVL_IE_:
- if(prx_pkt_attrib->encrypt)
- timeout_interval = (u32 *)(ptr+j+3);
- break;
- case _RIC_Descriptor_IE_:
- break;
- case _HT_CAPABILITY_IE_:
- rtw_tdls_process_ht_cap(padapter, ptdls_sta, pIE->data, pIE->Length);
- break;
- case EID_BSSCoexistence:
- break;
- case _LINK_ID_IE_:
- if(_rtw_memcmp(get_bssid(pmlmepriv), pIE->data, 6) == _FALSE)
- {
- //not in the same BSS
- ptdls_sta->stat_code=7;
- }
- break;
- default:
- break;
- }
-
- j += (pIE->Length + 2);
-
- }
-
- //check status code
- //if responder STA has/hasn't security on AP, but request hasn't/has RSNIE, it should reject
- if(ptdls_sta->stat_code == 0 )
- {
- if(rsnie_included && (prx_pkt_attrib->encrypt==0)){
- //security disabled
- ptdls_sta->stat_code = 5;
- }else if(rsnie_included==0 && (prx_pkt_attrib->encrypt)){
- //request haven't RSNIE
- ptdls_sta->stat_code = 38;
- }
-
-#ifdef CONFIG_WFD
- //WFD test plan version 0.18.2 test item 5.1.5
- //SoUT does not use TDLS if AP uses weak security
- if ( padapter->wdinfo.wfd_tdls_enable )
- {
- if(rsnie_included && (prx_pkt_attrib->encrypt != _AES_))
- {
- ptdls_sta->stat_code = 5;
- }
- }
-#endif //CONFIG_WFD
- }
-
- ptdls_sta->tdls_sta_state|= TDLS_INITIATOR_STATE;
- if(prx_pkt_attrib->encrypt){
- _rtw_memcpy(ptdls_sta->SNonce, SNonce, 32);
- _rtw_memcpy(&(ptdls_sta->TDLS_PeerKey_Lifetime), timeout_interval, 4);
- }
-
- //update station supportRate
- ptdls_sta->bssratelen = supportRateNum;
- _rtw_memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum);
-
- if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE))
- ptdlsinfo->sta_cnt++;
- if( ptdlsinfo->sta_cnt == (NUM_STA - 2 - 4) ) // -2: AP + BC/MC sta, -4: default key
- {
- ptdlsinfo->sta_maximum = _TRUE;
- }
-
-#ifdef CONFIG_WFD
- rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE);
-#endif // CONFIG_WFD
-
- }
- else
- {
- goto exit;
- }
-
- _rtw_memcpy(txmgmt.peer, prx_pkt_attrib->src, ETH_ALEN);
- issue_tdls_setup_rsp(padapter, &txmgmt);
-
- if(ptdls_sta->stat_code==0)
- {
- _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME);
- }
- else //status code!=0 ; setup unsuccess
- {
- free_tdls_sta(padapter, ptdls_sta);
- }
-
-exit:
-
- return _SUCCESS;
-}
-
-int On_TDLS_Setup_Rsp(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- struct sta_info *ptdls_sta= NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- _irqL irqL;
- struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
- u8 *psa;
- u16 stat_code;
- sint parsing_length; //frame body length, without icv_len
- PNDIS_802_11_VARIABLE_IEs pIE;
- u8 FIXED_IE =7;
- u8 ANonce[32];
- u8 *pftie=NULL, *ptimeout_ie=NULL, *plinkid_ie=NULL, *prsnie=NULL, *pftie_mic=NULL, *ppairwise_cipher=NULL;
- u16 pairwise_count, j, k;
- u8 verify_ccmp=0;
- unsigned char supportRate[16];
- int supportRateNum = 0;
- struct tdls_txmgmt txmgmt;
- int ret = _SUCCESS;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- psa = get_sa(ptr);
- ptdls_sta = rtw_get_stainfo(pstapriv, psa);
-
- if ( NULL == ptdls_sta )
- {
- ret = _FAIL;
- goto exit;
- }
-
- ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
- parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
- -prx_pkt_attrib->hdrlen
- -prx_pkt_attrib->iv_len
- -prx_pkt_attrib->icv_len
- -LLC_HEADER_SIZE
- -TYPE_LENGTH_FIELD_SIZE
- -1
- -FIXED_IE;
-
- _rtw_memcpy(&stat_code, ptr+2, 2);
-
- if(stat_code!=0)
- {
- DBG_871X( "[%s] status_code = %d, free_tdls_sta\n", __FUNCTION__, stat_code );
- free_tdls_sta(padapter, ptdls_sta);
- ret = _FAIL;
- goto exit;
- }
-
- stat_code = 0;
-
- //parsing information element
- for(j=FIXED_IE; j<parsing_length;)
- {
- pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
-
- switch (pIE->ElementID)
- {
- case _SUPPORTEDRATES_IE_:
- _rtw_memcpy(supportRate, pIE->data, pIE->Length);
- supportRateNum = pIE->Length;
- break;
- case _COUNTRY_IE_:
- break;
- case _EXT_SUPPORTEDRATES_IE_:
- if(supportRateNum<=sizeof(supportRate))
- {
- _rtw_memcpy(supportRate+supportRateNum, pIE->data, pIE->Length);
- supportRateNum += pIE->Length;
- }
- break;
- case _SUPPORTED_CH_IE_:
- break;
- case _RSN_IE_2_:
- prsnie=(u8*)pIE;
- //check whether responder STA has CCMP pairwise_cipher.
- ppairwise_cipher=prsnie+10;
- _rtw_memcpy(&pairwise_count, (u16*)(ppairwise_cipher-2), 2);
- for(k=0;k<pairwise_count;k++){
- if(_rtw_memcmp( ppairwise_cipher+4*k, RSN_CIPHER_SUITE_CCMP, 4)==_TRUE)
- verify_ccmp=1;
- }
- case _EXT_CAP_IE_:
- break;
- case _VENDOR_SPECIFIC_IE_:
- break;
- case _FTIE_:
- pftie=(u8*)pIE;
- //_rtw_memcpy(ptdls_sta->ANonce, (ptr+j+20), 32);
- _rtw_memcpy(ANonce, (ptr+j+20), 32);
- break;
- case _TIMEOUT_ITVL_IE_:
- ptimeout_ie=(u8*)pIE;
- break;
- case _RIC_Descriptor_IE_:
- break;
- case _HT_CAPABILITY_IE_:
- rtw_tdls_process_ht_cap(padapter, ptdls_sta, pIE->data, pIE->Length);
- break;
- case EID_BSSCoexistence:
- break;
- case _LINK_ID_IE_:
- plinkid_ie=(u8*)pIE;
- break;
- default:
- break;
- }
-
- j += (pIE->Length + 2);
-
- }
-
- //update station's supportRate
- ptdls_sta->bssratelen = supportRateNum;
- _rtw_memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum);
-
- _rtw_memcpy(ptdls_sta->ANonce, ANonce, 32);
-
-#ifdef CONFIG_WFD
- rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE);
-#endif // CONFIG_WFD
-
- if(stat_code != 0)
- {
- ptdls_sta->stat_code = stat_code;
- }
- else
- {
- if(prx_pkt_attrib->encrypt)
- {
- if(verify_ccmp==1)
- {
- wpa_tdls_generate_tpk(padapter, ptdls_sta);
- ptdls_sta->stat_code=0;
- if(tdls_verify_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie)==0) //0: Invalid, 1: valid
- {
- free_tdls_sta(padapter, ptdls_sta);
- ret = _FAIL;
- goto exit;
- }
- }
- else
- {
- ptdls_sta->stat_code=72; //invalide contents of RSNIE
- }
-
- }else{
- ptdls_sta->stat_code=0;
- }
- }
-
- DBG_871X("issue_tdls_setup_cfm\n");
- _rtw_memcpy(txmgmt.peer, prx_pkt_attrib->src, ETH_ALEN);
- issue_tdls_setup_cfm(padapter, &txmgmt);
-
- if(ptdls_sta->stat_code==0)
- {
- ptdlsinfo->link_established = _TRUE;
-
- if( ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE )
- {
- ptdls_sta->tdls_sta_state |= TDLS_LINKED_STATE;
- _cancel_timer_ex( &ptdls_sta->handshake_timer);
- }
-
- rtw_tdls_set_key(padapter, prx_pkt_attrib, ptdls_sta);
-
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_ESTABLISHED);
-
- }
-
-exit:
- return ret;
-
-}
-
-int On_TDLS_Setup_Cfm(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- struct sta_info *ptdls_sta= NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- _irqL irqL;
- struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
- u8 *psa;
- u16 stat_code;
- sint parsing_length;
- PNDIS_802_11_VARIABLE_IEs pIE;
- u8 FIXED_IE =5;
- u8 *pftie=NULL, *ptimeout_ie=NULL, *plinkid_ie=NULL, *prsnie=NULL, *pftie_mic=NULL, *ppairwise_cipher=NULL;
- u16 j, pairwise_count;
- int ret = _SUCCESS;
-
- psa = get_sa(ptr);
- ptdls_sta = rtw_get_stainfo(pstapriv, psa);
-
- if(ptdls_sta == NULL)
- {
- DBG_871X( "[%s] Direct Link Peer = "MAC_FMT" not found\n", __FUNCTION__, MAC_ARG(psa) );
- ret = _FAIL;
- goto exit;
- }
-
- ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
- parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
- -prx_pkt_attrib->hdrlen
- -prx_pkt_attrib->iv_len
- -prx_pkt_attrib->icv_len
- -LLC_HEADER_SIZE
- -ETH_TYPE_LEN
- -PAYLOAD_TYPE_LEN
- -FIXED_IE;
- _rtw_memcpy(&stat_code, ptr+2, 2);
-
- if(stat_code!=0){
- DBG_871X( "[%s] stat_code = %d\n, free_tdls_sta", __FUNCTION__, stat_code );
- free_tdls_sta(padapter, ptdls_sta);
- ret = _FAIL;
- goto exit;
- }
-
- if(prx_pkt_attrib->encrypt){
- //parsing information element
- for(j=FIXED_IE; j<parsing_length;){
-
- pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
-
- switch (pIE->ElementID)
- {
- case _RSN_IE_2_:
- prsnie=(u8*)pIE;
- break;
- case _VENDOR_SPECIFIC_IE_:
- break;
- case _FTIE_:
- pftie=(u8*)pIE;
- break;
- case _TIMEOUT_ITVL_IE_:
- ptimeout_ie=(u8*)pIE;
- break;
- case _HT_EXTRA_INFO_IE_:
- break;
- case _LINK_ID_IE_:
- plinkid_ie=(u8*)pIE;
- break;
- default:
- break;
- }
-
- j += (pIE->Length + 2);
-
- }
-
- //verify mic in FTIE MIC field
- if(tdls_verify_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie)==0){ //0: Invalid, 1: Valid
- free_tdls_sta(padapter, ptdls_sta);
- ret = _FAIL;
- goto exit;
- }
-
- }
-
- ptdlsinfo->link_established = _TRUE;
- if( ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE )
- {
- ptdls_sta->tdls_sta_state|=TDLS_LINKED_STATE;
- _cancel_timer_ex( &ptdls_sta->handshake_timer);
- }
-
- rtw_tdls_set_key(padapter, prx_pkt_attrib, ptdls_sta);
-
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_ESTABLISHED);
-
-exit:
- return ret;
-
-}
-
-int On_TDLS_Dis_Req(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *psta_ap;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- sint parsing_length; //frame body length, without icv_len
- PNDIS_802_11_VARIABLE_IEs pIE;
- u8 FIXED_IE = 3, *dst;
- u16 j;
- struct tdls_txmgmt txmgmt;
- int ret = _SUCCESS;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len + LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE + 1;
- txmgmt.dialog_token = *(ptr+2);
- _rtw_memcpy(&txmgmt.peer, precv_frame->u.hdr.attrib.src, ETH_ALEN);
- txmgmt.action_code = TDLS_DISCOVERY_RESPONSE;
- parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
- -prx_pkt_attrib->hdrlen
- -prx_pkt_attrib->iv_len
- -prx_pkt_attrib->icv_len
- -LLC_HEADER_SIZE
- -TYPE_LENGTH_FIELD_SIZE
- -1
- -FIXED_IE;
-
- //parsing information element
- for(j=FIXED_IE; j<parsing_length;){
-
- pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
-
- switch (pIE->ElementID)
- {
- case _LINK_ID_IE_:
- psta_ap = rtw_get_stainfo(pstapriv, pIE->data);
- if(psta_ap == NULL)
- {
- goto exit;
- }
- dst = pIE->data + 12;
- if( (MacAddr_isBcst(dst) == _FALSE) && (_rtw_memcmp(myid(&(padapter->eeprompriv)), dst, 6) == _FALSE) )
- {
- goto exit;
- }
- break;
- default:
- break;
- }
-
- j += (pIE->Length + 2);
-
- }
-
- issue_tdls_dis_rsp(padapter, &txmgmt, prx_pkt_attrib->privacy);
-
-exit:
- return ret;
-
-}
-
-int On_TDLS_Teardown(_adapter *padapter, union recv_frame *precv_frame)
-{
- u8 *psa;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *ptdls_sta= NULL;
- _irqL irqL;
-
- psa = get_sa(ptr);
-
- ptdls_sta = rtw_get_stainfo(pstapriv, psa);
- if(ptdls_sta!=NULL){
- if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
- }
- free_tdls_sta(padapter, ptdls_sta);
- }
-
- return _SUCCESS;
-
-}
-
-u8 TDLS_check_ch_state(uint state){
- if( (state & TDLS_CH_SWITCH_ON_STATE) &&
- (state & TDLS_AT_OFF_CH_STATE) &&
- (state & TDLS_PEER_AT_OFF_STATE) ){
-
- if(state & TDLS_PEER_SLEEP_STATE)
- return 2; //U-APSD + ch. switch
- else
- return 1; //ch. switch
- }else
- return 0;
-}
-
-int On_TDLS_Peer_Traffic_Indication(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
- struct sta_info *ptdls_sta = rtw_get_stainfo(&padapter->stapriv, pattrib->src);
- u8 *ptr = precv_frame->u.hdr.rx_data;
-
- ptr +=pattrib->hdrlen + pattrib->iv_len + LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE + 1;
-
- if(ptdls_sta != NULL)
- {
- ptdls_sta->dialog = *(ptr+2);
- issue_tdls_peer_traffic_rsp(padapter, ptdls_sta);
-
- //issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta->hwaddr, 0, 0, 0);
- }
- else
- {
- DBG_871X("from unknown sta:"MAC_FMT"\n", MAC_ARG(pattrib->src));
- return _FAIL;
- }
-
- return _SUCCESS;
-}
-
-//we process buffered data for 1. U-APSD, 2. ch. switch, 3. U-APSD + ch. switch here
-int On_TDLS_Peer_Traffic_Rsp(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib;
- struct sta_priv *pstapriv = &padapter->stapriv;
- //get peer sta infomation
- struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->src);
- u8 wmmps_ac=0, state=TDLS_check_ch_state(ptdls_sta->tdls_sta_state);
- int i;
-
- ptdls_sta->sta_stats.rx_data_pkts++;
-
- ptdls_sta->tdls_sta_state &= ~(TDLS_WAIT_PTR_STATE);
-
- //receive peer traffic response frame, sleeping STA wakes up
- //ptdls_sta->tdls_sta_state &= ~(TDLS_PEER_SLEEP_STATE);
- //process_wmmps_data( padapter, precv_frame);
-
- // if noticed peer STA wakes up by receiving peer traffic response
- // and we want to do channel swtiching, then we will transmit channel switch request first
- if(ptdls_sta->tdls_sta_state & TDLS_APSD_CHSW_STATE){
- issue_tdls_ch_switch_req(padapter, pattrib->src);
- ptdls_sta->tdls_sta_state &= ~(TDLS_APSD_CHSW_STATE);
- return _SUCCESS;
- }
-
- //check 4-AC queue bit
- if(ptdls_sta->uapsd_vo || ptdls_sta->uapsd_vi || ptdls_sta->uapsd_be || ptdls_sta->uapsd_bk)
- wmmps_ac=1;
-
- //if it's a direct link and have buffered frame
- if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){
- //[TDLS] UAPSD
- //if(wmmps_ac && state)
- if(wmmps_ac && 1)
- {
- _irqL irqL;
- _list *xmitframe_plist, *xmitframe_phead;
- struct xmit_frame *pxmitframe=NULL;
-
- _enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL);
-
- xmitframe_phead = get_list_head(&ptdls_sta->sleep_q);
- xmitframe_plist = get_next(xmitframe_phead);
-
- //transmit buffered frames
- while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE)
- {
- pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list);
- xmitframe_plist = get_next(xmitframe_plist);
- rtw_list_delete(&pxmitframe->list);
-
- ptdls_sta->sleepq_len--;
- ptdls_sta->sleepq_ac_len--;
- if(ptdls_sta->sleepq_len>0){
- pxmitframe->attrib.mdata = 1;
- pxmitframe->attrib.eosp = 0;
- }else{
- pxmitframe->attrib.mdata = 0;
- pxmitframe->attrib.eosp = 1;
- }
- pxmitframe->attrib.triggered = 1;
-
- rtw_hal_xmitframe_enqueue(padapter, pxmitframe);
-
-
- }
-
- if(ptdls_sta->sleepq_len==0)
- {
- DBG_871X("no buffered packets for tdls to xmit\n");
- //on U-APSD + CH. switch state, when there is no buffered date to xmit,
- // we should go back to base channel
- if(state==2){
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
- }else if(ptdls_sta->tdls_sta_state&TDLS_SW_OFF_STATE){
- ptdls_sta->tdls_sta_state &= ~(TDLS_SW_OFF_STATE);
- ptdlsinfo->candidate_ch= pmlmeext->cur_channel;
- issue_tdls_ch_switch_req(padapter, pattrib->src);
- DBG_871X("issue tdls ch switch req back to base channel\n");
- }
-
- }
- else
- {
- DBG_871X("error!psta->sleepq_len=%d\n", ptdls_sta->sleepq_len);
- ptdls_sta->sleepq_len=0;
- }
-
- _exit_critical_bh(&ptdls_sta->sleep_q.lock, &irqL);
-
- }
-
- }
-
- return _SUCCESS;
-}
-
-sint On_TDLS_Ch_Switch_Req(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct sta_info *ptdls_sta= NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
- u8 *psa;
- sint parsing_length;
- PNDIS_802_11_VARIABLE_IEs pIE;
- u8 FIXED_IE =3;
- u16 j;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-
- psa = get_sa(ptr);
- ptdls_sta = rtw_get_stainfo(pstapriv, psa);
-
- ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
- parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
- -prx_pkt_attrib->hdrlen
- -prx_pkt_attrib->iv_len
- -prx_pkt_attrib->icv_len
- -LLC_HEADER_SIZE
- -ETH_TYPE_LEN
- -PAYLOAD_TYPE_LEN
- -FIXED_IE;
-
- ptdls_sta->off_ch = *(ptr+2);
-
- //parsing information element
- for(j=FIXED_IE; j<parsing_length;){
-
- pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
-
- switch (pIE->ElementID)
- {
- case _COUNTRY_IE_:
- break;
- case _CH_SWTICH_ANNOUNCE_:
- break;
- case _LINK_ID_IE_:
- break;
- case _CH_SWITCH_TIMING_:
- _rtw_memcpy(&ptdls_sta->ch_switch_time, pIE->data, 2);
- _rtw_memcpy(&ptdls_sta->ch_switch_timeout, pIE->data+2, 2);
- default:
- break;
- }
-
- j += (pIE->Length + 2);
-
- }
-
- //todo: check status
- ptdls_sta->stat_code=0;
- ptdls_sta->tdls_sta_state |= TDLS_CH_SWITCH_ON_STATE;
-
- issue_nulldata(padapter, NULL, 1, 0, 0);
-
- issue_tdls_ch_switch_rsp(padapter, psa);
-
- DBG_871X("issue tdls channel switch response\n");
-
- if((ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE) && ptdls_sta->off_ch==pmlmeext->cur_channel){
- DBG_871X("back to base channel %x\n", pmlmeext->cur_channel);
- ptdls_sta->option=TDLS_BASE_CH;
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_BASE_CH);
- }else{
- ptdls_sta->option=TDLS_OFF_CH;
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_OFF_CH);
- }
- return _SUCCESS;
-}
-
-sint On_TDLS_Ch_Switch_Rsp(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct sta_info *ptdls_sta= NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
- u8 *psa;
- sint parsing_length;
- PNDIS_802_11_VARIABLE_IEs pIE;
- u8 FIXED_IE =4;
- u16 stat_code, j, switch_time, switch_timeout;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- int ret = _SUCCESS;
-
- psa = get_sa(ptr);
- ptdls_sta = rtw_get_stainfo(pstapriv, psa);
-
- //if channel switch is running and receiving Unsolicited TDLS Channel Switch Response,
- //it will go back to base channel and terminate this channel switch procedure
- if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE ){
- if(pmlmeext->cur_channel==ptdls_sta->off_ch){
- DBG_871X("back to base channel %x\n", pmlmeext->cur_channel);
- ptdls_sta->option=TDLS_BASE_CH;
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_BASE_CH);
- }else{
- DBG_871X("receive unsolicited channel switch response \n");
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
- }
- ret = _FAIL;
- goto exit;
- }
-
- //avoiding duplicated or unconditional ch. switch. rsp
- if(!(ptdls_sta->tdls_sta_state & TDLS_CH_SW_INITIATOR_STATE))
- {
- ret = _FAIL;
- goto exit;
- }
-
- ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
- parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
- -prx_pkt_attrib->hdrlen
- -prx_pkt_attrib->iv_len
- -prx_pkt_attrib->icv_len
- -LLC_HEADER_SIZE
- -ETH_TYPE_LEN
- -PAYLOAD_TYPE_LEN
- -FIXED_IE;
-
- _rtw_memcpy(&stat_code, ptr+2, 2);
-
- if(stat_code!=0){
- ret = _FAIL;
- goto exit;
- }
-
- //parsing information element
- for(j=FIXED_IE; j<parsing_length;){
-
- pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
-
- switch (pIE->ElementID)
- {
- case _LINK_ID_IE_:
- break;
- case _CH_SWITCH_TIMING_:
- _rtw_memcpy(&switch_time, pIE->data, 2);
- if(switch_time > ptdls_sta->ch_switch_time)
- _rtw_memcpy(&ptdls_sta->ch_switch_time, &switch_time, 2);
-
- _rtw_memcpy(&switch_timeout, pIE->data+2, 2);
- if(switch_timeout > ptdls_sta->ch_switch_timeout)
- _rtw_memcpy(&ptdls_sta->ch_switch_timeout, &switch_timeout, 2);
-
- default:
- break;
- }
-
- j += (pIE->Length + 2);
-
- }
-
- ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SW_INITIATOR_STATE);
- ptdls_sta->tdls_sta_state |=TDLS_CH_SWITCH_ON_STATE;
-
- //goto set_channel_workitem_callback()
- ptdls_sta->option=TDLS_OFF_CH;
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_OFF_CH);
-
-exit:
- return ret;
-}
-
-#ifdef CONFIG_WFD
-void wfd_ie_tdls(_adapter * padapter, u8 *pframe, u32 *pktlen )
-{
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct wifi_display_info *pwfd_info = padapter->tdlsinfo.wfd_info;
- u8 wfdie[ MAX_WFD_IE_LEN] = { 0x00 };
- u32 wfdielen = 0;
-
- // WFD OUI
- wfdielen = 0;
- wfdie[ wfdielen++ ] = 0x50;
- wfdie[ wfdielen++ ] = 0x6F;
- wfdie[ wfdielen++ ] = 0x9A;
- wfdie[ wfdielen++ ] = 0x0A; // WFA WFD v1.0
-
- // Commented by Albert 20110825
- // According to the WFD Specification, the negotiation request frame should contain 3 WFD attributes
- // 1. WFD Device Information
- // 2. Associated BSSID ( Optional )
- // 3. Local IP Adress ( Optional )
-
- // WFD Device Information ATTR
- // Type:
- wfdie[ wfdielen++ ] = WFD_ATTR_DEVICE_INFO;
-
- // Length:
- // Note: In the WFD specification, the size of length field is 2.
- RTW_PUT_BE16(wfdie + wfdielen, 0x0006);
- wfdielen += 2;
-
- // Value1:
- // WFD device information
- // available for WFD session + Preferred TDLS + WSD ( WFD Service Discovery )
- RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL
- | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_WSD);
- wfdielen += 2;
-
- // Value2:
- // Session Management Control Port
- // Default TCP port for RTSP messages is 554
- RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport );
- wfdielen += 2;
-
- // Value3:
- // WFD Device Maximum Throughput
- // 300Mbps is the maximum throughput
- RTW_PUT_BE16(wfdie + wfdielen, 300);
- wfdielen += 2;
-
- // Associated BSSID ATTR
- // Type:
- wfdie[ wfdielen++ ] = WFD_ATTR_ASSOC_BSSID;
-
- // Length:
- // Note: In the WFD specification, the size of length field is 2.
- RTW_PUT_BE16(wfdie + wfdielen, 0x0006);
- wfdielen += 2;
-
- // Value:
- // Associated BSSID
- if ( check_fwstate( pmlmepriv, _FW_LINKED) == _TRUE )
- {
- _rtw_memcpy( wfdie + wfdielen, &pmlmepriv->assoc_bssid[ 0 ], ETH_ALEN );
- }
- else
- {
- _rtw_memset( wfdie + wfdielen, 0x00, ETH_ALEN );
- }
-
- // Local IP Address ATTR
- wfdie[ wfdielen++ ] = WFD_ATTR_LOCAL_IP_ADDR;
-
- // Length:
- // Note: In the WFD specification, the size of length field is 2.
- RTW_PUT_BE16(wfdie + wfdielen, 0x0005);
- wfdielen += 2;
-
- // Version:
- // 0x01: Version1;IPv4
- wfdie[ wfdielen++ ] = 0x01;
-
- // IPv4 Address
- _rtw_memcpy( wfdie + wfdielen, pwfd_info->ip_address, 4 );
- wfdielen += 4;
-
- pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, pktlen);
-
-}
-#endif //CONFIG_WFD
-
-void rtw_build_tdls_setup_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
-{
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- struct registry_priv *pregistrypriv = &padapter->registrypriv;
- struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst);
-
- u8 payload_type = 0x02;
- u8 category = RTW_WLAN_CATEGORY_TDLS;
- u8 action = TDLS_SETUP_REQUEST;
- u8 bssrate[NDIS_802_11_LENGTH_RATES_EX]; //Use NDIS_802_11_LENGTH_RATES_EX in order to call func.rtw_set_supported_rate
- int bssrate_len = 0, i = 0 ;
- u8 more_supportedrates = 0;
- unsigned int ie_len;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- u8 link_id_addr[18] = {0};
- u8 iedata=0;
- u8 sup_ch[ 30 * 2 ] = {0x00 }, sup_ch_idx = 0, idx_5g = 2; //For supported channel
- u8 timeout_itvl[5]; //set timeout interval to maximum value
- u32 time;
- u8 *pframe_head;
-
- //SNonce
- if(pattrib->encrypt){
- for(i=0;i<8;i++){
- time=rtw_get_current_time();
- _rtw_memcpy(&ptdls_sta->SNonce[4*i], (u8 *)&time, 4);
- }
- }
-
- pframe_head = pframe; // For rtw_tdls_set_ht_cap()
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, dialog token
- 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, &(ptdls_sta->dialog), &(pattrib->pktlen));
-
- //capability
- _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2);
-
- if(pattrib->encrypt)
- *pframe =*pframe | cap_Privacy;
- pframe += 2;
- pattrib->pktlen += 2;
-
- //supported rates
- if(pmlmeext->cur_channel < 14 )
- {
- rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N);
- bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN;
- }
- else
- {
- rtw_set_supported_rate(bssrate, WIRELESS_11A_5N);
- bssrate_len = IEEE80211_NUM_OFDM_RATESLEN;
- }
-
- //country(optional)
-
- if (bssrate_len > 8)
- {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
- more_supportedrates = 1;
- }
- else
- {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
- }
-
- //extended supported rates
- if(more_supportedrates==1){
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
- }
-
- //supported channels
- pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib);
-
- // SRC IE
- pframe = rtw_set_ie( pframe, _SRC_IE_, sizeof(TDLS_SRC), TDLS_SRC, &(pattrib->pktlen));
-
- //RSNIE
- if(pattrib->encrypt)
- pframe = rtw_set_ie(pframe, _RSN_IE_2_, sizeof(TDLS_RSNIE), TDLS_RSNIE, &(pattrib->pktlen));
-
- //extended capabilities
- pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , sizeof(TDLS_EXT_CAPIE), TDLS_EXT_CAPIE, &(pattrib->pktlen));
-
- //QoS capability(WMM_IE)
- pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, sizeof(TDLS_WMMIE), TDLS_WMMIE, &(pattrib->pktlen));
-
-
- if(pattrib->encrypt){
- //FTIE
- _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0
- _rtw_memset(pframe, _FTIE_, 1); //version
- _rtw_memset((pframe+1), 82, 1); //length
- _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32);
- pframe += 84;
- pattrib->pktlen += 84;
-
- //Timeout interval
- timeout_itvl[0]=0x02;
- _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4);
- pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
- }
-
- //Sup_reg_classes(optional)
- //HT capabilities
- pframe += rtw_tdls_set_ht_cap(padapter, pframe_head, pattrib);
-
- //20/40 BSS coexistence
- if(pmlmepriv->num_FortyMHzIntolerant>0)
- iedata |= BIT(2);//20 MHz BSS Width Request
- pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
-
- //Link identifier
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
-#ifdef CONFIG_WFD
- wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) );
-#endif //CONFIG_WFD
-
-}
-
-void rtw_build_tdls_setup_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
-{
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- struct sta_info *ptdls_sta;
- struct registry_priv *pregistrypriv = &padapter->registrypriv;
-
- u8 payload_type = 0x02;
- unsigned char category = RTW_WLAN_CATEGORY_TDLS;
- unsigned char action = TDLS_SETUP_RESPONSE;
- unsigned char bssrate[NDIS_802_11_LENGTH_RATES_EX];
- int bssrate_len = 0;
- u8 more_supportedrates = 0;
- unsigned int ie_len;
- unsigned char *p;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- u8 link_id_addr[18] = {0};
- u8 iedata=0;
- u8 timeout_itvl[5]; //setup response timeout interval will copy from request
- u8 ANonce[32]; //maybe it can put in ontdls_req
- u8 k; //for random ANonce
- u8 *pftie=NULL, *ptimeout_ie=NULL, *plinkid_ie=NULL, *prsnie=NULL, *pftie_mic=NULL;
- u32 time;
- u8 *pframe_head;
-
- ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst);
-
- if(ptdls_sta == NULL )
- {
- DBG_871X("[%s] %d\n", __FUNCTION__, __LINE__);
- return;
- }
-
- if(pattrib->encrypt){
- for(k=0;k<8;k++){
- time=rtw_get_current_time();
- _rtw_memcpy(&ptdls_sta->ANonce[4*k], (u8*)&time, 4);
- }
- }
-
- pframe_head = pframe;
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, status code
- 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, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen));
-
- if(ptdls_sta->stat_code!=0) //invalid setup request
- {
- DBG_871X("ptdls_sta->stat_code:%04x \n", ptdls_sta->stat_code);
- return;
- }
-
- //dialog token
- pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen));
-
- //capability
- _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2);
-
- if(pattrib->encrypt )
- *pframe =*pframe | cap_Privacy;
- pframe += 2;
- pattrib->pktlen += 2;
-
- //supported rates
- //supported rates
- if(pmlmeext->cur_channel < 14 )
- {
- rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N);
- bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN;
- }
- else
- {
- rtw_set_supported_rate(bssrate, WIRELESS_11A_5N);
- bssrate_len = IEEE80211_NUM_OFDM_RATESLEN;
- }
-
- if (bssrate_len > 8)
- {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
- more_supportedrates = 1;
- }
- else
- {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
- }
-
- //country(optional)
- //extended supported rates
- if(more_supportedrates==1){
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
- }
-
- //supported channels
- pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib);
-
- // SRC IE
- pframe = rtw_set_ie(pframe, _SRC_IE_ , sizeof(TDLS_SRC), TDLS_SRC, &(pattrib->pktlen));
-
- //RSNIE
- if(pattrib->encrypt){
- prsnie = pframe;
- pframe = rtw_set_ie(pframe, _RSN_IE_2_, sizeof(ptdls_sta->TDLS_RSNIE), ptdls_sta->TDLS_RSNIE, &(pattrib->pktlen));
- }
-
- //extended capabilities
- pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , sizeof(TDLS_EXT_CAPIE), TDLS_EXT_CAPIE, &(pattrib->pktlen));
-
- //QoS capability(WMM_IE)
- pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, sizeof(TDLS_WMMIE), TDLS_WMMIE, &(pattrib->pktlen));
-
- if(pattrib->encrypt){
- wpa_tdls_generate_tpk(padapter, ptdls_sta);
-
- //FTIE
- pftie = pframe;
- pftie_mic = pframe+4;
- _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0
- _rtw_memset(pframe, _FTIE_, 1); //version
- _rtw_memset((pframe+1), 82, 1); //length
- _rtw_memcpy((pframe+20), ptdls_sta->ANonce, 32);
- _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32);
- pframe += 84;
- pattrib->pktlen += 84;
-
- //Timeout interval
- ptimeout_ie = pframe;
- timeout_itvl[0]=0x02;
- _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4);
- pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
- }
-
- //Sup_reg_classes(optional)
- //HT capabilities
- pframe += rtw_tdls_set_ht_cap(padapter, pframe_head, pattrib);
-
- //20/40 BSS coexistence
- if(pmlmepriv->num_FortyMHzIntolerant>0)
- iedata |= BIT(2);//20 MHz BSS Width Request
- pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
-
- //Link identifier
- plinkid_ie = pframe;
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
- //fill FTIE mic
- if(pattrib->encrypt)
- wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic);
-
-#ifdef CONFIG_WFD
- wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) );
-#endif //CONFIG_WFD
-
-}
-
-void rtw_build_tdls_setup_cfm_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
-{
-
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst);
-
- u8 payload_type = 0x02;
- unsigned char category = RTW_WLAN_CATEGORY_TDLS;
- unsigned char action = TDLS_SETUP_CONFIRM;
- u8 more_supportedrates = 0;
- unsigned int ie_len;
- unsigned char *p;
- u8 timeout_itvl[5]; //set timeout interval to maximum value
- u8 wmm_param_ele[24] = {0};
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- u8 link_id_addr[18] = {0};
- u8 *pftie=NULL, *ptimeout_ie=NULL, *plinkid_ie=NULL, *prsnie=NULL, *pftie_mic=NULL;
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, status code, dialog token
- 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, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen));
- pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen));
-
- if(ptdls_sta->stat_code!=0) //invalid setup request
- return;
-
- //RSNIE
- if(pattrib->encrypt){
- prsnie = pframe;
- pframe = rtw_set_ie(pframe, _RSN_IE_2_, sizeof(TDLS_RSNIE), TDLS_RSNIE, &(pattrib->pktlen));
- }
-
- //EDCA param set; WMM param ele.
- if(pattrib->encrypt){
- //FTIE
- pftie = pframe;
- pftie_mic = pframe+4;
- _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0
- _rtw_memset(pframe, _FTIE_, 1); //version
- _rtw_memset((pframe+1), 82, 1); //length
- _rtw_memcpy((pframe+20), ptdls_sta->ANonce, 32);
- _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32);
- pframe += 84;
- pattrib->pktlen += 84;
-
- //Timeout interval
- ptimeout_ie = pframe;
- timeout_itvl[0]=0x02;
- _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4);
- ptdls_sta->TPK_count=0;
- _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT);
- pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
- }
-
- //HT operation; todo
- //Link identifier
- plinkid_ie = pframe;
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
- //FTIE mic
- if(pattrib->encrypt)
- wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic);
-
- //WMM Parameter Set
- if(&pmlmeinfo->WMM_param)
- {
- _rtw_memcpy(wmm_param_ele, WMM_PARA_OUI, 6);
- _rtw_memcpy(wmm_param_ele+6, (u8 *)&pmlmeinfo->WMM_param, sizeof(pmlmeinfo->WMM_param));
- pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 24, wmm_param_ele, &(pattrib->pktlen));
- }
-
-}
-
-void rtw_build_tdls_teardown_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
-{
-
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- u8 payload_type = 0x02;
- unsigned char category = RTW_WLAN_CATEGORY_TDLS;
- u8 action = ptxmgmt->action_code;
- u8 link_id_addr[18] = {0};
- struct sta_info *ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst);
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, reason code
- 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, 2, (u8 *)&ptxmgmt->status_code, &(pattrib->pktlen));
-
- //Link identifier
- if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
- }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
- }
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
-}
-
-void rtw_build_tdls_dis_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
-{
-
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- u8 payload_type = 0x02;
- u8 category = RTW_WLAN_CATEGORY_TDLS;
- u8 action = TDLS_DISCOVERY_REQUEST;
- u8 link_id_addr[18] = {0};
- static u8 dialogtoken=0;
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, reason code
- pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
- pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
- if(ptxmgmt->external_support == _TRUE) {
- pframe = rtw_set_fixed_ie(pframe, 1, &(ptxmgmt->dialog_token), &(pattrib->pktlen));
- } else {
- pframe = rtw_set_fixed_ie(pframe, 1, &(dialogtoken), &(pattrib->pktlen));
- dialogtoken = (dialogtoken+1)%256;
- }
-
- //Link identifier
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
-}
-
-void rtw_build_tdls_dis_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog, u8 privacy)
-{
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- struct registry_priv *pregistrypriv = &padapter->registrypriv;
-
- u8 category = RTW_WLAN_CATEGORY_PUBLIC;
- u8 action = TDLS_DISCOVERY_RESPONSE;
- u8 bssrate[NDIS_802_11_LENGTH_RATES_EX];
- int bssrate_len = 0;
- u8 more_supportedrates = 0;
- u8 *p;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- u8 link_id_addr[18] = {0};
- u8 iedata=0;
- u8 timeout_itvl[5]; //set timeout interval to maximum value
- u32 timeout_interval= TPK_RESEND_COUNT * 1000;
- u8 *pframe_head, pktlen_index;
-
- pktlen_index = pattrib->pktlen; // For mgmt frame, pattrib->pktlen would count frame header
- pframe_head = pframe;
-
- //category, action, dialog token
- 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, &(dialog), &(pattrib->pktlen));
-
- //capability
- _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2);
-
- if(privacy)
- *pframe =*pframe | cap_Privacy;
- pframe += 2;
- pattrib->pktlen += 2;
-
- //supported rates
- rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N);
- bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN;
-
- if (bssrate_len > 8)
- {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
- more_supportedrates = 1;
- }
- else
- {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
- }
-
- //extended supported rates
- if(more_supportedrates==1){
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
- }
-
- //supported channels
- pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib);
-
- //RSNIE
- if(privacy)
- pframe = rtw_set_ie(pframe, _RSN_IE_2_, sizeof(TDLS_RSNIE), TDLS_RSNIE, &(pattrib->pktlen));
-
- //extended capability
- pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , sizeof(TDLS_EXT_CAPIE), TDLS_EXT_CAPIE, &(pattrib->pktlen));
-
- if(privacy){
- //FTIE
- _rtw_memset(pframe, 0, 84); //All fields shall be set to 0
- _rtw_memset(pframe, _FTIE_, 1); //version
- _rtw_memset((pframe+1), 82, 1); //length
- pframe += 84;
- pattrib->pktlen += 84;
-
- //Timeout interval
- timeout_itvl[0]=0x02;
- _rtw_memcpy(timeout_itvl+1, &timeout_interval, 4);
- pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
- }
-
- //Sup_reg_classes(optional)
- //HT capabilities
- pframe += rtw_tdls_set_ht_cap(padapter, pframe_head - pktlen_index, pattrib);
-
- //20/40 BSS coexistence
- if(pmlmepriv->num_FortyMHzIntolerant>0)
- iedata |= BIT(2);//20 MHz BSS Width Request
- pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
-
- //Link identifier
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
-}
-
-void rtw_build_tdls_peer_traffic_indication_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
-{
-
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- u8 payload_type = 0x02;
- unsigned char category = RTW_WLAN_CATEGORY_TDLS;
- unsigned char action = TDLS_PEER_TRAFFIC_INDICATION;
-
- u8 link_id_addr[18] = {0};
- u8 AC_queue=0;
- struct sta_info *ptdls_sta = rtw_get_stainfo(&padapter->stapriv, pattrib->dst);
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, reason code
- 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, &(ptdls_sta->dialog), &(pattrib->pktlen));
-
- //Link identifier
- if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
- }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
- }
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
- //PTI control
- //PU buffer status
- if(ptdls_sta->uapsd_bk&BIT(1))
- AC_queue=BIT(0);
- if(ptdls_sta->uapsd_be&BIT(1))
- AC_queue=BIT(1);
- if(ptdls_sta->uapsd_vi&BIT(1))
- AC_queue=BIT(2);
- if(ptdls_sta->uapsd_vo&BIT(1))
- AC_queue=BIT(3);
- pframe = rtw_set_ie(pframe, _PTI_BUFFER_STATUS_, 1, &AC_queue, &(pattrib->pktlen));
-
-}
-
-void rtw_build_tdls_peer_traffic_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
-{
-
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- u8 payload_type = 0x02;
- u8 category = RTW_WLAN_CATEGORY_TDLS;
- u8 action = TDLS_PEER_TRAFFIC_RESPONSE;
- u8 link_id_addr[18] = {0};
- struct sta_info *ptdls_sta = rtw_get_stainfo(&padapter->stapriv, pattrib->dst);
- static u8 dialogtoken=0;
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, reason code
- 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, &ptdls_sta->dialog, &(pattrib->pktlen));
-
- //Link identifier
- if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
- }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
- }
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
-}
-
-void rtw_build_tdls_ch_switch_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
-{
-
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- u8 payload_type = 0x02;
- unsigned char category = RTW_WLAN_CATEGORY_TDLS;
- unsigned char action = TDLS_CHANNEL_SWITCH_REQUEST;
- u8 link_id_addr[18] = {0};
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst);
- u8 ch_switch_timing[4] = {0};
- u16 switch_time= CH_SWITCH_TIME, switch_timeout=CH_SWITCH_TIMEOUT;
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, target_ch
- 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, &(ptdlsinfo->candidate_ch), &(pattrib->pktlen));
-
- //Link identifier
- if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
- }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
- }
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
- //ch switch timing
- _rtw_memcpy(ch_switch_timing, &switch_time, 2);
- _rtw_memcpy(ch_switch_timing+2, &switch_timeout, 2);
- pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen));
-
- //update ch switch attrib to sta_info
- ptdls_sta->off_ch=ptdlsinfo->candidate_ch;
- ptdls_sta->ch_switch_time=switch_time;
- ptdls_sta->ch_switch_timeout=switch_timeout;
-
-}
-
-void rtw_build_tdls_ch_switch_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
-{
-
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- u8 payload_type = 0x02;
- unsigned char category = RTW_WLAN_CATEGORY_TDLS;
- unsigned char action = TDLS_CHANNEL_SWITCH_RESPONSE;
- u8 link_id_addr[18] = {0};
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst);
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
- u8 ch_switch_timing[4] = {0};
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, action, status_code
- 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, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen));
-
- //Link identifier
- if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
- }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
- _rtw_memcpy(link_id_addr, pattrib->ra, 6);
- _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
- _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
- }
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
- //ch switch timing
- _rtw_memcpy(ch_switch_timing, &ptdls_sta->ch_switch_time, 2);
- _rtw_memcpy(ch_switch_timing+2, &ptdls_sta->ch_switch_timeout, 2);
- pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen));
-
-}
-
-#ifdef CONFIG_WFD
-void rtw_build_tunneled_probe_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
-{
-
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- struct wifidirect_info *pwdinfo = &padapter->wdinfo;
- struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo;
- u8 payload_type = 0x02;
- u8 category = RTW_WLAN_CATEGORY_P2P;
- u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a};
- u8 probe_req = 4;
- u8 wfdielen = 0;
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, OUI, frame_body_type
- pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
- pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen));
- pframe = rtw_set_fixed_ie(pframe, 1, &(probe_req), &(pattrib->pktlen));
-
- if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- wfdielen = build_probe_req_wfd_ie(pwdinfo, pframe);
- pframe += wfdielen;
- pattrib->pktlen += wfdielen;
- }
- else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE))
- {
- wfdielen = build_probe_req_wfd_ie(pbuddy_wdinfo, pframe);
- pframe += wfdielen;
- pattrib->pktlen += wfdielen;
- }
-
-}
-
-void rtw_build_tunneled_probe_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
-{
-
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
- struct wifidirect_info *pwdinfo = &padapter->wdinfo;
- struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo;
- u8 payload_type = 0x02;
- u8 category = RTW_WLAN_CATEGORY_P2P;
- u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a};
- u8 probe_rsp = 5;
- u8 wfdielen = 0;
-
- //payload type
- pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
- //category, OUI, frame_body_type
- pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
- pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen));
- pframe = rtw_set_fixed_ie(pframe, 1, &(probe_rsp), &(pattrib->pktlen));
-
- if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- wfdielen = build_probe_resp_wfd_ie(pwdinfo, pframe, 1);
- pframe += wfdielen;
- pattrib->pktlen += wfdielen;
- }
- else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE))
- {
- wfdielen = build_probe_resp_wfd_ie(pbuddy_wdinfo, pframe, 1);
- pframe += wfdielen;
- pattrib->pktlen += wfdielen;
- }
-
-}
-#endif //CONFIG_WFD
-
-void _tdls_tpk_timer_hdl(void *FunctionContext)
-{
- struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
- struct tdls_txmgmt txmgmt;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- ptdls_sta->TPK_count++;
- //TPK_timer set 1000 as default
- //retry timer should set at least 301 sec.
- if(ptdls_sta->TPK_count==TPK_RESEND_COUNT){
- ptdls_sta->TPK_count=0;
- _rtw_memcpy(txmgmt.peer, ptdls_sta->hwaddr, ETH_ALEN);
- issue_tdls_setup_req(ptdls_sta->padapter, &txmgmt, _FALSE);
- }
-
- _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT);
-}
-
-// TDLS_DONE_CH_SEN: channel sensing and report candidate channel
-// TDLS_OFF_CH: first time set channel to off channel
-// TDLS_BASE_CH: when go back to the channel linked with AP, send null data to peer STA as an indication
-void _tdls_ch_switch_timer_hdl(void *FunctionContext)
-{
-
- struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
- _adapter *padapter = ptdls_sta->padapter;
-
- if( ptdls_sta->option == TDLS_DONE_CH_SEN ){
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_DONE_CH_SEN);
- }else if( ptdls_sta->option == TDLS_OFF_CH ){
- issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta->hwaddr, 0, 0, 0);
- _set_timer(&ptdls_sta->base_ch_timer, 500);
- }else if( ptdls_sta->option == TDLS_BASE_CH){
- issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta->hwaddr, 0, 0, 0);
- }
-}
-
-void _tdls_base_ch_timer_hdl(void *FunctionContext)
-{
- struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
- rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_OFF_CH);
-}
-
-void _tdls_off_ch_timer_hdl(void *FunctionContext)
-{
- struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
- rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_BASE_CH );
-}
-
-void _tdls_handshake_timer_hdl(void *FunctionContext)
-{
- struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
-
- if(ptdls_sta != NULL)
- {
- if( !(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE) )
- {
- DBG_871X("tdls handshake time out\n");
- rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_TEAR_STA );
- }
- }
-}
-
-void _tdls_pti_timer_hdl(void *FunctionContext)
-{
- struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
- _adapter *padapter = ptdls_sta->padapter;
- struct tdls_txmgmt txmgmt;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- _rtw_memcpy(txmgmt.peer, ptdls_sta->hwaddr, ETH_ALEN);
- txmgmt.status_code = _RSON_TDLS_TEAR_TOOFAR_;
-
- if(ptdls_sta != NULL)
- {
- if( ptdls_sta->tdls_sta_state & TDLS_WAIT_PTR_STATE )
- {
- DBG_871X("Doesn't receive PTR from peer dev:"MAC_FMT"; Send TDLS Tear Down\n", MAC_ARG(ptdls_sta->hwaddr));
- issue_tdls_teardown(padapter, &txmgmt, _FALSE);
- }
- }
-}
-
-void rtw_init_tdls_timer(_adapter *padapter, struct sta_info *psta)
-{
- psta->padapter=padapter;
- _init_timer(&psta->TPK_timer, padapter->pnetdev, _tdls_tpk_timer_hdl, psta);
- _init_timer(&psta->option_timer, padapter->pnetdev, _tdls_ch_switch_timer_hdl, psta);
- _init_timer(&psta->base_ch_timer, padapter->pnetdev, _tdls_base_ch_timer_hdl, psta);
- _init_timer(&psta->off_ch_timer, padapter->pnetdev, _tdls_off_ch_timer_hdl, psta);
- _init_timer(&psta->handshake_timer, padapter->pnetdev, _tdls_handshake_timer_hdl, psta);
- _init_timer(&psta->pti_timer, padapter->pnetdev, _tdls_pti_timer_hdl, psta);
-}
-
-void rtw_free_tdls_timer(struct sta_info *psta)
-{
- _cancel_timer_ex(&psta->TPK_timer);
- _cancel_timer_ex(&psta->option_timer);
- _cancel_timer_ex(&psta->base_ch_timer);
- _cancel_timer_ex(&psta->off_ch_timer);
- _cancel_timer_ex(&psta->handshake_timer);
- _cancel_timer_ex(&psta->pti_timer);
-}
-
-u8 update_sgi_tdls(_adapter *padapter, struct sta_info *psta)
-{
- return query_ra_short_GI(psta);
-}
-
-u32 update_mask_tdls(_adapter *padapter, struct sta_info *psta)
-{
- unsigned char sta_band = 0;
- unsigned int tx_ra_bitmap=0;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
-
- rtw_hal_update_sta_rate_mask(padapter, psta);
- tx_ra_bitmap = psta->ra_mask;
-
- if ( pcur_network->Configuration.DSConfig > 14 ) {
- // 5G band
- if (tx_ra_bitmap & 0xffff000)
- sta_band |= WIRELESS_11_5N | WIRELESS_11A;
- else
- sta_band |= WIRELESS_11A;
- } else {
- if (tx_ra_bitmap & 0xffff000)
- sta_band |= WIRELESS_11_24N | WIRELESS_11G | WIRELESS_11B;
- else if (tx_ra_bitmap & 0xff0)
- sta_band |= WIRELESS_11G |WIRELESS_11B;
- else
- sta_band |= WIRELESS_11B;
- }
-
- psta->wireless_mode = sta_band;
-
- psta->raid = rtw_hal_networktype_to_raid(padapter,psta);
- tx_ra_bitmap |= ((psta->raid<<28)&0xf0000000);
- return tx_ra_bitmap;
-}
-
-#endif //CONFIG_TDLS
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTW_TDLS_C_
+
+#include <drv_types.h>
+
+#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)
+{
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+
+ ptdlsinfo->ap_prohibited = _FALSE;
+ ptdlsinfo->link_established = _FALSE;
+ ptdlsinfo->sta_cnt = 0;
+ ptdlsinfo->sta_maximum = _FALSE;
+ ptdlsinfo->ch_sensing = 0;
+ ptdlsinfo->cur_channel = 0;
+ ptdlsinfo->candidate_ch = 1; //when inplement channel switching, default candidate channel is 1
+ ptdlsinfo->watchdog_count = 0;
+ ptdlsinfo->dev_discovered = 0;
+
+#ifdef CONFIG_WFD
+ ptdlsinfo->wfd_info = &padapter->wfd_info;
+#endif //CONFIG_WFD
+}
+
+int rtw_init_tdls_info(_adapter* padapter)
+{
+ int res = _SUCCESS;
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+
+ ptdlsinfo->tdls_enable = _TRUE;
+ rtw_reset_tdls_info(padapter);
+
+ _rtw_spinlock_init(&ptdlsinfo->cmd_lock);
+ _rtw_spinlock_init(&ptdlsinfo->hdl_lock);
+
+ return res;
+
+}
+
+void rtw_free_tdls_info(struct tdls_info *ptdlsinfo)
+{
+ _rtw_spinlock_free(&ptdlsinfo->cmd_lock);
+ _rtw_spinlock_free(&ptdlsinfo->hdl_lock);
+
+ _rtw_memset(ptdlsinfo, 0, sizeof(struct tdls_info) );
+
+}
+
+int _issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsigned int power_mode, int wait_ack)
+{
+ int ret = _FAIL;
+ 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);
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ update_mgntframe_attrib(padapter, pattrib);
+ pattrib->retry_ctrl = _FALSE;
+
+ _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;
+
+ // SetToDs(fctrl);
+
+ if (power_mode)
+ {
+ SetPwrMgt(fctrl);
+ }
+
+ _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+
+ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
+ pmlmeext->mgnt_seq++;
+ SetFrameSubType(pframe, WIFI_DATA_NULL);
+
+ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
+ pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+
+ pattrib->last_txcmdsz = pattrib->pktlen;
+
+ if(wait_ack)
+ {
+ ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
+ }
+ else
+ {
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+ }
+
+exit:
+ return ret;
+
+}
+
+int issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms)
+{
+ int ret;
+ int i = 0;
+ u32 start = rtw_get_current_time();
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ //[TDLS] UAPSD : merge this from issue_nulldata() and mark it first.
+ #if 0
+ psta = rtw_get_stainfo(&padapter->stapriv, da);
+ if (psta) {
+ if (power_mode)
+ rtw_hal_macid_sleep(padapter, psta->mac_id);
+ else
+ rtw_hal_macid_wakeup(padapter, psta->mac_id);
+ } else {
+ DBG_871X(FUNC_ADPT_FMT ": Can't find sta info for " MAC_FMT ", skip macid %s!!\n",
+ FUNC_ADPT_ARG(padapter), MAC_ARG(da), power_mode?"sleep":"wakeup");
+ rtw_warn_on(1);
+ }
+ #endif
+
+ do
+ {
+ ret = _issue_nulldata_to_TDLS_peer_STA(padapter, da, power_mode, 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((i<try_cnt) && ((ret==_FAIL)||(wait_ms==0)));
+
+ if (ret != _FAIL) {
+ ret = _SUCCESS;
+ #ifndef DBG_XMIT_ACK
+ goto exit;
+ #endif
+ }
+
+ if (try_cnt && wait_ms) {
+ if (da)
+ DBG_871X(FUNC_ADPT_FMT" to "MAC_FMT", ch:%u%s, %d/%d in %u ms\n",
+ FUNC_ADPT_ARG(padapter), MAC_ARG(da), rtw_get_oper_ch(padapter),
+ ret==_SUCCESS?", acked":"", i, try_cnt, rtw_get_passing_time_ms(start));
+ else
+ DBG_871X(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n",
+ FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter),
+ ret==_SUCCESS?", acked":"", i, try_cnt, rtw_get_passing_time_ms(start));
+ }
+exit:
+ return ret;
+}
+
+void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta)
+{
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ _irqL irqL;
+
+ //free peer sta_info
+ _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+ if(ptdlsinfo->sta_cnt != 0)
+ ptdlsinfo->sta_cnt--;
+ _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
+ if( ptdlsinfo->sta_cnt < (NUM_STA - 2 - 4) ) // -2: AP + BC/MC sta, -4: default key
+ {
+ ptdlsinfo->sta_maximum = _FALSE;
+ _rtw_memset( &ptdlsinfo->ss_record, 0x00, sizeof(struct tdls_ss_record) );
+ }
+
+ //clear cam
+ rtw_clearstakey_cmd(padapter, ptdls_sta, _TRUE);
+
+ if(ptdlsinfo->sta_cnt==0){
+ rtw_tdls_cmd(padapter, myid(&(padapter->eeprompriv)), TDLS_RS_RCR);
+ ptdlsinfo->link_established = _FALSE;
+ }
+ else
+ DBG_871X("Remain tdls sta:%02x\n", ptdlsinfo->sta_cnt);
+
+ rtw_free_stainfo(padapter, ptdls_sta);
+
+}
+
+
+//TDLS encryption(if needed) will always be CCMP
+void rtw_tdls_set_key(_adapter *padapter, struct rx_pkt_attrib *prx_pkt_attrib, struct sta_info *ptdls_sta)
+{
+ if(prx_pkt_attrib->encrypt)
+ {
+ ptdls_sta->dot118021XPrivacy=_AES_;
+ rtw_setstakey_cmd(padapter, ptdls_sta, _TRUE, _TRUE);
+ }
+}
+
+void rtw_tdls_process_ht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8 *data, u8 Length)
+{
+ /* save HT capabilities in the sta object */
+ _rtw_memset(&ptdls_sta->htpriv.ht_cap, 0, sizeof(struct rtw_ieee80211_ht_cap));
+ if (data && Length >= sizeof(struct rtw_ieee80211_ht_cap) )
+ {
+ ptdls_sta->flags |= WLAN_STA_HT;
+
+ ptdls_sta->flags |= WLAN_STA_WME;
+
+ _rtw_memcpy(&ptdls_sta->htpriv.ht_cap, data, sizeof(struct rtw_ieee80211_ht_cap));
+
+ } else
+ ptdls_sta->flags &= ~WLAN_STA_HT;
+
+ if(ptdls_sta->flags & WLAN_STA_HT)
+ {
+ if(padapter->registrypriv.ht_enable == _TRUE)
+ {
+ ptdls_sta->htpriv.ht_option = _TRUE;
+ }
+ else
+ {
+ ptdls_sta->htpriv.ht_option = _FALSE;
+ ptdls_sta->stat_code = _STATS_FAILURE_;
+ }
+ }
+
+ //HT related cap
+ if(ptdls_sta->htpriv.ht_option)
+ {
+ //check if sta supports rx ampdu
+ if(padapter->registrypriv.ampdu_enable==1)
+ ptdls_sta->htpriv.ampdu_enable = _TRUE;
+
+ //check if sta support s Short GI 20M
+ if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_20))
+ {
+ ptdls_sta->htpriv.sgi_20m = _TRUE;
+ }
+ //check if sta support s Short GI 40M
+ if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_40))
+ {
+ ptdls_sta->htpriv.sgi_40m = _TRUE;
+ }
+
+ // bwmode would still followed AP's setting
+ if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH))
+ {
+ if (padapter->mlmeextpriv.cur_bwmode >= CHANNEL_WIDTH_40)
+ ptdls_sta->bw_mode = CHANNEL_WIDTH_40;
+ ptdls_sta->htpriv.ch_offset = padapter->mlmeextpriv.cur_ch_offset;
+ }
+ }
+
+}
+
+int rtw_tdls_set_ht_cap(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
+{
+ int tmplen;
+
+ rtw_ht_use_default_setting(padapter);
+
+ tmplen = pattrib->pktlen;
+ rtw_restructure_ht_ie(padapter, NULL, pframe, 0, &(pattrib->pktlen), padapter->mlmeextpriv.cur_channel);
+
+ return (pattrib->pktlen - tmplen);
+
+}
+
+u8 *rtw_tdls_set_sup_ch(struct mlme_ext_priv *pmlmeext, u8 *pframe, struct pkt_attrib *pattrib)
+{
+ u8 sup_ch[ 30 * 2 ] = { 0x00 }, ch_set_idx = 0; //For supported channel
+ u8 ch_24g = 0, b1 = 0, b4 = 0;
+ u8 bit_table = 0, sup_ch_idx = 0;
+
+ do{
+ if( pmlmeext->channel_set[ch_set_idx].ChannelNum >= 1 &&
+ pmlmeext->channel_set[ch_set_idx].ChannelNum <= 14 )
+ {
+ ch_24g = 1; // 2.4 G channels
+ }
+ else if( pmlmeext->channel_set[ch_set_idx].ChannelNum >= 36 &&
+ pmlmeext->channel_set[ch_set_idx].ChannelNum <= 48)
+ {
+ b1 = 1; // 5 G band1
+ }
+ else if( pmlmeext->channel_set[ch_set_idx].ChannelNum >= 149 &&
+ pmlmeext->channel_set[ch_set_idx].ChannelNum <= 165)
+ {
+ b4 = 1; // 5 G band4
+ }
+ else
+ {
+ ch_set_idx++; // We don't claim that we support DFS channels.
+ continue;
+ }
+
+ sup_ch_idx = (ch_24g + b1 + b4 - 1) * 2;
+ if( sup_ch_idx >= 0)
+ {
+ if(sup_ch[sup_ch_idx] == 0)
+ sup_ch[sup_ch_idx] = pmlmeext->channel_set[ch_set_idx].ChannelNum;
+ sup_ch[sup_ch_idx+1]++; //Number of channel
+ }
+
+ ch_set_idx++;
+ }
+ while( pmlmeext->channel_set[ch_set_idx].ChannelNum != 0 && ch_set_idx < MAX_CHANNEL_NUM );
+
+ return(rtw_set_ie(pframe, _SUPPORTED_CH_IE_, sup_ch_idx+2, sup_ch, &(pattrib->pktlen)));
+}
+
+#ifdef CONFIG_WFD
+void rtw_tdls_process_wfd_ie(struct tdls_info *ptdlsinfo, u8 *ptr, u8 length)
+{
+ u8 wfd_ie[ 128 ] = { 0x00 };
+ u32 wfd_ielen = 0;
+ u32 wfd_offset = 0;
+ // Try to get the TCP port information when receiving the negotiation response.
+ //
+
+ wfd_offset = 0;
+ wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen );
+ while( wfd_offset )
+ {
+ u8 attr_content[ 10 ] = { 0x00 };
+ u32 attr_contentlen = 0;
+ int i;
+
+ DBG_871X( "[%s] WFD IE Found!!\n", __FUNCTION__ );
+ rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen);
+ if ( attr_contentlen )
+ {
+ ptdlsinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16( attr_content + 2 );
+ DBG_871X( "[%s] Peer PORT NUM = %d\n", __FUNCTION__, ptdlsinfo->wfd_info->peer_rtsp_ctrlport );
+ }
+
+ _rtw_memset( attr_content, 0x00, 10);
+ attr_contentlen = 0;
+ rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_LOCAL_IP_ADDR, attr_content, &attr_contentlen);
+ if ( attr_contentlen )
+ {
+ _rtw_memcpy(ptdlsinfo->wfd_info->peer_ip_address, ( attr_content + 1 ), 4);
+ DBG_871X( "[%s] Peer IP = %02u.%02u.%02u.%02u \n", __FUNCTION__,
+ ptdlsinfo->wfd_info->peer_ip_address[0], ptdlsinfo->wfd_info->peer_ip_address[1],
+ ptdlsinfo->wfd_info->peer_ip_address[2], ptdlsinfo->wfd_info->peer_ip_address[3]
+ );
+ }
+ wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen );
+ }
+}
+
+int issue_tunneled_probe_req(_adapter *padapter)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ struct tdls_txmgmt txmgmt;
+ int ret = _FAIL;
+
+ DBG_871X("[%s]\n", __FUNCTION__);
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ txmgmt.action_code = TUNNELED_PROBE_REQ;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, baddr, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+ if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) != _SUCCESS) {
+ rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+exit:
+
+ return ret;
+}
+
+int issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct tdls_txmgmt txmgmt;
+ int ret = _FAIL;
+
+ DBG_871X("[%s]\n", __FUNCTION__);
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ txmgmt.action_code = TUNNELED_PROBE_RSP;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, precv_frame->u.hdr.attrib.src, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+ if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) != _SUCCESS) {
+ rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+exit:
+
+ return ret;
+}
+#endif //CONFIG_WFD
+
+int issue_tdls_setup_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, int wait_ack)
+{
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_info *ptdls_sta= NULL;
+ _irqL irqL;
+ static u8 dialogtoken = 0;
+ int ret = _FAIL;
+ u32 timeout_interval= TPK_RESEND_COUNT * 1000; //retry timer should set at least 301 sec, using TPK_count counting 301 times.
+
+ ptxmgmt->action_code = TDLS_SETUP_REQUEST;
+ if(ptdlsinfo->ap_prohibited == _TRUE)
+ goto exit;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+
+ //init peer sta_info
+ ptdls_sta = rtw_get_stainfo(pstapriv, ptxmgmt->peer);
+ if(ptdls_sta==NULL)
+ {
+ ptdls_sta = rtw_alloc_stainfo(pstapriv, ptxmgmt->peer);
+ if(ptdls_sta==NULL)
+ {
+ DBG_871X("[%s] rtw_alloc_stainfo fail\n", __FUNCTION__);
+ rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+ }
+
+ if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE))
+ ptdlsinfo->sta_cnt++;
+ if( ptdlsinfo->sta_cnt == (NUM_STA - 2 - 4) ) // -2: AP + BC/MC sta, -4: default key
+ {
+ ptdlsinfo->sta_maximum = _TRUE;
+ }
+
+ ptdls_sta->tdls_sta_state |= TDLS_RESPONDER_STATE;
+ //for tdls; ptdls_sta->aid is used to fill dialogtoken
+ ptdls_sta->dialog = dialogtoken;
+ dialogtoken = (dialogtoken+1)%256;
+ ptdls_sta->TDLS_PeerKey_Lifetime = timeout_interval;
+ _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME );
+
+ pattrib->qsel = pattrib->priority;
+
+ if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) !=_SUCCESS ){
+ rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+
+ if (wait_ack) {
+ ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
+ } else {
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+ }
+
+ ret = _SUCCESS;
+
+exit:
+
+ return ret;
+}
+
+int issue_tdls_teardown(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, u8 wait_ack)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_info *ptdls_sta=NULL;
+ _irqL irqL;
+ int ret = _FAIL;
+
+ ptxmgmt->action_code = TDLS_TEARDOWN;
+ ptdls_sta = rtw_get_stainfo(pstapriv, ptxmgmt->peer);
+ if(ptdls_sta==NULL){
+ DBG_871X("Np tdls_sta for tearing down\n");
+ goto exit;
+ }
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+ if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) != _SUCCESS) {
+ rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+
+ if (wait_ack) {
+ ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
+ } else {
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+ }
+
+ if(ret == _SUCCESS)
+ {
+ if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
+ }
+
+ if( ptdls_sta->timer_flag == 1 )
+ {
+ _enter_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL);
+ ptdls_sta->timer_flag = 2;
+ _exit_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL);
+ }
+ else
+ rtw_tdls_cmd(padapter, ptxmgmt->peer, TDLS_TEAR_STA );
+ }
+
+exit:
+
+ return ret;
+}
+
+int issue_tdls_dis_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ int ret = _FAIL;
+
+ ptxmgmt->action_code = TDLS_DISCOVERY_REQUEST;
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+ if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) != _SUCCESS) {
+ rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+ dump_mgntframe(padapter, pmgntframe);
+ DBG_871X("issue tdls dis req\n");
+
+ ret = _SUCCESS;
+exit:
+
+ return ret;
+}
+
+int issue_tdls_setup_rsp(_adapter *padapter, struct tdls_txmgmt *ptxmgmt)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ int ret = _FAIL;
+
+ ptxmgmt->action_code = TDLS_SETUP_RESPONSE;
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(&(padapter->mlmepriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+ if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) != _SUCCESS) {
+ rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+
+ dump_mgntframe(padapter, pmgntframe);
+
+ ret = _SUCCESS;
+exit:
+
+ return ret;
+
+}
+
+int issue_tdls_setup_cfm(_adapter *padapter, struct tdls_txmgmt *ptxmgmt)
+{
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ int ret = _FAIL;
+
+ ptxmgmt->action_code = TDLS_SETUP_CONFIRM;
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&padapter->eeprompriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(&padapter->mlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+ if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) != _SUCCESS) {
+ rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+
+ dump_mgntframe(padapter, pmgntframe);
+
+ ret = _SUCCESS;
+exit:
+
+ return ret;
+
+}
+
+//TDLS Discovery Response frame is a management action frame
+int issue_tdls_dis_rsp(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, u8 privacy)
+{
+ 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);
+ int ret = _FAIL;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //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;
+
+ // unicast probe request frame
+ _rtw_memcpy(pwlanhdr->addr1, ptxmgmt->peer, ETH_ALEN);
+ _rtw_memcpy(pattrib->dst, pwlanhdr->addr1, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->src, pwlanhdr->addr2, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, get_bssid(&padapter->mlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, pwlanhdr->addr3, ETH_ALEN);
+
+ 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);
+
+ rtw_build_tdls_dis_rsp_ies(padapter, pmgntframe, pframe, ptxmgmt->dialog_token, privacy);
+
+ pattrib->nr_frags = 1;
+ pattrib->last_txcmdsz = pattrib->pktlen;
+
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+
+exit:
+ return ret;
+}
+
+int issue_tdls_peer_traffic_rsp(_adapter *padapter, struct sta_info *ptdls_sta)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct tdls_txmgmt txmgmt;
+ int ret = _FAIL;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ txmgmt.action_code = TDLS_PEER_TRAFFIC_RESPONSE;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, ptdls_sta->hwaddr, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+
+ if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) !=_SUCCESS ){
+ rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+
+exit:
+
+ return ret;
+}
+
+int issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *ptdls_sta)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct tdls_txmgmt txmgmt;
+ int ret = _FAIL;
+ static u8 dialogtoken=0;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ txmgmt.action_code = TDLS_PEER_TRAFFIC_INDICATION;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, ptdls_sta->hwaddr, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ //for tdls; pattrib->nr_frags is used to fill dialogtoken
+ ptdls_sta->dialog = dialogtoken;
+ dialogtoken = (dialogtoken+1)%256;
+ //PTI frame's priority should be AC_VO
+ pattrib->priority = 7;
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+ if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) != _SUCCESS) {
+ rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+
+exit:
+
+ return ret;
+}
+
+int issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct tdls_txmgmt txmgmt;
+ int ret = _FAIL;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ txmgmt.action_code = TDLS_CHANNEL_SWITCH_REQUEST;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+ if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) !=_SUCCESS ){
+ rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+exit:
+
+ return ret;
+}
+
+int issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct tdls_txmgmt txmgmt;
+ int ret = _FAIL;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ txmgmt.action_code = TDLS_CHANNEL_SWITCH_RESPONSE;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+
+ pmgntframe->frame_tag = DATA_FRAMETAG;
+ pattrib->ether_type = 0x890d;
+
+ _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
+ _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
+ _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
+
+ update_tdls_attrib(padapter, pattrib);
+ pattrib->qsel = pattrib->priority;
+/*
+ _enter_critical_bh(&pxmitpriv->lock, &irqL);
+ if(xmitframe_enqueue_for_tdls_sleeping_sta(padapter, pmgntframe)==_TRUE){
+ _exit_critical_bh(&pxmitpriv->lock, &irqL);
+ return _FALSE;
+ }
+*/
+ if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) !=_SUCCESS ){
+ rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
+ rtw_free_xmitframe(pxmitpriv, pmgntframe);
+ goto exit;
+ }
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
+exit:
+
+ return ret;
+}
+
+int On_TDLS_Dis_Rsp(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct sta_info *ptdls_sta = NULL, *psta = rtw_get_stainfo(&(padapter->stapriv), get_bssid(&(padapter->mlmepriv)));
+ struct recv_priv *precvpriv = &(padapter->recvpriv);
+ u8 *ptr = precv_frame->u.hdr.rx_data, *psa;
+ struct rx_pkt_attrib *pattrib = &(precv_frame->u.hdr.attrib);
+ struct tdls_info *ptdlsinfo = &(padapter->tdlsinfo);
+ u8 empty_addr[ETH_ALEN] = { 0x00 };
+ int UndecoratedSmoothedPWDB;
+ struct tdls_txmgmt txmgmt;
+ int ret = _SUCCESS;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ //WFDTDLS: for sigma test, not to setup direct link automatically
+ ptdlsinfo->dev_discovered = 1;
+
+#ifdef CONFIG_TDLS_AUTOSETUP
+ psa = get_sa(ptr);
+ ptdls_sta = rtw_get_stainfo(&(padapter->stapriv), psa);
+
+ if(ptdls_sta != NULL)
+ {
+ ptdls_sta->tdls_sta_state |= TDLS_ALIVE_STATE;
+
+ //Record the tdls sta with lowest signal strength
+ if( (ptdlsinfo->sta_maximum == _TRUE) && (ptdls_sta->alive_count >= 1) )
+ {
+ if( _rtw_memcmp(ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN) )
+ {
+ _rtw_memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN);
+ ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll;
+ }
+ else
+ {
+ if( ptdlsinfo->ss_record.RxPWDBAll < pattrib->RxPWDBAll )
+ {
+ _rtw_memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN);
+ ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll;
+ }
+ }
+ }
+
+ }
+ else
+ {
+ if( ptdlsinfo->sta_maximum == _TRUE)
+ {
+ if( _rtw_memcmp( ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN ) )
+ {
+ //All traffics are busy, do not set up another direct link.
+ ret = _FAIL;
+ goto exit;
+ }
+ else
+ {
+ if( pattrib->RxPWDBAll > ptdlsinfo->ss_record.RxPWDBAll )
+ {
+ _rtw_memcpy(txmgmt.peer, ptdlsinfo->ss_record.macaddr, ETH_ALEN);
+ //issue_tdls_teardown(padapter, ptdlsinfo->ss_record.macaddr, _FALSE);
+ }
+ else
+ {
+ ret = _FAIL;
+ goto exit;
+ }
+ }
+ }
+
+ padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
+
+ if( pattrib->RxPWDBAll + TDLS_SIGNAL_THRESH >= UndecoratedSmoothedPWDB);
+ {
+ DBG_871X("pattrib->RxPWDBAll=%d, pdmpriv->UndecoratedSmoothedPWDB=%d\n", pattrib->RxPWDBAll, UndecoratedSmoothedPWDB);
+ _rtw_memcpy(txmgmt.peer, psa, ETH_ALEN);
+ issue_tdls_setup_req(padapter, &txmgmt, _FALSE);
+ }
+ }
+#endif //CONFIG_TDLS_AUTOSETUP
+
+exit:
+ return ret;
+
+}
+
+sint On_TDLS_Setup_Req(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+ u8 *psa, *pmyid;
+ struct sta_info *ptdls_sta= NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+ _irqL irqL;
+ struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
+ u8 *prsnie, *ppairwise_cipher;
+ u8 i, k;
+ u8 ccmp_included=0, rsnie_included=0;
+ u16 j, pairwise_count;
+ u8 SNonce[32];
+ u32 *timeout_interval=NULL;
+ sint parsing_length; //frame body length, without icv_len
+ PNDIS_802_11_VARIABLE_IEs pIE;
+ u8 FIXED_IE = 5;
+ unsigned char supportRate[16];
+ int supportRateNum = 0;
+ struct tdls_txmgmt txmgmt;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ psa = get_sa(ptr);
+ ptdls_sta = rtw_get_stainfo(pstapriv, psa);
+
+ pmyid=myid(&(padapter->eeprompriv));
+ ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
+ parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
+ -prx_pkt_attrib->hdrlen
+ -prx_pkt_attrib->iv_len
+ -prx_pkt_attrib->icv_len
+ -LLC_HEADER_SIZE
+ -ETH_TYPE_LEN
+ -PAYLOAD_TYPE_LEN
+ -FIXED_IE;
+
+ if(ptdlsinfo->ap_prohibited == _TRUE)
+ {
+ goto exit;
+ }
+
+ if(ptdls_sta==NULL){
+ ptdls_sta = rtw_alloc_stainfo(pstapriv, psa);
+ }else{
+ if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){
+ //If the direct link is already set up
+ //Process as re-setup after tear down
+ DBG_871X("re-setup a direct link\n");
+ }
+ //already receiving TDLS setup request
+ else if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
+ DBG_871X("receive duplicated TDLS setup request frame in handshaking\n");
+ goto exit;
+ }
+ //When receiving and sending setup_req to the same link at the same time, STA with higher MAC_addr would be initiator
+ //following is to check out MAC_addr
+ else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
+ DBG_871X("receive setup_req after sending setup_req\n");
+ for (i=0;i<6;i++){
+ if(*(pmyid+i)==*(psa+i)){
+ }
+ else if(*(pmyid+i)>*(psa+i)){
+ ptdls_sta->tdls_sta_state=TDLS_INITIATOR_STATE;
+ break;
+ }else if(*(pmyid+i)<*(psa+i)){
+ goto exit;
+ }
+ }
+ }
+ }
+
+ if(ptdls_sta)
+ {
+ ptdls_sta->dialog = *(ptr+2); //copy dialog token
+ ptdls_sta->stat_code = 0;
+
+ //parsing information element
+ for(j=FIXED_IE; j<parsing_length;){
+
+ pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
+
+ switch (pIE->ElementID)
+ {
+ case _SUPPORTEDRATES_IE_:
+ _rtw_memcpy(supportRate, pIE->data, pIE->Length);
+ supportRateNum = pIE->Length;
+ break;
+ case _COUNTRY_IE_:
+ break;
+ case _EXT_SUPPORTEDRATES_IE_:
+ if(supportRateNum<=sizeof(supportRate))
+ {
+ _rtw_memcpy(supportRate+supportRateNum, pIE->data, pIE->Length);
+ supportRateNum += pIE->Length;
+ }
+ break;
+ case _SUPPORTED_CH_IE_:
+ break;
+ case _RSN_IE_2_:
+ rsnie_included=1;
+ if(prx_pkt_attrib->encrypt){
+ prsnie=(u8*)pIE;
+ //check whether initiator STA has CCMP pairwise_cipher.
+ ppairwise_cipher=prsnie+10;
+ _rtw_memcpy(ptdls_sta->TDLS_RSNIE, pIE->data, pIE->Length);
+ pairwise_count = *(u16*)(ppairwise_cipher-2);
+ for(k=0;k<pairwise_count;k++){
+ if(_rtw_memcmp( ppairwise_cipher+4*k, RSN_CIPHER_SUITE_CCMP, 4)==_TRUE)
+ ccmp_included=1;
+ }
+ if(ccmp_included==0){
+ //invalid contents of RSNIE
+ ptdls_sta->stat_code=72;
+ }
+ }
+ break;
+ case _EXT_CAP_IE_:
+ break;
+ case _VENDOR_SPECIFIC_IE_:
+ break;
+ case _FTIE_:
+ if(prx_pkt_attrib->encrypt)
+ _rtw_memcpy(SNonce, (ptr+j+52), 32);
+ break;
+ case _TIMEOUT_ITVL_IE_:
+ if(prx_pkt_attrib->encrypt)
+ timeout_interval = (u32 *)(ptr+j+3);
+ break;
+ case _RIC_Descriptor_IE_:
+ break;
+ case _HT_CAPABILITY_IE_:
+ rtw_tdls_process_ht_cap(padapter, ptdls_sta, pIE->data, pIE->Length);
+ break;
+ case EID_BSSCoexistence:
+ break;
+ case _LINK_ID_IE_:
+ if(_rtw_memcmp(get_bssid(pmlmepriv), pIE->data, 6) == _FALSE)
+ {
+ //not in the same BSS
+ ptdls_sta->stat_code=7;
+ }
+ break;
+ default:
+ break;
+ }
+
+ j += (pIE->Length + 2);
+
+ }
+
+ //check status code
+ //if responder STA has/hasn't security on AP, but request hasn't/has RSNIE, it should reject
+ if(ptdls_sta->stat_code == 0 )
+ {
+ if(rsnie_included && (prx_pkt_attrib->encrypt==0)){
+ //security disabled
+ ptdls_sta->stat_code = 5;
+ }else if(rsnie_included==0 && (prx_pkt_attrib->encrypt)){
+ //request haven't RSNIE
+ ptdls_sta->stat_code = 38;
+ }
+
+#ifdef CONFIG_WFD
+ //WFD test plan version 0.18.2 test item 5.1.5
+ //SoUT does not use TDLS if AP uses weak security
+ if ( padapter->wdinfo.wfd_tdls_enable )
+ {
+ if(rsnie_included && (prx_pkt_attrib->encrypt != _AES_))
+ {
+ ptdls_sta->stat_code = 5;
+ }
+ }
+#endif //CONFIG_WFD
+ }
+
+ ptdls_sta->tdls_sta_state|= TDLS_INITIATOR_STATE;
+ if(prx_pkt_attrib->encrypt){
+ _rtw_memcpy(ptdls_sta->SNonce, SNonce, 32);
+ _rtw_memcpy(&(ptdls_sta->TDLS_PeerKey_Lifetime), timeout_interval, 4);
+ }
+
+ //update station supportRate
+ ptdls_sta->bssratelen = supportRateNum;
+ _rtw_memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum);
+
+ if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE))
+ ptdlsinfo->sta_cnt++;
+ if( ptdlsinfo->sta_cnt == (NUM_STA - 2 - 4) ) // -2: AP + BC/MC sta, -4: default key
+ {
+ ptdlsinfo->sta_maximum = _TRUE;
+ }
+
+#ifdef CONFIG_WFD
+ rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE);
+#endif // CONFIG_WFD
+
+ }
+ else
+ {
+ goto exit;
+ }
+
+ _rtw_memcpy(txmgmt.peer, prx_pkt_attrib->src, ETH_ALEN);
+ issue_tdls_setup_rsp(padapter, &txmgmt);
+
+ if(ptdls_sta->stat_code==0)
+ {
+ _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME);
+ }
+ else //status code!=0 ; setup unsuccess
+ {
+ free_tdls_sta(padapter, ptdls_sta);
+ }
+
+exit:
+
+ return _SUCCESS;
+}
+
+int On_TDLS_Setup_Rsp(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+ struct sta_info *ptdls_sta= NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+ _irqL irqL;
+ struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
+ u8 *psa;
+ u16 stat_code;
+ sint parsing_length; //frame body length, without icv_len
+ PNDIS_802_11_VARIABLE_IEs pIE;
+ u8 FIXED_IE =7;
+ u8 ANonce[32];
+ u8 *pftie=NULL, *ptimeout_ie=NULL, *plinkid_ie=NULL, *prsnie=NULL, *pftie_mic=NULL, *ppairwise_cipher=NULL;
+ u16 pairwise_count, j, k;
+ u8 verify_ccmp=0;
+ unsigned char supportRate[16];
+ int supportRateNum = 0;
+ struct tdls_txmgmt txmgmt;
+ int ret = _SUCCESS;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ psa = get_sa(ptr);
+ ptdls_sta = rtw_get_stainfo(pstapriv, psa);
+
+ if ( NULL == ptdls_sta )
+ {
+ ret = _FAIL;
+ goto exit;
+ }
+
+ ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
+ parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
+ -prx_pkt_attrib->hdrlen
+ -prx_pkt_attrib->iv_len
+ -prx_pkt_attrib->icv_len
+ -LLC_HEADER_SIZE
+ -TYPE_LENGTH_FIELD_SIZE
+ -1
+ -FIXED_IE;
+
+ _rtw_memcpy(&stat_code, ptr+2, 2);
+
+ if(stat_code!=0)
+ {
+ DBG_871X( "[%s] status_code = %d, free_tdls_sta\n", __FUNCTION__, stat_code );
+ free_tdls_sta(padapter, ptdls_sta);
+ ret = _FAIL;
+ goto exit;
+ }
+
+ stat_code = 0;
+
+ //parsing information element
+ for(j=FIXED_IE; j<parsing_length;)
+ {
+ pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
+
+ switch (pIE->ElementID)
+ {
+ case _SUPPORTEDRATES_IE_:
+ _rtw_memcpy(supportRate, pIE->data, pIE->Length);
+ supportRateNum = pIE->Length;
+ break;
+ case _COUNTRY_IE_:
+ break;
+ case _EXT_SUPPORTEDRATES_IE_:
+ if(supportRateNum<=sizeof(supportRate))
+ {
+ _rtw_memcpy(supportRate+supportRateNum, pIE->data, pIE->Length);
+ supportRateNum += pIE->Length;
+ }
+ break;
+ case _SUPPORTED_CH_IE_:
+ break;
+ case _RSN_IE_2_:
+ prsnie=(u8*)pIE;
+ //check whether responder STA has CCMP pairwise_cipher.
+ ppairwise_cipher=prsnie+10;
+ _rtw_memcpy(&pairwise_count, (u16*)(ppairwise_cipher-2), 2);
+ for(k=0;k<pairwise_count;k++){
+ if(_rtw_memcmp( ppairwise_cipher+4*k, RSN_CIPHER_SUITE_CCMP, 4)==_TRUE)
+ verify_ccmp=1;
+ }
+ case _EXT_CAP_IE_:
+ break;
+ case _VENDOR_SPECIFIC_IE_:
+ break;
+ case _FTIE_:
+ pftie=(u8*)pIE;
+ //_rtw_memcpy(ptdls_sta->ANonce, (ptr+j+20), 32);
+ _rtw_memcpy(ANonce, (ptr+j+20), 32);
+ break;
+ case _TIMEOUT_ITVL_IE_:
+ ptimeout_ie=(u8*)pIE;
+ break;
+ case _RIC_Descriptor_IE_:
+ break;
+ case _HT_CAPABILITY_IE_:
+ rtw_tdls_process_ht_cap(padapter, ptdls_sta, pIE->data, pIE->Length);
+ break;
+ case EID_BSSCoexistence:
+ break;
+ case _LINK_ID_IE_:
+ plinkid_ie=(u8*)pIE;
+ break;
+ default:
+ break;
+ }
+
+ j += (pIE->Length + 2);
+
+ }
+
+ //update station's supportRate
+ ptdls_sta->bssratelen = supportRateNum;
+ _rtw_memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum);
+
+ _rtw_memcpy(ptdls_sta->ANonce, ANonce, 32);
+
+#ifdef CONFIG_WFD
+ rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE);
+#endif // CONFIG_WFD
+
+ if(stat_code != 0)
+ {
+ ptdls_sta->stat_code = stat_code;
+ }
+ else
+ {
+ if(prx_pkt_attrib->encrypt)
+ {
+ if(verify_ccmp==1)
+ {
+ wpa_tdls_generate_tpk(padapter, ptdls_sta);
+ ptdls_sta->stat_code=0;
+ if(tdls_verify_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie)==0) //0: Invalid, 1: valid
+ {
+ free_tdls_sta(padapter, ptdls_sta);
+ ret = _FAIL;
+ goto exit;
+ }
+ }
+ else
+ {
+ ptdls_sta->stat_code=72; //invalide contents of RSNIE
+ }
+
+ }else{
+ ptdls_sta->stat_code=0;
+ }
+ }
+
+ DBG_871X("issue_tdls_setup_cfm\n");
+ _rtw_memcpy(txmgmt.peer, prx_pkt_attrib->src, ETH_ALEN);
+ issue_tdls_setup_cfm(padapter, &txmgmt);
+
+ if(ptdls_sta->stat_code==0)
+ {
+ ptdlsinfo->link_established = _TRUE;
+
+ if( ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE )
+ {
+ ptdls_sta->tdls_sta_state |= TDLS_LINKED_STATE;
+ _cancel_timer_ex( &ptdls_sta->handshake_timer);
+ }
+
+ rtw_tdls_set_key(padapter, prx_pkt_attrib, ptdls_sta);
+
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_ESTABLISHED);
+
+ }
+
+exit:
+ return ret;
+
+}
+
+int On_TDLS_Setup_Cfm(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+ struct sta_info *ptdls_sta= NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+ _irqL irqL;
+ struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
+ u8 *psa;
+ u16 stat_code;
+ sint parsing_length;
+ PNDIS_802_11_VARIABLE_IEs pIE;
+ u8 FIXED_IE =5;
+ u8 *pftie=NULL, *ptimeout_ie=NULL, *plinkid_ie=NULL, *prsnie=NULL, *pftie_mic=NULL, *ppairwise_cipher=NULL;
+ u16 j, pairwise_count;
+ int ret = _SUCCESS;
+
+ psa = get_sa(ptr);
+ ptdls_sta = rtw_get_stainfo(pstapriv, psa);
+
+ if(ptdls_sta == NULL)
+ {
+ DBG_871X( "[%s] Direct Link Peer = "MAC_FMT" not found\n", __FUNCTION__, MAC_ARG(psa) );
+ ret = _FAIL;
+ goto exit;
+ }
+
+ ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
+ parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
+ -prx_pkt_attrib->hdrlen
+ -prx_pkt_attrib->iv_len
+ -prx_pkt_attrib->icv_len
+ -LLC_HEADER_SIZE
+ -ETH_TYPE_LEN
+ -PAYLOAD_TYPE_LEN
+ -FIXED_IE;
+ _rtw_memcpy(&stat_code, ptr+2, 2);
+
+ if(stat_code!=0){
+ DBG_871X( "[%s] stat_code = %d\n, free_tdls_sta", __FUNCTION__, stat_code );
+ free_tdls_sta(padapter, ptdls_sta);
+ ret = _FAIL;
+ goto exit;
+ }
+
+ if(prx_pkt_attrib->encrypt){
+ //parsing information element
+ for(j=FIXED_IE; j<parsing_length;){
+
+ pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
+
+ switch (pIE->ElementID)
+ {
+ case _RSN_IE_2_:
+ prsnie=(u8*)pIE;
+ break;
+ case _VENDOR_SPECIFIC_IE_:
+ break;
+ case _FTIE_:
+ pftie=(u8*)pIE;
+ break;
+ case _TIMEOUT_ITVL_IE_:
+ ptimeout_ie=(u8*)pIE;
+ break;
+ case _HT_EXTRA_INFO_IE_:
+ break;
+ case _LINK_ID_IE_:
+ plinkid_ie=(u8*)pIE;
+ break;
+ default:
+ break;
+ }
+
+ j += (pIE->Length + 2);
+
+ }
+
+ //verify mic in FTIE MIC field
+ if(tdls_verify_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie)==0){ //0: Invalid, 1: Valid
+ free_tdls_sta(padapter, ptdls_sta);
+ ret = _FAIL;
+ goto exit;
+ }
+
+ }
+
+ ptdlsinfo->link_established = _TRUE;
+ if( ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE )
+ {
+ ptdls_sta->tdls_sta_state|=TDLS_LINKED_STATE;
+ _cancel_timer_ex( &ptdls_sta->handshake_timer);
+ }
+
+ rtw_tdls_set_key(padapter, prx_pkt_attrib, ptdls_sta);
+
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_ESTABLISHED);
+
+exit:
+ return ret;
+
+}
+
+int On_TDLS_Dis_Req(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_info *psta_ap;
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+ sint parsing_length; //frame body length, without icv_len
+ PNDIS_802_11_VARIABLE_IEs pIE;
+ u8 FIXED_IE = 3, *dst;
+ u16 j;
+ struct tdls_txmgmt txmgmt;
+ int ret = _SUCCESS;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len + LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE + 1;
+ txmgmt.dialog_token = *(ptr+2);
+ _rtw_memcpy(&txmgmt.peer, precv_frame->u.hdr.attrib.src, ETH_ALEN);
+ txmgmt.action_code = TDLS_DISCOVERY_RESPONSE;
+ parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
+ -prx_pkt_attrib->hdrlen
+ -prx_pkt_attrib->iv_len
+ -prx_pkt_attrib->icv_len
+ -LLC_HEADER_SIZE
+ -TYPE_LENGTH_FIELD_SIZE
+ -1
+ -FIXED_IE;
+
+ //parsing information element
+ for(j=FIXED_IE; j<parsing_length;){
+
+ pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
+
+ switch (pIE->ElementID)
+ {
+ case _LINK_ID_IE_:
+ psta_ap = rtw_get_stainfo(pstapriv, pIE->data);
+ if(psta_ap == NULL)
+ {
+ goto exit;
+ }
+ dst = pIE->data + 12;
+ if( (MacAddr_isBcst(dst) == _FALSE) && (_rtw_memcmp(myid(&(padapter->eeprompriv)), dst, 6) == _FALSE) )
+ {
+ goto exit;
+ }
+ break;
+ default:
+ break;
+ }
+
+ j += (pIE->Length + 2);
+
+ }
+
+ issue_tdls_dis_rsp(padapter, &txmgmt, prx_pkt_attrib->privacy);
+
+exit:
+ return ret;
+
+}
+
+int On_TDLS_Teardown(_adapter *padapter, union recv_frame *precv_frame)
+{
+ u8 *psa;
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+ struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_info *ptdls_sta= NULL;
+ _irqL irqL;
+
+ psa = get_sa(ptr);
+
+ ptdls_sta = rtw_get_stainfo(pstapriv, psa);
+ if(ptdls_sta!=NULL){
+ if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
+ }
+ free_tdls_sta(padapter, ptdls_sta);
+ }
+
+ return _SUCCESS;
+
+}
+
+u8 TDLS_check_ch_state(uint state){
+ if( (state & TDLS_CH_SWITCH_ON_STATE) &&
+ (state & TDLS_AT_OFF_CH_STATE) &&
+ (state & TDLS_PEER_AT_OFF_STATE) ){
+
+ if(state & TDLS_PEER_SLEEP_STATE)
+ return 2; //U-APSD + ch. switch
+ else
+ return 1; //ch. switch
+ }else
+ return 0;
+}
+
+int On_TDLS_Peer_Traffic_Indication(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
+ struct sta_info *ptdls_sta = rtw_get_stainfo(&padapter->stapriv, pattrib->src);
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+
+ ptr +=pattrib->hdrlen + pattrib->iv_len + LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE + 1;
+
+ if(ptdls_sta != NULL)
+ {
+ ptdls_sta->dialog = *(ptr+2);
+ issue_tdls_peer_traffic_rsp(padapter, ptdls_sta);
+
+ //issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta->hwaddr, 0, 0, 0);
+ }
+ else
+ {
+ DBG_871X("from unknown sta:"MAC_FMT"\n", MAC_ARG(pattrib->src));
+ return _FAIL;
+ }
+
+ return _SUCCESS;
+}
+
+//we process buffered data for 1. U-APSD, 2. ch. switch, 3. U-APSD + ch. switch here
+int On_TDLS_Peer_Traffic_Rsp(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ //get peer sta infomation
+ struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->src);
+ u8 wmmps_ac=0, state=TDLS_check_ch_state(ptdls_sta->tdls_sta_state);
+ int i;
+
+ ptdls_sta->sta_stats.rx_data_pkts++;
+
+ ptdls_sta->tdls_sta_state &= ~(TDLS_WAIT_PTR_STATE);
+
+ //receive peer traffic response frame, sleeping STA wakes up
+ //ptdls_sta->tdls_sta_state &= ~(TDLS_PEER_SLEEP_STATE);
+ //process_wmmps_data( padapter, precv_frame);
+
+ // if noticed peer STA wakes up by receiving peer traffic response
+ // and we want to do channel swtiching, then we will transmit channel switch request first
+ if(ptdls_sta->tdls_sta_state & TDLS_APSD_CHSW_STATE){
+ issue_tdls_ch_switch_req(padapter, pattrib->src);
+ ptdls_sta->tdls_sta_state &= ~(TDLS_APSD_CHSW_STATE);
+ return _SUCCESS;
+ }
+
+ //check 4-AC queue bit
+ if(ptdls_sta->uapsd_vo || ptdls_sta->uapsd_vi || ptdls_sta->uapsd_be || ptdls_sta->uapsd_bk)
+ wmmps_ac=1;
+
+ //if it's a direct link and have buffered frame
+ if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){
+ //[TDLS] UAPSD
+ //if(wmmps_ac && state)
+ if(wmmps_ac && 1)
+ {
+ _irqL irqL;
+ _list *xmitframe_plist, *xmitframe_phead;
+ struct xmit_frame *pxmitframe=NULL;
+
+ _enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL);
+
+ xmitframe_phead = get_list_head(&ptdls_sta->sleep_q);
+ xmitframe_plist = get_next(xmitframe_phead);
+
+ //transmit buffered frames
+ while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE)
+ {
+ pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list);
+ xmitframe_plist = get_next(xmitframe_plist);
+ rtw_list_delete(&pxmitframe->list);
+
+ ptdls_sta->sleepq_len--;
+ ptdls_sta->sleepq_ac_len--;
+ if(ptdls_sta->sleepq_len>0){
+ pxmitframe->attrib.mdata = 1;
+ pxmitframe->attrib.eosp = 0;
+ }else{
+ pxmitframe->attrib.mdata = 0;
+ pxmitframe->attrib.eosp = 1;
+ }
+ pxmitframe->attrib.triggered = 1;
+
+ rtw_hal_xmitframe_enqueue(padapter, pxmitframe);
+
+
+ }
+
+ if(ptdls_sta->sleepq_len==0)
+ {
+ DBG_871X("no buffered packets for tdls to xmit\n");
+ //on U-APSD + CH. switch state, when there is no buffered date to xmit,
+ // we should go back to base channel
+ if(state==2){
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
+ }else if(ptdls_sta->tdls_sta_state&TDLS_SW_OFF_STATE){
+ ptdls_sta->tdls_sta_state &= ~(TDLS_SW_OFF_STATE);
+ ptdlsinfo->candidate_ch= pmlmeext->cur_channel;
+ issue_tdls_ch_switch_req(padapter, pattrib->src);
+ DBG_871X("issue tdls ch switch req back to base channel\n");
+ }
+
+ }
+ else
+ {
+ DBG_871X("error!psta->sleepq_len=%d\n", ptdls_sta->sleepq_len);
+ ptdls_sta->sleepq_len=0;
+ }
+
+ _exit_critical_bh(&ptdls_sta->sleep_q.lock, &irqL);
+
+ }
+
+ }
+
+ return _SUCCESS;
+}
+
+sint On_TDLS_Ch_Switch_Req(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct sta_info *ptdls_sta= NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+ struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
+ u8 *psa;
+ sint parsing_length;
+ PNDIS_802_11_VARIABLE_IEs pIE;
+ u8 FIXED_IE =3;
+ u16 j;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+
+ psa = get_sa(ptr);
+ ptdls_sta = rtw_get_stainfo(pstapriv, psa);
+
+ ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
+ parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
+ -prx_pkt_attrib->hdrlen
+ -prx_pkt_attrib->iv_len
+ -prx_pkt_attrib->icv_len
+ -LLC_HEADER_SIZE
+ -ETH_TYPE_LEN
+ -PAYLOAD_TYPE_LEN
+ -FIXED_IE;
+
+ ptdls_sta->off_ch = *(ptr+2);
+
+ //parsing information element
+ for(j=FIXED_IE; j<parsing_length;){
+
+ pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
+
+ switch (pIE->ElementID)
+ {
+ case _COUNTRY_IE_:
+ break;
+ case _CH_SWTICH_ANNOUNCE_:
+ break;
+ case _LINK_ID_IE_:
+ break;
+ case _CH_SWITCH_TIMING_:
+ _rtw_memcpy(&ptdls_sta->ch_switch_time, pIE->data, 2);
+ _rtw_memcpy(&ptdls_sta->ch_switch_timeout, pIE->data+2, 2);
+ default:
+ break;
+ }
+
+ j += (pIE->Length + 2);
+
+ }
+
+ //todo: check status
+ ptdls_sta->stat_code=0;
+ ptdls_sta->tdls_sta_state |= TDLS_CH_SWITCH_ON_STATE;
+
+ issue_nulldata(padapter, NULL, 1, 0, 0);
+
+ issue_tdls_ch_switch_rsp(padapter, psa);
+
+ DBG_871X("issue tdls channel switch response\n");
+
+ if((ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE) && ptdls_sta->off_ch==pmlmeext->cur_channel){
+ DBG_871X("back to base channel %x\n", pmlmeext->cur_channel);
+ ptdls_sta->option=TDLS_BASE_CH;
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_BASE_CH);
+ }else{
+ ptdls_sta->option=TDLS_OFF_CH;
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_OFF_CH);
+ }
+ return _SUCCESS;
+}
+
+sint On_TDLS_Ch_Switch_Rsp(_adapter *padapter, union recv_frame *precv_frame)
+{
+ struct sta_info *ptdls_sta= NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+ struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib;
+ u8 *psa;
+ sint parsing_length;
+ PNDIS_802_11_VARIABLE_IEs pIE;
+ u8 FIXED_IE =4;
+ u16 stat_code, j, switch_time, switch_timeout;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ int ret = _SUCCESS;
+
+ psa = get_sa(ptr);
+ ptdls_sta = rtw_get_stainfo(pstapriv, psa);
+
+ //if channel switch is running and receiving Unsolicited TDLS Channel Switch Response,
+ //it will go back to base channel and terminate this channel switch procedure
+ if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE ){
+ if(pmlmeext->cur_channel==ptdls_sta->off_ch){
+ DBG_871X("back to base channel %x\n", pmlmeext->cur_channel);
+ ptdls_sta->option=TDLS_BASE_CH;
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_BASE_CH);
+ }else{
+ DBG_871X("receive unsolicited channel switch response \n");
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
+ }
+ ret = _FAIL;
+ goto exit;
+ }
+
+ //avoiding duplicated or unconditional ch. switch. rsp
+ if(!(ptdls_sta->tdls_sta_state & TDLS_CH_SW_INITIATOR_STATE))
+ {
+ ret = _FAIL;
+ goto exit;
+ }
+
+ ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
+ parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
+ -prx_pkt_attrib->hdrlen
+ -prx_pkt_attrib->iv_len
+ -prx_pkt_attrib->icv_len
+ -LLC_HEADER_SIZE
+ -ETH_TYPE_LEN
+ -PAYLOAD_TYPE_LEN
+ -FIXED_IE;
+
+ _rtw_memcpy(&stat_code, ptr+2, 2);
+
+ if(stat_code!=0){
+ ret = _FAIL;
+ goto exit;
+ }
+
+ //parsing information element
+ for(j=FIXED_IE; j<parsing_length;){
+
+ pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
+
+ switch (pIE->ElementID)
+ {
+ case _LINK_ID_IE_:
+ break;
+ case _CH_SWITCH_TIMING_:
+ _rtw_memcpy(&switch_time, pIE->data, 2);
+ if(switch_time > ptdls_sta->ch_switch_time)
+ _rtw_memcpy(&ptdls_sta->ch_switch_time, &switch_time, 2);
+
+ _rtw_memcpy(&switch_timeout, pIE->data+2, 2);
+ if(switch_timeout > ptdls_sta->ch_switch_timeout)
+ _rtw_memcpy(&ptdls_sta->ch_switch_timeout, &switch_timeout, 2);
+
+ default:
+ break;
+ }
+
+ j += (pIE->Length + 2);
+
+ }
+
+ ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SW_INITIATOR_STATE);
+ ptdls_sta->tdls_sta_state |=TDLS_CH_SWITCH_ON_STATE;
+
+ //goto set_channel_workitem_callback()
+ ptdls_sta->option=TDLS_OFF_CH;
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_OFF_CH);
+
+exit:
+ return ret;
+}
+
+#ifdef CONFIG_WFD
+void wfd_ie_tdls(_adapter * padapter, u8 *pframe, u32 *pktlen )
+{
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct wifi_display_info *pwfd_info = padapter->tdlsinfo.wfd_info;
+ u8 wfdie[ MAX_WFD_IE_LEN] = { 0x00 };
+ u32 wfdielen = 0;
+
+ // WFD OUI
+ wfdielen = 0;
+ wfdie[ wfdielen++ ] = 0x50;
+ wfdie[ wfdielen++ ] = 0x6F;
+ wfdie[ wfdielen++ ] = 0x9A;
+ wfdie[ wfdielen++ ] = 0x0A; // WFA WFD v1.0
+
+ // Commented by Albert 20110825
+ // According to the WFD Specification, the negotiation request frame should contain 3 WFD attributes
+ // 1. WFD Device Information
+ // 2. Associated BSSID ( Optional )
+ // 3. Local IP Adress ( Optional )
+
+ // WFD Device Information ATTR
+ // Type:
+ wfdie[ wfdielen++ ] = WFD_ATTR_DEVICE_INFO;
+
+ // Length:
+ // Note: In the WFD specification, the size of length field is 2.
+ RTW_PUT_BE16(wfdie + wfdielen, 0x0006);
+ wfdielen += 2;
+
+ // Value1:
+ // WFD device information
+ // available for WFD session + Preferred TDLS + WSD ( WFD Service Discovery )
+ RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL
+ | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_WSD);
+ wfdielen += 2;
+
+ // Value2:
+ // Session Management Control Port
+ // Default TCP port for RTSP messages is 554
+ RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport );
+ wfdielen += 2;
+
+ // Value3:
+ // WFD Device Maximum Throughput
+ // 300Mbps is the maximum throughput
+ RTW_PUT_BE16(wfdie + wfdielen, 300);
+ wfdielen += 2;
+
+ // Associated BSSID ATTR
+ // Type:
+ wfdie[ wfdielen++ ] = WFD_ATTR_ASSOC_BSSID;
+
+ // Length:
+ // Note: In the WFD specification, the size of length field is 2.
+ RTW_PUT_BE16(wfdie + wfdielen, 0x0006);
+ wfdielen += 2;
+
+ // Value:
+ // Associated BSSID
+ if ( check_fwstate( pmlmepriv, _FW_LINKED) == _TRUE )
+ {
+ _rtw_memcpy( wfdie + wfdielen, &pmlmepriv->assoc_bssid[ 0 ], ETH_ALEN );
+ }
+ else
+ {
+ _rtw_memset( wfdie + wfdielen, 0x00, ETH_ALEN );
+ }
+
+ // Local IP Address ATTR
+ wfdie[ wfdielen++ ] = WFD_ATTR_LOCAL_IP_ADDR;
+
+ // Length:
+ // Note: In the WFD specification, the size of length field is 2.
+ RTW_PUT_BE16(wfdie + wfdielen, 0x0005);
+ wfdielen += 2;
+
+ // Version:
+ // 0x01: Version1;IPv4
+ wfdie[ wfdielen++ ] = 0x01;
+
+ // IPv4 Address
+ _rtw_memcpy( wfdie + wfdielen, pwfd_info->ip_address, 4 );
+ wfdielen += 4;
+
+ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, pktlen);
+
+}
+#endif //CONFIG_WFD
+
+void rtw_build_tdls_setup_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
+{
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ struct registry_priv *pregistrypriv = &padapter->registrypriv;
+ struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst);
+
+ u8 payload_type = 0x02;
+ u8 category = RTW_WLAN_CATEGORY_TDLS;
+ u8 action = TDLS_SETUP_REQUEST;
+ u8 bssrate[NDIS_802_11_LENGTH_RATES_EX]; //Use NDIS_802_11_LENGTH_RATES_EX in order to call func.rtw_set_supported_rate
+ int bssrate_len = 0, i = 0 ;
+ u8 more_supportedrates = 0;
+ unsigned int ie_len;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ u8 link_id_addr[18] = {0};
+ u8 iedata=0;
+ u8 sup_ch[ 30 * 2 ] = {0x00 }, sup_ch_idx = 0, idx_5g = 2; //For supported channel
+ u8 timeout_itvl[5]; //set timeout interval to maximum value
+ u32 time;
+ u8 *pframe_head;
+
+ //SNonce
+ if(pattrib->encrypt){
+ for(i=0;i<8;i++){
+ time=rtw_get_current_time();
+ _rtw_memcpy(&ptdls_sta->SNonce[4*i], (u8 *)&time, 4);
+ }
+ }
+
+ pframe_head = pframe; // For rtw_tdls_set_ht_cap()
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, dialog token
+ 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, &(ptdls_sta->dialog), &(pattrib->pktlen));
+
+ //capability
+ _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2);
+
+ if(pattrib->encrypt)
+ *pframe =*pframe | cap_Privacy;
+ pframe += 2;
+ pattrib->pktlen += 2;
+
+ //supported rates
+ if(pmlmeext->cur_channel < 14 )
+ {
+ rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N);
+ bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN;
+ }
+ else
+ {
+ rtw_set_supported_rate(bssrate, WIRELESS_11A_5N);
+ bssrate_len = IEEE80211_NUM_OFDM_RATESLEN;
+ }
+
+ //country(optional)
+
+ if (bssrate_len > 8)
+ {
+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
+ more_supportedrates = 1;
+ }
+ else
+ {
+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
+ }
+
+ //extended supported rates
+ if(more_supportedrates==1){
+ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
+ }
+
+ //supported channels
+ pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib);
+
+ // SRC IE
+ pframe = rtw_set_ie( pframe, _SRC_IE_, sizeof(TDLS_SRC), TDLS_SRC, &(pattrib->pktlen));
+
+ //RSNIE
+ if(pattrib->encrypt)
+ pframe = rtw_set_ie(pframe, _RSN_IE_2_, sizeof(TDLS_RSNIE), TDLS_RSNIE, &(pattrib->pktlen));
+
+ //extended capabilities
+ pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , sizeof(TDLS_EXT_CAPIE), TDLS_EXT_CAPIE, &(pattrib->pktlen));
+
+ //QoS capability(WMM_IE)
+ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, sizeof(TDLS_WMMIE), TDLS_WMMIE, &(pattrib->pktlen));
+
+
+ if(pattrib->encrypt){
+ //FTIE
+ _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0
+ _rtw_memset(pframe, _FTIE_, 1); //version
+ _rtw_memset((pframe+1), 82, 1); //length
+ _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32);
+ pframe += 84;
+ pattrib->pktlen += 84;
+
+ //Timeout interval
+ timeout_itvl[0]=0x02;
+ _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4);
+ pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
+ }
+
+ //Sup_reg_classes(optional)
+ //HT capabilities
+ pframe += rtw_tdls_set_ht_cap(padapter, pframe_head, pattrib);
+
+ //20/40 BSS coexistence
+ if(pmlmepriv->num_FortyMHzIntolerant>0)
+ iedata |= BIT(2);//20 MHz BSS Width Request
+ pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
+
+ //Link identifier
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+#ifdef CONFIG_WFD
+ wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) );
+#endif //CONFIG_WFD
+
+}
+
+void rtw_build_tdls_setup_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
+{
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ struct sta_info *ptdls_sta;
+ struct registry_priv *pregistrypriv = &padapter->registrypriv;
+
+ u8 payload_type = 0x02;
+ unsigned char category = RTW_WLAN_CATEGORY_TDLS;
+ unsigned char action = TDLS_SETUP_RESPONSE;
+ unsigned char bssrate[NDIS_802_11_LENGTH_RATES_EX];
+ int bssrate_len = 0;
+ u8 more_supportedrates = 0;
+ unsigned int ie_len;
+ unsigned char *p;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ u8 link_id_addr[18] = {0};
+ u8 iedata=0;
+ u8 timeout_itvl[5]; //setup response timeout interval will copy from request
+ u8 ANonce[32]; //maybe it can put in ontdls_req
+ u8 k; //for random ANonce
+ u8 *pftie=NULL, *ptimeout_ie=NULL, *plinkid_ie=NULL, *prsnie=NULL, *pftie_mic=NULL;
+ u32 time;
+ u8 *pframe_head;
+
+ ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst);
+
+ if(ptdls_sta == NULL )
+ {
+ DBG_871X("[%s] %d\n", __FUNCTION__, __LINE__);
+ return;
+ }
+
+ if(pattrib->encrypt){
+ for(k=0;k<8;k++){
+ time=rtw_get_current_time();
+ _rtw_memcpy(&ptdls_sta->ANonce[4*k], (u8*)&time, 4);
+ }
+ }
+
+ pframe_head = pframe;
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, status code
+ 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, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen));
+
+ if(ptdls_sta->stat_code!=0) //invalid setup request
+ {
+ DBG_871X("ptdls_sta->stat_code:%04x \n", ptdls_sta->stat_code);
+ return;
+ }
+
+ //dialog token
+ pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen));
+
+ //capability
+ _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2);
+
+ if(pattrib->encrypt )
+ *pframe =*pframe | cap_Privacy;
+ pframe += 2;
+ pattrib->pktlen += 2;
+
+ //supported rates
+ //supported rates
+ if(pmlmeext->cur_channel < 14 )
+ {
+ rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N);
+ bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN;
+ }
+ else
+ {
+ rtw_set_supported_rate(bssrate, WIRELESS_11A_5N);
+ bssrate_len = IEEE80211_NUM_OFDM_RATESLEN;
+ }
+
+ if (bssrate_len > 8)
+ {
+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
+ more_supportedrates = 1;
+ }
+ else
+ {
+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
+ }
+
+ //country(optional)
+ //extended supported rates
+ if(more_supportedrates==1){
+ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
+ }
+
+ //supported channels
+ pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib);
+
+ // SRC IE
+ pframe = rtw_set_ie(pframe, _SRC_IE_ , sizeof(TDLS_SRC), TDLS_SRC, &(pattrib->pktlen));
+
+ //RSNIE
+ if(pattrib->encrypt){
+ prsnie = pframe;
+ pframe = rtw_set_ie(pframe, _RSN_IE_2_, sizeof(ptdls_sta->TDLS_RSNIE), ptdls_sta->TDLS_RSNIE, &(pattrib->pktlen));
+ }
+
+ //extended capabilities
+ pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , sizeof(TDLS_EXT_CAPIE), TDLS_EXT_CAPIE, &(pattrib->pktlen));
+
+ //QoS capability(WMM_IE)
+ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, sizeof(TDLS_WMMIE), TDLS_WMMIE, &(pattrib->pktlen));
+
+ if(pattrib->encrypt){
+ wpa_tdls_generate_tpk(padapter, ptdls_sta);
+
+ //FTIE
+ pftie = pframe;
+ pftie_mic = pframe+4;
+ _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0
+ _rtw_memset(pframe, _FTIE_, 1); //version
+ _rtw_memset((pframe+1), 82, 1); //length
+ _rtw_memcpy((pframe+20), ptdls_sta->ANonce, 32);
+ _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32);
+ pframe += 84;
+ pattrib->pktlen += 84;
+
+ //Timeout interval
+ ptimeout_ie = pframe;
+ timeout_itvl[0]=0x02;
+ _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4);
+ pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
+ }
+
+ //Sup_reg_classes(optional)
+ //HT capabilities
+ pframe += rtw_tdls_set_ht_cap(padapter, pframe_head, pattrib);
+
+ //20/40 BSS coexistence
+ if(pmlmepriv->num_FortyMHzIntolerant>0)
+ iedata |= BIT(2);//20 MHz BSS Width Request
+ pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
+
+ //Link identifier
+ plinkid_ie = pframe;
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+ //fill FTIE mic
+ if(pattrib->encrypt)
+ wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic);
+
+#ifdef CONFIG_WFD
+ wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) );
+#endif //CONFIG_WFD
+
+}
+
+void rtw_build_tdls_setup_cfm_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
+{
+
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst);
+
+ u8 payload_type = 0x02;
+ unsigned char category = RTW_WLAN_CATEGORY_TDLS;
+ unsigned char action = TDLS_SETUP_CONFIRM;
+ u8 more_supportedrates = 0;
+ unsigned int ie_len;
+ unsigned char *p;
+ u8 timeout_itvl[5]; //set timeout interval to maximum value
+ u8 wmm_param_ele[24] = {0};
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ u8 link_id_addr[18] = {0};
+ u8 *pftie=NULL, *ptimeout_ie=NULL, *plinkid_ie=NULL, *prsnie=NULL, *pftie_mic=NULL;
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, status code, dialog token
+ 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, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen));
+
+ if(ptdls_sta->stat_code!=0) //invalid setup request
+ return;
+
+ //RSNIE
+ if(pattrib->encrypt){
+ prsnie = pframe;
+ pframe = rtw_set_ie(pframe, _RSN_IE_2_, sizeof(TDLS_RSNIE), TDLS_RSNIE, &(pattrib->pktlen));
+ }
+
+ //EDCA param set; WMM param ele.
+ if(pattrib->encrypt){
+ //FTIE
+ pftie = pframe;
+ pftie_mic = pframe+4;
+ _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0
+ _rtw_memset(pframe, _FTIE_, 1); //version
+ _rtw_memset((pframe+1), 82, 1); //length
+ _rtw_memcpy((pframe+20), ptdls_sta->ANonce, 32);
+ _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32);
+ pframe += 84;
+ pattrib->pktlen += 84;
+
+ //Timeout interval
+ ptimeout_ie = pframe;
+ timeout_itvl[0]=0x02;
+ _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4);
+ ptdls_sta->TPK_count=0;
+ _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT);
+ pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
+ }
+
+ //HT operation; todo
+ //Link identifier
+ plinkid_ie = pframe;
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+ //FTIE mic
+ if(pattrib->encrypt)
+ wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic);
+
+ //WMM Parameter Set
+ if(&pmlmeinfo->WMM_param)
+ {
+ _rtw_memcpy(wmm_param_ele, WMM_PARA_OUI, 6);
+ _rtw_memcpy(wmm_param_ele+6, (u8 *)&pmlmeinfo->WMM_param, sizeof(pmlmeinfo->WMM_param));
+ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 24, wmm_param_ele, &(pattrib->pktlen));
+ }
+
+}
+
+void rtw_build_tdls_teardown_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
+{
+
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ u8 payload_type = 0x02;
+ unsigned char category = RTW_WLAN_CATEGORY_TDLS;
+ u8 action = ptxmgmt->action_code;
+ u8 link_id_addr[18] = {0};
+ struct sta_info *ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst);
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, reason code
+ 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, 2, (u8 *)&ptxmgmt->status_code, &(pattrib->pktlen));
+
+ //Link identifier
+ if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
+ }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
+ }
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+}
+
+void rtw_build_tdls_dis_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt)
+{
+
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ u8 payload_type = 0x02;
+ u8 category = RTW_WLAN_CATEGORY_TDLS;
+ u8 action = TDLS_DISCOVERY_REQUEST;
+ u8 link_id_addr[18] = {0};
+ static u8 dialogtoken=0;
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, reason code
+ pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
+ if(ptxmgmt->external_support == _TRUE) {
+ pframe = rtw_set_fixed_ie(pframe, 1, &(ptxmgmt->dialog_token), &(pattrib->pktlen));
+ } else {
+ pframe = rtw_set_fixed_ie(pframe, 1, &(dialogtoken), &(pattrib->pktlen));
+ dialogtoken = (dialogtoken+1)%256;
+ }
+
+ //Link identifier
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+}
+
+void rtw_build_tdls_dis_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog, u8 privacy)
+{
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ struct registry_priv *pregistrypriv = &padapter->registrypriv;
+
+ u8 category = RTW_WLAN_CATEGORY_PUBLIC;
+ u8 action = TDLS_DISCOVERY_RESPONSE;
+ u8 bssrate[NDIS_802_11_LENGTH_RATES_EX];
+ int bssrate_len = 0;
+ u8 more_supportedrates = 0;
+ u8 *p;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ u8 link_id_addr[18] = {0};
+ u8 iedata=0;
+ u8 timeout_itvl[5]; //set timeout interval to maximum value
+ u32 timeout_interval= TPK_RESEND_COUNT * 1000;
+ u8 *pframe_head, pktlen_index;
+
+ pktlen_index = pattrib->pktlen; // For mgmt frame, pattrib->pktlen would count frame header
+ pframe_head = pframe;
+
+ //category, action, dialog token
+ 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, &(dialog), &(pattrib->pktlen));
+
+ //capability
+ _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2);
+
+ if(privacy)
+ *pframe =*pframe | cap_Privacy;
+ pframe += 2;
+ pattrib->pktlen += 2;
+
+ //supported rates
+ rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N);
+ bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN;
+
+ if (bssrate_len > 8)
+ {
+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
+ more_supportedrates = 1;
+ }
+ else
+ {
+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
+ }
+
+ //extended supported rates
+ if(more_supportedrates==1){
+ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
+ }
+
+ //supported channels
+ pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib);
+
+ //RSNIE
+ if(privacy)
+ pframe = rtw_set_ie(pframe, _RSN_IE_2_, sizeof(TDLS_RSNIE), TDLS_RSNIE, &(pattrib->pktlen));
+
+ //extended capability
+ pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , sizeof(TDLS_EXT_CAPIE), TDLS_EXT_CAPIE, &(pattrib->pktlen));
+
+ if(privacy){
+ //FTIE
+ _rtw_memset(pframe, 0, 84); //All fields shall be set to 0
+ _rtw_memset(pframe, _FTIE_, 1); //version
+ _rtw_memset((pframe+1), 82, 1); //length
+ pframe += 84;
+ pattrib->pktlen += 84;
+
+ //Timeout interval
+ timeout_itvl[0]=0x02;
+ _rtw_memcpy(timeout_itvl+1, &timeout_interval, 4);
+ pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
+ }
+
+ //Sup_reg_classes(optional)
+ //HT capabilities
+ pframe += rtw_tdls_set_ht_cap(padapter, pframe_head - pktlen_index, pattrib);
+
+ //20/40 BSS coexistence
+ if(pmlmepriv->num_FortyMHzIntolerant>0)
+ iedata |= BIT(2);//20 MHz BSS Width Request
+ pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
+
+ //Link identifier
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+}
+
+void rtw_build_tdls_peer_traffic_indication_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
+{
+
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ u8 payload_type = 0x02;
+ unsigned char category = RTW_WLAN_CATEGORY_TDLS;
+ unsigned char action = TDLS_PEER_TRAFFIC_INDICATION;
+
+ u8 link_id_addr[18] = {0};
+ u8 AC_queue=0;
+ struct sta_info *ptdls_sta = rtw_get_stainfo(&padapter->stapriv, pattrib->dst);
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, reason code
+ 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, &(ptdls_sta->dialog), &(pattrib->pktlen));
+
+ //Link identifier
+ if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
+ }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
+ }
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+ //PTI control
+ //PU buffer status
+ if(ptdls_sta->uapsd_bk&BIT(1))
+ AC_queue=BIT(0);
+ if(ptdls_sta->uapsd_be&BIT(1))
+ AC_queue=BIT(1);
+ if(ptdls_sta->uapsd_vi&BIT(1))
+ AC_queue=BIT(2);
+ if(ptdls_sta->uapsd_vo&BIT(1))
+ AC_queue=BIT(3);
+ pframe = rtw_set_ie(pframe, _PTI_BUFFER_STATUS_, 1, &AC_queue, &(pattrib->pktlen));
+
+}
+
+void rtw_build_tdls_peer_traffic_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
+{
+
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ u8 payload_type = 0x02;
+ u8 category = RTW_WLAN_CATEGORY_TDLS;
+ u8 action = TDLS_PEER_TRAFFIC_RESPONSE;
+ u8 link_id_addr[18] = {0};
+ struct sta_info *ptdls_sta = rtw_get_stainfo(&padapter->stapriv, pattrib->dst);
+ static u8 dialogtoken=0;
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, reason code
+ 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, &ptdls_sta->dialog, &(pattrib->pktlen));
+
+ //Link identifier
+ if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
+ }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
+ }
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+}
+
+void rtw_build_tdls_ch_switch_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
+{
+
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+ u8 payload_type = 0x02;
+ unsigned char category = RTW_WLAN_CATEGORY_TDLS;
+ unsigned char action = TDLS_CHANNEL_SWITCH_REQUEST;
+ u8 link_id_addr[18] = {0};
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst);
+ u8 ch_switch_timing[4] = {0};
+ u16 switch_time= CH_SWITCH_TIME, switch_timeout=CH_SWITCH_TIMEOUT;
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, target_ch
+ 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, &(ptdlsinfo->candidate_ch), &(pattrib->pktlen));
+
+ //Link identifier
+ if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
+ }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
+ }
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+ //ch switch timing
+ _rtw_memcpy(ch_switch_timing, &switch_time, 2);
+ _rtw_memcpy(ch_switch_timing+2, &switch_timeout, 2);
+ pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen));
+
+ //update ch switch attrib to sta_info
+ ptdls_sta->off_ch=ptdlsinfo->candidate_ch;
+ ptdls_sta->ch_switch_time=switch_time;
+ ptdls_sta->ch_switch_timeout=switch_timeout;
+
+}
+
+void rtw_build_tdls_ch_switch_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
+{
+
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ u8 payload_type = 0x02;
+ unsigned char category = RTW_WLAN_CATEGORY_TDLS;
+ unsigned char action = TDLS_CHANNEL_SWITCH_RESPONSE;
+ u8 link_id_addr[18] = {0};
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst);
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
+ u8 ch_switch_timing[4] = {0};
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, action, status_code
+ 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, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen));
+
+ //Link identifier
+ if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->src, 6);
+ }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){
+ _rtw_memcpy(link_id_addr, pattrib->ra, 6);
+ _rtw_memcpy((link_id_addr+6), pattrib->src, 6);
+ _rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
+ }
+ pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
+
+ //ch switch timing
+ _rtw_memcpy(ch_switch_timing, &ptdls_sta->ch_switch_time, 2);
+ _rtw_memcpy(ch_switch_timing+2, &ptdls_sta->ch_switch_timeout, 2);
+ pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen));
+
+}
+
+#ifdef CONFIG_WFD
+void rtw_build_tunneled_probe_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
+{
+
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ struct wifidirect_info *pwdinfo = &padapter->wdinfo;
+ struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo;
+ u8 payload_type = 0x02;
+ u8 category = RTW_WLAN_CATEGORY_P2P;
+ u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a};
+ u8 probe_req = 4;
+ u8 wfdielen = 0;
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, OUI, frame_body_type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 1, &(probe_req), &(pattrib->pktlen));
+
+ if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ wfdielen = build_probe_req_wfd_ie(pwdinfo, pframe);
+ pframe += wfdielen;
+ pattrib->pktlen += wfdielen;
+ }
+ else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE))
+ {
+ wfdielen = build_probe_req_wfd_ie(pbuddy_wdinfo, pframe);
+ pframe += wfdielen;
+ pattrib->pktlen += wfdielen;
+ }
+
+}
+
+void rtw_build_tunneled_probe_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
+{
+
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+ struct wifidirect_info *pwdinfo = &padapter->wdinfo;
+ struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo;
+ u8 payload_type = 0x02;
+ u8 category = RTW_WLAN_CATEGORY_P2P;
+ u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a};
+ u8 probe_rsp = 5;
+ u8 wfdielen = 0;
+
+ //payload type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
+ //category, OUI, frame_body_type
+ pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 1, &(probe_rsp), &(pattrib->pktlen));
+
+ if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ wfdielen = build_probe_resp_wfd_ie(pwdinfo, pframe, 1);
+ pframe += wfdielen;
+ pattrib->pktlen += wfdielen;
+ }
+ else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE))
+ {
+ wfdielen = build_probe_resp_wfd_ie(pbuddy_wdinfo, pframe, 1);
+ pframe += wfdielen;
+ pattrib->pktlen += wfdielen;
+ }
+
+}
+#endif //CONFIG_WFD
+
+void _tdls_tpk_timer_hdl(void *FunctionContext)
+{
+ struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
+ struct tdls_txmgmt txmgmt;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ ptdls_sta->TPK_count++;
+ //TPK_timer set 1000 as default
+ //retry timer should set at least 301 sec.
+ if(ptdls_sta->TPK_count==TPK_RESEND_COUNT){
+ ptdls_sta->TPK_count=0;
+ _rtw_memcpy(txmgmt.peer, ptdls_sta->hwaddr, ETH_ALEN);
+ issue_tdls_setup_req(ptdls_sta->padapter, &txmgmt, _FALSE);
+ }
+
+ _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT);
+}
+
+// TDLS_DONE_CH_SEN: channel sensing and report candidate channel
+// TDLS_OFF_CH: first time set channel to off channel
+// TDLS_BASE_CH: when go back to the channel linked with AP, send null data to peer STA as an indication
+void _tdls_ch_switch_timer_hdl(void *FunctionContext)
+{
+
+ struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
+ _adapter *padapter = ptdls_sta->padapter;
+
+ if( ptdls_sta->option == TDLS_DONE_CH_SEN ){
+ rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_DONE_CH_SEN);
+ }else if( ptdls_sta->option == TDLS_OFF_CH ){
+ issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta->hwaddr, 0, 0, 0);
+ _set_timer(&ptdls_sta->base_ch_timer, 500);
+ }else if( ptdls_sta->option == TDLS_BASE_CH){
+ issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta->hwaddr, 0, 0, 0);
+ }
+}
+
+void _tdls_base_ch_timer_hdl(void *FunctionContext)
+{
+ struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
+ rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_OFF_CH);
+}
+
+void _tdls_off_ch_timer_hdl(void *FunctionContext)
+{
+ struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
+ rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_BASE_CH );
+}
+
+void _tdls_handshake_timer_hdl(void *FunctionContext)
+{
+ struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
+
+ if(ptdls_sta != NULL)
+ {
+ if( !(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE) )
+ {
+ DBG_871X("tdls handshake time out\n");
+ rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_TEAR_STA );
+ }
+ }
+}
+
+void _tdls_pti_timer_hdl(void *FunctionContext)
+{
+ struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
+ _adapter *padapter = ptdls_sta->padapter;
+ struct tdls_txmgmt txmgmt;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ _rtw_memcpy(txmgmt.peer, ptdls_sta->hwaddr, ETH_ALEN);
+ txmgmt.status_code = _RSON_TDLS_TEAR_TOOFAR_;
+
+ if(ptdls_sta != NULL)
+ {
+ if( ptdls_sta->tdls_sta_state & TDLS_WAIT_PTR_STATE )
+ {
+ DBG_871X("Doesn't receive PTR from peer dev:"MAC_FMT"; Send TDLS Tear Down\n", MAC_ARG(ptdls_sta->hwaddr));
+ issue_tdls_teardown(padapter, &txmgmt, _FALSE);
+ }
+ }
+}
+
+void rtw_init_tdls_timer(_adapter *padapter, struct sta_info *psta)
+{
+ psta->padapter=padapter;
+ _init_timer(&psta->TPK_timer, padapter->pnetdev, _tdls_tpk_timer_hdl, psta);
+ _init_timer(&psta->option_timer, padapter->pnetdev, _tdls_ch_switch_timer_hdl, psta);
+ _init_timer(&psta->base_ch_timer, padapter->pnetdev, _tdls_base_ch_timer_hdl, psta);
+ _init_timer(&psta->off_ch_timer, padapter->pnetdev, _tdls_off_ch_timer_hdl, psta);
+ _init_timer(&psta->handshake_timer, padapter->pnetdev, _tdls_handshake_timer_hdl, psta);
+ _init_timer(&psta->pti_timer, padapter->pnetdev, _tdls_pti_timer_hdl, psta);
+}
+
+void rtw_free_tdls_timer(struct sta_info *psta)
+{
+ _cancel_timer_ex(&psta->TPK_timer);
+ _cancel_timer_ex(&psta->option_timer);
+ _cancel_timer_ex(&psta->base_ch_timer);
+ _cancel_timer_ex(&psta->off_ch_timer);
+ _cancel_timer_ex(&psta->handshake_timer);
+ _cancel_timer_ex(&psta->pti_timer);
+}
+
+u8 update_sgi_tdls(_adapter *padapter, struct sta_info *psta)
+{
+ return query_ra_short_GI(psta);
+}
+
+u32 update_mask_tdls(_adapter *padapter, struct sta_info *psta)
+{
+ unsigned char sta_band = 0;
+ unsigned int tx_ra_bitmap=0;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+
+ rtw_hal_update_sta_rate_mask(padapter, psta);
+ tx_ra_bitmap = psta->ra_mask;
+
+ if ( pcur_network->Configuration.DSConfig > 14 ) {
+ // 5G band
+ if (tx_ra_bitmap & 0xffff000)
+ sta_band |= WIRELESS_11_5N | WIRELESS_11A;
+ else
+ sta_band |= WIRELESS_11A;
+ } else {
+ if (tx_ra_bitmap & 0xffff000)
+ sta_band |= WIRELESS_11_24N | WIRELESS_11G | WIRELESS_11B;
+ else if (tx_ra_bitmap & 0xff0)
+ sta_band |= WIRELESS_11G |WIRELESS_11B;
+ else
+ sta_band |= WIRELESS_11B;
+ }
+
+ psta->wireless_mode = sta_band;
+
+ psta->raid = rtw_hal_networktype_to_raid(padapter,psta);
+ tx_ra_bitmap |= ((psta->raid<<28)&0xf0000000);
+ return tx_ra_bitmap;
+}
+
+#endif //CONFIG_TDLS
+
diff --git a/rtl8xxx_EU/core/rtw_wapi.c b/rtl8xxx_EU/core/rtw_wapi.c
index d4835da..cf4a995 100755
--- a/rtl8xxx_EU/core/rtw_wapi.c
+++ b/rtl8xxx_EU/core/rtw_wapi.c
@@ -1,1326 +1,1326 @@
-#ifdef CONFIG_WAPI_SUPPORT
-
-#include <linux/unistd.h>
-#include <linux/etherdevice.h>
-#include <drv_types.h>
-#include <rtw_wapi.h>
-
-
-u32 wapi_debug_component =
-// WAPI_INIT |
-// WAPI_API |
-// WAPI_TX |
-// WAPI_RX |
- WAPI_ERR ; //always open err flags on
-
-void WapiFreeAllStaInfo(_adapter *padapter)
-{
- PRT_WAPI_T pWapiInfo;
- PRT_WAPI_STA_INFO pWapiStaInfo;
- PRT_WAPI_BKID pWapiBkid;
-
- WAPI_TRACE(WAPI_INIT, "===========> %s\n", __FUNCTION__);
- pWapiInfo = &padapter->wapiInfo;
-
- //Pust to Idle List
- rtw_wapi_return_all_sta_info(padapter);
-
- //Sta Info List
- while(!list_empty(&(pWapiInfo->wapiSTAIdleList)))
- {
- pWapiStaInfo = (PRT_WAPI_STA_INFO)list_entry(pWapiInfo->wapiSTAIdleList.next, RT_WAPI_STA_INFO, list);
- list_del_init(&pWapiStaInfo->list);
- }
-
- //BKID List
- while(!list_empty(&(pWapiInfo->wapiBKIDIdleList)))
- {
- pWapiBkid = (PRT_WAPI_BKID)list_entry(pWapiInfo->wapiBKIDIdleList.next, RT_WAPI_BKID, list);
- list_del_init(&pWapiBkid->list);
- }
- WAPI_TRACE(WAPI_INIT, "<=========== %s\n", __FUNCTION__);
- return;
-}
-
-void WapiSetIE(_adapter *padapter)
-{
- PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
- //PRT_WAPI_BKID pWapiBkid;
- u16 protocolVer = 1;
- u16 akmCnt = 1;
- u16 suiteCnt = 1;
- u16 capability = 0;
- u8 OUI[3];
-
- OUI[0] = 0x00;
- OUI[1] = 0x14;
- OUI[2] = 0x72;
-
- pWapiInfo->wapiIELength = 0;
-//protocol version
- memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength, &protocolVer, 2);
- pWapiInfo->wapiIELength +=2;
-//akm
- memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength, &akmCnt, 2);
- pWapiInfo->wapiIELength +=2;
-
- if(pWapiInfo->bWapiPSK){
- memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength,OUI, 3);
- pWapiInfo->wapiIELength +=3;
- pWapiInfo->wapiIE[pWapiInfo->wapiIELength] = 0x2;
- pWapiInfo->wapiIELength +=1;
- }else{
- memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength,OUI, 3);
- pWapiInfo->wapiIELength +=3;
- pWapiInfo->wapiIE[pWapiInfo->wapiIELength] = 0x1;
- pWapiInfo->wapiIELength +=1;
- }
-
-//usk
- memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength, &suiteCnt, 2);
- pWapiInfo->wapiIELength +=2;
- memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength,OUI, 3);
- pWapiInfo->wapiIELength +=3;
- pWapiInfo->wapiIE[pWapiInfo->wapiIELength] = 0x1;
- pWapiInfo->wapiIELength +=1;
-
-//msk
- memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength,OUI, 3);
- pWapiInfo->wapiIELength +=3;
- pWapiInfo->wapiIE[pWapiInfo->wapiIELength] = 0x1;
- pWapiInfo->wapiIELength +=1;
-
-//Capbility
- memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength, &capability, 2);
- pWapiInfo->wapiIELength +=2;
-}
-
-
-/* PN1 > PN2, return 1,
- * else return 0.
- */
-u32 WapiComparePN(u8 *PN1, u8 *PN2)
-{
- char i;
-
- if ((NULL == PN1) || (NULL == PN2))
- return 1;
-
- // overflow case
- if ((PN2[15] - PN1[15]) & 0x80)
- return 1;
-
- for (i=16; i>0; i--)
- {
- if(PN1[i-1] == PN2[i-1])
- continue;
- else if(PN1[i-1] > PN2[i-1])
- return 1;
- else
- return 0;
- }
-
- return 0;
-}
-
-u8
-WapiGetEntryForCamWrite(_adapter *padapter,u8 *pMacAddr,u8 KID,BOOLEAN IsMsk)
-{
- PRT_WAPI_T pWapiInfo=NULL;
- //PRT_WAPI_CAM_ENTRY pEntry=NULL;
- u8 i=0;
- u8 ret = 0xff;
-
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
- pWapiInfo = &padapter->wapiInfo;
-
- //exist?
- for(i=0;i<WAPI_CAM_ENTRY_NUM;i++)
- {
- if(pWapiInfo->wapiCamEntry[i].IsUsed
- && (_rtw_memcmp(pMacAddr, pWapiInfo->wapiCamEntry[i].PeerMacAddr, ETH_ALEN) == _TRUE)
- && pWapiInfo->wapiCamEntry[i].keyidx == KID
- && pWapiInfo->wapiCamEntry[i].type == IsMsk)
- {
- ret = pWapiInfo->wapiCamEntry[i].entry_idx; //cover it
- break;
- }
- }
-
- if(i == WAPI_CAM_ENTRY_NUM) //not found
- {
- for(i=0;i<WAPI_CAM_ENTRY_NUM;i++)
- {
- if(pWapiInfo->wapiCamEntry[i].IsUsed == 0)
- {
- pWapiInfo->wapiCamEntry[i].IsUsed = 1;
- pWapiInfo->wapiCamEntry[i].type = IsMsk;
- pWapiInfo->wapiCamEntry[i].keyidx = KID;
- _rtw_memcpy(pWapiInfo->wapiCamEntry[i].PeerMacAddr, pMacAddr,ETH_ALEN);
- ret = pWapiInfo->wapiCamEntry[i].entry_idx;
- break;
- }
- }
- }
-
- WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
- return ret;
-
-/*
- if(RTIsListEmpty(&pWapiInfo->wapiCamIdleList)){
- RT_TRACE(COMP_SEC,DBG_LOUD,("No Entry for wapi!!!\n"));
- return 0;
- }
-
- pEntry = (PRT_WAPI_CAM_ENTRY)RTRemoveHeadList(&pWapiInfo->wapiCamIdleList);
- RTInsertTailList(&pWapiInfo->wapiCamUsedList, &pEntry->list);
-
- RT_TRACE(COMP_SEC,DBG_LOUD,("<====WapiGetCamEntry(),Get Entry Idx:%d.but we just return 4 for test\n",pEntry->entry_idx));
-
- return pEntry->entry_idx;*/
-}
-
-u8 WapiGetEntryForCamClear(_adapter *padapter,u8 *pPeerMac,u8 keyid,u8 IsMsk)
-{
- PRT_WAPI_T pWapiInfo=NULL;
- u8 i=0;
-
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
- pWapiInfo = &padapter->wapiInfo;
-
- for(i=0;i<WAPI_CAM_ENTRY_NUM;i++)
- {
- if(pWapiInfo->wapiCamEntry[i].IsUsed
- && (_rtw_memcmp(pPeerMac, pWapiInfo->wapiCamEntry[i].PeerMacAddr, ETH_ALEN) == _TRUE)
- && pWapiInfo->wapiCamEntry[i].keyidx == keyid
- && pWapiInfo->wapiCamEntry[i].type == IsMsk)
- {
- pWapiInfo->wapiCamEntry[i].IsUsed = 0;
- pWapiInfo->wapiCamEntry[i].keyidx = 2;
- _rtw_memset(pWapiInfo->wapiCamEntry[i].PeerMacAddr,0,ETH_ALEN);
-
- WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
- return pWapiInfo->wapiCamEntry[i].entry_idx;
- }
- }
-
- WAPI_TRACE(WAPI_API,"<====WapiGetReturnCamEntry(), No this cam entry.\n");
- return 0xff;
-/*
- if(RTIsListEmpty(&pWapiInfo->wapiCamUsedList)){
- RT_TRACE(COMP_SEC,DBG_LOUD,("No Entry for wapi!!!\n"));
- return FALSE;
- }
-
- pList = &pWapiInfo->wapiCamUsedList;
- while(pList->Flink != &pWapiInfo->wapiCamUsedList)
- {
- pEntry = (PRT_WAPI_CAM_ENTRY)pList->Flink;
- if(PlatformCompareMemory(pPeerMac,pEntry->PeerMacAddr, ETHER_ADDRLEN)== 0
- && keyid == pEntry->keyidx)
- {
- RTRemoveEntryList(pList);
- RTInsertHeadList(&pWapiInfo->wapiCamIdleList, pList);
- return pEntry->entry_idx;
- }
- pList = pList->Flink;
- }
-
- return 0;
-*/
-}
-
-void
-WapiResetAllCamEntry(_adapter *padapter)
-{
- PRT_WAPI_T pWapiInfo;
- int i;
-
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
- pWapiInfo = &padapter->wapiInfo;
-
- for (i=0;i<WAPI_CAM_ENTRY_NUM;i++)
- {
- _rtw_memset(pWapiInfo->wapiCamEntry[i].PeerMacAddr, 0, ETH_ALEN);
- pWapiInfo->wapiCamEntry[i].IsUsed = 0;
- pWapiInfo->wapiCamEntry[i].keyidx = 2; //invalid
- pWapiInfo->wapiCamEntry[i].entry_idx = 4+i*2;
- }
-
- WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
-
- return;
-}
-
-u8 WapiWriteOneCamEntry(
- _adapter *padapter,
- u8 *pMacAddr,
- u8 KeyId,
- u8 EntryId,
- u8 EncAlg,
- u8 bGroupKey,
- u8 *pKey
-)
-{
- u8 retVal = 0;
- u16 usConfig = 0;
-
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
- if(EntryId >= 32)
- {
- WAPI_TRACE(WAPI_ERR, "<=== CamAddOneEntry(): ulKeyId exceed!\n");
- return retVal;
- }
-
- usConfig=usConfig|(0x01<<15)|((u16)(EncAlg)<<2)|(KeyId);
-
- if(EncAlg == _SMS4_ )
- {
- if(bGroupKey == 1)
- usConfig |= (0x01<<6);
- if((EntryId % 2)==1) // ==0 sec key; == 1mic key
- usConfig |= (0x01<<5);
- }
-
- write_cam(padapter, EntryId, usConfig, pMacAddr, pKey);
-
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
- return 1;
-}
-
-void rtw_wapi_init(_adapter *padapter)
-{
- PRT_WAPI_T pWapiInfo;
- int i;
-
- WAPI_TRACE(WAPI_INIT, "===========> %s\n", __FUNCTION__);
- RT_ASSERT_RET(padapter);
-
- if (!padapter->WapiSupport)
- {
- WAPI_TRACE(WAPI_INIT, "<========== %s, WAPI not supported!\n", __FUNCTION__);
- return;
- }
-
- pWapiInfo = &padapter->wapiInfo;
- pWapiInfo->bWapiEnable = false;
-
- //Init BKID List
- INIT_LIST_HEAD(&pWapiInfo->wapiBKIDIdleList);
- INIT_LIST_HEAD(&pWapiInfo->wapiBKIDStoreList);
- for(i=0;i<WAPI_MAX_BKID_NUM;i++)
- {
- list_add_tail(&pWapiInfo->wapiBKID[i].list, &pWapiInfo->wapiBKIDIdleList);
- }
-
- //Init STA List
- INIT_LIST_HEAD(&pWapiInfo->wapiSTAIdleList);
- INIT_LIST_HEAD(&pWapiInfo->wapiSTAUsedList);
- for(i=0;i<WAPI_MAX_STAINFO_NUM;i++)
- {
- list_add_tail(&pWapiInfo->wapiSta[i].list, &pWapiInfo->wapiSTAIdleList);
- }
-
- for (i=0;i<WAPI_CAM_ENTRY_NUM;i++)
- {
- pWapiInfo->wapiCamEntry[i].IsUsed = 0;
- pWapiInfo->wapiCamEntry[i].keyidx = 2; //invalid
- pWapiInfo->wapiCamEntry[i].entry_idx = 4+i*2;
- }
-
- WAPI_TRACE(WAPI_INIT, "<========== %s\n", __FUNCTION__);
-}
-
-void rtw_wapi_free(_adapter *padapter)
-{
- WAPI_TRACE(WAPI_INIT, "===========> %s\n", __FUNCTION__);
- RT_ASSERT_RET(padapter);
-
- if (!padapter->WapiSupport)
- {
- WAPI_TRACE(WAPI_INIT, "<========== %s, WAPI not supported!\n", __FUNCTION__);
- return;
- }
-
- WapiFreeAllStaInfo(padapter);
-
- WAPI_TRACE(WAPI_INIT, "<========== %s\n", __FUNCTION__);
-}
-
-void rtw_wapi_disable_tx(_adapter *padapter)
-{
- WAPI_TRACE(WAPI_INIT, "===========> %s\n", __FUNCTION__);
- RT_ASSERT_RET(padapter);
-
- if (!padapter->WapiSupport)
- {
- WAPI_TRACE(WAPI_INIT, "<========== %s, WAPI not supported!\n", __FUNCTION__);
- return;
- }
-
- padapter->wapiInfo.wapiTxMsk.bTxEnable = false;
- padapter->wapiInfo.wapiTxMsk.bSet = false;
-
- WAPI_TRACE(WAPI_INIT, "<========== %s\n", __FUNCTION__);
-}
-
-u8 rtw_wapi_is_wai_packet(_adapter* padapter,u8 *pkt_data)
-{
- PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct security_priv *psecuritypriv = &padapter->securitypriv;
- PRT_WAPI_STA_INFO pWapiSta = NULL;
- u8 WaiPkt = 0, *pTaddr, bFind = false;
- u8 Offset_TypeWAI = 0 ; // (mac header len + llc length)
-
- WAPI_TRACE(WAPI_TX|WAPI_RX, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return 0;
- }
-
- Offset_TypeWAI = 24 + 6 ;
-
- //YJ,add,091103. Data frame may also have skb->data[30]=0x88 and skb->data[31]=0xb4.
- if ((pkt_data[1]&0x40) !=0)
- {
- //DBG_871X("data is privacy \n");
- return 0;
- }
-
- pTaddr = GetAddr2Ptr(pkt_data);
- if(list_empty(&pWapiInfo->wapiSTAUsedList)){
- bFind = false;
- }else{
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list){
- if (_rtw_memcmp(pTaddr, pWapiSta->PeerMacAddr, 6) == _TRUE) {
- bFind = true;
- break;
- }
- }
- }
-
- WAPI_TRACE(WAPI_TX|WAPI_RX, "%s: bFind=%d pTaddr="MAC_FMT"\n", __FUNCTION__, bFind, MAC_ARG(pTaddr));
-
- if (pkt_data[0] == WIFI_QOS_DATA_TYPE)
- {
- Offset_TypeWAI += 2;
- }
-
- // 88b4?
- if( (pkt_data[Offset_TypeWAI]==0x88) && (pkt_data[Offset_TypeWAI+1]==0xb4) ){
- WaiPkt = pkt_data[Offset_TypeWAI+5];
-
- psecuritypriv->hw_decrypted = _TRUE;
- }else{
- WAPI_TRACE(WAPI_TX|WAPI_RX, "%s(): non wai packet\n",__FUNCTION__);
- }
-
- WAPI_TRACE(WAPI_TX|WAPI_RX, "%s(): Recvd WAI frame. IsWAIPkt(%d)\n",__FUNCTION__, WaiPkt);
-
- return WaiPkt;
-}
-
-
-void rtw_wapi_update_info(_adapter *padapter, union recv_frame *precv_frame)
-{
- PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
- struct recv_frame_hdr *precv_hdr;
- u8 *ptr;
- u8 *pTA;
- u8 *pRecvPN;
-
-
- WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return;
- }
-
- precv_hdr = &precv_frame->u.hdr;
- ptr = precv_hdr->rx_data;
-
- if (precv_hdr->attrib.qos == 1)
- {
- precv_hdr->UserPriority = GetTid(ptr);
- }
- else
- {
- precv_hdr->UserPriority = 0;
- }
-
- pTA = GetAddr2Ptr(ptr);
- _rtw_memcpy((u8 *)precv_hdr->WapiSrcAddr, pTA, 6);
- pRecvPN = ptr + precv_hdr->attrib.hdrlen + 2;
- _rtw_memcpy((u8 *)precv_hdr->WapiTempPN, pRecvPN, 16);
-
- WAPI_TRACE(WAPI_RX, "<========== %s\n", __FUNCTION__);
-}
-
-/****************************************************************************
-TRUE-----------------Drop
-FALSE---------------- handle
-add to support WAPI to N-mode
-*****************************************************************************/
-u8 rtw_wapi_check_for_drop(
- _adapter *padapter,
- union recv_frame *precv_frame
-)
-{
- PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
- u8 *pLastRecvPN = NULL;
- u8 bFind = false;
- PRT_WAPI_STA_INFO pWapiSta = NULL;
- u8 bDrop = false;
- struct recv_frame_hdr *precv_hdr = &precv_frame->u.hdr;
- u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
- u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- int i;
-
- WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return false;
- }
-
- if(precv_hdr->bIsWaiPacket !=0)
- {
- if(precv_hdr->bIsWaiPacket== 0x8)
- {
-
- DBG_871X("rtw_wapi_check_for_drop: dump packet \n");
- for(i=0;i<50;i++)
- {
- DBG_871X("%02X ",ptr[i]);
- if((i+1) %8 ==0)
- DBG_871X("\n");
- }
- DBG_871X("\n rtw_wapi_check_for_drop: dump packet \n");
-
- for(i=0;i<16;i++)
- {
- if(ptr[i+27] !=0)
- break;
- }
-
- if(i== 16)
- {
- WAPI_TRACE(WAPI_RX,"rtw_wapi_check_for_drop: drop with zero BKID \n");
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- return false;
- }
-
- if(list_empty(&pWapiInfo->wapiSTAUsedList)){
- bFind = false;
- }else{
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
- if (_rtw_memcmp(precv_hdr->WapiSrcAddr, pWapiSta->PeerMacAddr, ETH_ALEN) == _TRUE) {
- bFind = true;
- break;
- }
- }
- }
- WAPI_TRACE(WAPI_RX, "%s: bFind=%d prxb->WapiSrcAddr="MAC_FMT"\n", __FUNCTION__, bFind, MAC_ARG(precv_hdr->WapiSrcAddr));
-
- if(bFind)
- {
- if(IS_MCAST(precv_hdr->attrib.ra))
- {
- WAPI_TRACE(WAPI_RX,"rtw_wapi_check_for_drop: multicast case \n");
- pLastRecvPN = pWapiSta->lastRxMulticastPN;
- }
- else
- {
- WAPI_TRACE(WAPI_RX,"rtw_wapi_check_for_drop: unicast case \n");
- switch(precv_hdr->UserPriority)
- {
- case 0:
- case 3:
- pLastRecvPN = pWapiSta->lastRxUnicastPNBEQueue;
- break;
- case 1:
- case 2:
- pLastRecvPN = pWapiSta->lastRxUnicastPNBKQueue;
- break;
- case 4:
- case 5:
- pLastRecvPN = pWapiSta->lastRxUnicastPNVIQueue;
- break;
- case 6:
- case 7:
- pLastRecvPN = pWapiSta->lastRxUnicastPNVOQueue;
- break;
- default:
- WAPI_TRACE(WAPI_ERR,"%s: Unknown TID \n",__FUNCTION__);
- break;
- }
- }
-
- if(!WapiComparePN(precv_hdr->WapiTempPN,pLastRecvPN))
- {
- WAPI_TRACE(WAPI_RX,"%s: Equal PN!!\n",__FUNCTION__);
- if(IS_MCAST(precv_hdr->attrib.ra))
- _rtw_memcpy(pLastRecvPN,WapiAEMultiCastPNInitialValueSrc,16);
- else
- _rtw_memcpy(pLastRecvPN,WapiAEPNInitialValueSrc,16);
- bDrop = true;
- }
- else
- {
- _rtw_memcpy(pLastRecvPN,precv_hdr->WapiTempPN,16);
- }
- }
-
- WAPI_TRACE(WAPI_RX, "<========== %s\n", __FUNCTION__);
- return bDrop;
-}
-
-void rtw_build_probe_resp_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib)
-{
- PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
- u8 WapiIELength = 0;
-
- WAPI_TRACE(WAPI_MLME, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported!\n", __FUNCTION__);
- return;
- }
-
- WapiSetIE(padapter);
- WapiIELength = pWapiInfo->wapiIELength;
- pframe[0] = _WAPI_IE_;
- pframe[1] = WapiIELength;
- _rtw_memcpy(pframe+2, pWapiInfo->wapiIE, WapiIELength);
- pframe += WapiIELength+2;
- pattrib->pktlen += WapiIELength+2;
-
- WAPI_TRACE(WAPI_MLME, "<========== %s\n", __FUNCTION__);
-}
-
-void rtw_build_beacon_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib)
-{
- PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
- u8 WapiIELength = 0;
- WAPI_TRACE(WAPI_MLME, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported!\n", __FUNCTION__);
- return;
- }
-
- WapiSetIE(padapter);
- WapiIELength = pWapiInfo->wapiIELength;
- pframe[0] = _WAPI_IE_;
- pframe[1] = WapiIELength;
- _rtw_memcpy(pframe+2, pWapiInfo->wapiIE, WapiIELength);
- pframe += WapiIELength+2;
- pattrib->pktlen += WapiIELength+2;
-
- WAPI_TRACE(WAPI_MLME, "<========== %s\n", __FUNCTION__);
-}
-
-void rtw_build_assoc_req_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib)
-{
- PRT_WAPI_BKID pWapiBKID;
- u16 bkidNum;
- PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
- u8 WapiIELength = 0;
-
- WAPI_TRACE(WAPI_MLME, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported!\n", __FUNCTION__);
- return;
- }
-
- WapiSetIE(padapter);
- WapiIELength = pWapiInfo->wapiIELength;
- bkidNum = 0;
- if(!list_empty(&(pWapiInfo->wapiBKIDStoreList))){
- list_for_each_entry(pWapiBKID, &pWapiInfo->wapiBKIDStoreList, list) {
- bkidNum ++;
- _rtw_memcpy(pWapiInfo->wapiIE+WapiIELength+2, pWapiBKID->bkid,16);
- WapiIELength += 16;
- }
- }
- _rtw_memcpy(pWapiInfo->wapiIE+WapiIELength, &bkidNum, 2);
- WapiIELength += 2;
-
- pframe[0] = _WAPI_IE_;
- pframe[1] = WapiIELength;
- _rtw_memcpy(pframe+2, pWapiInfo->wapiIE, WapiIELength);
- pframe += WapiIELength+2;
- pattrib->pktlen += WapiIELength+2;
- WAPI_TRACE(WAPI_MLME, "<========== %s\n", __FUNCTION__);
-}
-
-void rtw_wapi_on_assoc_ok(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
-{
- PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
- PRT_WAPI_STA_INFO pWapiSta;
- u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
- //u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
- u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
-
- WAPI_TRACE(WAPI_MLME, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return;
- }
-
- pWapiSta =(PRT_WAPI_STA_INFO)list_entry(pWapiInfo->wapiSTAIdleList.next, RT_WAPI_STA_INFO, list);
- list_del_init(&pWapiSta->list);
- list_add_tail(&pWapiSta->list, &pWapiInfo->wapiSTAUsedList);
- _rtw_memcpy(pWapiSta->PeerMacAddr,padapter->mlmeextpriv.mlmext_info.network.MacAddress,6);
- _rtw_memcpy(pWapiSta->lastRxMulticastPN, WapiAEMultiCastPNInitialValueSrc, 16);
- _rtw_memcpy(pWapiSta->lastRxUnicastPN, WapiAEPNInitialValueSrc, 16);
-
- //For chenk PN error with Qos Data after s3: add by ylb 20111114
- _rtw_memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiAEPNInitialValueSrc,16);
- _rtw_memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiAEPNInitialValueSrc,16);
- _rtw_memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiAEPNInitialValueSrc,16);
- _rtw_memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiAEPNInitialValueSrc,16);
-
- WAPI_TRACE(WAPI_MLME, "<========== %s\n", __FUNCTION__);
-}
-
-
-void rtw_wapi_return_one_sta_info(_adapter *padapter, u8 *MacAddr)
-{
- PRT_WAPI_T pWapiInfo;
- PRT_WAPI_STA_INFO pWapiStaInfo = NULL;
- PRT_WAPI_BKID pWapiBkid = NULL;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-
- pWapiInfo = &padapter->wapiInfo;
-
- WAPI_TRACE(WAPI_API, "==========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return;
- }
-
- if(check_fwstate(pmlmepriv, WIFI_STATION_STATE))
- {
- while(!list_empty(&(pWapiInfo->wapiBKIDStoreList)))
- {
- pWapiBkid = (PRT_WAPI_BKID)list_entry(pWapiInfo->wapiBKIDStoreList.next, RT_WAPI_BKID, list);
- list_del_init(&pWapiBkid->list);
- _rtw_memset(pWapiBkid->bkid,0,16);
- list_add_tail(&pWapiBkid->list, &pWapiInfo->wapiBKIDIdleList);
- }
- }
-
-
- WAPI_TRACE(WAPI_API, " %s: after clear bkid \n", __FUNCTION__);
-
-
- //Remove STA info
- if(list_empty(&(pWapiInfo->wapiSTAUsedList))){
- WAPI_TRACE(WAPI_API, " %s: wapiSTAUsedList is null \n", __FUNCTION__);
- return;
- }else{
-
- WAPI_TRACE(WAPI_API, " %s: wapiSTAUsedList is not null \n", __FUNCTION__);
-#if 0
- pWapiStaInfo=(PRT_WAPI_STA_INFO)list_entry((pWapiInfo->wapiSTAUsedList.next),RT_WAPI_STA_INFO,list);
-
- list_for_each_entry(pWapiStaInfo, &(pWapiInfo->wapiSTAUsedList), list) {
-
- DBG_871X("MAC Addr %02x-%02x-%02x-%02x-%02x-%02x \n",MacAddr[0],MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5]);
-
-
- DBG_871X("peer Addr %02x-%02x-%02x-%02x-%02x-%02x \n",pWapiStaInfo->PeerMacAddr[0],pWapiStaInfo->PeerMacAddr[1],pWapiStaInfo->PeerMacAddr[2],pWapiStaInfo->PeerMacAddr[3],pWapiStaInfo->PeerMacAddr[4],pWapiStaInfo->PeerMacAddr[5]);
-
- if(pWapiStaInfo == NULL)
- {
- WAPI_TRACE(WAPI_API, " %s: pWapiStaInfo == NULL Case \n", __FUNCTION__);
- return;
- }
-
- if(pWapiStaInfo->PeerMacAddr == NULL)
- {
- WAPI_TRACE(WAPI_API, " %s: pWapiStaInfo->PeerMacAddr == NULL Case \n", __FUNCTION__);
- return;
- }
-
- if(MacAddr == NULL)
- {
- WAPI_TRACE(WAPI_API, " %s: MacAddr == NULL Case \n", __FUNCTION__);
- return;
- }
-
- if (_rtw_memcmp(pWapiStaInfo->PeerMacAddr, MacAddr, ETH_ALEN) == _TRUE) {
- pWapiStaInfo->bAuthenticateInProgress = false;
- pWapiStaInfo->bSetkeyOk = false;
- _rtw_memset(pWapiStaInfo->PeerMacAddr,0,ETH_ALEN);
- list_del_init(&pWapiStaInfo->list);
- list_add_tail(&pWapiStaInfo->list, &pWapiInfo->wapiSTAIdleList);
- break;
- }
-
- }
-#endif
-
- while(!list_empty(&(pWapiInfo->wapiSTAUsedList)))
- {
- pWapiStaInfo = (PRT_WAPI_STA_INFO)list_entry(pWapiInfo->wapiSTAUsedList.next, RT_WAPI_STA_INFO, list);
-
- DBG_871X("peer Addr %02x-%02x-%02x-%02x-%02x-%02x \n",pWapiStaInfo->PeerMacAddr[0],pWapiStaInfo->PeerMacAddr[1],pWapiStaInfo->PeerMacAddr[2],pWapiStaInfo->PeerMacAddr[3],pWapiStaInfo->PeerMacAddr[4],pWapiStaInfo->PeerMacAddr[5]);
-
- list_del_init(&pWapiStaInfo->list);
- memset(pWapiStaInfo->PeerMacAddr,0,ETH_ALEN);
- pWapiStaInfo->bSetkeyOk = 0;
- list_add_tail(&pWapiStaInfo->list, &pWapiInfo->wapiSTAIdleList);
- }
-
- }
-
- WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
- return;
-}
-
-void rtw_wapi_return_all_sta_info(_adapter *padapter)
-{
- PRT_WAPI_T pWapiInfo;
- PRT_WAPI_STA_INFO pWapiStaInfo;
- PRT_WAPI_BKID pWapiBkid;
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
- pWapiInfo = &padapter->wapiInfo;
-
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return;
- }
-
- //Sta Info List
- while(!list_empty(&(pWapiInfo->wapiSTAUsedList)))
- {
- pWapiStaInfo = (PRT_WAPI_STA_INFO)list_entry(pWapiInfo->wapiSTAUsedList.next, RT_WAPI_STA_INFO, list);
- list_del_init(&pWapiStaInfo->list);
- memset(pWapiStaInfo->PeerMacAddr,0,ETH_ALEN);
- pWapiStaInfo->bSetkeyOk = 0;
- list_add_tail(&pWapiStaInfo->list, &pWapiInfo->wapiSTAIdleList);
- }
-
- //BKID List
- while(!list_empty(&(pWapiInfo->wapiBKIDStoreList)))
- {
- pWapiBkid = (PRT_WAPI_BKID)list_entry(pWapiInfo->wapiBKIDStoreList.next, RT_WAPI_BKID, list);
- list_del_init(&pWapiBkid->list);
- memset(pWapiBkid->bkid,0,16);
- list_add_tail(&pWapiBkid->list, &pWapiInfo->wapiBKIDIdleList);
- }
- WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
-}
-
-void rtw_wapi_clear_cam_entry(_adapter *padapter, u8 *pMacAddr)
-{
- u8 UcIndex = 0;
-
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return;
- }
-
- UcIndex = WapiGetEntryForCamClear(padapter, pMacAddr, 0, 0);
- if(UcIndex != 0xff){
- //CAM_mark_invalid(Adapter, UcIndex);
- CAM_empty_entry(padapter, UcIndex);
- }
-
- UcIndex = WapiGetEntryForCamClear(padapter, pMacAddr, 1, 0);
- if(UcIndex != 0xff){
- //CAM_mark_invalid(Adapter, UcIndex);
- CAM_empty_entry(padapter, UcIndex);
- }
-
- UcIndex = WapiGetEntryForCamClear(padapter, pMacAddr, 0, 1);
- if(UcIndex != 0xff){
- //CAM_mark_invalid(Adapter, UcIndex);
- CAM_empty_entry(padapter, UcIndex);
- }
-
- UcIndex = WapiGetEntryForCamClear(padapter, pMacAddr, 1, 1);
- if(UcIndex != 0xff){
- //CAM_mark_invalid(padapter, UcIndex);
- CAM_empty_entry(padapter, UcIndex);
- }
-
- WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
-}
-
-void rtw_wapi_clear_all_cam_entry(_adapter *padapter)
-{
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
- {
- WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return;
- }
-
- invalidate_cam_all(padapter); // is this ok?
- WapiResetAllCamEntry(padapter);
-
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-}
-
-void rtw_wapi_set_key(_adapter *padapter, RT_WAPI_KEY *pWapiKey, RT_WAPI_STA_INFO *pWapiSta, u8 bGroupKey, u8 bUseDefaultKey)
-{
- PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
- u8 *pMacAddr = pWapiSta->PeerMacAddr;
- u32 EntryId = 0;
- BOOLEAN IsPairWise = false ;
- u8 EncAlgo;
-
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
- {
- WAPI_TRACE(WAPI_API, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
- return;
- }
-
- EncAlgo = _SMS4_;
-
- //For Tx bc/mc pkt,use defualt key entry
- if(bUseDefaultKey)
- {
- // when WAPI update key, keyid will be 0 or 1 by turns.
- if (pWapiKey->keyId == 0)
- EntryId = 0;
- else
- EntryId = 2;
- }
- else
- {
- // tx/rx unicast pkt, or rx broadcast, find the key entry by peer's MacAddr
- EntryId = WapiGetEntryForCamWrite(padapter,pMacAddr,pWapiKey->keyId,bGroupKey);
- }
-
- if(EntryId == 0xff){
- WAPI_TRACE(WAPI_API, "===>No entry for WAPI setkey! !!\n");
- return;
- }
-
- //EntryId is also used to diff Sec key and Mic key
- //Sec Key
- WapiWriteOneCamEntry(padapter,
- pMacAddr,
- pWapiKey->keyId, //keyid
- EntryId, //entry
- EncAlgo, //type
- bGroupKey, //pairwise or group key
- pWapiKey->dataKey);
- //MIC key
- WapiWriteOneCamEntry(padapter,
- pMacAddr,
- pWapiKey->keyId, //keyid
- EntryId+1, //entry
- EncAlgo, //type
- bGroupKey, //pairwise or group key
- pWapiKey->micKey);
-
- WAPI_TRACE(WAPI_API, "Set Wapi Key :KeyId:%d,EntryId:%d,PairwiseKey:%d.\n",pWapiKey->keyId,EntryId,!bGroupKey);
- WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
-
-}
-
-#if 0
-//YJ,test,091013
-void wapi_test_set_key(struct _adapter *padapter, u8* buf)
-{ /*Data: keyType(1) + bTxEnable(1) + bAuthenticator(1) + bUpdate(1) + PeerAddr(6) + DataKey(16) + MicKey(16) + KeyId(1)*/
- PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
- PRT_WAPI_BKID pWapiBkid;
- PRT_WAPI_STA_INFO pWapiSta;
- u8 data[43];
- bool bTxEnable;
- bool bUpdate;
- bool bAuthenticator;
- u8 PeerAddr[6];
- u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
- u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
- u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
-
- WAPI_TRACE(WAPI_INIT, "===========>%s\n", __FUNCTION__);
-
- if (!padapter->WapiSupport){
- return;
- }
-
- copy_from_user(data, buf, 43);
- bTxEnable = data[1];
- bAuthenticator = data[2];
- bUpdate = data[3];
- memcpy(PeerAddr,data+4,6);
-
- if(data[0] == 0x3){
- if(!list_empty(&(pWapiInfo->wapiBKIDIdleList))){
- pWapiBkid = (PRT_WAPI_BKID)list_entry(pWapiInfo->wapiBKIDIdleList.next, RT_WAPI_BKID, list);
- list_del_init(&pWapiBkid->list);
- memcpy(pWapiBkid->bkid, data+10, 16);
- WAPI_DATA(WAPI_INIT, "SetKey - BKID", pWapiBkid->bkid, 16);
- list_add_tail(&pWapiBkid->list, &pWapiInfo->wapiBKIDStoreList);
- }
- }else{
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
- if(!memcmp(pWapiSta->PeerMacAddr,PeerAddr,6)){
- pWapiSta->bAuthenticatorInUpdata = false;
- switch(data[0]){
- case 1: //usk
- if(bAuthenticator){ //authenticator
- memcpy(pWapiSta->lastTxUnicastPN,WapiAEPNInitialValueSrc,16);
- if(!bUpdate) { //first
- WAPI_TRACE(WAPI_INIT,"AE fisrt set usk \n");
- pWapiSta->wapiUsk.bSet = true;
- memcpy(pWapiSta->wapiUsk.dataKey,data+10,16);
- memcpy(pWapiSta->wapiUsk.micKey,data+26,16);
- pWapiSta->wapiUsk.keyId = *(data+42);
- pWapiSta->wapiUsk.bTxEnable = true;
- WAPI_DATA(WAPI_INIT, "SetKey - AE USK Data Key", pWapiSta->wapiUsk.dataKey, 16);
- WAPI_DATA(WAPI_INIT, "SetKey - AE USK Mic Key", pWapiSta->wapiUsk.micKey, 16);
- }
- else //update
- {
- WAPI_TRACE(WAPI_INIT, "AE update usk \n");
- pWapiSta->wapiUskUpdate.bSet = true;
- pWapiSta->bAuthenticatorInUpdata = true;
- memcpy(pWapiSta->wapiUskUpdate.dataKey,data+10,16);
- memcpy(pWapiSta->wapiUskUpdate.micKey,data+26,16);
- memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiASUEPNInitialValueSrc,16);
- memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiASUEPNInitialValueSrc,16);
- memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiASUEPNInitialValueSrc,16);
- memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiASUEPNInitialValueSrc,16);
- memcpy(pWapiSta->lastRxUnicastPN,WapiASUEPNInitialValueSrc,16);
- pWapiSta->wapiUskUpdate.keyId = *(data+42);
- pWapiSta->wapiUskUpdate.bTxEnable = true;
- }
- }
- else{
- if(!bUpdate){
- WAPI_TRACE(WAPI_INIT,"ASUE fisrt set usk \n");
- if(bTxEnable){
- pWapiSta->wapiUsk.bTxEnable = true;
- memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
- }else{
- pWapiSta->wapiUsk.bSet = true;
- memcpy(pWapiSta->wapiUsk.dataKey,data+10,16);
- memcpy(pWapiSta->wapiUsk.micKey,data+26,16);
- pWapiSta->wapiUsk.keyId = *(data+42);
- pWapiSta->wapiUsk.bTxEnable = false;
- }
- }else{
- WAPI_TRACE(WAPI_INIT,"ASUE update usk \n");
- if(bTxEnable){
- pWapiSta->wapiUskUpdate.bTxEnable = true;
- if(pWapiSta->wapiUskUpdate.bSet){
- memcpy(pWapiSta->wapiUsk.dataKey,pWapiSta->wapiUskUpdate.dataKey,16);
- memcpy(pWapiSta->wapiUsk.micKey,pWapiSta->wapiUskUpdate.micKey,16);
- pWapiSta->wapiUsk.keyId=pWapiSta->wapiUskUpdate.keyId;
- memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiASUEPNInitialValueSrc,16);
- memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiASUEPNInitialValueSrc,16);
- memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiASUEPNInitialValueSrc,16);
- memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiASUEPNInitialValueSrc,16);
- memcpy(pWapiSta->lastRxUnicastPN,WapiASUEPNInitialValueSrc,16);
- pWapiSta->wapiUskUpdate.bTxEnable = false;
- pWapiSta->wapiUskUpdate.bSet = false;
- }
- memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
- }else{
- pWapiSta->wapiUskUpdate.bSet = true;
- memcpy(pWapiSta->wapiUskUpdate.dataKey,data+10,16);
- memcpy(pWapiSta->wapiUskUpdate.micKey,data+26,16);
- pWapiSta->wapiUskUpdate.keyId = *(data+42);
- pWapiSta->wapiUskUpdate.bTxEnable = false;
- }
- }
- }
- break;
- case 2: //msk
- if(bAuthenticator){ //authenticator
- pWapiInfo->wapiTxMsk.bSet = true;
- memcpy(pWapiInfo->wapiTxMsk.dataKey,data+10,16);
- memcpy(pWapiInfo->wapiTxMsk.micKey,data+26,16);
- pWapiInfo->wapiTxMsk.keyId = *(data+42);
- pWapiInfo->wapiTxMsk.bTxEnable = true;
- memcpy(pWapiInfo->lastTxMulticastPN,WapiAEMultiCastPNInitialValueSrc,16);
-
- if(!bUpdate){ //first
- WAPI_TRACE(WAPI_INIT, "AE fisrt set msk \n");
- if(!pWapiSta->bSetkeyOk)
- pWapiSta->bSetkeyOk = true;
- pWapiInfo->bFirstAuthentiateInProgress= false;
- }else{ //update
- WAPI_TRACE(WAPI_INIT,"AE update msk \n");
- }
-
- WAPI_DATA(WAPI_INIT, "SetKey - AE MSK Data Key", pWapiInfo->wapiTxMsk.dataKey, 16);
- WAPI_DATA(WAPI_INIT, "SetKey - AE MSK Mic Key", pWapiInfo->wapiTxMsk.micKey, 16);
- }
- else{
- if(!bUpdate){
- WAPI_TRACE(WAPI_INIT,"ASUE fisrt set msk \n");
- pWapiSta->wapiMsk.bSet = true;
- memcpy(pWapiSta->wapiMsk.dataKey,data+10,16);
- memcpy(pWapiSta->wapiMsk.micKey,data+26,16);
- pWapiSta->wapiMsk.keyId = *(data+42);
- pWapiSta->wapiMsk.bTxEnable = false;
- if(!pWapiSta->bSetkeyOk)
- pWapiSta->bSetkeyOk = true;
- pWapiInfo->bFirstAuthentiateInProgress= false;
- WAPI_DATA(WAPI_INIT, "SetKey - ASUE MSK Data Key", pWapiSta->wapiMsk.dataKey, 16);
- WAPI_DATA(WAPI_INIT, "SetKey - ASUE MSK Mic Key", pWapiSta->wapiMsk.micKey, 16);
- }else{
- WAPI_TRACE(WAPI_INIT,"ASUE update msk \n");
- pWapiSta->wapiMskUpdate.bSet = true;
- memcpy(pWapiSta->wapiMskUpdate.dataKey,data+10,16);
- memcpy(pWapiSta->wapiMskUpdate.micKey,data+26,16);
- pWapiSta->wapiMskUpdate.keyId = *(data+42);
- pWapiSta->wapiMskUpdate.bTxEnable = false;
- }
- }
- break;
- default:
- WAPI_TRACE(WAPI_ERR,"Unknown Flag \n");
- break;
- }
- }
- }
- }
- WAPI_TRACE(WAPI_INIT, "<===========%s\n", __FUNCTION__);
-}
-
-
-void wapi_test_init(struct _adapter *padapter)
-{
- u8 keybuf[100];
- u8 mac_addr[6]={0x00,0xe0,0x4c,0x72,0x04,0x70};
- u8 UskDataKey[16]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
- u8 UskMicKey[16]={0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f};
- u8 UskId = 0;
- u8 MskDataKey[16]={0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f};
- u8 MskMicKey[16]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f};
- u8 MskId = 0;
-
- WAPI_TRACE(WAPI_INIT, "===========>%s\n", __FUNCTION__);
-
- //Enable Wapi
- WAPI_TRACE(WAPI_INIT, "%s: Enable wapi!!!!\n", __FUNCTION__);
- padapter->wapiInfo.bWapiEnable = true;
- padapter->pairwise_key_type = KEY_TYPE_SMS4;
- ieee->group_key_type = KEY_TYPE_SMS4;
- padapter->wapiInfo.extra_prefix_len = WAPI_EXT_LEN;
- padapter->wapiInfo.extra_postfix_len = SMS4_MIC_LEN;
-
- //set usk
- WAPI_TRACE(WAPI_INIT, "%s: Set USK!!!!\n", __FUNCTION__);
- memset(keybuf,0,100);
- keybuf[0] = 1; //set usk
- keybuf[1] = 1; //enable tx
- keybuf[2] = 1; //AE
- keybuf[3] = 0; //not update
-
- memcpy(keybuf+4,mac_addr,6);
- memcpy(keybuf+10,UskDataKey,16);
- memcpy(keybuf+26,UskMicKey,16);
- keybuf[42]=UskId;
- wapi_test_set_key(padapter, keybuf);
-
- memset(keybuf,0,100);
- keybuf[0] = 1; //set usk
- keybuf[1] = 1; //enable tx
- keybuf[2] = 0; //AE
- keybuf[3] = 0; //not update
-
- memcpy(keybuf+4,mac_addr,6);
- memcpy(keybuf+10,UskDataKey,16);
- memcpy(keybuf+26,UskMicKey,16);
- keybuf[42]=UskId;
- wapi_test_set_key(padapter, keybuf);
-
- //set msk
- WAPI_TRACE(WAPI_INIT, "%s: Set MSK!!!!\n", __FUNCTION__);
- memset(keybuf,0,100);
- keybuf[0] = 2; //set msk
- keybuf[1] = 1; //Enable TX
- keybuf[2] = 1; //AE
- keybuf[3] = 0; //not update
- memcpy(keybuf+4,mac_addr,6);
- memcpy(keybuf+10,MskDataKey,16);
- memcpy(keybuf+26,MskMicKey,16);
- keybuf[42] = MskId;
- wapi_test_set_key(padapter, keybuf);
-
- memset(keybuf,0,100);
- keybuf[0] = 2; //set msk
- keybuf[1] = 1; //Enable TX
- keybuf[2] = 0; //AE
- keybuf[3] = 0; //not update
- memcpy(keybuf+4,mac_addr,6);
- memcpy(keybuf+10,MskDataKey,16);
- memcpy(keybuf+26,MskMicKey,16);
- keybuf[42] = MskId;
- wapi_test_set_key(padapter, keybuf);
- WAPI_TRACE(WAPI_INIT, "<===========%s\n", __FUNCTION__);
-}
-#endif
-
-void rtw_wapi_get_iv(_adapter *padapter,u8 *pRA, u8*IV)
-{
- PWLAN_HEADER_WAPI_EXTENSION pWapiExt = NULL;
- PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
- bool bPNOverflow = false;
- bool bFindMatchPeer = false;
- PRT_WAPI_STA_INFO pWapiSta = NULL;
-
- pWapiExt = (PWLAN_HEADER_WAPI_EXTENSION)IV;
-
- WAPI_DATA(WAPI_RX,"wapi_get_iv: pra",pRA,6);
-
- if(IS_MCAST(pRA)){
- if(!pWapiInfo->wapiTxMsk.bTxEnable){
- WAPI_TRACE(WAPI_ERR,"%s: bTxEnable = 0!!\n",__FUNCTION__);
- return;
- }
-
- if(pWapiInfo->wapiTxMsk.keyId <= 1){
- pWapiExt->KeyIdx = pWapiInfo->wapiTxMsk.keyId;
- pWapiExt->Reserved = 0;
- bPNOverflow = WapiIncreasePN(pWapiInfo->lastTxMulticastPN, 1);
- memcpy(pWapiExt->PN, pWapiInfo->lastTxMulticastPN, 16);
- }
- }
- else
- {
- if(list_empty(&pWapiInfo->wapiSTAUsedList)){
- WAPI_TRACE(WAPI_RX,"rtw_wapi_get_iv: list is empty \n");
- _rtw_memset(IV,10,18);
- return;
- }
- else{
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list){
- WAPI_DATA(WAPI_RX,"rtw_wapi_get_iv: peermacaddr ",pWapiSta->PeerMacAddr,6);
- if (_rtw_memcmp((u8*)pWapiSta->PeerMacAddr, pRA, 6) == _TRUE) {
- bFindMatchPeer = true;
- break;
- }
- }
-
- WAPI_TRACE(WAPI_RX,"bFindMatchPeer: %d \n",bFindMatchPeer);
- WAPI_DATA(WAPI_RX,"Addr",pRA,6);
-
- if (bFindMatchPeer){
- if((!pWapiSta->wapiUskUpdate.bTxEnable) && (!pWapiSta->wapiUsk.bTxEnable))
- return;
-
- if (pWapiSta->wapiUsk.keyId <= 1){
- if(pWapiSta->wapiUskUpdate.bTxEnable)
- pWapiExt->KeyIdx = pWapiSta->wapiUskUpdate.keyId;
- else
- pWapiExt->KeyIdx = pWapiSta->wapiUsk.keyId;
-
- pWapiExt->Reserved = 0;
- bPNOverflow = WapiIncreasePN(pWapiSta->lastTxUnicastPN, 2);
- _rtw_memcpy(pWapiExt->PN, pWapiSta->lastTxUnicastPN, 16);
-
- }
- }
- }
-
- }
-
-}
-
-bool rtw_wapi_drop_for_key_absent(_adapter *padapter,u8 *pRA)
-{
- PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
- bool bFindMatchPeer = false;
- bool bDrop = false;
- PRT_WAPI_STA_INFO pWapiSta = NULL;
- struct security_priv *psecuritypriv = &padapter->securitypriv;
-
- WAPI_DATA(WAPI_RX,"rtw_wapi_drop_for_key_absent: ra ",pRA,6);
-
- if(psecuritypriv->dot11PrivacyAlgrthm == _SMS4_)
- {
- if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
- return true;
-
- if(IS_MCAST(pRA)){
- if(!pWapiInfo->wapiTxMsk.bTxEnable){
- bDrop = true;
- WAPI_TRACE(WAPI_RX,"rtw_wapi_drop_for_key_absent: multicast key is absent \n");
- return bDrop;
- }
- }
- else{
- if(!list_empty(&pWapiInfo->wapiSTAUsedList)){
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list){
- WAPI_DATA(WAPI_RX,"rtw_wapi_drop_for_key_absent: pWapiSta->PeerMacAddr ",pWapiSta->PeerMacAddr,6);
- if (_rtw_memcmp(pRA, pWapiSta->PeerMacAddr, 6) == _TRUE){
- bFindMatchPeer = true;
- break;
- }
- }
- if (bFindMatchPeer) {
- if (!pWapiSta->wapiUsk.bTxEnable){
- bDrop = true;
- WAPI_TRACE(WAPI_RX,"rtw_wapi_drop_for_key_absent: unicast key is absent \n");
- return bDrop;
- }
- }
- else{
- bDrop = true;
- WAPI_TRACE(WAPI_RX,"rtw_wapi_drop_for_key_absent: no peer find \n");
- return bDrop;
- }
-
- }
- else{
- bDrop = true;
- WAPI_TRACE(WAPI_RX,"rtw_wapi_drop_for_key_absent: no sta exist \n");
- return bDrop;
- }
- }
- }
- else
- {
- return bDrop;
- }
-
- return bDrop;
-}
-
-#endif
+#ifdef CONFIG_WAPI_SUPPORT
+
+#include <linux/unistd.h>
+#include <linux/etherdevice.h>
+#include <drv_types.h>
+#include <rtw_wapi.h>
+
+
+u32 wapi_debug_component =
+// WAPI_INIT |
+// WAPI_API |
+// WAPI_TX |
+// WAPI_RX |
+ WAPI_ERR ; //always open err flags on
+
+void WapiFreeAllStaInfo(_adapter *padapter)
+{
+ PRT_WAPI_T pWapiInfo;
+ PRT_WAPI_STA_INFO pWapiStaInfo;
+ PRT_WAPI_BKID pWapiBkid;
+
+ WAPI_TRACE(WAPI_INIT, "===========> %s\n", __FUNCTION__);
+ pWapiInfo = &padapter->wapiInfo;
+
+ //Pust to Idle List
+ rtw_wapi_return_all_sta_info(padapter);
+
+ //Sta Info List
+ while(!list_empty(&(pWapiInfo->wapiSTAIdleList)))
+ {
+ pWapiStaInfo = (PRT_WAPI_STA_INFO)list_entry(pWapiInfo->wapiSTAIdleList.next, RT_WAPI_STA_INFO, list);
+ list_del_init(&pWapiStaInfo->list);
+ }
+
+ //BKID List
+ while(!list_empty(&(pWapiInfo->wapiBKIDIdleList)))
+ {
+ pWapiBkid = (PRT_WAPI_BKID)list_entry(pWapiInfo->wapiBKIDIdleList.next, RT_WAPI_BKID, list);
+ list_del_init(&pWapiBkid->list);
+ }
+ WAPI_TRACE(WAPI_INIT, "<=========== %s\n", __FUNCTION__);
+ return;
+}
+
+void WapiSetIE(_adapter *padapter)
+{
+ PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
+ //PRT_WAPI_BKID pWapiBkid;
+ u16 protocolVer = 1;
+ u16 akmCnt = 1;
+ u16 suiteCnt = 1;
+ u16 capability = 0;
+ u8 OUI[3];
+
+ OUI[0] = 0x00;
+ OUI[1] = 0x14;
+ OUI[2] = 0x72;
+
+ pWapiInfo->wapiIELength = 0;
+//protocol version
+ memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength, &protocolVer, 2);
+ pWapiInfo->wapiIELength +=2;
+//akm
+ memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength, &akmCnt, 2);
+ pWapiInfo->wapiIELength +=2;
+
+ if(pWapiInfo->bWapiPSK){
+ memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength,OUI, 3);
+ pWapiInfo->wapiIELength +=3;
+ pWapiInfo->wapiIE[pWapiInfo->wapiIELength] = 0x2;
+ pWapiInfo->wapiIELength +=1;
+ }else{
+ memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength,OUI, 3);
+ pWapiInfo->wapiIELength +=3;
+ pWapiInfo->wapiIE[pWapiInfo->wapiIELength] = 0x1;
+ pWapiInfo->wapiIELength +=1;
+ }
+
+//usk
+ memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength, &suiteCnt, 2);
+ pWapiInfo->wapiIELength +=2;
+ memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength,OUI, 3);
+ pWapiInfo->wapiIELength +=3;
+ pWapiInfo->wapiIE[pWapiInfo->wapiIELength] = 0x1;
+ pWapiInfo->wapiIELength +=1;
+
+//msk
+ memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength,OUI, 3);
+ pWapiInfo->wapiIELength +=3;
+ pWapiInfo->wapiIE[pWapiInfo->wapiIELength] = 0x1;
+ pWapiInfo->wapiIELength +=1;
+
+//Capbility
+ memcpy(pWapiInfo->wapiIE+pWapiInfo->wapiIELength, &capability, 2);
+ pWapiInfo->wapiIELength +=2;
+}
+
+
+/* PN1 > PN2, return 1,
+ * else return 0.
+ */
+u32 WapiComparePN(u8 *PN1, u8 *PN2)
+{
+ char i;
+
+ if ((NULL == PN1) || (NULL == PN2))
+ return 1;
+
+ // overflow case
+ if ((PN2[15] - PN1[15]) & 0x80)
+ return 1;
+
+ for (i=16; i>0; i--)
+ {
+ if(PN1[i-1] == PN2[i-1])
+ continue;
+ else if(PN1[i-1] > PN2[i-1])
+ return 1;
+ else
+ return 0;
+ }
+
+ return 0;
+}
+
+u8
+WapiGetEntryForCamWrite(_adapter *padapter,u8 *pMacAddr,u8 KID,BOOLEAN IsMsk)
+{
+ PRT_WAPI_T pWapiInfo=NULL;
+ //PRT_WAPI_CAM_ENTRY pEntry=NULL;
+ u8 i=0;
+ u8 ret = 0xff;
+
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+ pWapiInfo = &padapter->wapiInfo;
+
+ //exist?
+ for(i=0;i<WAPI_CAM_ENTRY_NUM;i++)
+ {
+ if(pWapiInfo->wapiCamEntry[i].IsUsed
+ && (_rtw_memcmp(pMacAddr, pWapiInfo->wapiCamEntry[i].PeerMacAddr, ETH_ALEN) == _TRUE)
+ && pWapiInfo->wapiCamEntry[i].keyidx == KID
+ && pWapiInfo->wapiCamEntry[i].type == IsMsk)
+ {
+ ret = pWapiInfo->wapiCamEntry[i].entry_idx; //cover it
+ break;
+ }
+ }
+
+ if(i == WAPI_CAM_ENTRY_NUM) //not found
+ {
+ for(i=0;i<WAPI_CAM_ENTRY_NUM;i++)
+ {
+ if(pWapiInfo->wapiCamEntry[i].IsUsed == 0)
+ {
+ pWapiInfo->wapiCamEntry[i].IsUsed = 1;
+ pWapiInfo->wapiCamEntry[i].type = IsMsk;
+ pWapiInfo->wapiCamEntry[i].keyidx = KID;
+ _rtw_memcpy(pWapiInfo->wapiCamEntry[i].PeerMacAddr, pMacAddr,ETH_ALEN);
+ ret = pWapiInfo->wapiCamEntry[i].entry_idx;
+ break;
+ }
+ }
+ }
+
+ WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
+ return ret;
+
+/*
+ if(RTIsListEmpty(&pWapiInfo->wapiCamIdleList)){
+ RT_TRACE(COMP_SEC,DBG_LOUD,("No Entry for wapi!!!\n"));
+ return 0;
+ }
+
+ pEntry = (PRT_WAPI_CAM_ENTRY)RTRemoveHeadList(&pWapiInfo->wapiCamIdleList);
+ RTInsertTailList(&pWapiInfo->wapiCamUsedList, &pEntry->list);
+
+ RT_TRACE(COMP_SEC,DBG_LOUD,("<====WapiGetCamEntry(),Get Entry Idx:%d.but we just return 4 for test\n",pEntry->entry_idx));
+
+ return pEntry->entry_idx;*/
+}
+
+u8 WapiGetEntryForCamClear(_adapter *padapter,u8 *pPeerMac,u8 keyid,u8 IsMsk)
+{
+ PRT_WAPI_T pWapiInfo=NULL;
+ u8 i=0;
+
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+ pWapiInfo = &padapter->wapiInfo;
+
+ for(i=0;i<WAPI_CAM_ENTRY_NUM;i++)
+ {
+ if(pWapiInfo->wapiCamEntry[i].IsUsed
+ && (_rtw_memcmp(pPeerMac, pWapiInfo->wapiCamEntry[i].PeerMacAddr, ETH_ALEN) == _TRUE)
+ && pWapiInfo->wapiCamEntry[i].keyidx == keyid
+ && pWapiInfo->wapiCamEntry[i].type == IsMsk)
+ {
+ pWapiInfo->wapiCamEntry[i].IsUsed = 0;
+ pWapiInfo->wapiCamEntry[i].keyidx = 2;
+ _rtw_memset(pWapiInfo->wapiCamEntry[i].PeerMacAddr,0,ETH_ALEN);
+
+ WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
+ return pWapiInfo->wapiCamEntry[i].entry_idx;
+ }
+ }
+
+ WAPI_TRACE(WAPI_API,"<====WapiGetReturnCamEntry(), No this cam entry.\n");
+ return 0xff;
+/*
+ if(RTIsListEmpty(&pWapiInfo->wapiCamUsedList)){
+ RT_TRACE(COMP_SEC,DBG_LOUD,("No Entry for wapi!!!\n"));
+ return FALSE;
+ }
+
+ pList = &pWapiInfo->wapiCamUsedList;
+ while(pList->Flink != &pWapiInfo->wapiCamUsedList)
+ {
+ pEntry = (PRT_WAPI_CAM_ENTRY)pList->Flink;
+ if(PlatformCompareMemory(pPeerMac,pEntry->PeerMacAddr, ETHER_ADDRLEN)== 0
+ && keyid == pEntry->keyidx)
+ {
+ RTRemoveEntryList(pList);
+ RTInsertHeadList(&pWapiInfo->wapiCamIdleList, pList);
+ return pEntry->entry_idx;
+ }
+ pList = pList->Flink;
+ }
+
+ return 0;
+*/
+}
+
+void
+WapiResetAllCamEntry(_adapter *padapter)
+{
+ PRT_WAPI_T pWapiInfo;
+ int i;
+
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+ pWapiInfo = &padapter->wapiInfo;
+
+ for (i=0;i<WAPI_CAM_ENTRY_NUM;i++)
+ {
+ _rtw_memset(pWapiInfo->wapiCamEntry[i].PeerMacAddr, 0, ETH_ALEN);
+ pWapiInfo->wapiCamEntry[i].IsUsed = 0;
+ pWapiInfo->wapiCamEntry[i].keyidx = 2; //invalid
+ pWapiInfo->wapiCamEntry[i].entry_idx = 4+i*2;
+ }
+
+ WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
+
+ return;
+}
+
+u8 WapiWriteOneCamEntry(
+ _adapter *padapter,
+ u8 *pMacAddr,
+ u8 KeyId,
+ u8 EntryId,
+ u8 EncAlg,
+ u8 bGroupKey,
+ u8 *pKey
+)
+{
+ u8 retVal = 0;
+ u16 usConfig = 0;
+
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+ if(EntryId >= 32)
+ {
+ WAPI_TRACE(WAPI_ERR, "<=== CamAddOneEntry(): ulKeyId exceed!\n");
+ return retVal;
+ }
+
+ usConfig=usConfig|(0x01<<15)|((u16)(EncAlg)<<2)|(KeyId);
+
+ if(EncAlg == _SMS4_ )
+ {
+ if(bGroupKey == 1)
+ usConfig |= (0x01<<6);
+ if((EntryId % 2)==1) // ==0 sec key; == 1mic key
+ usConfig |= (0x01<<5);
+ }
+
+ write_cam(padapter, EntryId, usConfig, pMacAddr, pKey);
+
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+ return 1;
+}
+
+void rtw_wapi_init(_adapter *padapter)
+{
+ PRT_WAPI_T pWapiInfo;
+ int i;
+
+ WAPI_TRACE(WAPI_INIT, "===========> %s\n", __FUNCTION__);
+ RT_ASSERT_RET(padapter);
+
+ if (!padapter->WapiSupport)
+ {
+ WAPI_TRACE(WAPI_INIT, "<========== %s, WAPI not supported!\n", __FUNCTION__);
+ return;
+ }
+
+ pWapiInfo = &padapter->wapiInfo;
+ pWapiInfo->bWapiEnable = false;
+
+ //Init BKID List
+ INIT_LIST_HEAD(&pWapiInfo->wapiBKIDIdleList);
+ INIT_LIST_HEAD(&pWapiInfo->wapiBKIDStoreList);
+ for(i=0;i<WAPI_MAX_BKID_NUM;i++)
+ {
+ list_add_tail(&pWapiInfo->wapiBKID[i].list, &pWapiInfo->wapiBKIDIdleList);
+ }
+
+ //Init STA List
+ INIT_LIST_HEAD(&pWapiInfo->wapiSTAIdleList);
+ INIT_LIST_HEAD(&pWapiInfo->wapiSTAUsedList);
+ for(i=0;i<WAPI_MAX_STAINFO_NUM;i++)
+ {
+ list_add_tail(&pWapiInfo->wapiSta[i].list, &pWapiInfo->wapiSTAIdleList);
+ }
+
+ for (i=0;i<WAPI_CAM_ENTRY_NUM;i++)
+ {
+ pWapiInfo->wapiCamEntry[i].IsUsed = 0;
+ pWapiInfo->wapiCamEntry[i].keyidx = 2; //invalid
+ pWapiInfo->wapiCamEntry[i].entry_idx = 4+i*2;
+ }
+
+ WAPI_TRACE(WAPI_INIT, "<========== %s\n", __FUNCTION__);
+}
+
+void rtw_wapi_free(_adapter *padapter)
+{
+ WAPI_TRACE(WAPI_INIT, "===========> %s\n", __FUNCTION__);
+ RT_ASSERT_RET(padapter);
+
+ if (!padapter->WapiSupport)
+ {
+ WAPI_TRACE(WAPI_INIT, "<========== %s, WAPI not supported!\n", __FUNCTION__);
+ return;
+ }
+
+ WapiFreeAllStaInfo(padapter);
+
+ WAPI_TRACE(WAPI_INIT, "<========== %s\n", __FUNCTION__);
+}
+
+void rtw_wapi_disable_tx(_adapter *padapter)
+{
+ WAPI_TRACE(WAPI_INIT, "===========> %s\n", __FUNCTION__);
+ RT_ASSERT_RET(padapter);
+
+ if (!padapter->WapiSupport)
+ {
+ WAPI_TRACE(WAPI_INIT, "<========== %s, WAPI not supported!\n", __FUNCTION__);
+ return;
+ }
+
+ padapter->wapiInfo.wapiTxMsk.bTxEnable = false;
+ padapter->wapiInfo.wapiTxMsk.bSet = false;
+
+ WAPI_TRACE(WAPI_INIT, "<========== %s\n", __FUNCTION__);
+}
+
+u8 rtw_wapi_is_wai_packet(_adapter* padapter,u8 *pkt_data)
+{
+ PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+ PRT_WAPI_STA_INFO pWapiSta = NULL;
+ u8 WaiPkt = 0, *pTaddr, bFind = false;
+ u8 Offset_TypeWAI = 0 ; // (mac header len + llc length)
+
+ WAPI_TRACE(WAPI_TX|WAPI_RX, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return 0;
+ }
+
+ Offset_TypeWAI = 24 + 6 ;
+
+ //YJ,add,091103. Data frame may also have skb->data[30]=0x88 and skb->data[31]=0xb4.
+ if ((pkt_data[1]&0x40) !=0)
+ {
+ //DBG_871X("data is privacy \n");
+ return 0;
+ }
+
+ pTaddr = GetAddr2Ptr(pkt_data);
+ if(list_empty(&pWapiInfo->wapiSTAUsedList)){
+ bFind = false;
+ }else{
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list){
+ if (_rtw_memcmp(pTaddr, pWapiSta->PeerMacAddr, 6) == _TRUE) {
+ bFind = true;
+ break;
+ }
+ }
+ }
+
+ WAPI_TRACE(WAPI_TX|WAPI_RX, "%s: bFind=%d pTaddr="MAC_FMT"\n", __FUNCTION__, bFind, MAC_ARG(pTaddr));
+
+ if (pkt_data[0] == WIFI_QOS_DATA_TYPE)
+ {
+ Offset_TypeWAI += 2;
+ }
+
+ // 88b4?
+ if( (pkt_data[Offset_TypeWAI]==0x88) && (pkt_data[Offset_TypeWAI+1]==0xb4) ){
+ WaiPkt = pkt_data[Offset_TypeWAI+5];
+
+ psecuritypriv->hw_decrypted = _TRUE;
+ }else{
+ WAPI_TRACE(WAPI_TX|WAPI_RX, "%s(): non wai packet\n",__FUNCTION__);
+ }
+
+ WAPI_TRACE(WAPI_TX|WAPI_RX, "%s(): Recvd WAI frame. IsWAIPkt(%d)\n",__FUNCTION__, WaiPkt);
+
+ return WaiPkt;
+}
+
+
+void rtw_wapi_update_info(_adapter *padapter, union recv_frame *precv_frame)
+{
+ PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
+ struct recv_frame_hdr *precv_hdr;
+ u8 *ptr;
+ u8 *pTA;
+ u8 *pRecvPN;
+
+
+ WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return;
+ }
+
+ precv_hdr = &precv_frame->u.hdr;
+ ptr = precv_hdr->rx_data;
+
+ if (precv_hdr->attrib.qos == 1)
+ {
+ precv_hdr->UserPriority = GetTid(ptr);
+ }
+ else
+ {
+ precv_hdr->UserPriority = 0;
+ }
+
+ pTA = GetAddr2Ptr(ptr);
+ _rtw_memcpy((u8 *)precv_hdr->WapiSrcAddr, pTA, 6);
+ pRecvPN = ptr + precv_hdr->attrib.hdrlen + 2;
+ _rtw_memcpy((u8 *)precv_hdr->WapiTempPN, pRecvPN, 16);
+
+ WAPI_TRACE(WAPI_RX, "<========== %s\n", __FUNCTION__);
+}
+
+/****************************************************************************
+TRUE-----------------Drop
+FALSE---------------- handle
+add to support WAPI to N-mode
+*****************************************************************************/
+u8 rtw_wapi_check_for_drop(
+ _adapter *padapter,
+ union recv_frame *precv_frame
+)
+{
+ PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
+ u8 *pLastRecvPN = NULL;
+ u8 bFind = false;
+ PRT_WAPI_STA_INFO pWapiSta = NULL;
+ u8 bDrop = false;
+ struct recv_frame_hdr *precv_hdr = &precv_frame->u.hdr;
+ u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+ u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+ u8 *ptr = precv_frame->u.hdr.rx_data;
+ int i;
+
+ WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return false;
+ }
+
+ if(precv_hdr->bIsWaiPacket !=0)
+ {
+ if(precv_hdr->bIsWaiPacket== 0x8)
+ {
+
+ DBG_871X("rtw_wapi_check_for_drop: dump packet \n");
+ for(i=0;i<50;i++)
+ {
+ DBG_871X("%02X ",ptr[i]);
+ if((i+1) %8 ==0)
+ DBG_871X("\n");
+ }
+ DBG_871X("\n rtw_wapi_check_for_drop: dump packet \n");
+
+ for(i=0;i<16;i++)
+ {
+ if(ptr[i+27] !=0)
+ break;
+ }
+
+ if(i== 16)
+ {
+ WAPI_TRACE(WAPI_RX,"rtw_wapi_check_for_drop: drop with zero BKID \n");
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ return false;
+ }
+
+ if(list_empty(&pWapiInfo->wapiSTAUsedList)){
+ bFind = false;
+ }else{
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
+ if (_rtw_memcmp(precv_hdr->WapiSrcAddr, pWapiSta->PeerMacAddr, ETH_ALEN) == _TRUE) {
+ bFind = true;
+ break;
+ }
+ }
+ }
+ WAPI_TRACE(WAPI_RX, "%s: bFind=%d prxb->WapiSrcAddr="MAC_FMT"\n", __FUNCTION__, bFind, MAC_ARG(precv_hdr->WapiSrcAddr));
+
+ if(bFind)
+ {
+ if(IS_MCAST(precv_hdr->attrib.ra))
+ {
+ WAPI_TRACE(WAPI_RX,"rtw_wapi_check_for_drop: multicast case \n");
+ pLastRecvPN = pWapiSta->lastRxMulticastPN;
+ }
+ else
+ {
+ WAPI_TRACE(WAPI_RX,"rtw_wapi_check_for_drop: unicast case \n");
+ switch(precv_hdr->UserPriority)
+ {
+ case 0:
+ case 3:
+ pLastRecvPN = pWapiSta->lastRxUnicastPNBEQueue;
+ break;
+ case 1:
+ case 2:
+ pLastRecvPN = pWapiSta->lastRxUnicastPNBKQueue;
+ break;
+ case 4:
+ case 5:
+ pLastRecvPN = pWapiSta->lastRxUnicastPNVIQueue;
+ break;
+ case 6:
+ case 7:
+ pLastRecvPN = pWapiSta->lastRxUnicastPNVOQueue;
+ break;
+ default:
+ WAPI_TRACE(WAPI_ERR,"%s: Unknown TID \n",__FUNCTION__);
+ break;
+ }
+ }
+
+ if(!WapiComparePN(precv_hdr->WapiTempPN,pLastRecvPN))
+ {
+ WAPI_TRACE(WAPI_RX,"%s: Equal PN!!\n",__FUNCTION__);
+ if(IS_MCAST(precv_hdr->attrib.ra))
+ _rtw_memcpy(pLastRecvPN,WapiAEMultiCastPNInitialValueSrc,16);
+ else
+ _rtw_memcpy(pLastRecvPN,WapiAEPNInitialValueSrc,16);
+ bDrop = true;
+ }
+ else
+ {
+ _rtw_memcpy(pLastRecvPN,precv_hdr->WapiTempPN,16);
+ }
+ }
+
+ WAPI_TRACE(WAPI_RX, "<========== %s\n", __FUNCTION__);
+ return bDrop;
+}
+
+void rtw_build_probe_resp_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib)
+{
+ PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
+ u8 WapiIELength = 0;
+
+ WAPI_TRACE(WAPI_MLME, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported!\n", __FUNCTION__);
+ return;
+ }
+
+ WapiSetIE(padapter);
+ WapiIELength = pWapiInfo->wapiIELength;
+ pframe[0] = _WAPI_IE_;
+ pframe[1] = WapiIELength;
+ _rtw_memcpy(pframe+2, pWapiInfo->wapiIE, WapiIELength);
+ pframe += WapiIELength+2;
+ pattrib->pktlen += WapiIELength+2;
+
+ WAPI_TRACE(WAPI_MLME, "<========== %s\n", __FUNCTION__);
+}
+
+void rtw_build_beacon_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib)
+{
+ PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
+ u8 WapiIELength = 0;
+ WAPI_TRACE(WAPI_MLME, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported!\n", __FUNCTION__);
+ return;
+ }
+
+ WapiSetIE(padapter);
+ WapiIELength = pWapiInfo->wapiIELength;
+ pframe[0] = _WAPI_IE_;
+ pframe[1] = WapiIELength;
+ _rtw_memcpy(pframe+2, pWapiInfo->wapiIE, WapiIELength);
+ pframe += WapiIELength+2;
+ pattrib->pktlen += WapiIELength+2;
+
+ WAPI_TRACE(WAPI_MLME, "<========== %s\n", __FUNCTION__);
+}
+
+void rtw_build_assoc_req_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib)
+{
+ PRT_WAPI_BKID pWapiBKID;
+ u16 bkidNum;
+ PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
+ u8 WapiIELength = 0;
+
+ WAPI_TRACE(WAPI_MLME, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported!\n", __FUNCTION__);
+ return;
+ }
+
+ WapiSetIE(padapter);
+ WapiIELength = pWapiInfo->wapiIELength;
+ bkidNum = 0;
+ if(!list_empty(&(pWapiInfo->wapiBKIDStoreList))){
+ list_for_each_entry(pWapiBKID, &pWapiInfo->wapiBKIDStoreList, list) {
+ bkidNum ++;
+ _rtw_memcpy(pWapiInfo->wapiIE+WapiIELength+2, pWapiBKID->bkid,16);
+ WapiIELength += 16;
+ }
+ }
+ _rtw_memcpy(pWapiInfo->wapiIE+WapiIELength, &bkidNum, 2);
+ WapiIELength += 2;
+
+ pframe[0] = _WAPI_IE_;
+ pframe[1] = WapiIELength;
+ _rtw_memcpy(pframe+2, pWapiInfo->wapiIE, WapiIELength);
+ pframe += WapiIELength+2;
+ pattrib->pktlen += WapiIELength+2;
+ WAPI_TRACE(WAPI_MLME, "<========== %s\n", __FUNCTION__);
+}
+
+void rtw_wapi_on_assoc_ok(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
+{
+ PRT_WAPI_T pWapiInfo = &(padapter->wapiInfo);
+ PRT_WAPI_STA_INFO pWapiSta;
+ u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+ //u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+ u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+
+ WAPI_TRACE(WAPI_MLME, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return;
+ }
+
+ pWapiSta =(PRT_WAPI_STA_INFO)list_entry(pWapiInfo->wapiSTAIdleList.next, RT_WAPI_STA_INFO, list);
+ list_del_init(&pWapiSta->list);
+ list_add_tail(&pWapiSta->list, &pWapiInfo->wapiSTAUsedList);
+ _rtw_memcpy(pWapiSta->PeerMacAddr,padapter->mlmeextpriv.mlmext_info.network.MacAddress,6);
+ _rtw_memcpy(pWapiSta->lastRxMulticastPN, WapiAEMultiCastPNInitialValueSrc, 16);
+ _rtw_memcpy(pWapiSta->lastRxUnicastPN, WapiAEPNInitialValueSrc, 16);
+
+ //For chenk PN error with Qos Data after s3: add by ylb 20111114
+ _rtw_memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiAEPNInitialValueSrc,16);
+ _rtw_memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiAEPNInitialValueSrc,16);
+ _rtw_memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiAEPNInitialValueSrc,16);
+ _rtw_memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiAEPNInitialValueSrc,16);
+
+ WAPI_TRACE(WAPI_MLME, "<========== %s\n", __FUNCTION__);
+}
+
+
+void rtw_wapi_return_one_sta_info(_adapter *padapter, u8 *MacAddr)
+{
+ PRT_WAPI_T pWapiInfo;
+ PRT_WAPI_STA_INFO pWapiStaInfo = NULL;
+ PRT_WAPI_BKID pWapiBkid = NULL;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+
+ pWapiInfo = &padapter->wapiInfo;
+
+ WAPI_TRACE(WAPI_API, "==========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return;
+ }
+
+ if(check_fwstate(pmlmepriv, WIFI_STATION_STATE))
+ {
+ while(!list_empty(&(pWapiInfo->wapiBKIDStoreList)))
+ {
+ pWapiBkid = (PRT_WAPI_BKID)list_entry(pWapiInfo->wapiBKIDStoreList.next, RT_WAPI_BKID, list);
+ list_del_init(&pWapiBkid->list);
+ _rtw_memset(pWapiBkid->bkid,0,16);
+ list_add_tail(&pWapiBkid->list, &pWapiInfo->wapiBKIDIdleList);
+ }
+ }
+
+
+ WAPI_TRACE(WAPI_API, " %s: after clear bkid \n", __FUNCTION__);
+
+
+ //Remove STA info
+ if(list_empty(&(pWapiInfo->wapiSTAUsedList))){
+ WAPI_TRACE(WAPI_API, " %s: wapiSTAUsedList is null \n", __FUNCTION__);
+ return;
+ }else{
+
+ WAPI_TRACE(WAPI_API, " %s: wapiSTAUsedList is not null \n", __FUNCTION__);
+#if 0
+ pWapiStaInfo=(PRT_WAPI_STA_INFO)list_entry((pWapiInfo->wapiSTAUsedList.next),RT_WAPI_STA_INFO,list);
+
+ list_for_each_entry(pWapiStaInfo, &(pWapiInfo->wapiSTAUsedList), list) {
+
+ DBG_871X("MAC Addr %02x-%02x-%02x-%02x-%02x-%02x \n",MacAddr[0],MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5]);
+
+
+ DBG_871X("peer Addr %02x-%02x-%02x-%02x-%02x-%02x \n",pWapiStaInfo->PeerMacAddr[0],pWapiStaInfo->PeerMacAddr[1],pWapiStaInfo->PeerMacAddr[2],pWapiStaInfo->PeerMacAddr[3],pWapiStaInfo->PeerMacAddr[4],pWapiStaInfo->PeerMacAddr[5]);
+
+ if(pWapiStaInfo == NULL)
+ {
+ WAPI_TRACE(WAPI_API, " %s: pWapiStaInfo == NULL Case \n", __FUNCTION__);
+ return;
+ }
+
+ if(pWapiStaInfo->PeerMacAddr == NULL)
+ {
+ WAPI_TRACE(WAPI_API, " %s: pWapiStaInfo->PeerMacAddr == NULL Case \n", __FUNCTION__);
+ return;
+ }
+
+ if(MacAddr == NULL)
+ {
+ WAPI_TRACE(WAPI_API, " %s: MacAddr == NULL Case \n", __FUNCTION__);
+ return;
+ }
+
+ if (_rtw_memcmp(pWapiStaInfo->PeerMacAddr, MacAddr, ETH_ALEN) == _TRUE) {
+ pWapiStaInfo->bAuthenticateInProgress = false;
+ pWapiStaInfo->bSetkeyOk = false;
+ _rtw_memset(pWapiStaInfo->PeerMacAddr,0,ETH_ALEN);
+ list_del_init(&pWapiStaInfo->list);
+ list_add_tail(&pWapiStaInfo->list, &pWapiInfo->wapiSTAIdleList);
+ break;
+ }
+
+ }
+#endif
+
+ while(!list_empty(&(pWapiInfo->wapiSTAUsedList)))
+ {
+ pWapiStaInfo = (PRT_WAPI_STA_INFO)list_entry(pWapiInfo->wapiSTAUsedList.next, RT_WAPI_STA_INFO, list);
+
+ DBG_871X("peer Addr %02x-%02x-%02x-%02x-%02x-%02x \n",pWapiStaInfo->PeerMacAddr[0],pWapiStaInfo->PeerMacAddr[1],pWapiStaInfo->PeerMacAddr[2],pWapiStaInfo->PeerMacAddr[3],pWapiStaInfo->PeerMacAddr[4],pWapiStaInfo->PeerMacAddr[5]);
+
+ list_del_init(&pWapiStaInfo->list);
+ memset(pWapiStaInfo->PeerMacAddr,0,ETH_ALEN);
+ pWapiStaInfo->bSetkeyOk = 0;
+ list_add_tail(&pWapiStaInfo->list, &pWapiInfo->wapiSTAIdleList);
+ }
+
+ }
+
+ WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
+ return;
+}
+
+void rtw_wapi_return_all_sta_info(_adapter *padapter)
+{
+ PRT_WAPI_T pWapiInfo;
+ PRT_WAPI_STA_INFO pWapiStaInfo;
+ PRT_WAPI_BKID pWapiBkid;
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+ pWapiInfo = &padapter->wapiInfo;
+
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return;
+ }
+
+ //Sta Info List
+ while(!list_empty(&(pWapiInfo->wapiSTAUsedList)))
+ {
+ pWapiStaInfo = (PRT_WAPI_STA_INFO)list_entry(pWapiInfo->wapiSTAUsedList.next, RT_WAPI_STA_INFO, list);
+ list_del_init(&pWapiStaInfo->list);
+ memset(pWapiStaInfo->PeerMacAddr,0,ETH_ALEN);
+ pWapiStaInfo->bSetkeyOk = 0;
+ list_add_tail(&pWapiStaInfo->list, &pWapiInfo->wapiSTAIdleList);
+ }
+
+ //BKID List
+ while(!list_empty(&(pWapiInfo->wapiBKIDStoreList)))
+ {
+ pWapiBkid = (PRT_WAPI_BKID)list_entry(pWapiInfo->wapiBKIDStoreList.next, RT_WAPI_BKID, list);
+ list_del_init(&pWapiBkid->list);
+ memset(pWapiBkid->bkid,0,16);
+ list_add_tail(&pWapiBkid->list, &pWapiInfo->wapiBKIDIdleList);
+ }
+ WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
+}
+
+void rtw_wapi_clear_cam_entry(_adapter *padapter, u8 *pMacAddr)
+{
+ u8 UcIndex = 0;
+
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return;
+ }
+
+ UcIndex = WapiGetEntryForCamClear(padapter, pMacAddr, 0, 0);
+ if(UcIndex != 0xff){
+ //CAM_mark_invalid(Adapter, UcIndex);
+ CAM_empty_entry(padapter, UcIndex);
+ }
+
+ UcIndex = WapiGetEntryForCamClear(padapter, pMacAddr, 1, 0);
+ if(UcIndex != 0xff){
+ //CAM_mark_invalid(Adapter, UcIndex);
+ CAM_empty_entry(padapter, UcIndex);
+ }
+
+ UcIndex = WapiGetEntryForCamClear(padapter, pMacAddr, 0, 1);
+ if(UcIndex != 0xff){
+ //CAM_mark_invalid(Adapter, UcIndex);
+ CAM_empty_entry(padapter, UcIndex);
+ }
+
+ UcIndex = WapiGetEntryForCamClear(padapter, pMacAddr, 1, 1);
+ if(UcIndex != 0xff){
+ //CAM_mark_invalid(padapter, UcIndex);
+ CAM_empty_entry(padapter, UcIndex);
+ }
+
+ WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
+}
+
+void rtw_wapi_clear_all_cam_entry(_adapter *padapter)
+{
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_MLME, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return;
+ }
+
+ invalidate_cam_all(padapter); // is this ok?
+ WapiResetAllCamEntry(padapter);
+
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+}
+
+void rtw_wapi_set_key(_adapter *padapter, RT_WAPI_KEY *pWapiKey, RT_WAPI_STA_INFO *pWapiSta, u8 bGroupKey, u8 bUseDefaultKey)
+{
+ PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
+ u8 *pMacAddr = pWapiSta->PeerMacAddr;
+ u32 EntryId = 0;
+ BOOLEAN IsPairWise = false ;
+ u8 EncAlgo;
+
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_API, "<========== %s, WAPI not supported or not enabled!\n", __FUNCTION__);
+ return;
+ }
+
+ EncAlgo = _SMS4_;
+
+ //For Tx bc/mc pkt,use defualt key entry
+ if(bUseDefaultKey)
+ {
+ // when WAPI update key, keyid will be 0 or 1 by turns.
+ if (pWapiKey->keyId == 0)
+ EntryId = 0;
+ else
+ EntryId = 2;
+ }
+ else
+ {
+ // tx/rx unicast pkt, or rx broadcast, find the key entry by peer's MacAddr
+ EntryId = WapiGetEntryForCamWrite(padapter,pMacAddr,pWapiKey->keyId,bGroupKey);
+ }
+
+ if(EntryId == 0xff){
+ WAPI_TRACE(WAPI_API, "===>No entry for WAPI setkey! !!\n");
+ return;
+ }
+
+ //EntryId is also used to diff Sec key and Mic key
+ //Sec Key
+ WapiWriteOneCamEntry(padapter,
+ pMacAddr,
+ pWapiKey->keyId, //keyid
+ EntryId, //entry
+ EncAlgo, //type
+ bGroupKey, //pairwise or group key
+ pWapiKey->dataKey);
+ //MIC key
+ WapiWriteOneCamEntry(padapter,
+ pMacAddr,
+ pWapiKey->keyId, //keyid
+ EntryId+1, //entry
+ EncAlgo, //type
+ bGroupKey, //pairwise or group key
+ pWapiKey->micKey);
+
+ WAPI_TRACE(WAPI_API, "Set Wapi Key :KeyId:%d,EntryId:%d,PairwiseKey:%d.\n",pWapiKey->keyId,EntryId,!bGroupKey);
+ WAPI_TRACE(WAPI_API, "===========> %s\n", __FUNCTION__);
+
+}
+
+#if 0
+//YJ,test,091013
+void wapi_test_set_key(struct _adapter *padapter, u8* buf)
+{ /*Data: keyType(1) + bTxEnable(1) + bAuthenticator(1) + bUpdate(1) + PeerAddr(6) + DataKey(16) + MicKey(16) + KeyId(1)*/
+ PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
+ PRT_WAPI_BKID pWapiBkid;
+ PRT_WAPI_STA_INFO pWapiSta;
+ u8 data[43];
+ bool bTxEnable;
+ bool bUpdate;
+ bool bAuthenticator;
+ u8 PeerAddr[6];
+ u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+ u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+ u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+
+ WAPI_TRACE(WAPI_INIT, "===========>%s\n", __FUNCTION__);
+
+ if (!padapter->WapiSupport){
+ return;
+ }
+
+ copy_from_user(data, buf, 43);
+ bTxEnable = data[1];
+ bAuthenticator = data[2];
+ bUpdate = data[3];
+ memcpy(PeerAddr,data+4,6);
+
+ if(data[0] == 0x3){
+ if(!list_empty(&(pWapiInfo->wapiBKIDIdleList))){
+ pWapiBkid = (PRT_WAPI_BKID)list_entry(pWapiInfo->wapiBKIDIdleList.next, RT_WAPI_BKID, list);
+ list_del_init(&pWapiBkid->list);
+ memcpy(pWapiBkid->bkid, data+10, 16);
+ WAPI_DATA(WAPI_INIT, "SetKey - BKID", pWapiBkid->bkid, 16);
+ list_add_tail(&pWapiBkid->list, &pWapiInfo->wapiBKIDStoreList);
+ }
+ }else{
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
+ if(!memcmp(pWapiSta->PeerMacAddr,PeerAddr,6)){
+ pWapiSta->bAuthenticatorInUpdata = false;
+ switch(data[0]){
+ case 1: //usk
+ if(bAuthenticator){ //authenticator
+ memcpy(pWapiSta->lastTxUnicastPN,WapiAEPNInitialValueSrc,16);
+ if(!bUpdate) { //first
+ WAPI_TRACE(WAPI_INIT,"AE fisrt set usk \n");
+ pWapiSta->wapiUsk.bSet = true;
+ memcpy(pWapiSta->wapiUsk.dataKey,data+10,16);
+ memcpy(pWapiSta->wapiUsk.micKey,data+26,16);
+ pWapiSta->wapiUsk.keyId = *(data+42);
+ pWapiSta->wapiUsk.bTxEnable = true;
+ WAPI_DATA(WAPI_INIT, "SetKey - AE USK Data Key", pWapiSta->wapiUsk.dataKey, 16);
+ WAPI_DATA(WAPI_INIT, "SetKey - AE USK Mic Key", pWapiSta->wapiUsk.micKey, 16);
+ }
+ else //update
+ {
+ WAPI_TRACE(WAPI_INIT, "AE update usk \n");
+ pWapiSta->wapiUskUpdate.bSet = true;
+ pWapiSta->bAuthenticatorInUpdata = true;
+ memcpy(pWapiSta->wapiUskUpdate.dataKey,data+10,16);
+ memcpy(pWapiSta->wapiUskUpdate.micKey,data+26,16);
+ memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiASUEPNInitialValueSrc,16);
+ memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiASUEPNInitialValueSrc,16);
+ memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiASUEPNInitialValueSrc,16);
+ memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiASUEPNInitialValueSrc,16);
+ memcpy(pWapiSta->lastRxUnicastPN,WapiASUEPNInitialValueSrc,16);
+ pWapiSta->wapiUskUpdate.keyId = *(data+42);
+ pWapiSta->wapiUskUpdate.bTxEnable = true;
+ }
+ }
+ else{
+ if(!bUpdate){
+ WAPI_TRACE(WAPI_INIT,"ASUE fisrt set usk \n");
+ if(bTxEnable){
+ pWapiSta->wapiUsk.bTxEnable = true;
+ memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
+ }else{
+ pWapiSta->wapiUsk.bSet = true;
+ memcpy(pWapiSta->wapiUsk.dataKey,data+10,16);
+ memcpy(pWapiSta->wapiUsk.micKey,data+26,16);
+ pWapiSta->wapiUsk.keyId = *(data+42);
+ pWapiSta->wapiUsk.bTxEnable = false;
+ }
+ }else{
+ WAPI_TRACE(WAPI_INIT,"ASUE update usk \n");
+ if(bTxEnable){
+ pWapiSta->wapiUskUpdate.bTxEnable = true;
+ if(pWapiSta->wapiUskUpdate.bSet){
+ memcpy(pWapiSta->wapiUsk.dataKey,pWapiSta->wapiUskUpdate.dataKey,16);
+ memcpy(pWapiSta->wapiUsk.micKey,pWapiSta->wapiUskUpdate.micKey,16);
+ pWapiSta->wapiUsk.keyId=pWapiSta->wapiUskUpdate.keyId;
+ memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiASUEPNInitialValueSrc,16);
+ memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiASUEPNInitialValueSrc,16);
+ memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiASUEPNInitialValueSrc,16);
+ memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiASUEPNInitialValueSrc,16);
+ memcpy(pWapiSta->lastRxUnicastPN,WapiASUEPNInitialValueSrc,16);
+ pWapiSta->wapiUskUpdate.bTxEnable = false;
+ pWapiSta->wapiUskUpdate.bSet = false;
+ }
+ memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
+ }else{
+ pWapiSta->wapiUskUpdate.bSet = true;
+ memcpy(pWapiSta->wapiUskUpdate.dataKey,data+10,16);
+ memcpy(pWapiSta->wapiUskUpdate.micKey,data+26,16);
+ pWapiSta->wapiUskUpdate.keyId = *(data+42);
+ pWapiSta->wapiUskUpdate.bTxEnable = false;
+ }
+ }
+ }
+ break;
+ case 2: //msk
+ if(bAuthenticator){ //authenticator
+ pWapiInfo->wapiTxMsk.bSet = true;
+ memcpy(pWapiInfo->wapiTxMsk.dataKey,data+10,16);
+ memcpy(pWapiInfo->wapiTxMsk.micKey,data+26,16);
+ pWapiInfo->wapiTxMsk.keyId = *(data+42);
+ pWapiInfo->wapiTxMsk.bTxEnable = true;
+ memcpy(pWapiInfo->lastTxMulticastPN,WapiAEMultiCastPNInitialValueSrc,16);
+
+ if(!bUpdate){ //first
+ WAPI_TRACE(WAPI_INIT, "AE fisrt set msk \n");
+ if(!pWapiSta->bSetkeyOk)
+ pWapiSta->bSetkeyOk = true;
+ pWapiInfo->bFirstAuthentiateInProgress= false;
+ }else{ //update
+ WAPI_TRACE(WAPI_INIT,"AE update msk \n");
+ }
+
+ WAPI_DATA(WAPI_INIT, "SetKey - AE MSK Data Key", pWapiInfo->wapiTxMsk.dataKey, 16);
+ WAPI_DATA(WAPI_INIT, "SetKey - AE MSK Mic Key", pWapiInfo->wapiTxMsk.micKey, 16);
+ }
+ else{
+ if(!bUpdate){
+ WAPI_TRACE(WAPI_INIT,"ASUE fisrt set msk \n");
+ pWapiSta->wapiMsk.bSet = true;
+ memcpy(pWapiSta->wapiMsk.dataKey,data+10,16);
+ memcpy(pWapiSta->wapiMsk.micKey,data+26,16);
+ pWapiSta->wapiMsk.keyId = *(data+42);
+ pWapiSta->wapiMsk.bTxEnable = false;
+ if(!pWapiSta->bSetkeyOk)
+ pWapiSta->bSetkeyOk = true;
+ pWapiInfo->bFirstAuthentiateInProgress= false;
+ WAPI_DATA(WAPI_INIT, "SetKey - ASUE MSK Data Key", pWapiSta->wapiMsk.dataKey, 16);
+ WAPI_DATA(WAPI_INIT, "SetKey - ASUE MSK Mic Key", pWapiSta->wapiMsk.micKey, 16);
+ }else{
+ WAPI_TRACE(WAPI_INIT,"ASUE update msk \n");
+ pWapiSta->wapiMskUpdate.bSet = true;
+ memcpy(pWapiSta->wapiMskUpdate.dataKey,data+10,16);
+ memcpy(pWapiSta->wapiMskUpdate.micKey,data+26,16);
+ pWapiSta->wapiMskUpdate.keyId = *(data+42);
+ pWapiSta->wapiMskUpdate.bTxEnable = false;
+ }
+ }
+ break;
+ default:
+ WAPI_TRACE(WAPI_ERR,"Unknown Flag \n");
+ break;
+ }
+ }
+ }
+ }
+ WAPI_TRACE(WAPI_INIT, "<===========%s\n", __FUNCTION__);
+}
+
+
+void wapi_test_init(struct _adapter *padapter)
+{
+ u8 keybuf[100];
+ u8 mac_addr[6]={0x00,0xe0,0x4c,0x72,0x04,0x70};
+ u8 UskDataKey[16]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
+ u8 UskMicKey[16]={0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f};
+ u8 UskId = 0;
+ u8 MskDataKey[16]={0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f};
+ u8 MskMicKey[16]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f};
+ u8 MskId = 0;
+
+ WAPI_TRACE(WAPI_INIT, "===========>%s\n", __FUNCTION__);
+
+ //Enable Wapi
+ WAPI_TRACE(WAPI_INIT, "%s: Enable wapi!!!!\n", __FUNCTION__);
+ padapter->wapiInfo.bWapiEnable = true;
+ padapter->pairwise_key_type = KEY_TYPE_SMS4;
+ ieee->group_key_type = KEY_TYPE_SMS4;
+ padapter->wapiInfo.extra_prefix_len = WAPI_EXT_LEN;
+ padapter->wapiInfo.extra_postfix_len = SMS4_MIC_LEN;
+
+ //set usk
+ WAPI_TRACE(WAPI_INIT, "%s: Set USK!!!!\n", __FUNCTION__);
+ memset(keybuf,0,100);
+ keybuf[0] = 1; //set usk
+ keybuf[1] = 1; //enable tx
+ keybuf[2] = 1; //AE
+ keybuf[3] = 0; //not update
+
+ memcpy(keybuf+4,mac_addr,6);
+ memcpy(keybuf+10,UskDataKey,16);
+ memcpy(keybuf+26,UskMicKey,16);
+ keybuf[42]=UskId;
+ wapi_test_set_key(padapter, keybuf);
+
+ memset(keybuf,0,100);
+ keybuf[0] = 1; //set usk
+ keybuf[1] = 1; //enable tx
+ keybuf[2] = 0; //AE
+ keybuf[3] = 0; //not update
+
+ memcpy(keybuf+4,mac_addr,6);
+ memcpy(keybuf+10,UskDataKey,16);
+ memcpy(keybuf+26,UskMicKey,16);
+ keybuf[42]=UskId;
+ wapi_test_set_key(padapter, keybuf);
+
+ //set msk
+ WAPI_TRACE(WAPI_INIT, "%s: Set MSK!!!!\n", __FUNCTION__);
+ memset(keybuf,0,100);
+ keybuf[0] = 2; //set msk
+ keybuf[1] = 1; //Enable TX
+ keybuf[2] = 1; //AE
+ keybuf[3] = 0; //not update
+ memcpy(keybuf+4,mac_addr,6);
+ memcpy(keybuf+10,MskDataKey,16);
+ memcpy(keybuf+26,MskMicKey,16);
+ keybuf[42] = MskId;
+ wapi_test_set_key(padapter, keybuf);
+
+ memset(keybuf,0,100);
+ keybuf[0] = 2; //set msk
+ keybuf[1] = 1; //Enable TX
+ keybuf[2] = 0; //AE
+ keybuf[3] = 0; //not update
+ memcpy(keybuf+4,mac_addr,6);
+ memcpy(keybuf+10,MskDataKey,16);
+ memcpy(keybuf+26,MskMicKey,16);
+ keybuf[42] = MskId;
+ wapi_test_set_key(padapter, keybuf);
+ WAPI_TRACE(WAPI_INIT, "<===========%s\n", __FUNCTION__);
+}
+#endif
+
+void rtw_wapi_get_iv(_adapter *padapter,u8 *pRA, u8*IV)
+{
+ PWLAN_HEADER_WAPI_EXTENSION pWapiExt = NULL;
+ PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
+ bool bPNOverflow = false;
+ bool bFindMatchPeer = false;
+ PRT_WAPI_STA_INFO pWapiSta = NULL;
+
+ pWapiExt = (PWLAN_HEADER_WAPI_EXTENSION)IV;
+
+ WAPI_DATA(WAPI_RX,"wapi_get_iv: pra",pRA,6);
+
+ if(IS_MCAST(pRA)){
+ if(!pWapiInfo->wapiTxMsk.bTxEnable){
+ WAPI_TRACE(WAPI_ERR,"%s: bTxEnable = 0!!\n",__FUNCTION__);
+ return;
+ }
+
+ if(pWapiInfo->wapiTxMsk.keyId <= 1){
+ pWapiExt->KeyIdx = pWapiInfo->wapiTxMsk.keyId;
+ pWapiExt->Reserved = 0;
+ bPNOverflow = WapiIncreasePN(pWapiInfo->lastTxMulticastPN, 1);
+ memcpy(pWapiExt->PN, pWapiInfo->lastTxMulticastPN, 16);
+ }
+ }
+ else
+ {
+ if(list_empty(&pWapiInfo->wapiSTAUsedList)){
+ WAPI_TRACE(WAPI_RX,"rtw_wapi_get_iv: list is empty \n");
+ _rtw_memset(IV,10,18);
+ return;
+ }
+ else{
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list){
+ WAPI_DATA(WAPI_RX,"rtw_wapi_get_iv: peermacaddr ",pWapiSta->PeerMacAddr,6);
+ if (_rtw_memcmp((u8*)pWapiSta->PeerMacAddr, pRA, 6) == _TRUE) {
+ bFindMatchPeer = true;
+ break;
+ }
+ }
+
+ WAPI_TRACE(WAPI_RX,"bFindMatchPeer: %d \n",bFindMatchPeer);
+ WAPI_DATA(WAPI_RX,"Addr",pRA,6);
+
+ if (bFindMatchPeer){
+ if((!pWapiSta->wapiUskUpdate.bTxEnable) && (!pWapiSta->wapiUsk.bTxEnable))
+ return;
+
+ if (pWapiSta->wapiUsk.keyId <= 1){
+ if(pWapiSta->wapiUskUpdate.bTxEnable)
+ pWapiExt->KeyIdx = pWapiSta->wapiUskUpdate.keyId;
+ else
+ pWapiExt->KeyIdx = pWapiSta->wapiUsk.keyId;
+
+ pWapiExt->Reserved = 0;
+ bPNOverflow = WapiIncreasePN(pWapiSta->lastTxUnicastPN, 2);
+ _rtw_memcpy(pWapiExt->PN, pWapiSta->lastTxUnicastPN, 16);
+
+ }
+ }
+ }
+
+ }
+
+}
+
+bool rtw_wapi_drop_for_key_absent(_adapter *padapter,u8 *pRA)
+{
+ PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
+ bool bFindMatchPeer = false;
+ bool bDrop = false;
+ PRT_WAPI_STA_INFO pWapiSta = NULL;
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+
+ WAPI_DATA(WAPI_RX,"rtw_wapi_drop_for_key_absent: ra ",pRA,6);
+
+ if(psecuritypriv->dot11PrivacyAlgrthm == _SMS4_)
+ {
+ if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable))
+ return true;
+
+ if(IS_MCAST(pRA)){
+ if(!pWapiInfo->wapiTxMsk.bTxEnable){
+ bDrop = true;
+ WAPI_TRACE(WAPI_RX,"rtw_wapi_drop_for_key_absent: multicast key is absent \n");
+ return bDrop;
+ }
+ }
+ else{
+ if(!list_empty(&pWapiInfo->wapiSTAUsedList)){
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list){
+ WAPI_DATA(WAPI_RX,"rtw_wapi_drop_for_key_absent: pWapiSta->PeerMacAddr ",pWapiSta->PeerMacAddr,6);
+ if (_rtw_memcmp(pRA, pWapiSta->PeerMacAddr, 6) == _TRUE){
+ bFindMatchPeer = true;
+ break;
+ }
+ }
+ if (bFindMatchPeer) {
+ if (!pWapiSta->wapiUsk.bTxEnable){
+ bDrop = true;
+ WAPI_TRACE(WAPI_RX,"rtw_wapi_drop_for_key_absent: unicast key is absent \n");
+ return bDrop;
+ }
+ }
+ else{
+ bDrop = true;
+ WAPI_TRACE(WAPI_RX,"rtw_wapi_drop_for_key_absent: no peer find \n");
+ return bDrop;
+ }
+
+ }
+ else{
+ bDrop = true;
+ WAPI_TRACE(WAPI_RX,"rtw_wapi_drop_for_key_absent: no sta exist \n");
+ return bDrop;
+ }
+ }
+ }
+ else
+ {
+ return bDrop;
+ }
+
+ return bDrop;
+}
+
+#endif
diff --git a/rtl8xxx_EU/core/rtw_wapi_sms4.c b/rtl8xxx_EU/core/rtw_wapi_sms4.c
index 6126ed9..aa64193 100755
--- a/rtl8xxx_EU/core/rtw_wapi_sms4.c
+++ b/rtl8xxx_EU/core/rtw_wapi_sms4.c
@@ -1,923 +1,923 @@
-#ifdef CONFIG_WAPI_SUPPORT
-
-#include <linux/unistd.h>
-#include <linux/etherdevice.h>
-#include <drv_types.h>
-#include <rtw_wapi.h>
-
-
-#ifdef CONFIG_WAPI_SW_SMS4
-
-#define WAPI_LITTLE_ENDIAN
-//#define BIG_ENDIAN
-#define ENCRYPT 0
-#define DECRYPT 1
-
-
-/**********************************************************
- **********************************************************/
-const u8 Sbox[256] = {
-0xd6,0x90,0xe9,0xfe,0xcc,0xe1,0x3d,0xb7,0x16,0xb6,0x14,0xc2,0x28,0xfb,0x2c,0x05,
-0x2b,0x67,0x9a,0x76,0x2a,0xbe,0x04,0xc3,0xaa,0x44,0x13,0x26,0x49,0x86,0x06,0x99,
-0x9c,0x42,0x50,0xf4,0x91,0xef,0x98,0x7a,0x33,0x54,0x0b,0x43,0xed,0xcf,0xac,0x62,
-0xe4,0xb3,0x1c,0xa9,0xc9,0x08,0xe8,0x95,0x80,0xdf,0x94,0xfa,0x75,0x8f,0x3f,0xa6,
-0x47,0x07,0xa7,0xfc,0xf3,0x73,0x17,0xba,0x83,0x59,0x3c,0x19,0xe6,0x85,0x4f,0xa8,
-0x68,0x6b,0x81,0xb2,0x71,0x64,0xda,0x8b,0xf8,0xeb,0x0f,0x4b,0x70,0x56,0x9d,0x35,
-0x1e,0x24,0x0e,0x5e,0x63,0x58,0xd1,0xa2,0x25,0x22,0x7c,0x3b,0x01,0x21,0x78,0x87,
-0xd4,0x00,0x46,0x57,0x9f,0xd3,0x27,0x52,0x4c,0x36,0x02,0xe7,0xa0,0xc4,0xc8,0x9e,
-0xea,0xbf,0x8a,0xd2,0x40,0xc7,0x38,0xb5,0xa3,0xf7,0xf2,0xce,0xf9,0x61,0x15,0xa1,
-0xe0,0xae,0x5d,0xa4,0x9b,0x34,0x1a,0x55,0xad,0x93,0x32,0x30,0xf5,0x8c,0xb1,0xe3,
-0x1d,0xf6,0xe2,0x2e,0x82,0x66,0xca,0x60,0xc0,0x29,0x23,0xab,0x0d,0x53,0x4e,0x6f,
-0xd5,0xdb,0x37,0x45,0xde,0xfd,0x8e,0x2f,0x03,0xff,0x6a,0x72,0x6d,0x6c,0x5b,0x51,
-0x8d,0x1b,0xaf,0x92,0xbb,0xdd,0xbc,0x7f,0x11,0xd9,0x5c,0x41,0x1f,0x10,0x5a,0xd8,
-0x0a,0xc1,0x31,0x88,0xa5,0xcd,0x7b,0xbd,0x2d,0x74,0xd0,0x12,0xb8,0xe5,0xb4,0xb0,
-0x89,0x69,0x97,0x4a,0x0c,0x96,0x77,0x7e,0x65,0xb9,0xf1,0x09,0xc5,0x6e,0xc6,0x84,
-0x18,0xf0,0x7d,0xec,0x3a,0xdc,0x4d,0x20,0x79,0xee,0x5f,0x3e,0xd7,0xcb,0x39,0x48
-};
-
-const u32 CK[32] = {
- 0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
- 0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
- 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
- 0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9,
- 0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229,
- 0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299,
- 0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
- 0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279 };
-
-#define Rotl(_x, _y) (((_x) << (_y)) | ((_x) >> (32 - (_y))))
-
-#define ByteSub(_A) (Sbox[(_A) >> 24 & 0xFF] << 24 | \
- Sbox[(_A) >> 16 & 0xFF] << 16 | \
- Sbox[(_A) >> 8 & 0xFF] << 8 | \
- Sbox[(_A) & 0xFF])
-
-#define L1(_B) ((_B) ^ Rotl(_B, 2) ^ Rotl(_B, 10) ^ Rotl(_B, 18) ^ Rotl(_B, 24))
-#define L2(_B) ((_B) ^ Rotl(_B, 13) ^ Rotl(_B, 23))
-
-static void
-xor_block(void *dst, void *src1, void *src2)
-/* 128-bit xor: *dst = *src1 xor *src2. Pointers must be 32-bit aligned */
-{
- ((u32 *)dst)[0] = ((u32 *)src1)[0] ^ ((u32 *)src2)[0];
- ((u32 *)dst)[1] = ((u32 *)src1)[1] ^ ((u32 *)src2)[1];
- ((u32 *)dst)[2] = ((u32 *)src1)[2] ^ ((u32 *)src2)[2];
- ((u32 *)dst)[3] = ((u32 *)src1)[3] ^ ((u32 *)src2)[3];
-}
-
-
-void SMS4Crypt(u8 *Input, u8 *Output, u32 *rk)
-{
- u32 r, mid, x0, x1, x2, x3, *p;
- p = (u32 *)Input;
- x0 = p[0];
- x1 = p[1];
- x2 = p[2];
- x3 = p[3];
-#ifdef WAPI_LITTLE_ENDIAN
- x0 = Rotl(x0, 16); x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
- x1 = Rotl(x1, 16); x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
- x2 = Rotl(x2, 16); x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
- x3 = Rotl(x3, 16); x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
-#endif
- for (r = 0; r < 32; r += 4)
- {
- mid = x1 ^ x2 ^ x3 ^ rk[r + 0];
- mid = ByteSub(mid);
- x0 ^= L1(mid);
- mid = x2 ^ x3 ^ x0 ^ rk[r + 1];
- mid = ByteSub(mid);
- x1 ^= L1(mid);
- mid = x3 ^ x0 ^ x1 ^ rk[r + 2];
- mid = ByteSub(mid);
- x2 ^= L1(mid);
- mid = x0 ^ x1 ^ x2 ^ rk[r + 3];
- mid = ByteSub(mid);
- x3 ^= L1(mid);
- }
-#ifdef WAPI_LITTLE_ENDIAN
- x0 = Rotl(x0, 16); x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
- x1 = Rotl(x1, 16); x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
- x2 = Rotl(x2, 16); x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
- x3 = Rotl(x3, 16); x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
-#endif
- p = (u32 *)Output;
- p[0] = x3;
- p[1] = x2;
- p[2] = x1;
- p[3] = x0;
-}
-
-
-
-void SMS4KeyExt(u8 *Key, u32 *rk, u32 CryptFlag)
-{
- u32 r, mid, x0, x1, x2, x3, *p;
-
- p = (u32 *)Key;
- x0 = p[0];
- x1 = p[1];
- x2 = p[2];
- x3 = p[3];
-#ifdef WAPI_LITTLE_ENDIAN
- x0 = Rotl(x0, 16); x0 = ((x0 & 0xFF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
- x1 = Rotl(x1, 16); x1 = ((x1 & 0xFF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
- x2 = Rotl(x2, 16); x2 = ((x2 & 0xFF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
- x3 = Rotl(x3, 16); x3 = ((x3 & 0xFF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
-#endif
-
- x0 ^= 0xa3b1bac6;
- x1 ^= 0x56aa3350;
- x2 ^= 0x677d9197;
- x3 ^= 0xb27022dc;
- for (r = 0; r < 32; r += 4)
- {
- mid = x1 ^ x2 ^ x3 ^ CK[r + 0];
- mid = ByteSub(mid);
- rk[r + 0] = x0 ^= L2(mid);
- mid = x2 ^ x3 ^ x0 ^ CK[r + 1];
- mid = ByteSub(mid);
- rk[r + 1] = x1 ^= L2(mid);
- mid = x3 ^ x0 ^ x1 ^ CK[r + 2];
- mid = ByteSub(mid);
- rk[r + 2] = x2 ^= L2(mid);
- mid = x0 ^ x1 ^ x2 ^ CK[r + 3];
- mid = ByteSub(mid);
- rk[r + 3] = x3 ^= L2(mid);
- }
- if (CryptFlag == DECRYPT)
- {
- for (r = 0; r < 16; r++)
- mid = rk[r], rk[r] = rk[31 - r], rk[31 - r] = mid;
- }
-}
-
-
-void WapiSMS4Cryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
- u8 *Output, u16 *OutputLength, u32 CryptFlag)
-{
- u32 blockNum,i,j, rk[32];
- u16 remainder;
- u8 blockIn[16],blockOut[16], tempIV[16], k;
-
- *OutputLength = 0;
- remainder = InputLength & 0x0F;
- blockNum = InputLength >> 4;
- if(remainder !=0)
- blockNum++;
- else
- remainder = 16;
-
- for(k=0;k<16;k++)
- tempIV[k] = IV[15-k];
-
- memcpy(blockIn, tempIV, 16);
-
- SMS4KeyExt((u8 *)Key, rk,CryptFlag);
-
- for(i=0; i<blockNum-1; i++)
- {
- SMS4Crypt((u8 *)blockIn, blockOut, rk);
- xor_block(&Output[i*16], &Input[i*16], blockOut);
- memcpy(blockIn,blockOut,16);
- }
-
- *OutputLength = i*16;
-
- SMS4Crypt((u8 *)blockIn, blockOut, rk);
-
- for(j=0; j<remainder; j++)
- {
- Output[i*16+j] = Input[i*16+j] ^ blockOut[j];
- }
- *OutputLength += remainder;
-
-}
-
-void WapiSMS4Encryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
- u8 *Output, u16 *OutputLength)
-{
-
- WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
-}
-
-void WapiSMS4Decryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
- u8 *Output, u16 *OutputLength)
-{
- // OFB mode: is also ENCRYPT flag
- WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
-}
-
-void WapiSMS4CalculateMic(u8 *Key, u8 *IV, u8 *Input1, u8 Input1Length,
- u8 *Input2, u16 Input2Length, u8 *Output, u8 *OutputLength)
-{
- u32 blockNum, i, remainder, rk[32];
- u8 BlockIn[16], BlockOut[16], TempBlock[16], tempIV[16], k;
-
- *OutputLength = 0;
- remainder = Input1Length & 0x0F;
- blockNum = Input1Length >> 4;
-
- for(k=0;k<16;k++)
- tempIV[k] = IV[15-k];
-
- memcpy(BlockIn, tempIV, 16);
-
- SMS4KeyExt((u8 *)Key, rk, ENCRYPT);
-
- SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
-
- for(i=0; i<blockNum; i++){
- xor_block(BlockIn, (Input1+i*16), BlockOut);
- SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
- }
-
- if(remainder !=0){
- memset(TempBlock, 0, 16);
- memcpy(TempBlock, (Input1+blockNum*16), remainder);
-
- xor_block(BlockIn, TempBlock, BlockOut);
- SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
- }
-
- remainder = Input2Length & 0x0F;
- blockNum = Input2Length >> 4;
-
- for(i=0; i<blockNum; i++){
- xor_block(BlockIn, (Input2+i*16), BlockOut);
- SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
- }
-
- if(remainder !=0){
- memset(TempBlock, 0, 16);
- memcpy(TempBlock, (Input2+blockNum*16), remainder);
-
- xor_block(BlockIn, TempBlock, BlockOut);
- SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
- }
-
- memcpy(Output, BlockOut, 16);
- *OutputLength = 16;
-}
-
-void SecCalculateMicSMS4(
- u8 KeyIdx,
- u8 *MicKey,
- u8 *pHeader,
- u8 *pData,
- u16 DataLen,
- u8 *MicBuffer
- )
-{
-#if 0
- struct ieee80211_hdr_3addr_qos *header;
- u8 TempBuf[34], TempLen = 32, MicLen, QosOffset, *IV;
- u16 *pTemp, fc;
-
- WAPI_TRACE(WAPI_TX|WAPI_RX, "=========>%s\n", __FUNCTION__);
-
- header = (struct ieee80211_hdr_3addr_qos *)pHeader;
- memset(TempBuf, 0, 34);
- memcpy(TempBuf, pHeader, 2); //FrameCtrl
- pTemp = (u16*)TempBuf;
- *pTemp &= 0xc78f; //bit4,5,6,11,12,13
-
- memcpy((TempBuf+2), (pHeader+4), 12); //Addr1, Addr2
- memcpy((TempBuf+14), (pHeader+22), 2); // SeqCtrl
- pTemp = (u16*)(TempBuf + 14);
- *pTemp &= 0x000f;
-
- memcpy((TempBuf+16), (pHeader+16), 6); //Addr3
-
- fc = le16_to_cpu(header->frame_ctl);
-
-
-
- if (GetFrDs((u16*)&fc) && GetToDs((u16 *)&fc))
- {
- memcpy((TempBuf+22), (pHeader+24), 6);
- QosOffset = 30;
- }else{
- memset((TempBuf+22), 0, 6);
- QosOffset = 24;
- }
-
- if((fc & 0x0088) == 0x0088){
- memcpy((TempBuf+28), (pHeader+QosOffset), 2);
- TempLen += 2;
- //IV = pHeader + QosOffset + 2 + SNAP_SIZE + sizeof(u16) + 2;
- IV = pHeader + QosOffset + 2 + 2;
- }else{
- IV = pHeader + QosOffset + 2;
- //IV = pHeader + QosOffset + SNAP_SIZE + sizeof(u16) + 2;
- }
-
- TempBuf[TempLen-1] = (u8)(DataLen & 0xff);
- TempBuf[TempLen-2] = (u8)((DataLen & 0xff00)>>8);
- TempBuf[TempLen-4] = KeyIdx;
-
- WAPI_DATA(WAPI_TX, "CalculateMic - KEY", MicKey, 16);
- WAPI_DATA(WAPI_TX, "CalculateMic - IV", IV, 16);
- WAPI_DATA(WAPI_TX, "CalculateMic - TempBuf", TempBuf, TempLen);
- WAPI_DATA(WAPI_TX, "CalculateMic - pData", pData, DataLen);
-
- WapiSMS4CalculateMic(MicKey, IV, TempBuf, TempLen,
- pData, DataLen, MicBuffer, &MicLen);
-
- if (MicLen != 16)
- WAPI_TRACE(WAPI_ERR,"%s: MIC Length Error!!\n",__FUNCTION__);
-
- WAPI_TRACE(WAPI_TX|WAPI_RX, "<=========%s\n", __FUNCTION__);
-#endif
-}
-
-/* AddCount: 1 or 2.
- * If overflow, return 1,
- * else return 0.
- */
-u8 WapiIncreasePN(u8 *PN, u8 AddCount)
-{
- u8 i;
-
- if (NULL == PN)
- return 1;
- //YJ,test,091102
- /*
- if(AddCount == 2){
- DBG_8192C("############################%s(): PN[0]=0x%x\n", __FUNCTION__, PN[0]);
- if(PN[0] == 0x48){
- PN[0] += AddCount;
- return 1;
- }else{
- PN[0] += AddCount;
- return 0;
- }
- }
- */
- //YJ,test,091102,end
-
- for (i=0; i<16; i++)
- {
- if (PN[i] + AddCount <= 0xff)
- {
- PN[i] += AddCount;
- return 0;
- }
- else
- {
- PN[i] += AddCount;
- AddCount = 1;
- }
- }
- return 1;
-}
-
-
-void WapiGetLastRxUnicastPNForQoSData(
- u8 UserPriority,
- PRT_WAPI_STA_INFO pWapiStaInfo,
- u8 *PNOut
-)
-{
- WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
- switch(UserPriority)
- {
- case 0:
- case 3:
- memcpy(PNOut,pWapiStaInfo->lastRxUnicastPNBEQueue,16);
- break;
- case 1:
- case 2:
- memcpy(PNOut,pWapiStaInfo->lastRxUnicastPNBKQueue,16);
- break;
- case 4:
- case 5:
- memcpy(PNOut,pWapiStaInfo->lastRxUnicastPNVIQueue,16);
- break;
- case 6:
- case 7:
- memcpy(PNOut,pWapiStaInfo->lastRxUnicastPNVOQueue,16);
- break;
- default:
- WAPI_TRACE(WAPI_ERR, "%s: Unknown TID \n", __FUNCTION__);
- break;
- }
- WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
-}
-
-
-void WapiSetLastRxUnicastPNForQoSData(
- u8 UserPriority,
- u8 *PNIn,
- PRT_WAPI_STA_INFO pWapiStaInfo
-)
-{
- WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
- switch(UserPriority)
- {
- case 0:
- case 3:
- memcpy(pWapiStaInfo->lastRxUnicastPNBEQueue,PNIn,16);
- break;
- case 1:
- case 2:
- memcpy(pWapiStaInfo->lastRxUnicastPNBKQueue,PNIn,16);
- break;
- case 4:
- case 5:
- memcpy(pWapiStaInfo->lastRxUnicastPNVIQueue,PNIn,16);
- break;
- case 6:
- case 7:
- memcpy(pWapiStaInfo->lastRxUnicastPNVOQueue,PNIn,16);
- break;
- default:
- WAPI_TRACE(WAPI_ERR, "%s: Unknown TID \n", __FUNCTION__);
- break;
- }
- WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
-}
-
-
-/****************************************************************************
- FALSE not RX-Reorder
- TRUE do RX Reorder
-add to support WAPI to N-mode
-*****************************************************************************/
-u8 WapiCheckPnInSwDecrypt(
- _adapter *padapter,
- struct sk_buff *pskb
-)
-{
- u8 ret = false;
-
-#if 0
- struct ieee80211_hdr_3addr_qos *header;
- u16 fc;
- u8 *pDaddr, *pTaddr, *pRaddr;
-
- header = (struct ieee80211_hdr_3addr_qos *)pskb->data;
- pTaddr = header->addr2;
- pRaddr = header->addr1;
- fc = le16_to_cpu(header->frame_ctl);
-
- if(GetToDs(&fc))
- pDaddr = header->addr3;
- else
- pDaddr = header->addr1;
-
- if ((_rtw_memcmp(pRaddr, padapter->pnetdev->dev_addr, ETH_ALEN) == 0)
- && ! (pDaddr)
- && (GetFrameType(&fc) == WIFI_QOS_DATA_TYPE))
- //&& ieee->pHTInfo->bCurrentHTSupport &&
- //ieee->pHTInfo->bCurRxReorderEnable)
- ret = false;
- else
- ret = true;
-#endif
- WAPI_TRACE(WAPI_RX, "%s: return %d\n", __FUNCTION__, ret);
- return ret;
-}
-
-int SecSMS4HeaderFillIV(_adapter *padapter, u8 *pxmitframe)
-{
- struct pkt_attrib *pattrib = &((struct xmit_frame*)pxmitframe)->attrib;
- u8 * frame = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
- u8 *pSecHeader = NULL, *pos = NULL, *pRA = NULL;
- u8 bPNOverflow = false, bFindMatchPeer = false, hdr_len = 0;
- PWLAN_HEADER_WAPI_EXTENSION pWapiExt = NULL;
- PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
- PRT_WAPI_STA_INFO pWapiSta = NULL;
- int ret = 0;
-
- WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
-
- return ret;
-#if 0
- hdr_len = sMacHdrLng;
- if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE)
- {
- hdr_len += 2;
- }
- //hdr_len += SNAP_SIZE + sizeof(u16);
-
- pos = skb_push(pskb, padapter->wapiInfo.extra_prefix_len);
- memmove(pos, pos+padapter->wapiInfo.extra_prefix_len, hdr_len);
-
- pSecHeader = pskb->data + hdr_len;
- pWapiExt = (PWLAN_HEADER_WAPI_EXTENSION)pSecHeader;
- pRA = pskb->data + 4;
-
- WAPI_DATA(WAPI_TX, "FillIV - Before Fill IV", pskb->data, pskb->len);
-
- //Address 1 is always receiver's address
- if( IS_MCAST(pRA) ){
- if(!pWapiInfo->wapiTxMsk.bTxEnable){
- WAPI_TRACE(WAPI_ERR,"%s: bTxEnable = 0!!\n",__FUNCTION__);
- return -2;
- }
- if(pWapiInfo->wapiTxMsk.keyId <= 1){
- pWapiExt->KeyIdx = pWapiInfo->wapiTxMsk.keyId;
- pWapiExt->Reserved = 0;
- bPNOverflow = WapiIncreasePN(pWapiInfo->lastTxMulticastPN, 1);
- memcpy(pWapiExt->PN, pWapiInfo->lastTxMulticastPN, 16);
- if (bPNOverflow){
- // Update MSK Notification.
- WAPI_TRACE(WAPI_ERR,"===============>%s():multicast PN overflow\n",__FUNCTION__);
- rtw_wapi_app_event_handler(padapter,NULL,0,pRA, false, false, true, 0, false);
- }
- }else{
- WAPI_TRACE(WAPI_ERR,"%s: Invalid Wapi Multicast KeyIdx!!\n",__FUNCTION__);
- ret = -3;
- }
- }
- else{
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
- if(!memcmp(pWapiSta->PeerMacAddr,pRA,6)){
- bFindMatchPeer = true;
- break;
- }
- }
- if (bFindMatchPeer){
- if((!pWapiSta->wapiUskUpdate.bTxEnable) && (!pWapiSta->wapiUsk.bTxEnable)){
- WAPI_TRACE(WAPI_ERR,"%s: bTxEnable = 0!!\n",__FUNCTION__);
- return -4;
- }
- if (pWapiSta->wapiUsk.keyId <= 1){
- if(pWapiSta->wapiUskUpdate.bTxEnable)
- pWapiExt->KeyIdx = pWapiSta->wapiUskUpdate.keyId;
- else
- pWapiExt->KeyIdx = pWapiSta->wapiUsk.keyId;
-
- pWapiExt->Reserved = 0;
- bPNOverflow = WapiIncreasePN(pWapiSta->lastTxUnicastPN, 2);
- memcpy(pWapiExt->PN, pWapiSta->lastTxUnicastPN, 16);
- if (bPNOverflow){
- // Update USK Notification.
- WAPI_TRACE(WAPI_ERR,"===============>%s():unicast PN overflow\n",__FUNCTION__);
- rtw_wapi_app_event_handler(padapter,NULL,0,pWapiSta->PeerMacAddr, false, true, false, 0, false);
- }
- }else{
- WAPI_TRACE(WAPI_ERR,"%s: Invalid Wapi Unicast KeyIdx!!\n",__FUNCTION__);
- ret = -5;
- }
- }
- else{
- WAPI_TRACE(WAPI_ERR,"%s: Can not find Peer Sta "MAC_FMT"!!\n",__FUNCTION__, MAC_ARG(pRA));
- ret = -6;
- }
- }
-
- WAPI_DATA(WAPI_TX, "FillIV - After Fill IV", pskb->data, pskb->len);
- WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
- return ret;
-#endif
-}
-
-// WAPI SW Enc: must have done Coalesce!
-void SecSWSMS4Encryption(
- _adapter *padapter,
- u8 * pxmitframe
- )
-{
- PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
- PRT_WAPI_STA_INFO pWapiSta = NULL;
- u8 *pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + TXDESC_SIZE;
- struct pkt_attrib *pattrib = &((struct xmit_frame*)pxmitframe)->attrib;
-
- u8 *SecPtr = NULL, *pRA, *pMicKey = NULL, *pDataKey = NULL, *pIV = NULL;
- u8 IVOffset, DataOffset, bFindMatchPeer = false, KeyIdx = 0, MicBuffer[16];
- u16 OutputLength;
-
- WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
-
- WAPI_TRACE(WAPI_TX,"hdrlen: %d \n",pattrib->hdrlen);
-
- return;
-
- DataOffset = pattrib->hdrlen + pattrib->iv_len;
-
- pRA = pframe + 4;
-
-
- if( IS_MCAST(pRA) ){
- KeyIdx = pWapiInfo->wapiTxMsk.keyId;
- pIV = pWapiInfo->lastTxMulticastPN;
- pMicKey = pWapiInfo->wapiTxMsk.micKey;
- pDataKey = pWapiInfo->wapiTxMsk.dataKey;
- }else{
- if (!list_empty(&(pWapiInfo->wapiSTAUsedList))){
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
- if (0 == memcmp(pWapiSta->PeerMacAddr, pRA, 6)){
- bFindMatchPeer = true;
- break;
- }
- }
-
- if (bFindMatchPeer){
- if (pWapiSta->wapiUskUpdate.bTxEnable){
- KeyIdx = pWapiSta->wapiUskUpdate.keyId;
- WAPI_TRACE(WAPI_TX, "%s(): Use update USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
- pIV = pWapiSta->lastTxUnicastPN;
- pMicKey = pWapiSta->wapiUskUpdate.micKey;
- pDataKey = pWapiSta->wapiUskUpdate.dataKey;
- }else{
- KeyIdx = pWapiSta->wapiUsk.keyId;
- WAPI_TRACE(WAPI_TX, "%s(): Use USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
- pIV = pWapiSta->lastTxUnicastPN;
- pMicKey = pWapiSta->wapiUsk.micKey;
- pDataKey = pWapiSta->wapiUsk.dataKey;
- }
- }else{
- WAPI_TRACE(WAPI_ERR,"%s: Can not find Peer Sta!!\n",__FUNCTION__);
- return;
- }
- }else{
- WAPI_TRACE(WAPI_ERR,"%s: wapiSTAUsedList is empty!!\n",__FUNCTION__);
- return;
- }
- }
-
- SecPtr = pframe;
- SecCalculateMicSMS4(KeyIdx, pMicKey, SecPtr, (SecPtr+DataOffset), pattrib->pktlen, MicBuffer);
-
- WAPI_DATA(WAPI_TX, "Encryption - MIC", MicBuffer, padapter->wapiInfo.extra_postfix_len);
-
- memcpy(pframe+pattrib->hdrlen+pattrib->iv_len+pattrib->pktlen-pattrib->icv_len,
- (u8 *)MicBuffer,
- padapter->wapiInfo.extra_postfix_len
- );
-
-
- WapiSMS4Encryption(pDataKey, pIV, (SecPtr+DataOffset),pattrib->pktlen+pattrib->icv_len, (SecPtr+DataOffset), &OutputLength);
-
- WAPI_DATA(WAPI_TX, "Encryption - After SMS4 encryption",pframe,pattrib->hdrlen+pattrib->iv_len+pattrib->pktlen);
-
- WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
-}
-
-u8 SecSWSMS4Decryption(
- _adapter *padapter,
- u8 *precv_frame,
- struct recv_priv *precv_priv
- )
-{
- PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
- struct recv_frame_hdr *precv_hdr;
- PRT_WAPI_STA_INFO pWapiSta = NULL;
- u8 IVOffset, DataOffset, bFindMatchPeer = false, bUseUpdatedKey = false;
- u8 KeyIdx, MicBuffer[16], lastRxPNforQoS[16];
- u8 *pRA, *pTA, *pMicKey, *pDataKey, *pLastRxPN, *pRecvPN, *pSecData, *pRecvMic, *pos;
- u8 TID = 0;
- u16 OutputLength, DataLen;
- u8 bQosData;
- struct sk_buff * pskb;
-
- WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
-
- return 0;
-
- precv_hdr = &((union recv_frame*)precv_frame)->u.hdr;
- pskb = (struct sk_buff *)(precv_hdr->rx_data);
- precv_hdr->bWapiCheckPNInDecrypt = WapiCheckPnInSwDecrypt(padapter, pskb);
- WAPI_TRACE(WAPI_RX, "=========>%s: check PN %d\n", __FUNCTION__,precv_hdr->bWapiCheckPNInDecrypt);
- WAPI_DATA(WAPI_RX, "Decryption - Before decryption", pskb->data, pskb->len);
-
- IVOffset = sMacHdrLng;
- bQosData = GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE;
- if (bQosData){
- IVOffset += 2;
- }
-
- //if(GetHTC())
- // IVOffset += 4;
-
- //IVOffset += SNAP_SIZE + sizeof(u16);
-
- DataOffset = IVOffset + padapter->wapiInfo.extra_prefix_len;
-
- pRA = pskb->data + 4;
- pTA = pskb->data + 10;
- KeyIdx = *(pskb->data + IVOffset);
- pRecvPN = pskb->data + IVOffset + 2;
- pSecData = pskb->data + DataOffset;
- DataLen = pskb->len - DataOffset;
- pRecvMic = pskb->data + pskb->len - padapter->wapiInfo.extra_postfix_len;
- TID = GetTid(pskb->data);
-
- if (!list_empty(&(pWapiInfo->wapiSTAUsedList))){
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
- if (0 == memcmp(pWapiSta->PeerMacAddr, pTA, 6)){
- bFindMatchPeer = true;
- break;
- }
- }
- }
-
- if (!bFindMatchPeer){
- WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta "MAC_FMT" for Key Info!!!\n", __FUNCTION__, MAC_ARG(pTA));
- return false;
- }
-
- if( IS_MCAST(pRA) ){
- WAPI_TRACE(WAPI_RX, "%s: Multicast decryption !!!\n", __FUNCTION__);
- if (pWapiSta->wapiMsk.keyId == KeyIdx && pWapiSta->wapiMsk.bSet){
- pLastRxPN = pWapiSta->lastRxMulticastPN;
- if (!WapiComparePN(pRecvPN, pLastRxPN)){
- WAPI_TRACE(WAPI_ERR, "%s: MSK PN is not larger than last, Dropped!!!\n", __FUNCTION__);
- WAPI_DATA(WAPI_ERR, "pRecvPN:", pRecvPN, 16);
- WAPI_DATA(WAPI_ERR, "pLastRxPN:", pLastRxPN, 16);
- return false;
- }
-
- memcpy(pLastRxPN, pRecvPN, 16);
- pMicKey = pWapiSta->wapiMsk.micKey;
- pDataKey = pWapiSta->wapiMsk.dataKey;
- }else if (pWapiSta->wapiMskUpdate.keyId == KeyIdx && pWapiSta->wapiMskUpdate.bSet){
- WAPI_TRACE(WAPI_RX, "%s: Use Updated MSK for Decryption !!!\n", __FUNCTION__);
- bUseUpdatedKey = true;
- memcpy(pWapiSta->lastRxMulticastPN, pRecvPN, 16);
- pMicKey = pWapiSta->wapiMskUpdate.micKey;
- pDataKey = pWapiSta->wapiMskUpdate.dataKey;
- }else{
- WAPI_TRACE(WAPI_ERR, "%s: Can not find MSK with matched KeyIdx(%d), Dropped !!!\n", __FUNCTION__,KeyIdx);
- return false;
- }
- }
- else{
- WAPI_TRACE(WAPI_RX, "%s: Unicast decryption !!!\n", __FUNCTION__);
- if (pWapiSta->wapiUsk.keyId == KeyIdx && pWapiSta->wapiUsk.bSet){
- WAPI_TRACE(WAPI_RX, "%s: Use USK for Decryption!!!\n", __FUNCTION__);
- if(precv_hdr->bWapiCheckPNInDecrypt){
- if(GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE){
- WapiGetLastRxUnicastPNForQoSData(TID, pWapiSta, lastRxPNforQoS);
- pLastRxPN = lastRxPNforQoS;
- }else{
- pLastRxPN = pWapiSta->lastRxUnicastPN;
- }
- if (!WapiComparePN(pRecvPN, pLastRxPN)){
- return false;
- }
- if(bQosData){
- WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
- }else{
- memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
- }
- }else{
- memcpy(precv_hdr->WapiTempPN,pRecvPN,16);
- }
-
- if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE))
- {
- if ((pRecvPN[0] & 0x1) == 0){
- WAPI_TRACE(WAPI_ERR, "%s: Rx USK PN is not odd when Infra STA mode, Dropped !!!\n", __FUNCTION__);
- return false;
- }
- }
-
- pMicKey = pWapiSta->wapiUsk.micKey;
- pDataKey = pWapiSta->wapiUsk.dataKey;
- }
- else if (pWapiSta->wapiUskUpdate.keyId == KeyIdx && pWapiSta->wapiUskUpdate.bSet ){
- WAPI_TRACE(WAPI_RX, "%s: Use Updated USK for Decryption!!!\n", __FUNCTION__);
- if(pWapiSta->bAuthenticatorInUpdata)
- bUseUpdatedKey = true;
- else
- bUseUpdatedKey = false;
-
- if(bQosData){
- WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
- }else{
- memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
- }
- pMicKey = pWapiSta->wapiUskUpdate.micKey;
- pDataKey = pWapiSta->wapiUskUpdate.dataKey;
- }else{
- WAPI_TRACE(WAPI_ERR, "%s: No valid USK!!!KeyIdx=%d pWapiSta->wapiUsk.keyId=%d pWapiSta->wapiUskUpdate.keyId=%d\n", __FUNCTION__, KeyIdx, pWapiSta->wapiUsk.keyId, pWapiSta->wapiUskUpdate.keyId);
- //dump_buf(pskb->data,pskb->len);
- return false;
- }
- }
-
- WAPI_DATA(WAPI_RX, "Decryption - DataKey", pDataKey, 16);
- WAPI_DATA(WAPI_RX, "Decryption - IV", pRecvPN, 16);
- WapiSMS4Decryption(pDataKey, pRecvPN, pSecData, DataLen, pSecData, &OutputLength);
-
- if (OutputLength != DataLen)
- WAPI_TRACE(WAPI_ERR, "%s: Output Length Error!!!!\n", __FUNCTION__);
-
- WAPI_DATA(WAPI_RX, "Decryption - After decryption", pskb->data, pskb->len);
-
- DataLen -= padapter->wapiInfo.extra_postfix_len;
-
- SecCalculateMicSMS4(KeyIdx, pMicKey, pskb->data, pSecData, DataLen, MicBuffer);
-
- WAPI_DATA(WAPI_RX, "Decryption - MIC received", pRecvMic, SMS4_MIC_LEN);
- WAPI_DATA(WAPI_RX, "Decryption - MIC calculated", MicBuffer, SMS4_MIC_LEN);
-
- if (0 == memcmp(MicBuffer, pRecvMic, padapter->wapiInfo.extra_postfix_len)){
- WAPI_TRACE(WAPI_RX, "%s: Check MIC OK!!\n", __FUNCTION__);
- if (bUseUpdatedKey){
- // delete the old key
- if ( IS_MCAST(pRA) ){
- WAPI_TRACE(WAPI_API, "%s(): AE use new update MSK!!\n", __FUNCTION__);
- pWapiSta->wapiMsk.keyId = pWapiSta->wapiMskUpdate.keyId;
- memcpy(pWapiSta->wapiMsk.dataKey, pWapiSta->wapiMskUpdate.dataKey, 16);
- memcpy(pWapiSta->wapiMsk.micKey, pWapiSta->wapiMskUpdate.micKey, 16);
- pWapiSta->wapiMskUpdate.bTxEnable = pWapiSta->wapiMskUpdate.bSet = false;
- }else{
- WAPI_TRACE(WAPI_API, "%s(): AE use new update USK!!\n", __FUNCTION__);
- pWapiSta->wapiUsk.keyId = pWapiSta->wapiUskUpdate.keyId;
- memcpy(pWapiSta->wapiUsk.dataKey, pWapiSta->wapiUskUpdate.dataKey, 16);
- memcpy(pWapiSta->wapiUsk.micKey, pWapiSta->wapiUskUpdate.micKey, 16);
- pWapiSta->wapiUskUpdate.bTxEnable = pWapiSta->wapiUskUpdate.bSet = false;
- }
- }
- }else{
- WAPI_TRACE(WAPI_ERR, "%s: Check MIC Error, Dropped !!!!\n", __FUNCTION__);
- return false;
- }
-
- pos = pskb->data;
- memmove(pos+padapter->wapiInfo.extra_prefix_len, pos, IVOffset);
- skb_pull(pskb, padapter->wapiInfo.extra_prefix_len);
-
- WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
-
- return true;
-}
-
-u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
-{
-
- u8 *pframe;
- u32 res = _SUCCESS;
-
- WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
- {
- WAPI_TRACE(WAPI_TX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
- return _FAIL;
- }
-
- if(((struct xmit_frame*)pxmitframe)->buf_addr==NULL)
- return _FAIL;
-
- pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + TXDESC_OFFSET;
-
- SecSWSMS4Encryption(padapter, pxmitframe);
-
- WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
- return res;
-}
-
-u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
-{
- u8 *pframe;
- u32 res = _SUCCESS;
-
- WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
-
- if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
- {
- WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
- return _FAIL;
- }
-
-
- //drop packet when hw decrypt fail
- //return tempraily
- return _FAIL;
-
- //pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data;
-
- if (false == SecSWSMS4Decryption(padapter, precvframe, &padapter->recvpriv))
- {
- WAPI_TRACE(WAPI_ERR, "%s():SMS4 decrypt frame error\n",__FUNCTION__);
- return _FAIL;
- }
-
- WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
- return res;
-}
-
-#else
-
-u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
-{
- WAPI_TRACE(WAPI_TX, "=========>Dummy %s\n", __FUNCTION__);
- WAPI_TRACE(WAPI_TX, "<=========Dummy %s\n", __FUNCTION__);
- return _SUCCESS;
-}
-
-u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
-{
- WAPI_TRACE(WAPI_RX, "=========>Dummy %s\n", __FUNCTION__);
- WAPI_TRACE(WAPI_RX, "<=========Dummy %s\n", __FUNCTION__);
- return _SUCCESS;
-}
-
-#endif
-
-#endif
+#ifdef CONFIG_WAPI_SUPPORT
+
+#include <linux/unistd.h>
+#include <linux/etherdevice.h>
+#include <drv_types.h>
+#include <rtw_wapi.h>
+
+
+#ifdef CONFIG_WAPI_SW_SMS4
+
+#define WAPI_LITTLE_ENDIAN
+//#define BIG_ENDIAN
+#define ENCRYPT 0
+#define DECRYPT 1
+
+
+/**********************************************************
+ **********************************************************/
+const u8 Sbox[256] = {
+0xd6,0x90,0xe9,0xfe,0xcc,0xe1,0x3d,0xb7,0x16,0xb6,0x14,0xc2,0x28,0xfb,0x2c,0x05,
+0x2b,0x67,0x9a,0x76,0x2a,0xbe,0x04,0xc3,0xaa,0x44,0x13,0x26,0x49,0x86,0x06,0x99,
+0x9c,0x42,0x50,0xf4,0x91,0xef,0x98,0x7a,0x33,0x54,0x0b,0x43,0xed,0xcf,0xac,0x62,
+0xe4,0xb3,0x1c,0xa9,0xc9,0x08,0xe8,0x95,0x80,0xdf,0x94,0xfa,0x75,0x8f,0x3f,0xa6,
+0x47,0x07,0xa7,0xfc,0xf3,0x73,0x17,0xba,0x83,0x59,0x3c,0x19,0xe6,0x85,0x4f,0xa8,
+0x68,0x6b,0x81,0xb2,0x71,0x64,0xda,0x8b,0xf8,0xeb,0x0f,0x4b,0x70,0x56,0x9d,0x35,
+0x1e,0x24,0x0e,0x5e,0x63,0x58,0xd1,0xa2,0x25,0x22,0x7c,0x3b,0x01,0x21,0x78,0x87,
+0xd4,0x00,0x46,0x57,0x9f,0xd3,0x27,0x52,0x4c,0x36,0x02,0xe7,0xa0,0xc4,0xc8,0x9e,
+0xea,0xbf,0x8a,0xd2,0x40,0xc7,0x38,0xb5,0xa3,0xf7,0xf2,0xce,0xf9,0x61,0x15,0xa1,
+0xe0,0xae,0x5d,0xa4,0x9b,0x34,0x1a,0x55,0xad,0x93,0x32,0x30,0xf5,0x8c,0xb1,0xe3,
+0x1d,0xf6,0xe2,0x2e,0x82,0x66,0xca,0x60,0xc0,0x29,0x23,0xab,0x0d,0x53,0x4e,0x6f,
+0xd5,0xdb,0x37,0x45,0xde,0xfd,0x8e,0x2f,0x03,0xff,0x6a,0x72,0x6d,0x6c,0x5b,0x51,
+0x8d,0x1b,0xaf,0x92,0xbb,0xdd,0xbc,0x7f,0x11,0xd9,0x5c,0x41,0x1f,0x10,0x5a,0xd8,
+0x0a,0xc1,0x31,0x88,0xa5,0xcd,0x7b,0xbd,0x2d,0x74,0xd0,0x12,0xb8,0xe5,0xb4,0xb0,
+0x89,0x69,0x97,0x4a,0x0c,0x96,0x77,0x7e,0x65,0xb9,0xf1,0x09,0xc5,0x6e,0xc6,0x84,
+0x18,0xf0,0x7d,0xec,0x3a,0xdc,0x4d,0x20,0x79,0xee,0x5f,0x3e,0xd7,0xcb,0x39,0x48
+};
+
+const u32 CK[32] = {
+ 0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
+ 0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
+ 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
+ 0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9,
+ 0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229,
+ 0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299,
+ 0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
+ 0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279 };
+
+#define Rotl(_x, _y) (((_x) << (_y)) | ((_x) >> (32 - (_y))))
+
+#define ByteSub(_A) (Sbox[(_A) >> 24 & 0xFF] << 24 | \
+ Sbox[(_A) >> 16 & 0xFF] << 16 | \
+ Sbox[(_A) >> 8 & 0xFF] << 8 | \
+ Sbox[(_A) & 0xFF])
+
+#define L1(_B) ((_B) ^ Rotl(_B, 2) ^ Rotl(_B, 10) ^ Rotl(_B, 18) ^ Rotl(_B, 24))
+#define L2(_B) ((_B) ^ Rotl(_B, 13) ^ Rotl(_B, 23))
+
+static void
+xor_block(void *dst, void *src1, void *src2)
+/* 128-bit xor: *dst = *src1 xor *src2. Pointers must be 32-bit aligned */
+{
+ ((u32 *)dst)[0] = ((u32 *)src1)[0] ^ ((u32 *)src2)[0];
+ ((u32 *)dst)[1] = ((u32 *)src1)[1] ^ ((u32 *)src2)[1];
+ ((u32 *)dst)[2] = ((u32 *)src1)[2] ^ ((u32 *)src2)[2];
+ ((u32 *)dst)[3] = ((u32 *)src1)[3] ^ ((u32 *)src2)[3];
+}
+
+
+void SMS4Crypt(u8 *Input, u8 *Output, u32 *rk)
+{
+ u32 r, mid, x0, x1, x2, x3, *p;
+ p = (u32 *)Input;
+ x0 = p[0];
+ x1 = p[1];
+ x2 = p[2];
+ x3 = p[3];
+#ifdef WAPI_LITTLE_ENDIAN
+ x0 = Rotl(x0, 16); x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
+ x1 = Rotl(x1, 16); x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
+ x2 = Rotl(x2, 16); x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
+ x3 = Rotl(x3, 16); x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
+#endif
+ for (r = 0; r < 32; r += 4)
+ {
+ mid = x1 ^ x2 ^ x3 ^ rk[r + 0];
+ mid = ByteSub(mid);
+ x0 ^= L1(mid);
+ mid = x2 ^ x3 ^ x0 ^ rk[r + 1];
+ mid = ByteSub(mid);
+ x1 ^= L1(mid);
+ mid = x3 ^ x0 ^ x1 ^ rk[r + 2];
+ mid = ByteSub(mid);
+ x2 ^= L1(mid);
+ mid = x0 ^ x1 ^ x2 ^ rk[r + 3];
+ mid = ByteSub(mid);
+ x3 ^= L1(mid);
+ }
+#ifdef WAPI_LITTLE_ENDIAN
+ x0 = Rotl(x0, 16); x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
+ x1 = Rotl(x1, 16); x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
+ x2 = Rotl(x2, 16); x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
+ x3 = Rotl(x3, 16); x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
+#endif
+ p = (u32 *)Output;
+ p[0] = x3;
+ p[1] = x2;
+ p[2] = x1;
+ p[3] = x0;
+}
+
+
+
+void SMS4KeyExt(u8 *Key, u32 *rk, u32 CryptFlag)
+{
+ u32 r, mid, x0, x1, x2, x3, *p;
+
+ p = (u32 *)Key;
+ x0 = p[0];
+ x1 = p[1];
+ x2 = p[2];
+ x3 = p[3];
+#ifdef WAPI_LITTLE_ENDIAN
+ x0 = Rotl(x0, 16); x0 = ((x0 & 0xFF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
+ x1 = Rotl(x1, 16); x1 = ((x1 & 0xFF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
+ x2 = Rotl(x2, 16); x2 = ((x2 & 0xFF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
+ x3 = Rotl(x3, 16); x3 = ((x3 & 0xFF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
+#endif
+
+ x0 ^= 0xa3b1bac6;
+ x1 ^= 0x56aa3350;
+ x2 ^= 0x677d9197;
+ x3 ^= 0xb27022dc;
+ for (r = 0; r < 32; r += 4)
+ {
+ mid = x1 ^ x2 ^ x3 ^ CK[r + 0];
+ mid = ByteSub(mid);
+ rk[r + 0] = x0 ^= L2(mid);
+ mid = x2 ^ x3 ^ x0 ^ CK[r + 1];
+ mid = ByteSub(mid);
+ rk[r + 1] = x1 ^= L2(mid);
+ mid = x3 ^ x0 ^ x1 ^ CK[r + 2];
+ mid = ByteSub(mid);
+ rk[r + 2] = x2 ^= L2(mid);
+ mid = x0 ^ x1 ^ x2 ^ CK[r + 3];
+ mid = ByteSub(mid);
+ rk[r + 3] = x3 ^= L2(mid);
+ }
+ if (CryptFlag == DECRYPT)
+ {
+ for (r = 0; r < 16; r++)
+ mid = rk[r], rk[r] = rk[31 - r], rk[31 - r] = mid;
+ }
+}
+
+
+void WapiSMS4Cryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
+ u8 *Output, u16 *OutputLength, u32 CryptFlag)
+{
+ u32 blockNum,i,j, rk[32];
+ u16 remainder;
+ u8 blockIn[16],blockOut[16], tempIV[16], k;
+
+ *OutputLength = 0;
+ remainder = InputLength & 0x0F;
+ blockNum = InputLength >> 4;
+ if(remainder !=0)
+ blockNum++;
+ else
+ remainder = 16;
+
+ for(k=0;k<16;k++)
+ tempIV[k] = IV[15-k];
+
+ memcpy(blockIn, tempIV, 16);
+
+ SMS4KeyExt((u8 *)Key, rk,CryptFlag);
+
+ for(i=0; i<blockNum-1; i++)
+ {
+ SMS4Crypt((u8 *)blockIn, blockOut, rk);
+ xor_block(&Output[i*16], &Input[i*16], blockOut);
+ memcpy(blockIn,blockOut,16);
+ }
+
+ *OutputLength = i*16;
+
+ SMS4Crypt((u8 *)blockIn, blockOut, rk);
+
+ for(j=0; j<remainder; j++)
+ {
+ Output[i*16+j] = Input[i*16+j] ^ blockOut[j];
+ }
+ *OutputLength += remainder;
+
+}
+
+void WapiSMS4Encryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
+ u8 *Output, u16 *OutputLength)
+{
+
+ WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
+}
+
+void WapiSMS4Decryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
+ u8 *Output, u16 *OutputLength)
+{
+ // OFB mode: is also ENCRYPT flag
+ WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
+}
+
+void WapiSMS4CalculateMic(u8 *Key, u8 *IV, u8 *Input1, u8 Input1Length,
+ u8 *Input2, u16 Input2Length, u8 *Output, u8 *OutputLength)
+{
+ u32 blockNum, i, remainder, rk[32];
+ u8 BlockIn[16], BlockOut[16], TempBlock[16], tempIV[16], k;
+
+ *OutputLength = 0;
+ remainder = Input1Length & 0x0F;
+ blockNum = Input1Length >> 4;
+
+ for(k=0;k<16;k++)
+ tempIV[k] = IV[15-k];
+
+ memcpy(BlockIn, tempIV, 16);
+
+ SMS4KeyExt((u8 *)Key, rk, ENCRYPT);
+
+ SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
+
+ for(i=0; i<blockNum; i++){
+ xor_block(BlockIn, (Input1+i*16), BlockOut);
+ SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
+ }
+
+ if(remainder !=0){
+ memset(TempBlock, 0, 16);
+ memcpy(TempBlock, (Input1+blockNum*16), remainder);
+
+ xor_block(BlockIn, TempBlock, BlockOut);
+ SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
+ }
+
+ remainder = Input2Length & 0x0F;
+ blockNum = Input2Length >> 4;
+
+ for(i=0; i<blockNum; i++){
+ xor_block(BlockIn, (Input2+i*16), BlockOut);
+ SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
+ }
+
+ if(remainder !=0){
+ memset(TempBlock, 0, 16);
+ memcpy(TempBlock, (Input2+blockNum*16), remainder);
+
+ xor_block(BlockIn, TempBlock, BlockOut);
+ SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
+ }
+
+ memcpy(Output, BlockOut, 16);
+ *OutputLength = 16;
+}
+
+void SecCalculateMicSMS4(
+ u8 KeyIdx,
+ u8 *MicKey,
+ u8 *pHeader,
+ u8 *pData,
+ u16 DataLen,
+ u8 *MicBuffer
+ )
+{
+#if 0
+ struct ieee80211_hdr_3addr_qos *header;
+ u8 TempBuf[34], TempLen = 32, MicLen, QosOffset, *IV;
+ u16 *pTemp, fc;
+
+ WAPI_TRACE(WAPI_TX|WAPI_RX, "=========>%s\n", __FUNCTION__);
+
+ header = (struct ieee80211_hdr_3addr_qos *)pHeader;
+ memset(TempBuf, 0, 34);
+ memcpy(TempBuf, pHeader, 2); //FrameCtrl
+ pTemp = (u16*)TempBuf;
+ *pTemp &= 0xc78f; //bit4,5,6,11,12,13
+
+ memcpy((TempBuf+2), (pHeader+4), 12); //Addr1, Addr2
+ memcpy((TempBuf+14), (pHeader+22), 2); // SeqCtrl
+ pTemp = (u16*)(TempBuf + 14);
+ *pTemp &= 0x000f;
+
+ memcpy((TempBuf+16), (pHeader+16), 6); //Addr3
+
+ fc = le16_to_cpu(header->frame_ctl);
+
+
+
+ if (GetFrDs((u16*)&fc) && GetToDs((u16 *)&fc))
+ {
+ memcpy((TempBuf+22), (pHeader+24), 6);
+ QosOffset = 30;
+ }else{
+ memset((TempBuf+22), 0, 6);
+ QosOffset = 24;
+ }
+
+ if((fc & 0x0088) == 0x0088){
+ memcpy((TempBuf+28), (pHeader+QosOffset), 2);
+ TempLen += 2;
+ //IV = pHeader + QosOffset + 2 + SNAP_SIZE + sizeof(u16) + 2;
+ IV = pHeader + QosOffset + 2 + 2;
+ }else{
+ IV = pHeader + QosOffset + 2;
+ //IV = pHeader + QosOffset + SNAP_SIZE + sizeof(u16) + 2;
+ }
+
+ TempBuf[TempLen-1] = (u8)(DataLen & 0xff);
+ TempBuf[TempLen-2] = (u8)((DataLen & 0xff00)>>8);
+ TempBuf[TempLen-4] = KeyIdx;
+
+ WAPI_DATA(WAPI_TX, "CalculateMic - KEY", MicKey, 16);
+ WAPI_DATA(WAPI_TX, "CalculateMic - IV", IV, 16);
+ WAPI_DATA(WAPI_TX, "CalculateMic - TempBuf", TempBuf, TempLen);
+ WAPI_DATA(WAPI_TX, "CalculateMic - pData", pData, DataLen);
+
+ WapiSMS4CalculateMic(MicKey, IV, TempBuf, TempLen,
+ pData, DataLen, MicBuffer, &MicLen);
+
+ if (MicLen != 16)
+ WAPI_TRACE(WAPI_ERR,"%s: MIC Length Error!!\n",__FUNCTION__);
+
+ WAPI_TRACE(WAPI_TX|WAPI_RX, "<=========%s\n", __FUNCTION__);
+#endif
+}
+
+/* AddCount: 1 or 2.
+ * If overflow, return 1,
+ * else return 0.
+ */
+u8 WapiIncreasePN(u8 *PN, u8 AddCount)
+{
+ u8 i;
+
+ if (NULL == PN)
+ return 1;
+ //YJ,test,091102
+ /*
+ if(AddCount == 2){
+ DBG_8192C("############################%s(): PN[0]=0x%x\n", __FUNCTION__, PN[0]);
+ if(PN[0] == 0x48){
+ PN[0] += AddCount;
+ return 1;
+ }else{
+ PN[0] += AddCount;
+ return 0;
+ }
+ }
+ */
+ //YJ,test,091102,end
+
+ for (i=0; i<16; i++)
+ {
+ if (PN[i] + AddCount <= 0xff)
+ {
+ PN[i] += AddCount;
+ return 0;
+ }
+ else
+ {
+ PN[i] += AddCount;
+ AddCount = 1;
+ }
+ }
+ return 1;
+}
+
+
+void WapiGetLastRxUnicastPNForQoSData(
+ u8 UserPriority,
+ PRT_WAPI_STA_INFO pWapiStaInfo,
+ u8 *PNOut
+)
+{
+ WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
+ switch(UserPriority)
+ {
+ case 0:
+ case 3:
+ memcpy(PNOut,pWapiStaInfo->lastRxUnicastPNBEQueue,16);
+ break;
+ case 1:
+ case 2:
+ memcpy(PNOut,pWapiStaInfo->lastRxUnicastPNBKQueue,16);
+ break;
+ case 4:
+ case 5:
+ memcpy(PNOut,pWapiStaInfo->lastRxUnicastPNVIQueue,16);
+ break;
+ case 6:
+ case 7:
+ memcpy(PNOut,pWapiStaInfo->lastRxUnicastPNVOQueue,16);
+ break;
+ default:
+ WAPI_TRACE(WAPI_ERR, "%s: Unknown TID \n", __FUNCTION__);
+ break;
+ }
+ WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
+}
+
+
+void WapiSetLastRxUnicastPNForQoSData(
+ u8 UserPriority,
+ u8 *PNIn,
+ PRT_WAPI_STA_INFO pWapiStaInfo
+)
+{
+ WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
+ switch(UserPriority)
+ {
+ case 0:
+ case 3:
+ memcpy(pWapiStaInfo->lastRxUnicastPNBEQueue,PNIn,16);
+ break;
+ case 1:
+ case 2:
+ memcpy(pWapiStaInfo->lastRxUnicastPNBKQueue,PNIn,16);
+ break;
+ case 4:
+ case 5:
+ memcpy(pWapiStaInfo->lastRxUnicastPNVIQueue,PNIn,16);
+ break;
+ case 6:
+ case 7:
+ memcpy(pWapiStaInfo->lastRxUnicastPNVOQueue,PNIn,16);
+ break;
+ default:
+ WAPI_TRACE(WAPI_ERR, "%s: Unknown TID \n", __FUNCTION__);
+ break;
+ }
+ WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
+}
+
+
+/****************************************************************************
+ FALSE not RX-Reorder
+ TRUE do RX Reorder
+add to support WAPI to N-mode
+*****************************************************************************/
+u8 WapiCheckPnInSwDecrypt(
+ _adapter *padapter,
+ struct sk_buff *pskb
+)
+{
+ u8 ret = false;
+
+#if 0
+ struct ieee80211_hdr_3addr_qos *header;
+ u16 fc;
+ u8 *pDaddr, *pTaddr, *pRaddr;
+
+ header = (struct ieee80211_hdr_3addr_qos *)pskb->data;
+ pTaddr = header->addr2;
+ pRaddr = header->addr1;
+ fc = le16_to_cpu(header->frame_ctl);
+
+ if(GetToDs(&fc))
+ pDaddr = header->addr3;
+ else
+ pDaddr = header->addr1;
+
+ if ((_rtw_memcmp(pRaddr, padapter->pnetdev->dev_addr, ETH_ALEN) == 0)
+ && ! (pDaddr)
+ && (GetFrameType(&fc) == WIFI_QOS_DATA_TYPE))
+ //&& ieee->pHTInfo->bCurrentHTSupport &&
+ //ieee->pHTInfo->bCurRxReorderEnable)
+ ret = false;
+ else
+ ret = true;
+#endif
+ WAPI_TRACE(WAPI_RX, "%s: return %d\n", __FUNCTION__, ret);
+ return ret;
+}
+
+int SecSMS4HeaderFillIV(_adapter *padapter, u8 *pxmitframe)
+{
+ struct pkt_attrib *pattrib = &((struct xmit_frame*)pxmitframe)->attrib;
+ u8 * frame = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
+ u8 *pSecHeader = NULL, *pos = NULL, *pRA = NULL;
+ u8 bPNOverflow = false, bFindMatchPeer = false, hdr_len = 0;
+ PWLAN_HEADER_WAPI_EXTENSION pWapiExt = NULL;
+ PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
+ PRT_WAPI_STA_INFO pWapiSta = NULL;
+ int ret = 0;
+
+ WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
+
+ return ret;
+#if 0
+ hdr_len = sMacHdrLng;
+ if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE)
+ {
+ hdr_len += 2;
+ }
+ //hdr_len += SNAP_SIZE + sizeof(u16);
+
+ pos = skb_push(pskb, padapter->wapiInfo.extra_prefix_len);
+ memmove(pos, pos+padapter->wapiInfo.extra_prefix_len, hdr_len);
+
+ pSecHeader = pskb->data + hdr_len;
+ pWapiExt = (PWLAN_HEADER_WAPI_EXTENSION)pSecHeader;
+ pRA = pskb->data + 4;
+
+ WAPI_DATA(WAPI_TX, "FillIV - Before Fill IV", pskb->data, pskb->len);
+
+ //Address 1 is always receiver's address
+ if( IS_MCAST(pRA) ){
+ if(!pWapiInfo->wapiTxMsk.bTxEnable){
+ WAPI_TRACE(WAPI_ERR,"%s: bTxEnable = 0!!\n",__FUNCTION__);
+ return -2;
+ }
+ if(pWapiInfo->wapiTxMsk.keyId <= 1){
+ pWapiExt->KeyIdx = pWapiInfo->wapiTxMsk.keyId;
+ pWapiExt->Reserved = 0;
+ bPNOverflow = WapiIncreasePN(pWapiInfo->lastTxMulticastPN, 1);
+ memcpy(pWapiExt->PN, pWapiInfo->lastTxMulticastPN, 16);
+ if (bPNOverflow){
+ // Update MSK Notification.
+ WAPI_TRACE(WAPI_ERR,"===============>%s():multicast PN overflow\n",__FUNCTION__);
+ rtw_wapi_app_event_handler(padapter,NULL,0,pRA, false, false, true, 0, false);
+ }
+ }else{
+ WAPI_TRACE(WAPI_ERR,"%s: Invalid Wapi Multicast KeyIdx!!\n",__FUNCTION__);
+ ret = -3;
+ }
+ }
+ else{
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
+ if(!memcmp(pWapiSta->PeerMacAddr,pRA,6)){
+ bFindMatchPeer = true;
+ break;
+ }
+ }
+ if (bFindMatchPeer){
+ if((!pWapiSta->wapiUskUpdate.bTxEnable) && (!pWapiSta->wapiUsk.bTxEnable)){
+ WAPI_TRACE(WAPI_ERR,"%s: bTxEnable = 0!!\n",__FUNCTION__);
+ return -4;
+ }
+ if (pWapiSta->wapiUsk.keyId <= 1){
+ if(pWapiSta->wapiUskUpdate.bTxEnable)
+ pWapiExt->KeyIdx = pWapiSta->wapiUskUpdate.keyId;
+ else
+ pWapiExt->KeyIdx = pWapiSta->wapiUsk.keyId;
+
+ pWapiExt->Reserved = 0;
+ bPNOverflow = WapiIncreasePN(pWapiSta->lastTxUnicastPN, 2);
+ memcpy(pWapiExt->PN, pWapiSta->lastTxUnicastPN, 16);
+ if (bPNOverflow){
+ // Update USK Notification.
+ WAPI_TRACE(WAPI_ERR,"===============>%s():unicast PN overflow\n",__FUNCTION__);
+ rtw_wapi_app_event_handler(padapter,NULL,0,pWapiSta->PeerMacAddr, false, true, false, 0, false);
+ }
+ }else{
+ WAPI_TRACE(WAPI_ERR,"%s: Invalid Wapi Unicast KeyIdx!!\n",__FUNCTION__);
+ ret = -5;
+ }
+ }
+ else{
+ WAPI_TRACE(WAPI_ERR,"%s: Can not find Peer Sta "MAC_FMT"!!\n",__FUNCTION__, MAC_ARG(pRA));
+ ret = -6;
+ }
+ }
+
+ WAPI_DATA(WAPI_TX, "FillIV - After Fill IV", pskb->data, pskb->len);
+ WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
+ return ret;
+#endif
+}
+
+// WAPI SW Enc: must have done Coalesce!
+void SecSWSMS4Encryption(
+ _adapter *padapter,
+ u8 * pxmitframe
+ )
+{
+ PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
+ PRT_WAPI_STA_INFO pWapiSta = NULL;
+ u8 *pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + TXDESC_SIZE;
+ struct pkt_attrib *pattrib = &((struct xmit_frame*)pxmitframe)->attrib;
+
+ u8 *SecPtr = NULL, *pRA, *pMicKey = NULL, *pDataKey = NULL, *pIV = NULL;
+ u8 IVOffset, DataOffset, bFindMatchPeer = false, KeyIdx = 0, MicBuffer[16];
+ u16 OutputLength;
+
+ WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
+
+ WAPI_TRACE(WAPI_TX,"hdrlen: %d \n",pattrib->hdrlen);
+
+ return;
+
+ DataOffset = pattrib->hdrlen + pattrib->iv_len;
+
+ pRA = pframe + 4;
+
+
+ if( IS_MCAST(pRA) ){
+ KeyIdx = pWapiInfo->wapiTxMsk.keyId;
+ pIV = pWapiInfo->lastTxMulticastPN;
+ pMicKey = pWapiInfo->wapiTxMsk.micKey;
+ pDataKey = pWapiInfo->wapiTxMsk.dataKey;
+ }else{
+ if (!list_empty(&(pWapiInfo->wapiSTAUsedList))){
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
+ if (0 == memcmp(pWapiSta->PeerMacAddr, pRA, 6)){
+ bFindMatchPeer = true;
+ break;
+ }
+ }
+
+ if (bFindMatchPeer){
+ if (pWapiSta->wapiUskUpdate.bTxEnable){
+ KeyIdx = pWapiSta->wapiUskUpdate.keyId;
+ WAPI_TRACE(WAPI_TX, "%s(): Use update USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
+ pIV = pWapiSta->lastTxUnicastPN;
+ pMicKey = pWapiSta->wapiUskUpdate.micKey;
+ pDataKey = pWapiSta->wapiUskUpdate.dataKey;
+ }else{
+ KeyIdx = pWapiSta->wapiUsk.keyId;
+ WAPI_TRACE(WAPI_TX, "%s(): Use USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
+ pIV = pWapiSta->lastTxUnicastPN;
+ pMicKey = pWapiSta->wapiUsk.micKey;
+ pDataKey = pWapiSta->wapiUsk.dataKey;
+ }
+ }else{
+ WAPI_TRACE(WAPI_ERR,"%s: Can not find Peer Sta!!\n",__FUNCTION__);
+ return;
+ }
+ }else{
+ WAPI_TRACE(WAPI_ERR,"%s: wapiSTAUsedList is empty!!\n",__FUNCTION__);
+ return;
+ }
+ }
+
+ SecPtr = pframe;
+ SecCalculateMicSMS4(KeyIdx, pMicKey, SecPtr, (SecPtr+DataOffset), pattrib->pktlen, MicBuffer);
+
+ WAPI_DATA(WAPI_TX, "Encryption - MIC", MicBuffer, padapter->wapiInfo.extra_postfix_len);
+
+ memcpy(pframe+pattrib->hdrlen+pattrib->iv_len+pattrib->pktlen-pattrib->icv_len,
+ (u8 *)MicBuffer,
+ padapter->wapiInfo.extra_postfix_len
+ );
+
+
+ WapiSMS4Encryption(pDataKey, pIV, (SecPtr+DataOffset),pattrib->pktlen+pattrib->icv_len, (SecPtr+DataOffset), &OutputLength);
+
+ WAPI_DATA(WAPI_TX, "Encryption - After SMS4 encryption",pframe,pattrib->hdrlen+pattrib->iv_len+pattrib->pktlen);
+
+ WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
+}
+
+u8 SecSWSMS4Decryption(
+ _adapter *padapter,
+ u8 *precv_frame,
+ struct recv_priv *precv_priv
+ )
+{
+ PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
+ struct recv_frame_hdr *precv_hdr;
+ PRT_WAPI_STA_INFO pWapiSta = NULL;
+ u8 IVOffset, DataOffset, bFindMatchPeer = false, bUseUpdatedKey = false;
+ u8 KeyIdx, MicBuffer[16], lastRxPNforQoS[16];
+ u8 *pRA, *pTA, *pMicKey, *pDataKey, *pLastRxPN, *pRecvPN, *pSecData, *pRecvMic, *pos;
+ u8 TID = 0;
+ u16 OutputLength, DataLen;
+ u8 bQosData;
+ struct sk_buff * pskb;
+
+ WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
+
+ return 0;
+
+ precv_hdr = &((union recv_frame*)precv_frame)->u.hdr;
+ pskb = (struct sk_buff *)(precv_hdr->rx_data);
+ precv_hdr->bWapiCheckPNInDecrypt = WapiCheckPnInSwDecrypt(padapter, pskb);
+ WAPI_TRACE(WAPI_RX, "=========>%s: check PN %d\n", __FUNCTION__,precv_hdr->bWapiCheckPNInDecrypt);
+ WAPI_DATA(WAPI_RX, "Decryption - Before decryption", pskb->data, pskb->len);
+
+ IVOffset = sMacHdrLng;
+ bQosData = GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE;
+ if (bQosData){
+ IVOffset += 2;
+ }
+
+ //if(GetHTC())
+ // IVOffset += 4;
+
+ //IVOffset += SNAP_SIZE + sizeof(u16);
+
+ DataOffset = IVOffset + padapter->wapiInfo.extra_prefix_len;
+
+ pRA = pskb->data + 4;
+ pTA = pskb->data + 10;
+ KeyIdx = *(pskb->data + IVOffset);
+ pRecvPN = pskb->data + IVOffset + 2;
+ pSecData = pskb->data + DataOffset;
+ DataLen = pskb->len - DataOffset;
+ pRecvMic = pskb->data + pskb->len - padapter->wapiInfo.extra_postfix_len;
+ TID = GetTid(pskb->data);
+
+ if (!list_empty(&(pWapiInfo->wapiSTAUsedList))){
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
+ if (0 == memcmp(pWapiSta->PeerMacAddr, pTA, 6)){
+ bFindMatchPeer = true;
+ break;
+ }
+ }
+ }
+
+ if (!bFindMatchPeer){
+ WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta "MAC_FMT" for Key Info!!!\n", __FUNCTION__, MAC_ARG(pTA));
+ return false;
+ }
+
+ if( IS_MCAST(pRA) ){
+ WAPI_TRACE(WAPI_RX, "%s: Multicast decryption !!!\n", __FUNCTION__);
+ if (pWapiSta->wapiMsk.keyId == KeyIdx && pWapiSta->wapiMsk.bSet){
+ pLastRxPN = pWapiSta->lastRxMulticastPN;
+ if (!WapiComparePN(pRecvPN, pLastRxPN)){
+ WAPI_TRACE(WAPI_ERR, "%s: MSK PN is not larger than last, Dropped!!!\n", __FUNCTION__);
+ WAPI_DATA(WAPI_ERR, "pRecvPN:", pRecvPN, 16);
+ WAPI_DATA(WAPI_ERR, "pLastRxPN:", pLastRxPN, 16);
+ return false;
+ }
+
+ memcpy(pLastRxPN, pRecvPN, 16);
+ pMicKey = pWapiSta->wapiMsk.micKey;
+ pDataKey = pWapiSta->wapiMsk.dataKey;
+ }else if (pWapiSta->wapiMskUpdate.keyId == KeyIdx && pWapiSta->wapiMskUpdate.bSet){
+ WAPI_TRACE(WAPI_RX, "%s: Use Updated MSK for Decryption !!!\n", __FUNCTION__);
+ bUseUpdatedKey = true;
+ memcpy(pWapiSta->lastRxMulticastPN, pRecvPN, 16);
+ pMicKey = pWapiSta->wapiMskUpdate.micKey;
+ pDataKey = pWapiSta->wapiMskUpdate.dataKey;
+ }else{
+ WAPI_TRACE(WAPI_ERR, "%s: Can not find MSK with matched KeyIdx(%d), Dropped !!!\n", __FUNCTION__,KeyIdx);
+ return false;
+ }
+ }
+ else{
+ WAPI_TRACE(WAPI_RX, "%s: Unicast decryption !!!\n", __FUNCTION__);
+ if (pWapiSta->wapiUsk.keyId == KeyIdx && pWapiSta->wapiUsk.bSet){
+ WAPI_TRACE(WAPI_RX, "%s: Use USK for Decryption!!!\n", __FUNCTION__);
+ if(precv_hdr->bWapiCheckPNInDecrypt){
+ if(GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE){
+ WapiGetLastRxUnicastPNForQoSData(TID, pWapiSta, lastRxPNforQoS);
+ pLastRxPN = lastRxPNforQoS;
+ }else{
+ pLastRxPN = pWapiSta->lastRxUnicastPN;
+ }
+ if (!WapiComparePN(pRecvPN, pLastRxPN)){
+ return false;
+ }
+ if(bQosData){
+ WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
+ }else{
+ memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
+ }
+ }else{
+ memcpy(precv_hdr->WapiTempPN,pRecvPN,16);
+ }
+
+ if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE))
+ {
+ if ((pRecvPN[0] & 0x1) == 0){
+ WAPI_TRACE(WAPI_ERR, "%s: Rx USK PN is not odd when Infra STA mode, Dropped !!!\n", __FUNCTION__);
+ return false;
+ }
+ }
+
+ pMicKey = pWapiSta->wapiUsk.micKey;
+ pDataKey = pWapiSta->wapiUsk.dataKey;
+ }
+ else if (pWapiSta->wapiUskUpdate.keyId == KeyIdx && pWapiSta->wapiUskUpdate.bSet ){
+ WAPI_TRACE(WAPI_RX, "%s: Use Updated USK for Decryption!!!\n", __FUNCTION__);
+ if(pWapiSta->bAuthenticatorInUpdata)
+ bUseUpdatedKey = true;
+ else
+ bUseUpdatedKey = false;
+
+ if(bQosData){
+ WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
+ }else{
+ memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
+ }
+ pMicKey = pWapiSta->wapiUskUpdate.micKey;
+ pDataKey = pWapiSta->wapiUskUpdate.dataKey;
+ }else{
+ WAPI_TRACE(WAPI_ERR, "%s: No valid USK!!!KeyIdx=%d pWapiSta->wapiUsk.keyId=%d pWapiSta->wapiUskUpdate.keyId=%d\n", __FUNCTION__, KeyIdx, pWapiSta->wapiUsk.keyId, pWapiSta->wapiUskUpdate.keyId);
+ //dump_buf(pskb->data,pskb->len);
+ return false;
+ }
+ }
+
+ WAPI_DATA(WAPI_RX, "Decryption - DataKey", pDataKey, 16);
+ WAPI_DATA(WAPI_RX, "Decryption - IV", pRecvPN, 16);
+ WapiSMS4Decryption(pDataKey, pRecvPN, pSecData, DataLen, pSecData, &OutputLength);
+
+ if (OutputLength != DataLen)
+ WAPI_TRACE(WAPI_ERR, "%s: Output Length Error!!!!\n", __FUNCTION__);
+
+ WAPI_DATA(WAPI_RX, "Decryption - After decryption", pskb->data, pskb->len);
+
+ DataLen -= padapter->wapiInfo.extra_postfix_len;
+
+ SecCalculateMicSMS4(KeyIdx, pMicKey, pskb->data, pSecData, DataLen, MicBuffer);
+
+ WAPI_DATA(WAPI_RX, "Decryption - MIC received", pRecvMic, SMS4_MIC_LEN);
+ WAPI_DATA(WAPI_RX, "Decryption - MIC calculated", MicBuffer, SMS4_MIC_LEN);
+
+ if (0 == memcmp(MicBuffer, pRecvMic, padapter->wapiInfo.extra_postfix_len)){
+ WAPI_TRACE(WAPI_RX, "%s: Check MIC OK!!\n", __FUNCTION__);
+ if (bUseUpdatedKey){
+ // delete the old key
+ if ( IS_MCAST(pRA) ){
+ WAPI_TRACE(WAPI_API, "%s(): AE use new update MSK!!\n", __FUNCTION__);
+ pWapiSta->wapiMsk.keyId = pWapiSta->wapiMskUpdate.keyId;
+ memcpy(pWapiSta->wapiMsk.dataKey, pWapiSta->wapiMskUpdate.dataKey, 16);
+ memcpy(pWapiSta->wapiMsk.micKey, pWapiSta->wapiMskUpdate.micKey, 16);
+ pWapiSta->wapiMskUpdate.bTxEnable = pWapiSta->wapiMskUpdate.bSet = false;
+ }else{
+ WAPI_TRACE(WAPI_API, "%s(): AE use new update USK!!\n", __FUNCTION__);
+ pWapiSta->wapiUsk.keyId = pWapiSta->wapiUskUpdate.keyId;
+ memcpy(pWapiSta->wapiUsk.dataKey, pWapiSta->wapiUskUpdate.dataKey, 16);
+ memcpy(pWapiSta->wapiUsk.micKey, pWapiSta->wapiUskUpdate.micKey, 16);
+ pWapiSta->wapiUskUpdate.bTxEnable = pWapiSta->wapiUskUpdate.bSet = false;
+ }
+ }
+ }else{
+ WAPI_TRACE(WAPI_ERR, "%s: Check MIC Error, Dropped !!!!\n", __FUNCTION__);
+ return false;
+ }
+
+ pos = pskb->data;
+ memmove(pos+padapter->wapiInfo.extra_prefix_len, pos, IVOffset);
+ skb_pull(pskb, padapter->wapiInfo.extra_prefix_len);
+
+ WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
+
+ return true;
+}
+
+u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
+{
+
+ u8 *pframe;
+ u32 res = _SUCCESS;
+
+ WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_TX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
+ return _FAIL;
+ }
+
+ if(((struct xmit_frame*)pxmitframe)->buf_addr==NULL)
+ return _FAIL;
+
+ pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + TXDESC_OFFSET;
+
+ SecSWSMS4Encryption(padapter, pxmitframe);
+
+ WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
+ return res;
+}
+
+u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
+{
+ u8 *pframe;
+ u32 res = _SUCCESS;
+
+ WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
+
+ if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable))
+ {
+ WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
+ return _FAIL;
+ }
+
+
+ //drop packet when hw decrypt fail
+ //return tempraily
+ return _FAIL;
+
+ //pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data;
+
+ if (false == SecSWSMS4Decryption(padapter, precvframe, &padapter->recvpriv))
+ {
+ WAPI_TRACE(WAPI_ERR, "%s():SMS4 decrypt frame error\n",__FUNCTION__);
+ return _FAIL;
+ }
+
+ WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
+ return res;
+}
+
+#else
+
+u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
+{
+ WAPI_TRACE(WAPI_TX, "=========>Dummy %s\n", __FUNCTION__);
+ WAPI_TRACE(WAPI_TX, "<=========Dummy %s\n", __FUNCTION__);
+ return _SUCCESS;
+}
+
+u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
+{
+ WAPI_TRACE(WAPI_RX, "=========>Dummy %s\n", __FUNCTION__);
+ WAPI_TRACE(WAPI_RX, "<=========Dummy %s\n", __FUNCTION__);
+ return _SUCCESS;
+}
+
+#endif
+
+#endif
diff --git a/rtl8xxx_EU/core/rtw_wlan_util.c b/rtl8xxx_EU/core/rtw_wlan_util.c
index f8e3f60..aa83f77 100755
--- a/rtl8xxx_EU/core/rtw_wlan_util.c
+++ b/rtl8xxx_EU/core/rtw_wlan_util.c
@@ -465,6 +465,13 @@ void Switch_DM_Func(_adapter *padapter, u32 mode, u8 enable)
rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_CLR, (u8 *)(&mode));
}
+void ctrl_dm_func_for_offchannel(_adapter *padapter , u32 mode)
+{
+ Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
+ if (rtw_odm_adaptivity_needed(padapter))
+ rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_SET, (u8 *) (&mode));
+}
+
static void Set_NETYPE1_MSR(_adapter *padapter, u8 type)
{
rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS1, (u8 *)(&type));
diff --git a/rtl8xxx_EU/core/rtw_xmit.c b/rtl8xxx_EU/core/rtw_xmit.c
index 28d5e6e..4b21cc6 100644..100755
--- a/rtl8xxx_EU/core/rtw_xmit.c
+++ b/rtl8xxx_EU/core/rtw_xmit.c
@@ -4121,15 +4121,15 @@ static void dequeue_xmitframes_to_sleeping_queue(_adapter *padapter, struct sta_
plist = get_next(phead);
while (rtw_end_of_queue_search(phead, plist) == _FALSE)
- {
+ {
pxmitframe = LIST_CONTAINOR(plist, struct xmit_frame, list);
plist = get_next(plist);
pattrib = &pxmitframe->attrib;
-
+
pattrib->triggered = 0;
-
+
ret = xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe);
if(_TRUE == ret)
diff --git a/rtl8xxx_EU/hal/HalPwrSeqCmd.c b/rtl8xxx_EU/hal/HalPwrSeqCmd.c
index 425fbef..cd88954 100755
--- a/rtl8xxx_EU/hal/HalPwrSeqCmd.c
+++ b/rtl8xxx_EU/hal/HalPwrSeqCmd.c
@@ -1,183 +1,183 @@
-/******************************************************************************
- *
- * 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
- *
- *
- ******************************************************************************/
-/*++
-Copyright (c) Realtek Semiconductor Corp. All rights reserved.
-
-Module Name:
- HalPwrSeqCmd.c
-
-Abstract:
- Implement HW Power sequence configuration CMD handling routine for Realtek devices.
-
-Major Change History:
- When Who What
- ---------- --------------- -------------------------------
- 2011-10-26 Lucas Modify to be compatible with SD4-CE driver.
- 2011-07-07 Roger Create.
-
---*/
-#include <HalPwrSeqCmd.h>
-
-
-//
-// Description:
-// This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC.
-//
-// Assumption:
-// We should follow specific format which was released from HW SD.
-//
-// 2011.07.07, added by Roger.
-//
-u8 HalPwrSeqCmdParsing(
- PADAPTER padapter,
- u8 CutVersion,
- u8 FabVersion,
- u8 InterfaceType,
- WLAN_PWR_CFG PwrSeqCmd[])
-{
- WLAN_PWR_CFG PwrCfgCmd = {0};
- u8 bPollingBit = _FALSE;
- u32 AryIdx = 0;
- u8 value = 0;
- u32 offset = 0;
- u32 pollingCount = 0; // polling autoload done.
- u32 maxPollingCnt = 5000;
-
- do {
- PwrCfgCmd = PwrSeqCmd[AryIdx];
-
- RT_TRACE(_module_hal_init_c_ , _drv_info_,
- ("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n",
- GET_PWR_CFG_OFFSET(PwrCfgCmd),
- GET_PWR_CFG_CUT_MASK(PwrCfgCmd),
- GET_PWR_CFG_FAB_MASK(PwrCfgCmd),
- GET_PWR_CFG_INTF_MASK(PwrCfgCmd),
- GET_PWR_CFG_BASE(PwrCfgCmd),
- GET_PWR_CFG_CMD(PwrCfgCmd),
- GET_PWR_CFG_MASK(PwrCfgCmd),
- GET_PWR_CFG_VALUE(PwrCfgCmd)));
-
- //2 Only Handle the command whose FAB, CUT, and Interface are matched
- if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) &&
- (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
- (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType))
- {
- switch (GET_PWR_CFG_CMD(PwrCfgCmd))
- {
- case PWR_CMD_READ:
- RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n"));
- break;
-
- case PWR_CMD_WRITE:
- RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n"));
- offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
-
-#ifdef CONFIG_SDIO_HCI
- //
- // <Roger_Notes> We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface
- // 2011.07.07.
- //
- if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
- {
- // Read Back SDIO Local value
- value = SdioLocalCmd52Read1Byte(padapter, offset);
-
- value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
- value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
-
- // Write Back SDIO Local value
- SdioLocalCmd52Write1Byte(padapter, offset, value);
- }
- else
-#endif
- {
-#ifdef CONFIG_GSPI_HCI
- if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
- offset = SPI_LOCAL_OFFSET | offset;
-#endif
- // Read the value from system register
- value = rtw_read8(padapter, offset);
-
- value=value&(~(GET_PWR_CFG_MASK(PwrCfgCmd)));
- value=value|(GET_PWR_CFG_VALUE(PwrCfgCmd)&GET_PWR_CFG_MASK(PwrCfgCmd));
-
- // Write the value back to sytem register
- rtw_write8(padapter, offset, value);
- }
- break;
-
- case PWR_CMD_POLLING:
- RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n"));
-
- bPollingBit = _FALSE;
- offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
-#ifdef CONFIG_GSPI_HCI
- if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
- offset = SPI_LOCAL_OFFSET | offset;
-#endif
- do {
-#ifdef CONFIG_SDIO_HCI
- if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
- value = SdioLocalCmd52Read1Byte(padapter, offset);
- else
-#endif
- value = rtw_read8(padapter, offset);
-
- value=value&GET_PWR_CFG_MASK(PwrCfgCmd);
- if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)))
- bPollingBit = _TRUE;
- else
- rtw_udelay_os(10);
-
- if (pollingCount++ > maxPollingCnt) {
- DBG_871X("Fail to polling Offset[%#x]=%02x\n", offset, value);
- return _FALSE;
- }
- } while (!bPollingBit);
-
- break;
-
- case PWR_CMD_DELAY:
- RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n"));
- if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US)
- rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd));
- else
- rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000);
- break;
-
- case PWR_CMD_END:
- // When this command is parsed, end the process
- RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n"));
- return _TRUE;
- break;
-
- default:
- RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n"));
- break;
- }
- }
-
- AryIdx++;//Add Array Index
- }while(1);
-
- return _TRUE;
-}
-
-
+/******************************************************************************
+ *
+ * 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
+ *
+ *
+ ******************************************************************************/
+/*++
+Copyright (c) Realtek Semiconductor Corp. All rights reserved.
+
+Module Name:
+ HalPwrSeqCmd.c
+
+Abstract:
+ Implement HW Power sequence configuration CMD handling routine for Realtek devices.
+
+Major Change History:
+ When Who What
+ ---------- --------------- -------------------------------
+ 2011-10-26 Lucas Modify to be compatible with SD4-CE driver.
+ 2011-07-07 Roger Create.
+
+--*/
+#include <HalPwrSeqCmd.h>
+
+
+//
+// Description:
+// This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC.
+//
+// Assumption:
+// We should follow specific format which was released from HW SD.
+//
+// 2011.07.07, added by Roger.
+//
+u8 HalPwrSeqCmdParsing(
+ PADAPTER padapter,
+ u8 CutVersion,
+ u8 FabVersion,
+ u8 InterfaceType,
+ WLAN_PWR_CFG PwrSeqCmd[])
+{
+ WLAN_PWR_CFG PwrCfgCmd = {0};
+ u8 bPollingBit = _FALSE;
+ u32 AryIdx = 0;
+ u8 value = 0;
+ u32 offset = 0;
+ u32 pollingCount = 0; // polling autoload done.
+ u32 maxPollingCnt = 5000;
+
+ do {
+ PwrCfgCmd = PwrSeqCmd[AryIdx];
+
+ RT_TRACE(_module_hal_init_c_ , _drv_info_,
+ ("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n",
+ GET_PWR_CFG_OFFSET(PwrCfgCmd),
+ GET_PWR_CFG_CUT_MASK(PwrCfgCmd),
+ GET_PWR_CFG_FAB_MASK(PwrCfgCmd),
+ GET_PWR_CFG_INTF_MASK(PwrCfgCmd),
+ GET_PWR_CFG_BASE(PwrCfgCmd),
+ GET_PWR_CFG_CMD(PwrCfgCmd),
+ GET_PWR_CFG_MASK(PwrCfgCmd),
+ GET_PWR_CFG_VALUE(PwrCfgCmd)));
+
+ //2 Only Handle the command whose FAB, CUT, and Interface are matched
+ if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) &&
+ (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
+ (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType))
+ {
+ switch (GET_PWR_CFG_CMD(PwrCfgCmd))
+ {
+ case PWR_CMD_READ:
+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n"));
+ break;
+
+ case PWR_CMD_WRITE:
+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n"));
+ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
+
+#ifdef CONFIG_SDIO_HCI
+ //
+ // <Roger_Notes> We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface
+ // 2011.07.07.
+ //
+ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
+ {
+ // Read Back SDIO Local value
+ value = SdioLocalCmd52Read1Byte(padapter, offset);
+
+ value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
+ value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
+
+ // Write Back SDIO Local value
+ SdioLocalCmd52Write1Byte(padapter, offset, value);
+ }
+ else
+#endif
+ {
+#ifdef CONFIG_GSPI_HCI
+ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
+ offset = SPI_LOCAL_OFFSET | offset;
+#endif
+ // Read the value from system register
+ value = rtw_read8(padapter, offset);
+
+ value=value&(~(GET_PWR_CFG_MASK(PwrCfgCmd)));
+ value=value|(GET_PWR_CFG_VALUE(PwrCfgCmd)&GET_PWR_CFG_MASK(PwrCfgCmd));
+
+ // Write the value back to sytem register
+ rtw_write8(padapter, offset, value);
+ }
+ break;
+
+ case PWR_CMD_POLLING:
+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n"));
+
+ bPollingBit = _FALSE;
+ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
+#ifdef CONFIG_GSPI_HCI
+ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
+ offset = SPI_LOCAL_OFFSET | offset;
+#endif
+ do {
+#ifdef CONFIG_SDIO_HCI
+ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
+ value = SdioLocalCmd52Read1Byte(padapter, offset);
+ else
+#endif
+ value = rtw_read8(padapter, offset);
+
+ value=value&GET_PWR_CFG_MASK(PwrCfgCmd);
+ if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)))
+ bPollingBit = _TRUE;
+ else
+ rtw_udelay_os(10);
+
+ if (pollingCount++ > maxPollingCnt) {
+ DBG_871X("Fail to polling Offset[%#x]=%02x\n", offset, value);
+ return _FALSE;
+ }
+ } while (!bPollingBit);
+
+ break;
+
+ case PWR_CMD_DELAY:
+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n"));
+ if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US)
+ rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd));
+ else
+ rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000);
+ break;
+
+ case PWR_CMD_END:
+ // When this command is parsed, end the process
+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n"));
+ return _TRUE;
+ break;
+
+ default:
+ RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n"));
+ break;
+ }
+ }
+
+ AryIdx++;//Add Array Index
+ }while(1);
+
+ return _TRUE;
+}
+
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c
index 65cf94e..e198992 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c
@@ -1,2053 +1,2053 @@
-//============================================================
-// Description:
-//
-// This file is for 92CE/92CU BT 1 Antenna Co-exist mechanism
-//
-// By cosa 02/11/2011
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8188C_2ANT GLCoexDm8188c2Ant;
-static PCOEX_DM_8188C_2ANT pCoexDm=&GLCoexDm8188c2Ant;
-static COEX_STA_8188C_2ANT GLCoexSta8188c2Ant;
-static PCOEX_STA_8188C_2ANT pCoexSta=&GLCoexSta8188c2Ant;
-
-//============================================================
-// local function start with btdm_
-//============================================================
-u1Byte
-halbtc8188c2ant_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_8188C_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_8188C_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_8188C_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;
-}
-
-u1Byte
-halbtc8188c2ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- u1Byte algorithm=BT_8188C_2ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- 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(pStackInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO algorithm\n"));
- algorithm = BT_8188C_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(numOfDiffProfile == 1)
- {
- if(pStackInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8188C_2ANT_COEX_ALGO_HID;
- }
- else if(pStackInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8188C_2ANT_COEX_ALGO_A2DP;
- }
- else if(pStackInfo->bPanExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN only\n"));
- algorithm = BT_8188C_2ANT_COEX_ALGO_PAN;
- }
- }
- else
- {
- if( pStackInfo->bHidExist &&
- pStackInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8188C_2ANT_COEX_ALGO_HID_A2DP;
- }
- else if( pStackInfo->bHidExist &&
- pStackInfo->bPanExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN\n"));
- algorithm = BT_8188C_2ANT_COEX_ALGO_HID_PAN;
- }
- else if( pStackInfo->bPanExist &&
- pStackInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN + A2DP\n"));
- algorithm = BT_8188C_2ANT_COEX_ALGO_PAN_A2DP;
- }
- }
- }
- return algorithm;
-}
-
-VOID
-halbtc8188c2ant_SetFwBalance(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bBalanceOn,
- IN u1Byte ms0,
- IN u1Byte ms1
- )
-{
- u1Byte H2C_Parameter[3] ={0};
-
- if(bBalanceOn)
- {
- H2C_Parameter[2] = 1;
- H2C_Parameter[1] = ms1;
- H2C_Parameter[0] = ms0;
- }
- else
- {
- H2C_Parameter[2] = 0;
- H2C_Parameter[1] = 0;
- H2C_Parameter[0] = 0;
- }
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Balance=[%s:%dms:%dms], write 0xc=0x%x\n",
- bBalanceOn?"ON":"OFF", ms0, ms1,
- H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0xc, 3, H2C_Parameter);
-}
-
-VOID
-halbtc8188c2ant_Balance(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bBalanceOn,
- IN u1Byte ms0,
- IN u1Byte ms1
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Balance %s\n",
- (bForceExec? "force to":""), (bBalanceOn? "ON":"OFF")));
- pCoexDm->bCurBalanceOn = bBalanceOn;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBalanceOn = %d, bCurBalanceOn = %d!!\n",
- pCoexDm->bPreBalanceOn, pCoexDm->bCurBalanceOn));
-
- if(pCoexDm->bPreBalanceOn == pCoexDm->bCurBalanceOn)
- return;
- }
- halbtc8188c2ant_SetFwBalance(pBtCoexist, bBalanceOn, ms0, ms1);
-
- pCoexDm->bPreBalanceOn = pCoexDm->bCurBalanceOn;
-}
-
-VOID
-halbtc8188c2ant_SetFwDiminishWifi(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bDacOn,
- IN BOOLEAN bInterruptOn,
- IN u1Byte fwDacSwingLvl,
- IN BOOLEAN bNavOn
- )
-{
- u1Byte H2C_Parameter[3] ={0};
-
- if((pBtCoexist->stackInfo.minBtRssi <= -5) && (fwDacSwingLvl == 0x20))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], DiminishWiFi 0x20 original, but set 0x18 for Low RSSI!\n"));
- fwDacSwingLvl = 0x18;
- }
-
- H2C_Parameter[2] = 0;
- H2C_Parameter[1] = fwDacSwingLvl;
- H2C_Parameter[0] = 0;
- if(bDacOn)
- {
- H2C_Parameter[2] |= 0x01; //BIT0
- if(bInterruptOn)
- {
- H2C_Parameter[2] |= 0x02; //BIT1
- }
- }
- if(bNavOn)
- {
- H2C_Parameter[2] |= 0x08; //BIT3
- }
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], bDacOn=%s, bInterruptOn=%s, bNavOn=%s, write 0xe=0x%x\n",
- (bDacOn?"ON":"OFF"), (bInterruptOn?"ON":"OFF"), (bNavOn?"ON":"OFF"),
- (H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2])));
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0xe, 3, H2C_Parameter);
-}
-
-VOID
-halbtc8188c2ant_DiminishWifi(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bDacOn,
- IN BOOLEAN bInterruptOn,
- IN u1Byte fwDacSwingLvl,
- IN BOOLEAN bNavOn
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set Diminish Wifi, bDacOn=%s, bInterruptOn=%s, fwDacSwingLvl=%d, bNavOn=%s\n",
- (bForceExec? "force to":""), (bDacOn? "ON":"OFF"), (bInterruptOn? "ON":"OFF"), fwDacSwingLvl, (bNavOn? "ON":"OFF")));
-
- pCoexDm->bCurDacOn = bDacOn;
- pCoexDm->bCurInterruptOn = bInterruptOn;
- pCoexDm->curFwDacSwingLvl = fwDacSwingLvl;
- pCoexDm->bCurNavOn = bNavOn;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreDacOn=%d, bCurDacOn=%d!!\n",
- pCoexDm->bPreDacOn, pCoexDm->bCurDacOn));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreInterruptOn=%d, bCurInterruptOn=%d!!\n",
- pCoexDm->bPreInterruptOn, pCoexDm->bCurInterruptOn));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preFwDacSwingLvl=%d, curFwDacSwingLvl=%d!!\n",
- pCoexDm->preFwDacSwingLvl, pCoexDm->curFwDacSwingLvl));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreNavOn=%d, bCurNavOn=%d!!\n",
- pCoexDm->bPreNavOn, pCoexDm->bCurNavOn));
-
-
- if( (pCoexDm->bPreDacOn==pCoexDm->bCurDacOn) &&
- (pCoexDm->bPreInterruptOn==pCoexDm->bCurInterruptOn) &&
- (pCoexDm->preFwDacSwingLvl==pCoexDm->curFwDacSwingLvl) &&
- (pCoexDm->bPreNavOn==pCoexDm->bCurNavOn) )
- return;
- }
- halbtc8188c2ant_SetFwDiminishWifi(pBtCoexist, bDacOn, bInterruptOn, fwDacSwingLvl, bNavOn);
-
- pCoexDm->bPreDacOn = pCoexDm->bCurDacOn;
- pCoexDm->bPreInterruptOn = pCoexDm->bCurInterruptOn;
- pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
- pCoexDm->bPreNavOn = pCoexDm->bCurNavOn;
-}
-
-VOID
-halbtc8188c2ant_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, 0xf0, 0xf);
- }
- 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, 0xf0, pCoexDm->btRf0x1eBackup);
- }
- }
-}
-
-VOID
-halbtc8188c2ant_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;
- }
- halbtc8188c2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
-
- pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
-}
-
-VOID
-halbtc8188c2ant_SetSwPenaltyTxRateAdaptive(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- u1Byte tmpU1;
-
- tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
- if(bLowPenaltyRa)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
- tmpU1 &= ~BIT2;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
- tmpU1 |= BIT2;
- }
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
-}
-
-VOID
-halbtc8188c2ant_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;
- }
- halbtc8188c2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8188c2ant_SetSwFullTimeDacSwing(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSwDacSwingOn,
- IN u4Byte swDacSwingLvl
- )
-{
- u4Byte dacSwingLvl;
-
- if(bSwDacSwingOn)
- {
- if((pBtCoexist->stackInfo.minBtRssi <= -5) && (swDacSwingLvl == 0x20))
- {
- dacSwingLvl = 0x18;
- }
- else
- {
- dacSwingLvl = swDacSwingLvl;
- }
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xfc000000, dacSwingLvl);
- }
- else
- {
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xfc000000, 0x30);
- }
-}
-
-VOID
-halbtc8188c2ant_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);
- halbtc8188c2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
-
- pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
- pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
-}
-
-VOID
-halbtc8188c2ant_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->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a07611);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a05611);
- }
-}
-
-VOID
-halbtc8188c2ant_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;
- }
- halbtc8188c2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
-
- pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
-}
-
-VOID
-halbtc8188c2ant_SetAgcTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAgcTableEn
- )
-{
- u1Byte rssiAdjustVal=0;
-
- if(bAgcTableEn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4e1c0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4d1d0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4c1e0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4b1f0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4a200001);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x90000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x51000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x12000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x00255);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x641c0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x631d0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x621e0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x611f0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x60200001);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x32000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x71000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xb0000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xfc000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x10255);
- }
-
- // set rssiAdjustVal for wifi module.
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
-}
-
-
-VOID
-halbtc8188c2ant_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;
- }
- halbtc8188c2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
-
- pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
-}
-
-VOID
-halbtc8188c2ant_SetCoexTable(
- IN PBTC_COEXIST pBtCoexist,
- IN u4Byte val0x6c4,
- IN u4Byte val0x6c8,
- IN u4Byte val0x6cc
- )
-{
- 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->fBtcWrite4Byte(pBtCoexist, 0x6cc, val0x6cc);
-}
-
-VOID
-halbtc8188c2ant_CoexTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u4Byte val0x6c4,
- IN u4Byte val0x6c8,
- IN u4Byte val0x6cc
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
- (bForceExec? "force to":""), val0x6c4, val0x6c8, val0x6cc));
- pCoexDm->curVal0x6c4 = val0x6c4;
- pCoexDm->curVal0x6c8 = val0x6c8;
- pCoexDm->curVal0x6cc = val0x6cc;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c4=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n",
- pCoexDm->preVal0x6c4, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c4=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n",
- pCoexDm->curVal0x6c4, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));
-
- if( (pCoexDm->preVal0x6c4 == pCoexDm->curVal0x6c4) &&
- (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
- (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
- return;
- }
- halbtc8188c2ant_SetCoexTable(pBtCoexist, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8188c2ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // fw mechanism
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
-}
-VOID
-halbtc8188c2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-
-VOID
-halbtc8188c2ant_MonitorBtState(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN stateChange=FALSE;
- u4Byte BT_Polling, Ratio_Act, Ratio_STA;
- u4Byte BT_Active, BT_State;
- u4Byte regBTActive=0, regBTState=0, regBTPolling=0;
- u4Byte btBusyThresh=0;
- u4Byte fwVer=0;
- static BOOLEAN bBtBusyTraffic=FALSE;
- BOOLEAN bRejApAggPkt=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], FirmwareVersion = 0x%x(%d)\n", fwVer, fwVer));
- if(fwVer < 62)
- {
- regBTActive = 0x488;
- regBTState = 0x48c;
- regBTPolling = 0x490;
- }
- else
- {
- regBTActive = 0x444;
- regBTState = 0x448;
- if(fwVer >= 74)
- regBTPolling = 0x44c;
- else
- regBTPolling = 0x700;
- }
- btBusyThresh = 60;
-
- BT_Active = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTActive);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_Active(0x%x)=0x%x\n", regBTActive, BT_Active));
- BT_Active = BT_Active & 0x00ffffff;
-
- BT_State = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTState);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_State(0x%x)=0x%x\n", regBTState, BT_State));
- BT_State = BT_State & 0x00ffffff;
-
- BT_Polling = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTPolling);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_Polling(0x%x)=0x%x\n", regBTPolling, BT_Polling));
-
- if(BT_Active==0xffffffff && BT_State==0xffffffff && BT_Polling==0xffffffff )
- return;
-
- // 2011/05/04 MH For Slim combo test meet a problem. Surprise remove and WLAN is running
- // DHCP process. At the same time, the register read value might be zero. And cause BSOD 0x7f
- // EXCEPTION_DIVIDED_BY_ZERO. In This case, the stack content may always be wrong due to
- // HW divide trap.
- if (BT_Polling==0)
- return;
-
- Ratio_Act = BT_Active*1000/BT_Polling;
- Ratio_STA = BT_State*1000/BT_Polling;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Ratio_Act=%d\n", Ratio_Act));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Ratio_STA=%d\n", Ratio_STA));
-
- if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- if(Ratio_STA < 60) // BT PAN idle
- {
- }
- else
- {
- // Check if BT PAN (under BT 2.1) is uplink or downlink
- if((Ratio_Act/Ratio_STA) < 2)
- { // BT PAN Uplink
- pCoexSta->bBtUplink = TRUE;
- }
- else
- { // BT PAN downlink
- pCoexSta->bBtUplink = FALSE;
- }
- }
- }
-
- // Check BT is idle or not
- if(!pBtCoexist->stackInfo.bBtLinkExist)
- {
- pCoexSta->bBtBusy = FALSE;
- }
- else
- {
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- if(Ratio_Act<20)
- {
- pCoexSta->bBtBusy = FALSE;
- }
- else
- {
- pCoexSta->bBtBusy = TRUE;
- }
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- if(Ratio_STA < btBusyThresh)
- {
- pCoexSta->bBtBusy = FALSE;
- }
- else
- {
- pCoexSta->bBtBusy = TRUE;
- }
-
- if( (Ratio_STA < btBusyThresh) ||
- (Ratio_Act<180 && Ratio_STA<130) )
- {
- pCoexSta->bA2dpBusy = FALSE;
- }
- else
- {
- pCoexSta->bA2dpBusy = TRUE;
- }
- }
- }
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &pCoexSta->bBtBusy);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &pCoexSta->bBtBusy);
-
- if(bBtBusyTraffic != pCoexSta->bBtBusy)
- { // BT idle or BT non-idle
- bBtBusyTraffic = pCoexSta->bBtBusy;
- stateChange = TRUE;
- }
-
- if(stateChange)
- {
- if(!pCoexSta->bBtBusy)
- {
- halbtc8188c2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- }
- else
- {
- halbtc8188c2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- }
-
- if(stateChange)
- {
- bRejApAggPkt = pCoexSta->bBtBusy;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
- }
-}
-
-VOID
-halbtc8188c2ant_ActionA2dpBc4(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw, wifiTrafficDir;
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
-
- if(pCoexSta->bBtBusy)
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- // fw mechanism first
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0xc, 0x18);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
- }
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
-
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0xc, 0x18);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- }
- }
- else
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
-}
-
-VOID
-halbtc8188c2ant_ActionA2dpBc8(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw, wifiTrafficDir;
- BOOLEAN bWifiBusy=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- if(pCoexSta->bA2dpBusy && bWifiBusy)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
- wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
-
- // fw mechanism first
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0xc, 0x18);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x18);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- }
- else if(pCoexSta->bA2dpBusy)
- {
- // fw mechanism first
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, TRUE, 0x18, FALSE);
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
-}
-
-VOID
-halbtc8188c2ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionA2dpBc4(pBtCoexist);
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionA2dpBc8(pBtCoexist);
- }
-}
-
-VOID
-halbtc8188c2ant_ActionPanBc4(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- if(bBtHsOn)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
- }
- else
- {
- if(pCoexSta->bBtBusy && bWifiBusy)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
- }
- }
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
-}
-
-VOID
-halbtc8188c2ant_ActionPanBc8(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u1Byte wifiRssiState;
- u4Byte wifiBw, wifiTrafficDir;
- s4Byte wifiRssi;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi);
-
- if(bBtHsOn)
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
- else
- {
- wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 3, 25, 50);
-
- if(pCoexSta->bBtBusy && bWifiBusy)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- // fw mechanism first
- if(pCoexSta->bBtUplink)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
- }
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- if(pCoexSta->bBtUplink)
- {
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- }
- else if( (wifiRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- // fw mechanism first
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
-
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);//BT_FW_NAV_ON);
- else
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- // fw mechanism first
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
-
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- if(pCoexSta->bBtUplink)
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);//BT_FW_NAV_ON);
- }
- else
- {
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- }
- else
- {
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- }
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else if(pCoexSta->bBtBusy && !bWifiBusy && (wifiRssi < 30))
- {
- // fw mechanism first
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x0a, 0x20);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
- }
-}
-
-VOID
-halbtc8188c2ant_ActionPan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionPanBc4(pBtCoexist);
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionPanBc8(pBtCoexist);
- }
-}
-
-VOID
-halbtc8188c2ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u4Byte wifiBw, wifiTrafficDir;
- BOOLEAN bWifiBusy=FALSE;
-
- 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);
- if(BTC_WIFI_BW_LEGACY == wifiBw)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- }
- else if(!bWifiBusy)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
- }
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
-}
-
-
-VOID
-halbtc8188c2ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
-
- // fw mechanism
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- // fw mechanism first
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
- // fw mechanism first
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- }
-}
-
-VOID
-halbtc8188c2ant_ActionHidA2dpBc4(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw, wifiTrafficDir;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
-
- if(pCoexSta->bBtBusy)
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- // fw mechanism first
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x7, 0x20);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
- }
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- else
- {
- wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
- // fw mechanism first
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x7, 0x20);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- }
- }
- else
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
-}
-VOID
-halbtc8188c2ant_ActionHidA2dpBc8(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- if(pCoexSta->bBtBusy)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- // fw mechanism first
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- else
- {
- wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
- // fw mechanism
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- }
- }
- else
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
-}
-
-VOID
-halbtc8188c2ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionHidA2dpBc4(pBtCoexist);
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionHidA2dpBc8(pBtCoexist);
- }
-}
-
-VOID
-halbtc8188c2ant_ActionHidPanBc4(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u4Byte wifiBw, wifiTrafficDir;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(bBtHsOn)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- }
- else
- {
- 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);
- if(BTC_WIFI_BW_LEGACY == wifiBw)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- }
- else if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else if(!bWifiBusy)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
- }
- }
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
-}
-VOID
-halbtc8188c2ant_ActionHidPanBc8(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u1Byte wifiRssiState;
- u4Byte wifiBw, wifiTrafficDir;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!bBtHsOn)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 25, 0);
- if((pCoexSta->bBtBusy && bWifiBusy))
- {
- // fw mechanism first
- if(pCoexSta->bBtUplink)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x20);
- }
- else
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x20);
- }
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
- }
- else
- {
- if(BTC_INTF_USB == pBtCoexist->chipInterface)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- }
- else
- {
- if(pCoexSta->bBtBusy)
- {
- // fw mechanism
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- }
-}
-
-VOID
-halbtc8188c2ant_ActionHidPan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionHidPanBc4(pBtCoexist);
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionHidPanBc8(pBtCoexist);
- }
-}
-
-VOID
-halbtc8188c2ant_ActionPanA2dpBc4(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u1Byte wifiRssiState;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- if(bBtHsOn)
- {
- if(pCoexSta->bBtBusy)
- {
- // fw mechanism
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
- }
- else
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- if(pCoexSta->bBtBusy && bWifiBusy)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
- }
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
-}
-VOID
-halbtc8188c2ant_ActionPanA2dpBc8(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!bBtHsOn)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 25, 0);
- if((pCoexSta->bBtBusy && bWifiBusy))
- {
- // fw mechanism first
- if(pCoexSta->bBtUplink)
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x20);
- }
- else
- {
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x20);
- }
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
- }
- else
- {
- if(pCoexSta->bBtBusy)
- {
- // fw mechanism
- halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
-}
-
-VOID
-halbtc8188c2ant_ActionPanA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionPanA2dpBc4(pBtCoexist);
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8188c2ant_ActionPanA2dpBc8(pBtCoexist);
- }
-}
-
-//============================================================
-// extern function start with EXhalbtc8188c2ant_
-//============================================================
-VOID
-EXhalbtc8188c2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte u1Tmp=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
-
- // backup rf 0x1e value
- pCoexDm->btRf0x1eBackup =
- pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xf0);
-
- if( (BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType) ||
- (BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType) )
- {
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd) & BIT0;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, u1Tmp);
-
- halbtc8188c2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0xaaaa9aaa, 0xffbd0040, 0x40000010);
- }
-}
-
-VOID
-EXhalbtc8188c2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- halbtc8188c2ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8188c2ant_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;
-
- 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);
-
- 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_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 / HsChnl(HsMode)", \
- wifiDot11Chnl, 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, 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);
-
- 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);
- }
-
- // 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(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);
-
- // 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, 0x40);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
- u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6cc);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x6c4/0x6c8/0x6cc(coexTable)", \
- u4Tmp[0], u4Tmp[1], u4Tmp[2]);
- CL_PRINTF(cliBuf);
-
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8188c2ant_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"));
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- //halbtc8188c2ant_InitCoexDm(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8188c2ant_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"));
- halbtc8188c2ant_CoexAllOff(pBtCoexist);
- }
- else if(BTC_LPS_DISABLE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));
- halbtc8188c2ant_InitCoexDm(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8188c2ant_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
-EXhalbtc8188c2ant_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
-EXhalbtc8188c2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- 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"));
- }
-
-}
-
-VOID
-EXhalbtc8188c2ant_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
-EXhalbtc8188c2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
-}
-
-VOID
-EXhalbtc8188c2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- EXhalbtc8188c2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8188c2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte algorithm;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 2Ant Periodical!!\n"));
-
- // NOTE:
- // sw mechanism must be done after fw mechanism
- //
-
- if((BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType) ||
- (BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType) )
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_GET_BT_RSSI, NULL);
-
- halbtc8188c2ant_MonitorBtState(pBtCoexist);
- algorithm = halbtc8188c2ant_ActionAlgorithm(pBtCoexist);
- pCoexDm->curAlgorithm = algorithm;
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8188C_2ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO\n"));
- halbtc8188c2ant_ActionSco(pBtCoexist);
- break;
- case BT_8188C_2ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID\n"));
- halbtc8188c2ant_ActionHid(pBtCoexist);
- break;
- case BT_8188C_2ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP\n"));
- halbtc8188c2ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8188C_2ANT_COEX_ALGO_PAN:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN\n"));
- halbtc8188c2ant_ActionPan(pBtCoexist);
- break;
- case BT_8188C_2ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP\n"));
- halbtc8188c2ant_ActionHidA2dp(pBtCoexist);
- break;
- case BT_8188C_2ANT_COEX_ALGO_HID_PAN:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+HID\n"));
- halbtc8188c2ant_ActionHidPan(pBtCoexist);
- break;
- case BT_8188C_2ANT_COEX_ALGO_PAN_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP\n"));
- halbtc8188c2ant_ActionPanA2dp(pBtCoexist);
- break;
- default:
- break;
- }
- }
-}
-
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for 92CE/92CU BT 1 Antenna Co-exist mechanism
+//
+// By cosa 02/11/2011
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8188C_2ANT GLCoexDm8188c2Ant;
+static PCOEX_DM_8188C_2ANT pCoexDm=&GLCoexDm8188c2Ant;
+static COEX_STA_8188C_2ANT GLCoexSta8188c2Ant;
+static PCOEX_STA_8188C_2ANT pCoexSta=&GLCoexSta8188c2Ant;
+
+//============================================================
+// local function start with btdm_
+//============================================================
+u1Byte
+halbtc8188c2ant_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_8188C_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_8188C_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_8188C_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;
+}
+
+u1Byte
+halbtc8188c2ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ u1Byte algorithm=BT_8188C_2ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ 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(pStackInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO algorithm\n"));
+ algorithm = BT_8188C_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(numOfDiffProfile == 1)
+ {
+ if(pStackInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8188C_2ANT_COEX_ALGO_HID;
+ }
+ else if(pStackInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8188C_2ANT_COEX_ALGO_A2DP;
+ }
+ else if(pStackInfo->bPanExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN only\n"));
+ algorithm = BT_8188C_2ANT_COEX_ALGO_PAN;
+ }
+ }
+ else
+ {
+ if( pStackInfo->bHidExist &&
+ pStackInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8188C_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ else if( pStackInfo->bHidExist &&
+ pStackInfo->bPanExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN\n"));
+ algorithm = BT_8188C_2ANT_COEX_ALGO_HID_PAN;
+ }
+ else if( pStackInfo->bPanExist &&
+ pStackInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN + A2DP\n"));
+ algorithm = BT_8188C_2ANT_COEX_ALGO_PAN_A2DP;
+ }
+ }
+ }
+ return algorithm;
+}
+
+VOID
+halbtc8188c2ant_SetFwBalance(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bBalanceOn,
+ IN u1Byte ms0,
+ IN u1Byte ms1
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+
+ if(bBalanceOn)
+ {
+ H2C_Parameter[2] = 1;
+ H2C_Parameter[1] = ms1;
+ H2C_Parameter[0] = ms0;
+ }
+ else
+ {
+ H2C_Parameter[2] = 0;
+ H2C_Parameter[1] = 0;
+ H2C_Parameter[0] = 0;
+ }
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Balance=[%s:%dms:%dms], write 0xc=0x%x\n",
+ bBalanceOn?"ON":"OFF", ms0, ms1,
+ H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0xc, 3, H2C_Parameter);
+}
+
+VOID
+halbtc8188c2ant_Balance(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bBalanceOn,
+ IN u1Byte ms0,
+ IN u1Byte ms1
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Balance %s\n",
+ (bForceExec? "force to":""), (bBalanceOn? "ON":"OFF")));
+ pCoexDm->bCurBalanceOn = bBalanceOn;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBalanceOn = %d, bCurBalanceOn = %d!!\n",
+ pCoexDm->bPreBalanceOn, pCoexDm->bCurBalanceOn));
+
+ if(pCoexDm->bPreBalanceOn == pCoexDm->bCurBalanceOn)
+ return;
+ }
+ halbtc8188c2ant_SetFwBalance(pBtCoexist, bBalanceOn, ms0, ms1);
+
+ pCoexDm->bPreBalanceOn = pCoexDm->bCurBalanceOn;
+}
+
+VOID
+halbtc8188c2ant_SetFwDiminishWifi(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bDacOn,
+ IN BOOLEAN bInterruptOn,
+ IN u1Byte fwDacSwingLvl,
+ IN BOOLEAN bNavOn
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+
+ if((pBtCoexist->stackInfo.minBtRssi <= -5) && (fwDacSwingLvl == 0x20))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], DiminishWiFi 0x20 original, but set 0x18 for Low RSSI!\n"));
+ fwDacSwingLvl = 0x18;
+ }
+
+ H2C_Parameter[2] = 0;
+ H2C_Parameter[1] = fwDacSwingLvl;
+ H2C_Parameter[0] = 0;
+ if(bDacOn)
+ {
+ H2C_Parameter[2] |= 0x01; //BIT0
+ if(bInterruptOn)
+ {
+ H2C_Parameter[2] |= 0x02; //BIT1
+ }
+ }
+ if(bNavOn)
+ {
+ H2C_Parameter[2] |= 0x08; //BIT3
+ }
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], bDacOn=%s, bInterruptOn=%s, bNavOn=%s, write 0xe=0x%x\n",
+ (bDacOn?"ON":"OFF"), (bInterruptOn?"ON":"OFF"), (bNavOn?"ON":"OFF"),
+ (H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2])));
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0xe, 3, H2C_Parameter);
+}
+
+VOID
+halbtc8188c2ant_DiminishWifi(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bDacOn,
+ IN BOOLEAN bInterruptOn,
+ IN u1Byte fwDacSwingLvl,
+ IN BOOLEAN bNavOn
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set Diminish Wifi, bDacOn=%s, bInterruptOn=%s, fwDacSwingLvl=%d, bNavOn=%s\n",
+ (bForceExec? "force to":""), (bDacOn? "ON":"OFF"), (bInterruptOn? "ON":"OFF"), fwDacSwingLvl, (bNavOn? "ON":"OFF")));
+
+ pCoexDm->bCurDacOn = bDacOn;
+ pCoexDm->bCurInterruptOn = bInterruptOn;
+ pCoexDm->curFwDacSwingLvl = fwDacSwingLvl;
+ pCoexDm->bCurNavOn = bNavOn;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreDacOn=%d, bCurDacOn=%d!!\n",
+ pCoexDm->bPreDacOn, pCoexDm->bCurDacOn));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreInterruptOn=%d, bCurInterruptOn=%d!!\n",
+ pCoexDm->bPreInterruptOn, pCoexDm->bCurInterruptOn));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preFwDacSwingLvl=%d, curFwDacSwingLvl=%d!!\n",
+ pCoexDm->preFwDacSwingLvl, pCoexDm->curFwDacSwingLvl));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreNavOn=%d, bCurNavOn=%d!!\n",
+ pCoexDm->bPreNavOn, pCoexDm->bCurNavOn));
+
+
+ if( (pCoexDm->bPreDacOn==pCoexDm->bCurDacOn) &&
+ (pCoexDm->bPreInterruptOn==pCoexDm->bCurInterruptOn) &&
+ (pCoexDm->preFwDacSwingLvl==pCoexDm->curFwDacSwingLvl) &&
+ (pCoexDm->bPreNavOn==pCoexDm->bCurNavOn) )
+ return;
+ }
+ halbtc8188c2ant_SetFwDiminishWifi(pBtCoexist, bDacOn, bInterruptOn, fwDacSwingLvl, bNavOn);
+
+ pCoexDm->bPreDacOn = pCoexDm->bCurDacOn;
+ pCoexDm->bPreInterruptOn = pCoexDm->bCurInterruptOn;
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
+ pCoexDm->bPreNavOn = pCoexDm->bCurNavOn;
+}
+
+VOID
+halbtc8188c2ant_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, 0xf0, 0xf);
+ }
+ 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, 0xf0, pCoexDm->btRf0x1eBackup);
+ }
+ }
+}
+
+VOID
+halbtc8188c2ant_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;
+ }
+ halbtc8188c2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
+
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
+}
+
+VOID
+halbtc8188c2ant_SetSwPenaltyTxRateAdaptive(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ u1Byte tmpU1;
+
+ tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
+ if(bLowPenaltyRa)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
+ tmpU1 &= ~BIT2;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
+ tmpU1 |= BIT2;
+ }
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
+}
+
+VOID
+halbtc8188c2ant_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;
+ }
+ halbtc8188c2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8188c2ant_SetSwFullTimeDacSwing(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSwDacSwingOn,
+ IN u4Byte swDacSwingLvl
+ )
+{
+ u4Byte dacSwingLvl;
+
+ if(bSwDacSwingOn)
+ {
+ if((pBtCoexist->stackInfo.minBtRssi <= -5) && (swDacSwingLvl == 0x20))
+ {
+ dacSwingLvl = 0x18;
+ }
+ else
+ {
+ dacSwingLvl = swDacSwingLvl;
+ }
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xfc000000, dacSwingLvl);
+ }
+ else
+ {
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xfc000000, 0x30);
+ }
+}
+
+VOID
+halbtc8188c2ant_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);
+ halbtc8188c2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
+
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
+}
+
+VOID
+halbtc8188c2ant_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->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a07611);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a05611);
+ }
+}
+
+VOID
+halbtc8188c2ant_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;
+ }
+ halbtc8188c2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
+
+ pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
+}
+
+VOID
+halbtc8188c2ant_SetAgcTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAgcTableEn
+ )
+{
+ u1Byte rssiAdjustVal=0;
+
+ if(bAgcTableEn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4e1c0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4d1d0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4c1e0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4b1f0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4a200001);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x90000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x51000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x12000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x00255);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x641c0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x631d0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x621e0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x611f0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x60200001);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x32000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x71000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xb0000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xfc000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x10255);
+ }
+
+ // set rssiAdjustVal for wifi module.
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
+}
+
+
+VOID
+halbtc8188c2ant_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;
+ }
+ halbtc8188c2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
+
+ pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
+}
+
+VOID
+halbtc8188c2ant_SetCoexTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u4Byte val0x6c4,
+ IN u4Byte val0x6c8,
+ IN u4Byte val0x6cc
+ )
+{
+ 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->fBtcWrite4Byte(pBtCoexist, 0x6cc, val0x6cc);
+}
+
+VOID
+halbtc8188c2ant_CoexTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u4Byte val0x6c4,
+ IN u4Byte val0x6c8,
+ IN u4Byte val0x6cc
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
+ (bForceExec? "force to":""), val0x6c4, val0x6c8, val0x6cc));
+ pCoexDm->curVal0x6c4 = val0x6c4;
+ pCoexDm->curVal0x6c8 = val0x6c8;
+ pCoexDm->curVal0x6cc = val0x6cc;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c4=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n",
+ pCoexDm->preVal0x6c4, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c4=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n",
+ pCoexDm->curVal0x6c4, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));
+
+ if( (pCoexDm->preVal0x6c4 == pCoexDm->curVal0x6c4) &&
+ (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
+ (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
+ return;
+ }
+ halbtc8188c2ant_SetCoexTable(pBtCoexist, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8188c2ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // fw mechanism
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+}
+VOID
+halbtc8188c2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+
+VOID
+halbtc8188c2ant_MonitorBtState(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN stateChange=FALSE;
+ u4Byte BT_Polling, Ratio_Act, Ratio_STA;
+ u4Byte BT_Active, BT_State;
+ u4Byte regBTActive=0, regBTState=0, regBTPolling=0;
+ u4Byte btBusyThresh=0;
+ u4Byte fwVer=0;
+ static BOOLEAN bBtBusyTraffic=FALSE;
+ BOOLEAN bRejApAggPkt=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], FirmwareVersion = 0x%x(%d)\n", fwVer, fwVer));
+ if(fwVer < 62)
+ {
+ regBTActive = 0x488;
+ regBTState = 0x48c;
+ regBTPolling = 0x490;
+ }
+ else
+ {
+ regBTActive = 0x444;
+ regBTState = 0x448;
+ if(fwVer >= 74)
+ regBTPolling = 0x44c;
+ else
+ regBTPolling = 0x700;
+ }
+ btBusyThresh = 60;
+
+ BT_Active = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTActive);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_Active(0x%x)=0x%x\n", regBTActive, BT_Active));
+ BT_Active = BT_Active & 0x00ffffff;
+
+ BT_State = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTState);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_State(0x%x)=0x%x\n", regBTState, BT_State));
+ BT_State = BT_State & 0x00ffffff;
+
+ BT_Polling = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTPolling);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_Polling(0x%x)=0x%x\n", regBTPolling, BT_Polling));
+
+ if(BT_Active==0xffffffff && BT_State==0xffffffff && BT_Polling==0xffffffff )
+ return;
+
+ // 2011/05/04 MH For Slim combo test meet a problem. Surprise remove and WLAN is running
+ // DHCP process. At the same time, the register read value might be zero. And cause BSOD 0x7f
+ // EXCEPTION_DIVIDED_BY_ZERO. In This case, the stack content may always be wrong due to
+ // HW divide trap.
+ if (BT_Polling==0)
+ return;
+
+ Ratio_Act = BT_Active*1000/BT_Polling;
+ Ratio_STA = BT_State*1000/BT_Polling;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Ratio_Act=%d\n", Ratio_Act));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Ratio_STA=%d\n", Ratio_STA));
+
+ if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ if(Ratio_STA < 60) // BT PAN idle
+ {
+ }
+ else
+ {
+ // Check if BT PAN (under BT 2.1) is uplink or downlink
+ if((Ratio_Act/Ratio_STA) < 2)
+ { // BT PAN Uplink
+ pCoexSta->bBtUplink = TRUE;
+ }
+ else
+ { // BT PAN downlink
+ pCoexSta->bBtUplink = FALSE;
+ }
+ }
+ }
+
+ // Check BT is idle or not
+ if(!pBtCoexist->stackInfo.bBtLinkExist)
+ {
+ pCoexSta->bBtBusy = FALSE;
+ }
+ else
+ {
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ if(Ratio_Act<20)
+ {
+ pCoexSta->bBtBusy = FALSE;
+ }
+ else
+ {
+ pCoexSta->bBtBusy = TRUE;
+ }
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ if(Ratio_STA < btBusyThresh)
+ {
+ pCoexSta->bBtBusy = FALSE;
+ }
+ else
+ {
+ pCoexSta->bBtBusy = TRUE;
+ }
+
+ if( (Ratio_STA < btBusyThresh) ||
+ (Ratio_Act<180 && Ratio_STA<130) )
+ {
+ pCoexSta->bA2dpBusy = FALSE;
+ }
+ else
+ {
+ pCoexSta->bA2dpBusy = TRUE;
+ }
+ }
+ }
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &pCoexSta->bBtBusy);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &pCoexSta->bBtBusy);
+
+ if(bBtBusyTraffic != pCoexSta->bBtBusy)
+ { // BT idle or BT non-idle
+ bBtBusyTraffic = pCoexSta->bBtBusy;
+ stateChange = TRUE;
+ }
+
+ if(stateChange)
+ {
+ if(!pCoexSta->bBtBusy)
+ {
+ halbtc8188c2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ }
+ else
+ {
+ halbtc8188c2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ }
+
+ if(stateChange)
+ {
+ bRejApAggPkt = pCoexSta->bBtBusy;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionA2dpBc4(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw, wifiTrafficDir;
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
+
+ if(pCoexSta->bBtBusy)
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ // fw mechanism first
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0xc, 0x18);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+ }
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0xc, 0x18);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ }
+ }
+ else
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionA2dpBc8(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw, wifiTrafficDir;
+ BOOLEAN bWifiBusy=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ if(pCoexSta->bA2dpBusy && bWifiBusy)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
+ wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+
+ // fw mechanism first
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0xc, 0x18);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x18);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ }
+ else if(pCoexSta->bA2dpBusy)
+ {
+ // fw mechanism first
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, TRUE, 0x18, FALSE);
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionA2dpBc4(pBtCoexist);
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionA2dpBc8(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionPanBc4(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ if(bBtHsOn)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+ }
+ else
+ {
+ if(pCoexSta->bBtBusy && bWifiBusy)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+ }
+ }
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+}
+
+VOID
+halbtc8188c2ant_ActionPanBc8(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u1Byte wifiRssiState;
+ u4Byte wifiBw, wifiTrafficDir;
+ s4Byte wifiRssi;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi);
+
+ if(bBtHsOn)
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+ else
+ {
+ wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 3, 25, 50);
+
+ if(pCoexSta->bBtBusy && bWifiBusy)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ // fw mechanism first
+ if(pCoexSta->bBtUplink)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+ }
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ if(pCoexSta->bBtUplink)
+ {
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ }
+ else if( (wifiRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ // fw mechanism first
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
+
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);//BT_FW_NAV_ON);
+ else
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ // fw mechanism first
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
+
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ if(pCoexSta->bBtUplink)
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);//BT_FW_NAV_ON);
+ }
+ else
+ {
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ }
+ else
+ {
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ }
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else if(pCoexSta->bBtBusy && !bWifiBusy && (wifiRssi < 30))
+ {
+ // fw mechanism first
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x0a, 0x20);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionPan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionPanBc4(pBtCoexist);
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionPanBc8(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u4Byte wifiBw, wifiTrafficDir;
+ BOOLEAN bWifiBusy=FALSE;
+
+ 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);
+ if(BTC_WIFI_BW_LEGACY == wifiBw)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ }
+ else if(!bWifiBusy)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+ }
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+}
+
+
+VOID
+halbtc8188c2ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+
+ // fw mechanism
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ // fw mechanism first
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+ // fw mechanism first
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionHidA2dpBc4(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw, wifiTrafficDir;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
+
+ if(pCoexSta->bBtBusy)
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ // fw mechanism first
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x7, 0x20);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+ }
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ else
+ {
+ wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+ // fw mechanism first
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x7, 0x20);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ }
+ }
+ else
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+}
+VOID
+halbtc8188c2ant_ActionHidA2dpBc8(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ if(pCoexSta->bBtBusy)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ // fw mechanism first
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ else
+ {
+ wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+ // fw mechanism
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ }
+ }
+ else
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionHidA2dpBc4(pBtCoexist);
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionHidA2dpBc8(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionHidPanBc4(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u4Byte wifiBw, wifiTrafficDir;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(bBtHsOn)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ }
+ else
+ {
+ 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);
+ if(BTC_WIFI_BW_LEGACY == wifiBw)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ }
+ else if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else if(!bWifiBusy)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+ }
+ }
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+}
+VOID
+halbtc8188c2ant_ActionHidPanBc8(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u1Byte wifiRssiState;
+ u4Byte wifiBw, wifiTrafficDir;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!bBtHsOn)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 25, 0);
+ if((pCoexSta->bBtBusy && bWifiBusy))
+ {
+ // fw mechanism first
+ if(pCoexSta->bBtUplink)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x20);
+ }
+ else
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x20);
+ }
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+ }
+ else
+ {
+ if(BTC_INTF_USB == pBtCoexist->chipInterface)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8188c2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ }
+ else
+ {
+ if(pCoexSta->bBtBusy)
+ {
+ // fw mechanism
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionHidPan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionHidPanBc4(pBtCoexist);
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionHidPanBc8(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionPanA2dpBc4(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u1Byte wifiRssiState;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ if(bBtHsOn)
+ {
+ if(pCoexSta->bBtBusy)
+ {
+ // fw mechanism
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+ }
+ else
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ if(pCoexSta->bBtBusy && bWifiBusy)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+ }
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+}
+VOID
+halbtc8188c2ant_ActionPanA2dpBc8(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!bBtHsOn)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ wifiRssiState = halbtc8188c2ant_WifiRssiState(pBtCoexist, 0, 2, 25, 0);
+ if((pCoexSta->bBtBusy && bWifiBusy))
+ {
+ // fw mechanism first
+ if(pCoexSta->bBtUplink)
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x20);
+ }
+ else
+ {
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x20);
+ }
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+ }
+ else
+ {
+ if(pCoexSta->bBtBusy)
+ {
+ // fw mechanism
+ halbtc8188c2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8188c2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8188c2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ halbtc8188c2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+}
+
+VOID
+halbtc8188c2ant_ActionPanA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionPanA2dpBc4(pBtCoexist);
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8188c2ant_ActionPanA2dpBc8(pBtCoexist);
+ }
+}
+
+//============================================================
+// extern function start with EXhalbtc8188c2ant_
+//============================================================
+VOID
+EXhalbtc8188c2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte u1Tmp=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
+
+ // backup rf 0x1e value
+ pCoexDm->btRf0x1eBackup =
+ pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xf0);
+
+ if( (BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType) ||
+ (BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType) )
+ {
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd) & BIT0;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, u1Tmp);
+
+ halbtc8188c2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0xaaaa9aaa, 0xffbd0040, 0x40000010);
+ }
+}
+
+VOID
+EXhalbtc8188c2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ halbtc8188c2ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8188c2ant_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;
+
+ 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);
+
+ 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_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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, 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, 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);
+
+ 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);
+ }
+
+ // 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(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);
+
+ // 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, 0x40);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
+ u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6cc);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x6c4/0x6c8/0x6cc(coexTable)", \
+ u4Tmp[0], u4Tmp[1], u4Tmp[2]);
+ CL_PRINTF(cliBuf);
+
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8188c2ant_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"));
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ //halbtc8188c2ant_InitCoexDm(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8188c2ant_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"));
+ halbtc8188c2ant_CoexAllOff(pBtCoexist);
+ }
+ else if(BTC_LPS_DISABLE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));
+ halbtc8188c2ant_InitCoexDm(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8188c2ant_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
+EXhalbtc8188c2ant_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
+EXhalbtc8188c2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ 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"));
+ }
+
+}
+
+VOID
+EXhalbtc8188c2ant_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
+EXhalbtc8188c2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+}
+
+VOID
+EXhalbtc8188c2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ EXhalbtc8188c2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8188c2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte algorithm;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 2Ant Periodical!!\n"));
+
+ // NOTE:
+ // sw mechanism must be done after fw mechanism
+ //
+
+ if((BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType) ||
+ (BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType) )
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_GET_BT_RSSI, NULL);
+
+ halbtc8188c2ant_MonitorBtState(pBtCoexist);
+ algorithm = halbtc8188c2ant_ActionAlgorithm(pBtCoexist);
+ pCoexDm->curAlgorithm = algorithm;
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8188C_2ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO\n"));
+ halbtc8188c2ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8188C_2ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID\n"));
+ halbtc8188c2ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8188C_2ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP\n"));
+ halbtc8188c2ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8188C_2ANT_COEX_ALGO_PAN:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN\n"));
+ halbtc8188c2ant_ActionPan(pBtCoexist);
+ break;
+ case BT_8188C_2ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP\n"));
+ halbtc8188c2ant_ActionHidA2dp(pBtCoexist);
+ break;
+ case BT_8188C_2ANT_COEX_ALGO_HID_PAN:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+HID\n"));
+ halbtc8188c2ant_ActionHidPan(pBtCoexist);
+ break;
+ case BT_8188C_2ANT_COEX_ALGO_PAN_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP\n"));
+ halbtc8188c2ant_ActionPanA2dp(pBtCoexist);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h
index 086a879..1edaa45 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h
@@ -1,144 +1,144 @@
-//===========================================
-// The following is for 8188C 2Ant BT Co-exist definition
-//===========================================
-#define BTC_RSSI_COEX_THRESH_TOL_8188C_2ANT 6
-
-typedef enum _BT_INFO_SRC_8188C_2ANT{
- BT_INFO_SRC_8188C_2ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8188C_2ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8188C_2ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8188C_2ANT_MAX
-}BT_INFO_SRC_8188C_2ANT,*PBT_INFO_SRC_8188C_2ANT;
-
-typedef enum _BT_8188C_2ANT_BT_STATUS{
- BT_8188C_2ANT_BT_STATUS_IDLE = 0x0,
- BT_8188C_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8188C_2ANT_BT_STATUS_NON_IDLE = 0x2,
- BT_8188C_2ANT_BT_STATUS_MAX
-}BT_8188C_2ANT_BT_STATUS,*PBT_8188C_2ANT_BT_STATUS;
-
-typedef enum _BT_8188C_2ANT_COEX_ALGO{
- BT_8188C_2ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8188C_2ANT_COEX_ALGO_SCO = 0x1,
- BT_8188C_2ANT_COEX_ALGO_HID = 0x2,
- BT_8188C_2ANT_COEX_ALGO_A2DP = 0x3,
- BT_8188C_2ANT_COEX_ALGO_PAN = 0x4,
- BT_8188C_2ANT_COEX_ALGO_HID_A2DP = 0x5,
- BT_8188C_2ANT_COEX_ALGO_HID_PAN = 0x6,
- BT_8188C_2ANT_COEX_ALGO_PAN_A2DP = 0x7,
- BT_8188C_2ANT_COEX_ALGO_MAX
-}BT_8188C_2ANT_COEX_ALGO,*PBT_8188C_2ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8188C_2ANT{
- // fw mechanism
- BOOLEAN bPreBalanceOn;
- BOOLEAN bCurBalanceOn;
-
- // diminishWifi
- BOOLEAN bPreDacOn;
- BOOLEAN bCurDacOn;
- BOOLEAN bPreInterruptOn;
- BOOLEAN bCurInterruptOn;
- u1Byte preFwDacSwingLvl;
- u1Byte curFwDacSwingLvl;
- BOOLEAN bPreNavOn;
- BOOLEAN bCurNavOn;
-
- // 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;
- u4Byte preVal0x6cc;
- u4Byte curVal0x6cc;
- //BOOLEAN bLimitedDig;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- //u1Byte btStatus;
- //u1Byte wifiChnlInfo[3];
-} COEX_DM_8188C_2ANT, *PCOEX_DM_8188C_2ANT;
-
-typedef struct _COEX_STA_8188C_2ANT{
- u1Byte preWifiRssiState[4];
- BOOLEAN bBtBusy;
- BOOLEAN bBtUplink;
- BOOLEAN bBtDownLink;
- BOOLEAN bA2dpBusy;
-}COEX_STA_8188C_2ANT, *PCOEX_STA_8188C_2ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8188c2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8188c2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8188c2ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8188c2ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8188c2ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8188c2ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8188c2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8188c2ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8188c2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8188c2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8188c2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8188c2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
+//===========================================
+// The following is for 8188C 2Ant BT Co-exist definition
+//===========================================
+#define BTC_RSSI_COEX_THRESH_TOL_8188C_2ANT 6
+
+typedef enum _BT_INFO_SRC_8188C_2ANT{
+ BT_INFO_SRC_8188C_2ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8188C_2ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8188C_2ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8188C_2ANT_MAX
+}BT_INFO_SRC_8188C_2ANT,*PBT_INFO_SRC_8188C_2ANT;
+
+typedef enum _BT_8188C_2ANT_BT_STATUS{
+ BT_8188C_2ANT_BT_STATUS_IDLE = 0x0,
+ BT_8188C_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8188C_2ANT_BT_STATUS_NON_IDLE = 0x2,
+ BT_8188C_2ANT_BT_STATUS_MAX
+}BT_8188C_2ANT_BT_STATUS,*PBT_8188C_2ANT_BT_STATUS;
+
+typedef enum _BT_8188C_2ANT_COEX_ALGO{
+ BT_8188C_2ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8188C_2ANT_COEX_ALGO_SCO = 0x1,
+ BT_8188C_2ANT_COEX_ALGO_HID = 0x2,
+ BT_8188C_2ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8188C_2ANT_COEX_ALGO_PAN = 0x4,
+ BT_8188C_2ANT_COEX_ALGO_HID_A2DP = 0x5,
+ BT_8188C_2ANT_COEX_ALGO_HID_PAN = 0x6,
+ BT_8188C_2ANT_COEX_ALGO_PAN_A2DP = 0x7,
+ BT_8188C_2ANT_COEX_ALGO_MAX
+}BT_8188C_2ANT_COEX_ALGO,*PBT_8188C_2ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8188C_2ANT{
+ // fw mechanism
+ BOOLEAN bPreBalanceOn;
+ BOOLEAN bCurBalanceOn;
+
+ // diminishWifi
+ BOOLEAN bPreDacOn;
+ BOOLEAN bCurDacOn;
+ BOOLEAN bPreInterruptOn;
+ BOOLEAN bCurInterruptOn;
+ u1Byte preFwDacSwingLvl;
+ u1Byte curFwDacSwingLvl;
+ BOOLEAN bPreNavOn;
+ BOOLEAN bCurNavOn;
+
+ // 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;
+ u4Byte preVal0x6cc;
+ u4Byte curVal0x6cc;
+ //BOOLEAN bLimitedDig;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ //u1Byte btStatus;
+ //u1Byte wifiChnlInfo[3];
+} COEX_DM_8188C_2ANT, *PCOEX_DM_8188C_2ANT;
+
+typedef struct _COEX_STA_8188C_2ANT{
+ u1Byte preWifiRssiState[4];
+ BOOLEAN bBtBusy;
+ BOOLEAN bBtUplink;
+ BOOLEAN bBtDownLink;
+ BOOLEAN bA2dpBusy;
+}COEX_STA_8188C_2ANT, *PCOEX_STA_8188C_2ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8188c2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8188c2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8188c2ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8188c2ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8188c2ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8188c2ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8188c2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8188c2ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8188c2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8188c2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8188c2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8188c2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c
index 0a3f310..61855f5 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c
@@ -1,2058 +1,2058 @@
-//============================================================
-// Description:
-//
-// This file is for 92D BT 2 Antenna Co-exist mechanism
-//
-// By cosa 02/11/2011
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8192D_2ANT GLCoexDm8192d2Ant;
-static PCOEX_DM_8192D_2ANT pCoexDm=&GLCoexDm8192d2Ant;
-static COEX_STA_8192D_2ANT GLCoexSta8192d2Ant;
-static PCOEX_STA_8192D_2ANT pCoexSta=&GLCoexSta8192d2Ant;
-
-//============================================================
-// local function start with btdm_
-//============================================================
-u1Byte
-halbtc8192d2ant_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_8192D_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_8192D_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_8192D_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;
-}
-
-u1Byte
-halbtc8192d2ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8192D_2ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- 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(pStackInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO algorithm\n"));
- algorithm = BT_8192D_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(numOfDiffProfile == 1)
- {
- if(pStackInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8192D_2ANT_COEX_ALGO_HID;
- }
- else if(pStackInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8192D_2ANT_COEX_ALGO_A2DP;
- }
- else if(pStackInfo->bPanExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN only\n"));
- algorithm = BT_8192D_2ANT_COEX_ALGO_PAN;
- }
- }
- else
- {
- if( pStackInfo->bHidExist &&
- pStackInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8192D_2ANT_COEX_ALGO_HID_A2DP;
- }
- else if( pStackInfo->bHidExist &&
- pStackInfo->bPanExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN\n"));
- algorithm = BT_8192D_2ANT_COEX_ALGO_HID_PAN;
- }
- else if( pStackInfo->bPanExist &&
- pStackInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN + A2DP\n"));
- algorithm = BT_8192D_2ANT_COEX_ALGO_PAN_A2DP;
- }
- }
- }
- return algorithm;
-}
-
-VOID
-halbtc8192d2ant_SetFwBalance(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bBalanceOn,
- IN u1Byte ms0,
- IN u1Byte ms1
- )
-{
- u1Byte H2C_Parameter[3] ={0};
-
- if(bBalanceOn)
- {
- H2C_Parameter[2] = 1;
- H2C_Parameter[1] = ms1;
- H2C_Parameter[0] = ms0;
- }
- else
- {
- H2C_Parameter[2] = 0;
- H2C_Parameter[1] = 0;
- H2C_Parameter[0] = 0;
- }
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Balance=[%s:%dms:%dms], write 0xc=0x%x\n",
- bBalanceOn?"ON":"OFF", ms0, ms1,
- H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0xc, 3, H2C_Parameter);
-}
-
-VOID
-halbtc8192d2ant_Balance(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bBalanceOn,
- IN u1Byte ms0,
- IN u1Byte ms1
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Balance %s\n",
- (bForceExec? "force to":""), (bBalanceOn? "ON":"OFF")));
- pCoexDm->bCurBalanceOn = bBalanceOn;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBalanceOn = %d, bCurBalanceOn = %d!!\n",
- pCoexDm->bPreBalanceOn, pCoexDm->bCurBalanceOn));
-
- if(pCoexDm->bPreBalanceOn == pCoexDm->bCurBalanceOn)
- return;
- }
- halbtc8192d2ant_SetFwBalance(pBtCoexist, bBalanceOn, ms0, ms1);
-
- pCoexDm->bPreBalanceOn = pCoexDm->bCurBalanceOn;
-}
-
-VOID
-halbtc8192d2ant_SetFwDiminishWifi(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bDacOn,
- IN BOOLEAN bInterruptOn,
- IN u1Byte fwDacSwingLvl,
- IN BOOLEAN bNavOn
- )
-{
- u1Byte H2C_Parameter[3] ={0};
-
- if((pBtCoexist->stackInfo.minBtRssi <= -5) && (fwDacSwingLvl == 0x20))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], DiminishWiFi 0x20 original, but set 0x18 for Low RSSI!\n"));
- fwDacSwingLvl = 0x18;
- }
-
- H2C_Parameter[2] = 0;
- H2C_Parameter[1] = fwDacSwingLvl;
- H2C_Parameter[0] = 0;
- if(bDacOn)
- {
- H2C_Parameter[2] |= 0x01; //BIT0
- if(bInterruptOn)
- {
- H2C_Parameter[2] |= 0x02; //BIT1
- }
- }
- if(bNavOn)
- {
- H2C_Parameter[2] |= 0x08; //BIT3
- }
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], bDacOn=%s, bInterruptOn=%s, bNavOn=%s, write 0x12=0x%x\n",
- (bDacOn?"ON":"OFF"), (bInterruptOn?"ON":"OFF"), (bNavOn?"ON":"OFF"),
- (H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2])));
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x12, 3, H2C_Parameter);
-}
-
-
-VOID
-halbtc8192d2ant_DiminishWifi(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bDacOn,
- IN BOOLEAN bInterruptOn,
- IN u1Byte fwDacSwingLvl,
- IN BOOLEAN bNavOn
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set Diminish Wifi, bDacOn=%s, bInterruptOn=%s, fwDacSwingLvl=%d, bNavOn=%s\n",
- (bForceExec? "force to":""), (bDacOn? "ON":"OFF"), (bInterruptOn? "ON":"OFF"), fwDacSwingLvl, (bNavOn? "ON":"OFF")));
-
- pCoexDm->bCurDacOn = bDacOn;
- pCoexDm->bCurInterruptOn = bInterruptOn;
- pCoexDm->curFwDacSwingLvl = fwDacSwingLvl;
- pCoexDm->bCurNavOn = bNavOn;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreDacOn=%d, bCurDacOn=%d!!\n",
- pCoexDm->bPreDacOn, pCoexDm->bCurDacOn));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreInterruptOn=%d, bCurInterruptOn=%d!!\n",
- pCoexDm->bPreInterruptOn, pCoexDm->bCurInterruptOn));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preFwDacSwingLvl=%d, curFwDacSwingLvl=%d!!\n",
- pCoexDm->preFwDacSwingLvl, pCoexDm->curFwDacSwingLvl));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreNavOn=%d, bCurNavOn=%d!!\n",
- pCoexDm->bPreNavOn, pCoexDm->bCurNavOn));
-
-
- if( (pCoexDm->bPreDacOn==pCoexDm->bCurDacOn) &&
- (pCoexDm->bPreInterruptOn==pCoexDm->bCurInterruptOn) &&
- (pCoexDm->preFwDacSwingLvl==pCoexDm->curFwDacSwingLvl) &&
- (pCoexDm->bPreNavOn==pCoexDm->bCurNavOn) )
- return;
- }
- halbtc8192d2ant_SetFwDiminishWifi(pBtCoexist, bDacOn, bInterruptOn, fwDacSwingLvl, bNavOn);
-
- pCoexDm->bPreDacOn = pCoexDm->bCurDacOn;
- pCoexDm->bPreInterruptOn = pCoexDm->bCurInterruptOn;
- pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
- pCoexDm->bPreNavOn = pCoexDm->bCurNavOn;
-}
-
-VOID
-halbtc8192d2ant_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, 0xf2ff7);
- }
- 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
-halbtc8192d2ant_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;
- }
- halbtc8192d2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
-
- pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
-}
-
-VOID
-halbtc8192d2ant_SetSwPenaltyTxRateAdaptive(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- u1Byte tmpU1;
-
- tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
- if(bLowPenaltyRa)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
- tmpU1 &= ~BIT2;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
- tmpU1 |= BIT2;
- }
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
-}
-
-VOID
-halbtc8192d2ant_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;
- }
- halbtc8192d2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8192d2ant_SetSwFullTimeDacSwing(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSwDacSwingOn,
- IN u4Byte swDacSwingLvl
- )
-{
- u4Byte dacSwingLvl;
-
- if(bSwDacSwingOn)
- {
- if((pBtCoexist->stackInfo.minBtRssi <= -5) && (swDacSwingLvl == 0x20))
- {
- dacSwingLvl = 0x18;
- }
- else
- {
- dacSwingLvl = swDacSwingLvl;
- }
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xfc000000, dacSwingLvl);
- }
- else
- {
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xfc000000, 0x30);
- }
-}
-
-VOID
-halbtc8192d2ant_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);
- halbtc8192d2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
-
- pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
- pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
-}
-
-VOID
-halbtc8192d2ant_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->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a07611);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a05611);
- }
-}
-
-VOID
-halbtc8192d2ant_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;
- }
- halbtc8192d2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
-
- pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
-}
-
-VOID
-halbtc8192d2ant_SetAgcTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAgcTableEn
- )
-{
- u1Byte rssiAdjustVal=0;
-
- if(bAgcTableEn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0xa99);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xd4000);
-
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b000001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b010001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b020001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b030001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b040001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b050001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b060001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b070001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b080001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b090001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b0A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b0B0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7a0C0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x790D0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x780E0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x770F0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x76100001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x75110001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x74120001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x73130001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x72140001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x71150001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x70160001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6f170001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6e180001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6d190001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6c1A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6b1B0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6a1C0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x691D0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4f1E0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4e1F0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4d200001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4c210001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4b220001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4a230001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x49240001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x48250001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x47260001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x46270001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x45280001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x44290001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x432A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x422B0001);
-
- rssiAdjustVal = 12;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x30a99);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000);
-
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B000001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B010001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B020001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B030001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B040001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B050001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B060001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7A070001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x79080001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x78090001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x770A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x760B0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x750C0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x740D0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x730E0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x720F0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x71100001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x70110001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6F120001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6E130001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6D140001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6C150001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6B160001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6A170001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x69180001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x68190001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x671A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x661B0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x651C0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x641D0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x631E0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x621F0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x61200001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x60210001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x49220001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x48230001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x47240001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x46250001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x45260001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x44270001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x43280001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x42290001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x412A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x402B0001);
- }
-
- // set rssiAdjustVal for wifi module.
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
-}
-
-
-
-VOID
-halbtc8192d2ant_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;
- }
- halbtc8192d2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
-
- pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
-}
-
-VOID
-halbtc8192d2ant_SetCoexTable(
- IN PBTC_COEXIST pBtCoexist,
- IN u4Byte val0x6c4,
- IN u4Byte val0x6c8,
- IN u4Byte val0x6cc
- )
-{
- 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->fBtcWrite4Byte(pBtCoexist, 0x6cc, val0x6cc);
-}
-
-VOID
-halbtc8192d2ant_CoexTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u4Byte val0x6c4,
- IN u4Byte val0x6c8,
- IN u4Byte val0x6cc
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
- (bForceExec? "force to":""), val0x6c4, val0x6c8, val0x6cc));
- pCoexDm->curVal0x6c4 = val0x6c4;
- pCoexDm->curVal0x6c8 = val0x6c8;
- pCoexDm->curVal0x6cc = val0x6cc;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c4=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n",
- pCoexDm->preVal0x6c4, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c4=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n",
- pCoexDm->curVal0x6c4, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));
-
- if( (pCoexDm->preVal0x6c4 == pCoexDm->curVal0x6c4) &&
- (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
- (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
- return;
- }
- halbtc8192d2ant_SetCoexTable(pBtCoexist, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8192d2ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // fw mechanism
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
-}
-VOID
-halbtc8192d2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8192d2ant_MonitorBtEnableDisable(
- IN PBTC_COEXIST pBtCoexist,
- IN u4Byte btActive
- )
-{
- static BOOLEAN bPreBtDisabled=FALSE;
- static u4Byte btDisableCnt=0;
- BOOLEAN bBtDisabled=FALSE, bForceToRoam=FALSE;
- u4Byte u4Tmp=0;
-
- // This function check if bt is disabled
- if(btActive)
- {
- 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")));
-
- bForceToRoam = TRUE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_FORCE_TO_ROAM, &bForceToRoam);
-
- bPreBtDisabled = bBtDisabled;
- }
-}
-
-VOID
-halbtc8192d2ant_MonitorBtState(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN stateChange=FALSE;
- u4Byte BT_Polling, Ratio_Act, Ratio_STA;
- u4Byte BT_Active, BT_State;
- u4Byte regBTActive=0, regBTState=0, regBTPolling=0;
- u4Byte btBusyThresh=0;
- u4Byte fwVer=0;
- static BOOLEAN bBtBusyTraffic=FALSE;
- BOOLEAN bRejApAggPkt=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer);
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], FirmwareVersion = 0x%x(%d)\n", fwVer, fwVer));
-
- regBTActive = 0x444;
- regBTState = 0x448;
- regBTPolling = 0x44c;
-
- btBusyThresh = 40;
-
- BT_Active = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTActive);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_Active(0x%x)=0x%x\n", regBTActive, BT_Active));
- BT_Active = BT_Active & 0x00ffffff;
-
- BT_State = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTState);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_State(0x%x)=0x%x\n", regBTState, BT_State));
- BT_State = BT_State & 0x00ffffff;
-
- BT_Polling = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTPolling);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_Polling(0x%x)=0x%x\n", regBTPolling, BT_Polling));
-
- if(BT_Active==0xffffffff && BT_State==0xffffffff && BT_Polling==0xffffffff )
- return;
-
- // 2011/05/04 MH For Slim combo test meet a problem. Surprise remove and WLAN is running
- // DHCP process. At the same time, the register read value might be zero. And cause BSOD 0x7f
- // EXCEPTION_DIVIDED_BY_ZERO. In This case, the stack content may always be wrong due to
- // HW divide trap.
- if (BT_Polling==0)
- return;
-
- halbtc8192d2ant_MonitorBtEnableDisable(pBtCoexist, BT_Active);
-
- Ratio_Act = BT_Active*1000/BT_Polling;
- Ratio_STA = BT_State*1000/BT_Polling;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Ratio_Act=%d\n", Ratio_Act));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Ratio_STA=%d\n", Ratio_STA));
-
- if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- if(Ratio_STA < 60) // BT PAN idle
- {
- }
- else
- {
- // Check if BT PAN (under BT 2.1) is uplink or downlink
- if((Ratio_Act/Ratio_STA) < 2)
- { // BT PAN Uplink
- pCoexSta->bBtUplink = TRUE;
- }
- else
- { // BT PAN downlink
- pCoexSta->bBtUplink = FALSE;
- }
- }
- }
-
- // Check BT is idle or not
- if(!pBtCoexist->stackInfo.bBtLinkExist)
- {
- pCoexSta->bBtBusy = FALSE;
- }
- else
- {
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- if(Ratio_Act<20)
- {
- pCoexSta->bBtBusy = FALSE;
- }
- else
- {
- pCoexSta->bBtBusy = TRUE;
- }
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- if(Ratio_STA < btBusyThresh)
- {
- pCoexSta->bBtBusy = FALSE;
- }
- else
- {
- pCoexSta->bBtBusy = TRUE;
- }
-
- if( (Ratio_STA < btBusyThresh) ||
- (Ratio_Act<180 && Ratio_STA<130) )
- {
- pCoexSta->bA2dpBusy = FALSE;
- }
- else
- {
- pCoexSta->bA2dpBusy = TRUE;
- }
- }
- }
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &pCoexSta->bBtBusy);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &pCoexSta->bBtBusy);
-
- if(bBtBusyTraffic != pCoexSta->bBtBusy)
- { // BT idle or BT non-idle
- bBtBusyTraffic = pCoexSta->bBtBusy;
- stateChange = TRUE;
- }
-
- if(stateChange)
- {
- if(!pCoexSta->bBtBusy)
- {
- halbtc8192d2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- }
- else
- {
- halbtc8192d2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- }
-
- if(stateChange)
- {
- bRejApAggPkt = pCoexSta->bBtBusy;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
- }
-}
-
-VOID
-halbtc8192d2ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw, wifiTrafficDir;
- BOOLEAN bWifiBusy=FALSE;
-
- 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);
-
- wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
- if(pCoexSta->bA2dpBusy && bWifiBusy)
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
- }
- else
- {
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 25, 0);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 40, 0);
- }
- }
-
- // fw mechanism first
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0xc, 0x18);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x18);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- }
-
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- }
- else if(pCoexSta->bA2dpBusy)
- {
- // fw mechanism first
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, TRUE, 0x18, FALSE);
-
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
-}
-
-VOID
-halbtc8192d2ant_ActionPan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u1Byte wifiRssiState, wifiRssiState1;
- u4Byte wifiBw, wifiTrafficDir;
- s4Byte wifiRssi;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi);
-
- if(bBtHsOn)
- {
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
- else
- {
- wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 3, 25, 50);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
- }
- else
- {
- wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 25, 0);
- }
-
- if(pCoexSta->bBtBusy && bWifiBusy)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- // fw mechanism first
- if(pCoexSta->bBtUplink)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
- }
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- if(pCoexSta->bBtUplink)
- {
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- }
- else if( (wifiRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- // fw mechanism first
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
-
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);//BT_FW_NAV_ON);
- else
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- // fw mechanism first
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
-
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- if(pCoexSta->bBtUplink)
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);//BT_FW_NAV_ON);
- }
- else
- {
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- }
- else
- {
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- }
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else if(pCoexSta->bBtBusy &&
- !bWifiBusy &&
- (wifiRssi < 30))
- {
- // fw mechanism first
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x0a, 0x20);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
- }
-}
-
-
-VOID
-halbtc8192d2ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiTrafficDir;
- BOOLEAN bWifiBusy=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 45, 0);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 20, 0);
- }
-
- if(pCoexSta->bBtBusy && bWifiBusy)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- // fw mechanism first
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- // fw mechanism first
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, TRUE, 0x18, FALSE);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x15);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x30, FALSE);
- }
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
-}
-
-
-
-VOID
-halbtc8192d2ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
-
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- // fw mechanism first
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- // fw mechanism first
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
-}
-
-VOID
-halbtc8192d2ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1;
- u4Byte wifiBw;
-
- if(pCoexSta->bBtBusy)
- {
- wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 35, 0);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- // fw mechanism first
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- else
- {
- wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
- // fw mechanism
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- else
- {
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- }
- }
- else
- {
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
-}
-
-
-VOID
-halbtc8192d2ant_ActionHidPanBc4(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u4Byte wifiBw, wifiTrafficDir;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(bBtHsOn)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8192d2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- }
- else
- {
- 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);
- if(BTC_WIFI_BW_LEGACY == wifiBw)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8192d2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- }
- else if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8192d2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else if(!bWifiBusy)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
- }
- }
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
-}
-VOID
-halbtc8192d2ant_ActionHidPanBc8(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u1Byte wifiRssiState;
- u4Byte wifiBw, wifiTrafficDir;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!bBtHsOn)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 25, 0);
- if((pCoexSta->bBtBusy && bWifiBusy))
- {
- // fw mechanism first
- if(pCoexSta->bBtUplink)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x20);
- }
- else
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x20);
- }
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
- }
- else
- {
- if(BTC_INTF_USB == pBtCoexist->chipInterface)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
- if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
-
- halbtc8192d2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
- {
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
- }
- }
- else
- {
- if(pCoexSta->bBtBusy)
- {
- // fw mechanism
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- }
-}
-
-VOID
-halbtc8192d2ant_ActionHidPan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8192d2ant_ActionHidPanBc4(pBtCoexist);
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8192d2ant_ActionHidPanBc8(pBtCoexist);
- }
-}
-
-VOID
-halbtc8192d2ant_ActionPanA2dpBc4(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u1Byte wifiRssiState;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
- if(bBtHsOn)
- {
- if(pCoexSta->bBtBusy)
- {
- // fw mechanism
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
- }
- else
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- if(pCoexSta->bBtBusy && bWifiBusy)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
- }
- else
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
- }
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
-}
-VOID
-halbtc8192d2ant_ActionPanA2dpBc8(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!bBtHsOn)
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 25, 0);
- if((pCoexSta->bBtBusy && bWifiBusy))
- {
- // fw mechanism first
- if(pCoexSta->bBtUplink)
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x20);
- }
- else
- {
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x20);
- }
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
- else
- {
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
- }
- else
- {
- if(pCoexSta->bBtBusy)
- {
- // fw mechanism
- halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
- halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
-
- // sw mechanism
- halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
- }
- else
- {
- halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
- }
- }
-}
-
-VOID
-halbtc8192d2ant_ActionPanA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8192d2ant_ActionPanA2dpBc4(pBtCoexist);
- }
- else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- halbtc8192d2ant_ActionPanA2dpBc8(pBtCoexist);
- }
-}
-
-BOOLEAN
-halbtc8192d2ant_IsBtCoexistEnter(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte macPhyMode;
- BOOLEAN bRet=TRUE;
- BOOLEAN bWifiUnder5G=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_MAC_PHY_MODE, &macPhyMode);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G);
-
- if(BTC_SMSP != macPhyMode)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Only support single mac single phy!!\n"));
- bRet = FALSE;
- }
-
- if(bWifiUnder5G)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under 5G or A band\n"));
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- bRet = FALSE;
- }
-
- return bRet;
-}
-
-//============================================================
-// extern function start with EXhalbtc8192d2ant_
-//============================================================
-VOID
-EXhalbtc8192d2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte u1Tmp=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
-
- // backup rf 0x1e value
- pCoexDm->btRf0x1eBackup =
- pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
-
- if( (BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType) ||
- (BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType) )
- {
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd) & BIT0;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, u1Tmp);
-
- halbtc8192d2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0xaaaa9aaa, 0xffbd0040, 0x40000010);
-
- // switch control, here we set pathA to control
- // 0x878[13] = 1, 0:pathB, 1:pathA(default)
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x878, BIT13, 0x1);
-
- // antsel control, here we use phy0 and enable antsel.
- // 0x87c[16:15] = b'11, enable antsel, antsel output pin
- // 0x87c[30] = 0, 0: phy0, 1:phy 1
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x87c, bMaskDWord, 0x1fff8);
-
- // antsel to Bt or Wifi, it depends Bt on/off.
- // 0x860[9:8] = 'b10, b10:Bt On, WL2G off(default), b01:Bt off, WL2G on.
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x860, BIT9|BIT8, 0x2);
-
- // sw/hw control switch, here we set sw control
- // 0x870[9:8] = 'b11 sw control, 'b00 hw control
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x870, BIT9|BIT8, 0x3);
- }
-}
-
-VOID
-EXhalbtc8192d2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- halbtc8192d2ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8192d2ant_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;
-
- 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);
-
- 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_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 / HsChnl(HsMode)", \
- wifiDot11Chnl, 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, 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);
-
- 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);
- }
-
- // 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(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);
-
- // 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, 0x40);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
- u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6cc);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x6c4/0x6c8/0x6cc(coexTable)", \
- u4Tmp[0], u4Tmp[1], u4Tmp[2]);
- CL_PRINTF(cliBuf);
-
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8192d2ant_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"));
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- //halbtc8192d2ant_InitCoexDm(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8192d2ant_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"));
- halbtc8192d2ant_CoexAllOff(pBtCoexist);
- }
- else if(BTC_LPS_DISABLE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));
- halbtc8192d2ant_InitCoexDm(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8192d2ant_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
-EXhalbtc8192d2ant_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
-EXhalbtc8192d2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- 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"));
- }
-}
-
-VOID
-EXhalbtc8192d2ant_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
-EXhalbtc8192d2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
-}
-
-VOID
-EXhalbtc8192d2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- EXhalbtc8192d2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8192d2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte algorithm;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 2Ant Periodical!!\n"));
-
- // NOTE:
- // sw mechanism must be done after fw mechanism
- //
- if(!halbtc8192d2ant_IsBtCoexistEnter(pBtCoexist))
- return;
-
- if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_GET_BT_RSSI, NULL);
-
- halbtc8192d2ant_MonitorBtState(pBtCoexist);
- algorithm = halbtc8192d2ant_ActionAlgorithm(pBtCoexist);
- pCoexDm->curAlgorithm = algorithm;
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8192D_2ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO\n"));
- halbtc8192d2ant_ActionSco(pBtCoexist);
- break;
- case BT_8192D_2ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID\n"));
- halbtc8192d2ant_ActionHid(pBtCoexist);
- break;
- case BT_8192D_2ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP\n"));
- halbtc8192d2ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8192D_2ANT_COEX_ALGO_PAN:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN\n"));
- halbtc8192d2ant_ActionPan(pBtCoexist);
- break;
- case BT_8192D_2ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP\n"));
- halbtc8192d2ant_ActionHidA2dp(pBtCoexist);
- break;
- case BT_8192D_2ANT_COEX_ALGO_HID_PAN:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+HID\n"));
- halbtc8192d2ant_ActionHidPan(pBtCoexist);
- break;
- case BT_8192D_2ANT_COEX_ALGO_PAN_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP\n"));
- halbtc8192d2ant_ActionPanA2dp(pBtCoexist);
- break;
- default:
- break;
- }
- }
-}
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for 92D BT 2 Antenna Co-exist mechanism
+//
+// By cosa 02/11/2011
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8192D_2ANT GLCoexDm8192d2Ant;
+static PCOEX_DM_8192D_2ANT pCoexDm=&GLCoexDm8192d2Ant;
+static COEX_STA_8192D_2ANT GLCoexSta8192d2Ant;
+static PCOEX_STA_8192D_2ANT pCoexSta=&GLCoexSta8192d2Ant;
+
+//============================================================
+// local function start with btdm_
+//============================================================
+u1Byte
+halbtc8192d2ant_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_8192D_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_8192D_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_8192D_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;
+}
+
+u1Byte
+halbtc8192d2ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8192D_2ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ 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(pStackInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO algorithm\n"));
+ algorithm = BT_8192D_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(numOfDiffProfile == 1)
+ {
+ if(pStackInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8192D_2ANT_COEX_ALGO_HID;
+ }
+ else if(pStackInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8192D_2ANT_COEX_ALGO_A2DP;
+ }
+ else if(pStackInfo->bPanExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN only\n"));
+ algorithm = BT_8192D_2ANT_COEX_ALGO_PAN;
+ }
+ }
+ else
+ {
+ if( pStackInfo->bHidExist &&
+ pStackInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8192D_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ else if( pStackInfo->bHidExist &&
+ pStackInfo->bPanExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN\n"));
+ algorithm = BT_8192D_2ANT_COEX_ALGO_HID_PAN;
+ }
+ else if( pStackInfo->bPanExist &&
+ pStackInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN + A2DP\n"));
+ algorithm = BT_8192D_2ANT_COEX_ALGO_PAN_A2DP;
+ }
+ }
+ }
+ return algorithm;
+}
+
+VOID
+halbtc8192d2ant_SetFwBalance(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bBalanceOn,
+ IN u1Byte ms0,
+ IN u1Byte ms1
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+
+ if(bBalanceOn)
+ {
+ H2C_Parameter[2] = 1;
+ H2C_Parameter[1] = ms1;
+ H2C_Parameter[0] = ms0;
+ }
+ else
+ {
+ H2C_Parameter[2] = 0;
+ H2C_Parameter[1] = 0;
+ H2C_Parameter[0] = 0;
+ }
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Balance=[%s:%dms:%dms], write 0xc=0x%x\n",
+ bBalanceOn?"ON":"OFF", ms0, ms1,
+ H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0xc, 3, H2C_Parameter);
+}
+
+VOID
+halbtc8192d2ant_Balance(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bBalanceOn,
+ IN u1Byte ms0,
+ IN u1Byte ms1
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Balance %s\n",
+ (bForceExec? "force to":""), (bBalanceOn? "ON":"OFF")));
+ pCoexDm->bCurBalanceOn = bBalanceOn;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBalanceOn = %d, bCurBalanceOn = %d!!\n",
+ pCoexDm->bPreBalanceOn, pCoexDm->bCurBalanceOn));
+
+ if(pCoexDm->bPreBalanceOn == pCoexDm->bCurBalanceOn)
+ return;
+ }
+ halbtc8192d2ant_SetFwBalance(pBtCoexist, bBalanceOn, ms0, ms1);
+
+ pCoexDm->bPreBalanceOn = pCoexDm->bCurBalanceOn;
+}
+
+VOID
+halbtc8192d2ant_SetFwDiminishWifi(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bDacOn,
+ IN BOOLEAN bInterruptOn,
+ IN u1Byte fwDacSwingLvl,
+ IN BOOLEAN bNavOn
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+
+ if((pBtCoexist->stackInfo.minBtRssi <= -5) && (fwDacSwingLvl == 0x20))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], DiminishWiFi 0x20 original, but set 0x18 for Low RSSI!\n"));
+ fwDacSwingLvl = 0x18;
+ }
+
+ H2C_Parameter[2] = 0;
+ H2C_Parameter[1] = fwDacSwingLvl;
+ H2C_Parameter[0] = 0;
+ if(bDacOn)
+ {
+ H2C_Parameter[2] |= 0x01; //BIT0
+ if(bInterruptOn)
+ {
+ H2C_Parameter[2] |= 0x02; //BIT1
+ }
+ }
+ if(bNavOn)
+ {
+ H2C_Parameter[2] |= 0x08; //BIT3
+ }
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], bDacOn=%s, bInterruptOn=%s, bNavOn=%s, write 0x12=0x%x\n",
+ (bDacOn?"ON":"OFF"), (bInterruptOn?"ON":"OFF"), (bNavOn?"ON":"OFF"),
+ (H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2])));
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x12, 3, H2C_Parameter);
+}
+
+
+VOID
+halbtc8192d2ant_DiminishWifi(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bDacOn,
+ IN BOOLEAN bInterruptOn,
+ IN u1Byte fwDacSwingLvl,
+ IN BOOLEAN bNavOn
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set Diminish Wifi, bDacOn=%s, bInterruptOn=%s, fwDacSwingLvl=%d, bNavOn=%s\n",
+ (bForceExec? "force to":""), (bDacOn? "ON":"OFF"), (bInterruptOn? "ON":"OFF"), fwDacSwingLvl, (bNavOn? "ON":"OFF")));
+
+ pCoexDm->bCurDacOn = bDacOn;
+ pCoexDm->bCurInterruptOn = bInterruptOn;
+ pCoexDm->curFwDacSwingLvl = fwDacSwingLvl;
+ pCoexDm->bCurNavOn = bNavOn;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreDacOn=%d, bCurDacOn=%d!!\n",
+ pCoexDm->bPreDacOn, pCoexDm->bCurDacOn));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreInterruptOn=%d, bCurInterruptOn=%d!!\n",
+ pCoexDm->bPreInterruptOn, pCoexDm->bCurInterruptOn));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preFwDacSwingLvl=%d, curFwDacSwingLvl=%d!!\n",
+ pCoexDm->preFwDacSwingLvl, pCoexDm->curFwDacSwingLvl));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreNavOn=%d, bCurNavOn=%d!!\n",
+ pCoexDm->bPreNavOn, pCoexDm->bCurNavOn));
+
+
+ if( (pCoexDm->bPreDacOn==pCoexDm->bCurDacOn) &&
+ (pCoexDm->bPreInterruptOn==pCoexDm->bCurInterruptOn) &&
+ (pCoexDm->preFwDacSwingLvl==pCoexDm->curFwDacSwingLvl) &&
+ (pCoexDm->bPreNavOn==pCoexDm->bCurNavOn) )
+ return;
+ }
+ halbtc8192d2ant_SetFwDiminishWifi(pBtCoexist, bDacOn, bInterruptOn, fwDacSwingLvl, bNavOn);
+
+ pCoexDm->bPreDacOn = pCoexDm->bCurDacOn;
+ pCoexDm->bPreInterruptOn = pCoexDm->bCurInterruptOn;
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
+ pCoexDm->bPreNavOn = pCoexDm->bCurNavOn;
+}
+
+VOID
+halbtc8192d2ant_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, 0xf2ff7);
+ }
+ 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
+halbtc8192d2ant_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;
+ }
+ halbtc8192d2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
+
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
+}
+
+VOID
+halbtc8192d2ant_SetSwPenaltyTxRateAdaptive(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ u1Byte tmpU1;
+
+ tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
+ if(bLowPenaltyRa)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
+ tmpU1 &= ~BIT2;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
+ tmpU1 |= BIT2;
+ }
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
+}
+
+VOID
+halbtc8192d2ant_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;
+ }
+ halbtc8192d2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8192d2ant_SetSwFullTimeDacSwing(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSwDacSwingOn,
+ IN u4Byte swDacSwingLvl
+ )
+{
+ u4Byte dacSwingLvl;
+
+ if(bSwDacSwingOn)
+ {
+ if((pBtCoexist->stackInfo.minBtRssi <= -5) && (swDacSwingLvl == 0x20))
+ {
+ dacSwingLvl = 0x18;
+ }
+ else
+ {
+ dacSwingLvl = swDacSwingLvl;
+ }
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xfc000000, dacSwingLvl);
+ }
+ else
+ {
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xfc000000, 0x30);
+ }
+}
+
+VOID
+halbtc8192d2ant_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);
+ halbtc8192d2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
+
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
+}
+
+VOID
+halbtc8192d2ant_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->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a07611);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a05611);
+ }
+}
+
+VOID
+halbtc8192d2ant_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;
+ }
+ halbtc8192d2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
+
+ pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
+}
+
+VOID
+halbtc8192d2ant_SetAgcTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAgcTableEn
+ )
+{
+ u1Byte rssiAdjustVal=0;
+
+ if(bAgcTableEn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0xa99);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xd4000);
+
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b000001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b010001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b020001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b030001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b040001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b050001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b060001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b070001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b080001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b090001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b0A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7b0B0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7a0C0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x790D0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x780E0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x770F0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x76100001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x75110001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x74120001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x73130001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x72140001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x71150001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x70160001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6f170001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6e180001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6d190001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6c1A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6b1B0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6a1C0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x691D0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4f1E0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4e1F0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4d200001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4c210001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4b220001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x4a230001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x49240001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x48250001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x47260001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x46270001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x45280001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x44290001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x432A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x422B0001);
+
+ rssiAdjustVal = 12;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x30a99);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000);
+
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B000001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B010001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B020001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B030001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B040001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B050001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7B060001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x7A070001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x79080001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x78090001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x770A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x760B0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x750C0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x740D0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x730E0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x720F0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x71100001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x70110001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6F120001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6E130001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6D140001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6C150001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6B160001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6A170001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x69180001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x68190001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x671A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x661B0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x651C0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x641D0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x631E0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x621F0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x61200001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x60210001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x49220001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x48230001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x47240001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x46250001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x45260001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x44270001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x43280001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x42290001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x412A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x402B0001);
+ }
+
+ // set rssiAdjustVal for wifi module.
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
+}
+
+
+
+VOID
+halbtc8192d2ant_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;
+ }
+ halbtc8192d2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
+
+ pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
+}
+
+VOID
+halbtc8192d2ant_SetCoexTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u4Byte val0x6c4,
+ IN u4Byte val0x6c8,
+ IN u4Byte val0x6cc
+ )
+{
+ 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->fBtcWrite4Byte(pBtCoexist, 0x6cc, val0x6cc);
+}
+
+VOID
+halbtc8192d2ant_CoexTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u4Byte val0x6c4,
+ IN u4Byte val0x6c8,
+ IN u4Byte val0x6cc
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
+ (bForceExec? "force to":""), val0x6c4, val0x6c8, val0x6cc));
+ pCoexDm->curVal0x6c4 = val0x6c4;
+ pCoexDm->curVal0x6c8 = val0x6c8;
+ pCoexDm->curVal0x6cc = val0x6cc;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c4=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n",
+ pCoexDm->preVal0x6c4, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c4=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n",
+ pCoexDm->curVal0x6c4, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));
+
+ if( (pCoexDm->preVal0x6c4 == pCoexDm->curVal0x6c4) &&
+ (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
+ (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
+ return;
+ }
+ halbtc8192d2ant_SetCoexTable(pBtCoexist, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8192d2ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // fw mechanism
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+}
+VOID
+halbtc8192d2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8192d2ant_MonitorBtEnableDisable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u4Byte btActive
+ )
+{
+ static BOOLEAN bPreBtDisabled=FALSE;
+ static u4Byte btDisableCnt=0;
+ BOOLEAN bBtDisabled=FALSE, bForceToRoam=FALSE;
+ u4Byte u4Tmp=0;
+
+ // This function check if bt is disabled
+ if(btActive)
+ {
+ 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")));
+
+ bForceToRoam = TRUE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_FORCE_TO_ROAM, &bForceToRoam);
+
+ bPreBtDisabled = bBtDisabled;
+ }
+}
+
+VOID
+halbtc8192d2ant_MonitorBtState(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN stateChange=FALSE;
+ u4Byte BT_Polling, Ratio_Act, Ratio_STA;
+ u4Byte BT_Active, BT_State;
+ u4Byte regBTActive=0, regBTState=0, regBTPolling=0;
+ u4Byte btBusyThresh=0;
+ u4Byte fwVer=0;
+ static BOOLEAN bBtBusyTraffic=FALSE;
+ BOOLEAN bRejApAggPkt=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer);
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], FirmwareVersion = 0x%x(%d)\n", fwVer, fwVer));
+
+ regBTActive = 0x444;
+ regBTState = 0x448;
+ regBTPolling = 0x44c;
+
+ btBusyThresh = 40;
+
+ BT_Active = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTActive);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_Active(0x%x)=0x%x\n", regBTActive, BT_Active));
+ BT_Active = BT_Active & 0x00ffffff;
+
+ BT_State = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTState);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_State(0x%x)=0x%x\n", regBTState, BT_State));
+ BT_State = BT_State & 0x00ffffff;
+
+ BT_Polling = pBtCoexist->fBtcRead4Byte(pBtCoexist, regBTPolling);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT_Polling(0x%x)=0x%x\n", regBTPolling, BT_Polling));
+
+ if(BT_Active==0xffffffff && BT_State==0xffffffff && BT_Polling==0xffffffff )
+ return;
+
+ // 2011/05/04 MH For Slim combo test meet a problem. Surprise remove and WLAN is running
+ // DHCP process. At the same time, the register read value might be zero. And cause BSOD 0x7f
+ // EXCEPTION_DIVIDED_BY_ZERO. In This case, the stack content may always be wrong due to
+ // HW divide trap.
+ if (BT_Polling==0)
+ return;
+
+ halbtc8192d2ant_MonitorBtEnableDisable(pBtCoexist, BT_Active);
+
+ Ratio_Act = BT_Active*1000/BT_Polling;
+ Ratio_STA = BT_State*1000/BT_Polling;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Ratio_Act=%d\n", Ratio_Act));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Ratio_STA=%d\n", Ratio_STA));
+
+ if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ if(Ratio_STA < 60) // BT PAN idle
+ {
+ }
+ else
+ {
+ // Check if BT PAN (under BT 2.1) is uplink or downlink
+ if((Ratio_Act/Ratio_STA) < 2)
+ { // BT PAN Uplink
+ pCoexSta->bBtUplink = TRUE;
+ }
+ else
+ { // BT PAN downlink
+ pCoexSta->bBtUplink = FALSE;
+ }
+ }
+ }
+
+ // Check BT is idle or not
+ if(!pBtCoexist->stackInfo.bBtLinkExist)
+ {
+ pCoexSta->bBtBusy = FALSE;
+ }
+ else
+ {
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ if(Ratio_Act<20)
+ {
+ pCoexSta->bBtBusy = FALSE;
+ }
+ else
+ {
+ pCoexSta->bBtBusy = TRUE;
+ }
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ if(Ratio_STA < btBusyThresh)
+ {
+ pCoexSta->bBtBusy = FALSE;
+ }
+ else
+ {
+ pCoexSta->bBtBusy = TRUE;
+ }
+
+ if( (Ratio_STA < btBusyThresh) ||
+ (Ratio_Act<180 && Ratio_STA<130) )
+ {
+ pCoexSta->bA2dpBusy = FALSE;
+ }
+ else
+ {
+ pCoexSta->bA2dpBusy = TRUE;
+ }
+ }
+ }
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &pCoexSta->bBtBusy);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &pCoexSta->bBtBusy);
+
+ if(bBtBusyTraffic != pCoexSta->bBtBusy)
+ { // BT idle or BT non-idle
+ bBtBusyTraffic = pCoexSta->bBtBusy;
+ stateChange = TRUE;
+ }
+
+ if(stateChange)
+ {
+ if(!pCoexSta->bBtBusy)
+ {
+ halbtc8192d2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ }
+ else
+ {
+ halbtc8192d2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ }
+
+ if(stateChange)
+ {
+ bRejApAggPkt = pCoexSta->bBtBusy;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
+ }
+}
+
+VOID
+halbtc8192d2ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw, wifiTrafficDir;
+ BOOLEAN bWifiBusy=FALSE;
+
+ 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);
+
+ wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+ if(pCoexSta->bA2dpBusy && bWifiBusy)
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+ }
+ else
+ {
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 25, 0);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 40, 0);
+ }
+ }
+
+ // fw mechanism first
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0xc, 0x18);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x18);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ }
+ else if(pCoexSta->bA2dpBusy)
+ {
+ // fw mechanism first
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, TRUE, 0x18, FALSE);
+
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8192d2ant_ActionPan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u1Byte wifiRssiState, wifiRssiState1;
+ u4Byte wifiBw, wifiTrafficDir;
+ s4Byte wifiRssi;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi);
+
+ if(bBtHsOn)
+ {
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+ else
+ {
+ wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 3, 25, 50);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+ }
+ else
+ {
+ wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 25, 0);
+ }
+
+ if(pCoexSta->bBtBusy && bWifiBusy)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ // fw mechanism first
+ if(pCoexSta->bBtUplink)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+ }
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ if(pCoexSta->bBtUplink)
+ {
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ }
+ else if( (wifiRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ // fw mechanism first
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
+
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);//BT_FW_NAV_ON);
+ else
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ // fw mechanism first
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x20);
+
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ if(pCoexSta->bBtUplink)
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);//BT_FW_NAV_ON);
+ }
+ else
+ {
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ }
+ else
+ {
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ }
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else if(pCoexSta->bBtBusy &&
+ !bWifiBusy &&
+ (wifiRssi < 30))
+ {
+ // fw mechanism first
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x0a, 0x20);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+ }
+}
+
+
+VOID
+halbtc8192d2ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiTrafficDir;
+ BOOLEAN bWifiBusy=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 45, 0);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 20, 0);
+ }
+
+ if(pCoexSta->bBtBusy && bWifiBusy)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ // fw mechanism first
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ // fw mechanism first
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, TRUE, 0x18, FALSE);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x15);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x30, FALSE);
+ }
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+}
+
+
+
+VOID
+halbtc8192d2ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ // fw mechanism first
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ // fw mechanism first
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+}
+
+VOID
+halbtc8192d2ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1;
+ u4Byte wifiBw;
+
+ if(pCoexSta->bBtBusy)
+ {
+ wifiRssiState1 = halbtc8192d2ant_WifiRssiState(pBtCoexist, 1, 2, 35, 0);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ // fw mechanism first
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ else
+ {
+ wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+ // fw mechanism
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ else
+ {
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ }
+ }
+ else
+ {
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+}
+
+
+VOID
+halbtc8192d2ant_ActionHidPanBc4(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u4Byte wifiBw, wifiTrafficDir;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(bBtHsOn)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8192d2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ }
+ else
+ {
+ 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);
+ if(BTC_WIFI_BW_LEGACY == wifiBw)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8192d2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ }
+ else if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8192d2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else if(!bWifiBusy)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+ }
+ }
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+}
+VOID
+halbtc8192d2ant_ActionHidPanBc8(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u1Byte wifiRssiState;
+ u4Byte wifiBw, wifiTrafficDir;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!bBtHsOn)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 25, 0);
+ if((pCoexSta->bBtBusy && bWifiBusy))
+ {
+ // fw mechanism first
+ if(pCoexSta->bBtUplink)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x20);
+ }
+ else
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x20);
+ }
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+ }
+ else
+ {
+ if(BTC_INTF_USB == pBtCoexist->chipInterface)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir);
+ if(BTC_WIFI_TRAFFIC_TX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+
+ halbtc8192d2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x000000f0, 0x40000010);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0xa0);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ else if(BTC_WIFI_TRAFFIC_RX == wifiTrafficDir)
+ {
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x18);
+ }
+ }
+ else
+ {
+ if(pCoexSta->bBtBusy)
+ {
+ // fw mechanism
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ }
+}
+
+VOID
+halbtc8192d2ant_ActionHidPan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8192d2ant_ActionHidPanBc4(pBtCoexist);
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8192d2ant_ActionHidPanBc8(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8192d2ant_ActionPanA2dpBc4(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u1Byte wifiRssiState;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x0);
+ if(bBtHsOn)
+ {
+ if(pCoexSta->bBtBusy)
+ {
+ // fw mechanism
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+ }
+ else
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ if(pCoexSta->bBtBusy && bWifiBusy)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x20, 0x10);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+ }
+ else
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x0, FALSE);
+ }
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+}
+VOID
+halbtc8192d2ant_ActionPanA2dpBc8(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE;
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!bBtHsOn)
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ wifiRssiState = halbtc8192d2ant_WifiRssiState(pBtCoexist, 0, 2, 25, 0);
+ if((pCoexSta->bBtBusy && bWifiBusy))
+ {
+ // fw mechanism first
+ if(pCoexSta->bBtUplink)
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x15, 0x20);
+ }
+ else
+ {
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, TRUE, 0x10, 0x20);
+ }
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x20, FALSE);
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+ else
+ {
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+ }
+ else
+ {
+ if(pCoexSta->bBtBusy)
+ {
+ // fw mechanism
+ halbtc8192d2ant_Balance(pBtCoexist, NORMAL_EXEC, FALSE, 0, 0);
+ halbtc8192d2ant_DiminishWifi(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0, FALSE);
+
+ // sw mechanism
+ halbtc8192d2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0x20);
+ }
+ else
+ {
+ halbtc8192d2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0x30);
+ }
+ }
+}
+
+VOID
+halbtc8192d2ant_ActionPanA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ if(BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8192d2ant_ActionPanA2dpBc4(pBtCoexist);
+ }
+ else if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ halbtc8192d2ant_ActionPanA2dpBc8(pBtCoexist);
+ }
+}
+
+BOOLEAN
+halbtc8192d2ant_IsBtCoexistEnter(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte macPhyMode;
+ BOOLEAN bRet=TRUE;
+ BOOLEAN bWifiUnder5G=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_MAC_PHY_MODE, &macPhyMode);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G);
+
+ if(BTC_SMSP != macPhyMode)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Only support single mac single phy!!\n"));
+ bRet = FALSE;
+ }
+
+ if(bWifiUnder5G)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under 5G or A band\n"));
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ bRet = FALSE;
+ }
+
+ return bRet;
+}
+
+//============================================================
+// extern function start with EXhalbtc8192d2ant_
+//============================================================
+VOID
+EXhalbtc8192d2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte u1Tmp=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
+
+ // backup rf 0x1e value
+ pCoexDm->btRf0x1eBackup =
+ pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
+
+ if( (BTC_CHIP_CSR_BC4 == pBtCoexist->boardInfo.btChipType) ||
+ (BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType) )
+ {
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd) & BIT0;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, u1Tmp);
+
+ halbtc8192d2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0xaaaa9aaa, 0xffbd0040, 0x40000010);
+
+ // switch control, here we set pathA to control
+ // 0x878[13] = 1, 0:pathB, 1:pathA(default)
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x878, BIT13, 0x1);
+
+ // antsel control, here we use phy0 and enable antsel.
+ // 0x87c[16:15] = b'11, enable antsel, antsel output pin
+ // 0x87c[30] = 0, 0: phy0, 1:phy 1
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x87c, bMaskDWord, 0x1fff8);
+
+ // antsel to Bt or Wifi, it depends Bt on/off.
+ // 0x860[9:8] = 'b10, b10:Bt On, WL2G off(default), b01:Bt off, WL2G on.
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x860, BIT9|BIT8, 0x2);
+
+ // sw/hw control switch, here we set sw control
+ // 0x870[9:8] = 'b11 sw control, 'b00 hw control
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x870, BIT9|BIT8, 0x3);
+ }
+}
+
+VOID
+EXhalbtc8192d2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ halbtc8192d2ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8192d2ant_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;
+
+ 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);
+
+ 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_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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, 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, 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);
+
+ 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);
+ }
+
+ // 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(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);
+
+ // 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, 0x40);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
+ u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6cc);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x6c4/0x6c8/0x6cc(coexTable)", \
+ u4Tmp[0], u4Tmp[1], u4Tmp[2]);
+ CL_PRINTF(cliBuf);
+
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8192d2ant_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"));
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ //halbtc8192d2ant_InitCoexDm(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8192d2ant_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"));
+ halbtc8192d2ant_CoexAllOff(pBtCoexist);
+ }
+ else if(BTC_LPS_DISABLE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));
+ halbtc8192d2ant_InitCoexDm(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8192d2ant_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
+EXhalbtc8192d2ant_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
+EXhalbtc8192d2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ 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"));
+ }
+}
+
+VOID
+EXhalbtc8192d2ant_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
+EXhalbtc8192d2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+}
+
+VOID
+EXhalbtc8192d2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ EXhalbtc8192d2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8192d2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte algorithm;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 2Ant Periodical!!\n"));
+
+ // NOTE:
+ // sw mechanism must be done after fw mechanism
+ //
+ if(!halbtc8192d2ant_IsBtCoexistEnter(pBtCoexist))
+ return;
+
+ if(BTC_CHIP_CSR_BC8 == pBtCoexist->boardInfo.btChipType)
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_GET_BT_RSSI, NULL);
+
+ halbtc8192d2ant_MonitorBtState(pBtCoexist);
+ algorithm = halbtc8192d2ant_ActionAlgorithm(pBtCoexist);
+ pCoexDm->curAlgorithm = algorithm;
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8192D_2ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO\n"));
+ halbtc8192d2ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8192D_2ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID\n"));
+ halbtc8192d2ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8192D_2ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP\n"));
+ halbtc8192d2ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8192D_2ANT_COEX_ALGO_PAN:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN\n"));
+ halbtc8192d2ant_ActionPan(pBtCoexist);
+ break;
+ case BT_8192D_2ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP\n"));
+ halbtc8192d2ant_ActionHidA2dp(pBtCoexist);
+ break;
+ case BT_8192D_2ANT_COEX_ALGO_HID_PAN:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+HID\n"));
+ halbtc8192d2ant_ActionHidPan(pBtCoexist);
+ break;
+ case BT_8192D_2ANT_COEX_ALGO_PAN_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP\n"));
+ halbtc8192d2ant_ActionPanA2dp(pBtCoexist);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h
index 4d3b838..a1a0eb6 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h
@@ -1,165 +1,165 @@
-//===========================================
-// The following is for 8192D 2Ant BT Co-exist definition
-//===========================================
-#define BTC_RSSI_COEX_THRESH_TOL_8192D_2ANT 6
-
-typedef enum _BT_INFO_SRC_8192D_2ANT{
- BT_INFO_SRC_8192D_2ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8192D_2ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8192D_2ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8192D_2ANT_MAX
-}BT_INFO_SRC_8192D_2ANT,*PBT_INFO_SRC_8192D_2ANT;
-
-typedef enum _BT_8192D_2ANT_BT_STATUS{
- BT_8192D_2ANT_BT_STATUS_IDLE = 0x0,
- BT_8192D_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8192D_2ANT_BT_STATUS_NON_IDLE = 0x2,
- BT_8192D_2ANT_BT_STATUS_MAX
-}BT_8192D_2ANT_BT_STATUS,*PBT_8192D_2ANT_BT_STATUS;
-
-typedef enum _BT_8192D_2ANT_COEX_ALGO{
- BT_8192D_2ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8192D_2ANT_COEX_ALGO_SCO = 0x1,
- BT_8192D_2ANT_COEX_ALGO_HID = 0x2,
- BT_8192D_2ANT_COEX_ALGO_A2DP = 0x3,
- BT_8192D_2ANT_COEX_ALGO_PAN = 0x4,
- BT_8192D_2ANT_COEX_ALGO_HID_A2DP = 0x5,
- BT_8192D_2ANT_COEX_ALGO_HID_PAN = 0x6,
- BT_8192D_2ANT_COEX_ALGO_PAN_A2DP = 0x7,
- BT_8192D_2ANT_COEX_ALGO_MAX
-}BT_8192D_2ANT_COEX_ALGO,*PBT_8192D_2ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8192D_2ANT{
- // fw mechanism
- BOOLEAN bPreBalanceOn;
- BOOLEAN bCurBalanceOn;
-
- // diminishWifi
- BOOLEAN bPreDacOn;
- BOOLEAN bCurDacOn;
- BOOLEAN bPreInterruptOn;
- BOOLEAN bCurInterruptOn;
- u1Byte preFwDacSwingLvl;
- u1Byte curFwDacSwingLvl;
- BOOLEAN bPreNavOn;
- BOOLEAN bCurNavOn;
-
-
-
-
-
- //BOOLEAN bPreDecBtPwr;
- //BOOLEAN bCurDecBtPwr;
-
- //u1Byte preFwDacSwingLvl;
- //u1Byte curFwDacSwingLvl;
- //BOOLEAN bCurIgnoreWlanAct;
- //BOOLEAN bPreIgnoreWlanAct;
- //u1Byte prePsTdma;
- //u1Byte curPsTdma;
- //u1Byte psTdmaPara[5];
- //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;
- u4Byte preVal0x6cc;
- u4Byte curVal0x6cc;
- //BOOLEAN bLimitedDig;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- //u1Byte btStatus;
- //u1Byte wifiChnlInfo[3];
-} COEX_DM_8192D_2ANT, *PCOEX_DM_8192D_2ANT;
-
-typedef struct _COEX_STA_8192D_2ANT{
- u1Byte preWifiRssiState[4];
- BOOLEAN bBtBusy;
- BOOLEAN bBtUplink;
- BOOLEAN bBtDownLink;
- BOOLEAN bA2dpBusy;
-}COEX_STA_8192D_2ANT, *PCOEX_STA_8192D_2ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8192d2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192d2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192d2ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192d2ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192d2ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192d2ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192d2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192d2ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192d2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192d2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192d2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8192d2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
+//===========================================
+// The following is for 8192D 2Ant BT Co-exist definition
+//===========================================
+#define BTC_RSSI_COEX_THRESH_TOL_8192D_2ANT 6
+
+typedef enum _BT_INFO_SRC_8192D_2ANT{
+ BT_INFO_SRC_8192D_2ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8192D_2ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8192D_2ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8192D_2ANT_MAX
+}BT_INFO_SRC_8192D_2ANT,*PBT_INFO_SRC_8192D_2ANT;
+
+typedef enum _BT_8192D_2ANT_BT_STATUS{
+ BT_8192D_2ANT_BT_STATUS_IDLE = 0x0,
+ BT_8192D_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8192D_2ANT_BT_STATUS_NON_IDLE = 0x2,
+ BT_8192D_2ANT_BT_STATUS_MAX
+}BT_8192D_2ANT_BT_STATUS,*PBT_8192D_2ANT_BT_STATUS;
+
+typedef enum _BT_8192D_2ANT_COEX_ALGO{
+ BT_8192D_2ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8192D_2ANT_COEX_ALGO_SCO = 0x1,
+ BT_8192D_2ANT_COEX_ALGO_HID = 0x2,
+ BT_8192D_2ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8192D_2ANT_COEX_ALGO_PAN = 0x4,
+ BT_8192D_2ANT_COEX_ALGO_HID_A2DP = 0x5,
+ BT_8192D_2ANT_COEX_ALGO_HID_PAN = 0x6,
+ BT_8192D_2ANT_COEX_ALGO_PAN_A2DP = 0x7,
+ BT_8192D_2ANT_COEX_ALGO_MAX
+}BT_8192D_2ANT_COEX_ALGO,*PBT_8192D_2ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8192D_2ANT{
+ // fw mechanism
+ BOOLEAN bPreBalanceOn;
+ BOOLEAN bCurBalanceOn;
+
+ // diminishWifi
+ BOOLEAN bPreDacOn;
+ BOOLEAN bCurDacOn;
+ BOOLEAN bPreInterruptOn;
+ BOOLEAN bCurInterruptOn;
+ u1Byte preFwDacSwingLvl;
+ u1Byte curFwDacSwingLvl;
+ BOOLEAN bPreNavOn;
+ BOOLEAN bCurNavOn;
+
+
+
+
+
+ //BOOLEAN bPreDecBtPwr;
+ //BOOLEAN bCurDecBtPwr;
+
+ //u1Byte preFwDacSwingLvl;
+ //u1Byte curFwDacSwingLvl;
+ //BOOLEAN bCurIgnoreWlanAct;
+ //BOOLEAN bPreIgnoreWlanAct;
+ //u1Byte prePsTdma;
+ //u1Byte curPsTdma;
+ //u1Byte psTdmaPara[5];
+ //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;
+ u4Byte preVal0x6cc;
+ u4Byte curVal0x6cc;
+ //BOOLEAN bLimitedDig;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ //u1Byte btStatus;
+ //u1Byte wifiChnlInfo[3];
+} COEX_DM_8192D_2ANT, *PCOEX_DM_8192D_2ANT;
+
+typedef struct _COEX_STA_8192D_2ANT{
+ u1Byte preWifiRssiState[4];
+ BOOLEAN bBtBusy;
+ BOOLEAN bBtUplink;
+ BOOLEAN bBtDownLink;
+ BOOLEAN bA2dpBusy;
+}COEX_STA_8192D_2ANT, *PCOEX_STA_8192D_2ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8192d2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192d2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192d2ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192d2ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192d2ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192d2ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192d2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192d2ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192d2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192d2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192d2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8192d2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c
index a9b90c6..4a6244a 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c
@@ -1,3281 +1,3281 @@
-//============================================================
-// Description:
-//
-// This file is for 8192e1ant Co-exist mechanism
-//
-// History
-// 2012/11/15 Cosa first check in.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8192E_1ANT GLCoexDm8192e1Ant;
-static PCOEX_DM_8192E_1ANT pCoexDm=&GLCoexDm8192e1Ant;
-static COEX_STA_8192E_1ANT GLCoexSta8192e1Ant;
-static PCOEX_STA_8192E_1ANT pCoexSta=&GLCoexSta8192e1Ant;
-
-const char *const GLBtInfoSrc8192e1Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-u4Byte GLCoexVerDate8192e1Ant=20130729;
-u4Byte GLCoexVer8192e1Ant=0x10;
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8192e1ant_
-//============================================================
-u1Byte
-halbtc8192e1ant_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_8192E_1ANT))
- {
- 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_8192E_1ANT))
- {
- 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_8192E_1ANT))
- {
- 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
-halbtc8192e1ant_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_8192E_1ANT))
- {
- 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_8192E_1ANT))
- {
- 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_8192E_1ANT))
- {
- 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
-halbtc8192e1ant_UpdateRaMask(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type,
- IN u4Byte rateMask
- )
-{
- if(BTC_RATE_DISABLE == type)
- {
- pCoexDm->curRaMask |= rateMask; // disable rate
- }
- else if(BTC_RATE_ENABLE == type)
- {
- pCoexDm->curRaMask &= ~rateMask; // enable rate
- }
-
- if( bForceExec || (pCoexDm->preRaMask != pCoexDm->curRaMask))
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_UPDATE_RAMASK, &pCoexDm->curRaMask);
- }
- pCoexDm->preRaMask = pCoexDm->curRaMask;
-}
-
-VOID
-halbtc8192e1ant_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, 0xc);
-}
-
-VOID
-halbtc8192e1ant_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);
-}
-
-BOOLEAN
-halbtc8192e1ant_IsWifiStatusChanged(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
- BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
- BOOLEAN bWifiConnected=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
-
- if(bWifiConnected)
- {
- if(bWifiBusy != bPreWifiBusy)
- {
- bPreWifiBusy = bWifiBusy;
- return TRUE;
- }
- if(bUnder4way != bPreUnder4way)
- {
- bPreUnder4way = bUnder4way;
- return TRUE;
- }
- if(bBtHsOn != bPreBtHsOn)
- {
- bPreBtHsOn = bBtHsOn;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-VOID
-halbtc8192e1ant_UpdateBtLinkInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
- pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
- pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
- pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
- pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
-
- // check if Sco only
- if( pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bScoOnly = TRUE;
- else
- pBtLinkInfo->bScoOnly = FALSE;
-
- // check if A2dp only
- if( !pBtLinkInfo->bScoExist &&
- pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bA2dpOnly = TRUE;
- else
- pBtLinkInfo->bA2dpOnly = FALSE;
-
- // check if Pan only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bPanOnly = TRUE;
- else
- pBtLinkInfo->bPanOnly = FALSE;
-
- // check if Hid only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bHidExist )
- pBtLinkInfo->bHidOnly = TRUE;
- else
- pBtLinkInfo->bHidOnly = FALSE;
-}
-
-u1Byte
-halbtc8192e1ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8192E_1ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!pBtLinkInfo->bBtLinkExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
- return algorithm;
- }
-
- if(pBtLinkInfo->bScoExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bHidExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bPanExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bA2dpExist)
- numOfDiffProfile++;
-
- if(numOfDiffProfile == 1)
- {
- if(pBtLinkInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_A2DP;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile == 2)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_SCO;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP;
- }
- }
- }
- }
- else if(numOfDiffProfile == 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_HID;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile >= 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->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_8192E_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-VOID
-halbtc8192e1ant_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
-halbtc8192e1ant_SetFwDecBtPwr(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte decBtPwrLvl
- )
-{
- u1Byte H2C_Parameter[1] ={0};
-
- H2C_Parameter[0] = decBtPwrLvl;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power level = %d, FW write 0x62=0x%x\n",
- decBtPwrLvl, H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8192e1ant_DecBtPwr(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte decBtPwrLvl
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power level = %d\n",
- (bForceExec? "force to":""), decBtPwrLvl));
- pCoexDm->curBtDecPwrLvl = decBtPwrLvl;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], BtDecPwrLvl=%d, curBtDecPwrLvl=%d\n",
- pCoexDm->preBtDecPwrLvl, pCoexDm->curBtDecPwrLvl));
-
- if(pCoexDm->preBtDecPwrLvl == pCoexDm->curBtDecPwrLvl)
- return;
- }
- halbtc8192e1ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->curBtDecPwrLvl);
-
- pCoexDm->preBtDecPwrLvl = pCoexDm->curBtDecPwrLvl;
-}
-
-VOID
-halbtc8192e1ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8192e1ant_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;
- }
- halbtc8192e1ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
-
- pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
-}
-
-VOID
-halbtc8192e1ant_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;
- }
-
- halbtc8192e1ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
-
- pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
-}
-
-VOID
-halbtc8192e1ant_SetSwPenaltyTxRateAdaptive(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- u1Byte tmpU1;
-
- tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
- tmpU1 |= BIT0;
- if(bLowPenaltyRa)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
- tmpU1 &= ~BIT2;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
- tmpU1 |= BIT2;
- }
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
-}
-
-VOID
-halbtc8192e1ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- return;
- 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;
- }
- halbtc8192e1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8192e1ant_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, 0x883, 0x3e, val);
-}
-
-VOID
-halbtc8192e1ant_SetSwFullTimeDacSwing(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSwDacSwingOn,
- IN u4Byte swDacSwingLvl
- )
-{
- if(bSwDacSwingOn)
- {
- halbtc8192e1ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
- }
- else
- {
- halbtc8192e1ant_SetDacSwingReg(pBtCoexist, 0x18);
- }
-}
-
-VOID
-halbtc8192e1ant_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);
- halbtc8192e1ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
-
- pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
- pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
-}
-
-VOID
-halbtc8192e1ant_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
-halbtc8192e1ant_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;
- }
- halbtc8192e1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8192e1ant_CoexTableWithType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type
- )
-{
- switch(type)
- {
- case 0:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffffff, 0x3);
- break;
- case 1:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 2:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 3:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff, 0x3);
- break;
- case 4:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffffff, 0x3);
- break;
- case 5:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffffff, 0x3);
- break;
- case 6:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 7:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0xddffddff, 0xddffddff, 0xffffff, 0x3);
- break;
- case 8:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5afa5afa, 0xffffff, 0x3);
- break;
- case 9:
- halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x5f5f5f5f, 0x5f5f5f5f, 0xffffff, 0x3);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8192e1ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8192e1ant_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;
- }
- halbtc8192e1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8192e1ant_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};
-
- H2C_Parameter[0] = byte1;
- H2C_Parameter[1] = byte2;
- H2C_Parameter[2] = byte3;
- H2C_Parameter[3] = byte4;
- H2C_Parameter[4] = byte5;
-
- pCoexDm->psTdmaPara[0] = byte1;
- pCoexDm->psTdmaPara[1] = byte2;
- pCoexDm->psTdmaPara[2] = byte3;
- pCoexDm->psTdmaPara[3] = byte4;
- pCoexDm->psTdmaPara[4] = byte5;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
-halbtc8192e1ant_SetLpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- u1Byte lps=lpsVal;
- u1Byte rpwm=rpwmVal;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
-}
-
-VOID
-halbtc8192e1ant_LpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bForceExecPwrCmd=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
- (bForceExec? "force to":""), lpsVal, rpwmVal));
- pCoexDm->curLps = lpsVal;
- pCoexDm->curRpwm = rpwmVal;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preLps/curLps=0x%x/0x%x, preRpwm/curRpwm=0x%x/0x%x!!\n",
- pCoexDm->preLps, pCoexDm->curLps, pCoexDm->preRpwm, pCoexDm->curRpwm));
-
- if( (pCoexDm->preLps == pCoexDm->curLps) &&
- (pCoexDm->preRpwm == pCoexDm->curRpwm) )
- {
- return;
- }
- }
- halbtc8192e1ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
-
- pCoexDm->preLps = pCoexDm->curLps;
- pCoexDm->preRpwm = pCoexDm->curRpwm;
-}
-
-VOID
-halbtc8192e1ant_SetAntPath(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte antPosType,
- IN BOOLEAN bInitHwCfg,
- IN BOOLEAN bWifiOff
- )
-{
- u4Byte u4Tmp=0;
-
- if(bInitHwCfg)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x944, 0x24);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x930, 0x700700);
- if(pBtCoexist->chipInterface == BTC_INTF_USB)
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30430004);
- else
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30030004);
-
- // 0x4c[27][24]='00', Set Antenna to BB
- u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u4Tmp &= ~BIT24;
- u4Tmp &= ~BIT27;
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
- }
- else if(bWifiOff)
- {
- if(pBtCoexist->chipInterface == BTC_INTF_USB)
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30430004);
- else
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30030004);
-
- // 0x4c[27][24]='11', Set Antenna to BT, 0x64[8:7]=0, 0x64[2]=1
- u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u4Tmp |= BIT24;
- u4Tmp |= BIT27;
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
- }
-
- // ext switch setting
- switch(antPosType)
- {
- case BTC_ANT_PATH_WIFI:
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x4);
- break;
- case BTC_ANT_PATH_BT:
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x20);
- break;
- default:
- case BTC_ANT_PATH_PTA:
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x4);
- break;
- }
-}
-
-VOID
-halbtc8192e1ant_PsTdma(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bTurnOn,
- IN u1Byte type
- )
-{
- BOOLEAN bTurnOnByCnt=FALSE;
- u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=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)
- {
- default:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x2c, 0x03, 0x10, 0x50);
- break;
- case 1:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x2c, 0x03, 0x10, 0x50);
- rssiAdjustVal = 11;
- break;
- case 2:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x25, 0x03, 0x10, 0x50);
- rssiAdjustVal = 14;
- break;
- case 3:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x40);
- break;
- case 4:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
- rssiAdjustVal = 17;
- break;
- case 5:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x31, 0x0);
- break;
- case 6:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x0, 0x0);
- break;
- case 7:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0);
- break;
- case 8:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
- break;
- case 9:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x1e, 0x03, 0x10, 0x50);
- rssiAdjustVal = 18;
- break;
- case 10:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40);
- break;
- case 11:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x12, 0x03, 0x10, 0x50);
- rssiAdjustVal = 20;
- break;
- case 12:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xeb, 0xa, 0x3, 0x31, 0x18);
- break;
-
- case 15:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x8, 0x0);
- break;
- case 16:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x10, 0x0);
- rssiAdjustVal = 18;
- break;
-
- case 18:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
- rssiAdjustVal = 14;
- break;
-
- case 20:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0x25, 0x25, 0x0, 0x0);
- break;
- case 21:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x20, 0x3, 0x10, 0x40);
- break;
- case 22:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0x8, 0x8, 0x0, 0x40);
- break;
- case 23:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 24:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 25:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 26:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 27:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x98);
- rssiAdjustVal = 22;
- break;
- case 28:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x69, 0x25, 0x3, 0x31, 0x0);
- break;
- case 29:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10);
- break;
- case 30:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
- break;
- case 31:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58);
- break;
- case 32:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xab, 0xa, 0x3, 0x31, 0x90);
- break;
- case 33:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90);
- break;
- case 34:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x10);
- break;
- case 35:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x0, 0x10);
- break;
- case 36:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x3, 0x14, 0x50);
- break;
- case 37:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x25, 0x3, 0x10, 0x50);
- break;
- case 38:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
- break;
- }
- }
- else
- {
- // disable PS tdma
- switch(type)
- {
- case 8: //0x778 = 1, ant2PTA
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
- halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE);
- break;
- case 0: //0x778 = 1, ant2BT
- default:
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
- delay_ms(5);
- halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
- break;
- case 9: //0x778 = 1, ant2WIFI
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
- halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE);
- break;
- case 10: //0x778 = 3, ant2BT
- halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
- delay_ms(5);
- halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
- break;
- }
- }
- rssiAdjustVal =0;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal);
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-VOID
-halbtc8192e1ant_SetSwitchSsType(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte ssType
- )
-{
- u1Byte mimoPs=BTC_MIMO_PS_DYNAMIC;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], REAL set SS Type = %d\n", ssType));
-
- if(ssType == 1)
- {
- halbtc8192e1ant_UpdateRaMask(pBtCoexist, FORCE_EXEC, BTC_RATE_DISABLE, 0xfff00000); // disable 2ss
- halbtc8192e1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
- // switch ofdm path
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x11);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x1);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81111111);
- // switch cck patch
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x1);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x81);
- mimoPs=BTC_MIMO_PS_STATIC;
- }
- else if(ssType == 2)
- {
- halbtc8192e1ant_UpdateRaMask(pBtCoexist, FORCE_EXEC, BTC_RATE_ENABLE, 0xfff00000); // enable 2ss
- halbtc8192e1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x33);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x3);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81121313);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x0);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x41);
- mimoPs=BTC_MIMO_PS_DYNAMIC;
- }
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_SEND_MIMO_PS, &mimoPs); // set rx 1ss or 2ss
-}
-
-VOID
-halbtc8192e1ant_SwitchSsType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte newSsType
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], %s Switch SS Type = %d\n",
- (bForceExec? "force to":""), newSsType));
- pCoexDm->curSsType = newSsType;
-
- if(!bForceExec)
- {
- if(pCoexDm->preSsType == pCoexDm->curSsType)
- return;
- }
- halbtc8192e1ant_SetSwitchSsType(pBtCoexist, pCoexDm->curSsType);
-
- pCoexDm->preSsType = pCoexDm->curSsType;
-}
-
-VOID
-halbtc8192e1ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- // hw all off
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-BOOLEAN
-halbtc8192e1ant_IsCommonAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if(!bWifiConnected &&
- BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"));
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"));
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n"));
-
- bCommon = TRUE;
- }
- else
- {
- bCommon = FALSE;
- }
-
- return bCommon;
-}
-
-
-VOID
-halbtc8192e1ant_TdmaDurationAdjustForAcl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- static s4Byte up,dn,m,n,WaitCount;
- s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
- u1Byte retryCount=0, btInfoExt;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjustForAcl()\n"));
-
- if( (BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
- (BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
- (BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
- {
- if( pCoexDm->curPsTdma != 1 &&
- pCoexDm->curPsTdma != 2 &&
- pCoexDm->curPsTdma != 3 &&
- pCoexDm->curPsTdma != 9 )
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
-
- up = 0;
- dn = 0;
- m = 1;
- n= 3;
- result = 0;
- WaitCount = 0;
- }
- return;
- }
-
- if(!pCoexDm->bAutoTdmaAdjust)
- {
- pCoexDm->bAutoTdmaAdjust = TRUE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- //============
- 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;
- btInfoExt = pCoexSta->btInfoExt;
- 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"));
- }
-
- if(result == -1)
- {
- if( (BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- else if(result == 1)
- {
- if( (BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- }
-
- if( pCoexDm->curPsTdma != 1 &&
- pCoexDm->curPsTdma != 2 &&
- pCoexDm->curPsTdma != 9 &&
- pCoexDm->curPsTdma != 11 )
- {
- // recover to previous adjust type
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
- }
- }
-}
-
-u1Byte
-halbtc8192e1ant_PsTdmaTypeByWifiRssi(
- IN s4Byte wifiRssi,
- IN s4Byte preWifiRssi,
- IN u1Byte wifiRssiThresh
- )
-{
- u1Byte psTdmaType=0;
-
- if(wifiRssi > preWifiRssi)
- {
- if(wifiRssi > (wifiRssiThresh+5))
- {
- psTdmaType = 26;
- }
- else
- {
- psTdmaType = 25;
- }
- }
- else
- {
- if(wifiRssi > wifiRssiThresh)
- {
- psTdmaType = 26;
- }
- else
- {
- psTdmaType = 25;
- }
- }
-
- return psTdmaType;
-}
-
-VOID
-halbtc8192e1ant_PsTdmaCheckForPowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bNewPsState
- )
-{
- u1Byte lpsMode=0x0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
-
- if(lpsMode) // already under LPS state
- {
- if(bNewPsState)
- {
- // keep state under LPS, do nothing.
- }
- else
- {
- // will leave LPS state, turn off psTdma first
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- }
- else // NO PS state
- {
- if(bNewPsState)
- {
- // will enter LPS state, turn off psTdma first
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- // keep state under NO PS state, do nothing.
- }
- }
-}
-
-VOID
-halbtc8192e1ant_PowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte psType,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bLowPwrDisable=FALSE;
-
- switch(psType)
- {
- case BTC_PS_WIFI_NATIVE:
- // recover to original 32k low power setting
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- break;
- case BTC_PS_LPS_ON:
- halbtc8192e1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
- halbtc8192e1ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
- // when coex force to enter LPS, do not enter 32k low power.
- bLowPwrDisable = TRUE;
- 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);
- break;
- case BTC_PS_LPS_OFF:
- halbtc8192e1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
- break;
- default:
- break;
- }
-}
-
-
-VOID
-halbtc8192e1ant_ActionWifiOnly(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
-}
-
-VOID
-halbtc8192e1ant_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"));
- halbtc8192e1ant_ActionWifiOnly(pBtCoexist);
- }
- }
- 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
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- }
- }
-}
-
-//=============================================
-//
-// Software Coex Mechanism start
-//
-//=============================================
-
-// SCO only or SCO+PAN(HS)
-VOID
-halbtc8192e1ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8192e1ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8192e1ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8192e1ant_ActionA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8192e1ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-//PAN(HS) only
-VOID
-halbtc8192e1ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8192e1ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8192e1ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8192e1ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8192e1ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-//=============================================
-//
-// Non-Software Coex Mechanism start
-//
-//=============================================
-VOID
-halbtc8192e1ant_ActionBtInquiry(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- // Note:
- // Do not do DacSwing here, use original setting.
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(bBtHsOn)
- return;
-
- if(!bWifiConnected)
- {
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if( (pBtLinkInfo->bScoExist) ||
- (pBtLinkInfo->bHidOnly) )
- {
- // SCO/HID-only busy
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else
- {
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
-
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 30);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
-}
-
-VOID
-halbtc8192e1ant_ActionBtScoHidOnlyBusy(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- u1Byte btRssiState=BTC_RSSI_STATE_HIGH;
-
- if(BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus)
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
- else
- {
- if(pBtLinkInfo->bHidOnly)
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- else
- {
- // dec bt power for diff level
- btRssiState = halbtc8192e1ant_BtRssiState(3, 34, 42);
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 6);
- }
-
- // sw dacSwing
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0xc);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
- }
- }
-}
-
-VOID
-halbtc8192e1ant_ActionHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action for HS!!!\n"));
-
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- if(BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- // error, should not be here
- pCoexDm->errorCondition = 1;
- }
- else if(BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 6);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 10);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus &&
- !pBtCoexist->btLinkInfo.bHidOnly)
- {
- if(pCoexDm->curSsType == 1)
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 10);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
- }
- else
- {
- halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY);
- }
-}
-
-VOID
-halbtc8192e1ant_ActionWifiConnectedBtAclBusy(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- if(pBtLinkInfo->bHidOnly)
- {
- halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- return;
- }
-
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- if( (pBtLinkInfo->bA2dpOnly) ||
- (pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) )
- {
- halbtc8192e1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus);
- }
- else if( (pBtLinkInfo->bPanOnly) ||
- (pBtLinkInfo->bHidExist&&pBtLinkInfo->bPanExist) )
- {
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- else
- {
- if( (BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
- (BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
- (BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- else
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
-
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
-}
-
-
-VOID
-halbtc8192e1ant_ActionWifiNotConnected(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // power save state
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-VOID
-halbtc8192e1ant_ActionWifiNotConnectedAssoAuthScan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-VOID
-halbtc8192e1ant_ActionWifiConnectedScan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // power save state
- if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
- else
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8192e1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN);
- }
- else if( (BT_8192E_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN);
- }
- else
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
-}
-
-
-VOID
-halbtc8192e1ant_ActionWifiConnectedSpecialPacket(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // power save state
- if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
- else
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8192e1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT);
- }
- else
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
-}
-
-VOID
-halbtc8192e1ant_ActionWifiConnected(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiConnected=FALSE, bWifiBusy=FALSE;
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
- BOOLEAN bUnder4way=FALSE;
- u4Byte wifiBw;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n"));
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(!bWifiConnected)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi not connected<===\n"));
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
- if(bUnder4way)
- {
- halbtc8192e1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n"));
- return;
- }
-
- 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)
- {
- halbtc8192e1ant_ActionWifiConnectedScan(pBtCoexist);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under scan<===\n"));
- return;
- }
-
- // power save state
- if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
- else
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- if(!bWifiBusy)
- {
- if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8192e1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE);
- }
- else if( (BT_8192E_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE);
- }
- else
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- }
- else
- {
- if(BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- else if(BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- else if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8192e1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY);
- }
- else if( (BT_8192E_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY);
- }
- else
- {
- halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- }
-}
-
-VOID
-halbtc8192e1ant_RunSwCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiUnder5G=FALSE, bWifiBusy=FALSE, bWifiConnected=FALSE;
- u1Byte btInfoOriginal=0, btRetryCnt=0;
- u1Byte algorithm=0;
-
- return;
-
- algorithm = halbtc8192e1ant_ActionAlgorithm(pBtCoexist);
- pCoexDm->curAlgorithm = algorithm;
-
- if(halbtc8192e1ant_IsCommonAction(pBtCoexist))
- {
- }
- else
- {
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8192E_1ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n"));
- halbtc8192e1ant_ActionSco(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID.\n"));
- halbtc8192e1ant_ActionHid(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n"));
- halbtc8192e1ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP+PAN(HS).\n"));
- halbtc8192e1ant_ActionA2dpPanHs(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n"));
- halbtc8192e1ant_ActionPanEdr(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HS mode.\n"));
- halbtc8192e1ant_ActionPanHs(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN+A2DP.\n"));
- halbtc8192e1ant_ActionPanEdrA2dp(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_PANEDR_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR)+HID.\n"));
- halbtc8192e1ant_ActionPanEdrHid(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP+PAN.\n"));
- halbtc8192e1ant_ActionHidA2dpPanEdr(pBtCoexist);
- break;
- case BT_8192E_1ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP.\n"));
- halbtc8192e1ant_ActionHidA2dp(pBtCoexist);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n"));
- halbtc8192e1ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
-}
-
-VOID
-halbtc8192e1ant_RunCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
- return;
- }
-
- if(pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n"));
- return;
- }
-
- if(pCoexSta->bUnderIps)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
- return;
- }
-
- halbtc8192e1ant_RunSwCoexistMechanism(pBtCoexist);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8192e1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
-
- // 1ss or 2ss
- if(pBtLinkInfo->bScoExist)
- {
- halbtc8192e1ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else if(bBtHsOn)
- {
- if(pBtLinkInfo->bHidOnly)
- halbtc8192e1ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8192e1ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else
- halbtc8192e1ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
-
- if(bBtHsOn)
- {
- halbtc8192e1ant_ActionHs(pBtCoexist);
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(!bWifiConnected)
- {
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n"));
-
- 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)
- halbtc8192e1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- else
- halbtc8192e1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8192e1ant_ActionWifiConnected(pBtCoexist);
- }
-}
-
-VOID
-halbtc8192e1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
- halbtc8192e1ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
- halbtc8192e1ant_DecBtPwr(pBtCoexist, FORCE_EXEC, 0);
-
- halbtc8192e1ant_SwitchSsType(pBtCoexist, FORCE_EXEC, 2);
-
- halbtc8192e1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-}
-
-//============================================================
-// work around function start with wa_halbtc8192e1ant_
-//============================================================
-//============================================================
-// extern function start with EXhalbtc8192e1ant_
-//============================================================
-VOID
-EXhalbtc8192e1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u4Byte u4Tmp=0;
- u2Byte u2Tmp=0;
- u1Byte u1Tmp=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
-
- // antenna sw ctrl to bt
- halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE);
-
- halbtc8192e1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-
- // antenna switch control parameter
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x858, 0x55555555);
-
- // coex parameters
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1);
- // 0x790[5:0]=0x5
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
- u1Tmp &= 0xc0;
- u1Tmp |= 0x5;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
-
- // enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
-
- // enable PTA
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
- // enable mailbox interface
- u2Tmp = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x40);
- u2Tmp |= BIT9;
- pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x40, u2Tmp);
-
- // enable PTA I2C mailbox
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x101);
- u1Tmp |= BIT4;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x101, u1Tmp);
-
- // enable bt clock when wifi is disabled.
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x93);
- u1Tmp |= BIT0;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x93, u1Tmp);
- // enable bt clock when suspend.
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x7);
- u1Tmp |= BIT0;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x7, u1Tmp);
-}
-
-VOID
-EXhalbtc8192e1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- pBtCoexist->bStopCoexDm = FALSE;
-
- halbtc8192e1ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8192e1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- 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);
-
- if(pBtCoexist->bManualControl)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- CL_PRINTF(cliBuf);
- }
- if(pBtCoexist->bStopCoexDm)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- 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);
-
- 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", \
- GLCoexVerDate8192e1Ant, GLCoexVer8192e1Ant, 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 / HsChnl(HsMode)", \
- wifiDot11Chnl, wifiHsChnl, bBtHsOn);
- 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]", \
- ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
- ( (BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
- pCoexSta->btRssi, pCoexSta->btRetryCnt);
- CL_PRINTF(cliBuf);
-
- 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);
- 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; i<BT_INFO_SRC_8192E_1ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8192e1Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
- ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
- ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
- pBtCoexist->btInfo.lpsVal,
- pBtCoexist->btInfo.rpwmVal);
- CL_PRINTF(cliBuf);
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "SS Type", \
- pCoexDm->curSsType);
- CL_PRINTF(cliBuf);
-
- if(!pBtCoexist->bManualControl)
- {
- // 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(0x%x) ", "SM[SwDacSwing(lvl)]", \
- pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl);
- CL_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s/ %d ", "DelBA/ BtCtrlAgg/ AggSize", \
- (pBtCoexist->btInfo.bRejectAggPkt? "Yes":"No"), (pBtCoexist->btInfo.bBtCtrlAggBufSize? "Yes":"No"),
- pBtCoexist->btInfo.aggBufSize);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
- pBtCoexist->btInfo.raMask);
- CL_PRINTF(cliBuf);
-
- // Fw mechanism
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
- CL_PRINTF(cliBuf);
-
- psTdmaCase = pCoexDm->curPsTdma;
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
- pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
- pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
- 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/ %d ", "DecBtPwrLvl/ IgnWlanAct", \
- pCoexDm->curBtDecPwrLvl, pCoexDm->bCurIgnoreWlanAct);
- CL_PRINTF(cliBuf);
- }
-
- // Hw setting
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============");
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc04);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xd04);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x90c);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0xc04/ 0xd04/ 0x90c", \
- u4Tmp[0], u4Tmp[1], u4Tmp[2]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x778", \
- u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x92c);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x92c/ 0x930", \
- (u1Tmp[0]), u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4f);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x40/ 0x4f", \
- u1Tmp[0], u1Tmp[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);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- 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_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(hp rx[31:16]/tx[15:0])", \
- pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
- pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx);
- CL_PRINTF(cliBuf);
-#if(BT_AUTO_REPORT_ONLY_8192E_1ANT == 1)
- halbtc8192e1ant_MonitorBtCtr(pBtCoexist);
-#endif
-
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8192e1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u4Byte u4Tmp=0;
-
- if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
- return;
-
- if(BTC_IPS_ENTER == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n"));
- pCoexSta->bUnderIps = TRUE;
- halbtc8192e1ant_CoexAllOff(pBtCoexist);
- halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- pCoexSta->bUnderIps = FALSE;
- }
-}
-
-VOID
-EXhalbtc8192e1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
- return;
-
- 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
-EXhalbtc8192e1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8192e1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8192e1ant_ActionHs(pBtCoexist);
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(BTC_SCAN_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8192e1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- }
- else // wifi is connected
- {
- halbtc8192e1ant_ActionWifiConnectedScan(pBtCoexist);
- }
- }
- else if(BTC_SCAN_FINISH == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8192e1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8192e1ant_ActionWifiConnected(pBtCoexist);
- }
- }
-}
-
-VOID
-EXhalbtc8192e1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8192e1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8192e1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if(BTC_ASSOCIATE_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
- halbtc8192e1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- }
- else if(BTC_ASSOCIATE_FINISH == type)
- {
- 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
- {
- halbtc8192e1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8192e1ant_ActionWifiConnected(pBtCoexist);
- }
- }
-}
-
-VOID
-EXhalbtc8192e1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u1Byte H2C_Parameter[3] ={0};
- u4Byte wifiBw;
- u1Byte wifiCentralChnl;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- 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;
- }
-
- 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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
-}
-
-VOID
-EXhalbtc8192e1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8192e1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8192e1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if( BTC_PACKET_DHCP == type ||
- BTC_PACKET_EAPOL == type )
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type));
- halbtc8192e1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8192e1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- u1Byte btInfo=0;
- u1Byte i, rspSource=0;
- static u4Byte setBtPsdMode=0;
- BOOLEAN bBtBusy=FALSE;
- BOOLEAN bWifiConnected=FALSE;
- BOOLEAN bBtCtrlAggBufSize=FALSE;
-
- pCoexSta->bC2hBtInfoReqSent = FALSE;
-
- rspSource = tmpBuf[0]&0xf;
- if(rspSource >= BT_INFO_SRC_8192E_1ANT_MAX)
- rspSource = BT_INFO_SRC_8192E_1ANT_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; i<length; i++)
- {
- 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]));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
- }
- }
-
- if(pBtCoexist->btInfo.bBtDisabled)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for BT is disabled <===\n"));
- return;
- }
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Manual CTRL<===\n"));
- return;
- }
- if(pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Coex STOPPED!!<===\n"));
- return;
- }
-
- if(BT_INFO_SRC_8192E_1ANT_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];
-
- // Here we need to resend some wifi info to BT
- // because bt is reset and loss of the info.
- if( (pCoexSta->btInfoExt & BIT1) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- EXhalbtc8192e1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- EXhalbtc8192e1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
-
- setBtPsdMode = 0;
- }
-
- // test-chip bt patch only rsp the status for BT_RSP,
- // so temporary we consider the following only under BT_RSP
- if(BT_INFO_SRC_8192E_1ANT_BT_RSP == rspSource)
- {
- if( (pCoexSta->btInfoExt & BIT3) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
- halbtc8192e1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
- }
- else
- {
- // BT already NOT ignore Wlan active, do nothing here.
- }
-#if(BT_AUTO_REPORT_ONLY_8192E_1ANT == 0)
- if( (pCoexSta->btInfoExt & BIT4) )
- {
- // BT auto report already enabled, do nothing
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit4 check, set BT to enable Auto Report!!\n"));
- halbtc8192e1ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
- }
-#endif
- }
- }
-
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8192E_1ANT_B_INQ_PAGE)
- pCoexSta->bC2hBtInquiryPage = TRUE;
- else
- pCoexSta->bC2hBtInquiryPage = FALSE;
-
- // set link exist status
- if(!(btInfo&BT_INFO_8192E_1ANT_B_CONNECTION))
- {
- pCoexSta->bBtLinkExist = FALSE;
- pCoexSta->bPanExist = FALSE;
- pCoexSta->bA2dpExist = FALSE;
- pCoexSta->bHidExist = FALSE;
- pCoexSta->bScoExist = FALSE;
- }
- else // connection exists
- {
- pCoexSta->bBtLinkExist = TRUE;
- if(btInfo & BT_INFO_8192E_1ANT_B_FTP)
- pCoexSta->bPanExist = TRUE;
- else
- pCoexSta->bPanExist = FALSE;
- if(btInfo & BT_INFO_8192E_1ANT_B_A2DP)
- pCoexSta->bA2dpExist = TRUE;
- else
- pCoexSta->bA2dpExist = FALSE;
- if(btInfo & BT_INFO_8192E_1ANT_B_HID)
- pCoexSta->bHidExist = TRUE;
- else
- pCoexSta->bHidExist = FALSE;
- if(btInfo & BT_INFO_8192E_1ANT_B_SCO_ESCO)
- pCoexSta->bScoExist = TRUE;
- else
- pCoexSta->bScoExist = FALSE;
- }
-
- halbtc8192e1ant_UpdateBtLinkInfo(pBtCoexist);
-
- if(!(btInfo&BT_INFO_8192E_1ANT_B_CONNECTION))
- {
- pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-connected idle!!!\n"));
- }
- else if(btInfo == BT_INFO_8192E_1ANT_B_CONNECTION) // connection exists but no busy
- {
- pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt connected-idle!!!\n"));
- }
- else if((btInfo&BT_INFO_8192E_1ANT_B_SCO_ESCO) ||
- (btInfo&BT_INFO_8192E_1ANT_B_SCO_BUSY))
- {
- pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_SCO_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt sco busy!!!\n"));
- }
- else if( (btInfo&BT_INFO_8192E_1ANT_B_ACL_BUSY) ||
- (btInfo&BT_INFO_8192E_1ANT_B_A2DP) ||
- (btInfo&BT_INFO_8192E_1ANT_B_FTP) )
- {
- if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
- pCoexDm->bAutoTdmaAdjust = FALSE;
- pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_ACL_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt acl busy!!!\n"));
- }
- else
- {
- pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_MAX;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-defined state!!!\n"));
- }
-
- // ra mask check
- if(pBtLinkInfo->bScoExist || pBtLinkInfo->bHidExist)
- {
- halbtc8192e1ant_UpdateRaMask(pBtCoexist, NORMAL_EXEC, BTC_RATE_DISABLE, 0x00000003); // disable tx cck 1M/2M
- }
- else
- {
- halbtc8192e1ant_UpdateRaMask(pBtCoexist, NORMAL_EXEC, BTC_RATE_ENABLE, 0x00000003); // enable tx cck 1M/2M
- }
-
- if( (BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8192E_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- bBtBusy = TRUE;
- if(pBtLinkInfo->bHidExist)
- bBtCtrlAggBufSize = TRUE;
- }
- else
- {
- bBtBusy = FALSE;
- }
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
-
- //============================================
- // Aggregation related setting
- //============================================
- // if sco, reject AddBA
- //pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt);
-
- // decide BT control aggregation buf size or not
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE, &bBtCtrlAggBufSize);
- // real update aggregation setting
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
- //============================================
-
- halbtc8192e1ant_RunCoexistMechanism(pBtCoexist);
-}
-
-VOID
-EXhalbtc8192e1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- pBtCoexist->bStopCoexDm = TRUE;
- halbtc8192e1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
-
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
-
- EXhalbtc8192e1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8192e1ant_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)
- {
- pBtCoexist->bStopCoexDm = TRUE;
- halbtc8192e1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- }
- else if(BTC_WIFI_PNP_WAKE_UP == pnpState)
- {
-
- }
-}
-
-VOID
-EXhalbtc8192e1ant_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", \
- GLCoexVerDate8192e1Ant, GLCoexVer8192e1Ant, fwVer, btPatchVer, btPatchVer));
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
- }
-#if(BT_AUTO_REPORT_ONLY_8192E_1ANT == 0)
- halbtc8192e1ant_QueryBtInfo(pBtCoexist);
- halbtc8192e1ant_MonitorBtCtr(pBtCoexist);
- halbtc8192e1ant_MonitorBtEnableDisable(pBtCoexist);
-#else
- if( halbtc8192e1ant_IsWifiStatusChanged(pBtCoexist) ||
- pCoexDm->bAutoTdmaAdjust)
- {
- halbtc8192e1ant_RunCoexistMechanism(pBtCoexist);
- }
-#endif
-}
-
-VOID
-EXhalbtc8192e1ant_DbgControl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte opCode,
- IN u1Byte opLen,
- IN pu1Byte pData
- )
-{
- switch(opCode)
- {
- case BTC_DBG_SET_COEX_NORMAL:
- pBtCoexist->bManualControl = FALSE;
- halbtc8192e1ant_InitCoexDm(pBtCoexist);
- break;
- case BTC_DBG_SET_COEX_WIFI_ONLY:
- pBtCoexist->bManualControl = TRUE;
- halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- break;
- case BTC_DBG_SET_COEX_BT_ONLY:
- // todo
- break;
- default:
- break;
- }
-}
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for 8192e1ant Co-exist mechanism
+//
+// History
+// 2012/11/15 Cosa first check in.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8192E_1ANT GLCoexDm8192e1Ant;
+static PCOEX_DM_8192E_1ANT pCoexDm=&GLCoexDm8192e1Ant;
+static COEX_STA_8192E_1ANT GLCoexSta8192e1Ant;
+static PCOEX_STA_8192E_1ANT pCoexSta=&GLCoexSta8192e1Ant;
+
+const char *const GLBtInfoSrc8192e1Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+u4Byte GLCoexVerDate8192e1Ant=20130729;
+u4Byte GLCoexVer8192e1Ant=0x10;
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8192e1ant_
+//============================================================
+u1Byte
+halbtc8192e1ant_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_8192E_1ANT))
+ {
+ 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_8192E_1ANT))
+ {
+ 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_8192E_1ANT))
+ {
+ 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
+halbtc8192e1ant_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_8192E_1ANT))
+ {
+ 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_8192E_1ANT))
+ {
+ 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_8192E_1ANT))
+ {
+ 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
+halbtc8192e1ant_UpdateRaMask(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type,
+ IN u4Byte rateMask
+ )
+{
+ if(BTC_RATE_DISABLE == type)
+ {
+ pCoexDm->curRaMask |= rateMask; // disable rate
+ }
+ else if(BTC_RATE_ENABLE == type)
+ {
+ pCoexDm->curRaMask &= ~rateMask; // enable rate
+ }
+
+ if( bForceExec || (pCoexDm->preRaMask != pCoexDm->curRaMask))
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_UPDATE_RAMASK, &pCoexDm->curRaMask);
+ }
+ pCoexDm->preRaMask = pCoexDm->curRaMask;
+}
+
+VOID
+halbtc8192e1ant_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, 0xc);
+}
+
+VOID
+halbtc8192e1ant_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);
+}
+
+BOOLEAN
+halbtc8192e1ant_IsWifiStatusChanged(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
+ BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+
+ if(bWifiConnected)
+ {
+ if(bWifiBusy != bPreWifiBusy)
+ {
+ bPreWifiBusy = bWifiBusy;
+ return TRUE;
+ }
+ if(bUnder4way != bPreUnder4way)
+ {
+ bPreUnder4way = bUnder4way;
+ return TRUE;
+ }
+ if(bBtHsOn != bPreBtHsOn)
+ {
+ bPreBtHsOn = bBtHsOn;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+VOID
+halbtc8192e1ant_UpdateBtLinkInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
+ pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
+ pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
+ pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
+
+ // check if Sco only
+ if( pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bScoOnly = TRUE;
+ else
+ pBtLinkInfo->bScoOnly = FALSE;
+
+ // check if A2dp only
+ if( !pBtLinkInfo->bScoExist &&
+ pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bA2dpOnly = TRUE;
+ else
+ pBtLinkInfo->bA2dpOnly = FALSE;
+
+ // check if Pan only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bPanOnly = TRUE;
+ else
+ pBtLinkInfo->bPanOnly = FALSE;
+
+ // check if Hid only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bHidOnly = TRUE;
+ else
+ pBtLinkInfo->bHidOnly = FALSE;
+}
+
+u1Byte
+halbtc8192e1ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8192E_1ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!pBtLinkInfo->bBtLinkExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
+ return algorithm;
+ }
+
+ if(pBtLinkInfo->bScoExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bHidExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bPanExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bA2dpExist)
+ numOfDiffProfile++;
+
+ if(numOfDiffProfile == 1)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_A2DP;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 2)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_SCO;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_HID;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile >= 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->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_8192E_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+VOID
+halbtc8192e1ant_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
+halbtc8192e1ant_SetFwDecBtPwr(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte decBtPwrLvl
+ )
+{
+ u1Byte H2C_Parameter[1] ={0};
+
+ H2C_Parameter[0] = decBtPwrLvl;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power level = %d, FW write 0x62=0x%x\n",
+ decBtPwrLvl, H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8192e1ant_DecBtPwr(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte decBtPwrLvl
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power level = %d\n",
+ (bForceExec? "force to":""), decBtPwrLvl));
+ pCoexDm->curBtDecPwrLvl = decBtPwrLvl;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], BtDecPwrLvl=%d, curBtDecPwrLvl=%d\n",
+ pCoexDm->preBtDecPwrLvl, pCoexDm->curBtDecPwrLvl));
+
+ if(pCoexDm->preBtDecPwrLvl == pCoexDm->curBtDecPwrLvl)
+ return;
+ }
+ halbtc8192e1ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->curBtDecPwrLvl);
+
+ pCoexDm->preBtDecPwrLvl = pCoexDm->curBtDecPwrLvl;
+}
+
+VOID
+halbtc8192e1ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8192e1ant_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;
+ }
+ halbtc8192e1ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
+
+ pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
+}
+
+VOID
+halbtc8192e1ant_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;
+ }
+
+ halbtc8192e1ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
+
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
+}
+
+VOID
+halbtc8192e1ant_SetSwPenaltyTxRateAdaptive(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ u1Byte tmpU1;
+
+ tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
+ tmpU1 |= BIT0;
+ if(bLowPenaltyRa)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
+ tmpU1 &= ~BIT2;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
+ tmpU1 |= BIT2;
+ }
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
+}
+
+VOID
+halbtc8192e1ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ return;
+ 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;
+ }
+ halbtc8192e1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8192e1ant_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, 0x883, 0x3e, val);
+}
+
+VOID
+halbtc8192e1ant_SetSwFullTimeDacSwing(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSwDacSwingOn,
+ IN u4Byte swDacSwingLvl
+ )
+{
+ if(bSwDacSwingOn)
+ {
+ halbtc8192e1ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
+ }
+ else
+ {
+ halbtc8192e1ant_SetDacSwingReg(pBtCoexist, 0x18);
+ }
+}
+
+VOID
+halbtc8192e1ant_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);
+ halbtc8192e1ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
+
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
+}
+
+VOID
+halbtc8192e1ant_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
+halbtc8192e1ant_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;
+ }
+ halbtc8192e1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8192e1ant_CoexTableWithType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type
+ )
+{
+ switch(type)
+ {
+ case 0:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffffff, 0x3);
+ break;
+ case 1:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 2:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 3:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff, 0x3);
+ break;
+ case 4:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffffff, 0x3);
+ break;
+ case 5:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffffff, 0x3);
+ break;
+ case 6:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 7:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0xddffddff, 0xddffddff, 0xffffff, 0x3);
+ break;
+ case 8:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5afa5afa, 0xffffff, 0x3);
+ break;
+ case 9:
+ halbtc8192e1ant_CoexTable(pBtCoexist, bForceExec, 0x5f5f5f5f, 0x5f5f5f5f, 0xffffff, 0x3);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8192e1ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8192e1ant_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;
+ }
+ halbtc8192e1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8192e1ant_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};
+
+ H2C_Parameter[0] = byte1;
+ H2C_Parameter[1] = byte2;
+ H2C_Parameter[2] = byte3;
+ H2C_Parameter[3] = byte4;
+ H2C_Parameter[4] = byte5;
+
+ pCoexDm->psTdmaPara[0] = byte1;
+ pCoexDm->psTdmaPara[1] = byte2;
+ pCoexDm->psTdmaPara[2] = byte3;
+ pCoexDm->psTdmaPara[3] = byte4;
+ pCoexDm->psTdmaPara[4] = byte5;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
+halbtc8192e1ant_SetLpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ u1Byte lps=lpsVal;
+ u1Byte rpwm=rpwmVal;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
+}
+
+VOID
+halbtc8192e1ant_LpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bForceExecPwrCmd=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
+ (bForceExec? "force to":""), lpsVal, rpwmVal));
+ pCoexDm->curLps = lpsVal;
+ pCoexDm->curRpwm = rpwmVal;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preLps/curLps=0x%x/0x%x, preRpwm/curRpwm=0x%x/0x%x!!\n",
+ pCoexDm->preLps, pCoexDm->curLps, pCoexDm->preRpwm, pCoexDm->curRpwm));
+
+ if( (pCoexDm->preLps == pCoexDm->curLps) &&
+ (pCoexDm->preRpwm == pCoexDm->curRpwm) )
+ {
+ return;
+ }
+ }
+ halbtc8192e1ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
+
+ pCoexDm->preLps = pCoexDm->curLps;
+ pCoexDm->preRpwm = pCoexDm->curRpwm;
+}
+
+VOID
+halbtc8192e1ant_SetAntPath(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte antPosType,
+ IN BOOLEAN bInitHwCfg,
+ IN BOOLEAN bWifiOff
+ )
+{
+ u4Byte u4Tmp=0;
+
+ if(bInitHwCfg)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x944, 0x24);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x930, 0x700700);
+ if(pBtCoexist->chipInterface == BTC_INTF_USB)
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30430004);
+ else
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30030004);
+
+ // 0x4c[27][24]='00', Set Antenna to BB
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u4Tmp &= ~BIT24;
+ u4Tmp &= ~BIT27;
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
+ }
+ else if(bWifiOff)
+ {
+ if(pBtCoexist->chipInterface == BTC_INTF_USB)
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30430004);
+ else
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30030004);
+
+ // 0x4c[27][24]='11', Set Antenna to BT, 0x64[8:7]=0, 0x64[2]=1
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u4Tmp |= BIT24;
+ u4Tmp |= BIT27;
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
+ }
+
+ // ext switch setting
+ switch(antPosType)
+ {
+ case BTC_ANT_PATH_WIFI:
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x4);
+ break;
+ case BTC_ANT_PATH_BT:
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x20);
+ break;
+ default:
+ case BTC_ANT_PATH_PTA:
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x4);
+ break;
+ }
+}
+
+VOID
+halbtc8192e1ant_PsTdma(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bTurnOn,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bTurnOnByCnt=FALSE;
+ u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=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)
+ {
+ default:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x2c, 0x03, 0x10, 0x50);
+ break;
+ case 1:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x2c, 0x03, 0x10, 0x50);
+ rssiAdjustVal = 11;
+ break;
+ case 2:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x25, 0x03, 0x10, 0x50);
+ rssiAdjustVal = 14;
+ break;
+ case 3:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x40);
+ break;
+ case 4:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
+ rssiAdjustVal = 17;
+ break;
+ case 5:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x31, 0x0);
+ break;
+ case 6:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x0, 0x0);
+ break;
+ case 7:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0);
+ break;
+ case 8:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
+ break;
+ case 9:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x1e, 0x03, 0x10, 0x50);
+ rssiAdjustVal = 18;
+ break;
+ case 10:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40);
+ break;
+ case 11:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x12, 0x03, 0x10, 0x50);
+ rssiAdjustVal = 20;
+ break;
+ case 12:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xeb, 0xa, 0x3, 0x31, 0x18);
+ break;
+
+ case 15:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x8, 0x0);
+ break;
+ case 16:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x10, 0x0);
+ rssiAdjustVal = 18;
+ break;
+
+ case 18:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
+ rssiAdjustVal = 14;
+ break;
+
+ case 20:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0x25, 0x25, 0x0, 0x0);
+ break;
+ case 21:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x20, 0x3, 0x10, 0x40);
+ break;
+ case 22:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x13, 0x8, 0x8, 0x0, 0x40);
+ break;
+ case 23:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 24:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 25:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 26:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 27:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x98);
+ rssiAdjustVal = 22;
+ break;
+ case 28:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x69, 0x25, 0x3, 0x31, 0x0);
+ break;
+ case 29:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10);
+ break;
+ case 30:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
+ break;
+ case 31:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58);
+ break;
+ case 32:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xab, 0xa, 0x3, 0x31, 0x90);
+ break;
+ case 33:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90);
+ break;
+ case 34:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x10);
+ break;
+ case 35:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x0, 0x10);
+ break;
+ case 36:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x3, 0x14, 0x50);
+ break;
+ case 37:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x53, 0x25, 0x3, 0x10, 0x50);
+ break;
+ case 38:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
+ break;
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(type)
+ {
+ case 8: //0x778 = 1, ant2PTA
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
+ halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE);
+ break;
+ case 0: //0x778 = 1, ant2BT
+ default:
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
+ delay_ms(5);
+ halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
+ break;
+ case 9: //0x778 = 1, ant2WIFI
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
+ halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE);
+ break;
+ case 10: //0x778 = 3, ant2BT
+ halbtc8192e1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
+ delay_ms(5);
+ halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
+ break;
+ }
+ }
+ rssiAdjustVal =0;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal);
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+VOID
+halbtc8192e1ant_SetSwitchSsType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte ssType
+ )
+{
+ u1Byte mimoPs=BTC_MIMO_PS_DYNAMIC;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], REAL set SS Type = %d\n", ssType));
+
+ if(ssType == 1)
+ {
+ halbtc8192e1ant_UpdateRaMask(pBtCoexist, FORCE_EXEC, BTC_RATE_DISABLE, 0xfff00000); // disable 2ss
+ halbtc8192e1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
+ // switch ofdm path
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x11);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x1);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81111111);
+ // switch cck patch
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x1);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x81);
+ mimoPs=BTC_MIMO_PS_STATIC;
+ }
+ else if(ssType == 2)
+ {
+ halbtc8192e1ant_UpdateRaMask(pBtCoexist, FORCE_EXEC, BTC_RATE_ENABLE, 0xfff00000); // enable 2ss
+ halbtc8192e1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x33);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x3);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81121313);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x0);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x41);
+ mimoPs=BTC_MIMO_PS_DYNAMIC;
+ }
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_SEND_MIMO_PS, &mimoPs); // set rx 1ss or 2ss
+}
+
+VOID
+halbtc8192e1ant_SwitchSsType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte newSsType
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], %s Switch SS Type = %d\n",
+ (bForceExec? "force to":""), newSsType));
+ pCoexDm->curSsType = newSsType;
+
+ if(!bForceExec)
+ {
+ if(pCoexDm->preSsType == pCoexDm->curSsType)
+ return;
+ }
+ halbtc8192e1ant_SetSwitchSsType(pBtCoexist, pCoexDm->curSsType);
+
+ pCoexDm->preSsType = pCoexDm->curSsType;
+}
+
+VOID
+halbtc8192e1ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ // hw all off
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+BOOLEAN
+halbtc8192e1ant_IsCommonAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if(!bWifiConnected &&
+ BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"));
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"));
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n"));
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ bCommon = FALSE;
+ }
+
+ return bCommon;
+}
+
+
+VOID
+halbtc8192e1ant_TdmaDurationAdjustForAcl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ static s4Byte up,dn,m,n,WaitCount;
+ s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
+ u1Byte retryCount=0, btInfoExt;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjustForAcl()\n"));
+
+ if( (BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
+ (BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
+ (BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
+ {
+ if( pCoexDm->curPsTdma != 1 &&
+ pCoexDm->curPsTdma != 2 &&
+ pCoexDm->curPsTdma != 3 &&
+ pCoexDm->curPsTdma != 9 )
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+
+ up = 0;
+ dn = 0;
+ m = 1;
+ n= 3;
+ result = 0;
+ WaitCount = 0;
+ }
+ return;
+ }
+
+ if(!pCoexDm->bAutoTdmaAdjust)
+ {
+ pCoexDm->bAutoTdmaAdjust = TRUE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ //============
+ 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;
+ btInfoExt = pCoexSta->btInfoExt;
+ 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"));
+ }
+
+ if(result == -1)
+ {
+ if( (BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ else if(result == 1)
+ {
+ if( (BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ }
+
+ if( pCoexDm->curPsTdma != 1 &&
+ pCoexDm->curPsTdma != 2 &&
+ pCoexDm->curPsTdma != 9 &&
+ pCoexDm->curPsTdma != 11 )
+ {
+ // recover to previous adjust type
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
+ }
+ }
+}
+
+u1Byte
+halbtc8192e1ant_PsTdmaTypeByWifiRssi(
+ IN s4Byte wifiRssi,
+ IN s4Byte preWifiRssi,
+ IN u1Byte wifiRssiThresh
+ )
+{
+ u1Byte psTdmaType=0;
+
+ if(wifiRssi > preWifiRssi)
+ {
+ if(wifiRssi > (wifiRssiThresh+5))
+ {
+ psTdmaType = 26;
+ }
+ else
+ {
+ psTdmaType = 25;
+ }
+ }
+ else
+ {
+ if(wifiRssi > wifiRssiThresh)
+ {
+ psTdmaType = 26;
+ }
+ else
+ {
+ psTdmaType = 25;
+ }
+ }
+
+ return psTdmaType;
+}
+
+VOID
+halbtc8192e1ant_PsTdmaCheckForPowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bNewPsState
+ )
+{
+ u1Byte lpsMode=0x0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
+
+ if(lpsMode) // already under LPS state
+ {
+ if(bNewPsState)
+ {
+ // keep state under LPS, do nothing.
+ }
+ else
+ {
+ // will leave LPS state, turn off psTdma first
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ }
+ else // NO PS state
+ {
+ if(bNewPsState)
+ {
+ // will enter LPS state, turn off psTdma first
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ // keep state under NO PS state, do nothing.
+ }
+ }
+}
+
+VOID
+halbtc8192e1ant_PowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte psType,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bLowPwrDisable=FALSE;
+
+ switch(psType)
+ {
+ case BTC_PS_WIFI_NATIVE:
+ // recover to original 32k low power setting
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ break;
+ case BTC_PS_LPS_ON:
+ halbtc8192e1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
+ halbtc8192e1ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
+ // when coex force to enter LPS, do not enter 32k low power.
+ bLowPwrDisable = TRUE;
+ 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);
+ break;
+ case BTC_PS_LPS_OFF:
+ halbtc8192e1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+
+VOID
+halbtc8192e1ant_ActionWifiOnly(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+}
+
+VOID
+halbtc8192e1ant_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"));
+ halbtc8192e1ant_ActionWifiOnly(pBtCoexist);
+ }
+ }
+ 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
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ }
+ }
+}
+
+//=============================================
+//
+// Software Coex Mechanism start
+//
+//=============================================
+
+// SCO only or SCO+PAN(HS)
+VOID
+halbtc8192e1ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8192e1ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8192e1ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8192e1ant_ActionA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8192e1ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+//PAN(HS) only
+VOID
+halbtc8192e1ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8192e1ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8192e1ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8192e1ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8192e1ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+//=============================================
+//
+// Non-Software Coex Mechanism start
+//
+//=============================================
+VOID
+halbtc8192e1ant_ActionBtInquiry(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ // Note:
+ // Do not do DacSwing here, use original setting.
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(bBtHsOn)
+ return;
+
+ if(!bWifiConnected)
+ {
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if( (pBtLinkInfo->bScoExist) ||
+ (pBtLinkInfo->bHidOnly) )
+ {
+ // SCO/HID-only busy
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else
+ {
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
+
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 30);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+}
+
+VOID
+halbtc8192e1ant_ActionBtScoHidOnlyBusy(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ u1Byte btRssiState=BTC_RSSI_STATE_HIGH;
+
+ if(BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus)
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else
+ {
+ if(pBtLinkInfo->bHidOnly)
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else
+ {
+ // dec bt power for diff level
+ btRssiState = halbtc8192e1ant_BtRssiState(3, 34, 42);
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 6);
+ }
+
+ // sw dacSwing
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 0xc);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+ }
+ }
+}
+
+VOID
+halbtc8192e1ant_ActionHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action for HS!!!\n"));
+
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ if(BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ // error, should not be here
+ pCoexDm->errorCondition = 1;
+ }
+ else if(BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 10);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus &&
+ !pBtCoexist->btLinkInfo.bHidOnly)
+ {
+ if(pCoexDm->curSsType == 1)
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 10);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ }
+ else
+ {
+ halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY);
+ }
+}
+
+VOID
+halbtc8192e1ant_ActionWifiConnectedBtAclBusy(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ if(pBtLinkInfo->bHidOnly)
+ {
+ halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ return;
+ }
+
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ if( (pBtLinkInfo->bA2dpOnly) ||
+ (pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) )
+ {
+ halbtc8192e1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus);
+ }
+ else if( (pBtLinkInfo->bPanOnly) ||
+ (pBtLinkInfo->bHidExist&&pBtLinkInfo->bPanExist) )
+ {
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ else
+ {
+ if( (BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
+ (BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
+ (BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ else
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+}
+
+
+VOID
+halbtc8192e1ant_ActionWifiNotConnected(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // power save state
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+VOID
+halbtc8192e1ant_ActionWifiNotConnectedAssoAuthScan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+VOID
+halbtc8192e1ant_ActionWifiConnectedScan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // power save state
+ if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
+ else
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8192e1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN);
+ }
+ else if( (BT_8192E_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN);
+ }
+ else
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+}
+
+
+VOID
+halbtc8192e1ant_ActionWifiConnectedSpecialPacket(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // power save state
+ if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
+ else
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8192e1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT);
+ }
+ else
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+}
+
+VOID
+halbtc8192e1ant_ActionWifiConnected(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bWifiBusy=FALSE;
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+ BOOLEAN bUnder4way=FALSE;
+ u4Byte wifiBw;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n"));
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(!bWifiConnected)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi not connected<===\n"));
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+ if(bUnder4way)
+ {
+ halbtc8192e1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n"));
+ return;
+ }
+
+ 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)
+ {
+ halbtc8192e1ant_ActionWifiConnectedScan(pBtCoexist);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under scan<===\n"));
+ return;
+ }
+
+ // power save state
+ if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
+ else
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ if(!bWifiBusy)
+ {
+ if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8192e1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE);
+ }
+ else if( (BT_8192E_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE);
+ }
+ else
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ }
+ else
+ {
+ if(BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else if(BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8192e1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY);
+ }
+ else if( (BT_8192E_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8192e1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY);
+ }
+ else
+ {
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e1ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ }
+}
+
+VOID
+halbtc8192e1ant_RunSwCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiUnder5G=FALSE, bWifiBusy=FALSE, bWifiConnected=FALSE;
+ u1Byte btInfoOriginal=0, btRetryCnt=0;
+ u1Byte algorithm=0;
+
+ return;
+
+ algorithm = halbtc8192e1ant_ActionAlgorithm(pBtCoexist);
+ pCoexDm->curAlgorithm = algorithm;
+
+ if(halbtc8192e1ant_IsCommonAction(pBtCoexist))
+ {
+ }
+ else
+ {
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8192E_1ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n"));
+ halbtc8192e1ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID.\n"));
+ halbtc8192e1ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n"));
+ halbtc8192e1ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP+PAN(HS).\n"));
+ halbtc8192e1ant_ActionA2dpPanHs(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n"));
+ halbtc8192e1ant_ActionPanEdr(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HS mode.\n"));
+ halbtc8192e1ant_ActionPanHs(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN+A2DP.\n"));
+ halbtc8192e1ant_ActionPanEdrA2dp(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_PANEDR_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR)+HID.\n"));
+ halbtc8192e1ant_ActionPanEdrHid(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP+PAN.\n"));
+ halbtc8192e1ant_ActionHidA2dpPanEdr(pBtCoexist);
+ break;
+ case BT_8192E_1ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP.\n"));
+ halbtc8192e1ant_ActionHidA2dp(pBtCoexist);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n"));
+ halbtc8192e1ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+}
+
+VOID
+halbtc8192e1ant_RunCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
+ return;
+ }
+
+ if(pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n"));
+ return;
+ }
+
+ if(pCoexSta->bUnderIps)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
+ return;
+ }
+
+ halbtc8192e1ant_RunSwCoexistMechanism(pBtCoexist);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8192e1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+
+ // 1ss or 2ss
+ if(pBtLinkInfo->bScoExist)
+ {
+ halbtc8192e1ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else if(bBtHsOn)
+ {
+ if(pBtLinkInfo->bHidOnly)
+ halbtc8192e1ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8192e1ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else
+ halbtc8192e1ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
+
+ if(bBtHsOn)
+ {
+ halbtc8192e1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(!bWifiConnected)
+ {
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n"));
+
+ 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)
+ halbtc8192e1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ else
+ halbtc8192e1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8192e1ant_ActionWifiConnected(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8192e1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+ halbtc8192e1ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
+ halbtc8192e1ant_DecBtPwr(pBtCoexist, FORCE_EXEC, 0);
+
+ halbtc8192e1ant_SwitchSsType(pBtCoexist, FORCE_EXEC, 2);
+
+ halbtc8192e1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+}
+
+//============================================================
+// work around function start with wa_halbtc8192e1ant_
+//============================================================
+//============================================================
+// extern function start with EXhalbtc8192e1ant_
+//============================================================
+VOID
+EXhalbtc8192e1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u4Byte u4Tmp=0;
+ u2Byte u2Tmp=0;
+ u1Byte u1Tmp=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
+
+ // antenna sw ctrl to bt
+ halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE);
+
+ halbtc8192e1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+
+ // antenna switch control parameter
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x858, 0x55555555);
+
+ // coex parameters
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1);
+ // 0x790[5:0]=0x5
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
+ u1Tmp &= 0xc0;
+ u1Tmp |= 0x5;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
+
+ // enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+
+ // enable PTA
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
+ // enable mailbox interface
+ u2Tmp = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x40);
+ u2Tmp |= BIT9;
+ pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x40, u2Tmp);
+
+ // enable PTA I2C mailbox
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x101);
+ u1Tmp |= BIT4;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x101, u1Tmp);
+
+ // enable bt clock when wifi is disabled.
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x93);
+ u1Tmp |= BIT0;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x93, u1Tmp);
+ // enable bt clock when suspend.
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x7);
+ u1Tmp |= BIT0;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x7, u1Tmp);
+}
+
+VOID
+EXhalbtc8192e1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ pBtCoexist->bStopCoexDm = FALSE;
+
+ halbtc8192e1ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8192e1ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ 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);
+
+ if(pBtCoexist->bManualControl)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ CL_PRINTF(cliBuf);
+ }
+ if(pBtCoexist->bStopCoexDm)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ 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);
+
+ 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", \
+ GLCoexVerDate8192e1Ant, GLCoexVer8192e1Ant, 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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, wifiHsChnl, bBtHsOn);
+ 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]", \
+ ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
+ ( (BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
+ pCoexSta->btRssi, pCoexSta->btRetryCnt);
+ CL_PRINTF(cliBuf);
+
+ 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);
+ 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; i<BT_INFO_SRC_8192E_1ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8192e1Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
+ ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
+ ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
+ pBtCoexist->btInfo.lpsVal,
+ pBtCoexist->btInfo.rpwmVal);
+ CL_PRINTF(cliBuf);
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "SS Type", \
+ pCoexDm->curSsType);
+ CL_PRINTF(cliBuf);
+
+ if(!pBtCoexist->bManualControl)
+ {
+ // 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(0x%x) ", "SM[SwDacSwing(lvl)]", \
+ pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl);
+ CL_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s/ %d ", "DelBA/ BtCtrlAgg/ AggSize", \
+ (pBtCoexist->btInfo.bRejectAggPkt? "Yes":"No"), (pBtCoexist->btInfo.bBtCtrlAggBufSize? "Yes":"No"),
+ pBtCoexist->btInfo.aggBufSize);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
+ pBtCoexist->btInfo.raMask);
+ CL_PRINTF(cliBuf);
+
+ // Fw mechanism
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
+ CL_PRINTF(cliBuf);
+
+ psTdmaCase = pCoexDm->curPsTdma;
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
+ pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
+ pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
+ 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/ %d ", "DecBtPwrLvl/ IgnWlanAct", \
+ pCoexDm->curBtDecPwrLvl, pCoexDm->bCurIgnoreWlanAct);
+ CL_PRINTF(cliBuf);
+ }
+
+ // Hw setting
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============");
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc04);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xd04);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x90c);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0xc04/ 0xd04/ 0x90c", \
+ u4Tmp[0], u4Tmp[1], u4Tmp[2]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x778", \
+ u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x92c);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x92c/ 0x930", \
+ (u1Tmp[0]), u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4f);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x40/ 0x4f", \
+ u1Tmp[0], u1Tmp[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);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ 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_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(hp rx[31:16]/tx[15:0])", \
+ pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
+ pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx);
+ CL_PRINTF(cliBuf);
+#if(BT_AUTO_REPORT_ONLY_8192E_1ANT == 1)
+ halbtc8192e1ant_MonitorBtCtr(pBtCoexist);
+#endif
+
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8192e1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u4Byte u4Tmp=0;
+
+ if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
+ return;
+
+ if(BTC_IPS_ENTER == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n"));
+ pCoexSta->bUnderIps = TRUE;
+ halbtc8192e1ant_CoexAllOff(pBtCoexist);
+ halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ pCoexSta->bUnderIps = FALSE;
+ }
+}
+
+VOID
+EXhalbtc8192e1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
+ return;
+
+ 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
+EXhalbtc8192e1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8192e1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8192e1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(BTC_SCAN_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8192e1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ }
+ else // wifi is connected
+ {
+ halbtc8192e1ant_ActionWifiConnectedScan(pBtCoexist);
+ }
+ }
+ else if(BTC_SCAN_FINISH == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8192e1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8192e1ant_ActionWifiConnected(pBtCoexist);
+ }
+ }
+}
+
+VOID
+EXhalbtc8192e1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8192e1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8192e1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if(BTC_ASSOCIATE_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
+ halbtc8192e1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ }
+ else if(BTC_ASSOCIATE_FINISH == type)
+ {
+ 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
+ {
+ halbtc8192e1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8192e1ant_ActionWifiConnected(pBtCoexist);
+ }
+ }
+}
+
+VOID
+EXhalbtc8192e1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+ u4Byte wifiBw;
+ u1Byte wifiCentralChnl;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ 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;
+ }
+
+ 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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
+}
+
+VOID
+EXhalbtc8192e1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8192e1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8192e1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if( BTC_PACKET_DHCP == type ||
+ BTC_PACKET_EAPOL == type )
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type));
+ halbtc8192e1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8192e1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ u1Byte btInfo=0;
+ u1Byte i, rspSource=0;
+ static u4Byte setBtPsdMode=0;
+ BOOLEAN bBtBusy=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+ BOOLEAN bBtCtrlAggBufSize=FALSE;
+
+ pCoexSta->bC2hBtInfoReqSent = FALSE;
+
+ rspSource = tmpBuf[0]&0xf;
+ if(rspSource >= BT_INFO_SRC_8192E_1ANT_MAX)
+ rspSource = BT_INFO_SRC_8192E_1ANT_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; i<length; i++)
+ {
+ 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]));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
+ }
+ }
+
+ if(pBtCoexist->btInfo.bBtDisabled)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for BT is disabled <===\n"));
+ return;
+ }
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Manual CTRL<===\n"));
+ return;
+ }
+ if(pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Coex STOPPED!!<===\n"));
+ return;
+ }
+
+ if(BT_INFO_SRC_8192E_1ANT_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];
+
+ // Here we need to resend some wifi info to BT
+ // because bt is reset and loss of the info.
+ if( (pCoexSta->btInfoExt & BIT1) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ EXhalbtc8192e1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ EXhalbtc8192e1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+
+ setBtPsdMode = 0;
+ }
+
+ // test-chip bt patch only rsp the status for BT_RSP,
+ // so temporary we consider the following only under BT_RSP
+ if(BT_INFO_SRC_8192E_1ANT_BT_RSP == rspSource)
+ {
+ if( (pCoexSta->btInfoExt & BIT3) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
+ halbtc8192e1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+ }
+ else
+ {
+ // BT already NOT ignore Wlan active, do nothing here.
+ }
+#if(BT_AUTO_REPORT_ONLY_8192E_1ANT == 0)
+ if( (pCoexSta->btInfoExt & BIT4) )
+ {
+ // BT auto report already enabled, do nothing
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit4 check, set BT to enable Auto Report!!\n"));
+ halbtc8192e1ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
+ }
+#endif
+ }
+ }
+
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8192E_1ANT_B_INQ_PAGE)
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ else
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+
+ // set link exist status
+ if(!(btInfo&BT_INFO_8192E_1ANT_B_CONNECTION))
+ {
+ pCoexSta->bBtLinkExist = FALSE;
+ pCoexSta->bPanExist = FALSE;
+ pCoexSta->bA2dpExist = FALSE;
+ pCoexSta->bHidExist = FALSE;
+ pCoexSta->bScoExist = FALSE;
+ }
+ else // connection exists
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ if(btInfo & BT_INFO_8192E_1ANT_B_FTP)
+ pCoexSta->bPanExist = TRUE;
+ else
+ pCoexSta->bPanExist = FALSE;
+ if(btInfo & BT_INFO_8192E_1ANT_B_A2DP)
+ pCoexSta->bA2dpExist = TRUE;
+ else
+ pCoexSta->bA2dpExist = FALSE;
+ if(btInfo & BT_INFO_8192E_1ANT_B_HID)
+ pCoexSta->bHidExist = TRUE;
+ else
+ pCoexSta->bHidExist = FALSE;
+ if(btInfo & BT_INFO_8192E_1ANT_B_SCO_ESCO)
+ pCoexSta->bScoExist = TRUE;
+ else
+ pCoexSta->bScoExist = FALSE;
+ }
+
+ halbtc8192e1ant_UpdateBtLinkInfo(pBtCoexist);
+
+ if(!(btInfo&BT_INFO_8192E_1ANT_B_CONNECTION))
+ {
+ pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-connected idle!!!\n"));
+ }
+ else if(btInfo == BT_INFO_8192E_1ANT_B_CONNECTION) // connection exists but no busy
+ {
+ pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt connected-idle!!!\n"));
+ }
+ else if((btInfo&BT_INFO_8192E_1ANT_B_SCO_ESCO) ||
+ (btInfo&BT_INFO_8192E_1ANT_B_SCO_BUSY))
+ {
+ pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_SCO_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt sco busy!!!\n"));
+ }
+ else if( (btInfo&BT_INFO_8192E_1ANT_B_ACL_BUSY) ||
+ (btInfo&BT_INFO_8192E_1ANT_B_A2DP) ||
+ (btInfo&BT_INFO_8192E_1ANT_B_FTP) )
+ {
+ if(BT_8192E_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_ACL_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt acl busy!!!\n"));
+ }
+ else
+ {
+ pCoexDm->btStatus = BT_8192E_1ANT_BT_STATUS_MAX;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-defined state!!!\n"));
+ }
+
+ // ra mask check
+ if(pBtLinkInfo->bScoExist || pBtLinkInfo->bHidExist)
+ {
+ halbtc8192e1ant_UpdateRaMask(pBtCoexist, NORMAL_EXEC, BTC_RATE_DISABLE, 0x00000003); // disable tx cck 1M/2M
+ }
+ else
+ {
+ halbtc8192e1ant_UpdateRaMask(pBtCoexist, NORMAL_EXEC, BTC_RATE_ENABLE, 0x00000003); // enable tx cck 1M/2M
+ }
+
+ if( (BT_8192E_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8192E_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ bBtBusy = TRUE;
+ if(pBtLinkInfo->bHidExist)
+ bBtCtrlAggBufSize = TRUE;
+ }
+ else
+ {
+ bBtBusy = FALSE;
+ }
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+
+ //============================================
+ // Aggregation related setting
+ //============================================
+ // if sco, reject AddBA
+ //pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt);
+
+ // decide BT control aggregation buf size or not
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE, &bBtCtrlAggBufSize);
+ // real update aggregation setting
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
+ //============================================
+
+ halbtc8192e1ant_RunCoexistMechanism(pBtCoexist);
+}
+
+VOID
+EXhalbtc8192e1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ pBtCoexist->bStopCoexDm = TRUE;
+ halbtc8192e1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ halbtc8192e1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+
+ EXhalbtc8192e1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8192e1ant_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)
+ {
+ pBtCoexist->bStopCoexDm = TRUE;
+ halbtc8192e1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ }
+ else if(BTC_WIFI_PNP_WAKE_UP == pnpState)
+ {
+
+ }
+}
+
+VOID
+EXhalbtc8192e1ant_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", \
+ GLCoexVerDate8192e1Ant, GLCoexVer8192e1Ant, fwVer, btPatchVer, btPatchVer));
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
+ }
+#if(BT_AUTO_REPORT_ONLY_8192E_1ANT == 0)
+ halbtc8192e1ant_QueryBtInfo(pBtCoexist);
+ halbtc8192e1ant_MonitorBtCtr(pBtCoexist);
+ halbtc8192e1ant_MonitorBtEnableDisable(pBtCoexist);
+#else
+ if( halbtc8192e1ant_IsWifiStatusChanged(pBtCoexist) ||
+ pCoexDm->bAutoTdmaAdjust)
+ {
+ halbtc8192e1ant_RunCoexistMechanism(pBtCoexist);
+ }
+#endif
+}
+
+VOID
+EXhalbtc8192e1ant_DbgControl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte opCode,
+ IN u1Byte opLen,
+ IN pu1Byte pData
+ )
+{
+ switch(opCode)
+ {
+ case BTC_DBG_SET_COEX_NORMAL:
+ pBtCoexist->bManualControl = FALSE;
+ halbtc8192e1ant_InitCoexDm(pBtCoexist);
+ break;
+ case BTC_DBG_SET_COEX_WIFI_ONLY:
+ pBtCoexist->bManualControl = TRUE;
+ halbtc8192e1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8192e1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ break;
+ case BTC_DBG_SET_COEX_BT_ONLY:
+ // todo
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h
index 7a1ce5a..9dde00d 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h
@@ -1,209 +1,209 @@
-//===========================================
-// The following is for 8192E_1ANT BT Co-exist definition
-//===========================================
-#define BT_AUTO_REPORT_ONLY_8192E_1ANT 0
-
-#define BT_INFO_8192E_1ANT_B_FTP BIT7
-#define BT_INFO_8192E_1ANT_B_A2DP BIT6
-#define BT_INFO_8192E_1ANT_B_HID BIT5
-#define BT_INFO_8192E_1ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8192E_1ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8192E_1ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8192E_1ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8192E_1ANT_B_CONNECTION BIT0
-
-#define BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
- (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
-
-#define BTC_RSSI_COEX_THRESH_TOL_8192E_1ANT 2
-
-typedef enum _BT_INFO_SRC_8192E_1ANT{
- BT_INFO_SRC_8192E_1ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8192E_1ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8192E_1ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8192E_1ANT_MAX
-}BT_INFO_SRC_8192E_1ANT,*PBT_INFO_SRC_8192E_1ANT;
-
-typedef enum _BT_8192E_1ANT_BT_STATUS{
- BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8192E_1ANT_BT_STATUS_INQ_PAGE = 0x2,
- BT_8192E_1ANT_BT_STATUS_ACL_BUSY = 0x3,
- BT_8192E_1ANT_BT_STATUS_SCO_BUSY = 0x4,
- BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
- BT_8192E_1ANT_BT_STATUS_MAX
-}BT_8192E_1ANT_BT_STATUS,*PBT_8192E_1ANT_BT_STATUS;
-
-typedef enum _BT_8192E_1ANT_WIFI_STATUS{
- BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
- BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
- BT_8192E_1ANT_WIFI_STATUS_MAX
-}BT_8192E_1ANT_WIFI_STATUS,*PBT_8192E_1ANT_WIFI_STATUS;
-
-typedef enum _BT_8192E_1ANT_COEX_ALGO{
- BT_8192E_1ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8192E_1ANT_COEX_ALGO_SCO = 0x1,
- BT_8192E_1ANT_COEX_ALGO_HID = 0x2,
- BT_8192E_1ANT_COEX_ALGO_A2DP = 0x3,
- BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
- BT_8192E_1ANT_COEX_ALGO_PANEDR = 0x5,
- BT_8192E_1ANT_COEX_ALGO_PANHS = 0x6,
- BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
- BT_8192E_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
- BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
- BT_8192E_1ANT_COEX_ALGO_HID_A2DP = 0xa,
- BT_8192E_1ANT_COEX_ALGO_MAX = 0xb,
-}BT_8192E_1ANT_COEX_ALGO,*PBT_8192E_1ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8192E_1ANT{
- // fw mechanism
- u1Byte preBtDecPwrLvl;
- u1Byte curBtDecPwrLvl;
- u1Byte preFwDacSwingLvl;
- u1Byte curFwDacSwingLvl;
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- u1Byte psTdmaDuAdjType;
- BOOLEAN bAutoTdmaAdjust;
- BOOLEAN bPrePsTdmaOn;
- BOOLEAN bCurPsTdmaOn;
- BOOLEAN bPreBtAutoReport;
- BOOLEAN bCurBtAutoReport;
- u1Byte preLps;
- u1Byte curLps;
- u1Byte preRpwm;
- u1Byte curRpwm;
-
- // sw mechanism
- BOOLEAN bPreLowPenaltyRa;
- BOOLEAN bCurLowPenaltyRa;
- BOOLEAN bPreDacSwingOn;
- u4Byte preDacSwingLvl;
- BOOLEAN bCurDacSwingOn;
- u4Byte curDacSwingLvl;
- u4Byte preVal0x6c0;
- u4Byte curVal0x6c0;
- u4Byte preVal0x6c4;
- u4Byte curVal0x6c4;
- u4Byte preVal0x6c8;
- u4Byte curVal0x6c8;
- u1Byte preVal0x6cc;
- u1Byte curVal0x6cc;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-
- u1Byte preSsType;
- u1Byte curSsType;
-
- u4Byte preRaMask;
- u4Byte curRaMask;
-
- u1Byte errorCondition;
-} COEX_DM_8192E_1ANT, *PCOEX_DM_8192E_1ANT;
-
-typedef struct _COEX_STA_8192E_1ANT{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bA2dpExist;
- 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_8192E_1ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8192E_1ANT_MAX];
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
-}COEX_STA_8192E_1ANT, *PCOEX_STA_8192E_1ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8192e1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8192e1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e1ant_PnpNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte pnpState
- );
-VOID
-EXhalbtc8192e1ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e1ant_DbgControl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte opCode,
- IN u1Byte opLen,
- IN pu1Byte pData
- );
+//===========================================
+// The following is for 8192E_1ANT BT Co-exist definition
+//===========================================
+#define BT_AUTO_REPORT_ONLY_8192E_1ANT 0
+
+#define BT_INFO_8192E_1ANT_B_FTP BIT7
+#define BT_INFO_8192E_1ANT_B_A2DP BIT6
+#define BT_INFO_8192E_1ANT_B_HID BIT5
+#define BT_INFO_8192E_1ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8192E_1ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8192E_1ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8192E_1ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8192E_1ANT_B_CONNECTION BIT0
+
+#define BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
+ (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
+
+#define BTC_RSSI_COEX_THRESH_TOL_8192E_1ANT 2
+
+typedef enum _BT_INFO_SRC_8192E_1ANT{
+ BT_INFO_SRC_8192E_1ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8192E_1ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8192E_1ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8192E_1ANT_MAX
+}BT_INFO_SRC_8192E_1ANT,*PBT_INFO_SRC_8192E_1ANT;
+
+typedef enum _BT_8192E_1ANT_BT_STATUS{
+ BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8192E_1ANT_BT_STATUS_INQ_PAGE = 0x2,
+ BT_8192E_1ANT_BT_STATUS_ACL_BUSY = 0x3,
+ BT_8192E_1ANT_BT_STATUS_SCO_BUSY = 0x4,
+ BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
+ BT_8192E_1ANT_BT_STATUS_MAX
+}BT_8192E_1ANT_BT_STATUS,*PBT_8192E_1ANT_BT_STATUS;
+
+typedef enum _BT_8192E_1ANT_WIFI_STATUS{
+ BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
+ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
+ BT_8192E_1ANT_WIFI_STATUS_MAX
+}BT_8192E_1ANT_WIFI_STATUS,*PBT_8192E_1ANT_WIFI_STATUS;
+
+typedef enum _BT_8192E_1ANT_COEX_ALGO{
+ BT_8192E_1ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8192E_1ANT_COEX_ALGO_SCO = 0x1,
+ BT_8192E_1ANT_COEX_ALGO_HID = 0x2,
+ BT_8192E_1ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
+ BT_8192E_1ANT_COEX_ALGO_PANEDR = 0x5,
+ BT_8192E_1ANT_COEX_ALGO_PANHS = 0x6,
+ BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
+ BT_8192E_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
+ BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
+ BT_8192E_1ANT_COEX_ALGO_HID_A2DP = 0xa,
+ BT_8192E_1ANT_COEX_ALGO_MAX = 0xb,
+}BT_8192E_1ANT_COEX_ALGO,*PBT_8192E_1ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8192E_1ANT{
+ // fw mechanism
+ u1Byte preBtDecPwrLvl;
+ u1Byte curBtDecPwrLvl;
+ u1Byte preFwDacSwingLvl;
+ u1Byte curFwDacSwingLvl;
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ u1Byte psTdmaDuAdjType;
+ BOOLEAN bAutoTdmaAdjust;
+ BOOLEAN bPrePsTdmaOn;
+ BOOLEAN bCurPsTdmaOn;
+ BOOLEAN bPreBtAutoReport;
+ BOOLEAN bCurBtAutoReport;
+ u1Byte preLps;
+ u1Byte curLps;
+ u1Byte preRpwm;
+ u1Byte curRpwm;
+
+ // sw mechanism
+ BOOLEAN bPreLowPenaltyRa;
+ BOOLEAN bCurLowPenaltyRa;
+ BOOLEAN bPreDacSwingOn;
+ u4Byte preDacSwingLvl;
+ BOOLEAN bCurDacSwingOn;
+ u4Byte curDacSwingLvl;
+ u4Byte preVal0x6c0;
+ u4Byte curVal0x6c0;
+ u4Byte preVal0x6c4;
+ u4Byte curVal0x6c4;
+ u4Byte preVal0x6c8;
+ u4Byte curVal0x6c8;
+ u1Byte preVal0x6cc;
+ u1Byte curVal0x6cc;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+
+ u1Byte preSsType;
+ u1Byte curSsType;
+
+ u4Byte preRaMask;
+ u4Byte curRaMask;
+
+ u1Byte errorCondition;
+} COEX_DM_8192E_1ANT, *PCOEX_DM_8192E_1ANT;
+
+typedef struct _COEX_STA_8192E_1ANT{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bA2dpExist;
+ 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_8192E_1ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8192E_1ANT_MAX];
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+}COEX_STA_8192E_1ANT, *PCOEX_STA_8192E_1ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8192e1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8192e1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e1ant_PnpNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte pnpState
+ );
+VOID
+EXhalbtc8192e1ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e1ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e1ant_DbgControl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte opCode,
+ IN u1Byte opLen,
+ IN pu1Byte pData
+ );
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c
index a1b8f27..d4e5378 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c
@@ -1,4398 +1,4398 @@
-//============================================================
-// Description:
-//
-// This file is for RTL8192E Co-exist mechanism
-//
-// History
-// 2012/11/15 Cosa first check in.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8192E_2ANT GLCoexDm8192e2Ant;
-static PCOEX_DM_8192E_2ANT pCoexDm=&GLCoexDm8192e2Ant;
-static COEX_STA_8192E_2ANT GLCoexSta8192e2Ant;
-static PCOEX_STA_8192E_2ANT pCoexSta=&GLCoexSta8192e2Ant;
-
-const char *const GLBtInfoSrc8192e2Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-u4Byte GLCoexVerDate8192e2Ant=20130912;
-u4Byte GLCoexVer8192e2Ant=0x35;
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8192e2ant_
-//============================================================
-u1Byte
-halbtc8192e2ant_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))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));
- if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8192E_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
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));
- 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))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));
- if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8192E_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))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=MEDIUM\n"));
- if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8192E_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
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));
- 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
-halbtc8192e2ant_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_8192E_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_8192E_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_8192E_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
-halbtc8192e2ant_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
- {
- }
- }
-}
-
-u4Byte
-halbtc8192e2ant_DecideRaMask(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte ssType,
- IN u4Byte raMaskType
- )
-{
- u4Byte disRaMask=0x0;
-
- switch(raMaskType)
- {
- case 0: // normal mode
- if(ssType == 2)
- disRaMask = 0x0; // enable 2ss
- else
- disRaMask = 0xfff00000; // disable 2ss
- break;
- case 1: // disable cck 1/2
- if(ssType == 2)
- disRaMask = 0x00000003; // enable 2ss
- else
- disRaMask = 0xfff00003; // disable 2ss
- break;
- case 2: // disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4
- if(ssType == 2)
- disRaMask = 0x0001f1f7; // enable 2ss
- else
- disRaMask = 0xfff1f1f7; // disable 2ss
- break;
- default:
- break;
- }
-
- return disRaMask;
-}
-
-VOID
-halbtc8192e2ant_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
-halbtc8192e2ant_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
-halbtc8192e2ant_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
-halbtc8192e2ant_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;
- default:
- break;
- }
- }
-
- pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType;
-}
-
-VOID
-halbtc8192e2ant_LimitedTx(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte raMaskType,
- IN u1Byte arfrType,
- IN u1Byte retryLimitType,
- IN u1Byte ampduTimeType
- )
-{
- u4Byte disRaMask=0x0;
-
- pCoexDm->curRaMaskType = raMaskType;
- disRaMask = halbtc8192e2ant_DecideRaMask(pBtCoexist, pCoexDm->curSsType, raMaskType);
- halbtc8192e2ant_UpdateRaMask(pBtCoexist, bForceExec, disRaMask);
-
- halbtc8192e2ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType);
- halbtc8192e2ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType);
- halbtc8192e2ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType);
-}
-
-VOID
-halbtc8192e2ant_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
-halbtc8192e2ant_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, 0xc);
-}
-
-VOID
-halbtc8192e2ant_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);
-}
-
-BOOLEAN
-halbtc8192e2ant_IsWifiStatusChanged(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
- BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
- BOOLEAN bWifiConnected=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
-
- if(bWifiConnected)
- {
- if(bWifiBusy != bPreWifiBusy)
- {
- bPreWifiBusy = bWifiBusy;
- return TRUE;
- }
- if(bUnder4way != bPreUnder4way)
- {
- bPreUnder4way = bUnder4way;
- return TRUE;
- }
- if(bBtHsOn != bPreBtHsOn)
- {
- bPreBtHsOn = bBtHsOn;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-VOID
-halbtc8192e2ant_UpdateBtLinkInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
- pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
- pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
- pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
- pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
-
- // work around for HS mode.
- if(bBtHsOn)
- {
- pBtLinkInfo->bPanExist = TRUE;
- pBtLinkInfo->bBtLinkExist = TRUE;
- }
-
- // check if Sco only
- if( pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bScoOnly = TRUE;
- else
- pBtLinkInfo->bScoOnly = FALSE;
-
- // check if A2dp only
- if( !pBtLinkInfo->bScoExist &&
- pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bA2dpOnly = TRUE;
- else
- pBtLinkInfo->bA2dpOnly = FALSE;
-
- // check if Pan only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bPanOnly = TRUE;
- else
- pBtLinkInfo->bPanOnly = FALSE;
-
- // check if Hid only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bHidExist )
- pBtLinkInfo->bHidOnly = TRUE;
- else
- pBtLinkInfo->bHidOnly = FALSE;
-}
-
-u1Byte
-halbtc8192e2ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8192E_2ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!pBtLinkInfo->bBtLinkExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
- return algorithm;
- }
-
- if(pBtLinkInfo->bScoExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bHidExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bPanExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bA2dpExist)
- numOfDiffProfile++;
-
- if(numOfDiffProfile == 1)
- {
- if(pBtLinkInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_A2DP;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile == 2)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_SCO_PAN;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(pStackInfo->numOfHid >= 2)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID*2 + A2DP\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP;
- }
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP;
- }
- }
- }
- }
- else if(numOfDiffProfile == 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_SCO_PAN;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile >= 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->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_8192E_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-VOID
-halbtc8192e2ant_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
-halbtc8192e2ant_SetFwDecBtPwr(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte decBtPwrLvl
- )
-{
- u1Byte H2C_Parameter[1] ={0};
-
- H2C_Parameter[0] = decBtPwrLvl;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power level = %d, FW write 0x62=0x%x\n",
- decBtPwrLvl, H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8192e2ant_DecBtPwr(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte decBtPwrLvl
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power level = %d\n",
- (bForceExec? "force to":""), decBtPwrLvl));
- pCoexDm->curBtDecPwrLvl = decBtPwrLvl;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preBtDecPwrLvl=%d, curBtDecPwrLvl=%d\n",
- pCoexDm->preBtDecPwrLvl, pCoexDm->curBtDecPwrLvl));
-#if 0 // work around, avoid h2c command fail.
- if(pCoexDm->preBtDecPwrLvl == pCoexDm->curBtDecPwrLvl)
- return;
-#endif
- }
- halbtc8192e2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->curBtDecPwrLvl);
-
- pCoexDm->preBtDecPwrLvl = pCoexDm->curBtDecPwrLvl;
-}
-
-VOID
-halbtc8192e2ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8192e2ant_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;
- }
- halbtc8192e2ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
-
- pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
-}
-
-VOID
-halbtc8192e2ant_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;
- }
-
- halbtc8192e2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
-
- pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
-}
-
-VOID
-halbtc8192e2ant_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
-halbtc8192e2ant_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;
- }
- halbtc8192e2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
-
- pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
-}
-
-VOID
-halbtc8192e2ant_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
-halbtc8192e2ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- //return;
- 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;
- }
- halbtc8192e2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8192e2ant_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, 0x883, 0x3e, val);
-}
-
-VOID
-halbtc8192e2ant_SetSwFullTimeDacSwing(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSwDacSwingOn,
- IN u4Byte swDacSwingLvl
- )
-{
- if(bSwDacSwingOn)
- {
- halbtc8192e2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
- }
- else
- {
- halbtc8192e2ant_SetDacSwingReg(pBtCoexist, 0x18);
- }
-}
-
-
-VOID
-halbtc8192e2ant_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);
- halbtc8192e2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
-
- pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
- pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
-}
-
-VOID
-halbtc8192e2ant_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, 0xc05, 0x30, 0x3);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xc05, 0x30, 0x1);
- }
-}
-
-VOID
-halbtc8192e2ant_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;
- }
- halbtc8192e2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
-
- pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
-}
-
-VOID
-halbtc8192e2ant_SetAgcTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAgcTableEn
- )
-{
- u1Byte rssiAdjustVal=0;
-
- //=================BB AGC Gain Table
- if(bAgcTableEn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table On!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x0a1A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x091B0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x081C0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x071D0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x061E0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x051F0001);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table Off!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xaa1A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa91B0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa81C0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa71D0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa61E0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa51F0001);
- }
-
-#if 0
- //=================RF Gain
- 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, 0x38fff);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x38ffe);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x380c3);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x28ce6);
- }
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x1);
- if(bAgcTableEn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38fff);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38ffe);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x380c3);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x28ce6);
- }
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x0);
-
- // set rssiAdjustVal for wifi module.
- if(bAgcTableEn)
- {
- rssiAdjustVal = 8;
- }
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
-#endif
-
-}
-
-VOID
-halbtc8192e2ant_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;
- }
- halbtc8192e2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
-
- pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
-}
-
-VOID
-halbtc8192e2ant_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
-halbtc8192e2ant_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;
- }
- halbtc8192e2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8192e2ant_CoexTableWithType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type
- )
-{
- switch(type)
- {
- case 0:
- halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 1:
- halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 2:
- halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5ffb5ffb, 0xffffff, 0x3);
- break;
- case 3:
- halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x5fdf5fdf, 0x5fdb5fdb, 0xffffff, 0x3);
- break;
- case 4:
- halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0xdfffdfff, 0x5ffb5ffb, 0xffffff, 0x3);
- break;
-
- default:
- break;
- }
-}
-
-VOID
-halbtc8192e2ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8192e2ant_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;
- }
- halbtc8192e2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8192e2ant_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};
-
- H2C_Parameter[0] = byte1;
- H2C_Parameter[1] = byte2;
- H2C_Parameter[2] = byte3;
- H2C_Parameter[3] = byte4;
- H2C_Parameter[4] = byte5;
-
- pCoexDm->psTdmaPara[0] = byte1;
- pCoexDm->psTdmaPara[1] = byte2;
- pCoexDm->psTdmaPara[2] = byte3;
- pCoexDm->psTdmaPara[3] = byte4;
- pCoexDm->psTdmaPara[4] = byte5;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
-halbtc8192e2ant_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;
- }
- */
-
- halbtc8192e2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF);
- //halbtc8192e2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
-}
-
-VOID
-halbtc8192e2ant_SwMechanism2(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAGCTableShift,
- IN BOOLEAN bADCBackOff,
- IN BOOLEAN bSWDACSwing,
- IN u4Byte dacSwingLvl
- )
-{
- halbtc8192e2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift);
- //halbtc8192e2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff);
- halbtc8192e2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl);
-}
-
-VOID
-halbtc8192e2ant_SetAntPath(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte antPosType,
- IN BOOLEAN bInitHwCfg,
- IN BOOLEAN bWifiOff
- )
-{
- u4Byte u4Tmp=0;
-
- if(bInitHwCfg)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x944, 0x24);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x930, 0x700700);
- if(pBtCoexist->chipInterface == BTC_INTF_USB)
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30430004);
- else
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30030004);
-
- // 0x4c[27][24]='00', Set Antenna to BB
- u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u4Tmp &= ~BIT24;
- u4Tmp &= ~BIT27;
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
- }
- else if(bWifiOff)
- {
- if(pBtCoexist->chipInterface == BTC_INTF_USB)
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30430004);
- else
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30030004);
-
- // 0x4c[27][24]='11', Set Antenna to BT, 0x64[8:7]=0, 0x64[2]=1
- u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u4Tmp |= BIT24;
- u4Tmp |= BIT27;
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
- }
-
- // ext switch setting
- switch(antPosType)
- {
- case BTC_ANT_PATH_WIFI:
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x4);
- break;
- case BTC_ANT_PATH_BT:
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x20);
- break;
- default:
- case BTC_ANT_PATH_PTA:
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x4);
- break;
- }
-}
-
-VOID
-halbtc8192e2ant_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:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
- case 2:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
- break;
- case 3:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90);
- break;
- case 4:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x3, 0xf1, 0x90);
- break;
- case 5:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
- break;
- case 6:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
- break;
- case 7:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90);
- break;
- case 8:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90);
- break;
- case 9:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x10);
- break;
- case 10:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x10);
- break;
- case 11:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x10);
- break;
- case 12:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x3, 0xf1, 0x10);
- break;
- case 13:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe0, 0x10);
- break;
- case 14:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe0, 0x10);
- break;
- case 15:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf0, 0x10);
- break;
- case 16:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x3, 0xf0, 0x10);
- break;
- case 17:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x61, 0x20, 0x03, 0x10, 0x10);
- break;
- case 18:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
- break;
- case 19:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90);
- break;
- case 20:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);
- break;
- case 21:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);
- break;
- case 71:
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
- }
- }
- else
- {
- // disable PS tdma
- switch(type)
- {
- default:
- case 0: //ANT2PTA, 0x778=1
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
- halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE);
- break;
- case 1: //ANT2BT, 0x778=3
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
- delay_ms(5);
- halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
- break;
-
- }
- }
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-VOID
-halbtc8192e2ant_SetSwitchSsType(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte ssType
- )
-{
- u1Byte mimoPs=BTC_MIMO_PS_DYNAMIC;
- u4Byte disRaMask=0x0;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], REAL set SS Type = %d\n", ssType));
-
- disRaMask = halbtc8192e2ant_DecideRaMask(pBtCoexist, ssType, pCoexDm->curRaMaskType);
- halbtc8192e2ant_UpdateRaMask(pBtCoexist, FORCE_EXEC, disRaMask);
-
- if(ssType == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
- // switch ofdm path
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x11);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x1);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81111111);
- // switch cck patch
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x1);
- //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x81);
- mimoPs=BTC_MIMO_PS_STATIC;
- }
- else if(ssType == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x33);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x3);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81121313);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x0);
- //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x41);
- mimoPs=BTC_MIMO_PS_DYNAMIC;
- }
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_SEND_MIMO_PS, &mimoPs); // set rx 1ss or 2ss
-}
-
-VOID
-halbtc8192e2ant_SwitchSsType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte newSsType
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], %s Switch SS Type = %d\n",
- (bForceExec? "force to":""), newSsType));
- pCoexDm->curSsType = newSsType;
-
- if(!bForceExec)
- {
- if(pCoexDm->preSsType == pCoexDm->curSsType)
- return;
- }
- halbtc8192e2ant_SetSwitchSsType(pBtCoexist, pCoexDm->curSsType);
-
- pCoexDm->preSsType = pCoexDm->curSsType;
-}
-
-VOID
-halbtc8192e2ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // fw all off
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- // sw all off
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- // hw all off
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-VOID
-halbtc8192e2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
-
- halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, 0);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
- halbtc8192e2ant_SwitchSsType(pBtCoexist, FORCE_EXEC, 2);
-
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-}
-
-VOID
-halbtc8192e2ant_ActionBtInquiry(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bLowPwrDisable=TRUE;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-}
-
-BOOLEAN
-halbtc8192e2ant_IsCommonAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
- BOOLEAN bBtHsOn=FALSE, bLowPwrDisable=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if(pBtLinkInfo->bScoExist || pBtLinkInfo->bHidExist)
- {
- halbtc8192e2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 0, 0, 0);
- }
- else
- {
- halbtc8192e2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
- }
-
- if(!bWifiConnected)
- {
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-connected idle!!\n"));
-
- if( (BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) ||
- (BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else
- {
- if(BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else if(BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- bLowPwrDisable = TRUE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- if(bBtHsOn)
- return FALSE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- 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 Connected-Busy + BT Busy!!\n"));
- bCommon = FALSE;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21);
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- bCommon = TRUE;
- }
- }
- }
-
- return bCommon;
-}
-VOID
-halbtc8192e2ant_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->bAutoTdmaAdjust)
- {
- pCoexDm->bAutoTdmaAdjust = TRUE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
- {
- if(bScoHid)
- {
- if(bTxPause)
- {
- if(maxInterval == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(maxInterval == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(maxInterval == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(maxInterval == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(maxInterval == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- }
- else
- {
- if(bTxPause)
- {
- if(maxInterval == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(maxInterval == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(maxInterval == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(maxInterval == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(maxInterval == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else
- {
- halbtc8192e2ant_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)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_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)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
- pCoexDm->psTdmaDuAdjType = 71;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 71)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
- pCoexDm->psTdmaDuAdjType = 71;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_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)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_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)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_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)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_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)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8192e2ant_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)
- {
- halbtc8192e2ant_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"));
- }
- }
-}
-
-// SCO only or SCO+PAN(HS)
-VOID
-halbtc8192e2ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_STAY_LOW;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
-
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
- }
- }
-}
-
-VOID
-halbtc8192e2ant_ActionScoPan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_STAY_LOW;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
-
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
- }
- }
-}
-
-VOID
-halbtc8192e2ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8192e2ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
- BOOLEAN bLongDist=FALSE;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW||btRssiState == BTC_RSSI_STATE_STAY_LOW) &&
- (wifiRssiState == BTC_RSSI_STATE_LOW||wifiRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2dp, wifi/bt rssi both LOW!!\n"));
- bLongDist = TRUE;
- }
- if(bLongDist)
- {
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x4);
- }
- else
- {
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- }
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(bLongDist)
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- else
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-
-
- if(bLongDist)
- {
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 17);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- }
- else
- {
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- }
- }
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8192e2ant_ActionA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- }
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
- }
- }
-}
-
-VOID
-halbtc8192e2ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- }
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//PAN(HS) only
-VOID
-halbtc8192e2ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- }
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8192e2ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8192e2ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8192e2ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8192e2ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
-
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
-
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8192e2ant_RunCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiUnder5G=FALSE;
- u1Byte btInfoOriginal=0, btRetryCnt=0;
- u1Byte algorithm=0;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
- return;
- }
-
- if(pCoexSta->bUnderIps)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
- return;
- }
-
- algorithm = halbtc8192e2ant_ActionAlgorithm(pBtCoexist);
- if(pCoexSta->bC2hBtInquiryPage && (BT_8192E_2ANT_COEX_ALGO_PANHS!=algorithm))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));
- halbtc8192e2ant_ActionBtInquiry(pBtCoexist);
- return;
- }
-
- pCoexDm->curAlgorithm = algorithm;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
-
- if(halbtc8192e2ant_IsCommonAction(pBtCoexist))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n"));
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- else
- {
- if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n",
- pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8192E_2ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
- halbtc8192e2ant_ActionSco(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_SCO_PAN:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO+PAN(EDR).\n"));
- halbtc8192e2ant_ActionScoPan(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
- halbtc8192e2ant_ActionHid(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
- halbtc8192e2ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));
- halbtc8192e2ant_ActionA2dpPanHs(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
- halbtc8192e2ant_ActionPanEdr(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
- halbtc8192e2ant_ActionPanHs(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
- halbtc8192e2ant_ActionPanEdrA2dp(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_PANEDR_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
- halbtc8192e2ant_ActionPanEdrHid(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
- halbtc8192e2ant_ActionHidA2dpPanEdr(pBtCoexist);
- break;
- case BT_8192E_2ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
- halbtc8192e2ant_ActionHidA2dp(pBtCoexist);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = unknown!!\n"));
- //halbtc8192e2ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
-}
-
-VOID
-halbtc8192e2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bBackUp
- )
-{
- u4Byte u4Tmp=0;
- u2Byte u2Tmp=0;
- u1Byte u1Tmp=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
-
- 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);
- }
-
- // antenna sw ctrl to bt
- halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE);
-
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-
- // antenna switch control parameter
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x858, 0x55555555);
-
- // coex parameters
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
- // 0x790[5:0]=0x5
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
- u1Tmp &= 0xc0;
- u1Tmp |= 0x5;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
-
- // enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
-
- // enable PTA
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
- // enable mailbox interface
- u2Tmp = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x40);
- u2Tmp |= BIT9;
- pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x40, u2Tmp);
-
- // enable PTA I2C mailbox
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x101);
- u1Tmp |= BIT4;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x101, u1Tmp);
-
- // enable bt clock when wifi is disabled.
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x93);
- u1Tmp |= BIT0;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x93, u1Tmp);
- // enable bt clock when suspend.
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x7);
- u1Tmp |= BIT0;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x7, u1Tmp);
-}
-
-//============================================================
-// work around function start with wa_halbtc8192e2ant_
-//============================================================
-//============================================================
-// extern function start with EXhalbtc8192e2ant_
-//============================================================
-VOID
-EXhalbtc8192e2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8192e2ant_InitHwConfig(pBtCoexist, TRUE);
-}
-
-VOID
-EXhalbtc8192e2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- halbtc8192e2ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8192e2ant_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;
- u2Byte u2Tmp[4];
- 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, faOfdm, faCck;
- u1Byte wifiDot11Chnl, wifiHsChnl;
- u4Byte fwVer=0, btPatchVer=0;
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============");
- CL_PRINTF(cliBuf);
-
- if(pBtCoexist->bManualControl)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- 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);
-
- 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", \
- GLCoexVerDate8192e2Ant, GLCoexVer8192e2Ant, 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]", \
- ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
- ( (BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
- pCoexSta->btRssi, pCoexSta->btRetryCnt);
- CL_PRINTF(cliBuf);
-
- 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; i<BT_INFO_SRC_8192E_2ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8192e2Ant[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);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "SS Type", \
- pCoexDm->curSsType);
- CL_PRINTF(cliBuf);
-
- // 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);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
- pBtCoexist->btInfo.raMask);
- CL_PRINTF(cliBuf);
-
- // Fw mechanism
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
- CL_PRINTF(cliBuf);
-
- psTdmaCase = pCoexDm->curPsTdma;
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
- pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
- pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
- pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust);
- CL_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \
- pCoexDm->curBtDecPwrLvl, 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);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "backup ARFR1/ARFR2/RL/AMaxTime", \
- pCoexDm->backupArfrCnt1, pCoexDm->backupArfrCnt2, pCoexDm->backupRetryLimit, pCoexDm->backupAmpduMaxTime);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
- u2Tmp[0] = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "0x430/0x434/0x42a/0x456", \
- u4Tmp[0], u4Tmp[1], u2Tmp[0], u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc04);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xd04);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x90c);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0xc04/ 0xd04/ 0x90c", \
- u4Tmp[0], u4Tmp[1], u4Tmp[2]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x778", \
- u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x92c);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x92c/ 0x930", \
- (u1Tmp[0]), u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4f);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x40/ 0x4f", \
- u1Tmp[0], u1Tmp[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);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- 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_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(hp rx[31:16]/tx[15:0])", \
- pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
- pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx);
- CL_PRINTF(cliBuf);
-#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 1)
- halbtc8192e2ant_MonitorBtCtr(pBtCoexist);
-#endif
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8192e2ant_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;
- halbtc8192e2ant_CoexAllOff(pBtCoexist);
- halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- pCoexSta->bUnderIps = FALSE;
- }
-}
-
-VOID
-EXhalbtc8192e2ant_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
-EXhalbtc8192e2ant_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
-EXhalbtc8192e2ant_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
-EXhalbtc8192e2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u1Byte H2C_Parameter[3] ={0};
- u4Byte wifiBw;
- u1Byte wifiCentralChnl;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- 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;
- }
-
- 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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
-}
-
-VOID
-EXhalbtc8192e2ant_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
-EXhalbtc8192e2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- u1Byte btInfo=0;
- u1Byte i, rspSource=0;
- BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE;
- BOOLEAN bWifiConnected=FALSE;
-
- pCoexSta->bC2hBtInfoReqSent = FALSE;
-
- rspSource = tmpBuf[0]&0xf;
- if(rspSource >= BT_INFO_SRC_8192E_2ANT_MAX)
- rspSource = BT_INFO_SRC_8192E_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; i<length; i++)
- {
- 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]));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
- }
- }
-
- if(BT_INFO_SRC_8192E_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];
-
- // Here we need to resend some wifi info to BT
- // because bt is reset and loss of the info.
- if( (pCoexSta->btInfoExt & BIT1) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- EXhalbtc8192e2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- EXhalbtc8192e2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
- }
-
- if( (pCoexSta->btInfoExt & BIT3) )
- {
- if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
- halbtc8192e2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
- }
- }
- else
- {
- // BT already NOT ignore Wlan active, do nothing here.
- }
-
-#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
- if( (pCoexSta->btInfoExt & BIT4) )
- {
- // BT auto report already enabled, do nothing
- }
- else
- {
- halbtc8192e2ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
- }
-#endif
- }
-
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8192E_2ANT_B_INQ_PAGE)
- pCoexSta->bC2hBtInquiryPage = TRUE;
- else
- pCoexSta->bC2hBtInquiryPage = FALSE;
-
- // set link exist status
- if(!(btInfo&BT_INFO_8192E_2ANT_B_CONNECTION))
- {
- pCoexSta->bBtLinkExist = FALSE;
- pCoexSta->bPanExist = FALSE;
- pCoexSta->bA2dpExist = FALSE;
- pCoexSta->bHidExist = FALSE;
- pCoexSta->bScoExist = FALSE;
- }
- else // connection exists
- {
- pCoexSta->bBtLinkExist = TRUE;
- if(btInfo & BT_INFO_8192E_2ANT_B_FTP)
- pCoexSta->bPanExist = TRUE;
- else
- pCoexSta->bPanExist = FALSE;
- if(btInfo & BT_INFO_8192E_2ANT_B_A2DP)
- pCoexSta->bA2dpExist = TRUE;
- else
- pCoexSta->bA2dpExist = FALSE;
- if(btInfo & BT_INFO_8192E_2ANT_B_HID)
- pCoexSta->bHidExist = TRUE;
- else
- pCoexSta->bHidExist = FALSE;
- if(btInfo & BT_INFO_8192E_2ANT_B_SCO_ESCO)
- pCoexSta->bScoExist = TRUE;
- else
- pCoexSta->bScoExist = FALSE;
- }
-
- halbtc8192e2ant_UpdateBtLinkInfo(pBtCoexist);
-
- if(!(btInfo&BT_INFO_8192E_2ANT_B_CONNECTION))
- {
- pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
- }
- else if(btInfo == BT_INFO_8192E_2ANT_B_CONNECTION) // connection exists but no busy
- {
- pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
- }
- else if((btInfo&BT_INFO_8192E_2ANT_B_SCO_ESCO) ||
- (btInfo&BT_INFO_8192E_2ANT_B_SCO_BUSY))
- {
- pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_SCO_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
- }
- else if(btInfo&BT_INFO_8192E_2ANT_B_ACL_BUSY)
- {
- pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_ACL_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
- }
- else
- {
- pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_MAX;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
- }
-
- if( (BT_8192E_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8192E_2ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- bBtBusy = TRUE;
- bLimitedDig = TRUE;
- }
- else
- {
- bBtBusy = FALSE;
- bLimitedDig = FALSE;
- }
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
-
- pCoexDm->bLimitedDig = bLimitedDig;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
-
- halbtc8192e2ant_RunCoexistMechanism(pBtCoexist);
-}
-
-VOID
-EXhalbtc8192e2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
- halbtc8192e2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- EXhalbtc8192e2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8192e2ant_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", \
- GLCoexVerDate8192e2Ant, GLCoexVer8192e2Ant, fwVer, btPatchVer, btPatchVer));
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
- }
-
-#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
- halbtc8192e2ant_QueryBtInfo(pBtCoexist);
- halbtc8192e2ant_MonitorBtCtr(pBtCoexist);
- halbtc8192e2ant_MonitorBtEnableDisable(pBtCoexist);
-#else
- if( halbtc8192e2ant_IsWifiStatusChanged(pBtCoexist) ||
- pCoexDm->bAutoTdmaAdjust)
- {
- halbtc8192e2ant_RunCoexistMechanism(pBtCoexist);
- }
-#endif
-}
-
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for RTL8192E Co-exist mechanism
+//
+// History
+// 2012/11/15 Cosa first check in.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8192E_2ANT GLCoexDm8192e2Ant;
+static PCOEX_DM_8192E_2ANT pCoexDm=&GLCoexDm8192e2Ant;
+static COEX_STA_8192E_2ANT GLCoexSta8192e2Ant;
+static PCOEX_STA_8192E_2ANT pCoexSta=&GLCoexSta8192e2Ant;
+
+const char *const GLBtInfoSrc8192e2Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+u4Byte GLCoexVerDate8192e2Ant=20130912;
+u4Byte GLCoexVer8192e2Ant=0x35;
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8192e2ant_
+//============================================================
+u1Byte
+halbtc8192e2ant_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))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));
+ if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8192E_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
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));
+ 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))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));
+ if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8192E_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))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=MEDIUM\n"));
+ if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8192E_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
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));
+ 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
+halbtc8192e2ant_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_8192E_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_8192E_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_8192E_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
+halbtc8192e2ant_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
+ {
+ }
+ }
+}
+
+u4Byte
+halbtc8192e2ant_DecideRaMask(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte ssType,
+ IN u4Byte raMaskType
+ )
+{
+ u4Byte disRaMask=0x0;
+
+ switch(raMaskType)
+ {
+ case 0: // normal mode
+ if(ssType == 2)
+ disRaMask = 0x0; // enable 2ss
+ else
+ disRaMask = 0xfff00000; // disable 2ss
+ break;
+ case 1: // disable cck 1/2
+ if(ssType == 2)
+ disRaMask = 0x00000003; // enable 2ss
+ else
+ disRaMask = 0xfff00003; // disable 2ss
+ break;
+ case 2: // disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4
+ if(ssType == 2)
+ disRaMask = 0x0001f1f7; // enable 2ss
+ else
+ disRaMask = 0xfff1f1f7; // disable 2ss
+ break;
+ default:
+ break;
+ }
+
+ return disRaMask;
+}
+
+VOID
+halbtc8192e2ant_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
+halbtc8192e2ant_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
+halbtc8192e2ant_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
+halbtc8192e2ant_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;
+ default:
+ break;
+ }
+ }
+
+ pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType;
+}
+
+VOID
+halbtc8192e2ant_LimitedTx(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte raMaskType,
+ IN u1Byte arfrType,
+ IN u1Byte retryLimitType,
+ IN u1Byte ampduTimeType
+ )
+{
+ u4Byte disRaMask=0x0;
+
+ pCoexDm->curRaMaskType = raMaskType;
+ disRaMask = halbtc8192e2ant_DecideRaMask(pBtCoexist, pCoexDm->curSsType, raMaskType);
+ halbtc8192e2ant_UpdateRaMask(pBtCoexist, bForceExec, disRaMask);
+
+ halbtc8192e2ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType);
+ halbtc8192e2ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType);
+ halbtc8192e2ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType);
+}
+
+VOID
+halbtc8192e2ant_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
+halbtc8192e2ant_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, 0xc);
+}
+
+VOID
+halbtc8192e2ant_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);
+}
+
+BOOLEAN
+halbtc8192e2ant_IsWifiStatusChanged(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
+ BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+
+ if(bWifiConnected)
+ {
+ if(bWifiBusy != bPreWifiBusy)
+ {
+ bPreWifiBusy = bWifiBusy;
+ return TRUE;
+ }
+ if(bUnder4way != bPreUnder4way)
+ {
+ bPreUnder4way = bUnder4way;
+ return TRUE;
+ }
+ if(bBtHsOn != bPreBtHsOn)
+ {
+ bPreBtHsOn = bBtHsOn;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+VOID
+halbtc8192e2ant_UpdateBtLinkInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
+ pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
+ pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
+ pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
+
+ // work around for HS mode.
+ if(bBtHsOn)
+ {
+ pBtLinkInfo->bPanExist = TRUE;
+ pBtLinkInfo->bBtLinkExist = TRUE;
+ }
+
+ // check if Sco only
+ if( pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bScoOnly = TRUE;
+ else
+ pBtLinkInfo->bScoOnly = FALSE;
+
+ // check if A2dp only
+ if( !pBtLinkInfo->bScoExist &&
+ pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bA2dpOnly = TRUE;
+ else
+ pBtLinkInfo->bA2dpOnly = FALSE;
+
+ // check if Pan only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bPanOnly = TRUE;
+ else
+ pBtLinkInfo->bPanOnly = FALSE;
+
+ // check if Hid only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bHidOnly = TRUE;
+ else
+ pBtLinkInfo->bHidOnly = FALSE;
+}
+
+u1Byte
+halbtc8192e2ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8192E_2ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!pBtLinkInfo->bBtLinkExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
+ return algorithm;
+ }
+
+ if(pBtLinkInfo->bScoExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bHidExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bPanExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bA2dpExist)
+ numOfDiffProfile++;
+
+ if(numOfDiffProfile == 1)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_A2DP;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 2)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_SCO_PAN;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(pStackInfo->numOfHid >= 2)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID*2 + A2DP\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_SCO_PAN;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile >= 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->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_8192E_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+VOID
+halbtc8192e2ant_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
+halbtc8192e2ant_SetFwDecBtPwr(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte decBtPwrLvl
+ )
+{
+ u1Byte H2C_Parameter[1] ={0};
+
+ H2C_Parameter[0] = decBtPwrLvl;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power level = %d, FW write 0x62=0x%x\n",
+ decBtPwrLvl, H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8192e2ant_DecBtPwr(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte decBtPwrLvl
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power level = %d\n",
+ (bForceExec? "force to":""), decBtPwrLvl));
+ pCoexDm->curBtDecPwrLvl = decBtPwrLvl;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preBtDecPwrLvl=%d, curBtDecPwrLvl=%d\n",
+ pCoexDm->preBtDecPwrLvl, pCoexDm->curBtDecPwrLvl));
+#if 0 // work around, avoid h2c command fail.
+ if(pCoexDm->preBtDecPwrLvl == pCoexDm->curBtDecPwrLvl)
+ return;
+#endif
+ }
+ halbtc8192e2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->curBtDecPwrLvl);
+
+ pCoexDm->preBtDecPwrLvl = pCoexDm->curBtDecPwrLvl;
+}
+
+VOID
+halbtc8192e2ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8192e2ant_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;
+ }
+ halbtc8192e2ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
+
+ pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
+}
+
+VOID
+halbtc8192e2ant_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;
+ }
+
+ halbtc8192e2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
+
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
+}
+
+VOID
+halbtc8192e2ant_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
+halbtc8192e2ant_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;
+ }
+ halbtc8192e2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
+
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
+}
+
+VOID
+halbtc8192e2ant_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
+halbtc8192e2ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ //return;
+ 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;
+ }
+ halbtc8192e2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8192e2ant_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, 0x883, 0x3e, val);
+}
+
+VOID
+halbtc8192e2ant_SetSwFullTimeDacSwing(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSwDacSwingOn,
+ IN u4Byte swDacSwingLvl
+ )
+{
+ if(bSwDacSwingOn)
+ {
+ halbtc8192e2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
+ }
+ else
+ {
+ halbtc8192e2ant_SetDacSwingReg(pBtCoexist, 0x18);
+ }
+}
+
+
+VOID
+halbtc8192e2ant_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);
+ halbtc8192e2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
+
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
+}
+
+VOID
+halbtc8192e2ant_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, 0xc05, 0x30, 0x3);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xc05, 0x30, 0x1);
+ }
+}
+
+VOID
+halbtc8192e2ant_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;
+ }
+ halbtc8192e2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
+
+ pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
+}
+
+VOID
+halbtc8192e2ant_SetAgcTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAgcTableEn
+ )
+{
+ u1Byte rssiAdjustVal=0;
+
+ //=================BB AGC Gain Table
+ if(bAgcTableEn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table On!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x0a1A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x091B0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x081C0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x071D0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x061E0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x051F0001);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table Off!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xaa1A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa91B0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa81C0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa71D0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa61E0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa51F0001);
+ }
+
+#if 0
+ //=================RF Gain
+ 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, 0x38fff);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x38ffe);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x380c3);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x28ce6);
+ }
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x1);
+ if(bAgcTableEn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38fff);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38ffe);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x380c3);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x28ce6);
+ }
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x0);
+
+ // set rssiAdjustVal for wifi module.
+ if(bAgcTableEn)
+ {
+ rssiAdjustVal = 8;
+ }
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
+#endif
+
+}
+
+VOID
+halbtc8192e2ant_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;
+ }
+ halbtc8192e2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
+
+ pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
+}
+
+VOID
+halbtc8192e2ant_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
+halbtc8192e2ant_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;
+ }
+ halbtc8192e2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8192e2ant_CoexTableWithType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type
+ )
+{
+ switch(type)
+ {
+ case 0:
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 1:
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 2:
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5ffb5ffb, 0xffffff, 0x3);
+ break;
+ case 3:
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x5fdf5fdf, 0x5fdb5fdb, 0xffffff, 0x3);
+ break;
+ case 4:
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0xdfffdfff, 0x5ffb5ffb, 0xffffff, 0x3);
+ break;
+
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8192e2ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8192e2ant_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;
+ }
+ halbtc8192e2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8192e2ant_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};
+
+ H2C_Parameter[0] = byte1;
+ H2C_Parameter[1] = byte2;
+ H2C_Parameter[2] = byte3;
+ H2C_Parameter[3] = byte4;
+ H2C_Parameter[4] = byte5;
+
+ pCoexDm->psTdmaPara[0] = byte1;
+ pCoexDm->psTdmaPara[1] = byte2;
+ pCoexDm->psTdmaPara[2] = byte3;
+ pCoexDm->psTdmaPara[3] = byte4;
+ pCoexDm->psTdmaPara[4] = byte5;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
+halbtc8192e2ant_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;
+ }
+ */
+
+ halbtc8192e2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF);
+ //halbtc8192e2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
+}
+
+VOID
+halbtc8192e2ant_SwMechanism2(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAGCTableShift,
+ IN BOOLEAN bADCBackOff,
+ IN BOOLEAN bSWDACSwing,
+ IN u4Byte dacSwingLvl
+ )
+{
+ halbtc8192e2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift);
+ //halbtc8192e2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff);
+ halbtc8192e2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl);
+}
+
+VOID
+halbtc8192e2ant_SetAntPath(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte antPosType,
+ IN BOOLEAN bInitHwCfg,
+ IN BOOLEAN bWifiOff
+ )
+{
+ u4Byte u4Tmp=0;
+
+ if(bInitHwCfg)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x944, 0x24);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x930, 0x700700);
+ if(pBtCoexist->chipInterface == BTC_INTF_USB)
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30430004);
+ else
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30030004);
+
+ // 0x4c[27][24]='00', Set Antenna to BB
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u4Tmp &= ~BIT24;
+ u4Tmp &= ~BIT27;
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
+ }
+ else if(bWifiOff)
+ {
+ if(pBtCoexist->chipInterface == BTC_INTF_USB)
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30430004);
+ else
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x64, 0x30030004);
+
+ // 0x4c[27][24]='11', Set Antenna to BT, 0x64[8:7]=0, 0x64[2]=1
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u4Tmp |= BIT24;
+ u4Tmp |= BIT27;
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
+ }
+
+ // ext switch setting
+ switch(antPosType)
+ {
+ case BTC_ANT_PATH_WIFI:
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x4);
+ break;
+ case BTC_ANT_PATH_BT:
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x20);
+ break;
+ default:
+ case BTC_ANT_PATH_PTA:
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x92c, 0x4);
+ break;
+ }
+}
+
+VOID
+halbtc8192e2ant_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:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+ case 2:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
+ break;
+ case 3:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90);
+ break;
+ case 4:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x3, 0xf1, 0x90);
+ break;
+ case 5:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
+ break;
+ case 6:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
+ break;
+ case 7:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90);
+ break;
+ case 8:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90);
+ break;
+ case 9:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x10);
+ break;
+ case 10:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x10);
+ break;
+ case 11:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x10);
+ break;
+ case 12:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x3, 0xf1, 0x10);
+ break;
+ case 13:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe0, 0x10);
+ break;
+ case 14:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe0, 0x10);
+ break;
+ case 15:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf0, 0x10);
+ break;
+ case 16:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x3, 0xf0, 0x10);
+ break;
+ case 17:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x61, 0x20, 0x03, 0x10, 0x10);
+ break;
+ case 18:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
+ break;
+ case 19:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90);
+ break;
+ case 20:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);
+ break;
+ case 21:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);
+ break;
+ case 71:
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(type)
+ {
+ default:
+ case 0: //ANT2PTA, 0x778=1
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
+ halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE);
+ break;
+ case 1: //ANT2BT, 0x778=3
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
+ delay_ms(5);
+ halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
+ break;
+
+ }
+ }
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+VOID
+halbtc8192e2ant_SetSwitchSsType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte ssType
+ )
+{
+ u1Byte mimoPs=BTC_MIMO_PS_DYNAMIC;
+ u4Byte disRaMask=0x0;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], REAL set SS Type = %d\n", ssType));
+
+ disRaMask = halbtc8192e2ant_DecideRaMask(pBtCoexist, ssType, pCoexDm->curRaMaskType);
+ halbtc8192e2ant_UpdateRaMask(pBtCoexist, FORCE_EXEC, disRaMask);
+
+ if(ssType == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
+ // switch ofdm path
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x11);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x1);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81111111);
+ // switch cck patch
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x1);
+ //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x81);
+ mimoPs=BTC_MIMO_PS_STATIC;
+ }
+ else if(ssType == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x33);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x3);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81121313);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x0);
+ //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x41);
+ mimoPs=BTC_MIMO_PS_DYNAMIC;
+ }
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_SEND_MIMO_PS, &mimoPs); // set rx 1ss or 2ss
+}
+
+VOID
+halbtc8192e2ant_SwitchSsType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte newSsType
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], %s Switch SS Type = %d\n",
+ (bForceExec? "force to":""), newSsType));
+ pCoexDm->curSsType = newSsType;
+
+ if(!bForceExec)
+ {
+ if(pCoexDm->preSsType == pCoexDm->curSsType)
+ return;
+ }
+ halbtc8192e2ant_SetSwitchSsType(pBtCoexist, pCoexDm->curSsType);
+
+ pCoexDm->preSsType = pCoexDm->curSsType;
+}
+
+VOID
+halbtc8192e2ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // fw all off
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ // sw all off
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ // hw all off
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+VOID
+halbtc8192e2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, 0);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, FORCE_EXEC, 2);
+
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+}
+
+VOID
+halbtc8192e2ant_ActionBtInquiry(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bLowPwrDisable=TRUE;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+}
+
+BOOLEAN
+halbtc8192e2ant_IsCommonAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
+ BOOLEAN bBtHsOn=FALSE, bLowPwrDisable=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if(pBtLinkInfo->bScoExist || pBtLinkInfo->bHidExist)
+ {
+ halbtc8192e2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 0, 0, 0);
+ }
+ else
+ {
+ halbtc8192e2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+ }
+
+ if(!bWifiConnected)
+ {
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-connected idle!!\n"));
+
+ if( (BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) ||
+ (BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ if(BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else if(BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ bLowPwrDisable = TRUE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ if(bBtHsOn)
+ return FALSE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ 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 Connected-Busy + BT Busy!!\n"));
+ bCommon = FALSE;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21);
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ bCommon = TRUE;
+ }
+ }
+ }
+
+ return bCommon;
+}
+VOID
+halbtc8192e2ant_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->bAutoTdmaAdjust)
+ {
+ pCoexDm->bAutoTdmaAdjust = TRUE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
+ {
+ if(bScoHid)
+ {
+ if(bTxPause)
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ }
+ else
+ {
+ if(bTxPause)
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else
+ {
+ halbtc8192e2ant_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)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_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)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
+ pCoexDm->psTdmaDuAdjType = 71;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 71)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
+ pCoexDm->psTdmaDuAdjType = 71;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_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)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_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)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_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)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_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)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8192e2ant_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)
+ {
+ halbtc8192e2ant_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"));
+ }
+ }
+}
+
+// SCO only or SCO+PAN(HS)
+VOID
+halbtc8192e2ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_STAY_LOW;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
+
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
+ }
+ }
+}
+
+VOID
+halbtc8192e2ant_ActionScoPan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_STAY_LOW;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
+
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
+ }
+ }
+}
+
+VOID
+halbtc8192e2ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8192e2ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+ BOOLEAN bLongDist=FALSE;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW||btRssiState == BTC_RSSI_STATE_STAY_LOW) &&
+ (wifiRssiState == BTC_RSSI_STATE_LOW||wifiRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2dp, wifi/bt rssi both LOW!!\n"));
+ bLongDist = TRUE;
+ }
+ if(bLongDist)
+ {
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x4);
+ }
+ else
+ {
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ }
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(bLongDist)
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ else
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+
+
+ if(bLongDist)
+ {
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 17);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else
+ {
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ }
+ }
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8192e2ant_ActionA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ }
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
+ }
+ }
+}
+
+VOID
+halbtc8192e2ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ }
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//PAN(HS) only
+VOID
+halbtc8192e2ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ }
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8192e2ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8192e2ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8192e2ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8192e2ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);
+
+ halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+
+ if( (btRssiState == BTC_RSSI_STATE_LOW) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_LOW) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8192e2ant_RunCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiUnder5G=FALSE;
+ u1Byte btInfoOriginal=0, btRetryCnt=0;
+ u1Byte algorithm=0;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
+ return;
+ }
+
+ if(pCoexSta->bUnderIps)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
+ return;
+ }
+
+ algorithm = halbtc8192e2ant_ActionAlgorithm(pBtCoexist);
+ if(pCoexSta->bC2hBtInquiryPage && (BT_8192E_2ANT_COEX_ALGO_PANHS!=algorithm))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));
+ halbtc8192e2ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+
+ pCoexDm->curAlgorithm = algorithm;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
+
+ if(halbtc8192e2ant_IsCommonAction(pBtCoexist))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n"));
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ else
+ {
+ if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n",
+ pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8192E_2ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
+ halbtc8192e2ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_SCO_PAN:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO+PAN(EDR).\n"));
+ halbtc8192e2ant_ActionScoPan(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
+ halbtc8192e2ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
+ halbtc8192e2ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));
+ halbtc8192e2ant_ActionA2dpPanHs(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
+ halbtc8192e2ant_ActionPanEdr(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
+ halbtc8192e2ant_ActionPanHs(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
+ halbtc8192e2ant_ActionPanEdrA2dp(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_PANEDR_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
+ halbtc8192e2ant_ActionPanEdrHid(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
+ halbtc8192e2ant_ActionHidA2dpPanEdr(pBtCoexist);
+ break;
+ case BT_8192E_2ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
+ halbtc8192e2ant_ActionHidA2dp(pBtCoexist);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = unknown!!\n"));
+ //halbtc8192e2ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+}
+
+VOID
+halbtc8192e2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bBackUp
+ )
+{
+ u4Byte u4Tmp=0;
+ u2Byte u2Tmp=0;
+ u1Byte u1Tmp=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
+
+ 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);
+ }
+
+ // antenna sw ctrl to bt
+ halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE);
+
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+
+ // antenna switch control parameter
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x858, 0x55555555);
+
+ // coex parameters
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
+ // 0x790[5:0]=0x5
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
+ u1Tmp &= 0xc0;
+ u1Tmp |= 0x5;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
+
+ // enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+
+ // enable PTA
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
+ // enable mailbox interface
+ u2Tmp = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x40);
+ u2Tmp |= BIT9;
+ pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x40, u2Tmp);
+
+ // enable PTA I2C mailbox
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x101);
+ u1Tmp |= BIT4;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x101, u1Tmp);
+
+ // enable bt clock when wifi is disabled.
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x93);
+ u1Tmp |= BIT0;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x93, u1Tmp);
+ // enable bt clock when suspend.
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x7);
+ u1Tmp |= BIT0;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x7, u1Tmp);
+}
+
+//============================================================
+// work around function start with wa_halbtc8192e2ant_
+//============================================================
+//============================================================
+// extern function start with EXhalbtc8192e2ant_
+//============================================================
+VOID
+EXhalbtc8192e2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8192e2ant_InitHwConfig(pBtCoexist, TRUE);
+}
+
+VOID
+EXhalbtc8192e2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ halbtc8192e2ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8192e2ant_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;
+ u2Byte u2Tmp[4];
+ 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, faOfdm, faCck;
+ u1Byte wifiDot11Chnl, wifiHsChnl;
+ u4Byte fwVer=0, btPatchVer=0;
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============");
+ CL_PRINTF(cliBuf);
+
+ if(pBtCoexist->bManualControl)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ 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);
+
+ 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", \
+ GLCoexVerDate8192e2Ant, GLCoexVer8192e2Ant, 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]", \
+ ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
+ ( (BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
+ pCoexSta->btRssi, pCoexSta->btRetryCnt);
+ CL_PRINTF(cliBuf);
+
+ 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; i<BT_INFO_SRC_8192E_2ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8192e2Ant[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);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "SS Type", \
+ pCoexDm->curSsType);
+ CL_PRINTF(cliBuf);
+
+ // 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);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
+ pBtCoexist->btInfo.raMask);
+ CL_PRINTF(cliBuf);
+
+ // Fw mechanism
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
+ CL_PRINTF(cliBuf);
+
+ psTdmaCase = pCoexDm->curPsTdma;
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
+ pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
+ pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
+ pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust);
+ CL_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \
+ pCoexDm->curBtDecPwrLvl, 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);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "backup ARFR1/ARFR2/RL/AMaxTime", \
+ pCoexDm->backupArfrCnt1, pCoexDm->backupArfrCnt2, pCoexDm->backupRetryLimit, pCoexDm->backupAmpduMaxTime);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
+ u2Tmp[0] = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "0x430/0x434/0x42a/0x456", \
+ u4Tmp[0], u4Tmp[1], u2Tmp[0], u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc04);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xd04);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x90c);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0xc04/ 0xd04/ 0x90c", \
+ u4Tmp[0], u4Tmp[1], u4Tmp[2]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x778", \
+ u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x92c);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x92c/ 0x930", \
+ (u1Tmp[0]), u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4f);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x40/ 0x4f", \
+ u1Tmp[0], u1Tmp[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);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ 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_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(hp rx[31:16]/tx[15:0])", \
+ pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
+ pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx);
+ CL_PRINTF(cliBuf);
+#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 1)
+ halbtc8192e2ant_MonitorBtCtr(pBtCoexist);
+#endif
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8192e2ant_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;
+ halbtc8192e2ant_CoexAllOff(pBtCoexist);
+ halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ pCoexSta->bUnderIps = FALSE;
+ }
+}
+
+VOID
+EXhalbtc8192e2ant_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
+EXhalbtc8192e2ant_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
+EXhalbtc8192e2ant_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
+EXhalbtc8192e2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+ u4Byte wifiBw;
+ u1Byte wifiCentralChnl;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ 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;
+ }
+
+ 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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
+}
+
+VOID
+EXhalbtc8192e2ant_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
+EXhalbtc8192e2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ u1Byte btInfo=0;
+ u1Byte i, rspSource=0;
+ BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+
+ pCoexSta->bC2hBtInfoReqSent = FALSE;
+
+ rspSource = tmpBuf[0]&0xf;
+ if(rspSource >= BT_INFO_SRC_8192E_2ANT_MAX)
+ rspSource = BT_INFO_SRC_8192E_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; i<length; i++)
+ {
+ 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]));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
+ }
+ }
+
+ if(BT_INFO_SRC_8192E_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];
+
+ // Here we need to resend some wifi info to BT
+ // because bt is reset and loss of the info.
+ if( (pCoexSta->btInfoExt & BIT1) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ EXhalbtc8192e2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ EXhalbtc8192e2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+ }
+
+ if( (pCoexSta->btInfoExt & BIT3) )
+ {
+ if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
+ halbtc8192e2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+ }
+ }
+ else
+ {
+ // BT already NOT ignore Wlan active, do nothing here.
+ }
+
+#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
+ if( (pCoexSta->btInfoExt & BIT4) )
+ {
+ // BT auto report already enabled, do nothing
+ }
+ else
+ {
+ halbtc8192e2ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
+ }
+#endif
+ }
+
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8192E_2ANT_B_INQ_PAGE)
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ else
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+
+ // set link exist status
+ if(!(btInfo&BT_INFO_8192E_2ANT_B_CONNECTION))
+ {
+ pCoexSta->bBtLinkExist = FALSE;
+ pCoexSta->bPanExist = FALSE;
+ pCoexSta->bA2dpExist = FALSE;
+ pCoexSta->bHidExist = FALSE;
+ pCoexSta->bScoExist = FALSE;
+ }
+ else // connection exists
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ if(btInfo & BT_INFO_8192E_2ANT_B_FTP)
+ pCoexSta->bPanExist = TRUE;
+ else
+ pCoexSta->bPanExist = FALSE;
+ if(btInfo & BT_INFO_8192E_2ANT_B_A2DP)
+ pCoexSta->bA2dpExist = TRUE;
+ else
+ pCoexSta->bA2dpExist = FALSE;
+ if(btInfo & BT_INFO_8192E_2ANT_B_HID)
+ pCoexSta->bHidExist = TRUE;
+ else
+ pCoexSta->bHidExist = FALSE;
+ if(btInfo & BT_INFO_8192E_2ANT_B_SCO_ESCO)
+ pCoexSta->bScoExist = TRUE;
+ else
+ pCoexSta->bScoExist = FALSE;
+ }
+
+ halbtc8192e2ant_UpdateBtLinkInfo(pBtCoexist);
+
+ if(!(btInfo&BT_INFO_8192E_2ANT_B_CONNECTION))
+ {
+ pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
+ }
+ else if(btInfo == BT_INFO_8192E_2ANT_B_CONNECTION) // connection exists but no busy
+ {
+ pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
+ }
+ else if((btInfo&BT_INFO_8192E_2ANT_B_SCO_ESCO) ||
+ (btInfo&BT_INFO_8192E_2ANT_B_SCO_BUSY))
+ {
+ pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_SCO_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
+ }
+ else if(btInfo&BT_INFO_8192E_2ANT_B_ACL_BUSY)
+ {
+ pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_ACL_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
+ }
+ else
+ {
+ pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_MAX;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
+ }
+
+ if( (BT_8192E_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8192E_2ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ bBtBusy = TRUE;
+ bLimitedDig = TRUE;
+ }
+ else
+ {
+ bBtBusy = FALSE;
+ bLimitedDig = FALSE;
+ }
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+
+ pCoexDm->bLimitedDig = bLimitedDig;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
+
+ halbtc8192e2ant_RunCoexistMechanism(pBtCoexist);
+}
+
+VOID
+EXhalbtc8192e2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+ halbtc8192e2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ EXhalbtc8192e2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8192e2ant_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", \
+ GLCoexVerDate8192e2Ant, GLCoexVer8192e2Ant, fwVer, btPatchVer, btPatchVer));
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
+ }
+
+#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
+ halbtc8192e2ant_QueryBtInfo(pBtCoexist);
+ halbtc8192e2ant_MonitorBtCtr(pBtCoexist);
+ halbtc8192e2ant_MonitorBtEnableDisable(pBtCoexist);
+#else
+ if( halbtc8192e2ant_IsWifiStatusChanged(pBtCoexist) ||
+ pCoexDm->bAutoTdmaAdjust)
+ {
+ halbtc8192e2ant_RunCoexistMechanism(pBtCoexist);
+ }
+#endif
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h
index dc94c73..e986006 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h
@@ -1,201 +1,201 @@
-//===========================================
-// The following is for 8192E 2Ant BT Co-exist definition
-//===========================================
-#define BT_AUTO_REPORT_ONLY_8192E_2ANT 0
-
-#define BT_INFO_8192E_2ANT_B_FTP BIT7
-#define BT_INFO_8192E_2ANT_B_A2DP BIT6
-#define BT_INFO_8192E_2ANT_B_HID BIT5
-#define BT_INFO_8192E_2ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8192E_2ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8192E_2ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8192E_2ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8192E_2ANT_B_CONNECTION BIT0
-
-#define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT 2
-
-typedef enum _BT_INFO_SRC_8192E_2ANT{
- BT_INFO_SRC_8192E_2ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8192E_2ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8192E_2ANT_MAX
-}BT_INFO_SRC_8192E_2ANT,*PBT_INFO_SRC_8192E_2ANT;
-
-typedef enum _BT_8192E_2ANT_BT_STATUS{
- BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8192E_2ANT_BT_STATUS_INQ_PAGE = 0x2,
- BT_8192E_2ANT_BT_STATUS_ACL_BUSY = 0x3,
- BT_8192E_2ANT_BT_STATUS_SCO_BUSY = 0x4,
- BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
- BT_8192E_2ANT_BT_STATUS_MAX
-}BT_8192E_2ANT_BT_STATUS,*PBT_8192E_2ANT_BT_STATUS;
-
-typedef enum _BT_8192E_2ANT_COEX_ALGO{
- BT_8192E_2ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8192E_2ANT_COEX_ALGO_SCO = 0x1,
- BT_8192E_2ANT_COEX_ALGO_SCO_PAN = 0x2,
- BT_8192E_2ANT_COEX_ALGO_HID = 0x3,
- BT_8192E_2ANT_COEX_ALGO_A2DP = 0x4,
- BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
- BT_8192E_2ANT_COEX_ALGO_PANEDR = 0x6,
- BT_8192E_2ANT_COEX_ALGO_PANHS = 0x7,
- BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
- BT_8192E_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
- BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
- BT_8192E_2ANT_COEX_ALGO_HID_A2DP = 0xb,
- BT_8192E_2ANT_COEX_ALGO_MAX = 0xc
-}BT_8192E_2ANT_COEX_ALGO,*PBT_8192E_2ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8192E_2ANT{
- // fw mechanism
- u1Byte preBtDecPwrLvl;
- u1Byte curBtDecPwrLvl;
- u1Byte preFwDacSwingLvl;
- u1Byte curFwDacSwingLvl;
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- u1Byte psTdmaDuAdjType;
- BOOLEAN bResetTdmaAdjust;
- BOOLEAN bAutoTdmaAdjust;
- 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 backupArfrCnt1; // Auto Rate Fallback Retry cnt
- u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt
- u2Byte backupRetryLimit;
- u1Byte backupAmpduMaxTime;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-
- u1Byte preSsType;
- u1Byte curSsType;
-
- u4Byte preRaMask;
- u4Byte curRaMask;
- u1Byte curRaMaskType;
- u1Byte preArfrType;
- u1Byte curArfrType;
- u1Byte preRetryLimitType;
- u1Byte curRetryLimitType;
- u1Byte preAmpduTimeType;
- u1Byte curAmpduTimeType;
-} COEX_DM_8192E_2ANT, *PCOEX_DM_8192E_2ANT;
-
-typedef struct _COEX_STA_8192E_2ANT{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bA2dpExist;
- 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_8192E_2ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8192E_2ANT_MAX];
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
-}COEX_STA_8192E_2ANT, *PCOEX_STA_8192E_2ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8192e2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e2ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e2ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e2ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e2ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e2ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8192e2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8192e2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8192e2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-
+//===========================================
+// The following is for 8192E 2Ant BT Co-exist definition
+//===========================================
+#define BT_AUTO_REPORT_ONLY_8192E_2ANT 0
+
+#define BT_INFO_8192E_2ANT_B_FTP BIT7
+#define BT_INFO_8192E_2ANT_B_A2DP BIT6
+#define BT_INFO_8192E_2ANT_B_HID BIT5
+#define BT_INFO_8192E_2ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8192E_2ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8192E_2ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8192E_2ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8192E_2ANT_B_CONNECTION BIT0
+
+#define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT 2
+
+typedef enum _BT_INFO_SRC_8192E_2ANT{
+ BT_INFO_SRC_8192E_2ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8192E_2ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8192E_2ANT_MAX
+}BT_INFO_SRC_8192E_2ANT,*PBT_INFO_SRC_8192E_2ANT;
+
+typedef enum _BT_8192E_2ANT_BT_STATUS{
+ BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8192E_2ANT_BT_STATUS_INQ_PAGE = 0x2,
+ BT_8192E_2ANT_BT_STATUS_ACL_BUSY = 0x3,
+ BT_8192E_2ANT_BT_STATUS_SCO_BUSY = 0x4,
+ BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
+ BT_8192E_2ANT_BT_STATUS_MAX
+}BT_8192E_2ANT_BT_STATUS,*PBT_8192E_2ANT_BT_STATUS;
+
+typedef enum _BT_8192E_2ANT_COEX_ALGO{
+ BT_8192E_2ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8192E_2ANT_COEX_ALGO_SCO = 0x1,
+ BT_8192E_2ANT_COEX_ALGO_SCO_PAN = 0x2,
+ BT_8192E_2ANT_COEX_ALGO_HID = 0x3,
+ BT_8192E_2ANT_COEX_ALGO_A2DP = 0x4,
+ BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
+ BT_8192E_2ANT_COEX_ALGO_PANEDR = 0x6,
+ BT_8192E_2ANT_COEX_ALGO_PANHS = 0x7,
+ BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
+ BT_8192E_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
+ BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
+ BT_8192E_2ANT_COEX_ALGO_HID_A2DP = 0xb,
+ BT_8192E_2ANT_COEX_ALGO_MAX = 0xc
+}BT_8192E_2ANT_COEX_ALGO,*PBT_8192E_2ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8192E_2ANT{
+ // fw mechanism
+ u1Byte preBtDecPwrLvl;
+ u1Byte curBtDecPwrLvl;
+ u1Byte preFwDacSwingLvl;
+ u1Byte curFwDacSwingLvl;
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ u1Byte psTdmaDuAdjType;
+ BOOLEAN bResetTdmaAdjust;
+ BOOLEAN bAutoTdmaAdjust;
+ 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 backupArfrCnt1; // Auto Rate Fallback Retry cnt
+ u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt
+ u2Byte backupRetryLimit;
+ u1Byte backupAmpduMaxTime;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+
+ u1Byte preSsType;
+ u1Byte curSsType;
+
+ u4Byte preRaMask;
+ u4Byte curRaMask;
+ u1Byte curRaMaskType;
+ u1Byte preArfrType;
+ u1Byte curArfrType;
+ u1Byte preRetryLimitType;
+ u1Byte curRetryLimitType;
+ u1Byte preAmpduTimeType;
+ u1Byte curAmpduTimeType;
+} COEX_DM_8192E_2ANT, *PCOEX_DM_8192E_2ANT;
+
+typedef struct _COEX_STA_8192E_2ANT{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bA2dpExist;
+ 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_8192E_2ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8192E_2ANT_MAX];
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+}COEX_STA_8192E_2ANT, *PCOEX_STA_8192E_2ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8192e2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e2ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e2ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e2ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e2ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e2ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8192e2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8192e2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8192e2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c
index d2476cd..1e80e8d 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c
@@ -1,1598 +1,1598 @@
-//============================================================
-// Description:
-//
-// This file is for RTL8723A Co-exist mechanism
-//
-// History
-// 2012/08/22 Cosa first check in.
-// 2012/11/14 Cosa Revise for 8723A 1Ant out sourcing.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8723A_1ANT GLCoexDm8723a1Ant;
-static PCOEX_DM_8723A_1ANT pCoexDm=&GLCoexDm8723a1Ant;
-static COEX_STA_8723A_1ANT GLCoexSta8723a1Ant;
-static PCOEX_STA_8723A_1ANT pCoexSta=&GLCoexSta8723a1Ant;
-
-const char *const GLBtInfoSrc8723a1Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8723a1ant_
-//============================================================
-VOID
-halbtc8723a1ant_Reg0x550Bit3(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSet
- )
-{
- u1Byte u1tmp=0;
-
- u1tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x550);
- if(bSet)
- {
- u1tmp |= BIT3;
- }
- else
- {
- u1tmp &= ~BIT3;
- }
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x550, u1tmp);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], set 0x550[3]=%d\n", (bSet? 1:0)));
-}
-
-VOID
-halbtc8723a1ant_NotifyFwScan(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte scanType
- )
-{
- u1Byte H2C_Parameter[1] ={0};
-
- if(BTC_SCAN_START == scanType)
- H2C_Parameter[0] = 0x1;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Notify FW for wifi scan, write 0x3b=0x%x\n",
- H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x3b, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723a1ant_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 0x38=0x%x\n",
- H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x38, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723a1ant_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, 0xf0ff7);
- }
- 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
-halbtc8723a1ant_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;
- }
- halbtc8723a1ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
-
- pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
-}
-
-VOID
-halbtc8723a1ant_SetSwPenaltyTxRateAdaptive(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- u1Byte tmpU1;
-
- tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
- tmpU1 |= BIT0;
- if(bLowPenaltyRa)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
- tmpU1 &= ~BIT2;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
- tmpU1 |= BIT2;
- }
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
-}
-
-VOID
-halbtc8723a1ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- return;
- 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;
- }
- halbtc8723a1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8723a1ant_SetCoexTable(
- IN PBTC_COEXIST pBtCoexist,
- IN u4Byte val0x6c0,
- 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 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
-halbtc8723a1ant_CoexTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u4Byte val0x6c0,
- IN u4Byte val0x6c8,
- IN u1Byte val0x6cc
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
- (bForceExec? "force to":""), val0x6c0, val0x6c8, val0x6cc));
- pCoexDm->curVal0x6c0 = val0x6c0;
- pCoexDm->curVal0x6c8 = val0x6c8;
- pCoexDm->curVal0x6cc = val0x6cc;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c0=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n",
- pCoexDm->preVal0x6c0, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c0=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n",
- pCoexDm->curVal0x6c0, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));
-
- if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&
- (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
- (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
- return;
- }
- halbtc8723a1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8723a1ant_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 0x25=0x%x\n",
- H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x25, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723a1ant_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;
- }
- halbtc8723a1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8723a1ant_SetFwPstdma(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type,
- 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);
-
- // byte1[1:0] != 0 means enable pstdma
- // for 2Ant bt coexist, if byte1 != 0 means enable pstdma
- if(byte1)
- {
- if(bApEnable)
- {
- if(type != 5 && type != 12)
- {
- 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], FW write 0x3a(5bytes)=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, 0x3a, 5, H2C_Parameter);
-}
-
-VOID
-halbtc8723a1ant_PsTdma(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bTurnOn,
- IN u1Byte type
- )
-{
- 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(pCoexDm->bCurPsTdmaOn)
- {
- switch(pCoexDm->curPsTdma)
- {
- case 1:
- default:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x1a, 0x1a, 0x0, 0x40);
- break;
- case 2:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x12, 0x12, 0x0, 0x40);
- break;
- case 3:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x3f, 0x3, 0x10, 0x40);
- break;
- case 4:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x15, 0x3, 0x10, 0x0);
- break;
- case 5:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0xa9, 0x15, 0x3, 0x35, 0xc0);
- break;
-
- case 8:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x25, 0x3, 0x10, 0x0);
- break;
- case 9:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0xa, 0xa, 0x0, 0x40);
- break;
- case 10:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0xa, 0xa, 0x0, 0x40);
- break;
- case 11:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x5, 0x5, 0x0, 0x40);
- break;
- case 12:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0xa9, 0xa, 0x3, 0x15, 0xc0);
- break;
-
- case 18:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x25, 0x3, 0x10, 0x0);
- break;
-
- case 20:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x2a, 0x2a, 0x0, 0x0);
- break;
- case 21:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x20, 0x3, 0x10, 0x40);
- break;
- case 22:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x1a, 0x1a, 0x2, 0x40);
- break;
- case 23:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x12, 0x12, 0x2, 0x40);
- break;
- case 24:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0xa, 0xa, 0x2, 0x40);
- break;
- case 25:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x5, 0x5, 0x2, 0x40);
- break;
- case 26:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x25, 0x3, 0x10, 0x0);
- break;
- case 27:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x5, 0x5, 0x2, 0x40);
- break;
- case 28:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x3, 0x2f, 0x2f, 0x0, 0x0);
- break;
-
- }
- }
- else
- {
- // disable PS tdma
- switch(pCoexDm->curPsTdma)
- {
- case 8:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x8, 0x0, 0x0, 0x0, 0x0);
- break;
- case 0:
- default:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x0, 0x0, 0x0, 0x0, 0x0);
- pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x860, 0x210);
- break;
- case 9:
- halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x0, 0x0, 0x0, 0x0, 0x0);
- pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x860, 0x110);
- break;
-
- }
- }
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-
-VOID
-halbtc8723a1ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // fw all off
- halbtc8723a1ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- // sw all off
- halbtc8723a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a1ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
-
- // hw all off
- halbtc8723a1ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-}
-
-VOID
-halbtc8723a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
- halbtc8723a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
-}
-
-VOID
-halbtc8723a1ant_BtEnableAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
-}
-
-VOID
-halbtc8723a1ant_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, 0xc);
-}
-
-VOID
-halbtc8723a1ant_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)
- {
- halbtc8723a1ant_BtEnableAction(pBtCoexist);
- }
- else
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- }
- }
-}
-
-VOID
-halbtc8723a1ant_TdmaDurationAdjust(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- static s4Byte up,dn,m,n,WaitCount;
- s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
- u1Byte retryCount=0;
- u1Byte btState;
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
- u4Byte wifiBw;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- btState = pCoexDm->btStatus;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], TdmaDurationAdjust()\n"));
- if(pCoexDm->psTdmaGlobalCnt != pCoexDm->psTdmaMonitorCnt)
- {
- pCoexDm->psTdmaMonitorCnt = 0;
- pCoexDm->psTdmaGlobalCnt = 0;
- }
- if(pCoexDm->psTdmaMonitorCnt == 0)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], first run BT A2DP + WiFi busy state!!\n"));
- if(btState == BT_STATE_8723A_1ANT_ACL_ONLY_BUSY)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22);
- pCoexDm->psTdmaDuAdjType = 22;
- }
- //============
- 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, ("[BTCoex], retryCount = %d\n", retryCount));
- 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, ("[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, ("[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, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n"));
- }
-
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT TxRx counter H+L <= 1200\n"));
- if(btState != BT_STATE_8723A_1ANT_ACL_ONLY_BUSY)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], NOT ACL only busy!\n"));
- if(BTC_WIFI_BW_HT40 != wifiBw)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], 20MHz\n"));
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 22)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23);
- pCoexDm->psTdmaDuAdjType = 23;
- }
- else if(pCoexDm->curPsTdma == 23)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
- pCoexDm->psTdmaDuAdjType = 24;
- }
- else if(pCoexDm->curPsTdma == 24)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 25);
- pCoexDm->psTdmaDuAdjType = 25;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 25)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
- pCoexDm->psTdmaDuAdjType = 24;
- }
- else if(pCoexDm->curPsTdma == 24)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23);
- pCoexDm->psTdmaDuAdjType = 23;
- }
- else if(pCoexDm->curPsTdma == 23)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22);
- pCoexDm->psTdmaDuAdjType = 22;
- }
- }
- // error handle, if not in the following state,
- // set psTdma again.
- if( (pCoexDm->psTdmaDuAdjType != 22) &&
- (pCoexDm->psTdmaDuAdjType != 23) &&
- (pCoexDm->psTdmaDuAdjType != 24) &&
- (pCoexDm->psTdmaDuAdjType != 25) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], duration case out of handle!!\n"));
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23);
- pCoexDm->psTdmaDuAdjType = 23;
- }
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], 40MHz\n"));
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 23)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
- pCoexDm->psTdmaDuAdjType = 24;
- }
- else if(pCoexDm->curPsTdma == 24)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 25);
- pCoexDm->psTdmaDuAdjType = 25;
- }
- else if(pCoexDm->curPsTdma == 25)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 27);
- pCoexDm->psTdmaDuAdjType = 27;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 27)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 25);
- pCoexDm->psTdmaDuAdjType = 25;
- }
- else if(pCoexDm->curPsTdma == 25)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
- pCoexDm->psTdmaDuAdjType = 24;
- }
- else if(pCoexDm->curPsTdma == 24)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23);
- pCoexDm->psTdmaDuAdjType = 23;
- }
- }
- // error handle, if not in the following state,
- // set psTdma again.
- if( (pCoexDm->psTdmaDuAdjType != 23) &&
- (pCoexDm->psTdmaDuAdjType != 24) &&
- (pCoexDm->psTdmaDuAdjType != 25) &&
- (pCoexDm->psTdmaDuAdjType != 27) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], duration case out of handle!!\n"));
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
- pCoexDm->psTdmaDuAdjType = 24;
- }
- }
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ACL only busy\n"));
- if (result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- }
-
- // error handle, if not in the following state,
- // set psTdma again.
- if( (pCoexDm->psTdmaDuAdjType != 1) &&
- (pCoexDm->psTdmaDuAdjType != 2) &&
- (pCoexDm->psTdmaDuAdjType != 9) &&
- (pCoexDm->psTdmaDuAdjType != 11) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], duration case out of handle!!\n"));
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- }
- }
- }
-
- // 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)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[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)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], roaming/link/scan is under progress, will adjust next time!!!\n"));
- }
- }
- pCoexDm->psTdmaMonitorCnt++;
-}
-
-
-VOID
-halbtc8723a1ant_CoexForWifiConnect(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiConnected=FALSE, bWifiBusy=FALSE;
- u1Byte btState, btInfoOriginal=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- btState = pCoexDm->btStatus;
- btInfoOriginal = pCoexSta->btInfoC2h[BT_INFO_SRC_8723A_1ANT_BT_RSP][0];
-
- if(bWifiConnected)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi connected!!\n"));
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if( !bWifiBusy &&
- ((BT_STATE_8723A_1ANT_NO_CONNECTION == btState) ||
- (BT_STATE_8723A_1ANT_CONNECT_IDLE == btState)) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], [Wifi is idle] or [Bt is non connected idle or Bt is connected idle]!!\n"));
-
- if(BT_STATE_8723A_1ANT_NO_CONNECTION == btState)
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- else if(BT_STATE_8723A_1ANT_CONNECT_IDLE == btState)
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0);
- }
- else
- {
- if( (BT_STATE_8723A_1ANT_SCO_ONLY_BUSY == btState) ||
- (BT_STATE_8723A_1ANT_ACL_SCO_BUSY == btState) ||
- (BT_STATE_8723A_1ANT_HID_BUSY == btState) ||
- (BT_STATE_8723A_1ANT_HID_SCO_BUSY == btState) )
- {
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0x60);
- }
- else
- {
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0);
- }
- switch(btState)
- {
- case BT_STATE_8723A_1ANT_NO_CONNECTION:
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- break;
- case BT_STATE_8723A_1ANT_CONNECT_IDLE:
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- break;
- case BT_STATE_8723A_1ANT_INQ_OR_PAG:
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- break;
- case BT_STATE_8723A_1ANT_SCO_ONLY_BUSY:
- case BT_STATE_8723A_1ANT_ACL_SCO_BUSY:
- case BT_STATE_8723A_1ANT_HID_BUSY:
- case BT_STATE_8723A_1ANT_HID_SCO_BUSY:
- halbtc8723a1ant_TdmaDurationAdjust(pBtCoexist);
- break;
- case BT_STATE_8723A_1ANT_ACL_ONLY_BUSY:
- if (btInfoOriginal&BT_INFO_8723A_1ANT_B_A2DP)
- {
- halbtc8723a1ant_TdmaDurationAdjust(pBtCoexist);
- }
- else if(btInfoOriginal&BT_INFO_8723A_1ANT_B_FTP)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- }
- else if( (btInfoOriginal&BT_INFO_8723A_1ANT_B_A2DP) &&
- (btInfoOriginal&BT_INFO_8723A_1ANT_B_FTP) )
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- }
- else
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- }
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], error!!!, undefined case in halbtc8723a1ant_CoexForWifiConnect()!!\n"));
- break;
- }
- }
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is disconnected!!\n"));
- }
-
- pCoexDm->psTdmaGlobalCnt++;
-}
-
-//============================================================
-// work around function start with wa_halbtc8723a1ant_
-//============================================================
-VOID
-wa_halbtc8723a1ant_MonitorC2h(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte tmp1b=0x0;
- u4Byte curC2hTotalCnt=0x0;
- static u4Byte preC2hTotalCnt=0x0, sameCntPollingTime=0x0;
-
- curC2hTotalCnt+=pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8723A_1ANT_BT_RSP];
-
- if(curC2hTotalCnt == preC2hTotalCnt)
- {
- sameCntPollingTime++;
- }
- else
- {
- preC2hTotalCnt = curC2hTotalCnt;
- sameCntPollingTime = 0;
- }
-
- if(sameCntPollingTime >= 2)
- {
- tmp1b = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x1af);
- if(tmp1b != 0x0)
- {
- pCoexSta->c2hHangDetectCnt++;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x1af, 0x0);
- }
- }
-}
-
-//============================================================
-// extern function start with EXhalbtc8723a1ant_
-//============================================================
-VOID
-EXhalbtc8723a1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
-
- // backup rf 0x1e value
- pCoexDm->btRf0x1eBackup =
- pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
-
- // enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
-
- // coex table
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, 0x0); // 1-Ant coex
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, 0xffff); // wifi break table
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, 0x55555555); //coex table
-
- // antenna switch control parameter
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x858, 0xaaaaaaaa);
-
- pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x860, 0x210); //set antenna at wifi side if ANTSW is software control
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x870, 0x300); //SPDT(connected with TRSW) control by hardware PTA
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x874, 0x22804000); //ANTSW keep by GNT_BT
-
- // coexistence parameters
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1); // enable RTK mode PTA
-}
-
-VOID
-EXhalbtc8723a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- halbtc8723a1ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8723a1ant_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;
-
- 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);
-
- 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_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 / HsChnl(HsMode)", \
- wifiDot11Chnl, wifiHsChnl, bBtHsOn);
- 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_8723A_1ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8723A_1ANT_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; i<BT_INFO_SRC_8723A_1ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723a1Ant[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 = %d", "write 0x1af=0x0 num", \
- pCoexSta->c2hHangDetectCnt);
- CL_PRINTF(cliBuf);
-
- // 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);
-
- // 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 ", "IgnWlanAct", \
- 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, 0x783);
- u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x796);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \
- u1Tmp[0], u1Tmp[1], u1Tmp[2]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
- u1Tmp[0]);
- 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, 0x484);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
- u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xdac);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \
- u4Tmp[0], u4Tmp[1], u4Tmp[2], u4Tmp[3]);
- CL_PRINTF(cliBuf);
-
- 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_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770 (hp rx[31:16]/tx[15:0])", \
- pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
- 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
-EXhalbtc8723a1ant_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"));
- halbtc8723a1ant_CoexAllOff(pBtCoexist);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- //halbtc8723a1ant_InitCoexDm(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8723a1ant_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"));
- }
- else if(BTC_LPS_DISABLE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- }
-}
-
-VOID
-EXhalbtc8723a1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bWifiConnected=FALSE;
-
- halbtc8723a1ant_NotifyFwScan(pBtCoexist, type);
-
- if(pBtCoexist->btInfo.bBtDisabled)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- }
- else
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(BTC_SCAN_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- //set 0x550[3]=1 before PsTdma
- halbtc8723a1ant_Reg0x550Bit3(pBtCoexist, TRUE);
- }
-
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- }
- else if(BTC_SCAN_FINISH == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- halbtc8723a1ant_CoexForWifiConnect(pBtCoexist);
- }
- }
- }
-}
-
-VOID
-EXhalbtc8723a1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bWifiConnected=FALSE;
-
- if(pBtCoexist->btInfo.bBtDisabled)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- }
- else
- {
- if(BTC_ASSOCIATE_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
- //set 0x550[3]=1 before PsTdma
- halbtc8723a1ant_Reg0x550Bit3(pBtCoexist, TRUE);
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8); // extend wifi slot
- }
- else if(BTC_ASSOCIATE_FINISH == type)
- {
- 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
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- halbtc8723a1ant_CoexForWifiConnect(pBtCoexist);
- }
- }
- }
-}
-
-VOID
-EXhalbtc8723a1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- 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"));
- }
-}
-
-VOID
-EXhalbtc8723a1ant_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"));
- if(pBtCoexist->btInfo.bBtDisabled)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- }
- else
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 18);
- }
- }
-}
-
-VOID
-EXhalbtc8723a1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- u1Byte btInfo=0;
- u1Byte i, rspSource=0;
- BOOLEAN bBtHsOn=FALSE, bBtBusy=FALSE, bForceLps=FALSE;
-
- pCoexSta->bC2hBtInfoReqSent = FALSE;
-
- rspSource = BT_INFO_SRC_8723A_1ANT_BT_RSP;
- pCoexSta->btInfoC2hCnt[rspSource]++;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));
- for(i=0; i<length; i++)
- {
- pCoexSta->btInfoC2h[rspSource][i] = tmpBuf[i];
- if(i == 0)
- 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]));
- }
- }
-
- if(BT_INFO_SRC_8723A_1ANT_WIFI_FW != rspSource)
- {
- pCoexSta->btRetryCnt =
- pCoexSta->btInfoC2h[rspSource][1];
-
- pCoexSta->btRssi =
- pCoexSta->btInfoC2h[rspSource][2]*2+10;
-
- pCoexSta->btInfoExt =
- pCoexSta->btInfoC2h[rspSource][3];
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8723A_1ANT_B_INQ_PAGE)
- {
- pCoexSta->bC2hBtInquiryPage = TRUE;
- }
- else
- {
- pCoexSta->bC2hBtInquiryPage = FALSE;
- }
- btInfo &= ~BIT2;
- if(!(btInfo & BIT0))
- {
- pCoexDm->btStatus = BT_STATE_8723A_1ANT_NO_CONNECTION;
- bForceLps = FALSE;
- }
- else
- {
- bForceLps = TRUE;
- if(btInfo == 0x1)
- {
- pCoexDm->btStatus = BT_STATE_8723A_1ANT_CONNECT_IDLE;
- }
- else if(btInfo == 0x9)
- {
- pCoexDm->btStatus = BT_STATE_8723A_1ANT_ACL_ONLY_BUSY;
- bBtBusy = TRUE;
- }
- else if(btInfo == 0x13)
- {
- pCoexDm->btStatus = BT_STATE_8723A_1ANT_SCO_ONLY_BUSY;
- bBtBusy = TRUE;
- }
- else if(btInfo == 0x1b)
- {
- pCoexDm->btStatus = BT_STATE_8723A_1ANT_ACL_SCO_BUSY;
- bBtBusy = TRUE;
- }
- else if(btInfo == 0x29)
- {
- pCoexDm->btStatus = BT_STATE_8723A_1ANT_HID_BUSY;
- bBtBusy = TRUE;
- }
- else if(btInfo == 0x3b)
- {
- pCoexDm->btStatus = BT_STATE_8723A_1ANT_HID_SCO_BUSY;
- bBtBusy = TRUE;
- }
- }
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bBtBusy);
- if(bForceLps)
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_ENTER_LPS, NULL);
- else
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
-
- if( (BT_STATE_8723A_1ANT_NO_CONNECTION == pCoexDm->btStatus) ||
- (BT_STATE_8723A_1ANT_CONNECT_IDLE == pCoexDm->btStatus) )
- {
- if(pCoexSta->bC2hBtInquiryPage)
- pCoexDm->btStatus = BT_STATE_8723A_1ANT_INQ_OR_PAG;
- }
-}
-
-VOID
-EXhalbtc8723a1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
-
- halbtc8723a1ant_LowPenaltyRa(pBtCoexist, FORCE_EXEC, FALSE);
- halbtc8723a1ant_RfShrink(pBtCoexist, FORCE_EXEC, FALSE);
-
- halbtc8723a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- EXhalbtc8723a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8723a1ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE, bWifiConnected=FALSE;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 1Ant Periodical!!\n"));
-
- 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);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- // work around for c2h hang
- wa_halbtc8723a1ant_MonitorC2h(pBtCoexist);
-
- halbtc8723a1ant_QueryBtInfo(pBtCoexist);
- halbtc8723a1ant_MonitorBtCtr(pBtCoexist);
- halbtc8723a1ant_MonitorBtEnableDisable(pBtCoexist);
-
-
- if(bScan)
- return;
- if(bLink)
- return;
-
- if(bWifiConnected)
- {
- if(pBtCoexist->btInfo.bBtDisabled)
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
-
- halbtc8723a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a1ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- else
- {
- halbtc8723a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a1ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a1ant_CoexForWifiConnect(pBtCoexist);
- }
- }
- else
- {
- halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- halbtc8723a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a1ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
- }
-}
-
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for RTL8723A Co-exist mechanism
+//
+// History
+// 2012/08/22 Cosa first check in.
+// 2012/11/14 Cosa Revise for 8723A 1Ant out sourcing.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8723A_1ANT GLCoexDm8723a1Ant;
+static PCOEX_DM_8723A_1ANT pCoexDm=&GLCoexDm8723a1Ant;
+static COEX_STA_8723A_1ANT GLCoexSta8723a1Ant;
+static PCOEX_STA_8723A_1ANT pCoexSta=&GLCoexSta8723a1Ant;
+
+const char *const GLBtInfoSrc8723a1Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8723a1ant_
+//============================================================
+VOID
+halbtc8723a1ant_Reg0x550Bit3(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSet
+ )
+{
+ u1Byte u1tmp=0;
+
+ u1tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x550);
+ if(bSet)
+ {
+ u1tmp |= BIT3;
+ }
+ else
+ {
+ u1tmp &= ~BIT3;
+ }
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x550, u1tmp);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], set 0x550[3]=%d\n", (bSet? 1:0)));
+}
+
+VOID
+halbtc8723a1ant_NotifyFwScan(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte scanType
+ )
+{
+ u1Byte H2C_Parameter[1] ={0};
+
+ if(BTC_SCAN_START == scanType)
+ H2C_Parameter[0] = 0x1;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Notify FW for wifi scan, write 0x3b=0x%x\n",
+ H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x3b, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723a1ant_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 0x38=0x%x\n",
+ H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x38, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723a1ant_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, 0xf0ff7);
+ }
+ 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
+halbtc8723a1ant_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;
+ }
+ halbtc8723a1ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
+
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
+}
+
+VOID
+halbtc8723a1ant_SetSwPenaltyTxRateAdaptive(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ u1Byte tmpU1;
+
+ tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
+ tmpU1 |= BIT0;
+ if(bLowPenaltyRa)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
+ tmpU1 &= ~BIT2;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
+ tmpU1 |= BIT2;
+ }
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
+}
+
+VOID
+halbtc8723a1ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ return;
+ 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;
+ }
+ halbtc8723a1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8723a1ant_SetCoexTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u4Byte val0x6c0,
+ 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 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
+halbtc8723a1ant_CoexTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u4Byte val0x6c0,
+ IN u4Byte val0x6c8,
+ IN u1Byte val0x6cc
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
+ (bForceExec? "force to":""), val0x6c0, val0x6c8, val0x6cc));
+ pCoexDm->curVal0x6c0 = val0x6c0;
+ pCoexDm->curVal0x6c8 = val0x6c8;
+ pCoexDm->curVal0x6cc = val0x6cc;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c0=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n",
+ pCoexDm->preVal0x6c0, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c0=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n",
+ pCoexDm->curVal0x6c0, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));
+
+ if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&
+ (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
+ (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
+ return;
+ }
+ halbtc8723a1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8723a1ant_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 0x25=0x%x\n",
+ H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x25, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723a1ant_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;
+ }
+ halbtc8723a1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8723a1ant_SetFwPstdma(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type,
+ 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);
+
+ // byte1[1:0] != 0 means enable pstdma
+ // for 2Ant bt coexist, if byte1 != 0 means enable pstdma
+ if(byte1)
+ {
+ if(bApEnable)
+ {
+ if(type != 5 && type != 12)
+ {
+ 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], FW write 0x3a(5bytes)=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, 0x3a, 5, H2C_Parameter);
+}
+
+VOID
+halbtc8723a1ant_PsTdma(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bTurnOn,
+ IN u1Byte type
+ )
+{
+ 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(pCoexDm->bCurPsTdmaOn)
+ {
+ switch(pCoexDm->curPsTdma)
+ {
+ case 1:
+ default:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x1a, 0x1a, 0x0, 0x40);
+ break;
+ case 2:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x12, 0x12, 0x0, 0x40);
+ break;
+ case 3:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x3f, 0x3, 0x10, 0x40);
+ break;
+ case 4:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x15, 0x3, 0x10, 0x0);
+ break;
+ case 5:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0xa9, 0x15, 0x3, 0x35, 0xc0);
+ break;
+
+ case 8:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x25, 0x3, 0x10, 0x0);
+ break;
+ case 9:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0xa, 0xa, 0x0, 0x40);
+ break;
+ case 10:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0xa, 0xa, 0x0, 0x40);
+ break;
+ case 11:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x5, 0x5, 0x0, 0x40);
+ break;
+ case 12:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0xa9, 0xa, 0x3, 0x15, 0xc0);
+ break;
+
+ case 18:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x25, 0x3, 0x10, 0x0);
+ break;
+
+ case 20:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x2a, 0x2a, 0x0, 0x0);
+ break;
+ case 21:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x20, 0x3, 0x10, 0x40);
+ break;
+ case 22:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x1a, 0x1a, 0x2, 0x40);
+ break;
+ case 23:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x12, 0x12, 0x2, 0x40);
+ break;
+ case 24:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0xa, 0xa, 0x2, 0x40);
+ break;
+ case 25:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x5, 0x5, 0x2, 0x40);
+ break;
+ case 26:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x93, 0x25, 0x3, 0x10, 0x0);
+ break;
+ case 27:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x13, 0x5, 0x5, 0x2, 0x40);
+ break;
+ case 28:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x3, 0x2f, 0x2f, 0x0, 0x0);
+ break;
+
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(pCoexDm->curPsTdma)
+ {
+ case 8:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x8, 0x0, 0x0, 0x0, 0x0);
+ break;
+ case 0:
+ default:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x0, 0x0, 0x0, 0x0, 0x0);
+ pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x860, 0x210);
+ break;
+ case 9:
+ halbtc8723a1ant_SetFwPstdma(pBtCoexist, type, 0x0, 0x0, 0x0, 0x0, 0x0);
+ pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x860, 0x110);
+ break;
+
+ }
+ }
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+
+VOID
+halbtc8723a1ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // fw all off
+ halbtc8723a1ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ // sw all off
+ halbtc8723a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a1ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ // hw all off
+ halbtc8723a1ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+}
+
+VOID
+halbtc8723a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+ halbtc8723a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+}
+
+VOID
+halbtc8723a1ant_BtEnableAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+}
+
+VOID
+halbtc8723a1ant_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, 0xc);
+}
+
+VOID
+halbtc8723a1ant_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)
+ {
+ halbtc8723a1ant_BtEnableAction(pBtCoexist);
+ }
+ else
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ }
+ }
+}
+
+VOID
+halbtc8723a1ant_TdmaDurationAdjust(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ static s4Byte up,dn,m,n,WaitCount;
+ s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
+ u1Byte retryCount=0;
+ u1Byte btState;
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+ u4Byte wifiBw;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ btState = pCoexDm->btStatus;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], TdmaDurationAdjust()\n"));
+ if(pCoexDm->psTdmaGlobalCnt != pCoexDm->psTdmaMonitorCnt)
+ {
+ pCoexDm->psTdmaMonitorCnt = 0;
+ pCoexDm->psTdmaGlobalCnt = 0;
+ }
+ if(pCoexDm->psTdmaMonitorCnt == 0)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], first run BT A2DP + WiFi busy state!!\n"));
+ if(btState == BT_STATE_8723A_1ANT_ACL_ONLY_BUSY)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22);
+ pCoexDm->psTdmaDuAdjType = 22;
+ }
+ //============
+ 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, ("[BTCoex], retryCount = %d\n", retryCount));
+ 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, ("[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, ("[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, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n"));
+ }
+
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT TxRx counter H+L <= 1200\n"));
+ if(btState != BT_STATE_8723A_1ANT_ACL_ONLY_BUSY)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], NOT ACL only busy!\n"));
+ if(BTC_WIFI_BW_HT40 != wifiBw)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], 20MHz\n"));
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 22)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23);
+ pCoexDm->psTdmaDuAdjType = 23;
+ }
+ else if(pCoexDm->curPsTdma == 23)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
+ pCoexDm->psTdmaDuAdjType = 24;
+ }
+ else if(pCoexDm->curPsTdma == 24)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 25);
+ pCoexDm->psTdmaDuAdjType = 25;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 25)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
+ pCoexDm->psTdmaDuAdjType = 24;
+ }
+ else if(pCoexDm->curPsTdma == 24)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23);
+ pCoexDm->psTdmaDuAdjType = 23;
+ }
+ else if(pCoexDm->curPsTdma == 23)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22);
+ pCoexDm->psTdmaDuAdjType = 22;
+ }
+ }
+ // error handle, if not in the following state,
+ // set psTdma again.
+ if( (pCoexDm->psTdmaDuAdjType != 22) &&
+ (pCoexDm->psTdmaDuAdjType != 23) &&
+ (pCoexDm->psTdmaDuAdjType != 24) &&
+ (pCoexDm->psTdmaDuAdjType != 25) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], duration case out of handle!!\n"));
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23);
+ pCoexDm->psTdmaDuAdjType = 23;
+ }
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], 40MHz\n"));
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 23)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
+ pCoexDm->psTdmaDuAdjType = 24;
+ }
+ else if(pCoexDm->curPsTdma == 24)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 25);
+ pCoexDm->psTdmaDuAdjType = 25;
+ }
+ else if(pCoexDm->curPsTdma == 25)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 27);
+ pCoexDm->psTdmaDuAdjType = 27;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 27)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 25);
+ pCoexDm->psTdmaDuAdjType = 25;
+ }
+ else if(pCoexDm->curPsTdma == 25)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
+ pCoexDm->psTdmaDuAdjType = 24;
+ }
+ else if(pCoexDm->curPsTdma == 24)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23);
+ pCoexDm->psTdmaDuAdjType = 23;
+ }
+ }
+ // error handle, if not in the following state,
+ // set psTdma again.
+ if( (pCoexDm->psTdmaDuAdjType != 23) &&
+ (pCoexDm->psTdmaDuAdjType != 24) &&
+ (pCoexDm->psTdmaDuAdjType != 25) &&
+ (pCoexDm->psTdmaDuAdjType != 27) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], duration case out of handle!!\n"));
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 24);
+ pCoexDm->psTdmaDuAdjType = 24;
+ }
+ }
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ACL only busy\n"));
+ if (result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ }
+
+ // error handle, if not in the following state,
+ // set psTdma again.
+ if( (pCoexDm->psTdmaDuAdjType != 1) &&
+ (pCoexDm->psTdmaDuAdjType != 2) &&
+ (pCoexDm->psTdmaDuAdjType != 9) &&
+ (pCoexDm->psTdmaDuAdjType != 11) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], duration case out of handle!!\n"));
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ }
+ }
+ }
+
+ // 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)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[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)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], roaming/link/scan is under progress, will adjust next time!!!\n"));
+ }
+ }
+ pCoexDm->psTdmaMonitorCnt++;
+}
+
+
+VOID
+halbtc8723a1ant_CoexForWifiConnect(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bWifiBusy=FALSE;
+ u1Byte btState, btInfoOriginal=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ btState = pCoexDm->btStatus;
+ btInfoOriginal = pCoexSta->btInfoC2h[BT_INFO_SRC_8723A_1ANT_BT_RSP][0];
+
+ if(bWifiConnected)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi connected!!\n"));
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if( !bWifiBusy &&
+ ((BT_STATE_8723A_1ANT_NO_CONNECTION == btState) ||
+ (BT_STATE_8723A_1ANT_CONNECT_IDLE == btState)) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], [Wifi is idle] or [Bt is non connected idle or Bt is connected idle]!!\n"));
+
+ if(BT_STATE_8723A_1ANT_NO_CONNECTION == btState)
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ else if(BT_STATE_8723A_1ANT_CONNECT_IDLE == btState)
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0);
+ }
+ else
+ {
+ if( (BT_STATE_8723A_1ANT_SCO_ONLY_BUSY == btState) ||
+ (BT_STATE_8723A_1ANT_ACL_SCO_BUSY == btState) ||
+ (BT_STATE_8723A_1ANT_HID_BUSY == btState) ||
+ (BT_STATE_8723A_1ANT_HID_SCO_BUSY == btState) )
+ {
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0x60);
+ }
+ else
+ {
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0);
+ }
+ switch(btState)
+ {
+ case BT_STATE_8723A_1ANT_NO_CONNECTION:
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ break;
+ case BT_STATE_8723A_1ANT_CONNECT_IDLE:
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ break;
+ case BT_STATE_8723A_1ANT_INQ_OR_PAG:
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ break;
+ case BT_STATE_8723A_1ANT_SCO_ONLY_BUSY:
+ case BT_STATE_8723A_1ANT_ACL_SCO_BUSY:
+ case BT_STATE_8723A_1ANT_HID_BUSY:
+ case BT_STATE_8723A_1ANT_HID_SCO_BUSY:
+ halbtc8723a1ant_TdmaDurationAdjust(pBtCoexist);
+ break;
+ case BT_STATE_8723A_1ANT_ACL_ONLY_BUSY:
+ if (btInfoOriginal&BT_INFO_8723A_1ANT_B_A2DP)
+ {
+ halbtc8723a1ant_TdmaDurationAdjust(pBtCoexist);
+ }
+ else if(btInfoOriginal&BT_INFO_8723A_1ANT_B_FTP)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ }
+ else if( (btInfoOriginal&BT_INFO_8723A_1ANT_B_A2DP) &&
+ (btInfoOriginal&BT_INFO_8723A_1ANT_B_FTP) )
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ }
+ else
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ }
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], error!!!, undefined case in halbtc8723a1ant_CoexForWifiConnect()!!\n"));
+ break;
+ }
+ }
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is disconnected!!\n"));
+ }
+
+ pCoexDm->psTdmaGlobalCnt++;
+}
+
+//============================================================
+// work around function start with wa_halbtc8723a1ant_
+//============================================================
+VOID
+wa_halbtc8723a1ant_MonitorC2h(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte tmp1b=0x0;
+ u4Byte curC2hTotalCnt=0x0;
+ static u4Byte preC2hTotalCnt=0x0, sameCntPollingTime=0x0;
+
+ curC2hTotalCnt+=pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8723A_1ANT_BT_RSP];
+
+ if(curC2hTotalCnt == preC2hTotalCnt)
+ {
+ sameCntPollingTime++;
+ }
+ else
+ {
+ preC2hTotalCnt = curC2hTotalCnt;
+ sameCntPollingTime = 0;
+ }
+
+ if(sameCntPollingTime >= 2)
+ {
+ tmp1b = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x1af);
+ if(tmp1b != 0x0)
+ {
+ pCoexSta->c2hHangDetectCnt++;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x1af, 0x0);
+ }
+ }
+}
+
+//============================================================
+// extern function start with EXhalbtc8723a1ant_
+//============================================================
+VOID
+EXhalbtc8723a1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
+
+ // backup rf 0x1e value
+ pCoexDm->btRf0x1eBackup =
+ pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
+
+ // enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+
+ // coex table
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, 0x0); // 1-Ant coex
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, 0xffff); // wifi break table
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, 0x55555555); //coex table
+
+ // antenna switch control parameter
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x858, 0xaaaaaaaa);
+
+ pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x860, 0x210); //set antenna at wifi side if ANTSW is software control
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x870, 0x300); //SPDT(connected with TRSW) control by hardware PTA
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x874, 0x22804000); //ANTSW keep by GNT_BT
+
+ // coexistence parameters
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1); // enable RTK mode PTA
+}
+
+VOID
+EXhalbtc8723a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ halbtc8723a1ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8723a1ant_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;
+
+ 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);
+
+ 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_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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, wifiHsChnl, bBtHsOn);
+ 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_8723A_1ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8723A_1ANT_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; i<BT_INFO_SRC_8723A_1ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723a1Ant[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 = %d", "write 0x1af=0x0 num", \
+ pCoexSta->c2hHangDetectCnt);
+ CL_PRINTF(cliBuf);
+
+ // 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);
+
+ // 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 ", "IgnWlanAct", \
+ 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, 0x783);
+ u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x796);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \
+ u1Tmp[0], u1Tmp[1], u1Tmp[2]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
+ u1Tmp[0]);
+ 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, 0x484);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
+ u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xdac);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \
+ u4Tmp[0], u4Tmp[1], u4Tmp[2], u4Tmp[3]);
+ CL_PRINTF(cliBuf);
+
+ 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_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770 (hp rx[31:16]/tx[15:0])", \
+ pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
+ 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
+EXhalbtc8723a1ant_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"));
+ halbtc8723a1ant_CoexAllOff(pBtCoexist);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ //halbtc8723a1ant_InitCoexDm(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8723a1ant_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"));
+ }
+ else if(BTC_LPS_DISABLE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ }
+}
+
+VOID
+EXhalbtc8723a1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bWifiConnected=FALSE;
+
+ halbtc8723a1ant_NotifyFwScan(pBtCoexist, type);
+
+ if(pBtCoexist->btInfo.bBtDisabled)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ }
+ else
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(BTC_SCAN_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ //set 0x550[3]=1 before PsTdma
+ halbtc8723a1ant_Reg0x550Bit3(pBtCoexist, TRUE);
+ }
+
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ }
+ else if(BTC_SCAN_FINISH == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ halbtc8723a1ant_CoexForWifiConnect(pBtCoexist);
+ }
+ }
+ }
+}
+
+VOID
+EXhalbtc8723a1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bWifiConnected=FALSE;
+
+ if(pBtCoexist->btInfo.bBtDisabled)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ }
+ else
+ {
+ if(BTC_ASSOCIATE_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
+ //set 0x550[3]=1 before PsTdma
+ halbtc8723a1ant_Reg0x550Bit3(pBtCoexist, TRUE);
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8); // extend wifi slot
+ }
+ else if(BTC_ASSOCIATE_FINISH == type)
+ {
+ 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
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ halbtc8723a1ant_CoexForWifiConnect(pBtCoexist);
+ }
+ }
+ }
+}
+
+VOID
+EXhalbtc8723a1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ 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"));
+ }
+}
+
+VOID
+EXhalbtc8723a1ant_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"));
+ if(pBtCoexist->btInfo.bBtDisabled)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ }
+ else
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 18);
+ }
+ }
+}
+
+VOID
+EXhalbtc8723a1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ u1Byte btInfo=0;
+ u1Byte i, rspSource=0;
+ BOOLEAN bBtHsOn=FALSE, bBtBusy=FALSE, bForceLps=FALSE;
+
+ pCoexSta->bC2hBtInfoReqSent = FALSE;
+
+ rspSource = BT_INFO_SRC_8723A_1ANT_BT_RSP;
+ pCoexSta->btInfoC2hCnt[rspSource]++;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));
+ for(i=0; i<length; i++)
+ {
+ pCoexSta->btInfoC2h[rspSource][i] = tmpBuf[i];
+ if(i == 0)
+ 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]));
+ }
+ }
+
+ if(BT_INFO_SRC_8723A_1ANT_WIFI_FW != rspSource)
+ {
+ pCoexSta->btRetryCnt =
+ pCoexSta->btInfoC2h[rspSource][1];
+
+ pCoexSta->btRssi =
+ pCoexSta->btInfoC2h[rspSource][2]*2+10;
+
+ pCoexSta->btInfoExt =
+ pCoexSta->btInfoC2h[rspSource][3];
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8723A_1ANT_B_INQ_PAGE)
+ {
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ }
+ else
+ {
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+ }
+ btInfo &= ~BIT2;
+ if(!(btInfo & BIT0))
+ {
+ pCoexDm->btStatus = BT_STATE_8723A_1ANT_NO_CONNECTION;
+ bForceLps = FALSE;
+ }
+ else
+ {
+ bForceLps = TRUE;
+ if(btInfo == 0x1)
+ {
+ pCoexDm->btStatus = BT_STATE_8723A_1ANT_CONNECT_IDLE;
+ }
+ else if(btInfo == 0x9)
+ {
+ pCoexDm->btStatus = BT_STATE_8723A_1ANT_ACL_ONLY_BUSY;
+ bBtBusy = TRUE;
+ }
+ else if(btInfo == 0x13)
+ {
+ pCoexDm->btStatus = BT_STATE_8723A_1ANT_SCO_ONLY_BUSY;
+ bBtBusy = TRUE;
+ }
+ else if(btInfo == 0x1b)
+ {
+ pCoexDm->btStatus = BT_STATE_8723A_1ANT_ACL_SCO_BUSY;
+ bBtBusy = TRUE;
+ }
+ else if(btInfo == 0x29)
+ {
+ pCoexDm->btStatus = BT_STATE_8723A_1ANT_HID_BUSY;
+ bBtBusy = TRUE;
+ }
+ else if(btInfo == 0x3b)
+ {
+ pCoexDm->btStatus = BT_STATE_8723A_1ANT_HID_SCO_BUSY;
+ bBtBusy = TRUE;
+ }
+ }
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bBtBusy);
+ if(bForceLps)
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_ENTER_LPS, NULL);
+ else
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+
+ if( (BT_STATE_8723A_1ANT_NO_CONNECTION == pCoexDm->btStatus) ||
+ (BT_STATE_8723A_1ANT_CONNECT_IDLE == pCoexDm->btStatus) )
+ {
+ if(pCoexSta->bC2hBtInquiryPage)
+ pCoexDm->btStatus = BT_STATE_8723A_1ANT_INQ_OR_PAG;
+ }
+}
+
+VOID
+EXhalbtc8723a1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
+
+ halbtc8723a1ant_LowPenaltyRa(pBtCoexist, FORCE_EXEC, FALSE);
+ halbtc8723a1ant_RfShrink(pBtCoexist, FORCE_EXEC, FALSE);
+
+ halbtc8723a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ EXhalbtc8723a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8723a1ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE, bWifiConnected=FALSE;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 1Ant Periodical!!\n"));
+
+ 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);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ // work around for c2h hang
+ wa_halbtc8723a1ant_MonitorC2h(pBtCoexist);
+
+ halbtc8723a1ant_QueryBtInfo(pBtCoexist);
+ halbtc8723a1ant_MonitorBtCtr(pBtCoexist);
+ halbtc8723a1ant_MonitorBtEnableDisable(pBtCoexist);
+
+
+ if(bScan)
+ return;
+ if(bLink)
+ return;
+
+ if(bWifiConnected)
+ {
+ if(pBtCoexist->btInfo.bBtDisabled)
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+
+ halbtc8723a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a1ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ else
+ {
+ halbtc8723a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a1ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a1ant_CoexForWifiConnect(pBtCoexist);
+ }
+ }
+ else
+ {
+ halbtc8723a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ halbtc8723a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a1ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.h
index e8c2fd0..6d4e1b4 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.h
@@ -1,171 +1,171 @@
-//===========================================
-// The following is for 8723A 1Ant BT Co-exist definition
-//===========================================
-#define BT_INFO_8723A_1ANT_B_FTP BIT7
-#define BT_INFO_8723A_1ANT_B_A2DP BIT6
-#define BT_INFO_8723A_1ANT_B_HID BIT5
-#define BT_INFO_8723A_1ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8723A_1ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8723A_1ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8723A_1ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8723A_1ANT_B_CONNECTION BIT0
-
-typedef enum _BT_STATE_8723A_1ANT{
- BT_STATE_8723A_1ANT_DISABLED = 0,
- BT_STATE_8723A_1ANT_NO_CONNECTION = 1,
- BT_STATE_8723A_1ANT_CONNECT_IDLE = 2,
- BT_STATE_8723A_1ANT_INQ_OR_PAG = 3,
- BT_STATE_8723A_1ANT_ACL_ONLY_BUSY = 4,
- BT_STATE_8723A_1ANT_SCO_ONLY_BUSY = 5,
- BT_STATE_8723A_1ANT_ACL_SCO_BUSY = 6,
- BT_STATE_8723A_1ANT_HID_BUSY = 7,
- BT_STATE_8723A_1ANT_HID_SCO_BUSY = 8,
- BT_STATE_8723A_1ANT_MAX
-}BT_STATE_8723A_1ANT, *PBT_STATE_8723A_1ANT;
-
-#define BTC_RSSI_COEX_THRESH_TOL_8723A_1ANT 2
-
-typedef enum _BT_INFO_SRC_8723A_1ANT{
- BT_INFO_SRC_8723A_1ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8723A_1ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8723A_1ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8723A_1ANT_MAX
-}BT_INFO_SRC_8723A_1ANT,*PBT_INFO_SRC_8723A_1ANT;
-
-typedef enum _BT_8723A_1ANT_BT_STATUS{
- BT_8723A_1ANT_BT_STATUS_IDLE = 0x0,
- BT_8723A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8723A_1ANT_BT_STATUS_NON_IDLE = 0x2,
- BT_8723A_1ANT_BT_STATUS_MAX
-}BT_8723A_1ANT_BT_STATUS,*PBT_8723A_1ANT_BT_STATUS;
-
-typedef enum _BT_8723A_1ANT_COEX_ALGO{
- BT_8723A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8723A_1ANT_COEX_ALGO_SCO = 0x1,
- BT_8723A_1ANT_COEX_ALGO_HID = 0x2,
- BT_8723A_1ANT_COEX_ALGO_A2DP = 0x3,
- BT_8723A_1ANT_COEX_ALGO_PANEDR = 0x4,
- BT_8723A_1ANT_COEX_ALGO_PANHS = 0x5,
- BT_8723A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x6,
- BT_8723A_1ANT_COEX_ALGO_PANEDR_HID = 0x7,
- BT_8723A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x8,
- BT_8723A_1ANT_COEX_ALGO_HID_A2DP = 0x9,
- BT_8723A_1ANT_COEX_ALGO_MAX
-}BT_8723A_1ANT_COEX_ALGO,*PBT_8723A_1ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8723A_1ANT{
- // fw mechanism
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- u1Byte psTdmaDuAdjType;
- u4Byte psTdmaMonitorCnt;
- u4Byte psTdmaGlobalCnt;
- BOOLEAN bResetTdmaAdjust;
- BOOLEAN bPrePsTdmaOn;
- BOOLEAN bCurPsTdmaOn;
-
- // sw mechanism
- BOOLEAN bPreRfRxLpfShrink;
- BOOLEAN bCurRfRxLpfShrink;
- u4Byte btRf0x1eBackup;
- BOOLEAN bPreLowPenaltyRa;
- BOOLEAN bCurLowPenaltyRa;
- u4Byte preVal0x6c0;
- u4Byte curVal0x6c0;
- u4Byte preVal0x6c8;
- u4Byte curVal0x6c8;
- u1Byte preVal0x6cc;
- u1Byte curVal0x6cc;
- BOOLEAN bLimitedDig;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-} COEX_DM_8723A_1ANT, *PCOEX_DM_8723A_1ANT;
-
-typedef struct _COEX_STA_8723A_1ANT{
- u4Byte highPriorityTx;
- u4Byte highPriorityRx;
- u4Byte lowPriorityTx;
- u4Byte lowPriorityRx;
- u1Byte btRssi;
- u1Byte preBtRssiState;
- u1Byte preBtRssiState1;
- u1Byte preWifiRssiState[4];
- BOOLEAN bC2hBtInfoReqSent;
- u1Byte btInfoC2h[BT_INFO_SRC_8723A_1ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8723A_1ANT_MAX];
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
- //BOOLEAN bHoldForStackOperation;
- //u1Byte bHoldPeriodCnt;
- // this is for c2h hang work-around
- u4Byte c2hHangDetectCnt;
-}COEX_STA_8723A_1ANT, *PCOEX_STA_8723A_1ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8723a1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723a1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8723a1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723a1ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723a1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-
+//===========================================
+// The following is for 8723A 1Ant BT Co-exist definition
+//===========================================
+#define BT_INFO_8723A_1ANT_B_FTP BIT7
+#define BT_INFO_8723A_1ANT_B_A2DP BIT6
+#define BT_INFO_8723A_1ANT_B_HID BIT5
+#define BT_INFO_8723A_1ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8723A_1ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8723A_1ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8723A_1ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8723A_1ANT_B_CONNECTION BIT0
+
+typedef enum _BT_STATE_8723A_1ANT{
+ BT_STATE_8723A_1ANT_DISABLED = 0,
+ BT_STATE_8723A_1ANT_NO_CONNECTION = 1,
+ BT_STATE_8723A_1ANT_CONNECT_IDLE = 2,
+ BT_STATE_8723A_1ANT_INQ_OR_PAG = 3,
+ BT_STATE_8723A_1ANT_ACL_ONLY_BUSY = 4,
+ BT_STATE_8723A_1ANT_SCO_ONLY_BUSY = 5,
+ BT_STATE_8723A_1ANT_ACL_SCO_BUSY = 6,
+ BT_STATE_8723A_1ANT_HID_BUSY = 7,
+ BT_STATE_8723A_1ANT_HID_SCO_BUSY = 8,
+ BT_STATE_8723A_1ANT_MAX
+}BT_STATE_8723A_1ANT, *PBT_STATE_8723A_1ANT;
+
+#define BTC_RSSI_COEX_THRESH_TOL_8723A_1ANT 2
+
+typedef enum _BT_INFO_SRC_8723A_1ANT{
+ BT_INFO_SRC_8723A_1ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8723A_1ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8723A_1ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8723A_1ANT_MAX
+}BT_INFO_SRC_8723A_1ANT,*PBT_INFO_SRC_8723A_1ANT;
+
+typedef enum _BT_8723A_1ANT_BT_STATUS{
+ BT_8723A_1ANT_BT_STATUS_IDLE = 0x0,
+ BT_8723A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8723A_1ANT_BT_STATUS_NON_IDLE = 0x2,
+ BT_8723A_1ANT_BT_STATUS_MAX
+}BT_8723A_1ANT_BT_STATUS,*PBT_8723A_1ANT_BT_STATUS;
+
+typedef enum _BT_8723A_1ANT_COEX_ALGO{
+ BT_8723A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8723A_1ANT_COEX_ALGO_SCO = 0x1,
+ BT_8723A_1ANT_COEX_ALGO_HID = 0x2,
+ BT_8723A_1ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8723A_1ANT_COEX_ALGO_PANEDR = 0x4,
+ BT_8723A_1ANT_COEX_ALGO_PANHS = 0x5,
+ BT_8723A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x6,
+ BT_8723A_1ANT_COEX_ALGO_PANEDR_HID = 0x7,
+ BT_8723A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x8,
+ BT_8723A_1ANT_COEX_ALGO_HID_A2DP = 0x9,
+ BT_8723A_1ANT_COEX_ALGO_MAX
+}BT_8723A_1ANT_COEX_ALGO,*PBT_8723A_1ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8723A_1ANT{
+ // fw mechanism
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ u1Byte psTdmaDuAdjType;
+ u4Byte psTdmaMonitorCnt;
+ u4Byte psTdmaGlobalCnt;
+ BOOLEAN bResetTdmaAdjust;
+ BOOLEAN bPrePsTdmaOn;
+ BOOLEAN bCurPsTdmaOn;
+
+ // sw mechanism
+ BOOLEAN bPreRfRxLpfShrink;
+ BOOLEAN bCurRfRxLpfShrink;
+ u4Byte btRf0x1eBackup;
+ BOOLEAN bPreLowPenaltyRa;
+ BOOLEAN bCurLowPenaltyRa;
+ u4Byte preVal0x6c0;
+ u4Byte curVal0x6c0;
+ u4Byte preVal0x6c8;
+ u4Byte curVal0x6c8;
+ u1Byte preVal0x6cc;
+ u1Byte curVal0x6cc;
+ BOOLEAN bLimitedDig;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+} COEX_DM_8723A_1ANT, *PCOEX_DM_8723A_1ANT;
+
+typedef struct _COEX_STA_8723A_1ANT{
+ u4Byte highPriorityTx;
+ u4Byte highPriorityRx;
+ u4Byte lowPriorityTx;
+ u4Byte lowPriorityRx;
+ u1Byte btRssi;
+ u1Byte preBtRssiState;
+ u1Byte preBtRssiState1;
+ u1Byte preWifiRssiState[4];
+ BOOLEAN bC2hBtInfoReqSent;
+ u1Byte btInfoC2h[BT_INFO_SRC_8723A_1ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8723A_1ANT_MAX];
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+ //BOOLEAN bHoldForStackOperation;
+ //u1Byte bHoldPeriodCnt;
+ // this is for c2h hang work-around
+ u4Byte c2hHangDetectCnt;
+}COEX_STA_8723A_1ANT, *PCOEX_STA_8723A_1ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8723a1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723a1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8723a1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723a1ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723a1ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c
index 2b72397..9e2c184 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c
@@ -1,3780 +1,3780 @@
-//============================================================
-// Description:
-//
-// This file is for RTL8723A Co-exist mechanism
-//
-// History
-// 2012/08/22 Cosa first check in.
-// 2012/11/14 Cosa Revise for 8723A 2Ant out sourcing.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8723A_2ANT GLCoexDm8723a2Ant;
-static PCOEX_DM_8723A_2ANT pCoexDm=&GLCoexDm8723a2Ant;
-static COEX_STA_8723A_2ANT GLCoexSta8723a2Ant;
-static PCOEX_STA_8723A_2ANT pCoexSta=&GLCoexSta8723a2Ant;
-
-const char *const GLBtInfoSrc8723a2Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8723a2ant_
-//============================================================
-BOOLEAN
-halbtc8723a2ant_IsWifiIdle(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiConnected=FALSE, bScan=FALSE, bLink=FALSE, bRoam=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- 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(bWifiConnected)
- return FALSE;
- if(bScan)
- return FALSE;
- if(bLink)
- return FALSE;
- if(bRoam)
- return FALSE;
-
- return TRUE;
-}
-
-u1Byte
-halbtc8723a2ant_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_8723A_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_8723A_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_8723A_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
-halbtc8723a2ant_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_8723A_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_8723A_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_8723A_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
-halbtc8723a2ant_IndicateWifiChnlBwInfo(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u1Byte H2C_Parameter[3] ={0};
- u4Byte wifiBw;
- u1Byte wifiCentralChnl;
-
- // 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;
- }
-
- 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 0x19=0x%x\n",
- H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x19, 3, H2C_Parameter);
-}
-
-VOID
-halbtc8723a2ant_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 0x38=0x%x\n",
- H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x38, 1, H2C_Parameter);
-}
-u1Byte
-halbtc8723a2ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- BOOLEAN bBtHsOn=FALSE, bBtBusy=FALSE, bLimitedDig=FALSE;
- u1Byte algorithm=BT_8723A_2ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- //======================
- // here we get BT status first
- //======================
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_IDLE;
-
- if((pStackInfo->bScoExist) ||(bBtHsOn) ||(pStackInfo->bHidExist))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO or HID or HS exists, set BT non-idle !!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
- }
- else
- {
- // A2dp profile
- if( (pBtCoexist->stackInfo.numOfLink == 1) &&
- (pStackInfo->bA2dpExist) )
- {
- if( (pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 100)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP, low priority tx+rx < 100, set BT connected-idle!!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP, low priority tx+rx >= 100, set BT non-idle!!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
- }
- }
- // Pan profile
- if( (pBtCoexist->stackInfo.numOfLink == 1) &&
- (pStackInfo->bPanExist) )
- {
- if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, low priority tx+rx < 600, set BT connected-idle!!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
- }
- else
- {
- if(pCoexSta->lowPriorityTx)
- {
- if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, low priority rx/tx > 9, set BT connected-idle!!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
- }
- }
- }
- if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, set BT non-idle!!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
- }
- }
- // Pan+A2dp profile
- if( (pBtCoexist->stackInfo.numOfLink == 2) &&
- (pStackInfo->bA2dpExist) &&
- (pStackInfo->bPanExist) )
- {
- if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, low priority tx+rx < 600, set BT connected-idle!!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
- }
- else
- {
- if(pCoexSta->lowPriorityTx)
- {
- if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, low priority rx/tx > 9, set BT connected-idle!!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
- }
- }
- }
- if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, set BT non-idle!!!\n"));
- pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
- }
- }
- }
- if(BT_8723A_2ANT_BT_STATUS_IDLE != pCoexDm->btStatus)
- {
- bBtBusy = TRUE;
- bLimitedDig = TRUE;
- }
- else
- {
- bBtBusy = FALSE;
- bLimitedDig = FALSE;
- }
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
- //======================
-
- 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_8723A_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pStackInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8723A_2ANT_COEX_ALGO_HID;
- }
- else if(pStackInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8723A_2ANT_COEX_ALGO_A2DP;
- }
- else if(pStackInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
- algorithm = BT_8723A_2ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
- algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_HID;
- }
- else if(pStackInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
- algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;
- }
- else if(pStackInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
- algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
- algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pStackInfo->bHidExist &&
- pStackInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
- algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
- algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_HID;
- }
- else if( pStackInfo->bHidExist &&
- pStackInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
- algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-BOOLEAN
-halbtc8723a2ant_NeedToDecBtPwr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bRet=FALSE;
- BOOLEAN bBtHsOn=FALSE, bWifiConnected=FALSE;
- s4Byte btHsRssi=0;
-
- 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;
-
- 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
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], Need to decrease bt power for Wifi is connected!!\n"));
- bRet = TRUE;
- }
- }
-
- return bRet;
-}
-
-VOID
-halbtc8723a2ant_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 0x29=0x%x\n", H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x29, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723a2ant_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 0x21=0x%x\n",
- (bDecBtPwr? "Yes!!":"No!!"), H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x21, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723a2ant_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;
- }
- halbtc8723a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr);
-
- pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr;
-}
-
-VOID
-halbtc8723a2ant_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;
- }
-
- halbtc8723a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
-
- pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
-}
-
-VOID
-halbtc8723a2ant_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, 0xf0ff7);
- }
- 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
-halbtc8723a2ant_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;
- }
- halbtc8723a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
-
- pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
-}
-
-VOID
-halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- u1Byte tmpU1;
-
- tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
- tmpU1 |= BIT0;
- if(bLowPenaltyRa)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
- tmpU1 &= ~BIT2;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
- tmpU1 |= BIT2;
- }
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
-}
-
-VOID
-halbtc8723a2ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- return;
- 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;
- }
- halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8723a2ant_SetSwFullTimeDacSwing(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSwDacSwingOn,
- IN u4Byte swDacSwingLvl
- )
-{
- if(bSwDacSwingOn)
- {
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, swDacSwingLvl);
- }
- else
- {
- pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0);
- }
-}
-
-
-VOID
-halbtc8723a2ant_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);
- halbtc8723a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
-
- pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
- pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
-}
-
-VOID
-halbtc8723a2ant_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->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a07611);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a05611);
- }
-}
-
-VOID
-halbtc8723a2ant_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;
- }
- halbtc8723a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
-
- pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
-}
-
-VOID
-halbtc8723a2ant_SetAgcTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAgcTableEn
- )
-{
- u1Byte rssiAdjustVal=0;
-
- if(bAgcTableEn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4e1c0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4d1d0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4c1e0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4b1f0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4a200001);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x90000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x51000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x12000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x00355);
-
- rssiAdjustVal = 6;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x641c0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x631d0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x621e0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x611f0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x60200001);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x32000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x71000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xb0000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xfc000);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x30355);
- }
-
- // set rssiAdjustVal for wifi module.
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
-}
-
-
-VOID
-halbtc8723a2ant_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;
- }
- halbtc8723a2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
-
- pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
-}
-
-VOID
-halbtc8723a2ant_SetCoexTable(
- IN PBTC_COEXIST pBtCoexist,
- IN u4Byte val0x6c0,
- 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 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
-halbtc8723a2ant_CoexTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u4Byte val0x6c0,
- IN u4Byte val0x6c8,
- IN u1Byte val0x6cc
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
- (bForceExec? "force to":""), val0x6c0, val0x6c8, val0x6cc));
- pCoexDm->curVal0x6c0 = val0x6c0;
- pCoexDm->curVal0x6c8 = val0x6c8;
- pCoexDm->curVal0x6cc = val0x6cc;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c0=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n",
- pCoexDm->preVal0x6c0, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c0=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n",
- pCoexDm->curVal0x6c0, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));
-
- if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&
- (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
- (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
- return;
- }
- halbtc8723a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8723a2ant_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 0x25=0x%x\n",
- H2C_Parameter[0]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x25, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723a2ant_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;
- }
- halbtc8723a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8723a2ant_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};
-
- H2C_Parameter[0] = byte1;
- H2C_Parameter[1] = byte2;
- H2C_Parameter[2] = byte3;
- H2C_Parameter[3] = byte4;
- H2C_Parameter[4] = byte5;
-
- pCoexDm->psTdmaPara[0] = byte1;
- pCoexDm->psTdmaPara[1] = byte2;
- pCoexDm->psTdmaPara[2] = byte3;
- pCoexDm->psTdmaPara[3] = byte4;
- pCoexDm->psTdmaPara[4] = byte5;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x3a(5bytes)=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, 0x3a, 5, H2C_Parameter);
-}
-
-VOID
-halbtc8723a2ant_PsTdma(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bTurnOn,
- IN u1Byte type
- )
-{
- u4Byte btTxRxCnt=0;
-
- btTxRxCnt = pCoexSta->highPriorityTx+pCoexSta->highPriorityRx+
- pCoexSta->lowPriorityTx+pCoexSta->lowPriorityRx;
-
- if(btTxRxCnt > 3000)
- {
- pCoexDm->bCurPsTdmaOn = TRUE;
- pCoexDm->curPsTdma = 8;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], turn ON PS TDMA, type=%d for BT tx/rx counters=%d(>3000)\n",
- pCoexDm->curPsTdma, btTxRxCnt));
- }
- else
- {
- 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(pCoexDm->bCurPsTdmaOn)
- {
- switch(pCoexDm->curPsTdma)
- {
- case 1:
- default:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98);
- break;
- case 2:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98);
- break;
- case 3:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98);
- break;
- case 4:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0xe1, 0x80);
- break;
- case 5:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98);
- break;
- case 6:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98);
- break;
- case 7:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98);
- break;
- case 8:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0x60, 0x80);
- break;
- case 9:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98);
- break;
- case 10:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98);
- break;
- case 11:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98);
- break;
- case 12:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98);
- break;
- case 13:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98);
- break;
- case 14:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98);
- break;
- case 15:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98);
- break;
- case 16:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x98);
- break;
- case 17:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x80);
- break;
- case 18:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98);
- break;
- case 19:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x98);
- break;
- case 20:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x98);
- break;
- }
- }
- else
- {
- // disable PS tdma
- switch(pCoexDm->curPsTdma)
- {
- case 0:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
- break;
- case 1:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
- break;
- default:
- halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
- break;
- }
- }
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-
-VOID
-halbtc8723a2ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // fw all off
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- // sw all off
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
-
- // hw all off
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-}
-
-VOID
-halbtc8723a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
- halbtc8723a2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0xffff, 0x3);
- halbtc8723a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
- halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 0x20);
- halbtc8723a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE);
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
-
- halbtc8723a2ant_AgcTable(pBtCoexist, FORCE_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, FORCE_EXEC, FALSE);
- halbtc8723a2ant_LowPenaltyRa(pBtCoexist, FORCE_EXEC, FALSE);
- halbtc8723a2ant_RfShrink(pBtCoexist, FORCE_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, FORCE_EXEC, FALSE, 0xc0);
-}
-
-VOID
-halbtc8723a2ant_BtInquiryPage(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bLowPwrDisable=TRUE;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
-}
-
-VOID
-halbtc8723a2ant_BtEnableAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiConnected=FALSE;
-
- // Here we need to resend some wifi info to BT
- // because bt is reset and loss of the info.
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
-
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
-}
-
-VOID
-halbtc8723a2ant_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, 0xc);
-}
-
-VOID
-halbtc8723a2ant_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)
- {
- halbtc8723a2ant_BtEnableAction(pBtCoexist);
- }
- }
-}
-
-BOOLEAN
-halbtc8723a2ant_IsCommonAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- BOOLEAN bCommon=FALSE, bWifiConnected=FALSE;
- BOOLEAN bLowPwrDisable=FALSE;
-
- if(!pStackInfo->bBtLinkExist)
- {
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
- }
- else
- {
- bLowPwrDisable = TRUE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
- BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + Bt idle!!\n"));
-
- halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
-
- bCommon = TRUE;
- }
- else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
- (BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + BT idle!!\n"));
-
- halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
-
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
-
- bCommon = TRUE;
- }
- else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
- (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + Bt connected idle!!\n"));
-
- halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
-
- bCommon = TRUE;
- }
- else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
- (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + Bt connected idle!!\n"));
-
- halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
-
- bCommon = TRUE;
- }
- else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
- (BT_8723A_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + BT non-idle!!\n"));
-
- halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
-
- bCommon = TRUE;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + BT non-idle!!\n"));
- halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
-
- bCommon = FALSE;
- }
-
- return bCommon;
-}
-VOID
-halbtc8723a2ant_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)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(maxInterval == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(maxInterval == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(maxInterval == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(maxInterval == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- }
- else
- {
- if(bTxPause)
- {
- if(maxInterval == 1)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(maxInterval == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(maxInterval == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(maxInterval == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(maxInterval == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else
- {
- halbtc8723a2ant_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 == 1)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_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)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_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)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_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)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_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)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_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)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723a2ant_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)
- {
- halbtc8723a2ant_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"));
- }
- }
-}
-
-// SCO only or SCO+PAN(HS)
-VOID
-halbtc8723a2ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1;
- u4Byte wifiBw;
-
- if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- }
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
- wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- }
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-
-VOID
-halbtc8723a2ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1;
- u4Byte wifiBw;
-
- if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- }
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
- wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- }
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8723a2ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
-
- if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
- else
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- }
- else
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
- }
- }
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
- wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
- else
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- }
- else
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-VOID
-halbtc8723a2ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
-
- if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- }
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
- wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- }
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-
-//PAN(HS) only
-VOID
-halbtc8723a2ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8723a2ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
-
- if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- }
- }
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
- wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-VOID
-halbtc8723a2ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1;
- u4Byte wifiBw;
-
- if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- }
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
- wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
- else
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8723a2ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
-
- if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- }
- }
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
- wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-VOID
-halbtc8723a2ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
-
- if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 1);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 1);
- }
- }
-
- // sw mechanism
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
- wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
-
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 1);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 1);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- else
- {
- halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
- }
- }
-}
-
-VOID
-halbtc8723a2ant_RunCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- u1Byte btInfoOriginal=0, btRetryCnt=0;
- u1Byte algorithm=0;
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Manual control!!!\n"));
- return;
- }
-
- if(pStackInfo->bProfileNotified)
- {
- if(pCoexSta->bHoldForStackOperation)
- {
- // if bt inquiry/page/pair, do not execute.
- return;
- }
-
- algorithm = halbtc8723a2ant_ActionAlgorithm(pBtCoexist);
- if(pCoexSta->bHoldPeriodCnt && (BT_8723A_2ANT_COEX_ALGO_PANHS!=algorithm))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex],Hold BT inquiry/page scan setting (cnt = %d)!!\n",
- pCoexSta->bHoldPeriodCnt));
- if(pCoexSta->bHoldPeriodCnt >= 6)
- {
- pCoexSta->bHoldPeriodCnt = 0;
- // next time the coexist parameters should be reset again.
- }
- else
- pCoexSta->bHoldPeriodCnt++;
- return;
- }
-
- pCoexDm->curAlgorithm = algorithm;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
- if(halbtc8723a2ant_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_8723A_2ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
- halbtc8723a2ant_ActionSco(pBtCoexist);
- break;
- case BT_8723A_2ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
- halbtc8723a2ant_ActionHid(pBtCoexist);
- break;
- case BT_8723A_2ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
- halbtc8723a2ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8723A_2ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
- halbtc8723a2ant_ActionPanEdr(pBtCoexist);
- break;
- case BT_8723A_2ANT_COEX_ALGO_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
- halbtc8723a2ant_ActionPanHs(pBtCoexist);
- break;
- case BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
- halbtc8723a2ant_ActionPanEdrA2dp(pBtCoexist);
- break;
- case BT_8723A_2ANT_COEX_ALGO_PANEDR_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
- halbtc8723a2ant_ActionPanEdrHid(pBtCoexist);
- break;
- case BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
- halbtc8723a2ant_ActionHidA2dpPanEdr(pBtCoexist);
- break;
- case BT_8723A_2ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
- halbtc8723a2ant_ActionHidA2dp(pBtCoexist);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
- halbtc8723a2ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
- }
-}
-
-//============================================================
-// work around function start with wa_halbtc8723a2ant_
-//============================================================
-VOID
-wa_halbtc8723a2ant_MonitorC2h(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte tmp1b=0x0;
- u4Byte curC2hTotalCnt=0x0;
- static u4Byte preC2hTotalCnt=0x0, sameCntPollingTime=0x0;
-
- curC2hTotalCnt+=pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8723A_2ANT_BT_RSP];
-
- if(curC2hTotalCnt == preC2hTotalCnt)
- {
- sameCntPollingTime++;
- }
- else
- {
- preC2hTotalCnt = curC2hTotalCnt;
- sameCntPollingTime = 0;
- }
-
- if(sameCntPollingTime >= 2)
- {
- tmp1b = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x1af);
- if(tmp1b != 0x0)
- {
- pCoexSta->c2hHangDetectCnt++;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x1af, 0x0);
- }
- }
-}
-
-//============================================================
-// extern function start with EXhalbtc8723a2ant_
-//============================================================
-VOID
-EXhalbtc8723a2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u4Byte u4Tmp=0;
- u1Byte u1Tmp=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
-
- // backup rf 0x1e value
- pCoexDm->btRf0x1eBackup =
- pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
-
- // Enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
-}
-
-VOID
-EXhalbtc8723a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- halbtc8723a2ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8723a2ant_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;
-
- 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);
-
- 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_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 / HsChnl(HsMode)", \
- wifiDot11Chnl, wifiHsChnl, bBtHsOn);
- 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_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8723A_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; i<BT_INFO_SRC_8723A_2ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723a2Ant[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 = %d", "write 0x1af=0x0 num", \
- pCoexSta->c2hHangDetectCnt);
- CL_PRINTF(cliBuf);
-
- // 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, 0x783);
- u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x796);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \
- u1Tmp[0], u1Tmp[1], u1Tmp[2]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
- u1Tmp[0]);
- 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, 0x484);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
- u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xdac);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \
- u4Tmp[0], u4Tmp[1], u4Tmp[2], u4Tmp[3]);
- CL_PRINTF(cliBuf);
-
- 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_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770 (hp rx[31:16]/tx[15:0])", \
- pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
- 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
-EXhalbtc8723a2ant_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"));
- halbtc8723a2ant_CoexAllOff(pBtCoexist);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- //halbtc8723a2ant_InitCoexDm(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8723a2ant_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"));
- }
- else if(BTC_LPS_DISABLE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));
- }
-}
-
-VOID
-EXhalbtc8723a2ant_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
-EXhalbtc8723a2ant_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
-EXhalbtc8723a2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- 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"));
- }
-
- halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, type);
-}
-
-VOID
-EXhalbtc8723a2ant_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
-EXhalbtc8723a2ant_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;
-
- pCoexSta->bC2hBtInfoReqSent = FALSE;
-
- rspSource = BT_INFO_SRC_8723A_2ANT_BT_RSP;
- pCoexSta->btInfoC2hCnt[rspSource]++;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));
- for(i=0; i<length; i++)
- {
- pCoexSta->btInfoC2h[rspSource][i] = tmpBuf[i];
- if(i == 0)
- 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]));
- }
- }
-
- if(BT_INFO_SRC_8723A_2ANT_WIFI_FW != rspSource)
- {
- pCoexSta->btRetryCnt =
- pCoexSta->btInfoC2h[rspSource][1];
-
- pCoexSta->btRssi =
- pCoexSta->btInfoC2h[rspSource][2]*2+10;
-
- pCoexSta->btInfoExt =
- pCoexSta->btInfoC2h[rspSource][3];
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8723A_2ANT_B_INQ_PAGE)
- {
- pCoexSta->bC2hBtInquiryPage = TRUE;
- }
- else
- {
- pCoexSta->bC2hBtInquiryPage = FALSE;
- }
-}
-
-VOID
-EXhalbtc8723a2ant_StackOperationNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- if(BTC_STACK_OP_INQ_PAGE_PAIR_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], StackOP Inquiry/page/pair start notify\n"));
- pCoexSta->bHoldForStackOperation = TRUE;
- pCoexSta->bHoldPeriodCnt = 1;
- halbtc8723a2ant_BtInquiryPage(pBtCoexist);
- }
- else if(BTC_STACK_OP_INQ_PAGE_PAIR_FINISH == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], StackOP Inquiry/page/pair finish notify\n"));
- pCoexSta->bHoldForStackOperation = FALSE;
- }
-}
-
-VOID
-EXhalbtc8723a2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- EXhalbtc8723a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8723a2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 2Ant Periodical!!\n"));
-
- // work around for c2h hang
- wa_halbtc8723a2ant_MonitorC2h(pBtCoexist);
-
- halbtc8723a2ant_QueryBtInfo(pBtCoexist);
- halbtc8723a2ant_MonitorBtCtr(pBtCoexist);
- halbtc8723a2ant_MonitorBtEnableDisable(pBtCoexist);
-
- halbtc8723a2ant_RunCoexistMechanism(pBtCoexist);
-}
-
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for RTL8723A Co-exist mechanism
+//
+// History
+// 2012/08/22 Cosa first check in.
+// 2012/11/14 Cosa Revise for 8723A 2Ant out sourcing.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8723A_2ANT GLCoexDm8723a2Ant;
+static PCOEX_DM_8723A_2ANT pCoexDm=&GLCoexDm8723a2Ant;
+static COEX_STA_8723A_2ANT GLCoexSta8723a2Ant;
+static PCOEX_STA_8723A_2ANT pCoexSta=&GLCoexSta8723a2Ant;
+
+const char *const GLBtInfoSrc8723a2Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8723a2ant_
+//============================================================
+BOOLEAN
+halbtc8723a2ant_IsWifiIdle(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ 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(bWifiConnected)
+ return FALSE;
+ if(bScan)
+ return FALSE;
+ if(bLink)
+ return FALSE;
+ if(bRoam)
+ return FALSE;
+
+ return TRUE;
+}
+
+u1Byte
+halbtc8723a2ant_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_8723A_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_8723A_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_8723A_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
+halbtc8723a2ant_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_8723A_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_8723A_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_8723A_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
+halbtc8723a2ant_IndicateWifiChnlBwInfo(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+ u4Byte wifiBw;
+ u1Byte wifiCentralChnl;
+
+ // 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;
+ }
+
+ 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 0x19=0x%x\n",
+ H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x19, 3, H2C_Parameter);
+}
+
+VOID
+halbtc8723a2ant_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 0x38=0x%x\n",
+ H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x38, 1, H2C_Parameter);
+}
+u1Byte
+halbtc8723a2ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ BOOLEAN bBtHsOn=FALSE, bBtBusy=FALSE, bLimitedDig=FALSE;
+ u1Byte algorithm=BT_8723A_2ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ //======================
+ // here we get BT status first
+ //======================
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_IDLE;
+
+ if((pStackInfo->bScoExist) ||(bBtHsOn) ||(pStackInfo->bHidExist))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO or HID or HS exists, set BT non-idle !!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
+ }
+ else
+ {
+ // A2dp profile
+ if( (pBtCoexist->stackInfo.numOfLink == 1) &&
+ (pStackInfo->bA2dpExist) )
+ {
+ if( (pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 100)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP, low priority tx+rx < 100, set BT connected-idle!!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP, low priority tx+rx >= 100, set BT non-idle!!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
+ }
+ }
+ // Pan profile
+ if( (pBtCoexist->stackInfo.numOfLink == 1) &&
+ (pStackInfo->bPanExist) )
+ {
+ if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, low priority tx+rx < 600, set BT connected-idle!!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
+ }
+ else
+ {
+ if(pCoexSta->lowPriorityTx)
+ {
+ if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, low priority rx/tx > 9, set BT connected-idle!!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
+ }
+ }
+ }
+ if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, set BT non-idle!!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
+ }
+ }
+ // Pan+A2dp profile
+ if( (pBtCoexist->stackInfo.numOfLink == 2) &&
+ (pStackInfo->bA2dpExist) &&
+ (pStackInfo->bPanExist) )
+ {
+ if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, low priority tx+rx < 600, set BT connected-idle!!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
+ }
+ else
+ {
+ if(pCoexSta->lowPriorityTx)
+ {
+ if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, low priority rx/tx > 9, set BT connected-idle!!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
+ }
+ }
+ }
+ if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, set BT non-idle!!!\n"));
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
+ }
+ }
+ }
+ if(BT_8723A_2ANT_BT_STATUS_IDLE != pCoexDm->btStatus)
+ {
+ bBtBusy = TRUE;
+ bLimitedDig = TRUE;
+ }
+ else
+ {
+ bBtBusy = FALSE;
+ bLimitedDig = FALSE;
+ }
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
+ //======================
+
+ 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_8723A_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pStackInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID;
+ }
+ else if(pStackInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8723A_2ANT_COEX_ALGO_A2DP;
+ }
+ else if(pStackInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
+ algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_HID;
+ }
+ else if(pStackInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;
+ }
+ else if(pStackInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
+ algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pStackInfo->bHidExist &&
+ pStackInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
+ algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
+ algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_HID;
+ }
+ else if( pStackInfo->bHidExist &&
+ pStackInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8723A_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_8723A_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+BOOLEAN
+halbtc8723a2ant_NeedToDecBtPwr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bRet=FALSE;
+ BOOLEAN bBtHsOn=FALSE, bWifiConnected=FALSE;
+ s4Byte btHsRssi=0;
+
+ 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;
+
+ 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
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], Need to decrease bt power for Wifi is connected!!\n"));
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+VOID
+halbtc8723a2ant_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 0x29=0x%x\n", H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x29, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723a2ant_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 0x21=0x%x\n",
+ (bDecBtPwr? "Yes!!":"No!!"), H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x21, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723a2ant_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;
+ }
+ halbtc8723a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr);
+
+ pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr;
+}
+
+VOID
+halbtc8723a2ant_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;
+ }
+
+ halbtc8723a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
+
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
+}
+
+VOID
+halbtc8723a2ant_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, 0xf0ff7);
+ }
+ 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
+halbtc8723a2ant_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;
+ }
+ halbtc8723a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
+
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
+}
+
+VOID
+halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ u1Byte tmpU1;
+
+ tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
+ tmpU1 |= BIT0;
+ if(bLowPenaltyRa)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
+ tmpU1 &= ~BIT2;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
+ tmpU1 |= BIT2;
+ }
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
+}
+
+VOID
+halbtc8723a2ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ return;
+ 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;
+ }
+ halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8723a2ant_SetSwFullTimeDacSwing(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSwDacSwingOn,
+ IN u4Byte swDacSwingLvl
+ )
+{
+ if(bSwDacSwingOn)
+ {
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, swDacSwingLvl);
+ }
+ else
+ {
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0);
+ }
+}
+
+
+VOID
+halbtc8723a2ant_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);
+ halbtc8723a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
+
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
+}
+
+VOID
+halbtc8723a2ant_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->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a07611);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a05611);
+ }
+}
+
+VOID
+halbtc8723a2ant_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;
+ }
+ halbtc8723a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
+
+ pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
+}
+
+VOID
+halbtc8723a2ant_SetAgcTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAgcTableEn
+ )
+{
+ u1Byte rssiAdjustVal=0;
+
+ if(bAgcTableEn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4e1c0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4d1d0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4c1e0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4b1f0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4a200001);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x90000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x51000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x12000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x00355);
+
+ rssiAdjustVal = 6;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x641c0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x631d0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x621e0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x611f0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x60200001);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x32000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x71000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xb0000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xfc000);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x30355);
+ }
+
+ // set rssiAdjustVal for wifi module.
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
+}
+
+
+VOID
+halbtc8723a2ant_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;
+ }
+ halbtc8723a2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
+
+ pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
+}
+
+VOID
+halbtc8723a2ant_SetCoexTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u4Byte val0x6c0,
+ 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 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
+halbtc8723a2ant_CoexTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u4Byte val0x6c0,
+ IN u4Byte val0x6c8,
+ IN u1Byte val0x6cc
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
+ (bForceExec? "force to":""), val0x6c0, val0x6c8, val0x6cc));
+ pCoexDm->curVal0x6c0 = val0x6c0;
+ pCoexDm->curVal0x6c8 = val0x6c8;
+ pCoexDm->curVal0x6cc = val0x6cc;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c0=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n",
+ pCoexDm->preVal0x6c0, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c0=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n",
+ pCoexDm->curVal0x6c0, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));
+
+ if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&
+ (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
+ (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
+ return;
+ }
+ halbtc8723a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8723a2ant_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 0x25=0x%x\n",
+ H2C_Parameter[0]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x25, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723a2ant_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;
+ }
+ halbtc8723a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8723a2ant_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};
+
+ H2C_Parameter[0] = byte1;
+ H2C_Parameter[1] = byte2;
+ H2C_Parameter[2] = byte3;
+ H2C_Parameter[3] = byte4;
+ H2C_Parameter[4] = byte5;
+
+ pCoexDm->psTdmaPara[0] = byte1;
+ pCoexDm->psTdmaPara[1] = byte2;
+ pCoexDm->psTdmaPara[2] = byte3;
+ pCoexDm->psTdmaPara[3] = byte4;
+ pCoexDm->psTdmaPara[4] = byte5;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x3a(5bytes)=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, 0x3a, 5, H2C_Parameter);
+}
+
+VOID
+halbtc8723a2ant_PsTdma(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bTurnOn,
+ IN u1Byte type
+ )
+{
+ u4Byte btTxRxCnt=0;
+
+ btTxRxCnt = pCoexSta->highPriorityTx+pCoexSta->highPriorityRx+
+ pCoexSta->lowPriorityTx+pCoexSta->lowPriorityRx;
+
+ if(btTxRxCnt > 3000)
+ {
+ pCoexDm->bCurPsTdmaOn = TRUE;
+ pCoexDm->curPsTdma = 8;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], turn ON PS TDMA, type=%d for BT tx/rx counters=%d(>3000)\n",
+ pCoexDm->curPsTdma, btTxRxCnt));
+ }
+ else
+ {
+ 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(pCoexDm->bCurPsTdmaOn)
+ {
+ switch(pCoexDm->curPsTdma)
+ {
+ case 1:
+ default:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98);
+ break;
+ case 2:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98);
+ break;
+ case 3:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98);
+ break;
+ case 4:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0xe1, 0x80);
+ break;
+ case 5:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98);
+ break;
+ case 6:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98);
+ break;
+ case 7:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98);
+ break;
+ case 8:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0x60, 0x80);
+ break;
+ case 9:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98);
+ break;
+ case 10:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98);
+ break;
+ case 11:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98);
+ break;
+ case 12:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98);
+ break;
+ case 13:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98);
+ break;
+ case 14:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98);
+ break;
+ case 15:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98);
+ break;
+ case 16:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x98);
+ break;
+ case 17:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x80);
+ break;
+ case 18:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98);
+ break;
+ case 19:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x98);
+ break;
+ case 20:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x98);
+ break;
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(pCoexDm->curPsTdma)
+ {
+ case 0:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
+ break;
+ case 1:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
+ break;
+ default:
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
+ break;
+ }
+ }
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+
+VOID
+halbtc8723a2ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // fw all off
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ // sw all off
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+
+ // hw all off
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+}
+
+VOID
+halbtc8723a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+ halbtc8723a2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0xffff, 0x3);
+ halbtc8723a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 0x20);
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE);
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+
+ halbtc8723a2ant_AgcTable(pBtCoexist, FORCE_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, FORCE_EXEC, FALSE);
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, FORCE_EXEC, FALSE);
+ halbtc8723a2ant_RfShrink(pBtCoexist, FORCE_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, FORCE_EXEC, FALSE, 0xc0);
+}
+
+VOID
+halbtc8723a2ant_BtInquiryPage(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bLowPwrDisable=TRUE;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+}
+
+VOID
+halbtc8723a2ant_BtEnableAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiConnected=FALSE;
+
+ // Here we need to resend some wifi info to BT
+ // because bt is reset and loss of the info.
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+}
+
+VOID
+halbtc8723a2ant_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, 0xc);
+}
+
+VOID
+halbtc8723a2ant_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)
+ {
+ halbtc8723a2ant_BtEnableAction(pBtCoexist);
+ }
+ }
+}
+
+BOOLEAN
+halbtc8723a2ant_IsCommonAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE;
+ BOOLEAN bLowPwrDisable=FALSE;
+
+ if(!pStackInfo->bBtLinkExist)
+ {
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+ }
+ else
+ {
+ bLowPwrDisable = TRUE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
+ BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + Bt idle!!\n"));
+
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+
+ bCommon = TRUE;
+ }
+ else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
+ (BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + BT idle!!\n"));
+
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+
+ bCommon = TRUE;
+ }
+ else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
+ (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + Bt connected idle!!\n"));
+
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+
+ bCommon = TRUE;
+ }
+ else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
+ (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + Bt connected idle!!\n"));
+
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+
+ bCommon = TRUE;
+ }
+ else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
+ (BT_8723A_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + BT non-idle!!\n"));
+
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + BT non-idle!!\n"));
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
+
+ bCommon = FALSE;
+ }
+
+ return bCommon;
+}
+VOID
+halbtc8723a2ant_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)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ }
+ else
+ {
+ if(bTxPause)
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else
+ {
+ halbtc8723a2ant_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 == 1)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_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)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_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)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_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)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_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)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_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)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723a2ant_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)
+ {
+ halbtc8723a2ant_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"));
+ }
+ }
+}
+
+// SCO only or SCO+PAN(HS)
+VOID
+halbtc8723a2ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1;
+ u4Byte wifiBw;
+
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ }
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+
+VOID
+halbtc8723a2ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1;
+ u4Byte wifiBw;
+
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ }
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8723a2ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+ else
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ }
+ else
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
+ }
+ }
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+ else
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ }
+ else
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+VOID
+halbtc8723a2ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ }
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+
+//PAN(HS) only
+VOID
+halbtc8723a2ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8723a2ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ }
+ }
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+VOID
+halbtc8723a2ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1;
+ u4Byte wifiBw;
+
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ }
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+ else
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8723a2ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ }
+ }
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+VOID
+halbtc8723a2ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 1);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 1);
+ }
+ }
+
+ // sw mechanism
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
+
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 1);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 1);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ else
+ {
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
+ }
+ }
+}
+
+VOID
+halbtc8723a2ant_RunCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ u1Byte btInfoOriginal=0, btRetryCnt=0;
+ u1Byte algorithm=0;
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Manual control!!!\n"));
+ return;
+ }
+
+ if(pStackInfo->bProfileNotified)
+ {
+ if(pCoexSta->bHoldForStackOperation)
+ {
+ // if bt inquiry/page/pair, do not execute.
+ return;
+ }
+
+ algorithm = halbtc8723a2ant_ActionAlgorithm(pBtCoexist);
+ if(pCoexSta->bHoldPeriodCnt && (BT_8723A_2ANT_COEX_ALGO_PANHS!=algorithm))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex],Hold BT inquiry/page scan setting (cnt = %d)!!\n",
+ pCoexSta->bHoldPeriodCnt));
+ if(pCoexSta->bHoldPeriodCnt >= 6)
+ {
+ pCoexSta->bHoldPeriodCnt = 0;
+ // next time the coexist parameters should be reset again.
+ }
+ else
+ pCoexSta->bHoldPeriodCnt++;
+ return;
+ }
+
+ pCoexDm->curAlgorithm = algorithm;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
+ if(halbtc8723a2ant_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_8723A_2ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
+ halbtc8723a2ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8723A_2ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
+ halbtc8723a2ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8723A_2ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
+ halbtc8723a2ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8723A_2ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
+ halbtc8723a2ant_ActionPanEdr(pBtCoexist);
+ break;
+ case BT_8723A_2ANT_COEX_ALGO_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
+ halbtc8723a2ant_ActionPanHs(pBtCoexist);
+ break;
+ case BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
+ halbtc8723a2ant_ActionPanEdrA2dp(pBtCoexist);
+ break;
+ case BT_8723A_2ANT_COEX_ALGO_PANEDR_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
+ halbtc8723a2ant_ActionPanEdrHid(pBtCoexist);
+ break;
+ case BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
+ halbtc8723a2ant_ActionHidA2dpPanEdr(pBtCoexist);
+ break;
+ case BT_8723A_2ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
+ halbtc8723a2ant_ActionHidA2dp(pBtCoexist);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
+ halbtc8723a2ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+ }
+}
+
+//============================================================
+// work around function start with wa_halbtc8723a2ant_
+//============================================================
+VOID
+wa_halbtc8723a2ant_MonitorC2h(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte tmp1b=0x0;
+ u4Byte curC2hTotalCnt=0x0;
+ static u4Byte preC2hTotalCnt=0x0, sameCntPollingTime=0x0;
+
+ curC2hTotalCnt+=pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8723A_2ANT_BT_RSP];
+
+ if(curC2hTotalCnt == preC2hTotalCnt)
+ {
+ sameCntPollingTime++;
+ }
+ else
+ {
+ preC2hTotalCnt = curC2hTotalCnt;
+ sameCntPollingTime = 0;
+ }
+
+ if(sameCntPollingTime >= 2)
+ {
+ tmp1b = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x1af);
+ if(tmp1b != 0x0)
+ {
+ pCoexSta->c2hHangDetectCnt++;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x1af, 0x0);
+ }
+ }
+}
+
+//============================================================
+// extern function start with EXhalbtc8723a2ant_
+//============================================================
+VOID
+EXhalbtc8723a2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u4Byte u4Tmp=0;
+ u1Byte u1Tmp=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
+
+ // backup rf 0x1e value
+ pCoexDm->btRf0x1eBackup =
+ pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
+
+ // Enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
+}
+
+VOID
+EXhalbtc8723a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ halbtc8723a2ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8723a2ant_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;
+
+ 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);
+
+ 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_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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, wifiHsChnl, bBtHsOn);
+ 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_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8723A_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; i<BT_INFO_SRC_8723A_2ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723a2Ant[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 = %d", "write 0x1af=0x0 num", \
+ pCoexSta->c2hHangDetectCnt);
+ CL_PRINTF(cliBuf);
+
+ // 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, 0x783);
+ u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x796);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \
+ u1Tmp[0], u1Tmp[1], u1Tmp[2]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
+ u1Tmp[0]);
+ 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, 0x484);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
+ u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xdac);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \
+ u4Tmp[0], u4Tmp[1], u4Tmp[2], u4Tmp[3]);
+ CL_PRINTF(cliBuf);
+
+ 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_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770 (hp rx[31:16]/tx[15:0])", \
+ pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
+ 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
+EXhalbtc8723a2ant_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"));
+ halbtc8723a2ant_CoexAllOff(pBtCoexist);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ //halbtc8723a2ant_InitCoexDm(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8723a2ant_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"));
+ }
+ else if(BTC_LPS_DISABLE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));
+ }
+}
+
+VOID
+EXhalbtc8723a2ant_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
+EXhalbtc8723a2ant_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
+EXhalbtc8723a2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ 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"));
+ }
+
+ halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, type);
+}
+
+VOID
+EXhalbtc8723a2ant_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
+EXhalbtc8723a2ant_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;
+
+ pCoexSta->bC2hBtInfoReqSent = FALSE;
+
+ rspSource = BT_INFO_SRC_8723A_2ANT_BT_RSP;
+ pCoexSta->btInfoC2hCnt[rspSource]++;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));
+ for(i=0; i<length; i++)
+ {
+ pCoexSta->btInfoC2h[rspSource][i] = tmpBuf[i];
+ if(i == 0)
+ 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]));
+ }
+ }
+
+ if(BT_INFO_SRC_8723A_2ANT_WIFI_FW != rspSource)
+ {
+ pCoexSta->btRetryCnt =
+ pCoexSta->btInfoC2h[rspSource][1];
+
+ pCoexSta->btRssi =
+ pCoexSta->btInfoC2h[rspSource][2]*2+10;
+
+ pCoexSta->btInfoExt =
+ pCoexSta->btInfoC2h[rspSource][3];
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8723A_2ANT_B_INQ_PAGE)
+ {
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ }
+ else
+ {
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+ }
+}
+
+VOID
+EXhalbtc8723a2ant_StackOperationNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ if(BTC_STACK_OP_INQ_PAGE_PAIR_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], StackOP Inquiry/page/pair start notify\n"));
+ pCoexSta->bHoldForStackOperation = TRUE;
+ pCoexSta->bHoldPeriodCnt = 1;
+ halbtc8723a2ant_BtInquiryPage(pBtCoexist);
+ }
+ else if(BTC_STACK_OP_INQ_PAGE_PAIR_FINISH == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], StackOP Inquiry/page/pair finish notify\n"));
+ pCoexSta->bHoldForStackOperation = FALSE;
+ }
+}
+
+VOID
+EXhalbtc8723a2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ EXhalbtc8723a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8723a2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 2Ant Periodical!!\n"));
+
+ // work around for c2h hang
+ wa_halbtc8723a2ant_MonitorC2h(pBtCoexist);
+
+ halbtc8723a2ant_QueryBtInfo(pBtCoexist);
+ halbtc8723a2ant_MonitorBtCtr(pBtCoexist);
+ halbtc8723a2ant_MonitorBtEnableDisable(pBtCoexist);
+
+ halbtc8723a2ant_RunCoexistMechanism(pBtCoexist);
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h
index c2733d8..584c95f 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h
@@ -1,179 +1,179 @@
-//===========================================
-// The following is for 8723A 2Ant BT Co-exist definition
-//===========================================
-#define BT_INFO_8723A_2ANT_B_FTP BIT7
-#define BT_INFO_8723A_2ANT_B_A2DP BIT6
-#define BT_INFO_8723A_2ANT_B_HID BIT5
-#define BT_INFO_8723A_2ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8723A_2ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8723A_2ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8723A_2ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8723A_2ANT_B_CONNECTION BIT0
-
-#define BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT 2
-
-typedef enum _BT_INFO_SRC_8723A_2ANT{
- BT_INFO_SRC_8723A_2ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8723A_2ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8723A_2ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8723A_2ANT_MAX
-}BT_INFO_SRC_8723A_2ANT,*PBT_INFO_SRC_8723A_2ANT;
-
-typedef enum _BT_8723A_2ANT_BT_STATUS{
- BT_8723A_2ANT_BT_STATUS_IDLE = 0x0,
- BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8723A_2ANT_BT_STATUS_NON_IDLE = 0x2,
- BT_8723A_2ANT_BT_STATUS_MAX
-}BT_8723A_2ANT_BT_STATUS,*PBT_8723A_2ANT_BT_STATUS;
-
-typedef enum _BT_8723A_2ANT_COEX_ALGO{
- BT_8723A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8723A_2ANT_COEX_ALGO_SCO = 0x1,
- BT_8723A_2ANT_COEX_ALGO_HID = 0x2,
- BT_8723A_2ANT_COEX_ALGO_A2DP = 0x3,
- BT_8723A_2ANT_COEX_ALGO_PANEDR = 0x4,
- BT_8723A_2ANT_COEX_ALGO_PANHS = 0x5,
- BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x6,
- BT_8723A_2ANT_COEX_ALGO_PANEDR_HID = 0x7,
- BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x8,
- BT_8723A_2ANT_COEX_ALGO_HID_A2DP = 0x9,
- BT_8723A_2ANT_COEX_ALGO_MAX
-}BT_8723A_2ANT_COEX_ALGO,*PBT_8723A_2ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8723A_2ANT{
- // fw mechanism
- BOOLEAN bPreDecBtPwr;
- BOOLEAN bCurDecBtPwr;
- //BOOLEAN bPreBtLnaConstrain;
- //BOOLEAN bCurBtLnaConstrain;
- //u1Byte bPreBtPsdMode;
- //u1Byte bCurBtPsdMode;
- u1Byte preFwDacSwingLvl;
- u1Byte curFwDacSwingLvl;
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- 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 preVal0x6c8;
- u4Byte curVal0x6c8;
- u1Byte preVal0x6cc;
- u1Byte curVal0x6cc;
- BOOLEAN bLimitedDig;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-} COEX_DM_8723A_2ANT, *PCOEX_DM_8723A_2ANT;
-
-typedef struct _COEX_STA_8723A_2ANT{
- u4Byte highPriorityTx;
- u4Byte highPriorityRx;
- u4Byte lowPriorityTx;
- u4Byte lowPriorityRx;
- u1Byte btRssi;
- u1Byte preBtRssiState;
- u1Byte preBtRssiState1;
- u1Byte preWifiRssiState[4];
- BOOLEAN bC2hBtInfoReqSent;
- u1Byte btInfoC2h[BT_INFO_SRC_8723A_2ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8723A_2ANT_MAX];
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
- BOOLEAN bHoldForStackOperation;
- u1Byte bHoldPeriodCnt;
- // this is for c2h hang work-around
- u4Byte c2hHangDetectCnt;
-}COEX_STA_8723A_2ANT, *PCOEX_STA_8723A_2ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8723a2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723a2ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a2ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a2ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a2ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a2ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723a2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723a2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8723a2ant_StackOperationNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723a2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-
+//===========================================
+// The following is for 8723A 2Ant BT Co-exist definition
+//===========================================
+#define BT_INFO_8723A_2ANT_B_FTP BIT7
+#define BT_INFO_8723A_2ANT_B_A2DP BIT6
+#define BT_INFO_8723A_2ANT_B_HID BIT5
+#define BT_INFO_8723A_2ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8723A_2ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8723A_2ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8723A_2ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8723A_2ANT_B_CONNECTION BIT0
+
+#define BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT 2
+
+typedef enum _BT_INFO_SRC_8723A_2ANT{
+ BT_INFO_SRC_8723A_2ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8723A_2ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8723A_2ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8723A_2ANT_MAX
+}BT_INFO_SRC_8723A_2ANT,*PBT_INFO_SRC_8723A_2ANT;
+
+typedef enum _BT_8723A_2ANT_BT_STATUS{
+ BT_8723A_2ANT_BT_STATUS_IDLE = 0x0,
+ BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8723A_2ANT_BT_STATUS_NON_IDLE = 0x2,
+ BT_8723A_2ANT_BT_STATUS_MAX
+}BT_8723A_2ANT_BT_STATUS,*PBT_8723A_2ANT_BT_STATUS;
+
+typedef enum _BT_8723A_2ANT_COEX_ALGO{
+ BT_8723A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8723A_2ANT_COEX_ALGO_SCO = 0x1,
+ BT_8723A_2ANT_COEX_ALGO_HID = 0x2,
+ BT_8723A_2ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8723A_2ANT_COEX_ALGO_PANEDR = 0x4,
+ BT_8723A_2ANT_COEX_ALGO_PANHS = 0x5,
+ BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x6,
+ BT_8723A_2ANT_COEX_ALGO_PANEDR_HID = 0x7,
+ BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x8,
+ BT_8723A_2ANT_COEX_ALGO_HID_A2DP = 0x9,
+ BT_8723A_2ANT_COEX_ALGO_MAX
+}BT_8723A_2ANT_COEX_ALGO,*PBT_8723A_2ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8723A_2ANT{
+ // fw mechanism
+ BOOLEAN bPreDecBtPwr;
+ BOOLEAN bCurDecBtPwr;
+ //BOOLEAN bPreBtLnaConstrain;
+ //BOOLEAN bCurBtLnaConstrain;
+ //u1Byte bPreBtPsdMode;
+ //u1Byte bCurBtPsdMode;
+ u1Byte preFwDacSwingLvl;
+ u1Byte curFwDacSwingLvl;
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ 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 preVal0x6c8;
+ u4Byte curVal0x6c8;
+ u1Byte preVal0x6cc;
+ u1Byte curVal0x6cc;
+ BOOLEAN bLimitedDig;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+} COEX_DM_8723A_2ANT, *PCOEX_DM_8723A_2ANT;
+
+typedef struct _COEX_STA_8723A_2ANT{
+ u4Byte highPriorityTx;
+ u4Byte highPriorityRx;
+ u4Byte lowPriorityTx;
+ u4Byte lowPriorityRx;
+ u1Byte btRssi;
+ u1Byte preBtRssiState;
+ u1Byte preBtRssiState1;
+ u1Byte preWifiRssiState[4];
+ BOOLEAN bC2hBtInfoReqSent;
+ u1Byte btInfoC2h[BT_INFO_SRC_8723A_2ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8723A_2ANT_MAX];
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+ BOOLEAN bHoldForStackOperation;
+ u1Byte bHoldPeriodCnt;
+ // this is for c2h hang work-around
+ u4Byte c2hHangDetectCnt;
+}COEX_STA_8723A_2ANT, *PCOEX_STA_8723A_2ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8723a2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723a2ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a2ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a2ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a2ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a2ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723a2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723a2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8723a2ant_StackOperationNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723a2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c
index 6105afc..04115b8 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c
@@ -1,3669 +1,3669 @@
-//============================================================
-// Description:
-//
-// This file is for RTL8723B Co-exist mechanism
-//
-// History
-// 2012/11/15 Cosa first check in.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8723B_1ANT GLCoexDm8723b1Ant;
-static PCOEX_DM_8723B_1ANT pCoexDm=&GLCoexDm8723b1Ant;
-static COEX_STA_8723B_1ANT GLCoexSta8723b1Ant;
-static PCOEX_STA_8723B_1ANT pCoexSta=&GLCoexSta8723b1Ant;
-
-const char *const GLBtInfoSrc8723b1Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-u4Byte GLCoexVerDate8723b1Ant=20140110;
-u4Byte GLCoexVer8723b1Ant=0x49;
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8723b1ant_
-//============================================================
-u1Byte
-halbtc8723b1ant_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_8723B_1ANT))
- {
- 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_8723B_1ANT))
- {
- 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_8723B_1ANT))
- {
- 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
-halbtc8723b1ant_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_8723B_1ANT))
- {
- 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_8723B_1ANT))
- {
- 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_8723B_1ANT))
- {
- 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
-halbtc8723b1ant_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
-halbtc8723b1ant_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
-halbtc8723b1ant_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
-halbtc8723b1ant_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;
- default:
- break;
- }
- }
-
- pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType;
-}
-
-VOID
-halbtc8723b1ant_LimitedTx(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte raMaskType,
- IN u1Byte arfrType,
- IN u1Byte retryLimitType,
- IN u1Byte ampduTimeType
- )
-{
- switch(raMaskType)
- {
- case 0: // normal mode
- halbtc8723b1ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0);
- break;
- case 1: // disable cck 1/2
- halbtc8723b1ant_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
- halbtc8723b1ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0001f1f7);
- break;
- default:
- break;
- }
-
- halbtc8723b1ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType);
- halbtc8723b1ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType);
- halbtc8723b1ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType);
-}
-
-VOID
-halbtc8723b1ant_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
-halbtc8723b1ant_MonitorBtCtr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u4Byte regHPTxRx, regLPTxRx, u4Tmp, u4Tmp1;
- u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0;
- u1Byte u1Tmp, u1Tmp1;
- s4Byte wifiRssi;
-
- 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;
-
- // reset counter
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);
-}
-
-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);
-}
-
-BOOLEAN
-halbtc8723b1ant_IsWifiStatusChanged(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
- BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
- BOOLEAN bWifiConnected=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
-
- if(bWifiConnected)
- {
- if(bWifiBusy != bPreWifiBusy)
- {
- bPreWifiBusy = bWifiBusy;
- return TRUE;
- }
- if(bUnder4way != bPreUnder4way)
- {
- bPreUnder4way = bUnder4way;
- return TRUE;
- }
- if(bBtHsOn != bPreBtHsOn)
- {
- bPreBtHsOn = bBtHsOn;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-VOID
-halbtc8723b1ant_UpdateBtLinkInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
- pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
- pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
- pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
- pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
-
- // work around for HS mode.
- if(bBtHsOn)
- {
- pBtLinkInfo->bPanExist = TRUE;
- pBtLinkInfo->bBtLinkExist = TRUE;
- }
-
- // check if Sco only
- if( pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bScoOnly = TRUE;
- else
- pBtLinkInfo->bScoOnly = FALSE;
-
- // check if A2dp only
- if( !pBtLinkInfo->bScoExist &&
- pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bA2dpOnly = TRUE;
- else
- pBtLinkInfo->bA2dpOnly = FALSE;
-
- // check if Pan only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bPanOnly = TRUE;
- else
- pBtLinkInfo->bPanOnly = FALSE;
-
- // check if Hid only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bHidExist )
- pBtLinkInfo->bHidOnly = TRUE;
- else
- pBtLinkInfo->bHidOnly = FALSE;
-}
-
-u1Byte
-halbtc8723b1ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8723B_1ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!pBtLinkInfo->bBtLinkExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
- return algorithm;
- }
-
- if(pBtLinkInfo->bScoExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bHidExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bPanExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bA2dpExist)
- numOfDiffProfile++;
-
- if(numOfDiffProfile == 1)
- {
- if(pBtLinkInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO only\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID only\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP only\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_A2DP;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = PAN(HS) only\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = PAN(EDR) only\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile == 2)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP ==> SCO\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_SCO;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + PAN(HS)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + PAN(EDR)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + PAN(HS)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + PAN(EDR)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP + PAN(HS)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP + PAN(EDR)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP;
- }
- }
- }
- }
- else if(numOfDiffProfile == 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + A2DP ==> HID\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_HID;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + PAN(HS)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP + PAN(HS)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP + PAN(HS)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile >= 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! BT Profile = SCO + HID + A2DP + PAN(HS)\n"));
-
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"));
- algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-VOID
-halbtc8723b1ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723b1ant_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;
- }
- halbtc8723b1ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
-
- pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
-}
-
-VOID
-halbtc8723b1ant_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
-halbtc8723b1ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa;
-
- if(!bForceExec)
- {
- if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa)
- return;
- }
- halbtc8723b1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8723b1ant_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
-halbtc8723b1ant_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, 0x6cc=0x%x\n",
- (bForceExec? "force to":""), val0x6c0, val0x6c4, 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;
- }
- halbtc8723b1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8723b1ant_CoexTableWithType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type
- )
-{
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], ********** CoexTable(%d) **********\n",
- type));
-
- switch(type)
- {
- case 0:
- halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffffff, 0x3);
- break;
- case 1:
- halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 2:
- halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 3:
- halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaaaaaa, 0xffffff, 0x3);
- break;
- case 4:
- halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3);
- break;
- case 5:
- halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaa5a5a, 0xffffff, 0x3);
- break;
- case 6:
- halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaa5a5a, 0xffffff, 0x3);
- break;
- case 7:
- halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff, 0x3);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8723b1ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723b1ant_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;
- }
- halbtc8723b1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- 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,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- u1Byte lps=lpsVal;
- u1Byte rpwm=rpwmVal;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
-}
-
-VOID
-halbtc8723b1ant_LpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bForceExecPwrCmd=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
- (bForceExec? "force to":""), lpsVal, rpwmVal));
- pCoexDm->curLps = lpsVal;
- pCoexDm->curRpwm = rpwmVal;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], LPS-RxBeaconMode=0x%x , LPS-RPWM=0x%x!!\n",
- pCoexDm->curLps, pCoexDm->curRpwm));
-
- if( (pCoexDm->preLps == pCoexDm->curLps) &&
- (pCoexDm->preRpwm == pCoexDm->curRpwm) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], LPS-RPWM_Last=0x%x , LPS-RPWM_Now=0x%x!!\n",
- pCoexDm->preRpwm, pCoexDm->curRpwm));
-
- return;
- }
- }
- halbtc8723b1ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
-
- pCoexDm->preLps = pCoexDm->curLps;
- pCoexDm->preRpwm = pCoexDm->curRpwm;
-}
-
-VOID
-halbtc8723b1ant_SwMechanism(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRA
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], SM[LpRA] = %d\n",
- bLowPenaltyRA));
-
- halbtc8723b1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
-}
-
-VOID
-halbtc8723b1ant_SetAntPath(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte antPosType,
- IN BOOLEAN bInitHwCfg,
- IN BOOLEAN bWifiOff
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- u4Byte fwVer=0, u4Tmp=0;
- BOOLEAN bPgExtSwitch=FALSE;
- BOOLEAN bUseExtSwitch=FALSE;
- u1Byte H2C_Parameter[2] ={0};
- PADAPTER padapter=pBtCoexist->Adapter;
- 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)
- bUseExtSwitch = TRUE;
-
- if(bInitHwCfg)
- {
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); //BT select s0/s1 is controlled by WiFi
-
- //Force GNT_BT to Normal
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x0);
-
- //set wlan_act control by PTA
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);
-
- //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
- }
- else if(bWifiOff)
- {
- //Force GNT_BT to High
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x3);
-
- //set wlan_act to always low
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
-
- if(padapter->registrypriv.mp_mode ==0)
- 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
-
- // 0x4c[24:23]=00, Set Antenna control by BT_RFE_CTRL BT Vendor 0xac=0xf002
- u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u4Tmp &= ~BIT23;
- u4Tmp &= ~BIT24;
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
- }
-
- if(bUseExtSwitch)
- {
- 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);
-
- 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
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
- }
- 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
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
- }
- }
-
- // 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
-
- // 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
- {
- if(bInitHwCfg)
- {
- // 0x4c[23]=1, 0x4c[24]=0 Antenna control by 0x64
- u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u4Tmp |= BIT23;
- u4Tmp &=~BIT24;
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
-
- 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;
- H2C_Parameter[1] = 0; //internal switch type
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
- }
- 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;
- H2C_Parameter[1] = 0; //internal switch type
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
- }
- }
-
- // 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
-
- // 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;
- }
- }
-}
-
-VOID
-halbtc8723b1ant_PsTdma(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bTurnOn,
- IN u1Byte type
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- BOOLEAN bTurnOnByCnt=FALSE, bWifiBusy=FALSE;
- u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=0;
- //u4Byte fwVer=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;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if (pCoexDm->bCurPsTdmaOn)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], ********** TDMA(on, %d) **********\n",
- pCoexDm->curPsTdma));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], ********** TDMA(off, %d) **********\n",
- pCoexDm->curPsTdma));
- }
-
- if(!bForceExec)
- {
- if( (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) &&
- (pCoexDm->prePsTdma == pCoexDm->curPsTdma) )
- return;
- }
- if(bTurnOn)
- {
- switch(type)
- {
- default:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1a, 0x1a, 0x0, 0x50);
- break;
- case 1:
- //if(bWifiBusy)
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x3a, 0x03, 0x10, 0x50);
- //else
- // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x3a, 0x03, 0x10, 0x51);
-
- rssiAdjustVal = 11;
- break;
- case 2:
- //if(bWifiBusy)
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x2b, 0x03, 0x10, 0x50);
- //else
- // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x2b, 0x03, 0x10, 0x51);
- rssiAdjustVal = 14;
- break;
- case 3:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1d, 0x1d, 0x0, 0x52);
- break;
- case 4:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
- rssiAdjustVal = 17;
- break;
- case 5:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x11, 0x10);
- break;
- case 6:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x20, 0x3, 0x11, 0x13);
- break;
- case 7:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0);
- break;
- case 8:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
- break;
- case 9:
- //if(bWifiBusy)
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x50);
- //else
- // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x50);
- rssiAdjustVal = 18;
- break;
- case 10:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40);
- break;
- case 11:
- //if(bWifiBusy)
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x15, 0x03, 0x10, 0x50);
- //else
- // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x15, 0x03, 0x10, 0x50);
- rssiAdjustVal = 20;
- break;
- case 12:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x0a, 0x0a, 0x0, 0x50);
- break;
- case 13:
- //halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x15, 0x15, 0x0, 0x50);
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x12, 0x12, 0x0, 0x50);
- break;
- case 14:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x52);
- 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);
- break;
- case 21:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x11);
- break;
- case 22:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x10);
- 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);
- break;
- case 29:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10);
- break;
- case 30:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x30, 0x3, 0x10, 0x10);
- break;
- case 31:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58);
- break;
- case 32:
- //halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0xa, 0x3, 0x10, 0x0);
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x35, 0x3, 0x11, 0x11);
- break;
- case 33:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90);
- break;
- case 34:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x53, 0x1a, 0x1a, 0x0, 0x10);
- break;
- case 35:
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x63, 0x1a, 0x1a, 0x0, 0x10);
- break;
- case 36:
- halbtc8723b1ant_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 */
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x23, 0x18, 0x00, 0x10, 0x24);
- break;
- }
- }
- else
- {
- //pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); // [31:16]=fw ver, [15:0]=fw sub ver
-
- // disable PS tdma
- switch(type)
- {
- case 8: //PTA Control
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
- 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_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
- break;
- case 9: //Software control, Antenna at WiFi side
- halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
- halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE);
- break;
- }
- }
- rssiAdjustVal =0;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal);
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-VOID
-halbtc8723b1ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // sw all off
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-
- // hw all off
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-BOOLEAN
-halbtc8723b1ant_IsCommonAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if(!bWifiConnected &&
- BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"));
-
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
-
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"));
-
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
-
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n"));
-
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else
- {
- if (bWifiBusy)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n"));
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
- }
-
- bCommon = FALSE;
- }
-
- return bCommon;
-}
-
-
-VOID
-halbtc8723b1ant_TdmaDurationAdjustForAcl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- static s4Byte up,dn,m,n,WaitCount;
- s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
- u1Byte retryCount=0, btInfoExt;
- static BOOLEAN bPreWifiBusy=FALSE;
- BOOLEAN bWifiBusy = FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjustForAcl()\n"));
-
- if(BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY == wifiStatus)
- bWifiBusy = TRUE;
- else
- bWifiBusy = FALSE;
-
- if( (BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
- (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
- (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
- {
- if( pCoexDm->curPsTdma != 1 &&
- pCoexDm->curPsTdma != 2 &&
- pCoexDm->curPsTdma != 3 &&
- pCoexDm->curPsTdma != 9 )
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
-
- up = 0;
- dn = 0;
- m = 1;
- n= 3;
- result = 0;
- WaitCount = 0;
- }
- return;
- }
-
- if(!pCoexDm->bAutoTdmaAdjust)
- {
- pCoexDm->bAutoTdmaAdjust = TRUE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
-
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- //============
- 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;
- btInfoExt = pCoexSta->btInfoExt;
- //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"));
- }
-
- if(result == -1)
- {
- if( (BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- else if(result == 1)
- {
- if( (BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- }
- else //no change
- {
- /* Bryant Modify
- if(bWifiBusy != bPreWifiBusy) //if busy / idle change
- {
- bPreWifiBusy = bWifiBusy;
- halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, pCoexDm->curPsTdma);
- }
- */
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], ********** TDMA(on, %d) **********\n",
- pCoexDm->curPsTdma));
- }
-
- if( pCoexDm->curPsTdma != 1 &&
- pCoexDm->curPsTdma != 2 &&
- pCoexDm->curPsTdma != 9 &&
- pCoexDm->curPsTdma != 11 )
- {
- // recover to previous adjust type
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
- }
- }
-}
-
-VOID
-halbtc8723b1ant_PsTdmaCheckForPowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bNewPsState
- )
-{
- u1Byte lpsMode=0x0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
-
- if(lpsMode) // already under LPS state
- {
- if(bNewPsState)
- {
- // keep state under LPS, do nothing.
- }
- else
- {
- // will leave LPS state, turn off psTdma first
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- }
- else // NO PS state
- {
- if(bNewPsState)
- {
- // will enter LPS state, turn off psTdma first
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- // keep state under NO PS state, do nothing.
- }
- }
-}
-
-VOID
-halbtc8723b1ant_PowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte psType,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bLowPwrDisable=FALSE;
-
- switch(psType)
- {
- case BTC_PS_WIFI_NATIVE:
- // recover to original 32k low power setting
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- break;
- case BTC_PS_LPS_ON:
- halbtc8723b1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
- halbtc8723b1ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
- // when coex force to enter LPS, do not enter 32k low power.
- bLowPwrDisable = TRUE;
- 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);
- break;
- case BTC_PS_LPS_OFF:
- halbtc8723b1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8723b1ant_ActionWifiOnly(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
-}
-
-VOID
-halbtc8723b1ant_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"));
- halbtc8723b1ant_ActionWifiOnly(pBtCoexist);
- }
- }
- 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
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- }
- }
-}
-
-//=============================================
-//
-// Software Coex Mechanism start
-//
-//=============================================
-
-// SCO only or SCO+PAN(HS)
-VOID
-halbtc8723b1ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-
-VOID
-halbtc8723b1ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8723b1ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-VOID
-halbtc8723b1ant_ActionA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-VOID
-halbtc8723b1ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-//PAN(HS) only
-VOID
-halbtc8723b1ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8723b1ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-VOID
-halbtc8723b1ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8723b1ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-VOID
-halbtc8723b1ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-//=============================================
-//
-// Non-Software Coex Mechanism start
-//
-//=============================================
-VOID
-halbtc8723b1ant_ActionWifiMultiPort(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-}
-
-VOID
-halbtc8723b1ant_ActionHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-}
-
-VOID
-halbtc8723b1ant_ActionBtInquiry(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bWifiConnected=FALSE, bApEnable=FALSE, bWifiBusy=FALSE, bBtBusy=FALSE;
-
- 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) )
- {
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
-
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if( (pBtLinkInfo->bScoExist) ||
- (pBtLinkInfo->bHidExist) )
- {
- // SCO/HID-only busy
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
-
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
- }
- else if ( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) || (bWifiBusy) )
- {
-
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
-
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
- }
- else
- {
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
-
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
- }
-
-}
-
-VOID
-halbtc8723b1ant_ActionBtScoHidOnlyBusy(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bWifiConnected=FALSE;
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- // tdma and coex table
-
- if(pBtLinkInfo->bScoExist)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- 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
-halbtc8723b1ant_ActionWifiConnectedBtAclBusy(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- u1Byte btRssiState;
-
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- btRssiState = halbtc8723b1ant_BtRssiState(2, 28, 0);
-
- if(pBtLinkInfo->bHidOnly) //HID
- {
- halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- return;
- }
- else if(pBtLinkInfo->bA2dpOnly) //A2DP
- {
- 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);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- 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);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- else
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
-}
-
-VOID
-halbtc8723b1ant_ActionWifiNotConnected(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // power save state
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-VOID
-halbtc8723b1ant_ActionWifiNotConnectedScan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
-
- // tdma and coex table
- if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- if(pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else if(pBtLinkInfo->bPanOnly)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- else
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- }
- else if( (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN);
- }
- else
- {
- //halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- //halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
-
- //Bryant Add
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
-}
-
-VOID
-halbtc8723b1ant_ActionWifiNotConnectedAssoAuth(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) )
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
- }
- else if( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) )
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
- }
- else
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
-
-}
-
-VOID
-halbtc8723b1ant_ActionWifiConnectedScan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- if(pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else if(pBtLinkInfo->bPanOnly)
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- else
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- }
- else if( (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN);
- }
- else
- {
- //halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- //halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
-
- //Bryant Add
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
-}
-
-VOID
-halbtc8723b1ant_ActionWifiConnectedSpecialPacket(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) )
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
- }
- else if( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) )
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
- }
- else
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
-}
-
-VOID
-halbtc8723b1ant_ActionWifiConnected(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiBusy=FALSE;
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
- BOOLEAN bUnder4way=FALSE, bApEnable=FALSE;
- u4Byte wifiBw;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n"));
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
- if(bUnder4way)
- {
- halbtc8723b1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n"));
- return;
- }
-
- 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)
- {
- if(bScan)
- halbtc8723b1ant_ActionWifiConnectedScan(pBtCoexist);
- else
- halbtc8723b1ant_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(!bApEnable && BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
- {
- if(!bWifiBusy && pBtCoexist->btLinkInfo.bA2dpOnly) //A2DP
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- else
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);
- }
- else
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- if(!bWifiBusy)
- {
- if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8723b1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE);
- }
- else if( (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE);
- }
- else
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- }
- else
- {
- if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8723b1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY);
- }
- else if( (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY);
- }
- else
- {
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- }
-}
-
-VOID
-halbtc8723b1ant_RunSwCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte algorithm=0;
-
- algorithm = halbtc8723b1ant_ActionAlgorithm(pBtCoexist);
- pCoexDm->curAlgorithm = algorithm;
-
- if(halbtc8723b1ant_IsCommonAction(pBtCoexist))
- {
-
- }
- else
- {
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8723B_1ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n"));
- 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);
- break;
- case BT_8723B_1ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n"));
- 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);
- break;
- case BT_8723B_1ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n"));
- 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);
- 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);
- 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);
- 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);
- 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);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n"));
- //halbtc8723b1ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
-}
-
-VOID
-halbtc8723b1ant_RunCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
- BOOLEAN bIncreaseScanDevNum=FALSE;
- BOOLEAN bBtCtrlAggBufSize=FALSE;
- u1Byte aggBufSize=5;
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiLinkStatus=0;
- u4Byte numOfWifiLink=0;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
- return;
- }
-
- if(pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n"));
- return;
- }
-
- if(pCoexSta->bUnderIps)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
- return;
- }
-
- if( (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- bIncreaseScanDevNum = TRUE;
- }
-
- 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)
- {
- halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
- halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
- halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist);
- return;
- }
-
- if(!pBtLinkInfo->bScoExist && !pBtLinkInfo->bHidExist)
- {
- halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
- }
- else
- {
- if(bWifiConnected)
- {
- 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);
- }
- }
- 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_RunSwCoexistMechanism(pBtCoexist);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8723b1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8723b1ant_ActionHs(pBtCoexist);
- return;
- }
-
-
- if(!bWifiConnected)
- {
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n"));
-
- 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)
- {
- if (bScan)
- halbtc8723b1ant_ActionWifiNotConnectedScan(pBtCoexist);
- else
- halbtc8723b1ant_ActionWifiNotConnectedAssoAuth(pBtCoexist);
- }
- else
- halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else // wifi LPS/Busy
- {
- halbtc8723b1ant_ActionWifiConnected(pBtCoexist);
- }
-}
-
-VOID
-halbtc8723b1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
-
- // sw all off
- halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
-
- //halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-}
-
-VOID
-halbtc8723b1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bBackUp
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- u4Byte u4Tmp=0;//, fwVer;
- u2Byte u2Tmp=0;
- u1Byte u1Tmp=0;
- u1Byte H2C_Parameter[2] ={0};
- u4Byte cntBtCalChk=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
-
- if(bBackUp)
- {
- pCoexDm->backupArfrCnt1 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
- pCoexDm->backupArfrCnt2 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
- pCoexDm->backupRetryLimit = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
- pCoexDm->backupAmpduMaxTime = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
- }
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); //WiFi goto standby while GNT_BT 0-->1
- //pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 0x3c, 0x15); //BT goto standby while GNT_BT 1-->0
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x974, 0xff);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x944, 0x3, 0x3);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x930, 0x77);
-
- //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); //BT select s0/s1 is controlled by WiFi
-
- // BT calibration check
- while(cntBtCalChk <= 20)
- {
- u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x49d);
- cntBtCalChk++;
- if(u4Tmp & BIT0)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ########### BT calibration(cnt=%d) ###########\n", cntBtCalChk));
- delay_ms(50);
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ********** BT NOT calibration (cnt=%d)**********\n", cntBtCalChk));
- break;
- }
- }
-
- // 0x790[5:0]=0x5
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
- u1Tmp &= 0xc0;
- u1Tmp |= 0x5;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
-
- // Enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); //0x76e[3] =1, WLAN_Act control by PTA
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1);
-
- //Antenna config
- //halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, TRUE, FALSE);
- halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE);
-
- // PTA parameter
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-}
-
-VOID
-halbtc8723b1ant_WifiOffHwCfg(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // set wlan_act to low
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
-}
-
-//============================================================
-// work around function start with wa_halbtc8723b1ant_
-//============================================================
-//============================================================
-// extern function start with EXhalbtc8723b1ant_
-//============================================================
-VOID
-EXhalbtc8723b1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8723b1ant_InitHwConfig(pBtCoexist, TRUE);
-}
-
-VOID
-EXhalbtc8723b1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- pBtCoexist->bStopCoexDm = FALSE;
-
- halbtc8723b1ant_InitCoexDm(pBtCoexist);
-
- halbtc8723b1ant_QueryBtInfo(pBtCoexist);
-}
-
-VOID
-EXhalbtc8723b1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- pu1Byte cliBuf=pBtCoexist->cliBuf;
- u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0;
- u2Byte u2Tmp[4];
- 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, faOfdm, faCck, wifiLinkStatus;
- u1Byte wifiDot11Chnl, wifiHsChnl;
- u4Byte fwVer=0, btPatchVer=0;
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============");
- CL_PRINTF(cliBuf);
-
- if(pBtCoexist->bManualControl)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- CL_PRINTF(cliBuf);
- }
- if(pBtCoexist->bStopCoexDm)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- 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);
-
- 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_%x/ 0x%x/ 0x%x(%d)", "CoexVer/ FwVer/ PatchVer", \
- GLCoexVerDate8723b1Ant, GLCoexVer8723b1Ant, 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 / HsChnl(HsMode)", \
- wifiDot11Chnl, wifiHsChnl, bBtHsOn);
- 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);
-
- 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_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);
- CL_PRINTF(cliBuf);
-
-
- 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);
- 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; i<BT_INFO_SRC_8723B_1ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723b1Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
- ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
- ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
- pBtCoexist->btInfo.lpsVal,
- pBtCoexist->btInfo.rpwmVal);
- CL_PRINTF(cliBuf);
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
-
- if(!pBtCoexist->bManualControl)
- {
- // 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", "SM[LowPenaltyRA]", \
- pCoexDm->bCurLowPenaltyRa);
- CL_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s/ %d ", "DelBA/ BtCtrlAgg/ AggSize", \
- (pBtCoexist->btInfo.bRejectAggPkt? "Yes":"No"), (pBtCoexist->btInfo.bBtCtrlAggBufSize? "Yes":"No"),
- pBtCoexist->btInfo.aggBufSize);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
- pBtCoexist->btInfo.raMask);
- CL_PRINTF(cliBuf);
-
- // Fw mechanism
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
- CL_PRINTF(cliBuf);
-
- psTdmaCase = pCoexDm->curPsTdma;
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
- pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
- pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
- pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust);
- 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
- 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/0x%x/0x%x/0x%x", "backup ARFR1/ARFR2/RL/AMaxTime", \
- pCoexDm->backupArfrCnt1, pCoexDm->backupArfrCnt2, pCoexDm->backupRetryLimit, pCoexDm->backupAmpduMaxTime);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
- u2Tmp[0] = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "0x430/0x434/0x42a/0x456", \
- u4Tmp[0], u4Tmp[1], u2Tmp[0], u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6cc);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/0x6cc/0x880[29:25]", \
- u1Tmp[0], u4Tmp[0], (u4Tmp[1]&0x3e000000) >> 25);
- CL_PRINTF(cliBuf);
-
- 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]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x92c);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x944);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x92c[1:0]/ 0x930[7:0]/0x944[1:0]", \
- u4Tmp[0]&0x3, u4Tmp[1]&0xff, u4Tmp[2]&0x3);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x39);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x64);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x38[11]/0x40/0x4c[24:23]/0x64[0]", \
- ((u1Tmp[0] & 0x8)>>3), u1Tmp[1], ((u4Tmp[0]&0x01800000)>>23), u1Tmp[2]&0x1);
- 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, 0x49c);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xc50(dig)/0x49c(null-drop)", \
- u4Tmp[0]&0xff, u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
- u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xcf0);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5b);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5c);
-
- faOfdm = ((u4Tmp[0]&0xffff0000) >> 16) + ((u4Tmp[1]&0xffff0000) >> 16) + (u4Tmp[1] & 0xffff) + (u4Tmp[2] & 0xffff) + \
- ((u4Tmp[3]&0xffff0000) >> 16) + (u4Tmp[3] & 0xffff) ;
- faCck = (u1Tmp[0] << 8) + u1Tmp[1];
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "OFDM-CCA/OFDM-FA/CCK-FA", \
- u4Tmp[0]&0xffff, faOfdm, faCck);
- 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(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)", \
- 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);
-#if(BT_AUTO_REPORT_ONLY_8723B_1ANT == 1)
- halbtc8723b1ant_MonitorBtCtr(pBtCoexist);
-#endif
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8723b1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u4Byte u4Tmp=0;
-
- if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
- return;
-
- if(BTC_IPS_ENTER == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n"));
- pCoexSta->bUnderIps = TRUE;
- halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8723b1ant_WifiOffHwCfg(pBtCoexist);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- pCoexSta->bUnderIps = FALSE;
- //halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, TRUE, FALSE);
- //halbtc8723b1ant_RunCoexistMechanism(pBtCoexist);
-
- halbtc8723b1ant_InitHwConfig(pBtCoexist, FALSE);
- halbtc8723b1ant_InitCoexDm(pBtCoexist);
- halbtc8723b1ant_QueryBtInfo(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8723b1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
- return;
-
- 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
-EXhalbtc8723b1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- 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;
-
- 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"));
- }
- else
- {
- pCoexSta->bWiFiIsHighPriTask = FALSE;
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
- }
-
- halbtc8723b1ant_QueryBtInfo(pBtCoexist);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus);
- numOfWifiLink = wifiLinkStatus>>16;
- if(numOfWifiLink >= 2)
- {
- halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
- halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
- halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist);
- return;
- }
-
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8723b1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8723b1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if(BTC_SCAN_START == type)
- {
- //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8723b1ant_ActionWifiNotConnectedScan(pBtCoexist);
- }
- else // wifi is connected
- {
- halbtc8723b1ant_ActionWifiConnectedScan(pBtCoexist);
- }
- }
- else if(BTC_SCAN_FINISH == type)
- {
- //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8723b1ant_ActionWifiConnected(pBtCoexist);
- }
- }
-}
-
-VOID
-EXhalbtc8723b1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- 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"));
- }
- else
- {
- pCoexSta->bWiFiIsHighPriTask = FALSE;
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n"));
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus);
- numOfWifiLink = wifiLinkStatus>>16;
- if(numOfWifiLink >= 2)
- {
- halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
- halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
- halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist);
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8723b1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8723b1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if(BTC_ASSOCIATE_START == type)
- {
- //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
- halbtc8723b1ant_ActionWifiNotConnectedAssoAuth(pBtCoexist);
- }
- else if(BTC_ASSOCIATE_FINISH == type)
- {
- //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
- {
- halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8723b1ant_ActionWifiConnected(pBtCoexist);
- }
- }
-}
-
-VOID
-EXhalbtc8723b1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u1Byte H2C_Parameter[3] ={0};
- u4Byte wifiBw;
- u1Byte wifiCentralChnl;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- 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[0] = 0x0;
- 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;
- }
-
- 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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
-}
-
-VOID
-EXhalbtc8723b1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- 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)
- {
- halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
- halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
- halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist);
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8723b1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8723b1ant_ActionHs(pBtCoexist);
- return;
- }
-
- 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));
- halbtc8723b1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8723b1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- u1Byte btInfo=0;
- u1Byte i, rspSource=0;
- BOOLEAN bWifiConnected=FALSE;
- BOOLEAN bBtBusy=FALSE;
-
- pCoexSta->bC2hBtInfoReqSent = FALSE;
-
- rspSource = tmpBuf[0]&0xf;
- if(rspSource >= BT_INFO_SRC_8723B_1ANT_MAX)
- rspSource = BT_INFO_SRC_8723B_1ANT_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; i<length; i++)
- {
- 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]));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
- }
-
- }
-
- if(BT_INFO_SRC_8723B_1ANT_WIFI_FW != rspSource)
- {
- 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];
-
- if (!(pCoexSta->btInfoC2h[rspSource][2] & 0x40))
- {
- /* BT into is responded by BT FW and BT RF REG 0x3C != 0x15 => Need to switch GNT_BT */
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Switch GNT_BT since BT RF REG 0x3C != 0x15\n"));
- pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 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)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- EXhalbtc8723b1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- EXhalbtc8723b1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
- }
-
- if(pCoexSta->btInfoExt & BIT3)
- {
- if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
- halbtc8723b1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
- }
- }
- else
- {
- // BT already NOT ignore Wlan active, do nothing here.
- }
-#if(BT_AUTO_REPORT_ONLY_8723B_1ANT == 0)
- if( (pCoexSta->btInfoExt & BIT4) )
- {
- // BT auto report already enabled, do nothing
- }
- else
- {
- halbtc8723b1ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
- }
-#endif
- }
-
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8723B_1ANT_B_INQ_PAGE)
- pCoexSta->bC2hBtInquiryPage = TRUE;
- else
- pCoexSta->bC2hBtInquiryPage = FALSE;
-
- // set link exist status
- if(!(btInfo&BT_INFO_8723B_1ANT_B_CONNECTION))
- {
- pCoexSta->bBtLinkExist = FALSE;
- pCoexSta->bPanExist = FALSE;
- pCoexSta->bA2dpExist = FALSE;
- pCoexSta->bHidExist = FALSE;
- pCoexSta->bScoExist = FALSE;
- }
- else // connection exists
- {
- pCoexSta->bBtLinkExist = TRUE;
- if(btInfo & BT_INFO_8723B_1ANT_B_FTP)
- pCoexSta->bPanExist = TRUE;
- else
- pCoexSta->bPanExist = FALSE;
- if(btInfo & BT_INFO_8723B_1ANT_B_A2DP)
- pCoexSta->bA2dpExist = TRUE;
- else
- pCoexSta->bA2dpExist = FALSE;
- if(btInfo & BT_INFO_8723B_1ANT_B_HID)
- pCoexSta->bHidExist = TRUE;
- else
- pCoexSta->bHidExist = FALSE;
- if(btInfo & BT_INFO_8723B_1ANT_B_SCO_ESCO)
- pCoexSta->bScoExist = TRUE;
- else
- pCoexSta->bScoExist = FALSE;
- }
-
- halbtc8723b1ant_UpdateBtLinkInfo(pBtCoexist);
-
- if(!(btInfo&BT_INFO_8723B_1ANT_B_CONNECTION))
- {
- pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
- }
- else if(btInfo == BT_INFO_8723B_1ANT_B_CONNECTION) // connection exists but no busy
- {
- pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
- }
- else if((btInfo&BT_INFO_8723B_1ANT_B_SCO_ESCO) ||
- (btInfo&BT_INFO_8723B_1ANT_B_SCO_BUSY))
- {
- pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_SCO_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
- }
- else if(btInfo&BT_INFO_8723B_1ANT_B_ACL_BUSY)
- {
- if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
- pCoexDm->bAutoTdmaAdjust = FALSE;
- pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_ACL_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
- }
- else
- {
- pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_MAX;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
- }
-
- if( (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- bBtBusy = TRUE;
- else
- bBtBusy = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
-
- halbtc8723b1ant_RunCoexistMechanism(pBtCoexist);
-}
-
-VOID
-EXhalbtc8723b1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u4Byte u4Tmp;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- pBtCoexist->bStopCoexDm = TRUE;
-
- halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
- halbtc8723b1ant_WifiOffHwCfg(pBtCoexist);
- halbtc8723b1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
-
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
-
- EXhalbtc8723b1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8723b1ant_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"));
- pBtCoexist->bStopCoexDm = TRUE;
- /*
- halbtc8723b1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- */
-
- halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
- halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8723b1ant_WifiOffHwCfg(pBtCoexist);
- }
- 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;
- halbtc8723b1ant_InitHwConfig(pBtCoexist, FALSE);
- halbtc8723b1ant_InitCoexDm(pBtCoexist);
- halbtc8723b1ant_QueryBtInfo(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8723b1ant_CoexDmReset(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], *****************Coex DM Reset*****************\n"));
-
- halbtc8723b1ant_InitHwConfig(pBtCoexist, FALSE);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x2, 0xfffff, 0x0);
- halbtc8723b1ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8723b1ant_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", \
- GLCoexVerDate8723b1Ant, GLCoexVer8723b1Ant, fwVer, btPatchVer, btPatchVer));
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
- }
-
-#if(BT_AUTO_REPORT_ONLY_8723B_1ANT == 0)
- halbtc8723b1ant_QueryBtInfo(pBtCoexist);
- halbtc8723b1ant_MonitorBtCtr(pBtCoexist);
- halbtc8723b1ant_MonitorBtEnableDisable(pBtCoexist);
-#else
- if( halbtc8723b1ant_IsWifiStatusChanged(pBtCoexist) ||
- pCoexDm->bAutoTdmaAdjust )
- {
- //if(pCoexSta->specialPktPeriodCnt > 2)
- //{
- halbtc8723b1ant_RunCoexistMechanism(pBtCoexist);
- //}
- }
-
- pCoexSta->specialPktPeriodCnt++;
-#endif
-}
-
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for RTL8723B Co-exist mechanism
+//
+// History
+// 2012/11/15 Cosa first check in.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8723B_1ANT GLCoexDm8723b1Ant;
+static PCOEX_DM_8723B_1ANT pCoexDm=&GLCoexDm8723b1Ant;
+static COEX_STA_8723B_1ANT GLCoexSta8723b1Ant;
+static PCOEX_STA_8723B_1ANT pCoexSta=&GLCoexSta8723b1Ant;
+
+const char *const GLBtInfoSrc8723b1Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+u4Byte GLCoexVerDate8723b1Ant=20140110;
+u4Byte GLCoexVer8723b1Ant=0x49;
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8723b1ant_
+//============================================================
+u1Byte
+halbtc8723b1ant_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_8723B_1ANT))
+ {
+ 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_8723B_1ANT))
+ {
+ 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_8723B_1ANT))
+ {
+ 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
+halbtc8723b1ant_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_8723B_1ANT))
+ {
+ 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_8723B_1ANT))
+ {
+ 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_8723B_1ANT))
+ {
+ 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
+halbtc8723b1ant_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
+halbtc8723b1ant_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
+halbtc8723b1ant_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
+halbtc8723b1ant_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;
+ default:
+ break;
+ }
+ }
+
+ pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType;
+}
+
+VOID
+halbtc8723b1ant_LimitedTx(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte raMaskType,
+ IN u1Byte arfrType,
+ IN u1Byte retryLimitType,
+ IN u1Byte ampduTimeType
+ )
+{
+ switch(raMaskType)
+ {
+ case 0: // normal mode
+ halbtc8723b1ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0);
+ break;
+ case 1: // disable cck 1/2
+ halbtc8723b1ant_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
+ halbtc8723b1ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0001f1f7);
+ break;
+ default:
+ break;
+ }
+
+ halbtc8723b1ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType);
+ halbtc8723b1ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType);
+ halbtc8723b1ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType);
+}
+
+VOID
+halbtc8723b1ant_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
+halbtc8723b1ant_MonitorBtCtr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u4Byte regHPTxRx, regLPTxRx, u4Tmp, u4Tmp1;
+ u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0;
+ u1Byte u1Tmp, u1Tmp1;
+ s4Byte wifiRssi;
+
+ 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;
+
+ // reset counter
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);
+}
+
+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);
+}
+
+BOOLEAN
+halbtc8723b1ant_IsWifiStatusChanged(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
+ BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+
+ if(bWifiConnected)
+ {
+ if(bWifiBusy != bPreWifiBusy)
+ {
+ bPreWifiBusy = bWifiBusy;
+ return TRUE;
+ }
+ if(bUnder4way != bPreUnder4way)
+ {
+ bPreUnder4way = bUnder4way;
+ return TRUE;
+ }
+ if(bBtHsOn != bPreBtHsOn)
+ {
+ bPreBtHsOn = bBtHsOn;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+VOID
+halbtc8723b1ant_UpdateBtLinkInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
+ pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
+ pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
+ pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
+
+ // work around for HS mode.
+ if(bBtHsOn)
+ {
+ pBtLinkInfo->bPanExist = TRUE;
+ pBtLinkInfo->bBtLinkExist = TRUE;
+ }
+
+ // check if Sco only
+ if( pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bScoOnly = TRUE;
+ else
+ pBtLinkInfo->bScoOnly = FALSE;
+
+ // check if A2dp only
+ if( !pBtLinkInfo->bScoExist &&
+ pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bA2dpOnly = TRUE;
+ else
+ pBtLinkInfo->bA2dpOnly = FALSE;
+
+ // check if Pan only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bPanOnly = TRUE;
+ else
+ pBtLinkInfo->bPanOnly = FALSE;
+
+ // check if Hid only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bHidOnly = TRUE;
+ else
+ pBtLinkInfo->bHidOnly = FALSE;
+}
+
+u1Byte
+halbtc8723b1ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8723B_1ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!pBtLinkInfo->bBtLinkExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
+ return algorithm;
+ }
+
+ if(pBtLinkInfo->bScoExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bHidExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bPanExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bA2dpExist)
+ numOfDiffProfile++;
+
+ if(numOfDiffProfile == 1)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO only\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID only\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP only\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_A2DP;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = PAN(HS) only\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = PAN(EDR) only\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 2)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_SCO;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + PAN(HS)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + PAN(EDR)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + PAN(HS)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + PAN(EDR)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP + PAN(HS)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP + PAN(EDR)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + A2DP ==> HID\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_HID;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + PAN(HS)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP + PAN(HS)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP + PAN(HS)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile >= 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! BT Profile = SCO + HID + A2DP + PAN(HS)\n"));
+
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"));
+ algorithm = BT_8723B_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+VOID
+halbtc8723b1ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723b1ant_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;
+ }
+ halbtc8723b1ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
+
+ pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
+}
+
+VOID
+halbtc8723b1ant_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
+halbtc8723b1ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa;
+
+ if(!bForceExec)
+ {
+ if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa)
+ return;
+ }
+ halbtc8723b1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8723b1ant_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
+halbtc8723b1ant_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, 0x6cc=0x%x\n",
+ (bForceExec? "force to":""), val0x6c0, val0x6c4, 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;
+ }
+ halbtc8723b1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8723b1ant_CoexTableWithType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type
+ )
+{
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], ********** CoexTable(%d) **********\n",
+ type));
+
+ switch(type)
+ {
+ case 0:
+ halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffffff, 0x3);
+ break;
+ case 1:
+ halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 2:
+ halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 3:
+ halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaaaaaa, 0xffffff, 0x3);
+ break;
+ case 4:
+ halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3);
+ break;
+ case 5:
+ halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaa5a5a, 0xffffff, 0x3);
+ break;
+ case 6:
+ halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaa5a5a, 0xffffff, 0x3);
+ break;
+ case 7:
+ halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff, 0x3);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8723b1ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723b1ant_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;
+ }
+ halbtc8723b1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ 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,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ u1Byte lps=lpsVal;
+ u1Byte rpwm=rpwmVal;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
+}
+
+VOID
+halbtc8723b1ant_LpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bForceExecPwrCmd=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
+ (bForceExec? "force to":""), lpsVal, rpwmVal));
+ pCoexDm->curLps = lpsVal;
+ pCoexDm->curRpwm = rpwmVal;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], LPS-RxBeaconMode=0x%x , LPS-RPWM=0x%x!!\n",
+ pCoexDm->curLps, pCoexDm->curRpwm));
+
+ if( (pCoexDm->preLps == pCoexDm->curLps) &&
+ (pCoexDm->preRpwm == pCoexDm->curRpwm) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], LPS-RPWM_Last=0x%x , LPS-RPWM_Now=0x%x!!\n",
+ pCoexDm->preRpwm, pCoexDm->curRpwm));
+
+ return;
+ }
+ }
+ halbtc8723b1ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
+
+ pCoexDm->preLps = pCoexDm->curLps;
+ pCoexDm->preRpwm = pCoexDm->curRpwm;
+}
+
+VOID
+halbtc8723b1ant_SwMechanism(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRA
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], SM[LpRA] = %d\n",
+ bLowPenaltyRA));
+
+ halbtc8723b1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
+}
+
+VOID
+halbtc8723b1ant_SetAntPath(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte antPosType,
+ IN BOOLEAN bInitHwCfg,
+ IN BOOLEAN bWifiOff
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ u4Byte fwVer=0, u4Tmp=0;
+ BOOLEAN bPgExtSwitch=FALSE;
+ BOOLEAN bUseExtSwitch=FALSE;
+ u1Byte H2C_Parameter[2] ={0};
+ PADAPTER padapter=pBtCoexist->Adapter;
+ 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)
+ bUseExtSwitch = TRUE;
+
+ if(bInitHwCfg)
+ {
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); //BT select s0/s1 is controlled by WiFi
+
+ //Force GNT_BT to Normal
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x0);
+
+ //set wlan_act control by PTA
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);
+
+ //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+ }
+ else if(bWifiOff)
+ {
+ //Force GNT_BT to High
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x3);
+
+ //set wlan_act to always low
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+
+ if(padapter->registrypriv.mp_mode ==0)
+ 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
+
+ // 0x4c[24:23]=00, Set Antenna control by BT_RFE_CTRL BT Vendor 0xac=0xf002
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u4Tmp &= ~BIT23;
+ u4Tmp &= ~BIT24;
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
+ }
+
+ if(bUseExtSwitch)
+ {
+ 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);
+
+ 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
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
+ }
+ 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
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
+ }
+ }
+
+ // 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
+
+ // 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
+ {
+ if(bInitHwCfg)
+ {
+ // 0x4c[23]=1, 0x4c[24]=0 Antenna control by 0x64
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u4Tmp |= BIT23;
+ u4Tmp &=~BIT24;
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
+
+ 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;
+ H2C_Parameter[1] = 0; //internal switch type
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
+ }
+ 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;
+ H2C_Parameter[1] = 0; //internal switch type
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
+ }
+ }
+
+ // 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
+
+ // 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;
+ }
+ }
+}
+
+VOID
+halbtc8723b1ant_PsTdma(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bTurnOn,
+ IN u1Byte type
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ BOOLEAN bTurnOnByCnt=FALSE, bWifiBusy=FALSE;
+ u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=0;
+ //u4Byte fwVer=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;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if (pCoexDm->bCurPsTdmaOn)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], ********** TDMA(on, %d) **********\n",
+ pCoexDm->curPsTdma));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], ********** TDMA(off, %d) **********\n",
+ pCoexDm->curPsTdma));
+ }
+
+ if(!bForceExec)
+ {
+ if( (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) &&
+ (pCoexDm->prePsTdma == pCoexDm->curPsTdma) )
+ return;
+ }
+ if(bTurnOn)
+ {
+ switch(type)
+ {
+ default:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1a, 0x1a, 0x0, 0x50);
+ break;
+ case 1:
+ //if(bWifiBusy)
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x3a, 0x03, 0x10, 0x50);
+ //else
+ // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x3a, 0x03, 0x10, 0x51);
+
+ rssiAdjustVal = 11;
+ break;
+ case 2:
+ //if(bWifiBusy)
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x2b, 0x03, 0x10, 0x50);
+ //else
+ // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x2b, 0x03, 0x10, 0x51);
+ rssiAdjustVal = 14;
+ break;
+ case 3:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1d, 0x1d, 0x0, 0x52);
+ break;
+ case 4:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
+ rssiAdjustVal = 17;
+ break;
+ case 5:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x11, 0x10);
+ break;
+ case 6:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x20, 0x3, 0x11, 0x13);
+ break;
+ case 7:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0);
+ break;
+ case 8:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
+ break;
+ case 9:
+ //if(bWifiBusy)
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x50);
+ //else
+ // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x50);
+ rssiAdjustVal = 18;
+ break;
+ case 10:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40);
+ break;
+ case 11:
+ //if(bWifiBusy)
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x15, 0x03, 0x10, 0x50);
+ //else
+ // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x15, 0x03, 0x10, 0x50);
+ rssiAdjustVal = 20;
+ break;
+ case 12:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x0a, 0x0a, 0x0, 0x50);
+ break;
+ case 13:
+ //halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x15, 0x15, 0x0, 0x50);
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x12, 0x12, 0x0, 0x50);
+ break;
+ case 14:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x52);
+ 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);
+ break;
+ case 21:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x11);
+ break;
+ case 22:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x10);
+ 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);
+ break;
+ case 29:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10);
+ break;
+ case 30:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x30, 0x3, 0x10, 0x10);
+ break;
+ case 31:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58);
+ break;
+ case 32:
+ //halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0xa, 0x3, 0x10, 0x0);
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x35, 0x3, 0x11, 0x11);
+ break;
+ case 33:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90);
+ break;
+ case 34:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x53, 0x1a, 0x1a, 0x0, 0x10);
+ break;
+ case 35:
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x63, 0x1a, 0x1a, 0x0, 0x10);
+ break;
+ case 36:
+ halbtc8723b1ant_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 */
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x23, 0x18, 0x00, 0x10, 0x24);
+ break;
+ }
+ }
+ else
+ {
+ //pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); // [31:16]=fw ver, [15:0]=fw sub ver
+
+ // disable PS tdma
+ switch(type)
+ {
+ case 8: //PTA Control
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
+ 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_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
+ break;
+ case 9: //Software control, Antenna at WiFi side
+ halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
+ halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE);
+ break;
+ }
+ }
+ rssiAdjustVal =0;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal);
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+VOID
+halbtc8723b1ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // sw all off
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+
+ // hw all off
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+BOOLEAN
+halbtc8723b1ant_IsCommonAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if(!bWifiConnected &&
+ BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"));
+
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
+
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"));
+
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
+
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n"));
+
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ if (bWifiBusy)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n"));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
+ }
+
+ bCommon = FALSE;
+ }
+
+ return bCommon;
+}
+
+
+VOID
+halbtc8723b1ant_TdmaDurationAdjustForAcl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ static s4Byte up,dn,m,n,WaitCount;
+ s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
+ u1Byte retryCount=0, btInfoExt;
+ static BOOLEAN bPreWifiBusy=FALSE;
+ BOOLEAN bWifiBusy = FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjustForAcl()\n"));
+
+ if(BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY == wifiStatus)
+ bWifiBusy = TRUE;
+ else
+ bWifiBusy = FALSE;
+
+ if( (BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
+ (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
+ (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
+ {
+ if( pCoexDm->curPsTdma != 1 &&
+ pCoexDm->curPsTdma != 2 &&
+ pCoexDm->curPsTdma != 3 &&
+ pCoexDm->curPsTdma != 9 )
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+
+ up = 0;
+ dn = 0;
+ m = 1;
+ n= 3;
+ result = 0;
+ WaitCount = 0;
+ }
+ return;
+ }
+
+ if(!pCoexDm->bAutoTdmaAdjust)
+ {
+ pCoexDm->bAutoTdmaAdjust = TRUE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
+
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ //============
+ 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;
+ btInfoExt = pCoexSta->btInfoExt;
+ //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"));
+ }
+
+ if(result == -1)
+ {
+ if( (BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ else if(result == 1)
+ {
+ if( (BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ }
+ else //no change
+ {
+ /* Bryant Modify
+ if(bWifiBusy != bPreWifiBusy) //if busy / idle change
+ {
+ bPreWifiBusy = bWifiBusy;
+ halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, pCoexDm->curPsTdma);
+ }
+ */
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], ********** TDMA(on, %d) **********\n",
+ pCoexDm->curPsTdma));
+ }
+
+ if( pCoexDm->curPsTdma != 1 &&
+ pCoexDm->curPsTdma != 2 &&
+ pCoexDm->curPsTdma != 9 &&
+ pCoexDm->curPsTdma != 11 )
+ {
+ // recover to previous adjust type
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
+ }
+ }
+}
+
+VOID
+halbtc8723b1ant_PsTdmaCheckForPowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bNewPsState
+ )
+{
+ u1Byte lpsMode=0x0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
+
+ if(lpsMode) // already under LPS state
+ {
+ if(bNewPsState)
+ {
+ // keep state under LPS, do nothing.
+ }
+ else
+ {
+ // will leave LPS state, turn off psTdma first
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ }
+ else // NO PS state
+ {
+ if(bNewPsState)
+ {
+ // will enter LPS state, turn off psTdma first
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ // keep state under NO PS state, do nothing.
+ }
+ }
+}
+
+VOID
+halbtc8723b1ant_PowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte psType,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bLowPwrDisable=FALSE;
+
+ switch(psType)
+ {
+ case BTC_PS_WIFI_NATIVE:
+ // recover to original 32k low power setting
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ break;
+ case BTC_PS_LPS_ON:
+ halbtc8723b1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
+ halbtc8723b1ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
+ // when coex force to enter LPS, do not enter 32k low power.
+ bLowPwrDisable = TRUE;
+ 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);
+ break;
+ case BTC_PS_LPS_OFF:
+ halbtc8723b1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8723b1ant_ActionWifiOnly(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+}
+
+VOID
+halbtc8723b1ant_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"));
+ halbtc8723b1ant_ActionWifiOnly(pBtCoexist);
+ }
+ }
+ 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
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ }
+ }
+}
+
+//=============================================
+//
+// Software Coex Mechanism start
+//
+//=============================================
+
+// SCO only or SCO+PAN(HS)
+VOID
+halbtc8723b1ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+
+VOID
+halbtc8723b1ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8723b1ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+VOID
+halbtc8723b1ant_ActionA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+VOID
+halbtc8723b1ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+//PAN(HS) only
+VOID
+halbtc8723b1ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8723b1ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+VOID
+halbtc8723b1ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8723b1ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+VOID
+halbtc8723b1ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+//=============================================
+//
+// Non-Software Coex Mechanism start
+//
+//=============================================
+VOID
+halbtc8723b1ant_ActionWifiMultiPort(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+}
+
+VOID
+halbtc8723b1ant_ActionHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+}
+
+VOID
+halbtc8723b1ant_ActionBtInquiry(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bWifiConnected=FALSE, bApEnable=FALSE, bWifiBusy=FALSE, bBtBusy=FALSE;
+
+ 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) )
+ {
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if( (pBtLinkInfo->bScoExist) ||
+ (pBtLinkInfo->bHidExist) )
+ {
+ // SCO/HID-only busy
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
+
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+ }
+ else if ( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) || (bWifiBusy) )
+ {
+
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
+ }
+ else
+ {
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+ }
+
+}
+
+VOID
+halbtc8723b1ant_ActionBtScoHidOnlyBusy(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bWifiConnected=FALSE;
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ // tdma and coex table
+
+ if(pBtLinkInfo->bScoExist)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ 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
+halbtc8723b1ant_ActionWifiConnectedBtAclBusy(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ u1Byte btRssiState;
+
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ btRssiState = halbtc8723b1ant_BtRssiState(2, 28, 0);
+
+ if(pBtLinkInfo->bHidOnly) //HID
+ {
+ halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ return;
+ }
+ else if(pBtLinkInfo->bA2dpOnly) //A2DP
+ {
+ 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);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ 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);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ else
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+}
+
+VOID
+halbtc8723b1ant_ActionWifiNotConnected(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // power save state
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+VOID
+halbtc8723b1ant_ActionWifiNotConnectedScan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
+
+ // tdma and coex table
+ if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ if(pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else if(pBtLinkInfo->bPanOnly)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ }
+ else if( (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN);
+ }
+ else
+ {
+ //halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ //halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+
+ //Bryant Add
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+}
+
+VOID
+halbtc8723b1ant_ActionWifiNotConnectedAssoAuth(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) )
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+ }
+ else if( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) )
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
+ }
+ else
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+
+}
+
+VOID
+halbtc8723b1ant_ActionWifiConnectedScan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ if(pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else if(pBtLinkInfo->bPanOnly)
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ }
+ else if( (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN);
+ }
+ else
+ {
+ //halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ //halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+
+ //Bryant Add
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+}
+
+VOID
+halbtc8723b1ant_ActionWifiConnectedSpecialPacket(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) )
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+ }
+ else if( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) )
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
+ }
+ else
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+}
+
+VOID
+halbtc8723b1ant_ActionWifiConnected(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiBusy=FALSE;
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+ BOOLEAN bUnder4way=FALSE, bApEnable=FALSE;
+ u4Byte wifiBw;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n"));
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+ if(bUnder4way)
+ {
+ halbtc8723b1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n"));
+ return;
+ }
+
+ 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)
+ {
+ if(bScan)
+ halbtc8723b1ant_ActionWifiConnectedScan(pBtCoexist);
+ else
+ halbtc8723b1ant_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(!bApEnable && BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
+ {
+ if(!bWifiBusy && pBtCoexist->btLinkInfo.bA2dpOnly) //A2DP
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ else
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);
+ }
+ else
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ if(!bWifiBusy)
+ {
+ if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8723b1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE);
+ }
+ else if( (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE);
+ }
+ else
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ }
+ else
+ {
+ if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8723b1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY);
+ }
+ else if( (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY);
+ }
+ else
+ {
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ }
+}
+
+VOID
+halbtc8723b1ant_RunSwCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte algorithm=0;
+
+ algorithm = halbtc8723b1ant_ActionAlgorithm(pBtCoexist);
+ pCoexDm->curAlgorithm = algorithm;
+
+ if(halbtc8723b1ant_IsCommonAction(pBtCoexist))
+ {
+
+ }
+ else
+ {
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8723B_1ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n"));
+ 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);
+ break;
+ case BT_8723B_1ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n"));
+ 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);
+ break;
+ case BT_8723B_1ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n"));
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n"));
+ //halbtc8723b1ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+}
+
+VOID
+halbtc8723b1ant_RunCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+ BOOLEAN bIncreaseScanDevNum=FALSE;
+ BOOLEAN bBtCtrlAggBufSize=FALSE;
+ u1Byte aggBufSize=5;
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiLinkStatus=0;
+ u4Byte numOfWifiLink=0;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
+ return;
+ }
+
+ if(pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n"));
+ return;
+ }
+
+ if(pCoexSta->bUnderIps)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
+ return;
+ }
+
+ if( (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ bIncreaseScanDevNum = TRUE;
+ }
+
+ 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)
+ {
+ halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+ halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
+ halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist);
+ return;
+ }
+
+ if(!pBtLinkInfo->bScoExist && !pBtLinkInfo->bHidExist)
+ {
+ halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+ }
+ else
+ {
+ if(bWifiConnected)
+ {
+ 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);
+ }
+ }
+ 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_RunSwCoexistMechanism(pBtCoexist);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8723b1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8723b1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+
+ if(!bWifiConnected)
+ {
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n"));
+
+ 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)
+ {
+ if (bScan)
+ halbtc8723b1ant_ActionWifiNotConnectedScan(pBtCoexist);
+ else
+ halbtc8723b1ant_ActionWifiNotConnectedAssoAuth(pBtCoexist);
+ }
+ else
+ halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else // wifi LPS/Busy
+ {
+ halbtc8723b1ant_ActionWifiConnected(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8723b1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+
+ // sw all off
+ halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE);
+
+ //halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+}
+
+VOID
+halbtc8723b1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bBackUp
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ u4Byte u4Tmp=0;//, fwVer;
+ u2Byte u2Tmp=0;
+ u1Byte u1Tmp=0;
+ u1Byte H2C_Parameter[2] ={0};
+ u4Byte cntBtCalChk=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
+
+ if(bBackUp)
+ {
+ pCoexDm->backupArfrCnt1 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
+ pCoexDm->backupArfrCnt2 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
+ pCoexDm->backupRetryLimit = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
+ pCoexDm->backupAmpduMaxTime = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
+ }
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); //WiFi goto standby while GNT_BT 0-->1
+ //pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 0x3c, 0x15); //BT goto standby while GNT_BT 1-->0
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x974, 0xff);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x944, 0x3, 0x3);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x930, 0x77);
+
+ //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); //BT select s0/s1 is controlled by WiFi
+
+ // BT calibration check
+ while(cntBtCalChk <= 20)
+ {
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x49d);
+ cntBtCalChk++;
+ if(u4Tmp & BIT0)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ########### BT calibration(cnt=%d) ###########\n", cntBtCalChk));
+ delay_ms(50);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ********** BT NOT calibration (cnt=%d)**********\n", cntBtCalChk));
+ break;
+ }
+ }
+
+ // 0x790[5:0]=0x5
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
+ u1Tmp &= 0xc0;
+ u1Tmp |= 0x5;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
+
+ // Enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); //0x76e[3] =1, WLAN_Act control by PTA
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1);
+
+ //Antenna config
+ //halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, TRUE, FALSE);
+ halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE);
+
+ // PTA parameter
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+}
+
+VOID
+halbtc8723b1ant_WifiOffHwCfg(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // set wlan_act to low
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+}
+
+//============================================================
+// work around function start with wa_halbtc8723b1ant_
+//============================================================
+//============================================================
+// extern function start with EXhalbtc8723b1ant_
+//============================================================
+VOID
+EXhalbtc8723b1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8723b1ant_InitHwConfig(pBtCoexist, TRUE);
+}
+
+VOID
+EXhalbtc8723b1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ pBtCoexist->bStopCoexDm = FALSE;
+
+ halbtc8723b1ant_InitCoexDm(pBtCoexist);
+
+ halbtc8723b1ant_QueryBtInfo(pBtCoexist);
+}
+
+VOID
+EXhalbtc8723b1ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ pu1Byte cliBuf=pBtCoexist->cliBuf;
+ u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0;
+ u2Byte u2Tmp[4];
+ 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, faOfdm, faCck, wifiLinkStatus;
+ u1Byte wifiDot11Chnl, wifiHsChnl;
+ u4Byte fwVer=0, btPatchVer=0;
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============");
+ CL_PRINTF(cliBuf);
+
+ if(pBtCoexist->bManualControl)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ CL_PRINTF(cliBuf);
+ }
+ if(pBtCoexist->bStopCoexDm)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ 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);
+
+ 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_%x/ 0x%x/ 0x%x(%d)", "CoexVer/ FwVer/ PatchVer", \
+ GLCoexVerDate8723b1Ant, GLCoexVer8723b1Ant, 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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, wifiHsChnl, bBtHsOn);
+ 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);
+
+ 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_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);
+ CL_PRINTF(cliBuf);
+
+
+ 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);
+ 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; i<BT_INFO_SRC_8723B_1ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723b1Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
+ ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
+ ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
+ pBtCoexist->btInfo.lpsVal,
+ pBtCoexist->btInfo.rpwmVal);
+ CL_PRINTF(cliBuf);
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
+
+ if(!pBtCoexist->bManualControl)
+ {
+ // 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", "SM[LowPenaltyRA]", \
+ pCoexDm->bCurLowPenaltyRa);
+ CL_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s/ %d ", "DelBA/ BtCtrlAgg/ AggSize", \
+ (pBtCoexist->btInfo.bRejectAggPkt? "Yes":"No"), (pBtCoexist->btInfo.bBtCtrlAggBufSize? "Yes":"No"),
+ pBtCoexist->btInfo.aggBufSize);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
+ pBtCoexist->btInfo.raMask);
+ CL_PRINTF(cliBuf);
+
+ // Fw mechanism
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
+ CL_PRINTF(cliBuf);
+
+ psTdmaCase = pCoexDm->curPsTdma;
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
+ pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
+ pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
+ pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust);
+ 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
+ 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/0x%x/0x%x/0x%x", "backup ARFR1/ARFR2/RL/AMaxTime", \
+ pCoexDm->backupArfrCnt1, pCoexDm->backupArfrCnt2, pCoexDm->backupRetryLimit, pCoexDm->backupAmpduMaxTime);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
+ u2Tmp[0] = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "0x430/0x434/0x42a/0x456", \
+ u4Tmp[0], u4Tmp[1], u2Tmp[0], u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6cc);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/0x6cc/0x880[29:25]", \
+ u1Tmp[0], u4Tmp[0], (u4Tmp[1]&0x3e000000) >> 25);
+ CL_PRINTF(cliBuf);
+
+ 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]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x92c);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x944);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x92c[1:0]/ 0x930[7:0]/0x944[1:0]", \
+ u4Tmp[0]&0x3, u4Tmp[1]&0xff, u4Tmp[2]&0x3);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x39);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x64);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x38[11]/0x40/0x4c[24:23]/0x64[0]", \
+ ((u1Tmp[0] & 0x8)>>3), u1Tmp[1], ((u4Tmp[0]&0x01800000)>>23), u1Tmp[2]&0x1);
+ 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, 0x49c);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xc50(dig)/0x49c(null-drop)", \
+ u4Tmp[0]&0xff, u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
+ u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xcf0);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5b);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5c);
+
+ faOfdm = ((u4Tmp[0]&0xffff0000) >> 16) + ((u4Tmp[1]&0xffff0000) >> 16) + (u4Tmp[1] & 0xffff) + (u4Tmp[2] & 0xffff) + \
+ ((u4Tmp[3]&0xffff0000) >> 16) + (u4Tmp[3] & 0xffff) ;
+ faCck = (u1Tmp[0] << 8) + u1Tmp[1];
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "OFDM-CCA/OFDM-FA/CCK-FA", \
+ u4Tmp[0]&0xffff, faOfdm, faCck);
+ 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(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)", \
+ 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);
+#if(BT_AUTO_REPORT_ONLY_8723B_1ANT == 1)
+ halbtc8723b1ant_MonitorBtCtr(pBtCoexist);
+#endif
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8723b1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u4Byte u4Tmp=0;
+
+ if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
+ return;
+
+ if(BTC_IPS_ENTER == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n"));
+ pCoexSta->bUnderIps = TRUE;
+ halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8723b1ant_WifiOffHwCfg(pBtCoexist);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ pCoexSta->bUnderIps = FALSE;
+ //halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, TRUE, FALSE);
+ //halbtc8723b1ant_RunCoexistMechanism(pBtCoexist);
+
+ halbtc8723b1ant_InitHwConfig(pBtCoexist, FALSE);
+ halbtc8723b1ant_InitCoexDm(pBtCoexist);
+ halbtc8723b1ant_QueryBtInfo(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8723b1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
+ return;
+
+ 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
+EXhalbtc8723b1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ 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;
+
+ 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"));
+ }
+ else
+ {
+ pCoexSta->bWiFiIsHighPriTask = FALSE;
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
+ }
+
+ halbtc8723b1ant_QueryBtInfo(pBtCoexist);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus);
+ numOfWifiLink = wifiLinkStatus>>16;
+ if(numOfWifiLink >= 2)
+ {
+ halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+ halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
+ halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist);
+ return;
+ }
+
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8723b1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8723b1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if(BTC_SCAN_START == type)
+ {
+ //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8723b1ant_ActionWifiNotConnectedScan(pBtCoexist);
+ }
+ else // wifi is connected
+ {
+ halbtc8723b1ant_ActionWifiConnectedScan(pBtCoexist);
+ }
+ }
+ else if(BTC_SCAN_FINISH == type)
+ {
+ //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8723b1ant_ActionWifiConnected(pBtCoexist);
+ }
+ }
+}
+
+VOID
+EXhalbtc8723b1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ 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"));
+ }
+ else
+ {
+ pCoexSta->bWiFiIsHighPriTask = FALSE;
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n"));
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus);
+ numOfWifiLink = wifiLinkStatus>>16;
+ if(numOfWifiLink >= 2)
+ {
+ halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+ halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
+ halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist);
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8723b1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8723b1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if(BTC_ASSOCIATE_START == type)
+ {
+ //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
+ halbtc8723b1ant_ActionWifiNotConnectedAssoAuth(pBtCoexist);
+ }
+ else if(BTC_ASSOCIATE_FINISH == type)
+ {
+ //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
+ {
+ halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8723b1ant_ActionWifiConnected(pBtCoexist);
+ }
+ }
+}
+
+VOID
+EXhalbtc8723b1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+ u4Byte wifiBw;
+ u1Byte wifiCentralChnl;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ 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[0] = 0x0;
+ 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;
+ }
+
+ 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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
+}
+
+VOID
+EXhalbtc8723b1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ 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)
+ {
+ halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+ halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
+ halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist);
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8723b1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8723b1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ 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));
+ halbtc8723b1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8723b1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ u1Byte btInfo=0;
+ u1Byte i, rspSource=0;
+ BOOLEAN bWifiConnected=FALSE;
+ BOOLEAN bBtBusy=FALSE;
+
+ pCoexSta->bC2hBtInfoReqSent = FALSE;
+
+ rspSource = tmpBuf[0]&0xf;
+ if(rspSource >= BT_INFO_SRC_8723B_1ANT_MAX)
+ rspSource = BT_INFO_SRC_8723B_1ANT_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; i<length; i++)
+ {
+ 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]));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
+ }
+
+ }
+
+ if(BT_INFO_SRC_8723B_1ANT_WIFI_FW != rspSource)
+ {
+ 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];
+
+ if (!(pCoexSta->btInfoC2h[rspSource][2] & 0x40))
+ {
+ /* BT into is responded by BT FW and BT RF REG 0x3C != 0x15 => Need to switch GNT_BT */
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Switch GNT_BT since BT RF REG 0x3C != 0x15\n"));
+ pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 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)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ EXhalbtc8723b1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ EXhalbtc8723b1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+ }
+
+ if(pCoexSta->btInfoExt & BIT3)
+ {
+ if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
+ halbtc8723b1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+ }
+ }
+ else
+ {
+ // BT already NOT ignore Wlan active, do nothing here.
+ }
+#if(BT_AUTO_REPORT_ONLY_8723B_1ANT == 0)
+ if( (pCoexSta->btInfoExt & BIT4) )
+ {
+ // BT auto report already enabled, do nothing
+ }
+ else
+ {
+ halbtc8723b1ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
+ }
+#endif
+ }
+
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8723B_1ANT_B_INQ_PAGE)
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ else
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+
+ // set link exist status
+ if(!(btInfo&BT_INFO_8723B_1ANT_B_CONNECTION))
+ {
+ pCoexSta->bBtLinkExist = FALSE;
+ pCoexSta->bPanExist = FALSE;
+ pCoexSta->bA2dpExist = FALSE;
+ pCoexSta->bHidExist = FALSE;
+ pCoexSta->bScoExist = FALSE;
+ }
+ else // connection exists
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ if(btInfo & BT_INFO_8723B_1ANT_B_FTP)
+ pCoexSta->bPanExist = TRUE;
+ else
+ pCoexSta->bPanExist = FALSE;
+ if(btInfo & BT_INFO_8723B_1ANT_B_A2DP)
+ pCoexSta->bA2dpExist = TRUE;
+ else
+ pCoexSta->bA2dpExist = FALSE;
+ if(btInfo & BT_INFO_8723B_1ANT_B_HID)
+ pCoexSta->bHidExist = TRUE;
+ else
+ pCoexSta->bHidExist = FALSE;
+ if(btInfo & BT_INFO_8723B_1ANT_B_SCO_ESCO)
+ pCoexSta->bScoExist = TRUE;
+ else
+ pCoexSta->bScoExist = FALSE;
+ }
+
+ halbtc8723b1ant_UpdateBtLinkInfo(pBtCoexist);
+
+ if(!(btInfo&BT_INFO_8723B_1ANT_B_CONNECTION))
+ {
+ pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
+ }
+ else if(btInfo == BT_INFO_8723B_1ANT_B_CONNECTION) // connection exists but no busy
+ {
+ pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
+ }
+ else if((btInfo&BT_INFO_8723B_1ANT_B_SCO_ESCO) ||
+ (btInfo&BT_INFO_8723B_1ANT_B_SCO_BUSY))
+ {
+ pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_SCO_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
+ }
+ else if(btInfo&BT_INFO_8723B_1ANT_B_ACL_BUSY)
+ {
+ if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_ACL_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
+ }
+ else
+ {
+ pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_MAX;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
+ }
+
+ if( (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ bBtBusy = TRUE;
+ else
+ bBtBusy = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+
+ halbtc8723b1ant_RunCoexistMechanism(pBtCoexist);
+}
+
+VOID
+EXhalbtc8723b1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u4Byte u4Tmp;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ pBtCoexist->bStopCoexDm = TRUE;
+
+ halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+ halbtc8723b1ant_WifiOffHwCfg(pBtCoexist);
+ halbtc8723b1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
+
+ EXhalbtc8723b1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8723b1ant_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"));
+ pBtCoexist->bStopCoexDm = TRUE;
+ /*
+ halbtc8723b1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ */
+
+ halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+ halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8723b1ant_WifiOffHwCfg(pBtCoexist);
+ }
+ 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;
+ halbtc8723b1ant_InitHwConfig(pBtCoexist, FALSE);
+ halbtc8723b1ant_InitCoexDm(pBtCoexist);
+ halbtc8723b1ant_QueryBtInfo(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8723b1ant_CoexDmReset(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], *****************Coex DM Reset*****************\n"));
+
+ halbtc8723b1ant_InitHwConfig(pBtCoexist, FALSE);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x2, 0xfffff, 0x0);
+ halbtc8723b1ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8723b1ant_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", \
+ GLCoexVerDate8723b1Ant, GLCoexVer8723b1Ant, fwVer, btPatchVer, btPatchVer));
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
+ }
+
+#if(BT_AUTO_REPORT_ONLY_8723B_1ANT == 0)
+ halbtc8723b1ant_QueryBtInfo(pBtCoexist);
+ halbtc8723b1ant_MonitorBtCtr(pBtCoexist);
+ halbtc8723b1ant_MonitorBtEnableDisable(pBtCoexist);
+#else
+ if( halbtc8723b1ant_IsWifiStatusChanged(pBtCoexist) ||
+ pCoexDm->bAutoTdmaAdjust )
+ {
+ //if(pCoexSta->specialPktPeriodCnt > 2)
+ //{
+ halbtc8723b1ant_RunCoexistMechanism(pBtCoexist);
+ //}
+ }
+
+ pCoexSta->specialPktPeriodCnt++;
+#endif
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h
index f6db10a..179ab10 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h
@@ -1,211 +1,211 @@
-//===========================================
-// The following is for 8723B 1ANT BT Co-exist definition
-//===========================================
-#define BT_AUTO_REPORT_ONLY_8723B_1ANT 1
-
-#define BT_INFO_8723B_1ANT_B_FTP BIT7
-#define BT_INFO_8723B_1ANT_B_A2DP BIT6
-#define BT_INFO_8723B_1ANT_B_HID BIT5
-#define BT_INFO_8723B_1ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8723B_1ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8723B_1ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8723B_1ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8723B_1ANT_B_CONNECTION BIT0
-
-#define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
- (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
-
-#define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2
-
-typedef enum _BT_INFO_SRC_8723B_1ANT{
- BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8723B_1ANT_MAX
-}BT_INFO_SRC_8723B_1ANT,*PBT_INFO_SRC_8723B_1ANT;
-
-typedef enum _BT_8723B_1ANT_BT_STATUS{
- BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8723B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
- BT_8723B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
- BT_8723B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
- BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
- BT_8723B_1ANT_BT_STATUS_MAX
-}BT_8723B_1ANT_BT_STATUS,*PBT_8723B_1ANT_BT_STATUS;
-
-typedef enum _BT_8723B_1ANT_WIFI_STATUS{
- BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
- BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
- BT_8723B_1ANT_WIFI_STATUS_MAX
-}BT_8723B_1ANT_WIFI_STATUS,*PBT_8723B_1ANT_WIFI_STATUS;
-
-typedef enum _BT_8723B_1ANT_COEX_ALGO{
- BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8723B_1ANT_COEX_ALGO_SCO = 0x1,
- BT_8723B_1ANT_COEX_ALGO_HID = 0x2,
- BT_8723B_1ANT_COEX_ALGO_A2DP = 0x3,
- BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
- BT_8723B_1ANT_COEX_ALGO_PANEDR = 0x5,
- BT_8723B_1ANT_COEX_ALGO_PANHS = 0x6,
- BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
- BT_8723B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
- BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
- BT_8723B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
- BT_8723B_1ANT_COEX_ALGO_MAX = 0xb,
-}BT_8723B_1ANT_COEX_ALGO,*PBT_8723B_1ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8723B_1ANT{
- // fw mechanism
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- u1Byte psTdmaDuAdjType;
- BOOLEAN bAutoTdmaAdjust;
- BOOLEAN bPrePsTdmaOn;
- BOOLEAN bCurPsTdmaOn;
- BOOLEAN bPreBtAutoReport;
- BOOLEAN bCurBtAutoReport;
- u1Byte preLps;
- u1Byte curLps;
- u1Byte preRpwm;
- u1Byte curRpwm;
-
- // sw mechanism
- BOOLEAN bPreLowPenaltyRa;
- BOOLEAN bCurLowPenaltyRa;
- u4Byte preVal0x6c0;
- u4Byte curVal0x6c0;
- u4Byte preVal0x6c4;
- u4Byte curVal0x6c4;
- u4Byte preVal0x6c8;
- u4Byte curVal0x6c8;
- u1Byte preVal0x6cc;
- u1Byte curVal0x6cc;
- BOOLEAN bLimitedDig;
-
- u4Byte backupArfrCnt1; // Auto Rate Fallback Retry cnt
- u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt
- u2Byte backupRetryLimit;
- u1Byte backupAmpduMaxTime;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-
- u4Byte preRaMask;
- u4Byte curRaMask;
- u1Byte preArfrType;
- u1Byte curArfrType;
- u1Byte preRetryLimitType;
- u1Byte curRetryLimitType;
- u1Byte preAmpduTimeType;
- u1Byte curAmpduTimeType;
-
- u1Byte errorCondition;
-} COEX_DM_8723B_1ANT, *PCOEX_DM_8723B_1ANT;
-
-typedef struct _COEX_STA_8723B_1ANT{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bA2dpExist;
- BOOLEAN bHidExist;
- BOOLEAN bPanExist;
-
- BOOLEAN bUnderLps;
- BOOLEAN bUnderIps;
- u4Byte specialPktPeriodCnt;
- u4Byte highPriorityTx;
- u4Byte highPriorityRx;
- u4Byte lowPriorityTx;
- u4Byte lowPriorityRx;
- u1Byte btRssi;
- u1Byte preBtRssiState;
- u1Byte preWifiRssiState[4];
- BOOLEAN bC2hBtInfoReqSent;
- u1Byte btInfoC2h[BT_INFO_SRC_8723B_1ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8723B_1ANT_MAX];
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
- BOOLEAN bWiFiIsHighPriTask;
- BOOLEAN bC2hBtPage;
-}COEX_STA_8723B_1ANT, *PCOEX_STA_8723B_1ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8723b1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8723b1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b1ant_PnpNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte pnpState
- );
-VOID
-EXhalbtc8723b1ant_CoexDmReset(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b1ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-
+//===========================================
+// The following is for 8723B 1ANT BT Co-exist definition
+//===========================================
+#define BT_AUTO_REPORT_ONLY_8723B_1ANT 1
+
+#define BT_INFO_8723B_1ANT_B_FTP BIT7
+#define BT_INFO_8723B_1ANT_B_A2DP BIT6
+#define BT_INFO_8723B_1ANT_B_HID BIT5
+#define BT_INFO_8723B_1ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8723B_1ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8723B_1ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8723B_1ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8723B_1ANT_B_CONNECTION BIT0
+
+#define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
+ (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
+
+#define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2
+
+typedef enum _BT_INFO_SRC_8723B_1ANT{
+ BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8723B_1ANT_MAX
+}BT_INFO_SRC_8723B_1ANT,*PBT_INFO_SRC_8723B_1ANT;
+
+typedef enum _BT_8723B_1ANT_BT_STATUS{
+ BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8723B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
+ BT_8723B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
+ BT_8723B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
+ BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
+ BT_8723B_1ANT_BT_STATUS_MAX
+}BT_8723B_1ANT_BT_STATUS,*PBT_8723B_1ANT_BT_STATUS;
+
+typedef enum _BT_8723B_1ANT_WIFI_STATUS{
+ BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
+ BT_8723B_1ANT_WIFI_STATUS_MAX
+}BT_8723B_1ANT_WIFI_STATUS,*PBT_8723B_1ANT_WIFI_STATUS;
+
+typedef enum _BT_8723B_1ANT_COEX_ALGO{
+ BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8723B_1ANT_COEX_ALGO_SCO = 0x1,
+ BT_8723B_1ANT_COEX_ALGO_HID = 0x2,
+ BT_8723B_1ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
+ BT_8723B_1ANT_COEX_ALGO_PANEDR = 0x5,
+ BT_8723B_1ANT_COEX_ALGO_PANHS = 0x6,
+ BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
+ BT_8723B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
+ BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
+ BT_8723B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
+ BT_8723B_1ANT_COEX_ALGO_MAX = 0xb,
+}BT_8723B_1ANT_COEX_ALGO,*PBT_8723B_1ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8723B_1ANT{
+ // fw mechanism
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ u1Byte psTdmaDuAdjType;
+ BOOLEAN bAutoTdmaAdjust;
+ BOOLEAN bPrePsTdmaOn;
+ BOOLEAN bCurPsTdmaOn;
+ BOOLEAN bPreBtAutoReport;
+ BOOLEAN bCurBtAutoReport;
+ u1Byte preLps;
+ u1Byte curLps;
+ u1Byte preRpwm;
+ u1Byte curRpwm;
+
+ // sw mechanism
+ BOOLEAN bPreLowPenaltyRa;
+ BOOLEAN bCurLowPenaltyRa;
+ u4Byte preVal0x6c0;
+ u4Byte curVal0x6c0;
+ u4Byte preVal0x6c4;
+ u4Byte curVal0x6c4;
+ u4Byte preVal0x6c8;
+ u4Byte curVal0x6c8;
+ u1Byte preVal0x6cc;
+ u1Byte curVal0x6cc;
+ BOOLEAN bLimitedDig;
+
+ u4Byte backupArfrCnt1; // Auto Rate Fallback Retry cnt
+ u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt
+ u2Byte backupRetryLimit;
+ u1Byte backupAmpduMaxTime;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+
+ u4Byte preRaMask;
+ u4Byte curRaMask;
+ u1Byte preArfrType;
+ u1Byte curArfrType;
+ u1Byte preRetryLimitType;
+ u1Byte curRetryLimitType;
+ u1Byte preAmpduTimeType;
+ u1Byte curAmpduTimeType;
+
+ u1Byte errorCondition;
+} COEX_DM_8723B_1ANT, *PCOEX_DM_8723B_1ANT;
+
+typedef struct _COEX_STA_8723B_1ANT{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bA2dpExist;
+ BOOLEAN bHidExist;
+ BOOLEAN bPanExist;
+
+ BOOLEAN bUnderLps;
+ BOOLEAN bUnderIps;
+ u4Byte specialPktPeriodCnt;
+ u4Byte highPriorityTx;
+ u4Byte highPriorityRx;
+ u4Byte lowPriorityTx;
+ u4Byte lowPriorityRx;
+ u1Byte btRssi;
+ u1Byte preBtRssiState;
+ u1Byte preWifiRssiState[4];
+ BOOLEAN bC2hBtInfoReqSent;
+ u1Byte btInfoC2h[BT_INFO_SRC_8723B_1ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8723B_1ANT_MAX];
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+ BOOLEAN bWiFiIsHighPriTask;
+ BOOLEAN bC2hBtPage;
+}COEX_STA_8723B_1ANT, *PCOEX_STA_8723B_1ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8723b1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8723b1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b1ant_PnpNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte pnpState
+ );
+VOID
+EXhalbtc8723b1ant_CoexDmReset(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b1ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b1ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c
index dc29ba2..fc2b904 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c
@@ -1,4155 +1,4155 @@
-//============================================================
-// Description:
-//
-// This file is for RTL8723B Co-exist mechanism
-//
-// History
-// 2012/11/15 Cosa first check in.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8723B_2ANT GLCoexDm8723b2Ant;
-static PCOEX_DM_8723B_2ANT pCoexDm=&GLCoexDm8723b2Ant;
-static COEX_STA_8723B_2ANT GLCoexSta8723b2Ant;
-static PCOEX_STA_8723B_2ANT pCoexSta=&GLCoexSta8723b2Ant;
-
-const char *const GLBtInfoSrc8723b2Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-u4Byte GLCoexVerDate8723b2Ant=20131113;
-u4Byte GLCoexVer8723b2Ant=0x3f;
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8723b2ant_
-//============================================================
-u1Byte
-halbtc8723b2ant_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_8723B_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_8723B_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_8723B_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
-halbtc8723b2ant_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_8723B_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_8723B_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_8723B_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
-halbtc8723b2ant_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
-halbtc8723b2ant_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, 0xc);
-}
-
-VOID
-halbtc8723b2ant_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);
-}
-
-BOOLEAN
-halbtc8723b2ant_IsWifiStatusChanged(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
- BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
- BOOLEAN bWifiConnected=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
-
- if(bWifiConnected)
- {
- if(bWifiBusy != bPreWifiBusy)
- {
- bPreWifiBusy = bWifiBusy;
- return TRUE;
- }
- if(bUnder4way != bPreUnder4way)
- {
- bPreUnder4way = bUnder4way;
- return TRUE;
- }
- if(bBtHsOn != bPreBtHsOn)
- {
- bPreBtHsOn = bBtHsOn;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-VOID
-halbtc8723b2ant_UpdateBtLinkInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
-
-#if(BT_AUTO_REPORT_ONLY_8723B_2ANT == 1) // profile from bt patch
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
- pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
- pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
- pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
- pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
-
- // work around for HS mode.
- if(bBtHsOn)
- {
- pBtLinkInfo->bPanExist = TRUE;
- pBtLinkInfo->bBtLinkExist = TRUE;
- }
-#else // profile from bt stack
- pBtLinkInfo->bBtLinkExist = pStackInfo->bBtLinkExist;
- pBtLinkInfo->bScoExist = pStackInfo->bScoExist;
- pBtLinkInfo->bA2dpExist = pStackInfo->bA2dpExist;
- pBtLinkInfo->bPanExist = pStackInfo->bPanExist;
- pBtLinkInfo->bHidExist = pStackInfo->bHidExist;
-
- //for win-8 stack HID report error
- if(!pStackInfo->bHidExist)
- pStackInfo->bHidExist = pCoexSta->bHidExist; //sync BTInfo with BT firmware and stack
- // when stack HID report error, here we use the info from bt fw.
- if(!pStackInfo->bBtLinkExist)
- pStackInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
-#endif
- // check if Sco only
- if( pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bScoOnly = TRUE;
- else
- pBtLinkInfo->bScoOnly = FALSE;
-
- // check if A2dp only
- if( !pBtLinkInfo->bScoExist &&
- pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bA2dpOnly = TRUE;
- else
- pBtLinkInfo->bA2dpOnly = FALSE;
-
- // check if Pan only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bPanOnly = TRUE;
- else
- pBtLinkInfo->bPanOnly = FALSE;
-
- // check if Hid only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bHidExist )
- pBtLinkInfo->bHidOnly = TRUE;
- else
- pBtLinkInfo->bHidOnly = FALSE;
-}
-
-u1Byte
-halbtc8723b2ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8723B_2ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!pBtLinkInfo->bBtLinkExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
- return algorithm;
- }
-
- if(pBtLinkInfo->bScoExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bHidExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bPanExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bA2dpExist)
- numOfDiffProfile++;
-
- if(numOfDiffProfile == 1)
- {
- if(pBtLinkInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_A2DP;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile == 2)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
-#if 0
- if(pStackInfo->numOfHid >= 2)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID*2 + A2DP\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- else
-#endif
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP;
- }
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP;
- }
- }
- }
- }
- else if(numOfDiffProfile == 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile >= 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->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_8723B_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-BOOLEAN
-halbtc8723b2ant_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 = halbtc8723b2ant_BtRssiState(2, 29, 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
-halbtc8723b2ant_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
-halbtc8723b2ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723b2ant_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;
- }
- halbtc8723b2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr);
-
- pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr;
-}
-
-VOID
-halbtc8723b2ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723b2ant_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;
- }
- halbtc8723b2ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
-
- pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
-}
-
-VOID
-halbtc8723b2ant_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;
- }
-
- halbtc8723b2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
-
- pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
-}
-
-VOID
-halbtc8723b2ant_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
-halbtc8723b2ant_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;
- }
- halbtc8723b2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
-
- pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
-}
-
-VOID
-halbtc8723b2ant_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
-halbtc8723b2ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- //return;
- 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;
- }
- halbtc8723b2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8723b2ant_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, 0x883, 0x3e, val);
-}
-
-VOID
-halbtc8723b2ant_SetSwFullTimeDacSwing(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSwDacSwingOn,
- IN u4Byte swDacSwingLvl
- )
-{
- if(bSwDacSwingOn)
- {
- halbtc8723b2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
- }
- else
- {
- halbtc8723b2ant_SetDacSwingReg(pBtCoexist, 0x18);
- }
-}
-
-
-VOID
-halbtc8723b2ant_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);
- halbtc8723b2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
-
- pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
- pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
-}
-
-VOID
-halbtc8723b2ant_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, 0xc05, 0x30, 0x3);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xc05, 0x30, 0x1);
- }
-}
-
-VOID
-halbtc8723b2ant_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;
- }
- halbtc8723b2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
-
- pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
-}
-
-VOID
-halbtc8723b2ant_SetAgcTable(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAgcTableEn
- )
-{
- u1Byte rssiAdjustVal=0;
-
- //=================BB AGC Gain Table
- if(bAgcTableEn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table On!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6e1A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6d1B0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6c1C0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6b1D0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6a1E0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x691F0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x68200001);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table Off!\n"));
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xaa1A0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa91B0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa81C0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa71D0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa61E0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa51F0001);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa4200001);
- }
-
-
- //=================RF Gain
- 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, 0x38fff);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x38ffe);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x380c3);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x28ce6);
- }
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x1);
- if(bAgcTableEn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38fff);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38ffe);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x380c3);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x28ce6);
- }
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x0);
-
- // set rssiAdjustVal for wifi module.
- if(bAgcTableEn)
- {
- rssiAdjustVal = 8;
- }
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
-}
-
-VOID
-halbtc8723b2ant_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;
- }
- halbtc8723b2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
-
- pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
-}
-
-VOID
-halbtc8723b2ant_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
-halbtc8723b2ant_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;
- }
- halbtc8723b2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8723b2ant_CoexTableWithType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type
- )
-{
- switch(type)
- {
- case 0:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffff, 0x3);
- break;
- case 1:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5afa5afa, 0xffff, 0x3);
- break;
- case 2:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3);
- break;
- case 3:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff, 0x3);
- break;
- case 4:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffff, 0x3);
- break;
- case 5:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffff, 0x3);
- break;
- case 6:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
- break;
- case 7:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3);
- break;
- case 8:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3);
- break;
- case 9:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5aea5aea, 0xffff, 0x3);
- break;
- case 10:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5aff5aff, 0xffff, 0x3);
- break;
- case 11:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3);
- break;
- case 12:
- halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5f5f5f5f, 0xffff, 0x3);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8723b2ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8723b2ant_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;
- }
- halbtc8723b2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8723b2ant_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};
-
- H2C_Parameter[0] = byte1;
- H2C_Parameter[1] = byte2;
- H2C_Parameter[2] = byte3;
- H2C_Parameter[3] = byte4;
- H2C_Parameter[4] = byte5;
-
- pCoexDm->psTdmaPara[0] = byte1;
- pCoexDm->psTdmaPara[1] = byte2;
- pCoexDm->psTdmaPara[2] = byte3;
- pCoexDm->psTdmaPara[3] = byte4;
- pCoexDm->psTdmaPara[4] = byte5;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
-halbtc8723b2ant_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;
- }
- */
-
- halbtc8723b2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF);
- halbtc8723b2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
-}
-
-VOID
-halbtc8723b2ant_SwMechanism2(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAGCTableShift,
- IN BOOLEAN bADCBackOff,
- IN BOOLEAN bSWDACSwing,
- IN u4Byte dacSwingLvl
- )
-{
- halbtc8723b2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift);
- //halbtc8723b2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff);
- halbtc8723b2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl);
-}
-
-VOID
-halbtc8723b2ant_SetAntPath(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte antPosType,
- IN BOOLEAN bInitHwCfg,
- IN BOOLEAN bWifiOff
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- u4Byte fwVer=0, u4Tmp=0;
- BOOLEAN bPgExtSwitch=FALSE;
- BOOLEAN bUseExtSwitch=FALSE;
- u1Byte H2C_Parameter[2] ={0};
-
- 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)
- bUseExtSwitch = TRUE;
-
- 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->fBtcWrite1Byte(pBtCoexist, 0x974, 0xff);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x944, 0x3, 0x3);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x930, 0x77);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1);
-
- //Force GNT_BT to low
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x0);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0);
-
- if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT)
- {
- //tell firmware "no antenna inverse"
- H2C_Parameter[0] = 0;
- }
- else
- {
- //tell firmware "antenna inverse"
- H2C_Parameter[0] = 1;
- }
-
- if (bUseExtSwitch)
- {
- //ext switch type
- H2C_Parameter[1] = 1;
- }
- else
- {
- //int switch type
- H2C_Parameter[1] = 0;
- }
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
- }
-
-
- // ext switch setting
- if(bUseExtSwitch)
- {
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); // fixed internal switch S1->WiFi, S0->BT
- switch(antPosType)
- {
- case BTC_ANT_WIFI_AT_MAIN:
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); // ext switch main at wifi
- break;
- case BTC_ANT_WIFI_AT_AUX:
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); // ext switch aux at wifi
- break;
- }
- }
- else // internal switch
- {
- // fixed ext switch
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1);
- switch(antPosType)
- {
- case BTC_ANT_WIFI_AT_MAIN:
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); // fixed internal switch S1->WiFi, S0->BT
- break;
- case BTC_ANT_WIFI_AT_AUX:
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); // fixed internal switch S0->WiFi, S1->BT
- break;
- }
- }
-}
-
-VOID
-halbtc8723b2ant_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:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
- case 2:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
- break;
- case 3:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90);
- break;
- case 4:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xf1, 0x90);
- break;
- case 5:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
- break;
- case 6:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
- break;
- case 7:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90);
- break;
- case 8:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90);
- break;
- case 9:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
- case 10:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
- break;
- case 11:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x90);
- break;
- case 12:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
- break;
- case 13:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
- break;
- case 14:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
- break;
- case 15:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x90);
- break;
- case 16:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x90);
- break;
- case 17:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x90);
- break;
- case 18:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
- break;
- case 19:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90);
- break;
- case 20:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);
- break;
- case 21:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);
- break;
- case 71:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
- }
- }
- else
- {
- // disable PS tdma
- switch(type)
- {
- case 0:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0);
- break;
- case 1:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x48, 0x0);
- break;
- default:
- halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0);
- break;
- }
- }
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-VOID
-halbtc8723b2ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // fw all off
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- // sw all off
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- // hw all off
- //pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-VOID
-halbtc8723b2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
-
- halbtc8723b2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
- halbtc8723b2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE);
-
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-}
-
-VOID
-halbtc8723b2ant_ActionBtInquiry(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiConnected=FALSE;
- BOOLEAN bLowPwrDisable=TRUE;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- if(bWifiConnected)
- {
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- }
- else
- {
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- pCoexDm->bNeedRecover0x948 = TRUE;
- pCoexDm->backup0x948 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x948);
-
- halbtc8723b2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_AUX, FALSE, FALSE);
-}
-BOOLEAN
-halbtc8723b2ant_IsCommonAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
- BOOLEAN bBtHsOn=FALSE, bLowPwrDisable=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if(!bWifiConnected)
- {
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-connected idle!!\n"));
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else
- {
- if(BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xb);
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else if(BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- bLowPwrDisable = TRUE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- if(bBtHsOn)
- return FALSE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xb);
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- 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 Connected-Busy + BT Busy!!\n"));
- bCommon = FALSE;
- }
- else
- {
- if(bBtHsOn)
- return FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21);
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xb);
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- bCommon = TRUE;
- }
- }
- }
-
- return bCommon;
-}
-VOID
-halbtc8723b2ant_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->bAutoTdmaAdjust)
- {
- pCoexDm->bAutoTdmaAdjust = TRUE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
- {
- if(bScoHid)
- {
- if(bTxPause)
- {
- if(maxInterval == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(maxInterval == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(maxInterval == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(maxInterval == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(maxInterval == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- }
- else
- {
- if(bTxPause)
- {
- if(maxInterval == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(maxInterval == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(maxInterval == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(maxInterval == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(maxInterval == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else
- {
- halbtc8723b2ant_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)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_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)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
- pCoexDm->psTdmaDuAdjType = 71;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 71)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
- pCoexDm->psTdmaDuAdjType = 71;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_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)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_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)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_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)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_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)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8723b2ant_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)
- {
- halbtc8723b2ant_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"));
- }
- }
-}
-
-// SCO only or SCO+PAN(HS)
-VOID
-halbtc8723b2ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 4);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_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
- {
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- else //for SCO quality & wifi performance balance at 11n mode
- {
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8);
- }
-
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x4);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x4);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x4);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x4);
- }
- }
-}
-
-
-VOID
-halbtc8723b2ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_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
- {
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
- }
- else //for HID quality & wifi performance balance at 11n mode
- {
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 9);
- }
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
- else
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8723b2ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, wifiRssiState1, btRssiState;
- u4Byte wifiBw;
- u1Byte apNum=0;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- wifiRssiState1 = halbtc8723b2ant_WifiRssiState(pBtCoexist, 1, 2, 40, 0);
- btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum);
-
- // define the office environment
- if(apNum >= 10 && BTC_RSSI_HIGH(wifiRssiState1))
- {
- //DbgPrint(" AP#>10(%d)\n", apNum);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x18);
- }
- return;
- }
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
- }
- else
- {
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
- }
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8723b2ant_ActionA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
-
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8723b2ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 10);
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- }
- else
- {
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- }
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-
-//PAN(HS) only
-VOID
-halbtc8723b2ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- }
-
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
-
- halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8723b2ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 12);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- else
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
- else
- {
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8723b2ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 3);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 11);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780);
- }
- else
- {
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- }
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
- }
- else
- {
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 11);
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8723b2ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- if(BTC_WIFI_BW_HT40 == wifiBw)
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- else
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
- }
- else
- {
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8723b2ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-
- halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
-
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
- }
- else
- {
- halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
-
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8723b2ant_RunCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiUnder5G=FALSE, bBtHsOn=FALSE;
- u1Byte btInfoOriginal=0, btRetryCnt=0;
- u1Byte algorithm=0;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
- return;
- }
-
- if(pCoexSta->bUnderIps)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
- return;
- }
-
- algorithm = halbtc8723b2ant_ActionAlgorithm(pBtCoexist);
- if(pCoexSta->bC2hBtInquiryPage && (BT_8723B_2ANT_COEX_ALGO_PANHS!=algorithm))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));
- halbtc8723b2ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else
- {
- if(pCoexDm->bNeedRecover0x948)
- {
- pCoexDm->bNeedRecover0x948 = FALSE;
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, pCoexDm->backup0x948);
- }
- }
-
- pCoexDm->curAlgorithm = algorithm;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
-
- if(halbtc8723b2ant_IsCommonAction(pBtCoexist))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n"));
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- else
- {
- if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n",
- pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8723B_2ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
- halbtc8723b2ant_ActionSco(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
- halbtc8723b2ant_ActionHid(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
- halbtc8723b2ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));
- halbtc8723b2ant_ActionA2dpPanHs(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
- halbtc8723b2ant_ActionPanEdr(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
- halbtc8723b2ant_ActionPanHs(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
- halbtc8723b2ant_ActionPanEdrA2dp(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_PANEDR_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
- halbtc8723b2ant_ActionPanEdrHid(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
- halbtc8723b2ant_ActionHidA2dpPanEdr(pBtCoexist);
- break;
- case BT_8723B_2ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
- halbtc8723b2ant_ActionHidA2dp(pBtCoexist);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
- halbtc8723b2ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
-}
-
-VOID
-halbtc8723b2ant_WifiOffHwCfg(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PADAPTER padapter=pBtCoexist->Adapter;
- // 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
-
- //Force GNT_BT to High
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x3);
- if(padapter->registrypriv.mp_mode ==0)
- 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
-}
-
-//============================================================
-// work around function start with wa_halbtc8723b2ant_
-//============================================================
-//============================================================
-// extern function start with EXhalbtc8723b2ant_
-//============================================================
-VOID
-EXhalbtc8723b2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- u4Byte u4Tmp=0, fwVer;
- u2Byte u2Tmp=0;
- u1Byte u1Tmp=0;
- u1Byte H2C_Parameter[2] ={0};
-
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
-
- //pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); //WiFi goto standby while GNT_BT 0-->1
- //pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 0x3c, 0x1); //BT goto standby while GNT_BT 1-->0
-
- // backup rf 0x1e value
- pCoexDm->btRf0x1eBackup =
- pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
-
- // 0x790[5:0]=0x5
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
- u1Tmp &= 0xc0;
- u1Tmp |= 0x5;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
-
- //Antenna config
- halbtc8723b2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_MAIN, TRUE, FALSE);
-
- // PTA parameter
- halbtc8723b2ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-
- // Enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); //0x76e[3] =1, WLAN_Act control by PTA
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1);
-
- pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); //WiFi goto standby while GNT_BT 0-->1
-}
-
-VOID
-EXhalbtc8723b2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- halbtc8723b2ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8723b2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- 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, faOfdm, faCck;
- u1Byte wifiDot11Chnl, wifiHsChnl;
- u4Byte fwVer=0, btPatchVer=0;
- u1Byte apNum=0;
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============");
- CL_PRINTF(cliBuf);
-
- if(pBtCoexist->bManualControl)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- 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);
-
- 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_%x/ 0x%x/ 0x%x(%d)", "CoexVer/ FwVer/ PatchVer", \
- GLCoexVerDate8723b2Ant, GLCoexVer8723b2Ant, 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 / HsChnl(HsMode)", \
- wifiDot11Chnl, wifiHsChnl, bBtHsOn);
- 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);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d", "Wifi rssi/ HS rssi/ AP#", \
- wifiRssi, btHsRssi, apNum);
- 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]", \
- ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
- ( (BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
- pCoexSta->btRssi, pCoexSta->btRetryCnt);
- CL_PRINTF(cliBuf);
-
- 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);
- 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; i<BT_INFO_SRC_8723B_2ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723b2Ant[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);
-
- psTdmaCase = pCoexDm->curPsTdma;
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
- pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
- pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
- pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust);
- 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);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x778/0x880[29:25]", \
- u1Tmp[0], (u4Tmp[0]&0x3e000000) >> 25);
- CL_PRINTF(cliBuf);
-
-
- 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]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x92c);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x944);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x92c[1:0]/ 0x930[7:0]/0x944[1:0]", \
- u4Tmp[0]&0x3, u4Tmp[1]&0xff, u4Tmp[2]&0x3);
- CL_PRINTF(cliBuf);
-
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x39);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x64);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x38[11]/0x40/0x4c[24:23]/0x64[0]", \
- ((u1Tmp[0] & 0x8)>>3), u1Tmp[1], ((u4Tmp[0]&0x01800000)>>23), u1Tmp[2]&0x1);
- 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, 0x49c);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xc50(dig)/0x49c(null-drop)", \
- u4Tmp[0]&0xff, u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
- u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
- u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xcf0);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5b);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5c);
-
- faOfdm = ((u4Tmp[0]&0xffff0000) >> 16) + ((u4Tmp[1]&0xffff0000) >> 16) + (u4Tmp[1] & 0xffff) + (u4Tmp[2] & 0xffff) + \
- ((u4Tmp[3]&0xffff0000) >> 16) + (u4Tmp[3] & 0xffff) ;
- faCck = (u1Tmp[0] << 8) + u1Tmp[1];
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "OFDM-CCA/OFDM-FA/CCK-FA", \
- u4Tmp[0]&0xffff, faOfdm, faCck);
- CL_PRINTF(cliBuf);
-
- 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_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(high-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);
-#if(BT_AUTO_REPORT_ONLY_8723B_2ANT == 1)
- halbtc8723b2ant_MonitorBtCtr(pBtCoexist);
-#endif
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8723b2ant_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;
- halbtc8723b2ant_WifiOffHwCfg(pBtCoexist);
- halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- halbtc8723b2ant_CoexAllOff(pBtCoexist);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- pCoexSta->bUnderIps = FALSE;
- EXhalbtc8723b2ant_InitHwConfig(pBtCoexist);
- halbtc8723b2ant_InitCoexDm(pBtCoexist);
- halbtc8723b2ant_QueryBtInfo(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8723b2ant_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
-EXhalbtc8723b2ant_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
-EXhalbtc8723b2ant_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
-EXhalbtc8723b2ant_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;
- }
-
- 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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
-}
-
-VOID
-EXhalbtc8723b2ant_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
-EXhalbtc8723b2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- u1Byte btInfo=0;
- u1Byte i, rspSource=0;
- BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE;
- BOOLEAN bWifiConnected=FALSE;
- static BOOLEAN bPreScoExist=FALSE;
- u4Byte raMask=0x0;
-
- pCoexSta->bC2hBtInfoReqSent = FALSE;
-
- rspSource = tmpBuf[0]&0xf;
- if(rspSource >= BT_INFO_SRC_8723B_2ANT_MAX)
- rspSource = BT_INFO_SRC_8723B_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; i<length; i++)
- {
- 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]));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
- }
- }
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Manual CTRL<===\n"));
- return;
- }
-
- if(BT_INFO_SRC_8723B_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 (pCoexSta->btInfoC2h[rspSource][2] & 0x40)
- {
- /* BT into is responded by BT FW and BT RF REG 0x3C != 0x01 => Need to switch GNT_BT */
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Switch GNT_BT since BT RF REG 0x3C != 0x01\n"));
- pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 0x3c, 0x01);
- }
-
- // Here we need to resend some wifi info to BT
- // because bt is reset and loss of the info.
- if( (pCoexSta->btInfoExt & BIT1) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
- }
-
- if( (pCoexSta->btInfoExt & BIT3) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
- halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
- }
- else
- {
- // BT already NOT ignore Wlan active, do nothing here.
- }
-#if(BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
- if( (pCoexSta->btInfoExt & BIT4) )
- {
- // BT auto report already enabled, do nothing
- }
- else
- {
- halbtc8723b2ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
- }
-#endif
- }
-
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8723B_2ANT_B_INQ_PAGE)
- pCoexSta->bC2hBtInquiryPage = TRUE;
- else
- pCoexSta->bC2hBtInquiryPage = FALSE;
-
- // set link exist status
- if(!(btInfo&BT_INFO_8723B_2ANT_B_CONNECTION))
- {
- pCoexSta->bBtLinkExist = FALSE;
- pCoexSta->bPanExist = FALSE;
- pCoexSta->bA2dpExist = FALSE;
- pCoexSta->bHidExist = FALSE;
- pCoexSta->bScoExist = FALSE;
- }
- else // connection exists
- {
- pCoexSta->bBtLinkExist = TRUE;
- if(btInfo & BT_INFO_8723B_2ANT_B_FTP)
- pCoexSta->bPanExist = TRUE;
- else
- pCoexSta->bPanExist = FALSE;
- if(btInfo & BT_INFO_8723B_2ANT_B_A2DP)
- pCoexSta->bA2dpExist = TRUE;
- else
- pCoexSta->bA2dpExist = FALSE;
- if(btInfo & BT_INFO_8723B_2ANT_B_HID)
- pCoexSta->bHidExist = TRUE;
- else
- pCoexSta->bHidExist = FALSE;
- if(btInfo & BT_INFO_8723B_2ANT_B_SCO_ESCO)
- pCoexSta->bScoExist = TRUE;
- else
- pCoexSta->bScoExist = FALSE;
- }
-
- halbtc8723b2ant_UpdateBtLinkInfo(pBtCoexist);
-
- if(!(btInfo&BT_INFO_8723B_2ANT_B_CONNECTION))
- {
- pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
- }
- else if(btInfo == BT_INFO_8723B_2ANT_B_CONNECTION) // connection exists but no busy
- {
- pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
- }
- else if((btInfo&BT_INFO_8723B_2ANT_B_SCO_ESCO) ||
- (btInfo&BT_INFO_8723B_2ANT_B_SCO_BUSY))
- {
- pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_SCO_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
- }
- else if(btInfo&BT_INFO_8723B_2ANT_B_ACL_BUSY)
- {
- pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_ACL_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
- }
- else
- {
- pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_MAX;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
- }
-
- if( (BT_8723B_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_2ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- bBtBusy = TRUE;
- bLimitedDig = TRUE;
- }
- else
- {
- bBtBusy = FALSE;
- bLimitedDig = FALSE;
- }
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
-
- pCoexDm->bLimitedDig = bLimitedDig;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
-
- halbtc8723b2ant_RunCoexistMechanism(pBtCoexist);
-}
-
-VOID
-EXhalbtc8723b2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- halbtc8723b2ant_WifiOffHwCfg(pBtCoexist);
- pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 0x3c, 0x15); //BT goto standby while GNT_BT 1-->0
- halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
-
- EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8723b2ant_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", \
- GLCoexVerDate8723b2Ant, GLCoexVer8723b2Ant, fwVer, btPatchVer, btPatchVer));
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
- }
-
-#if(BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
- halbtc8723b2ant_QueryBtInfo(pBtCoexist);
- halbtc8723b2ant_MonitorBtCtr(pBtCoexist);
- halbtc8723b2ant_MonitorBtEnableDisable(pBtCoexist);
-#else
- if( halbtc8723b2ant_IsWifiStatusChanged(pBtCoexist) ||
- pCoexDm->bAutoTdmaAdjust)
- {
- halbtc8723b2ant_RunCoexistMechanism(pBtCoexist);
- }
-#endif
-}
-
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for RTL8723B Co-exist mechanism
+//
+// History
+// 2012/11/15 Cosa first check in.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8723B_2ANT GLCoexDm8723b2Ant;
+static PCOEX_DM_8723B_2ANT pCoexDm=&GLCoexDm8723b2Ant;
+static COEX_STA_8723B_2ANT GLCoexSta8723b2Ant;
+static PCOEX_STA_8723B_2ANT pCoexSta=&GLCoexSta8723b2Ant;
+
+const char *const GLBtInfoSrc8723b2Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+u4Byte GLCoexVerDate8723b2Ant=20131113;
+u4Byte GLCoexVer8723b2Ant=0x3f;
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8723b2ant_
+//============================================================
+u1Byte
+halbtc8723b2ant_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_8723B_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_8723B_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_8723B_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
+halbtc8723b2ant_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_8723B_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_8723B_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_8723B_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
+halbtc8723b2ant_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
+halbtc8723b2ant_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, 0xc);
+}
+
+VOID
+halbtc8723b2ant_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);
+}
+
+BOOLEAN
+halbtc8723b2ant_IsWifiStatusChanged(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
+ BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+
+ if(bWifiConnected)
+ {
+ if(bWifiBusy != bPreWifiBusy)
+ {
+ bPreWifiBusy = bWifiBusy;
+ return TRUE;
+ }
+ if(bUnder4way != bPreUnder4way)
+ {
+ bPreUnder4way = bUnder4way;
+ return TRUE;
+ }
+ if(bBtHsOn != bPreBtHsOn)
+ {
+ bPreBtHsOn = bBtHsOn;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+VOID
+halbtc8723b2ant_UpdateBtLinkInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+
+#if(BT_AUTO_REPORT_ONLY_8723B_2ANT == 1) // profile from bt patch
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
+ pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
+ pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
+ pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
+
+ // work around for HS mode.
+ if(bBtHsOn)
+ {
+ pBtLinkInfo->bPanExist = TRUE;
+ pBtLinkInfo->bBtLinkExist = TRUE;
+ }
+#else // profile from bt stack
+ pBtLinkInfo->bBtLinkExist = pStackInfo->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pStackInfo->bScoExist;
+ pBtLinkInfo->bA2dpExist = pStackInfo->bA2dpExist;
+ pBtLinkInfo->bPanExist = pStackInfo->bPanExist;
+ pBtLinkInfo->bHidExist = pStackInfo->bHidExist;
+
+ //for win-8 stack HID report error
+ if(!pStackInfo->bHidExist)
+ pStackInfo->bHidExist = pCoexSta->bHidExist; //sync BTInfo with BT firmware and stack
+ // when stack HID report error, here we use the info from bt fw.
+ if(!pStackInfo->bBtLinkExist)
+ pStackInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+#endif
+ // check if Sco only
+ if( pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bScoOnly = TRUE;
+ else
+ pBtLinkInfo->bScoOnly = FALSE;
+
+ // check if A2dp only
+ if( !pBtLinkInfo->bScoExist &&
+ pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bA2dpOnly = TRUE;
+ else
+ pBtLinkInfo->bA2dpOnly = FALSE;
+
+ // check if Pan only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bPanOnly = TRUE;
+ else
+ pBtLinkInfo->bPanOnly = FALSE;
+
+ // check if Hid only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bHidOnly = TRUE;
+ else
+ pBtLinkInfo->bHidOnly = FALSE;
+}
+
+u1Byte
+halbtc8723b2ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8723B_2ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!pBtLinkInfo->bBtLinkExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
+ return algorithm;
+ }
+
+ if(pBtLinkInfo->bScoExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bHidExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bPanExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bA2dpExist)
+ numOfDiffProfile++;
+
+ if(numOfDiffProfile == 1)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_A2DP;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 2)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+#if 0
+ if(pStackInfo->numOfHid >= 2)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID*2 + A2DP\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ else
+#endif
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile >= 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->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_8723B_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+BOOLEAN
+halbtc8723b2ant_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 = halbtc8723b2ant_BtRssiState(2, 29, 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
+halbtc8723b2ant_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
+halbtc8723b2ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723b2ant_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;
+ }
+ halbtc8723b2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr);
+
+ pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr;
+}
+
+VOID
+halbtc8723b2ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723b2ant_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;
+ }
+ halbtc8723b2ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
+
+ pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
+}
+
+VOID
+halbtc8723b2ant_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;
+ }
+
+ halbtc8723b2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
+
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
+}
+
+VOID
+halbtc8723b2ant_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
+halbtc8723b2ant_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;
+ }
+ halbtc8723b2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
+
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
+}
+
+VOID
+halbtc8723b2ant_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
+halbtc8723b2ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ //return;
+ 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;
+ }
+ halbtc8723b2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8723b2ant_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, 0x883, 0x3e, val);
+}
+
+VOID
+halbtc8723b2ant_SetSwFullTimeDacSwing(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSwDacSwingOn,
+ IN u4Byte swDacSwingLvl
+ )
+{
+ if(bSwDacSwingOn)
+ {
+ halbtc8723b2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
+ }
+ else
+ {
+ halbtc8723b2ant_SetDacSwingReg(pBtCoexist, 0x18);
+ }
+}
+
+
+VOID
+halbtc8723b2ant_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);
+ halbtc8723b2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
+
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
+}
+
+VOID
+halbtc8723b2ant_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, 0xc05, 0x30, 0x3);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xc05, 0x30, 0x1);
+ }
+}
+
+VOID
+halbtc8723b2ant_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;
+ }
+ halbtc8723b2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
+
+ pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
+}
+
+VOID
+halbtc8723b2ant_SetAgcTable(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAgcTableEn
+ )
+{
+ u1Byte rssiAdjustVal=0;
+
+ //=================BB AGC Gain Table
+ if(bAgcTableEn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table On!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6e1A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6d1B0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6c1C0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6b1D0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6a1E0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x691F0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x68200001);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table Off!\n"));
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xaa1A0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa91B0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa81C0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa71D0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa61E0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa51F0001);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa4200001);
+ }
+
+
+ //=================RF Gain
+ 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, 0x38fff);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x38ffe);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x380c3);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x28ce6);
+ }
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x1);
+ if(bAgcTableEn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38fff);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38ffe);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x380c3);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x28ce6);
+ }
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x0);
+
+ // set rssiAdjustVal for wifi module.
+ if(bAgcTableEn)
+ {
+ rssiAdjustVal = 8;
+ }
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
+}
+
+VOID
+halbtc8723b2ant_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;
+ }
+ halbtc8723b2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
+
+ pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
+}
+
+VOID
+halbtc8723b2ant_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
+halbtc8723b2ant_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;
+ }
+ halbtc8723b2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8723b2ant_CoexTableWithType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type
+ )
+{
+ switch(type)
+ {
+ case 0:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffff, 0x3);
+ break;
+ case 1:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5afa5afa, 0xffff, 0x3);
+ break;
+ case 2:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3);
+ break;
+ case 3:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff, 0x3);
+ break;
+ case 4:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffff, 0x3);
+ break;
+ case 5:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffff, 0x3);
+ break;
+ case 6:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
+ break;
+ case 7:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3);
+ break;
+ case 8:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3);
+ break;
+ case 9:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5aea5aea, 0xffff, 0x3);
+ break;
+ case 10:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5aff5aff, 0xffff, 0x3);
+ break;
+ case 11:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3);
+ break;
+ case 12:
+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5f5f5f5f, 0xffff, 0x3);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8723b2ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8723b2ant_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;
+ }
+ halbtc8723b2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8723b2ant_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};
+
+ H2C_Parameter[0] = byte1;
+ H2C_Parameter[1] = byte2;
+ H2C_Parameter[2] = byte3;
+ H2C_Parameter[3] = byte4;
+ H2C_Parameter[4] = byte5;
+
+ pCoexDm->psTdmaPara[0] = byte1;
+ pCoexDm->psTdmaPara[1] = byte2;
+ pCoexDm->psTdmaPara[2] = byte3;
+ pCoexDm->psTdmaPara[3] = byte4;
+ pCoexDm->psTdmaPara[4] = byte5;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
+halbtc8723b2ant_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;
+ }
+ */
+
+ halbtc8723b2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF);
+ halbtc8723b2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
+}
+
+VOID
+halbtc8723b2ant_SwMechanism2(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAGCTableShift,
+ IN BOOLEAN bADCBackOff,
+ IN BOOLEAN bSWDACSwing,
+ IN u4Byte dacSwingLvl
+ )
+{
+ halbtc8723b2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift);
+ //halbtc8723b2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff);
+ halbtc8723b2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl);
+}
+
+VOID
+halbtc8723b2ant_SetAntPath(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte antPosType,
+ IN BOOLEAN bInitHwCfg,
+ IN BOOLEAN bWifiOff
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ u4Byte fwVer=0, u4Tmp=0;
+ BOOLEAN bPgExtSwitch=FALSE;
+ BOOLEAN bUseExtSwitch=FALSE;
+ u1Byte H2C_Parameter[2] ={0};
+
+ 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)
+ bUseExtSwitch = TRUE;
+
+ 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->fBtcWrite1Byte(pBtCoexist, 0x974, 0xff);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x944, 0x3, 0x3);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x930, 0x77);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1);
+
+ //Force GNT_BT to low
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x0);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0);
+
+ if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT)
+ {
+ //tell firmware "no antenna inverse"
+ H2C_Parameter[0] = 0;
+ }
+ else
+ {
+ //tell firmware "antenna inverse"
+ H2C_Parameter[0] = 1;
+ }
+
+ if (bUseExtSwitch)
+ {
+ //ext switch type
+ H2C_Parameter[1] = 1;
+ }
+ else
+ {
+ //int switch type
+ H2C_Parameter[1] = 0;
+ }
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter);
+ }
+
+
+ // ext switch setting
+ if(bUseExtSwitch)
+ {
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); // fixed internal switch S1->WiFi, S0->BT
+ switch(antPosType)
+ {
+ case BTC_ANT_WIFI_AT_MAIN:
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); // ext switch main at wifi
+ break;
+ case BTC_ANT_WIFI_AT_AUX:
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); // ext switch aux at wifi
+ break;
+ }
+ }
+ else // internal switch
+ {
+ // fixed ext switch
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1);
+ switch(antPosType)
+ {
+ case BTC_ANT_WIFI_AT_MAIN:
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); // fixed internal switch S1->WiFi, S0->BT
+ break;
+ case BTC_ANT_WIFI_AT_AUX:
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); // fixed internal switch S0->WiFi, S1->BT
+ break;
+ }
+ }
+}
+
+VOID
+halbtc8723b2ant_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:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+ case 2:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
+ break;
+ case 3:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90);
+ break;
+ case 4:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xf1, 0x90);
+ break;
+ case 5:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
+ break;
+ case 6:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
+ break;
+ case 7:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90);
+ break;
+ case 8:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90);
+ break;
+ case 9:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+ case 10:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
+ break;
+ case 11:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x90);
+ break;
+ case 12:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
+ break;
+ case 13:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
+ break;
+ case 14:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
+ break;
+ case 15:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x90);
+ break;
+ case 16:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x90);
+ break;
+ case 17:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x90);
+ break;
+ case 18:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
+ break;
+ case 19:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90);
+ break;
+ case 20:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);
+ break;
+ case 21:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);
+ break;
+ case 71:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(type)
+ {
+ case 0:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0);
+ break;
+ case 1:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x48, 0x0);
+ break;
+ default:
+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0);
+ break;
+ }
+ }
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+VOID
+halbtc8723b2ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // fw all off
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ // sw all off
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ // hw all off
+ //pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+VOID
+halbtc8723b2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+
+ halbtc8723b2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE);
+
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+}
+
+VOID
+halbtc8723b2ant_ActionBtInquiry(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiConnected=FALSE;
+ BOOLEAN bLowPwrDisable=TRUE;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ if(bWifiConnected)
+ {
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ }
+ else
+ {
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ pCoexDm->bNeedRecover0x948 = TRUE;
+ pCoexDm->backup0x948 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x948);
+
+ halbtc8723b2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_AUX, FALSE, FALSE);
+}
+BOOLEAN
+halbtc8723b2ant_IsCommonAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
+ BOOLEAN bBtHsOn=FALSE, bLowPwrDisable=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if(!bWifiConnected)
+ {
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-connected idle!!\n"));
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ if(BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xb);
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else if(BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ bLowPwrDisable = TRUE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ if(bBtHsOn)
+ return FALSE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xb);
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ 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 Connected-Busy + BT Busy!!\n"));
+ bCommon = FALSE;
+ }
+ else
+ {
+ if(bBtHsOn)
+ return FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21);
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xb);
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ bCommon = TRUE;
+ }
+ }
+ }
+
+ return bCommon;
+}
+VOID
+halbtc8723b2ant_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->bAutoTdmaAdjust)
+ {
+ pCoexDm->bAutoTdmaAdjust = TRUE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
+ {
+ if(bScoHid)
+ {
+ if(bTxPause)
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ }
+ else
+ {
+ if(bTxPause)
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else
+ {
+ halbtc8723b2ant_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)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_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)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
+ pCoexDm->psTdmaDuAdjType = 71;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 71)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
+ pCoexDm->psTdmaDuAdjType = 71;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_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)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_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)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_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)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_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)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8723b2ant_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)
+ {
+ halbtc8723b2ant_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"));
+ }
+ }
+}
+
+// SCO only or SCO+PAN(HS)
+VOID
+halbtc8723b2ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 4);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_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
+ {
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else //for SCO quality & wifi performance balance at 11n mode
+ {
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8);
+ }
+
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x4);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x4);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x4);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x4);
+ }
+ }
+}
+
+
+VOID
+halbtc8723b2ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_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
+ {
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+ }
+ else //for HID quality & wifi performance balance at 11n mode
+ {
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 9);
+ }
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+ else
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8723b2ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, wifiRssiState1, btRssiState;
+ u4Byte wifiBw;
+ u1Byte apNum=0;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ wifiRssiState1 = halbtc8723b2ant_WifiRssiState(pBtCoexist, 1, 2, 40, 0);
+ btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum);
+
+ // define the office environment
+ if(apNum >= 10 && BTC_RSSI_HIGH(wifiRssiState1))
+ {
+ //DbgPrint(" AP#>10(%d)\n", apNum);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x18);
+ }
+ return;
+ }
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
+ }
+ else
+ {
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
+ }
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8723b2ant_ActionA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8723b2ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 10);
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ }
+ else
+ {
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ }
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+
+//PAN(HS) only
+VOID
+halbtc8723b2ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+
+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8723b2ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 12);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ else
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+ else
+ {
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8723b2ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 3);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 11);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780);
+ }
+ else
+ {
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ }
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
+ }
+ else
+ {
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 11);
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8723b2ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ else
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
+ }
+ else
+ {
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8723b2ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8723b2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
+ }
+ else
+ {
+ halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8723b2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8723b2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8723b2ant_RunCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiUnder5G=FALSE, bBtHsOn=FALSE;
+ u1Byte btInfoOriginal=0, btRetryCnt=0;
+ u1Byte algorithm=0;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
+ return;
+ }
+
+ if(pCoexSta->bUnderIps)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
+ return;
+ }
+
+ algorithm = halbtc8723b2ant_ActionAlgorithm(pBtCoexist);
+ if(pCoexSta->bC2hBtInquiryPage && (BT_8723B_2ANT_COEX_ALGO_PANHS!=algorithm))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));
+ halbtc8723b2ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else
+ {
+ if(pCoexDm->bNeedRecover0x948)
+ {
+ pCoexDm->bNeedRecover0x948 = FALSE;
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, pCoexDm->backup0x948);
+ }
+ }
+
+ pCoexDm->curAlgorithm = algorithm;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
+
+ if(halbtc8723b2ant_IsCommonAction(pBtCoexist))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n"));
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ else
+ {
+ if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n",
+ pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8723B_2ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
+ halbtc8723b2ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
+ halbtc8723b2ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
+ halbtc8723b2ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));
+ halbtc8723b2ant_ActionA2dpPanHs(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
+ halbtc8723b2ant_ActionPanEdr(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
+ halbtc8723b2ant_ActionPanHs(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
+ halbtc8723b2ant_ActionPanEdrA2dp(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_PANEDR_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
+ halbtc8723b2ant_ActionPanEdrHid(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
+ halbtc8723b2ant_ActionHidA2dpPanEdr(pBtCoexist);
+ break;
+ case BT_8723B_2ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
+ halbtc8723b2ant_ActionHidA2dp(pBtCoexist);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
+ halbtc8723b2ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+}
+
+VOID
+halbtc8723b2ant_WifiOffHwCfg(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PADAPTER padapter=pBtCoexist->Adapter;
+ // 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
+
+ //Force GNT_BT to High
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x3);
+ if(padapter->registrypriv.mp_mode ==0)
+ 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
+}
+
+//============================================================
+// work around function start with wa_halbtc8723b2ant_
+//============================================================
+//============================================================
+// extern function start with EXhalbtc8723b2ant_
+//============================================================
+VOID
+EXhalbtc8723b2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ u4Byte u4Tmp=0, fwVer;
+ u2Byte u2Tmp=0;
+ u1Byte u1Tmp=0;
+ u1Byte H2C_Parameter[2] ={0};
+
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
+
+ //pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); //WiFi goto standby while GNT_BT 0-->1
+ //pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 0x3c, 0x1); //BT goto standby while GNT_BT 1-->0
+
+ // backup rf 0x1e value
+ pCoexDm->btRf0x1eBackup =
+ pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
+
+ // 0x790[5:0]=0x5
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
+ u1Tmp &= 0xc0;
+ u1Tmp |= 0x5;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
+
+ //Antenna config
+ halbtc8723b2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_MAIN, TRUE, FALSE);
+
+ // PTA parameter
+ halbtc8723b2ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+
+ // Enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); //0x76e[3] =1, WLAN_Act control by PTA
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1);
+
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); //WiFi goto standby while GNT_BT 0-->1
+}
+
+VOID
+EXhalbtc8723b2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ halbtc8723b2ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8723b2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ 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, faOfdm, faCck;
+ u1Byte wifiDot11Chnl, wifiHsChnl;
+ u4Byte fwVer=0, btPatchVer=0;
+ u1Byte apNum=0;
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============");
+ CL_PRINTF(cliBuf);
+
+ if(pBtCoexist->bManualControl)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ 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);
+
+ 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_%x/ 0x%x/ 0x%x(%d)", "CoexVer/ FwVer/ PatchVer", \
+ GLCoexVerDate8723b2Ant, GLCoexVer8723b2Ant, 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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, wifiHsChnl, bBtHsOn);
+ 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);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d", "Wifi rssi/ HS rssi/ AP#", \
+ wifiRssi, btHsRssi, apNum);
+ 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]", \
+ ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
+ ( (BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
+ pCoexSta->btRssi, pCoexSta->btRetryCnt);
+ CL_PRINTF(cliBuf);
+
+ 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);
+ 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; i<BT_INFO_SRC_8723B_2ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723b2Ant[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);
+
+ psTdmaCase = pCoexDm->curPsTdma;
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
+ pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
+ pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
+ pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust);
+ 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);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x778/0x880[29:25]", \
+ u1Tmp[0], (u4Tmp[0]&0x3e000000) >> 25);
+ CL_PRINTF(cliBuf);
+
+
+ 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]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x92c);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x944);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x92c[1:0]/ 0x930[7:0]/0x944[1:0]", \
+ u4Tmp[0]&0x3, u4Tmp[1]&0xff, u4Tmp[2]&0x3);
+ CL_PRINTF(cliBuf);
+
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x39);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x64);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x38[11]/0x40/0x4c[24:23]/0x64[0]", \
+ ((u1Tmp[0] & 0x8)>>3), u1Tmp[1], ((u4Tmp[0]&0x01800000)>>23), u1Tmp[2]&0x1);
+ 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, 0x49c);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xc50(dig)/0x49c(null-drop)", \
+ u4Tmp[0]&0xff, u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
+ u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xcf0);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5b);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5c);
+
+ faOfdm = ((u4Tmp[0]&0xffff0000) >> 16) + ((u4Tmp[1]&0xffff0000) >> 16) + (u4Tmp[1] & 0xffff) + (u4Tmp[2] & 0xffff) + \
+ ((u4Tmp[3]&0xffff0000) >> 16) + (u4Tmp[3] & 0xffff) ;
+ faCck = (u1Tmp[0] << 8) + u1Tmp[1];
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "OFDM-CCA/OFDM-FA/CCK-FA", \
+ u4Tmp[0]&0xffff, faOfdm, faCck);
+ CL_PRINTF(cliBuf);
+
+ 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_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(high-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);
+#if(BT_AUTO_REPORT_ONLY_8723B_2ANT == 1)
+ halbtc8723b2ant_MonitorBtCtr(pBtCoexist);
+#endif
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8723b2ant_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;
+ halbtc8723b2ant_WifiOffHwCfg(pBtCoexist);
+ halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ halbtc8723b2ant_CoexAllOff(pBtCoexist);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ pCoexSta->bUnderIps = FALSE;
+ EXhalbtc8723b2ant_InitHwConfig(pBtCoexist);
+ halbtc8723b2ant_InitCoexDm(pBtCoexist);
+ halbtc8723b2ant_QueryBtInfo(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8723b2ant_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
+EXhalbtc8723b2ant_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
+EXhalbtc8723b2ant_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
+EXhalbtc8723b2ant_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;
+ }
+
+ 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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
+}
+
+VOID
+EXhalbtc8723b2ant_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
+EXhalbtc8723b2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ u1Byte btInfo=0;
+ u1Byte i, rspSource=0;
+ BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+ static BOOLEAN bPreScoExist=FALSE;
+ u4Byte raMask=0x0;
+
+ pCoexSta->bC2hBtInfoReqSent = FALSE;
+
+ rspSource = tmpBuf[0]&0xf;
+ if(rspSource >= BT_INFO_SRC_8723B_2ANT_MAX)
+ rspSource = BT_INFO_SRC_8723B_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; i<length; i++)
+ {
+ 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]));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
+ }
+ }
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Manual CTRL<===\n"));
+ return;
+ }
+
+ if(BT_INFO_SRC_8723B_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 (pCoexSta->btInfoC2h[rspSource][2] & 0x40)
+ {
+ /* BT into is responded by BT FW and BT RF REG 0x3C != 0x01 => Need to switch GNT_BT */
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Switch GNT_BT since BT RF REG 0x3C != 0x01\n"));
+ pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 0x3c, 0x01);
+ }
+
+ // Here we need to resend some wifi info to BT
+ // because bt is reset and loss of the info.
+ if( (pCoexSta->btInfoExt & BIT1) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+ }
+
+ if( (pCoexSta->btInfoExt & BIT3) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
+ halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+ }
+ else
+ {
+ // BT already NOT ignore Wlan active, do nothing here.
+ }
+#if(BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
+ if( (pCoexSta->btInfoExt & BIT4) )
+ {
+ // BT auto report already enabled, do nothing
+ }
+ else
+ {
+ halbtc8723b2ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
+ }
+#endif
+ }
+
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8723B_2ANT_B_INQ_PAGE)
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ else
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+
+ // set link exist status
+ if(!(btInfo&BT_INFO_8723B_2ANT_B_CONNECTION))
+ {
+ pCoexSta->bBtLinkExist = FALSE;
+ pCoexSta->bPanExist = FALSE;
+ pCoexSta->bA2dpExist = FALSE;
+ pCoexSta->bHidExist = FALSE;
+ pCoexSta->bScoExist = FALSE;
+ }
+ else // connection exists
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ if(btInfo & BT_INFO_8723B_2ANT_B_FTP)
+ pCoexSta->bPanExist = TRUE;
+ else
+ pCoexSta->bPanExist = FALSE;
+ if(btInfo & BT_INFO_8723B_2ANT_B_A2DP)
+ pCoexSta->bA2dpExist = TRUE;
+ else
+ pCoexSta->bA2dpExist = FALSE;
+ if(btInfo & BT_INFO_8723B_2ANT_B_HID)
+ pCoexSta->bHidExist = TRUE;
+ else
+ pCoexSta->bHidExist = FALSE;
+ if(btInfo & BT_INFO_8723B_2ANT_B_SCO_ESCO)
+ pCoexSta->bScoExist = TRUE;
+ else
+ pCoexSta->bScoExist = FALSE;
+ }
+
+ halbtc8723b2ant_UpdateBtLinkInfo(pBtCoexist);
+
+ if(!(btInfo&BT_INFO_8723B_2ANT_B_CONNECTION))
+ {
+ pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
+ }
+ else if(btInfo == BT_INFO_8723B_2ANT_B_CONNECTION) // connection exists but no busy
+ {
+ pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
+ }
+ else if((btInfo&BT_INFO_8723B_2ANT_B_SCO_ESCO) ||
+ (btInfo&BT_INFO_8723B_2ANT_B_SCO_BUSY))
+ {
+ pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_SCO_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
+ }
+ else if(btInfo&BT_INFO_8723B_2ANT_B_ACL_BUSY)
+ {
+ pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_ACL_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
+ }
+ else
+ {
+ pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_MAX;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
+ }
+
+ if( (BT_8723B_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_2ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ bBtBusy = TRUE;
+ bLimitedDig = TRUE;
+ }
+ else
+ {
+ bBtBusy = FALSE;
+ bLimitedDig = FALSE;
+ }
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+
+ pCoexDm->bLimitedDig = bLimitedDig;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
+
+ halbtc8723b2ant_RunCoexistMechanism(pBtCoexist);
+}
+
+VOID
+EXhalbtc8723b2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ halbtc8723b2ant_WifiOffHwCfg(pBtCoexist);
+ pBtCoexist->fBtcSetBtReg(pBtCoexist, 0, 0x3c, 0x15); //BT goto standby while GNT_BT 1-->0
+ halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+
+ EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8723b2ant_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", \
+ GLCoexVerDate8723b2Ant, GLCoexVer8723b2Ant, fwVer, btPatchVer, btPatchVer));
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
+ }
+
+#if(BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
+ halbtc8723b2ant_QueryBtInfo(pBtCoexist);
+ halbtc8723b2ant_MonitorBtCtr(pBtCoexist);
+ halbtc8723b2ant_MonitorBtEnableDisable(pBtCoexist);
+#else
+ if( halbtc8723b2ant_IsWifiStatusChanged(pBtCoexist) ||
+ pCoexDm->bAutoTdmaAdjust)
+ {
+ halbtc8723b2ant_RunCoexistMechanism(pBtCoexist);
+ }
+#endif
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h
index b894db0..e758414 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h
@@ -1,186 +1,186 @@
-//===========================================
-// The following is for 8723B 2Ant BT Co-exist definition
-//===========================================
-#define BT_AUTO_REPORT_ONLY_8723B_2ANT 1
-
-
-#define BT_INFO_8723B_2ANT_B_FTP BIT7
-#define BT_INFO_8723B_2ANT_B_A2DP BIT6
-#define BT_INFO_8723B_2ANT_B_HID BIT5
-#define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8723B_2ANT_B_CONNECTION BIT0
-
-#define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2
-
-typedef enum _BT_INFO_SRC_8723B_2ANT{
- BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8723B_2ANT_MAX
-}BT_INFO_SRC_8723B_2ANT,*PBT_INFO_SRC_8723B_2ANT;
-
-typedef enum _BT_8723B_2ANT_BT_STATUS{
- BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
- BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
- BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
- BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
- BT_8723B_2ANT_BT_STATUS_MAX
-}BT_8723B_2ANT_BT_STATUS,*PBT_8723B_2ANT_BT_STATUS;
-
-typedef enum _BT_8723B_2ANT_COEX_ALGO{
- BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8723B_2ANT_COEX_ALGO_SCO = 0x1,
- BT_8723B_2ANT_COEX_ALGO_HID = 0x2,
- BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3,
- BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
- BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5,
- BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6,
- BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
- BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
- BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
- BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
- BT_8723B_2ANT_COEX_ALGO_MAX = 0xb,
-}BT_8723B_2ANT_COEX_ALGO,*PBT_8723B_2ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8723B_2ANT{
- // fw mechanism
- BOOLEAN bPreDecBtPwr;
- BOOLEAN bCurDecBtPwr;
- u1Byte preFwDacSwingLvl;
- u1Byte curFwDacSwingLvl;
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- u1Byte psTdmaDuAdjType;
- BOOLEAN bResetTdmaAdjust;
- BOOLEAN bAutoTdmaAdjust;
- 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;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-
- BOOLEAN bNeedRecover0x948;
- u4Byte backup0x948;
-} COEX_DM_8723B_2ANT, *PCOEX_DM_8723B_2ANT;
-
-typedef struct _COEX_STA_8723B_2ANT{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bA2dpExist;
- 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_8723B_2ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8723B_2ANT_MAX];
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
-}COEX_STA_8723B_2ANT, *PCOEX_STA_8723B_2ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8723b2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b2ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b2ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b2ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b2ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b2ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8723b2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8723b2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8723b2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-
+//===========================================
+// The following is for 8723B 2Ant BT Co-exist definition
+//===========================================
+#define BT_AUTO_REPORT_ONLY_8723B_2ANT 1
+
+
+#define BT_INFO_8723B_2ANT_B_FTP BIT7
+#define BT_INFO_8723B_2ANT_B_A2DP BIT6
+#define BT_INFO_8723B_2ANT_B_HID BIT5
+#define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8723B_2ANT_B_CONNECTION BIT0
+
+#define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2
+
+typedef enum _BT_INFO_SRC_8723B_2ANT{
+ BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8723B_2ANT_MAX
+}BT_INFO_SRC_8723B_2ANT,*PBT_INFO_SRC_8723B_2ANT;
+
+typedef enum _BT_8723B_2ANT_BT_STATUS{
+ BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
+ BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
+ BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
+ BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
+ BT_8723B_2ANT_BT_STATUS_MAX
+}BT_8723B_2ANT_BT_STATUS,*PBT_8723B_2ANT_BT_STATUS;
+
+typedef enum _BT_8723B_2ANT_COEX_ALGO{
+ BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8723B_2ANT_COEX_ALGO_SCO = 0x1,
+ BT_8723B_2ANT_COEX_ALGO_HID = 0x2,
+ BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
+ BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5,
+ BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6,
+ BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
+ BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
+ BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
+ BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
+ BT_8723B_2ANT_COEX_ALGO_MAX = 0xb,
+}BT_8723B_2ANT_COEX_ALGO,*PBT_8723B_2ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8723B_2ANT{
+ // fw mechanism
+ BOOLEAN bPreDecBtPwr;
+ BOOLEAN bCurDecBtPwr;
+ u1Byte preFwDacSwingLvl;
+ u1Byte curFwDacSwingLvl;
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ u1Byte psTdmaDuAdjType;
+ BOOLEAN bResetTdmaAdjust;
+ BOOLEAN bAutoTdmaAdjust;
+ 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;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+
+ BOOLEAN bNeedRecover0x948;
+ u4Byte backup0x948;
+} COEX_DM_8723B_2ANT, *PCOEX_DM_8723B_2ANT;
+
+typedef struct _COEX_STA_8723B_2ANT{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bA2dpExist;
+ 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_8723B_2ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8723B_2ANT_MAX];
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+}COEX_STA_8723B_2ANT, *PCOEX_STA_8723B_2ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8723b2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b2ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b2ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b2ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b2ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b2ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8723b2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8723b2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8723b2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c
index 9f4e49a..3a21622 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c
@@ -1,2973 +1,2973 @@
-//============================================================
-// Description:
-//
-// This file is for 8812a1ant Co-exist mechanism
-//
-// History
-// 2012/11/15 Cosa first check in.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8812A_1ANT GLCoexDm8812a1Ant;
-static PCOEX_DM_8812A_1ANT pCoexDm=&GLCoexDm8812a1Ant;
-static COEX_STA_8812A_1ANT GLCoexSta8812a1Ant;
-static PCOEX_STA_8812A_1ANT pCoexSta=&GLCoexSta8812a1Ant;
-
-const char *const GLBtInfoSrc8812a1Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-u4Byte GLCoexVerDate8812a1Ant=20130729;
-u4Byte GLCoexVer8812a1Ant=0x10;
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8812a1ant_
-//============================================================
-u1Byte
-halbtc8812a1ant_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_8812A_1ANT))
- {
- 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_8812A_1ANT))
- {
- 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_8812A_1ANT))
- {
- 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
-halbtc8812a1ant_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_8812A_1ANT))
- {
- 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_8812A_1ANT))
- {
- 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_8812A_1ANT))
- {
- 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
-halbtc8812a1ant_UpdateRaMask(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type,
- IN u4Byte rateMask
- )
-{
- if(BTC_RATE_DISABLE == type)
- {
- pCoexDm->curRaMask |= rateMask; // disable rate
- }
- else if(BTC_RATE_ENABLE == type)
- {
- pCoexDm->curRaMask &= ~rateMask; // enable rate
- }
-
- if( bForceExec || (pCoexDm->preRaMask != pCoexDm->curRaMask))
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_UPDATE_RAMASK, &pCoexDm->curRaMask);
- }
- pCoexDm->preRaMask = pCoexDm->curRaMask;
-}
-
-VOID
-halbtc8812a1ant_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, 0xc);
-}
-
-VOID
-halbtc8812a1ant_QueryBtInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte dataLen=3;
- u1Byte buf[5] = {0};
-
- if(!pBtCoexist->btInfo.bBtDisabled)
- {
- if(!pCoexSta->btInfoQueryCnt ||
- (pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8812A_1ANT_BT_RSP]-pCoexSta->btInfoQueryCnt)>2)
- {
- buf[0] = dataLen;
- buf[1] = 0x1; // polling enable, 1=enable, 0=disable
- buf[2] = 0x2; // polling time in seconds
- buf[3] = 0x1; // auto report enable, 1=enable, 0=disable
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_INFO, (PVOID)&buf[0]);
- }
- }
- pCoexSta->btInfoQueryCnt++;
-}
-
-VOID
-halbtc8812a1ant_UpdateBtLinkInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
- pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
- pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
- pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
- pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
-
- // check if Sco only
- if( pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bScoOnly = TRUE;
- else
- pBtLinkInfo->bScoOnly = FALSE;
-
- // check if A2dp only
- if( !pBtLinkInfo->bScoExist &&
- pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bA2dpOnly = TRUE;
- else
- pBtLinkInfo->bA2dpOnly = FALSE;
-
- // check if Pan only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bPanOnly = TRUE;
- else
- pBtLinkInfo->bPanOnly = FALSE;
-
- // check if Hid only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bHidExist )
- pBtLinkInfo->bHidOnly = TRUE;
- else
- pBtLinkInfo->bHidOnly = FALSE;
-}
-
-u1Byte
-halbtc8812a1ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8812A_1ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!pBtLinkInfo->bBtLinkExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No profile exists!!!\n"));
- return algorithm;
- }
-
- if(pBtLinkInfo->bScoExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bHidExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bPanExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bA2dpExist)
- numOfDiffProfile++;
-
- if(numOfDiffProfile == 1)
- {
- if(pBtLinkInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_A2DP;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile == 2)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_SCO;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP;
- }
- }
- }
- }
- else if(numOfDiffProfile == 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_HID;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile >= 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->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_8812A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-VOID
-halbtc8812a1ant_SetBtAutoReport(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bEnableAutoReport
- )
-{
-}
-
-VOID
-halbtc8812a1ant_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;
- }
- halbtc8812a1ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
-
- pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
-}
-
-VOID
-halbtc8812a1ant_SetSwPenaltyTxRateAdaptive(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- u1Byte tmpU1;
-
- tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
- tmpU1 |= BIT0;
- if(bLowPenaltyRa)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
- tmpU1 &= ~BIT2;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
- tmpU1 |= BIT2;
- }
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
-}
-
-VOID
-halbtc8812a1ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- return;
- 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;
- }
- halbtc8812a1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8812a1ant_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
-halbtc8812a1ant_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;
- }
- halbtc8812a1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8812a1ant_CoexTableWithType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type
- )
-{
- switch(type)
- {
- case 0:
- halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffff, 0x3);
- break;
- case 1:
- halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffff, 0x3);
- break;
- case 2:
- halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3);
- break;
- case 3:
- halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff, 0x3);
- break;
- case 4:
- halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffff, 0x3);
- break;
- case 5:
- halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffff, 0x3);
- break;
- case 6:
- halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
- break;
- case 7:
- halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x5afa5afa, 0x5afa5afa, 0xffff, 0x3);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8812a1ant_SetFwIgnoreWlanAct(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bEnable
- )
-{
- u1Byte dataLen=3;
- u1Byte buf[5] = {0};
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], %s BT Ignore Wlan_Act\n",
- (bEnable? "Enable":"Disable")));
-
- buf[0] = dataLen;
- buf[1] = 0x1; // OP_Code
- buf[2] = 0x1; // OP_Code_Length
- if(bEnable)
- buf[3] = 0x1; // OP_Code_Content
- else
- buf[3] = 0x0;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
-}
-
-VOID
-halbtc8812a1ant_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;
- }
- halbtc8812a1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8812a1ant_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};
-
- H2C_Parameter[0] = byte1;
- H2C_Parameter[1] = byte2;
- H2C_Parameter[2] = byte3;
- H2C_Parameter[3] = byte4;
- H2C_Parameter[4] = byte5;
-
- pCoexDm->psTdmaPara[0] = byte1;
- pCoexDm->psTdmaPara[1] = byte2;
- pCoexDm->psTdmaPara[2] = byte3;
- pCoexDm->psTdmaPara[3] = byte4;
- pCoexDm->psTdmaPara[4] = byte5;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
-halbtc8812a1ant_SetLpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- u1Byte lps=lpsVal;
- u1Byte rpwm=rpwmVal;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
-}
-
-VOID
-halbtc8812a1ant_LpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bForceExecPwrCmd=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
- (bForceExec? "force to":""), lpsVal, rpwmVal));
- pCoexDm->curLps = lpsVal;
- pCoexDm->curRpwm = rpwmVal;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preLps/curLps=0x%x/0x%x, preRpwm/curRpwm=0x%x/0x%x!!\n",
- pCoexDm->preLps, pCoexDm->curLps, pCoexDm->preRpwm, pCoexDm->curRpwm));
-
- if( (pCoexDm->preLps == pCoexDm->curLps) &&
- (pCoexDm->preRpwm == pCoexDm->curRpwm) )
- {
- return;
- }
- }
- halbtc8812a1ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
-
- pCoexDm->preLps = pCoexDm->curLps;
- pCoexDm->preRpwm = pCoexDm->curRpwm;
-}
-
-VOID
-halbtc8812a1ant_SetAntPath(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte antPosType,
- IN BOOLEAN bInitHwCfg,
- IN BOOLEAN bWifiOff
- )
-{
- u1Byte u1Tmp=0;
-
- if(bInitHwCfg)
- {
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb3, 0x77);
-
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x900, 0x00000400);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76d, 0x1);
- }
- else if(bWifiOff)
- {
-
- }
-
- // ext switch setting
- switch(antPosType)
- {
- case BTC_ANT_PATH_WIFI:
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
- u1Tmp |= BIT3;
- u1Tmp &= ~BIT2;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb7, u1Tmp);
- break;
- case BTC_ANT_PATH_BT:
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
- u1Tmp &= ~BIT3;
- u1Tmp |= BIT2;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb7, u1Tmp);
- break;
- default:
- case BTC_ANT_PATH_PTA:
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
- u1Tmp |= BIT3;
- u1Tmp &= ~BIT2;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb7, u1Tmp);
- break;
- }
-}
-
-VOID
-halbtc8812a1ant_PsTdma(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bTurnOn,
- IN u1Byte type
- )
-{
- BOOLEAN bTurnOnByCnt=FALSE;
- u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=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)
- {
- default:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x50);
- break;
- case 1:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x50);
- rssiAdjustVal = 11;
- break;
- case 2:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x12, 0x0, 0x50);
- rssiAdjustVal = 14;
- break;
- case 3:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x40);
- break;
- case 4:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
- rssiAdjustVal = 17;
- break;
- case 5:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x31, 0x0);
- break;
- case 6:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x0, 0x0);
- break;
- case 7:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0);
- break;
- case 8:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
- break;
- case 9:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0xa, 0xa, 0x0, 0x50);
- rssiAdjustVal = 18;
- break;
- case 10:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40);
- break;
- case 11:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x5, 0x5, 0x0, 0x50);
- rssiAdjustVal = 20;
- break;
- case 12:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xeb, 0xa, 0x3, 0x31, 0x18);
- break;
-
- case 15:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x8, 0x0);
- break;
- case 16:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x10, 0x0);
- rssiAdjustVal = 18;
- break;
-
- case 18:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
- rssiAdjustVal = 14;
- break;
-
- case 20:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0x25, 0x25, 0x0, 0x0);
- break;
- case 21:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x20, 0x3, 0x10, 0x40);
- break;
- case 22:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0x8, 0x8, 0x0, 0x40);
- break;
- case 23:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 24:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 25:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 26:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 27:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x98);
- rssiAdjustVal = 22;
- break;
- case 28:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x69, 0x25, 0x3, 0x31, 0x0);
- break;
- case 29:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10);
- break;
- case 30:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
- break;
- case 31:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58);
- break;
- case 32:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xab, 0xa, 0x3, 0x31, 0x90);
- break;
- case 33:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90);
- break;
- case 34:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x10);
- break;
- case 35:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x0, 0x10);
- break;
- case 36:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x3, 0x14, 0x50);
- break;
- case 37:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x53, 0x25, 0x3, 0x10, 0x50);
- break;
- }
- }
- else
- {
- // disable PS tdma
- switch(type)
- {
- case 8:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
- halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE);
- break;
- case 0:
- default:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
- halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
- break;
- case 9:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
- halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE);
- break;
- case 10:
- halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
- halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
- break;
- }
- }
- rssiAdjustVal =0;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal);
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-VOID
-halbtc8812a1ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // hw all off
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-BOOLEAN
-halbtc8812a1ant_IsCommonAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if(!bWifiConnected &&
- BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"));
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"));
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n"));
-
- bCommon = TRUE;
- }
- else
- {
- bCommon = FALSE;
- }
-
- return bCommon;
-}
-
-
-VOID
-halbtc8812a1ant_TdmaDurationAdjustForAcl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- static s4Byte up,dn,m,n,WaitCount;
- s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
- u1Byte retryCount=0, btInfoExt;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjustForAcl()\n"));
-
- if( (BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
- (BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
- (BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
- {
- if( pCoexDm->curPsTdma != 1 &&
- pCoexDm->curPsTdma != 2 &&
- pCoexDm->curPsTdma != 3 &&
- pCoexDm->curPsTdma != 9 )
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
-
- up = 0;
- dn = 0;
- m = 1;
- n= 3;
- result = 0;
- WaitCount = 0;
- }
- return;
- }
-
- if(pCoexDm->bResetTdmaAdjust)
- {
- pCoexDm->bResetTdmaAdjust = FALSE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
-
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- //============
- 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;
- btInfoExt = pCoexSta->btInfoExt;
- 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"));
- }
-
- if(result == -1)
- {
- if( (BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- else if(result == 1)
- {
- if( (BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- }
-
- if( pCoexDm->curPsTdma != 1 &&
- pCoexDm->curPsTdma != 2 &&
- pCoexDm->curPsTdma != 9 &&
- pCoexDm->curPsTdma != 11 )
- {
- // recover to previous adjust type
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
- }
- }
-}
-
-u1Byte
-halbtc8812a1ant_PsTdmaTypeByWifiRssi(
- IN s4Byte wifiRssi,
- IN s4Byte preWifiRssi,
- IN u1Byte wifiRssiThresh
- )
-{
- u1Byte psTdmaType=0;
-
- if(wifiRssi > preWifiRssi)
- {
- if(wifiRssi > (wifiRssiThresh+5))
- {
- psTdmaType = 26;
- }
- else
- {
- psTdmaType = 25;
- }
- }
- else
- {
- if(wifiRssi > wifiRssiThresh)
- {
- psTdmaType = 26;
- }
- else
- {
- psTdmaType = 25;
- }
- }
-
- return psTdmaType;
-}
-
-VOID
-halbtc8812a1ant_PsTdmaCheckForPowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bNewPsState
- )
-{
- u1Byte lpsMode=0x0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
-
- if(lpsMode) // already under LPS state
- {
- if(bNewPsState)
- {
- // keep state under LPS, do nothing.
- }
- else
- {
- // will leave LPS state, turn off psTdma first
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- }
- else // NO PS state
- {
- if(bNewPsState)
- {
- // will enter LPS state, turn off psTdma first
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- // keep state under NO PS state, do nothing.
- }
- }
-}
-
-VOID
-halbtc8812a1ant_PowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte psType,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bLowPwrDisable=FALSE;
-
- switch(psType)
- {
- case BTC_PS_WIFI_NATIVE:
- // recover to original 32k low power setting
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- break;
- case BTC_PS_LPS_ON:
- halbtc8812a1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
- halbtc8812a1ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
- // when coex force to enter LPS, do not enter 32k low power.
- bLowPwrDisable = TRUE;
- 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);
- break;
- case BTC_PS_LPS_OFF:
- halbtc8812a1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
- break;
- default:
- break;
- }
-}
-
-
-VOID
-halbtc8812a1ant_CoexUnder5G(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 10);
-
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-VOID
-halbtc8812a1ant_ActionWifiOnly(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
-}
-
-VOID
-halbtc8812a1ant_MonitorBtEnableDisable(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- static BOOLEAN bPreBtDisabled=FALSE;
- static u4Byte btDisableCnt=0;
- BOOLEAN bBtActive=TRUE, bBtDisabled=FALSE;
-
- // only 8812a need to consider if core stack is installed.
- if(!pStackInfo->hciVersion)
- {
- bBtActive = 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"));
- halbtc8812a1ant_ActionWifiOnly(pBtCoexist);
- }
- }
- 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
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- }
- }
-}
-
-//=============================================
-//
-// Software Coex Mechanism start
-//
-//=============================================
-
-// SCO only or SCO+PAN(HS)
-VOID
-halbtc8812a1ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8812a1ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8812a1ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8812a1ant_ActionA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8812a1ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-//PAN(HS) only
-VOID
-halbtc8812a1ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8812a1ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8812a1ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8812a1ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-VOID
-halbtc8812a1ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
-}
-
-//=============================================
-//
-// Non-Software Coex Mechanism start
-//
-//=============================================
-
-VOID
-halbtc8812a1ant_ActionHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bHsConnecting=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_CONNECTING, &bHsConnecting);
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action for HS, bHsConnecting=%d!!!\n", bHsConnecting));
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
-
- if(bHsConnecting)
- {
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 3);
- }
- else
- {
- if((pCoexSta->highPriorityTx+pCoexSta->highPriorityRx+
- pCoexSta->lowPriorityTx+pCoexSta->lowPriorityRx)<=1200)
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 3);
- else
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 4);
- }
-}
-
-VOID
-halbtc8812a1ant_ActionBtInquiry(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bWifiConnected=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- if(!bWifiConnected)
- {
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if( (pBtLinkInfo->bScoExist) ||
- (pBtLinkInfo->bHidOnly) )
- {
- // SCO/HID-only busy
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else
- {
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 30);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
-}
-
-VOID
-halbtc8812a1ant_ActionBtScoHidOnlyBusy(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- // tdma and coex table
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
-
- if(BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus)
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- else
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-}
-
-VOID
-halbtc8812a1ant_ActionWifiConnectedBtAclBusy(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
-
- if(pBtLinkInfo->bHidOnly)
- {
- halbtc8812a1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus);
- pCoexDm->bResetTdmaAdjust = TRUE;
- return;
- }
- else if( (pBtLinkInfo->bA2dpOnly) ||
- (pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) )
- {
- halbtc8812a1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus);
- }
- else if( (pBtLinkInfo->bPanOnly) ||
- (pBtLinkInfo->bHidExist&&pBtLinkInfo->bPanExist) )
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->bResetTdmaAdjust = TRUE;
- }
- else
- {
- if( (BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
- (BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
- (BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- else
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->bResetTdmaAdjust = TRUE;
- }
-
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
-}
-
-VOID
-halbtc8812a1ant_ActionWifiNotConnected(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // power save state
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-VOID
-halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-}
-
-VOID
-halbtc8812a1ant_ActionWifiConnectedScan(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // power save state
- if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
- else
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8812a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN);
- }
- else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8812a1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN);
- }
- else
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
-}
-
-VOID
-halbtc8812a1ant_ActionWifiConnectedSpecialPacket(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // power save state
- if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
- else
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8812a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT);
- }
- else
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
-}
-
-VOID
-halbtc8812a1ant_ActionWifiConnected(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiConnected=FALSE, bWifiBusy=FALSE;
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
- BOOLEAN bUnder4way=FALSE;
- u4Byte wifiBw;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n"));
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(!bWifiConnected)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi not connected<===\n"));
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
- if(bUnder4way)
- {
- halbtc8812a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n"));
- return;
- }
-
- 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)
- {
- halbtc8812a1ant_ActionWifiConnectedScan(pBtCoexist);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under scan<===\n"));
- return;
- }
-
- // power save state
- if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
- else
- halbtc8812a1ant_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_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8812a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE);
- }
- else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8812a1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE);
- }
- else
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- }
- else
- {
- if(BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- else if(BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- else if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8812a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY);
- }
- else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- halbtc8812a1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY);
- }
- else
- {
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- }
-}
-
-VOID
-halbtc8812a1ant_RunSwCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiUnder5G=FALSE, bWifiBusy=FALSE, bWifiConnected=FALSE;
- u1Byte btInfoOriginal=0, btRetryCnt=0;
- u1Byte algorithm=0;
-
- return;
-
- algorithm = halbtc8812a1ant_ActionAlgorithm(pBtCoexist);
- pCoexDm->curAlgorithm = algorithm;
-
- if(halbtc8812a1ant_IsCommonAction(pBtCoexist))
- {
- }
- else
- {
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8812A_1ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n"));
- halbtc8812a1ant_ActionSco(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID.\n"));
- halbtc8812a1ant_ActionHid(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n"));
- halbtc8812a1ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP+PAN(HS).\n"));
- halbtc8812a1ant_ActionA2dpPanHs(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n"));
- halbtc8812a1ant_ActionPanEdr(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HS mode.\n"));
- halbtc8812a1ant_ActionPanHs(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN+A2DP.\n"));
- halbtc8812a1ant_ActionPanEdrA2dp(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_PANEDR_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR)+HID.\n"));
- halbtc8812a1ant_ActionPanEdrHid(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP+PAN.\n"));
- halbtc8812a1ant_ActionHidA2dpPanEdr(pBtCoexist);
- break;
- case BT_8812A_1ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP.\n"));
- halbtc8812a1ant_ActionHidA2dp(pBtCoexist);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n"));
- halbtc8812a1ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
-}
-
-VOID
-halbtc8812a1ant_RunCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiUnder5G=FALSE, bWifiBusy=FALSE, bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
- return;
- }
-
- if(pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n"));
- return;
- }
-
- if(pCoexSta->bUnderIps)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\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"));
- halbtc8812a1ant_CoexUnder5G(pBtCoexist);
- return;
- }
-
- halbtc8812a1ant_RunSwCoexistMechanism(pBtCoexist);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8812a1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8812a1ant_ActionHs(pBtCoexist);
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(!bWifiConnected)
- {
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n"));
-
- 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)
- halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- else
- halbtc8812a1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else // wifi LPS/Busy
- {
- halbtc8812a1ant_ActionWifiConnected(pBtCoexist);
- }
-}
-
-VOID
-halbtc8812a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
- halbtc8812a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
- halbtc8812a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-}
-
-//============================================================
-// work around function start with wa_halbtc8812a1ant_
-//============================================================
-//============================================================
-// extern function start with EXhalbtc8812a1ant_
-//============================================================
-VOID
-EXhalbtc8812a1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u4Byte u4Tmp=0;
- u2Byte u2Tmp=0;
- u1Byte u1Tmp=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
-
- //ant sw control to BT
- halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE);
-
- // 0x790[5:0]=0x5
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
- u1Tmp &= 0xc0;
- u1Tmp |= 0x5;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
-
- // PTA parameter
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, 0x0);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, 0xffff);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, 0x55555555);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c0, 0x55555555);
-
- // coex parameters
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1);
-
- // enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
-
- // enable PTA
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
-
- // bt clock related
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4);
- u1Tmp |= BIT7;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4, u1Tmp);
-
- // bt clock related
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x7);
- u1Tmp |= BIT1;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x7, u1Tmp);
-}
-
-VOID
-EXhalbtc8812a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- pBtCoexist->bStopCoexDm = FALSE;
-
- halbtc8812a1ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8812a1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- 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);
-
- if(pBtCoexist->bManualControl)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- CL_PRINTF(cliBuf);
- }
- if(pBtCoexist->bStopCoexDm)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- 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);
-
- 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", \
- GLCoexVerDate8812a1Ant, GLCoexVer8812a1Ant, 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 / HsChnl(HsMode)", \
- wifiDot11Chnl, wifiHsChnl, bBtHsOn);
- 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]", \
- ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
- ( (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
- pCoexSta->btRssi, pCoexSta->btRetryCnt);
- CL_PRINTF(cliBuf);
-
- 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);
- 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; i<BT_INFO_SRC_8812A_1ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8812a1Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
- ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
- ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
- pBtCoexist->btInfo.lpsVal,
- pBtCoexist->btInfo.rpwmVal);
- CL_PRINTF(cliBuf);
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
-
- if(!pBtCoexist->bManualControl)
- {
- // 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 = %s/ %s/ %d ", "DelBA/ BtCtrlAgg/ AggSize", \
- (pBtCoexist->btInfo.bRejectAggPkt? "Yes":"No"), (pBtCoexist->btInfo.bBtCtrlAggBufSize? "Yes":"No"),
- pBtCoexist->btInfo.aggBufSize);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
- pBtCoexist->btInfo.raMask);
- CL_PRINTF(cliBuf);
-
- // Fw mechanism
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
- CL_PRINTF(cliBuf);
-
- 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 = 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);
- }
-
- // Hw setting
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============");
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x778", \
- u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb3);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x900);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0xcb3/0xcb7/0x900", \
- u1Tmp[0], u1Tmp[1], u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
- u1Tmp[0]);
- 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);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
- u4Tmp[0]);
- CL_PRINTF(cliBuf);
-
- 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_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(hp rx[31:16]/tx[15:0])", \
- pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
- pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx);
- CL_PRINTF(cliBuf);
-
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8812a1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u4Byte u4Tmp=0;
-
- if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
- return;
-
- if(BTC_IPS_ENTER == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n"));
- pCoexSta->bUnderIps = TRUE;
- halbtc8812a1ant_CoexAllOff(pBtCoexist);
- halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- pCoexSta->bUnderIps = FALSE;
- }
-}
-
-VOID
-EXhalbtc8812a1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
- return;
-
- 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
-EXhalbtc8812a1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8812a1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8812a1ant_ActionHs(pBtCoexist);
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(BTC_SCAN_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- }
- else // wifi is connected
- {
- halbtc8812a1ant_ActionWifiConnectedScan(pBtCoexist);
- }
- }
- else if(BTC_SCAN_FINISH == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8812a1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8812a1ant_ActionWifiConnected(pBtCoexist);
- }
- }
-}
-
-VOID
-EXhalbtc8812a1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8812a1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8812a1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if(BTC_ASSOCIATE_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
- halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- }
- else if(BTC_ASSOCIATE_FINISH == type)
- {
- 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
- {
- halbtc8812a1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8812a1ant_ActionWifiConnected(pBtCoexist);
- }
- }
-}
-
-VOID
-EXhalbtc8812a1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u1Byte dataLen=5;
- u1Byte buf[6] = {0};
- u1Byte H2C_Parameter[3] ={0};
- u4Byte wifiBw;
- u1Byte wifiCentralChnl;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- 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;
- }
-
- pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0];
- pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1];
- pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2];
-
- buf[0] = dataLen;
- buf[1] = 0x5; // OP_Code
- buf[2] = 0x3; // OP_Code_Length
- buf[3] = H2C_Parameter[0]; // OP_Code_Content
- buf[4] = H2C_Parameter[1];
- buf[5] = H2C_Parameter[2];
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
-}
-
-VOID
-EXhalbtc8812a1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8812a1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8812a1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if( BTC_PACKET_DHCP == type ||
- BTC_PACKET_EAPOL == type )
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type));
- halbtc8812a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8812a1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- u1Byte btInfo=0;
- u1Byte i, rspSource=0;
- static u4Byte setBtPsdMode=0;
- BOOLEAN bBtBusy=FALSE;
- BOOLEAN bWifiConnected=FALSE;
- BOOLEAN bBtCtrlAggBufSize=FALSE, bRejApAggPkt=FALSE;
-
- rspSource = tmpBuf[0]&0xf;
- if(rspSource >= BT_INFO_SRC_8812A_1ANT_MAX)
- rspSource = BT_INFO_SRC_8812A_1ANT_WIFI_FW;
- pCoexSta->btInfoC2hCnt[rspSource]++;
-
- if(BT_INFO_SRC_8812A_1ANT_BT_RSP == rspSource)
- pCoexSta->btInfoQueryCnt = pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8812A_1ANT_BT_RSP];
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));
- for(i=0; i<length; i++)
- {
- 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]));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
- }
- }
-
- if(pBtCoexist->btInfo.bBtDisabled)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for BT is disabled <===\n"));
- return;
- }
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Manual CTRL<===\n"));
- return;
- }
- if(pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Coex STOPPED!!<===\n"));
- return;
- }
-
- if(BT_INFO_SRC_8812A_1ANT_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];
-
- // Here we need to resend some wifi info to BT
- // because bt is reset and loss of the info.
- if( (pCoexSta->btInfoExt & BIT1) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- EXhalbtc8812a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- EXhalbtc8812a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
-
- setBtPsdMode = 0;
- }
-
- // test-chip bt patch only rsp the status for BT_RSP,
- // so temporary we consider the following only under BT_RSP
- if(BT_INFO_SRC_8812A_1ANT_BT_RSP == rspSource)
- {
- if( (pCoexSta->btInfoExt & BIT3) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
- halbtc8812a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
- }
- else
- {
- // BT already NOT ignore Wlan active, do nothing here.
- }
-
- if( (pCoexSta->btInfoExt & BIT4) )
- {
- // BT auto report already enabled, do nothing
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit4 check, set BT to enable Auto Report!!\n"));
- halbtc8812a1ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
- }
- }
- }
-
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8812A_1ANT_B_INQ_PAGE)
- pCoexSta->bC2hBtInquiryPage = TRUE;
- else
- pCoexSta->bC2hBtInquiryPage = FALSE;
-
- // set link exist status
- if(!(btInfo&BT_INFO_8812A_1ANT_B_CONNECTION))
- {
- pCoexSta->bBtLinkExist = FALSE;
- pCoexSta->bPanExist = FALSE;
- pCoexSta->bA2dpExist = FALSE;
- pCoexSta->bHidExist = FALSE;
- pCoexSta->bScoExist = FALSE;
- }
- else // connection exists
- {
- pCoexSta->bBtLinkExist = TRUE;
- if(btInfo & BT_INFO_8812A_1ANT_B_FTP)
- pCoexSta->bPanExist = TRUE;
- else
- pCoexSta->bPanExist = FALSE;
- if(btInfo & BT_INFO_8812A_1ANT_B_A2DP)
- pCoexSta->bA2dpExist = TRUE;
- else
- pCoexSta->bA2dpExist = FALSE;
- if(btInfo & BT_INFO_8812A_1ANT_B_HID)
- pCoexSta->bHidExist = TRUE;
- else
- pCoexSta->bHidExist = FALSE;
- if(btInfo & BT_INFO_8812A_1ANT_B_SCO_ESCO)
- pCoexSta->bScoExist = TRUE;
- else
- pCoexSta->bScoExist = FALSE;
- }
-
- halbtc8812a1ant_UpdateBtLinkInfo(pBtCoexist);
-
- if(!(btInfo&BT_INFO_8812A_1ANT_B_CONNECTION))
- {
- pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-connected idle!!!\n"));
- }
- else if(btInfo == BT_INFO_8812A_1ANT_B_CONNECTION) // connection exists but no busy
- {
- pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt connected-idle!!!\n"));
- }
- else if((btInfo&BT_INFO_8812A_1ANT_B_SCO_ESCO) ||
- (btInfo&BT_INFO_8812A_1ANT_B_SCO_BUSY))
- {
- pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_SCO_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt sco busy!!!\n"));
- }
- else if(btInfo&BT_INFO_8812A_1ANT_B_ACL_BUSY)
- {
- if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
- pCoexDm->bResetTdmaAdjust = TRUE;
- pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_ACL_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt acl busy!!!\n"));
- }
- else
- {
- pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_MAX;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-defined state!!!\n"));
- }
-
- if(pBtLinkInfo->bScoExist)
- {
- bRejApAggPkt = TRUE;
- halbtc8812a1ant_UpdateRaMask(pBtCoexist, NORMAL_EXEC, BTC_RATE_DISABLE, 0x00000003); // disable cck 1M2M.
- }
- else
- {
- halbtc8812a1ant_UpdateRaMask(pBtCoexist, NORMAL_EXEC, BTC_RATE_ENABLE, 0x00000003); // enable cck 1M2M.
- }
-
- if( (BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- bBtBusy = TRUE;
- if(pBtLinkInfo->bHidExist)
- bBtCtrlAggBufSize = TRUE;
- }
- else
- {
- bBtBusy = FALSE;
- }
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
-
- //============================================
- // Aggregation related setting
- //============================================
- // if sco, reject AddBA
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt);
- // decide BT control aggregation buf size or not
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE, &bBtCtrlAggBufSize);
- // real update aggregation setting
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
- //============================================
-
- halbtc8812a1ant_RunCoexistMechanism(pBtCoexist);
-}
-
-VOID
-EXhalbtc8812a1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- halbtc8812a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- halbtc8812a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
- halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
- EXhalbtc8812a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8812a1ant_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)
- {
- pBtCoexist->bStopCoexDm = TRUE;
- halbtc8812a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- }
- else if(BTC_WIFI_PNP_WAKE_UP == pnpState)
- {
-
- }
-}
-
-VOID
-EXhalbtc8812a1ant_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", \
- GLCoexVerDate8812a1Ant, GLCoexVer8812a1Ant, fwVer, btPatchVer, btPatchVer));
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
- }
-
- halbtc8812a1ant_QueryBtInfo(pBtCoexist);
- halbtc8812a1ant_MonitorBtCtr(pBtCoexist);
- halbtc8812a1ant_MonitorBtEnableDisable(pBtCoexist);
-}
-
-VOID
-EXhalbtc8812a1ant_DbgControl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte opCode,
- IN u1Byte opLen,
- IN pu1Byte pData
- )
-{
- switch(opCode)
- {
- case BTC_DBG_SET_COEX_NORMAL:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set CoexMode to Normal\n"));
- pBtCoexist->bManualControl = FALSE;
- halbtc8812a1ant_InitCoexDm(pBtCoexist);
- break;
- case BTC_DBG_SET_COEX_WIFI_ONLY:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set CoexMode to Wifi Only\n"));
- pBtCoexist->bManualControl = TRUE;
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- break;
- case BTC_DBG_SET_COEX_BT_ONLY:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set CoexMode to BT only\n"));
- pBtCoexist->bManualControl = TRUE;
- halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- break;
- case BTC_DBG_SET_COEX_DEC_BT_PWR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set Dec BT power\n"));
- {
- u1Byte dataLen=4;
- u1Byte buf[6] = {0};
- u1Byte decBtPwr=0, pwrLevel=0;
- if(opLen == 2)
- {
- decBtPwr = pData[0];
- pwrLevel = pData[1];
-
- buf[0] = dataLen;
- buf[1] = 0x3; // OP_Code
- buf[2] = 0x2; // OP_Code_Length
-
- buf[3] = decBtPwr; // OP_Code_Content
- buf[4] = pwrLevel;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set Dec BT power=%d, pwrLevel=%d\n", decBtPwr, pwrLevel));
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
- }
- }
- break;
-
- case BTC_DBG_SET_COEX_BT_AFH_MAP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT AFH Map\n"));
- {
- u1Byte dataLen=5;
- u1Byte buf[6] = {0};
- if(opLen == 3)
- {
- buf[0] = dataLen;
- buf[1] = 0x5; // OP_Code
- buf[2] = 0x3; // OP_Code_Length
-
- buf[3] = pData[0]; // OP_Code_Content
- buf[4] = pData[1];
- buf[5] = pData[2];
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT AFH Map = %02x %02x %02x\n",
- pData[0], pData[1], pData[2]));
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
- }
- }
- break;
-
- case BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT Ignore Wlan Active\n"));
- {
- u1Byte dataLen=3;
- u1Byte buf[6] = {0};
- if(opLen == 1)
- {
- buf[0] = dataLen;
- buf[1] = 0x1; // OP_Code
- buf[2] = 0x1; // OP_Code_Length
-
- buf[3] = pData[0]; // OP_Code_Content
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT Ignore Wlan Active = 0x%x\n",
- pData[0]));
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
- }
- }
- break;
- default:
- break;
- }
-}
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for 8812a1ant Co-exist mechanism
+//
+// History
+// 2012/11/15 Cosa first check in.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8812A_1ANT GLCoexDm8812a1Ant;
+static PCOEX_DM_8812A_1ANT pCoexDm=&GLCoexDm8812a1Ant;
+static COEX_STA_8812A_1ANT GLCoexSta8812a1Ant;
+static PCOEX_STA_8812A_1ANT pCoexSta=&GLCoexSta8812a1Ant;
+
+const char *const GLBtInfoSrc8812a1Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+u4Byte GLCoexVerDate8812a1Ant=20130729;
+u4Byte GLCoexVer8812a1Ant=0x10;
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8812a1ant_
+//============================================================
+u1Byte
+halbtc8812a1ant_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_8812A_1ANT))
+ {
+ 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_8812A_1ANT))
+ {
+ 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_8812A_1ANT))
+ {
+ 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
+halbtc8812a1ant_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_8812A_1ANT))
+ {
+ 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_8812A_1ANT))
+ {
+ 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_8812A_1ANT))
+ {
+ 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
+halbtc8812a1ant_UpdateRaMask(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type,
+ IN u4Byte rateMask
+ )
+{
+ if(BTC_RATE_DISABLE == type)
+ {
+ pCoexDm->curRaMask |= rateMask; // disable rate
+ }
+ else if(BTC_RATE_ENABLE == type)
+ {
+ pCoexDm->curRaMask &= ~rateMask; // enable rate
+ }
+
+ if( bForceExec || (pCoexDm->preRaMask != pCoexDm->curRaMask))
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_UPDATE_RAMASK, &pCoexDm->curRaMask);
+ }
+ pCoexDm->preRaMask = pCoexDm->curRaMask;
+}
+
+VOID
+halbtc8812a1ant_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, 0xc);
+}
+
+VOID
+halbtc8812a1ant_QueryBtInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte dataLen=3;
+ u1Byte buf[5] = {0};
+
+ if(!pBtCoexist->btInfo.bBtDisabled)
+ {
+ if(!pCoexSta->btInfoQueryCnt ||
+ (pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8812A_1ANT_BT_RSP]-pCoexSta->btInfoQueryCnt)>2)
+ {
+ buf[0] = dataLen;
+ buf[1] = 0x1; // polling enable, 1=enable, 0=disable
+ buf[2] = 0x2; // polling time in seconds
+ buf[3] = 0x1; // auto report enable, 1=enable, 0=disable
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_INFO, (PVOID)&buf[0]);
+ }
+ }
+ pCoexSta->btInfoQueryCnt++;
+}
+
+VOID
+halbtc8812a1ant_UpdateBtLinkInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
+ pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
+ pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
+ pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
+
+ // check if Sco only
+ if( pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bScoOnly = TRUE;
+ else
+ pBtLinkInfo->bScoOnly = FALSE;
+
+ // check if A2dp only
+ if( !pBtLinkInfo->bScoExist &&
+ pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bA2dpOnly = TRUE;
+ else
+ pBtLinkInfo->bA2dpOnly = FALSE;
+
+ // check if Pan only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bPanOnly = TRUE;
+ else
+ pBtLinkInfo->bPanOnly = FALSE;
+
+ // check if Hid only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bHidOnly = TRUE;
+ else
+ pBtLinkInfo->bHidOnly = FALSE;
+}
+
+u1Byte
+halbtc8812a1ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8812A_1ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!pBtLinkInfo->bBtLinkExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No profile exists!!!\n"));
+ return algorithm;
+ }
+
+ if(pBtLinkInfo->bScoExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bHidExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bPanExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bA2dpExist)
+ numOfDiffProfile++;
+
+ if(numOfDiffProfile == 1)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_A2DP;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 2)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_SCO;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_HID;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile >= 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->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_8812A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+VOID
+halbtc8812a1ant_SetBtAutoReport(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bEnableAutoReport
+ )
+{
+}
+
+VOID
+halbtc8812a1ant_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;
+ }
+ halbtc8812a1ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
+
+ pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
+}
+
+VOID
+halbtc8812a1ant_SetSwPenaltyTxRateAdaptive(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ u1Byte tmpU1;
+
+ tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
+ tmpU1 |= BIT0;
+ if(bLowPenaltyRa)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
+ tmpU1 &= ~BIT2;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
+ tmpU1 |= BIT2;
+ }
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
+}
+
+VOID
+halbtc8812a1ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ return;
+ 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;
+ }
+ halbtc8812a1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8812a1ant_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
+halbtc8812a1ant_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;
+ }
+ halbtc8812a1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8812a1ant_CoexTableWithType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type
+ )
+{
+ switch(type)
+ {
+ case 0:
+ halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffff, 0x3);
+ break;
+ case 1:
+ halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffff, 0x3);
+ break;
+ case 2:
+ halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3);
+ break;
+ case 3:
+ halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff, 0x3);
+ break;
+ case 4:
+ halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffff, 0x3);
+ break;
+ case 5:
+ halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffff, 0x3);
+ break;
+ case 6:
+ halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
+ break;
+ case 7:
+ halbtc8812a1ant_CoexTable(pBtCoexist, bForceExec, 0x5afa5afa, 0x5afa5afa, 0xffff, 0x3);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8812a1ant_SetFwIgnoreWlanAct(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bEnable
+ )
+{
+ u1Byte dataLen=3;
+ u1Byte buf[5] = {0};
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], %s BT Ignore Wlan_Act\n",
+ (bEnable? "Enable":"Disable")));
+
+ buf[0] = dataLen;
+ buf[1] = 0x1; // OP_Code
+ buf[2] = 0x1; // OP_Code_Length
+ if(bEnable)
+ buf[3] = 0x1; // OP_Code_Content
+ else
+ buf[3] = 0x0;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+}
+
+VOID
+halbtc8812a1ant_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;
+ }
+ halbtc8812a1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8812a1ant_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};
+
+ H2C_Parameter[0] = byte1;
+ H2C_Parameter[1] = byte2;
+ H2C_Parameter[2] = byte3;
+ H2C_Parameter[3] = byte4;
+ H2C_Parameter[4] = byte5;
+
+ pCoexDm->psTdmaPara[0] = byte1;
+ pCoexDm->psTdmaPara[1] = byte2;
+ pCoexDm->psTdmaPara[2] = byte3;
+ pCoexDm->psTdmaPara[3] = byte4;
+ pCoexDm->psTdmaPara[4] = byte5;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
+halbtc8812a1ant_SetLpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ u1Byte lps=lpsVal;
+ u1Byte rpwm=rpwmVal;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
+}
+
+VOID
+halbtc8812a1ant_LpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bForceExecPwrCmd=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
+ (bForceExec? "force to":""), lpsVal, rpwmVal));
+ pCoexDm->curLps = lpsVal;
+ pCoexDm->curRpwm = rpwmVal;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preLps/curLps=0x%x/0x%x, preRpwm/curRpwm=0x%x/0x%x!!\n",
+ pCoexDm->preLps, pCoexDm->curLps, pCoexDm->preRpwm, pCoexDm->curRpwm));
+
+ if( (pCoexDm->preLps == pCoexDm->curLps) &&
+ (pCoexDm->preRpwm == pCoexDm->curRpwm) )
+ {
+ return;
+ }
+ }
+ halbtc8812a1ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
+
+ pCoexDm->preLps = pCoexDm->curLps;
+ pCoexDm->preRpwm = pCoexDm->curRpwm;
+}
+
+VOID
+halbtc8812a1ant_SetAntPath(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte antPosType,
+ IN BOOLEAN bInitHwCfg,
+ IN BOOLEAN bWifiOff
+ )
+{
+ u1Byte u1Tmp=0;
+
+ if(bInitHwCfg)
+ {
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb3, 0x77);
+
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x900, 0x00000400);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76d, 0x1);
+ }
+ else if(bWifiOff)
+ {
+
+ }
+
+ // ext switch setting
+ switch(antPosType)
+ {
+ case BTC_ANT_PATH_WIFI:
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
+ u1Tmp |= BIT3;
+ u1Tmp &= ~BIT2;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb7, u1Tmp);
+ break;
+ case BTC_ANT_PATH_BT:
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
+ u1Tmp &= ~BIT3;
+ u1Tmp |= BIT2;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb7, u1Tmp);
+ break;
+ default:
+ case BTC_ANT_PATH_PTA:
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
+ u1Tmp |= BIT3;
+ u1Tmp &= ~BIT2;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb7, u1Tmp);
+ break;
+ }
+}
+
+VOID
+halbtc8812a1ant_PsTdma(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bTurnOn,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bTurnOnByCnt=FALSE;
+ u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=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)
+ {
+ default:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x50);
+ break;
+ case 1:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x50);
+ rssiAdjustVal = 11;
+ break;
+ case 2:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x12, 0x0, 0x50);
+ rssiAdjustVal = 14;
+ break;
+ case 3:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x40);
+ break;
+ case 4:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
+ rssiAdjustVal = 17;
+ break;
+ case 5:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x31, 0x0);
+ break;
+ case 6:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x0, 0x0);
+ break;
+ case 7:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0);
+ break;
+ case 8:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
+ break;
+ case 9:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0xa, 0xa, 0x0, 0x50);
+ rssiAdjustVal = 18;
+ break;
+ case 10:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40);
+ break;
+ case 11:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x5, 0x5, 0x0, 0x50);
+ rssiAdjustVal = 20;
+ break;
+ case 12:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xeb, 0xa, 0x3, 0x31, 0x18);
+ break;
+
+ case 15:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x8, 0x0);
+ break;
+ case 16:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x10, 0x0);
+ rssiAdjustVal = 18;
+ break;
+
+ case 18:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
+ rssiAdjustVal = 14;
+ break;
+
+ case 20:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0x25, 0x25, 0x0, 0x0);
+ break;
+ case 21:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x20, 0x3, 0x10, 0x40);
+ break;
+ case 22:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x13, 0x8, 0x8, 0x0, 0x40);
+ break;
+ case 23:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 24:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 25:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 26:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 27:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x98);
+ rssiAdjustVal = 22;
+ break;
+ case 28:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x69, 0x25, 0x3, 0x31, 0x0);
+ break;
+ case 29:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10);
+ break;
+ case 30:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
+ break;
+ case 31:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58);
+ break;
+ case 32:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xab, 0xa, 0x3, 0x31, 0x90);
+ break;
+ case 33:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90);
+ break;
+ case 34:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x10);
+ break;
+ case 35:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x0, 0x10);
+ break;
+ case 36:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x3, 0x14, 0x50);
+ break;
+ case 37:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x53, 0x25, 0x3, 0x10, 0x50);
+ break;
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(type)
+ {
+ case 8:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
+ halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE);
+ break;
+ case 0:
+ default:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
+ halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
+ break;
+ case 9:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
+ halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE);
+ break;
+ case 10:
+ halbtc8812a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
+ halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
+ break;
+ }
+ }
+ rssiAdjustVal =0;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal);
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+VOID
+halbtc8812a1ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // hw all off
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+BOOLEAN
+halbtc8812a1ant_IsCommonAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if(!bWifiConnected &&
+ BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"));
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"));
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n"));
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ bCommon = FALSE;
+ }
+
+ return bCommon;
+}
+
+
+VOID
+halbtc8812a1ant_TdmaDurationAdjustForAcl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ static s4Byte up,dn,m,n,WaitCount;
+ s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
+ u1Byte retryCount=0, btInfoExt;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjustForAcl()\n"));
+
+ if( (BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
+ (BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
+ (BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
+ {
+ if( pCoexDm->curPsTdma != 1 &&
+ pCoexDm->curPsTdma != 2 &&
+ pCoexDm->curPsTdma != 3 &&
+ pCoexDm->curPsTdma != 9 )
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+
+ up = 0;
+ dn = 0;
+ m = 1;
+ n= 3;
+ result = 0;
+ WaitCount = 0;
+ }
+ return;
+ }
+
+ if(pCoexDm->bResetTdmaAdjust)
+ {
+ pCoexDm->bResetTdmaAdjust = FALSE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
+
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ //============
+ 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;
+ btInfoExt = pCoexSta->btInfoExt;
+ 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"));
+ }
+
+ if(result == -1)
+ {
+ if( (BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ else if(result == 1)
+ {
+ if( (BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ }
+
+ if( pCoexDm->curPsTdma != 1 &&
+ pCoexDm->curPsTdma != 2 &&
+ pCoexDm->curPsTdma != 9 &&
+ pCoexDm->curPsTdma != 11 )
+ {
+ // recover to previous adjust type
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
+ }
+ }
+}
+
+u1Byte
+halbtc8812a1ant_PsTdmaTypeByWifiRssi(
+ IN s4Byte wifiRssi,
+ IN s4Byte preWifiRssi,
+ IN u1Byte wifiRssiThresh
+ )
+{
+ u1Byte psTdmaType=0;
+
+ if(wifiRssi > preWifiRssi)
+ {
+ if(wifiRssi > (wifiRssiThresh+5))
+ {
+ psTdmaType = 26;
+ }
+ else
+ {
+ psTdmaType = 25;
+ }
+ }
+ else
+ {
+ if(wifiRssi > wifiRssiThresh)
+ {
+ psTdmaType = 26;
+ }
+ else
+ {
+ psTdmaType = 25;
+ }
+ }
+
+ return psTdmaType;
+}
+
+VOID
+halbtc8812a1ant_PsTdmaCheckForPowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bNewPsState
+ )
+{
+ u1Byte lpsMode=0x0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
+
+ if(lpsMode) // already under LPS state
+ {
+ if(bNewPsState)
+ {
+ // keep state under LPS, do nothing.
+ }
+ else
+ {
+ // will leave LPS state, turn off psTdma first
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ }
+ else // NO PS state
+ {
+ if(bNewPsState)
+ {
+ // will enter LPS state, turn off psTdma first
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ // keep state under NO PS state, do nothing.
+ }
+ }
+}
+
+VOID
+halbtc8812a1ant_PowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte psType,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bLowPwrDisable=FALSE;
+
+ switch(psType)
+ {
+ case BTC_PS_WIFI_NATIVE:
+ // recover to original 32k low power setting
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ break;
+ case BTC_PS_LPS_ON:
+ halbtc8812a1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
+ halbtc8812a1ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
+ // when coex force to enter LPS, do not enter 32k low power.
+ bLowPwrDisable = TRUE;
+ 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);
+ break;
+ case BTC_PS_LPS_OFF:
+ halbtc8812a1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+
+VOID
+halbtc8812a1ant_CoexUnder5G(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 10);
+
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+VOID
+halbtc8812a1ant_ActionWifiOnly(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+}
+
+VOID
+halbtc8812a1ant_MonitorBtEnableDisable(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ static BOOLEAN bPreBtDisabled=FALSE;
+ static u4Byte btDisableCnt=0;
+ BOOLEAN bBtActive=TRUE, bBtDisabled=FALSE;
+
+ // only 8812a need to consider if core stack is installed.
+ if(!pStackInfo->hciVersion)
+ {
+ bBtActive = 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"));
+ halbtc8812a1ant_ActionWifiOnly(pBtCoexist);
+ }
+ }
+ 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
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ }
+ }
+}
+
+//=============================================
+//
+// Software Coex Mechanism start
+//
+//=============================================
+
+// SCO only or SCO+PAN(HS)
+VOID
+halbtc8812a1ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8812a1ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8812a1ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8812a1ant_ActionA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8812a1ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+//PAN(HS) only
+VOID
+halbtc8812a1ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8812a1ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8812a1ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8812a1ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+VOID
+halbtc8812a1ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+}
+
+//=============================================
+//
+// Non-Software Coex Mechanism start
+//
+//=============================================
+
+VOID
+halbtc8812a1ant_ActionHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bHsConnecting=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_CONNECTING, &bHsConnecting);
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action for HS, bHsConnecting=%d!!!\n", bHsConnecting));
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+
+ if(bHsConnecting)
+ {
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 3);
+ }
+ else
+ {
+ if((pCoexSta->highPriorityTx+pCoexSta->highPriorityRx+
+ pCoexSta->lowPriorityTx+pCoexSta->lowPriorityRx)<=1200)
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 3);
+ else
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 4);
+ }
+}
+
+VOID
+halbtc8812a1ant_ActionBtInquiry(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bWifiConnected=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ if(!bWifiConnected)
+ {
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if( (pBtLinkInfo->bScoExist) ||
+ (pBtLinkInfo->bHidOnly) )
+ {
+ // SCO/HID-only busy
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else
+ {
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 30);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+}
+
+VOID
+halbtc8812a1ant_ActionBtScoHidOnlyBusy(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ // tdma and coex table
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+
+ if(BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus)
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ else
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+}
+
+VOID
+halbtc8812a1ant_ActionWifiConnectedBtAclBusy(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+
+ if(pBtLinkInfo->bHidOnly)
+ {
+ halbtc8812a1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus);
+ pCoexDm->bResetTdmaAdjust = TRUE;
+ return;
+ }
+ else if( (pBtLinkInfo->bA2dpOnly) ||
+ (pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) )
+ {
+ halbtc8812a1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus);
+ }
+ else if( (pBtLinkInfo->bPanOnly) ||
+ (pBtLinkInfo->bHidExist&&pBtLinkInfo->bPanExist) )
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->bResetTdmaAdjust = TRUE;
+ }
+ else
+ {
+ if( (BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
+ (BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
+ (BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ else
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->bResetTdmaAdjust = TRUE;
+ }
+
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+}
+
+VOID
+halbtc8812a1ant_ActionWifiNotConnected(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // power save state
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+VOID
+halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+}
+
+VOID
+halbtc8812a1ant_ActionWifiConnectedScan(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // power save state
+ if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
+ else
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8812a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN);
+ }
+ else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8812a1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN);
+ }
+ else
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+}
+
+VOID
+halbtc8812a1ant_ActionWifiConnectedSpecialPacket(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // power save state
+ if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
+ else
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8812a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT);
+ }
+ else
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+}
+
+VOID
+halbtc8812a1ant_ActionWifiConnected(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bWifiBusy=FALSE;
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+ BOOLEAN bUnder4way=FALSE;
+ u4Byte wifiBw;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n"));
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(!bWifiConnected)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi not connected<===\n"));
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+ if(bUnder4way)
+ {
+ halbtc8812a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n"));
+ return;
+ }
+
+ 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)
+ {
+ halbtc8812a1ant_ActionWifiConnectedScan(pBtCoexist);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under scan<===\n"));
+ return;
+ }
+
+ // power save state
+ if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly)
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x0);
+ else
+ halbtc8812a1ant_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_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8812a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE);
+ }
+ else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8812a1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE);
+ }
+ else
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ }
+ else
+ {
+ if(BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else if(BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ else if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8812a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY);
+ }
+ else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ halbtc8812a1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY);
+ }
+ else
+ {
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ }
+}
+
+VOID
+halbtc8812a1ant_RunSwCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiUnder5G=FALSE, bWifiBusy=FALSE, bWifiConnected=FALSE;
+ u1Byte btInfoOriginal=0, btRetryCnt=0;
+ u1Byte algorithm=0;
+
+ return;
+
+ algorithm = halbtc8812a1ant_ActionAlgorithm(pBtCoexist);
+ pCoexDm->curAlgorithm = algorithm;
+
+ if(halbtc8812a1ant_IsCommonAction(pBtCoexist))
+ {
+ }
+ else
+ {
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8812A_1ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n"));
+ halbtc8812a1ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID.\n"));
+ halbtc8812a1ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n"));
+ halbtc8812a1ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP+PAN(HS).\n"));
+ halbtc8812a1ant_ActionA2dpPanHs(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n"));
+ halbtc8812a1ant_ActionPanEdr(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HS mode.\n"));
+ halbtc8812a1ant_ActionPanHs(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN+A2DP.\n"));
+ halbtc8812a1ant_ActionPanEdrA2dp(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_PANEDR_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR)+HID.\n"));
+ halbtc8812a1ant_ActionPanEdrHid(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP+PAN.\n"));
+ halbtc8812a1ant_ActionHidA2dpPanEdr(pBtCoexist);
+ break;
+ case BT_8812A_1ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP.\n"));
+ halbtc8812a1ant_ActionHidA2dp(pBtCoexist);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n"));
+ halbtc8812a1ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+}
+
+VOID
+halbtc8812a1ant_RunCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiUnder5G=FALSE, bWifiBusy=FALSE, bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
+ return;
+ }
+
+ if(pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n"));
+ return;
+ }
+
+ if(pCoexSta->bUnderIps)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\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"));
+ halbtc8812a1ant_CoexUnder5G(pBtCoexist);
+ return;
+ }
+
+ halbtc8812a1ant_RunSwCoexistMechanism(pBtCoexist);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8812a1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8812a1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(!bWifiConnected)
+ {
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n"));
+
+ 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)
+ halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ else
+ halbtc8812a1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else // wifi LPS/Busy
+ {
+ halbtc8812a1ant_ActionWifiConnected(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8812a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+ halbtc8812a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
+ halbtc8812a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+}
+
+//============================================================
+// work around function start with wa_halbtc8812a1ant_
+//============================================================
+//============================================================
+// extern function start with EXhalbtc8812a1ant_
+//============================================================
+VOID
+EXhalbtc8812a1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u4Byte u4Tmp=0;
+ u2Byte u2Tmp=0;
+ u1Byte u1Tmp=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
+
+ //ant sw control to BT
+ halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE);
+
+ // 0x790[5:0]=0x5
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
+ u1Tmp &= 0xc0;
+ u1Tmp |= 0x5;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
+
+ // PTA parameter
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, 0x0);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, 0xffff);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, 0x55555555);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c0, 0x55555555);
+
+ // coex parameters
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1);
+
+ // enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+
+ // enable PTA
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
+
+ // bt clock related
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4);
+ u1Tmp |= BIT7;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4, u1Tmp);
+
+ // bt clock related
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x7);
+ u1Tmp |= BIT1;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x7, u1Tmp);
+}
+
+VOID
+EXhalbtc8812a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ pBtCoexist->bStopCoexDm = FALSE;
+
+ halbtc8812a1ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8812a1ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ 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);
+
+ if(pBtCoexist->bManualControl)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ CL_PRINTF(cliBuf);
+ }
+ if(pBtCoexist->bStopCoexDm)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ 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);
+
+ 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", \
+ GLCoexVerDate8812a1Ant, GLCoexVer8812a1Ant, 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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, wifiHsChnl, bBtHsOn);
+ 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]", \
+ ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
+ ( (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
+ pCoexSta->btRssi, pCoexSta->btRetryCnt);
+ CL_PRINTF(cliBuf);
+
+ 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);
+ 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; i<BT_INFO_SRC_8812A_1ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8812a1Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
+ ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
+ ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
+ pBtCoexist->btInfo.lpsVal,
+ pBtCoexist->btInfo.rpwmVal);
+ CL_PRINTF(cliBuf);
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
+
+ if(!pBtCoexist->bManualControl)
+ {
+ // 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 = %s/ %s/ %d ", "DelBA/ BtCtrlAgg/ AggSize", \
+ (pBtCoexist->btInfo.bRejectAggPkt? "Yes":"No"), (pBtCoexist->btInfo.bBtCtrlAggBufSize? "Yes":"No"),
+ pBtCoexist->btInfo.aggBufSize);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
+ pBtCoexist->btInfo.raMask);
+ CL_PRINTF(cliBuf);
+
+ // Fw mechanism
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
+ CL_PRINTF(cliBuf);
+
+ 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 = 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);
+ }
+
+ // Hw setting
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============");
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x778", \
+ u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb3);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x900);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0xcb3/0xcb7/0x900", \
+ u1Tmp[0], u1Tmp[1], u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
+ u1Tmp[0]);
+ 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);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
+ u4Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ 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_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(hp rx[31:16]/tx[15:0])", \
+ pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
+ pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx);
+ CL_PRINTF(cliBuf);
+
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8812a1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u4Byte u4Tmp=0;
+
+ if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
+ return;
+
+ if(BTC_IPS_ENTER == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n"));
+ pCoexSta->bUnderIps = TRUE;
+ halbtc8812a1ant_CoexAllOff(pBtCoexist);
+ halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ pCoexSta->bUnderIps = FALSE;
+ }
+}
+
+VOID
+EXhalbtc8812a1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
+ return;
+
+ 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
+EXhalbtc8812a1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8812a1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8812a1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(BTC_SCAN_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ }
+ else // wifi is connected
+ {
+ halbtc8812a1ant_ActionWifiConnectedScan(pBtCoexist);
+ }
+ }
+ else if(BTC_SCAN_FINISH == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8812a1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8812a1ant_ActionWifiConnected(pBtCoexist);
+ }
+ }
+}
+
+VOID
+EXhalbtc8812a1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8812a1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8812a1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if(BTC_ASSOCIATE_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
+ halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ }
+ else if(BTC_ASSOCIATE_FINISH == type)
+ {
+ 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
+ {
+ halbtc8812a1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8812a1ant_ActionWifiConnected(pBtCoexist);
+ }
+ }
+}
+
+VOID
+EXhalbtc8812a1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u1Byte dataLen=5;
+ u1Byte buf[6] = {0};
+ u1Byte H2C_Parameter[3] ={0};
+ u4Byte wifiBw;
+ u1Byte wifiCentralChnl;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ 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;
+ }
+
+ pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0];
+ pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1];
+ pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2];
+
+ buf[0] = dataLen;
+ buf[1] = 0x5; // OP_Code
+ buf[2] = 0x3; // OP_Code_Length
+ buf[3] = H2C_Parameter[0]; // OP_Code_Content
+ buf[4] = H2C_Parameter[1];
+ buf[5] = H2C_Parameter[2];
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+}
+
+VOID
+EXhalbtc8812a1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8812a1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8812a1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if( BTC_PACKET_DHCP == type ||
+ BTC_PACKET_EAPOL == type )
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type));
+ halbtc8812a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8812a1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ u1Byte btInfo=0;
+ u1Byte i, rspSource=0;
+ static u4Byte setBtPsdMode=0;
+ BOOLEAN bBtBusy=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+ BOOLEAN bBtCtrlAggBufSize=FALSE, bRejApAggPkt=FALSE;
+
+ rspSource = tmpBuf[0]&0xf;
+ if(rspSource >= BT_INFO_SRC_8812A_1ANT_MAX)
+ rspSource = BT_INFO_SRC_8812A_1ANT_WIFI_FW;
+ pCoexSta->btInfoC2hCnt[rspSource]++;
+
+ if(BT_INFO_SRC_8812A_1ANT_BT_RSP == rspSource)
+ pCoexSta->btInfoQueryCnt = pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8812A_1ANT_BT_RSP];
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));
+ for(i=0; i<length; i++)
+ {
+ 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]));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
+ }
+ }
+
+ if(pBtCoexist->btInfo.bBtDisabled)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for BT is disabled <===\n"));
+ return;
+ }
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Manual CTRL<===\n"));
+ return;
+ }
+ if(pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Coex STOPPED!!<===\n"));
+ return;
+ }
+
+ if(BT_INFO_SRC_8812A_1ANT_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];
+
+ // Here we need to resend some wifi info to BT
+ // because bt is reset and loss of the info.
+ if( (pCoexSta->btInfoExt & BIT1) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ EXhalbtc8812a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ EXhalbtc8812a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+
+ setBtPsdMode = 0;
+ }
+
+ // test-chip bt patch only rsp the status for BT_RSP,
+ // so temporary we consider the following only under BT_RSP
+ if(BT_INFO_SRC_8812A_1ANT_BT_RSP == rspSource)
+ {
+ if( (pCoexSta->btInfoExt & BIT3) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
+ halbtc8812a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+ }
+ else
+ {
+ // BT already NOT ignore Wlan active, do nothing here.
+ }
+
+ if( (pCoexSta->btInfoExt & BIT4) )
+ {
+ // BT auto report already enabled, do nothing
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit4 check, set BT to enable Auto Report!!\n"));
+ halbtc8812a1ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
+ }
+ }
+ }
+
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8812A_1ANT_B_INQ_PAGE)
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ else
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+
+ // set link exist status
+ if(!(btInfo&BT_INFO_8812A_1ANT_B_CONNECTION))
+ {
+ pCoexSta->bBtLinkExist = FALSE;
+ pCoexSta->bPanExist = FALSE;
+ pCoexSta->bA2dpExist = FALSE;
+ pCoexSta->bHidExist = FALSE;
+ pCoexSta->bScoExist = FALSE;
+ }
+ else // connection exists
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ if(btInfo & BT_INFO_8812A_1ANT_B_FTP)
+ pCoexSta->bPanExist = TRUE;
+ else
+ pCoexSta->bPanExist = FALSE;
+ if(btInfo & BT_INFO_8812A_1ANT_B_A2DP)
+ pCoexSta->bA2dpExist = TRUE;
+ else
+ pCoexSta->bA2dpExist = FALSE;
+ if(btInfo & BT_INFO_8812A_1ANT_B_HID)
+ pCoexSta->bHidExist = TRUE;
+ else
+ pCoexSta->bHidExist = FALSE;
+ if(btInfo & BT_INFO_8812A_1ANT_B_SCO_ESCO)
+ pCoexSta->bScoExist = TRUE;
+ else
+ pCoexSta->bScoExist = FALSE;
+ }
+
+ halbtc8812a1ant_UpdateBtLinkInfo(pBtCoexist);
+
+ if(!(btInfo&BT_INFO_8812A_1ANT_B_CONNECTION))
+ {
+ pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-connected idle!!!\n"));
+ }
+ else if(btInfo == BT_INFO_8812A_1ANT_B_CONNECTION) // connection exists but no busy
+ {
+ pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt connected-idle!!!\n"));
+ }
+ else if((btInfo&BT_INFO_8812A_1ANT_B_SCO_ESCO) ||
+ (btInfo&BT_INFO_8812A_1ANT_B_SCO_BUSY))
+ {
+ pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_SCO_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt sco busy!!!\n"));
+ }
+ else if(btInfo&BT_INFO_8812A_1ANT_B_ACL_BUSY)
+ {
+ if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
+ pCoexDm->bResetTdmaAdjust = TRUE;
+ pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_ACL_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt acl busy!!!\n"));
+ }
+ else
+ {
+ pCoexDm->btStatus = BT_8812A_1ANT_BT_STATUS_MAX;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-defined state!!!\n"));
+ }
+
+ if(pBtLinkInfo->bScoExist)
+ {
+ bRejApAggPkt = TRUE;
+ halbtc8812a1ant_UpdateRaMask(pBtCoexist, NORMAL_EXEC, BTC_RATE_DISABLE, 0x00000003); // disable cck 1M2M.
+ }
+ else
+ {
+ halbtc8812a1ant_UpdateRaMask(pBtCoexist, NORMAL_EXEC, BTC_RATE_ENABLE, 0x00000003); // enable cck 1M2M.
+ }
+
+ if( (BT_8812A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ bBtBusy = TRUE;
+ if(pBtLinkInfo->bHidExist)
+ bBtCtrlAggBufSize = TRUE;
+ }
+ else
+ {
+ bBtBusy = FALSE;
+ }
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+
+ //============================================
+ // Aggregation related setting
+ //============================================
+ // if sco, reject AddBA
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt);
+ // decide BT control aggregation buf size or not
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE, &bBtCtrlAggBufSize);
+ // real update aggregation setting
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
+ //============================================
+
+ halbtc8812a1ant_RunCoexistMechanism(pBtCoexist);
+}
+
+VOID
+EXhalbtc8812a1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ halbtc8812a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ halbtc8812a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
+ halbtc8812a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);
+ EXhalbtc8812a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8812a1ant_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)
+ {
+ pBtCoexist->bStopCoexDm = TRUE;
+ halbtc8812a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ }
+ else if(BTC_WIFI_PNP_WAKE_UP == pnpState)
+ {
+
+ }
+}
+
+VOID
+EXhalbtc8812a1ant_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", \
+ GLCoexVerDate8812a1Ant, GLCoexVer8812a1Ant, fwVer, btPatchVer, btPatchVer));
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
+ }
+
+ halbtc8812a1ant_QueryBtInfo(pBtCoexist);
+ halbtc8812a1ant_MonitorBtCtr(pBtCoexist);
+ halbtc8812a1ant_MonitorBtEnableDisable(pBtCoexist);
+}
+
+VOID
+EXhalbtc8812a1ant_DbgControl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte opCode,
+ IN u1Byte opLen,
+ IN pu1Byte pData
+ )
+{
+ switch(opCode)
+ {
+ case BTC_DBG_SET_COEX_NORMAL:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set CoexMode to Normal\n"));
+ pBtCoexist->bManualControl = FALSE;
+ halbtc8812a1ant_InitCoexDm(pBtCoexist);
+ break;
+ case BTC_DBG_SET_COEX_WIFI_ONLY:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set CoexMode to Wifi Only\n"));
+ pBtCoexist->bManualControl = TRUE;
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ break;
+ case BTC_DBG_SET_COEX_BT_ONLY:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set CoexMode to BT only\n"));
+ pBtCoexist->bManualControl = TRUE;
+ halbtc8812a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8812a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ break;
+ case BTC_DBG_SET_COEX_DEC_BT_PWR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set Dec BT power\n"));
+ {
+ u1Byte dataLen=4;
+ u1Byte buf[6] = {0};
+ u1Byte decBtPwr=0, pwrLevel=0;
+ if(opLen == 2)
+ {
+ decBtPwr = pData[0];
+ pwrLevel = pData[1];
+
+ buf[0] = dataLen;
+ buf[1] = 0x3; // OP_Code
+ buf[2] = 0x2; // OP_Code_Length
+
+ buf[3] = decBtPwr; // OP_Code_Content
+ buf[4] = pwrLevel;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set Dec BT power=%d, pwrLevel=%d\n", decBtPwr, pwrLevel));
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+ }
+ }
+ break;
+
+ case BTC_DBG_SET_COEX_BT_AFH_MAP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT AFH Map\n"));
+ {
+ u1Byte dataLen=5;
+ u1Byte buf[6] = {0};
+ if(opLen == 3)
+ {
+ buf[0] = dataLen;
+ buf[1] = 0x5; // OP_Code
+ buf[2] = 0x3; // OP_Code_Length
+
+ buf[3] = pData[0]; // OP_Code_Content
+ buf[4] = pData[1];
+ buf[5] = pData[2];
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT AFH Map = %02x %02x %02x\n",
+ pData[0], pData[1], pData[2]));
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+ }
+ }
+ break;
+
+ case BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT Ignore Wlan Active\n"));
+ {
+ u1Byte dataLen=3;
+ u1Byte buf[6] = {0};
+ if(opLen == 1)
+ {
+ buf[0] = dataLen;
+ buf[1] = 0x1; // OP_Code
+ buf[2] = 0x1; // OP_Code_Length
+
+ buf[3] = pData[0]; // OP_Code_Content
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT Ignore Wlan Active = 0x%x\n",
+ pData[0]));
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h
index 652e723..8517c6f 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h
@@ -1,201 +1,201 @@
-//===========================================
-// The following is for 8812A_1ANT BT Co-exist definition
-//===========================================
-#define BT_INFO_8812A_1ANT_B_FTP BIT7
-#define BT_INFO_8812A_1ANT_B_A2DP BIT6
-#define BT_INFO_8812A_1ANT_B_HID BIT5
-#define BT_INFO_8812A_1ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8812A_1ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8812A_1ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8812A_1ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8812A_1ANT_B_CONNECTION BIT0
-
-#define BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
- (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
-
-#define BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT 2
-
-#define BTC_8812A_1ANT_SWITCH_TO_WIFI 0
-#define BTC_8812A_1ANT_SWITCH_TO_BT 1
-
-typedef enum _BT_INFO_SRC_8812A_1ANT{
- BT_INFO_SRC_8812A_1ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8812A_1ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8812A_1ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8812A_1ANT_MAX
-}BT_INFO_SRC_8812A_1ANT,*PBT_INFO_SRC_8812A_1ANT;
-
-typedef enum _BT_8812A_1ANT_BT_STATUS{
- BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8812A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
- BT_8812A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
- BT_8812A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
- BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
- BT_8812A_1ANT_BT_STATUS_MAX
-}BT_8812A_1ANT_BT_STATUS,*PBT_8812A_1ANT_BT_STATUS;
-
-typedef enum _BT_8812A_1ANT_WIFI_STATUS{
- BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
- BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
- BT_8812A_1ANT_WIFI_STATUS_MAX
-}BT_8812A_1ANT_WIFI_STATUS,*PBT_8812A_1ANT_WIFI_STATUS;
-
-typedef enum _BT_8812A_1ANT_COEX_ALGO{
- BT_8812A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8812A_1ANT_COEX_ALGO_SCO = 0x1,
- BT_8812A_1ANT_COEX_ALGO_HID = 0x2,
- BT_8812A_1ANT_COEX_ALGO_A2DP = 0x3,
- BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
- BT_8812A_1ANT_COEX_ALGO_PANEDR = 0x5,
- BT_8812A_1ANT_COEX_ALGO_PANHS = 0x6,
- BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
- BT_8812A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
- BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
- BT_8812A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
- BT_8812A_1ANT_COEX_ALGO_MAX = 0xb,
-}BT_8812A_1ANT_COEX_ALGO,*PBT_8812A_1ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8812A_1ANT{
- // fw mechanism
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- u1Byte psTdmaDuAdjType;
- BOOLEAN bResetTdmaAdjust;
- BOOLEAN bPrePsTdmaOn;
- BOOLEAN bCurPsTdmaOn;
- BOOLEAN bPreBtAutoReport;
- BOOLEAN bCurBtAutoReport;
- u1Byte preLps;
- u1Byte curLps;
- u1Byte preRpwm;
- u1Byte curRpwm;
-
- // sw mechanism
- BOOLEAN bPreLowPenaltyRa;
- BOOLEAN bCurLowPenaltyRa;
- BOOLEAN bPreDacSwingOn;
- u4Byte preVal0x6c0;
- u4Byte curVal0x6c0;
- u4Byte preVal0x6c4;
- u4Byte curVal0x6c4;
- u4Byte preVal0x6c8;
- u4Byte curVal0x6c8;
- u1Byte preVal0x6cc;
- u1Byte curVal0x6cc;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-
- u4Byte preRaMask;
- u4Byte curRaMask;
-
- u1Byte errorCondition;
-} COEX_DM_8812A_1ANT, *PCOEX_DM_8812A_1ANT;
-
-typedef struct _COEX_STA_8812A_1ANT{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bA2dpExist;
- 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_8812A_1ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8812A_1ANT_MAX];
- u4Byte btInfoQueryCnt;
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
-}COEX_STA_8812A_1ANT, *PCOEX_STA_8812A_1ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8812a1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8812a1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a1ant_PnpNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte pnpState
- );
-VOID
-EXhalbtc8812a1ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a1ant_DbgControl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte opCode,
- IN u1Byte opLen,
- IN pu1Byte pData
- );
+//===========================================
+// The following is for 8812A_1ANT BT Co-exist definition
+//===========================================
+#define BT_INFO_8812A_1ANT_B_FTP BIT7
+#define BT_INFO_8812A_1ANT_B_A2DP BIT6
+#define BT_INFO_8812A_1ANT_B_HID BIT5
+#define BT_INFO_8812A_1ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8812A_1ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8812A_1ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8812A_1ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8812A_1ANT_B_CONNECTION BIT0
+
+#define BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
+ (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
+
+#define BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT 2
+
+#define BTC_8812A_1ANT_SWITCH_TO_WIFI 0
+#define BTC_8812A_1ANT_SWITCH_TO_BT 1
+
+typedef enum _BT_INFO_SRC_8812A_1ANT{
+ BT_INFO_SRC_8812A_1ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8812A_1ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8812A_1ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8812A_1ANT_MAX
+}BT_INFO_SRC_8812A_1ANT,*PBT_INFO_SRC_8812A_1ANT;
+
+typedef enum _BT_8812A_1ANT_BT_STATUS{
+ BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8812A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
+ BT_8812A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
+ BT_8812A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
+ BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
+ BT_8812A_1ANT_BT_STATUS_MAX
+}BT_8812A_1ANT_BT_STATUS,*PBT_8812A_1ANT_BT_STATUS;
+
+typedef enum _BT_8812A_1ANT_WIFI_STATUS{
+ BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
+ BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
+ BT_8812A_1ANT_WIFI_STATUS_MAX
+}BT_8812A_1ANT_WIFI_STATUS,*PBT_8812A_1ANT_WIFI_STATUS;
+
+typedef enum _BT_8812A_1ANT_COEX_ALGO{
+ BT_8812A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8812A_1ANT_COEX_ALGO_SCO = 0x1,
+ BT_8812A_1ANT_COEX_ALGO_HID = 0x2,
+ BT_8812A_1ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
+ BT_8812A_1ANT_COEX_ALGO_PANEDR = 0x5,
+ BT_8812A_1ANT_COEX_ALGO_PANHS = 0x6,
+ BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
+ BT_8812A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
+ BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
+ BT_8812A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
+ BT_8812A_1ANT_COEX_ALGO_MAX = 0xb,
+}BT_8812A_1ANT_COEX_ALGO,*PBT_8812A_1ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8812A_1ANT{
+ // fw mechanism
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ u1Byte psTdmaDuAdjType;
+ BOOLEAN bResetTdmaAdjust;
+ BOOLEAN bPrePsTdmaOn;
+ BOOLEAN bCurPsTdmaOn;
+ BOOLEAN bPreBtAutoReport;
+ BOOLEAN bCurBtAutoReport;
+ u1Byte preLps;
+ u1Byte curLps;
+ u1Byte preRpwm;
+ u1Byte curRpwm;
+
+ // sw mechanism
+ BOOLEAN bPreLowPenaltyRa;
+ BOOLEAN bCurLowPenaltyRa;
+ BOOLEAN bPreDacSwingOn;
+ u4Byte preVal0x6c0;
+ u4Byte curVal0x6c0;
+ u4Byte preVal0x6c4;
+ u4Byte curVal0x6c4;
+ u4Byte preVal0x6c8;
+ u4Byte curVal0x6c8;
+ u1Byte preVal0x6cc;
+ u1Byte curVal0x6cc;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+
+ u4Byte preRaMask;
+ u4Byte curRaMask;
+
+ u1Byte errorCondition;
+} COEX_DM_8812A_1ANT, *PCOEX_DM_8812A_1ANT;
+
+typedef struct _COEX_STA_8812A_1ANT{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bA2dpExist;
+ 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_8812A_1ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8812A_1ANT_MAX];
+ u4Byte btInfoQueryCnt;
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+}COEX_STA_8812A_1ANT, *PCOEX_STA_8812A_1ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8812a1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8812a1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a1ant_PnpNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte pnpState
+ );
+VOID
+EXhalbtc8812a1ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a1ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a1ant_DbgControl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte opCode,
+ IN u1Byte opLen,
+ IN pu1Byte pData
+ );
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c
index c7add94..adf7be7 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c
@@ -1,4826 +1,4826 @@
-//============================================================
-// Description:
-//
-// This file is for RTL8812A Co-exist mechanism
-//
-// History
-// 2012/08/22 Cosa first check in.
-// 2012/11/14 Cosa Revise for 8812A 2Ant out sourcing.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8812A_2ANT GLCoexDm8812a2Ant;
-static PCOEX_DM_8812A_2ANT pCoexDm=&GLCoexDm8812a2Ant;
-static COEX_STA_8812A_2ANT GLCoexSta8812a2Ant;
-static PCOEX_STA_8812A_2ANT pCoexSta=&GLCoexSta8812a2Ant;
-
-const char *const GLBtInfoSrc8812a2Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-u4Byte GLCoexVerDate8812a2Ant=20131017;
-u4Byte GLCoexVer8812a2Ant=0x36;
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8812a2ant_
-//============================================================
-u1Byte
-halbtc8812a2ant_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))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));
- if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8812A_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
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));
- 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))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));
- if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8812A_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))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=MEDIUM\n"));
- if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8812A_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
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));
- 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
-halbtc8812a2ant_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_8812A_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_8812A_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_8812A_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
-halbtc8812a2ant_MonitorBtEnableDisable(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- static BOOLEAN bPreBtDisabled=FALSE;
- static u4Byte btDisableCnt=0;
- BOOLEAN bBtActive=TRUE, bBtDisabled=FALSE;
-
- // This function check if bt is disabled
-
- // only 8812a need to consider if core stack is installed.
- if(!pStackInfo->hciVersion)
- {
- bBtActive = FALSE;
- }
-
- 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 is detected as disabled %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
- {
- }
- }
-}
-
-u4Byte
-halbtc8812a2ant_DecideRaMask(
- IN PBTC_COEXIST pBtCoexist,
- IN u4Byte raMaskType
- )
-{
- u4Byte disRaMask=0x0;
-
- switch(raMaskType)
- {
- case 0: // normal mode
- disRaMask = 0x0;
- break;
- case 1: // disable cck 1/2
- disRaMask = 0x00000003;
- break;
- case 2: // disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4
- disRaMask = 0x0001f1f7;
- break;
- default:
- break;
- }
-
- return disRaMask;
-}
-
-VOID
-halbtc8812a2ant_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
-halbtc8812a2ant_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
-halbtc8812a2ant_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
-halbtc8812a2ant_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;
- default:
- break;
- }
- }
-
- pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType;
-}
-
-VOID
-halbtc8812a2ant_LimitedTx(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte raMaskType,
- IN u1Byte arfrType,
- IN u1Byte retryLimitType,
- IN u1Byte ampduTimeType
- )
-{
- u4Byte disRaMask=0x0;
-
- pCoexDm->curRaMaskType = raMaskType;
- disRaMask = halbtc8812a2ant_DecideRaMask(pBtCoexist, raMaskType);
- halbtc8812a2ant_UpdateRaMask(pBtCoexist, bForceExec, disRaMask);
-
- halbtc8812a2ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType);
- halbtc8812a2ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType);
- halbtc8812a2ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType);
-}
-
-VOID
-halbtc8812a2ant_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
-halbtc8812a2ant_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, 0xc);
-}
-
-VOID
-halbtc8812a2ant_QueryBtInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte dataLen=3;
- u1Byte buf[5] = {0};
-
- if(!pBtCoexist->btInfo.bBtDisabled)
- {
- if(!pCoexSta->btInfoQueryCnt ||
- (pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8812A_2ANT_BT_RSP]-pCoexSta->btInfoQueryCnt)>2)
- {
- buf[0] = dataLen;
- buf[1] = 0x1; // polling enable, 1=enable, 0=disable
- buf[2] = 0x2; // polling time in seconds
- buf[3] = 0x1; // auto report enable, 1=enable, 0=disable
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_INFO, (PVOID)&buf[0]);
- }
- }
- pCoexSta->btInfoQueryCnt++;
-}
-
-BOOLEAN
-halbtc8812a2ant_IsWifiStatusChanged(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
- BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
- BOOLEAN bWifiConnected=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
-
- if(bWifiConnected)
- {
- if(bWifiBusy != bPreWifiBusy)
- {
- bPreWifiBusy = bWifiBusy;
- return TRUE;
- }
- if(bUnder4way != bPreUnder4way)
- {
- bPreUnder4way = bUnder4way;
- return TRUE;
- }
- if(bBtHsOn != bPreBtHsOn)
- {
- bPreBtHsOn = bBtHsOn;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-VOID
-halbtc8812a2ant_UpdateBtLinkInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
-
-#if 1//(BT_AUTO_REPORT_ONLY_8812A_2ANT == 1) // profile from bt patch
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
- pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
- pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
- pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
- pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
-
- // work around for HS mode.
- if(bBtHsOn)
- {
- pBtLinkInfo->bPanExist = TRUE;
- pBtLinkInfo->bBtLinkExist = TRUE;
- }
-#else // profile from bt stack
- pBtLinkInfo->bBtLinkExist = pStackInfo->bBtLinkExist;
- pBtLinkInfo->bScoExist = pStackInfo->bScoExist;
- pBtLinkInfo->bA2dpExist = pStackInfo->bA2dpExist;
- pBtLinkInfo->bPanExist = pStackInfo->bPanExist;
- pBtLinkInfo->bHidExist = pStackInfo->bHidExist;
-
- //for win-8 stack HID report error
- if(!pStackInfo->bHidExist)
- pStackInfo->bHidExist = pCoexSta->bHidExist; //sync BTInfo with BT firmware and stack
- // when stack HID report error, here we use the info from bt fw.
- if(!pStackInfo->bBtLinkExist)
- pStackInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
-#endif
- // check if Sco only
- if( pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bScoOnly = TRUE;
- else
- pBtLinkInfo->bScoOnly = FALSE;
-
- // check if A2dp only
- if( !pBtLinkInfo->bScoExist &&
- pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bA2dpOnly = TRUE;
- else
- pBtLinkInfo->bA2dpOnly = FALSE;
-
- // check if Pan only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bPanOnly = TRUE;
- else
- pBtLinkInfo->bPanOnly = FALSE;
-
- // check if Hid only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bHidExist )
- pBtLinkInfo->bHidOnly = TRUE;
- else
- pBtLinkInfo->bHidOnly = FALSE;
-}
-
-u1Byte
-halbtc8812a2ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8812A_2ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!pBtLinkInfo->bBtLinkExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
- return algorithm;
- }
-
- if(pBtLinkInfo->bScoExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bHidExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bPanExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bA2dpExist)
- numOfDiffProfile++;
-
- if(numOfDiffProfile == 1)
- {
- if(pBtLinkInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_A2DP;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile == 2)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_SCO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_SCO;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(pStackInfo->numOfHid >= 2)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID*2 + A2DP\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_HID_A2DP;
- }
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP;
- }
- }
- }
- }
- else if(numOfDiffProfile == 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_SCO_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_SCO_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile >= 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->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_8812A_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-VOID
-halbtc8812a2ant_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
-halbtc8812a2ant_SetFwDecBtPwr(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte decBtPwrLvl
- )
-{
- u1Byte dataLen=4;
- u1Byte buf[6] = {0};
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power level = %d\n",
- decBtPwrLvl));
-
- buf[0] = dataLen;
- buf[1] = 0x3; // OP_Code
- buf[2] = 0x2; // OP_Code_Length
- if(decBtPwrLvl)
- buf[3] = 0x1; // OP_Code_Content
- else
- buf[3] = 0x0;
- buf[4] = decBtPwrLvl;// pwrLevel
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
-}
-
-VOID
-halbtc8812a2ant_DecBtPwr(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte decBtPwrLvl
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power level = %d\n",
- (bForceExec? "force to":""), decBtPwrLvl));
- pCoexDm->curBtDecPwrLvl = decBtPwrLvl;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preBtDecPwrLvl=%d, curBtDecPwrLvl=%d\n",
- pCoexDm->preBtDecPwrLvl, pCoexDm->curBtDecPwrLvl));
-
- if(pCoexDm->preBtDecPwrLvl == pCoexDm->curBtDecPwrLvl)
- return;
- }
- halbtc8812a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->curBtDecPwrLvl);
-
- pCoexDm->preBtDecPwrLvl = pCoexDm->curBtDecPwrLvl;
-}
-
-VOID
-halbtc8812a2ant_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;
- }
-
- halbtc8812a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
-
- pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
-}
-
-VOID
-halbtc8812a2ant_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
-halbtc8812a2ant_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;
- }
- halbtc8812a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
-
- pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
-}
-
-VOID
-halbtc8812a2ant_SetSwPenaltyTxRateAdaptive(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- u1Byte tmpU1;
-
- tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
- tmpU1 |= BIT0;
- if(bLowPenaltyRa)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
- tmpU1 &= ~BIT2;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
- tmpU1 |= BIT2;
- }
-
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
-}
-
-VOID
-halbtc8812a2ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- return;
- 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;
- }
- halbtc8812a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8812a2ant_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
-halbtc8812a2ant_SetSwFullTimeDacSwing(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSwDacSwingOn,
- IN u4Byte swDacSwingLvl
- )
-{
- if(bSwDacSwingOn)
- {
- halbtc8812a2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
- }
- else
- {
- halbtc8812a2ant_SetDacSwingReg(pBtCoexist, 0x18);
- }
-}
-
-
-VOID
-halbtc8812a2ant_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);
- halbtc8812a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
-
- pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
- pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
-}
-
-VOID
-halbtc8812a2ant_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
-halbtc8812a2ant_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;
- }
- halbtc8812a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
-
- pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
-}
-
-VOID
-halbtc8812a2ant_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
-halbtc8812a2ant_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;
- }
- halbtc8812a2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
-
- pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
-}
-
-VOID
-halbtc8812a2ant_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
-halbtc8812a2ant_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;
- }
- halbtc8812a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8812a2ant_CoexTableWithType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type
- )
-{
- switch(type)
- {
- case 0:
- halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 1:
- halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 2:
- halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5ffb5ffb, 0xffffff, 0x3);
- break;
- case 3:
- halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x5fdf5fdf, 0x5fdb5fdb, 0xffffff, 0x3);
- break;
- case 4:
- halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0xdfffdfff, 0x5fdb5fdb, 0xffffff, 0x3);
- break;
- case 5:
- halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x5ddd5ddd, 0x5fdb5fdb, 0xffffff, 0x3);
- break;
-
- default:
- break;
- }
-}
-
-VOID
-halbtc8812a2ant_SetFwIgnoreWlanAct(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bEnable
- )
-{
- u1Byte dataLen=3;
- u1Byte buf[5] = {0};
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], %s BT Ignore Wlan_Act\n",
- (bEnable? "Enable":"Disable")));
-
- buf[0] = dataLen;
- buf[1] = 0x1; // OP_Code
- buf[2] = 0x1; // OP_Code_Length
- if(bEnable)
- buf[3] = 0x1; // OP_Code_Content
- else
- buf[3] = 0x0;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
-}
-
-VOID
-halbtc8812a2ant_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;
- }
- halbtc8812a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8812a2ant_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};
-
- H2C_Parameter[0] = byte1;
- H2C_Parameter[1] = byte2;
- H2C_Parameter[2] = byte3;
- H2C_Parameter[3] = byte4;
- H2C_Parameter[4] = byte5;
-
- pCoexDm->psTdmaPara[0] = byte1;
- pCoexDm->psTdmaPara[1] = byte2;
- pCoexDm->psTdmaPara[2] = byte3;
- pCoexDm->psTdmaPara[3] = byte4;
- pCoexDm->psTdmaPara[4] = byte5;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
-halbtc8812a2ant_SetLpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- u1Byte lps=lpsVal;
- u1Byte rpwm=rpwmVal;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
-}
-
-VOID
-halbtc8812a2ant_LpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bForceExecPwrCmd=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
- (bForceExec? "force to":""), lpsVal, rpwmVal));
- pCoexDm->curLps = lpsVal;
- pCoexDm->curRpwm = rpwmVal;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preLps/curLps=0x%x/0x%x, preRpwm/curRpwm=0x%x/0x%x!!\n",
- pCoexDm->preLps, pCoexDm->curLps, pCoexDm->preRpwm, pCoexDm->curRpwm));
-
- if( (pCoexDm->preLps == pCoexDm->curLps) &&
- (pCoexDm->preRpwm == pCoexDm->curRpwm) )
- {
- return;
- }
- }
- halbtc8812a2ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
-
- pCoexDm->preLps = pCoexDm->curLps;
- pCoexDm->preRpwm = pCoexDm->curRpwm;
-}
-
-VOID
-halbtc8812a2ant_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;
- }
- */
-
- halbtc8812a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF);
- //halbtc8812a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
-}
-
-VOID
-halbtc8812a2ant_SwMechanism2(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAGCTableShift,
- IN BOOLEAN bADCBackOff,
- IN BOOLEAN bSWDACSwing,
- IN u4Byte dacSwingLvl
- )
-{
- //halbtc8812a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift);
- halbtc8812a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff);
- halbtc8812a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl);
-}
-
-VOID
-halbtc8812a2ant_SetAntPath(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte antPosType,
- IN BOOLEAN bInitHwCfg,
- IN BOOLEAN bWifiOff
- )
-{
- u1Byte u1Tmp=0;
-
- if(bInitHwCfg)
- {
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x900, 0x00000400);
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76d, 0x1);
- }
- else if(bWifiOff)
- {
-
- }
-
- // ext switch setting
- switch(antPosType)
- {
- case BTC_ANT_WIFI_AT_CPL_MAIN:
- break;
- case BTC_ANT_WIFI_AT_CPL_AUX:
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
- u1Tmp &= ~BIT3;
- u1Tmp |= BIT2;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb7, u1Tmp);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8812a2ant_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:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xa1, 0x90);
- break;
- case 2:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xa1, 0x90);
- break;
- case 3:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xb1, 0x90);
- break;
- case 4:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xb1, 0x90);
- break;
- case 5:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x21, 0x10);
- break;
- case 6:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x21, 0x10);
- break;
- case 7:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x21, 0x10);
- break;
- case 8:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x3, 0x21, 0x10);
- break;
- case 9:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xa1, 0x10);
- break;
- case 10:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xa1, 0x10);
- break;
- case 11:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x03, 0xb1, 0x10);
- break;
- case 12:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xb1, 0x10);
- break;
- case 13:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x21, 0x10);
- break;
- case 14:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x21, 0x10);
- break;
- case 15:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x03, 0x21, 0x10);
- break;
- case 16:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0x21, 0x10);
- break;
- case 17:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0xb1, 0x10);
- break;
- case 18:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
- break;
- case 19:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90);
- break;
- case 20:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);
- break;
- case 21:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);
- break;
- case 71:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
-
- // following cases is for wifi rssi low, started from 81
- case 81:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x3a, 0x3, 0x90, 0x50);
- break;
- case 82:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x2b, 0x3, 0x90, 0x50);
- break;
- case 83:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x21, 0x3, 0x90, 0x50);
- break;
- case 84:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x15, 0x3, 0x90, 0x50);
- break;
- case 85:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1d, 0x1d, 0x80, 0x50);
- break;
- case 86:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x15, 0x15, 0x80, 0x50);
- break;
- }
- }
- else
- {
- // disable PS tdma
- switch(type)
- {
- case 0: //ANT2PTA, 0x778=0x1
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
- break;
- case 1: //ANT2BT, 0x778=3
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x08, 0x0);
- delay_ms(5);
- halbtc8812a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_CPL_AUX, FALSE, FALSE);
- break;
- default:
- halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x00, 0x0);
- break;
- }
- }
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-VOID
-halbtc8812a2ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // fw all off
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- // sw all off
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- // hw all off
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-VOID
-halbtc8812a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
-
- halbtc8812a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
- halbtc8812a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, 0);
-
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-}
-
-VOID
-halbtc8812a2ant_PsTdmaCheckForPowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bNewPsState
- )
-{
- u1Byte lpsMode=0x0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
-
- if(lpsMode) // already under LPS state
- {
- if(bNewPsState)
- {
- // keep state under LPS, do nothing.
- }
- else
- {
- // will leave LPS state, turn off psTdma first
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- }
- else // NO PS state
- {
- if(bNewPsState)
- {
- // will enter LPS state, turn off psTdma first
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- // keep state under NO PS state, do nothing.
- }
- }
-}
-
-VOID
-halbtc8812a2ant_PowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte psType,
- IN BOOLEAN bLowPwrDisable,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- switch(psType)
- {
- case BTC_PS_WIFI_NATIVE:
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- break;
- case BTC_PS_LPS_ON:
- halbtc8812a2ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
- halbtc8812a2ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
- 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);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8812a2ant_ActionBtInquiry(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
-
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-}
-
-BOOLEAN
-halbtc8812a2ant_IsCommonAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
- BOOLEAN bBtHsOn=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if(pBtLinkInfo->bScoExist || pBtLinkInfo->bHidExist)
- {
- halbtc8812a2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 0, 0, 0);
- }
- else
- {
- halbtc8812a2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
- }
-
- if(!bWifiConnected)
- {
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, FALSE, 0x0, 0x0);
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-connected idle!!\n"));
-
- if( (BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) ||
- (BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
-
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else
- {
- if(BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, FALSE, 0x0, 0x0);
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else if(BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- if(bBtHsOn)
- return FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else
- {
- if(bWifiBusy)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n"));
- bCommon = FALSE;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
-
- if(BTC_RSSI_HIGH(wifiRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
-
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- if(BTC_RSSI_HIGH(wifiRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-
- if(BTC_RSSI_HIGH(wifiRssiState))
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 17);
- else
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- bCommon = TRUE;
- }
- }
- }
-
- return bCommon;
-}
-
-VOID
-halbtc8812a2ant_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"));
-
- pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;
-
- if(!pCoexDm->bAutoTdmaAdjust)
- {
- pCoexDm->bAutoTdmaAdjust = TRUE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
- {
- if(bScoHid)
- {
- if(bTxPause)
- {
- if(maxInterval == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(maxInterval == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(maxInterval == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(maxInterval == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(maxInterval == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- }
- else
- {
- if(bTxPause)
- {
- if(maxInterval == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(maxInterval == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(maxInterval == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(maxInterval == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(maxInterval == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else
- {
- halbtc8812a2ant_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)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_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)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
- pCoexDm->psTdmaDuAdjType = 71;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 71)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
- pCoexDm->psTdmaDuAdjType = 71;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_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)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_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)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_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)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_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)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8812a2ant_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)
- {
- halbtc8812a2ant_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"));
- }
- }
-}
-
-//==================
-// pstdma for wifi rssi low
-//==================
-VOID
-halbtc8812a2ant_TdmaDurationAdjustForWifiRssiLow(
- IN PBTC_COEXIST pBtCoexist//,
- //IN u1Byte wifiStatus
- )
-{
- static s4Byte up,dn,m,n,WaitCount;
- s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
- u1Byte retryCount=0, btInfoExt;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], halbtc8812a2ant_TdmaDurationAdjustForWifiRssiLow()\n"));
-#if 0
- if( (BT_8812A_2ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
- (BT_8812A_2ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
- (BT_8812A_2ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
- {
- if( pCoexDm->curPsTdma != 81 &&
- pCoexDm->curPsTdma != 82 &&
- pCoexDm->curPsTdma != 83 &&
- pCoexDm->curPsTdma != 84 )
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
- pCoexDm->psTdmaDuAdjType = 82;
-
- up = 0;
- dn = 0;
- m = 1;
- n= 3;
- result = 0;
- WaitCount = 0;
- }
- return;
- }
-#endif
- pCoexDm->bAutoTdmaAdjust = FALSE;
-
- if(!pCoexDm->bAutoTdmaAdjustLowRssi)
- {
- pCoexDm->bAutoTdmaAdjustLowRssi = TRUE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjustForWifiRssiLow()!!\n"));
-
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
- pCoexDm->psTdmaDuAdjType = 82;
- //============
- 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;
- btInfoExt = pCoexSta->btInfoExt;
- 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"));
- }
-
- if(result == -1)
- {
- if( (BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 81) ||(pCoexDm->curPsTdma == 82)) )
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
- pCoexDm->psTdmaDuAdjType = 83;
- }
- else if(pCoexDm->curPsTdma == 81)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
- pCoexDm->psTdmaDuAdjType = 82;
- }
- else if(pCoexDm->curPsTdma == 82)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
- pCoexDm->psTdmaDuAdjType = 83;
- }
- else if(pCoexDm->curPsTdma == 83)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 84);
- pCoexDm->psTdmaDuAdjType = 84;
- }
- }
- else if(result == 1)
- {
- if( (BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 81) ||(pCoexDm->curPsTdma == 82)) )
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
- pCoexDm->psTdmaDuAdjType = 83;
- }
- else if(pCoexDm->curPsTdma == 84)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
- pCoexDm->psTdmaDuAdjType = 83;
- }
- else if(pCoexDm->curPsTdma == 83)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
- pCoexDm->psTdmaDuAdjType = 82;
- }
- else if(pCoexDm->curPsTdma == 82)
- {
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 81);
- pCoexDm->psTdmaDuAdjType = 81;
- }
- }
-
- if( pCoexDm->curPsTdma != 81 &&
- pCoexDm->curPsTdma != 82 &&
- pCoexDm->curPsTdma != 83 &&
- pCoexDm->curPsTdma != 84 )
- {
- // recover to previous adjust type
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
- }
- }
-}
-
-VOID
-halbtc8812a2ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
-
- // coex table
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
-
- // pstdma
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- else
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
- }
- }
-}
-
-VOID
-halbtc8812a2ant_ActionScoHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
-
- // coex table
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
-
- // pstdma
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- else
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
- }
- }
-}
-
-VOID
-halbtc8812a2ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- else
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
-
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8812a2ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
- else
- halbtc8812a2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8812a2ant_ActionA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);
- else
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
- }
- }
-}
-
-VOID
-halbtc8812a2ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- else
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 85);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- // sw mechanism
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//PAN(HS) only
-VOID
-halbtc8812a2ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
-
- // coex table
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
-
- // pstdma
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8812a2ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- else
- {
- pCoexDm->bAutoTdmaAdjust = FALSE;
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 86);
- }
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8812a2ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- else
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 85);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8812a2ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- else
- {
- pCoexDm->bAutoTdmaAdjust = FALSE;
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 86);
- }
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
-
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8812a2ant_ActionHidA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- else
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8812a2ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
- btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
-
- // power save state
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
- else
- halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
-
- // coex table
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
- else
- halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-
- // pstdma
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- else
- {
- pCoexDm->bAutoTdmaAdjust = FALSE;
- halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
- }
-
- // decrease BT power
- if(BTC_RSSI_LOW(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
- else if(BTC_RSSI_MEDIUM(btRssiState))
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
- else
- halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
-
- // limited Rx
- if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
- else
- halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
-
- // fw dac swing level
- halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
- // sw mechanism
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- if(BTC_RSSI_HIGH(wifiRssiState))
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-
-VOID
-halbtc8812a2ant_CoexUnder5G(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8812a2ant_CoexAllOff(pBtCoexist);
-
- halbtc8812a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, TRUE);
-}
-//====================================================
-VOID
-halbtc8812a2ant_RunCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiUnder5G=FALSE, bBtHsOn=FALSE;
- u1Byte btInfoOriginal=0, btRetryCnt=0;
- u1Byte algorithm=0;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
- return;
- }
-
- if(pCoexSta->bUnderIps)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\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"));
- halbtc8812a2ant_CoexUnder5G(pBtCoexist);
- return;
- }
-
- algorithm = halbtc8812a2ant_ActionAlgorithm(pBtCoexist);
- if(pCoexSta->bC2hBtInquiryPage && (BT_8812A_2ANT_COEX_ALGO_PANHS!=algorithm))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));
- halbtc8812a2ant_ActionBtInquiry(pBtCoexist);
- return;
- }
-
- pCoexDm->curAlgorithm = algorithm;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
-
- if(halbtc8812a2ant_IsCommonAction(pBtCoexist))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n"));
- pCoexDm->bAutoTdmaAdjust = FALSE;
- pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;
- }
- else
- {
- if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n",
- pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));
- pCoexDm->bAutoTdmaAdjust = FALSE;
- pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;
- }
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8812A_2ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
- halbtc8812a2ant_ActionSco(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_SCO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO+HID.\n"));
- halbtc8812a2ant_ActionScoHid(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
- halbtc8812a2ant_ActionHid(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
- halbtc8812a2ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));
- halbtc8812a2ant_ActionA2dpPanHs(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
- halbtc8812a2ant_ActionPanEdr(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
- halbtc8812a2ant_ActionPanHs(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
- halbtc8812a2ant_ActionPanEdrA2dp(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_PANEDR_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
- halbtc8812a2ant_ActionPanEdrHid(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
- halbtc8812a2ant_ActionHidA2dpPanEdr(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN(HS).\n"));
- halbtc8812a2ant_ActionHidA2dpPanHs(pBtCoexist);
- break;
- case BT_8812A_2ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
- halbtc8812a2ant_ActionHidA2dp(pBtCoexist);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
- halbtc8812a2ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
-}
-
-VOID
-halbtc8812a2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bBackUp
- )
-{
- u4Byte u4Tmp=0;
- u2Byte u2Tmp=0;
- u1Byte u1Tmp=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
-
- 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);
- }
-
- //ant sw control to BT
- halbtc8812a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_CPL_AUX, TRUE, FALSE);
-
- // 0x790[5:0]=0x5
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
- u1Tmp &= 0xc0;
- u1Tmp |= 0x5;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
-
- // PTA parameter
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, 0x0);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, 0xffff);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, 0x55555555);
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c0, 0x55555555);
-
- // coex parameters
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1);
-
- // enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
-
- // enable PTA
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
-
- // bt clock related
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4);
- u1Tmp |= BIT7;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4, u1Tmp);
-
- // bt clock related
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x7);
- u1Tmp |= BIT1;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x7, u1Tmp);
-}
-
-//============================================================
-// work around function start with wa_halbtc8812a2ant_
-//============================================================
-//============================================================
-// extern function start with EXhalbtc8812a2ant_
-//============================================================
-VOID
-EXhalbtc8812a2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8812a2ant_InitHwConfig(pBtCoexist, TRUE);
-}
-
-VOID
-EXhalbtc8812a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- halbtc8812a2ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8812a2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- pu1Byte cliBuf=pBtCoexist->cliBuf;
- u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0;
- u2Byte u2Tmp[4];
- 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);
-
- if(pBtCoexist->bManualControl)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- 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);
-
- 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", \
- GLCoexVerDate8812a2Ant, GLCoexVer8812a2Ant, 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]", \
- ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
- ( (BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
- pCoexSta->btRssi, pCoexSta->btRetryCnt);
- CL_PRINTF(cliBuf);
-
- 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);
- 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; i<BT_INFO_SRC_8812A_2ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8812a2Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
- ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
- ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
- pBtCoexist->btInfo.lpsVal,
- pBtCoexist->btInfo.rpwmVal);
- 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);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
- pBtCoexist->btInfo.raMask);
- CL_PRINTF(cliBuf);
-
- // Fw mechanism
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
- CL_PRINTF(cliBuf);
-
- psTdmaCase = pCoexDm->curPsTdma;
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d/%d)", "PS TDMA", \
- pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
- pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
- pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust, pCoexDm->bAutoTdmaAdjustLowRssi);
- CL_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \
- pCoexDm->curBtDecPwrLvl, 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);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "backup ARFR1/ARFR2/RL/AMaxTime", \
- pCoexDm->backupArfrCnt1, pCoexDm->backupArfrCnt2, pCoexDm->backupRetryLimit, pCoexDm->backupAmpduMaxTime);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
- u2Tmp[0] = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "0x430/0x434/0x42a/0x456", \
- u4Tmp[0], u4Tmp[1], u2Tmp[0], u1Tmp[0]);
- 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);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb3);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xcb3/ 0xcb7", \
- u1Tmp[0], u1Tmp[1]);
- 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", "0xf48/ 0xa5b (FA cnt-- OFDM : CCK)", \
- 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);
- 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_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(high-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);
-#if(BT_AUTO_REPORT_ONLY_8812A_2ANT == 1)
- halbtc8812a2ant_MonitorBtCtr(pBtCoexist);
-#endif
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8812a2ant_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;
- halbtc8812a2ant_CoexAllOff(pBtCoexist);
- halbtc8812a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_CPL_AUX, FALSE, TRUE);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- pCoexSta->bUnderIps = FALSE;
- }
-}
-
-VOID
-EXhalbtc8812a2ant_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
-EXhalbtc8812a2ant_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
-EXhalbtc8812a2ant_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
-EXhalbtc8812a2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u1Byte dataLen=5;
- u1Byte buf[6] = {0};
- u1Byte H2C_Parameter[3] ={0};
- u4Byte wifiBw;
- u1Byte wifiCentralChnl;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- 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;
- }
-
- pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0];
- pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1];
- pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2];
-
- buf[0] = dataLen;
- buf[1] = 0x5; // OP_Code
- buf[2] = 0x3; // OP_Code_Length
- buf[3] = H2C_Parameter[0]; // OP_Code_Content
- buf[4] = H2C_Parameter[1];
- buf[5] = H2C_Parameter[2];
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
-}
-
-VOID
-EXhalbtc8812a2ant_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
-EXhalbtc8812a2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- 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_8812A_2ANT_MAX)
- rspSource = BT_INFO_SRC_8812A_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; i<length; i++)
- {
- 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]));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
- }
- }
-
- if(BT_INFO_SRC_8812A_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];
-
- // Here we need to resend some wifi info to BT
- // because bt is reset and loss of the info.
- if( (pCoexSta->btInfoExt & BIT1) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- EXhalbtc8812a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- EXhalbtc8812a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
- }
-
- if( (pCoexSta->btInfoExt&BIT3) && !bWifiUnder5G)
- {
- if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
- halbtc8812a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
- }
- }
- else
- {
- // BT already NOT ignore Wlan active, do nothing here.
- }
- }
-
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8812A_2ANT_B_INQ_PAGE)
- pCoexSta->bC2hBtInquiryPage = TRUE;
- else
- pCoexSta->bC2hBtInquiryPage = FALSE;
-
- // set link exist status
- if(!(btInfo&BT_INFO_8812A_2ANT_B_CONNECTION))
- {
- pCoexSta->bBtLinkExist = FALSE;
- pCoexSta->bPanExist = FALSE;
- pCoexSta->bA2dpExist = FALSE;
- pCoexSta->bHidExist = FALSE;
- pCoexSta->bScoExist = FALSE;
- }
- else // connection exists
- {
- pCoexSta->bBtLinkExist = TRUE;
- if(btInfo & BT_INFO_8812A_2ANT_B_FTP)
- pCoexSta->bPanExist = TRUE;
- else
- pCoexSta->bPanExist = FALSE;
- if(btInfo & BT_INFO_8812A_2ANT_B_A2DP)
- pCoexSta->bA2dpExist = TRUE;
- else
- pCoexSta->bA2dpExist = FALSE;
- if(btInfo & BT_INFO_8812A_2ANT_B_HID)
- pCoexSta->bHidExist = TRUE;
- else
- pCoexSta->bHidExist = FALSE;
- if(btInfo & BT_INFO_8812A_2ANT_B_SCO_ESCO)
- pCoexSta->bScoExist = TRUE;
- else
- pCoexSta->bScoExist = FALSE;
- }
-
- halbtc8812a2ant_UpdateBtLinkInfo(pBtCoexist);
-
- if(!(btInfo&BT_INFO_8812A_2ANT_B_CONNECTION))
- {
- pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
- }
- else if(btInfo == BT_INFO_8812A_2ANT_B_CONNECTION) // connection exists but no busy
- {
- pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
- }
- else if((btInfo&BT_INFO_8812A_2ANT_B_SCO_ESCO) ||
- (btInfo&BT_INFO_8812A_2ANT_B_SCO_BUSY))
- {
- pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_SCO_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
- }
- else if(btInfo&BT_INFO_8812A_2ANT_B_ACL_BUSY)
- {
- pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_ACL_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
- }
- else
- {
- pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_MAX;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
- }
-
- if( (BT_8812A_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8812A_2ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8812A_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- bBtBusy = TRUE;
- if(!bWifiUnder5G)
- bLimitedDig = TRUE;
- }
- else
- {
- bBtBusy = FALSE;
- bLimitedDig = FALSE;
- }
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
-
- pCoexDm->bLimitedDig = bLimitedDig;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
-
- halbtc8812a2ant_RunCoexistMechanism(pBtCoexist);
-}
-
-VOID
-EXhalbtc8812a2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte u1Tmp=0;
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- halbtc8812a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_CPL_AUX, FALSE, TRUE);
- halbtc8812a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- EXhalbtc8812a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-
- // 0x522=0xff, pause tx
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x522, 0xff);
- // 0x40[7:6]=2'b01, modify BT mode.
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0xc0, 0x2);
-}
-
-VOID
-EXhalbtc8812a2ant_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", \
- GLCoexVerDate8812a2Ant, GLCoexVer8812a2Ant, fwVer, btPatchVer, btPatchVer));
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
- }
-
-#if(BT_AUTO_REPORT_ONLY_8812A_2ANT == 0)
- halbtc8812a2ant_QueryBtInfo(pBtCoexist);
- halbtc8812a2ant_MonitorBtCtr(pBtCoexist);
- halbtc8812a2ant_MonitorBtEnableDisable(pBtCoexist);
-#else
- if( halbtc8812a2ant_IsWifiStatusChanged(pBtCoexist) ||
- pCoexDm->bAutoTdmaAdjust ||
- pCoexDm->bAutoTdmaAdjustLowRssi)
- {
- halbtc8812a2ant_RunCoexistMechanism(pBtCoexist);
- }
-#endif
-}
-
-VOID
-EXhalbtc8812a2ant_DbgControl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte opCode,
- IN u1Byte opLen,
- IN pu1Byte pData
- )
-{
- switch(opCode)
- {
- case BTC_DBG_SET_COEX_DEC_BT_PWR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set Dec BT power\n"));
- {
- u1Byte dataLen=4;
- u1Byte buf[6] = {0};
- u1Byte decBtPwr=0, pwrLevel=0;
- if(opLen == 2)
- {
- decBtPwr = pData[0];
- pwrLevel = pData[1];
-
- buf[0] = dataLen;
- buf[1] = 0x3; // OP_Code
- buf[2] = 0x2; // OP_Code_Length
-
- buf[3] = decBtPwr; // OP_Code_Content
- buf[4] = pwrLevel;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set Dec BT power=%d, pwrLevel=%d\n", decBtPwr, pwrLevel));
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
- }
- }
- break;
-
- case BTC_DBG_SET_COEX_BT_AFH_MAP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT AFH Map\n"));
- {
- u1Byte dataLen=5;
- u1Byte buf[6] = {0};
- if(opLen == 3)
- {
- buf[0] = dataLen;
- buf[1] = 0x5; // OP_Code
- buf[2] = 0x3; // OP_Code_Length
-
- buf[3] = pData[0]; // OP_Code_Content
- buf[4] = pData[1];
- buf[5] = pData[2];
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT AFH Map = %02x %02x %02x\n",
- pData[0], pData[1], pData[2]));
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
- }
- }
- break;
-
- case BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT Ignore Wlan Active\n"));
- {
- u1Byte dataLen=3;
- u1Byte buf[6] = {0};
- if(opLen == 1)
- {
- buf[0] = dataLen;
- buf[1] = 0x1; // OP_Code
- buf[2] = 0x1; // OP_Code_Length
-
- buf[3] = pData[0]; // OP_Code_Content
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT Ignore Wlan Active = 0x%x\n",
- pData[0]));
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
- }
- }
- break;
-
- default:
- break;
- }
-}
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for RTL8812A Co-exist mechanism
+//
+// History
+// 2012/08/22 Cosa first check in.
+// 2012/11/14 Cosa Revise for 8812A 2Ant out sourcing.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8812A_2ANT GLCoexDm8812a2Ant;
+static PCOEX_DM_8812A_2ANT pCoexDm=&GLCoexDm8812a2Ant;
+static COEX_STA_8812A_2ANT GLCoexSta8812a2Ant;
+static PCOEX_STA_8812A_2ANT pCoexSta=&GLCoexSta8812a2Ant;
+
+const char *const GLBtInfoSrc8812a2Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+u4Byte GLCoexVerDate8812a2Ant=20131017;
+u4Byte GLCoexVer8812a2Ant=0x36;
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8812a2ant_
+//============================================================
+u1Byte
+halbtc8812a2ant_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))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));
+ if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8812A_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
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));
+ 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))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));
+ if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8812A_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))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=MEDIUM\n"));
+ if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8812A_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
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));
+ 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
+halbtc8812a2ant_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_8812A_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_8812A_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_8812A_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
+halbtc8812a2ant_MonitorBtEnableDisable(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ static BOOLEAN bPreBtDisabled=FALSE;
+ static u4Byte btDisableCnt=0;
+ BOOLEAN bBtActive=TRUE, bBtDisabled=FALSE;
+
+ // This function check if bt is disabled
+
+ // only 8812a need to consider if core stack is installed.
+ if(!pStackInfo->hciVersion)
+ {
+ bBtActive = FALSE;
+ }
+
+ 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 is detected as disabled %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
+ {
+ }
+ }
+}
+
+u4Byte
+halbtc8812a2ant_DecideRaMask(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u4Byte raMaskType
+ )
+{
+ u4Byte disRaMask=0x0;
+
+ switch(raMaskType)
+ {
+ case 0: // normal mode
+ disRaMask = 0x0;
+ break;
+ case 1: // disable cck 1/2
+ disRaMask = 0x00000003;
+ break;
+ case 2: // disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4
+ disRaMask = 0x0001f1f7;
+ break;
+ default:
+ break;
+ }
+
+ return disRaMask;
+}
+
+VOID
+halbtc8812a2ant_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
+halbtc8812a2ant_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
+halbtc8812a2ant_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
+halbtc8812a2ant_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;
+ default:
+ break;
+ }
+ }
+
+ pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType;
+}
+
+VOID
+halbtc8812a2ant_LimitedTx(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte raMaskType,
+ IN u1Byte arfrType,
+ IN u1Byte retryLimitType,
+ IN u1Byte ampduTimeType
+ )
+{
+ u4Byte disRaMask=0x0;
+
+ pCoexDm->curRaMaskType = raMaskType;
+ disRaMask = halbtc8812a2ant_DecideRaMask(pBtCoexist, raMaskType);
+ halbtc8812a2ant_UpdateRaMask(pBtCoexist, bForceExec, disRaMask);
+
+ halbtc8812a2ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType);
+ halbtc8812a2ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType);
+ halbtc8812a2ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType);
+}
+
+VOID
+halbtc8812a2ant_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
+halbtc8812a2ant_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, 0xc);
+}
+
+VOID
+halbtc8812a2ant_QueryBtInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte dataLen=3;
+ u1Byte buf[5] = {0};
+
+ if(!pBtCoexist->btInfo.bBtDisabled)
+ {
+ if(!pCoexSta->btInfoQueryCnt ||
+ (pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8812A_2ANT_BT_RSP]-pCoexSta->btInfoQueryCnt)>2)
+ {
+ buf[0] = dataLen;
+ buf[1] = 0x1; // polling enable, 1=enable, 0=disable
+ buf[2] = 0x2; // polling time in seconds
+ buf[3] = 0x1; // auto report enable, 1=enable, 0=disable
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_INFO, (PVOID)&buf[0]);
+ }
+ }
+ pCoexSta->btInfoQueryCnt++;
+}
+
+BOOLEAN
+halbtc8812a2ant_IsWifiStatusChanged(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
+ BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+
+ if(bWifiConnected)
+ {
+ if(bWifiBusy != bPreWifiBusy)
+ {
+ bPreWifiBusy = bWifiBusy;
+ return TRUE;
+ }
+ if(bUnder4way != bPreUnder4way)
+ {
+ bPreUnder4way = bUnder4way;
+ return TRUE;
+ }
+ if(bBtHsOn != bPreBtHsOn)
+ {
+ bPreBtHsOn = bBtHsOn;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+VOID
+halbtc8812a2ant_UpdateBtLinkInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+
+#if 1//(BT_AUTO_REPORT_ONLY_8812A_2ANT == 1) // profile from bt patch
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
+ pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
+ pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
+ pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
+
+ // work around for HS mode.
+ if(bBtHsOn)
+ {
+ pBtLinkInfo->bPanExist = TRUE;
+ pBtLinkInfo->bBtLinkExist = TRUE;
+ }
+#else // profile from bt stack
+ pBtLinkInfo->bBtLinkExist = pStackInfo->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pStackInfo->bScoExist;
+ pBtLinkInfo->bA2dpExist = pStackInfo->bA2dpExist;
+ pBtLinkInfo->bPanExist = pStackInfo->bPanExist;
+ pBtLinkInfo->bHidExist = pStackInfo->bHidExist;
+
+ //for win-8 stack HID report error
+ if(!pStackInfo->bHidExist)
+ pStackInfo->bHidExist = pCoexSta->bHidExist; //sync BTInfo with BT firmware and stack
+ // when stack HID report error, here we use the info from bt fw.
+ if(!pStackInfo->bBtLinkExist)
+ pStackInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+#endif
+ // check if Sco only
+ if( pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bScoOnly = TRUE;
+ else
+ pBtLinkInfo->bScoOnly = FALSE;
+
+ // check if A2dp only
+ if( !pBtLinkInfo->bScoExist &&
+ pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bA2dpOnly = TRUE;
+ else
+ pBtLinkInfo->bA2dpOnly = FALSE;
+
+ // check if Pan only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bPanOnly = TRUE;
+ else
+ pBtLinkInfo->bPanOnly = FALSE;
+
+ // check if Hid only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bHidOnly = TRUE;
+ else
+ pBtLinkInfo->bHidOnly = FALSE;
+}
+
+u1Byte
+halbtc8812a2ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8812A_2ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!pBtLinkInfo->bBtLinkExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
+ return algorithm;
+ }
+
+ if(pBtLinkInfo->bScoExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bHidExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bPanExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bA2dpExist)
+ numOfDiffProfile++;
+
+ if(numOfDiffProfile == 1)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_A2DP;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 2)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_SCO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_SCO;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(pStackInfo->numOfHid >= 2)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID*2 + A2DP\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_SCO_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_SCO_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile >= 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->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_8812A_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+VOID
+halbtc8812a2ant_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
+halbtc8812a2ant_SetFwDecBtPwr(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte decBtPwrLvl
+ )
+{
+ u1Byte dataLen=4;
+ u1Byte buf[6] = {0};
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power level = %d\n",
+ decBtPwrLvl));
+
+ buf[0] = dataLen;
+ buf[1] = 0x3; // OP_Code
+ buf[2] = 0x2; // OP_Code_Length
+ if(decBtPwrLvl)
+ buf[3] = 0x1; // OP_Code_Content
+ else
+ buf[3] = 0x0;
+ buf[4] = decBtPwrLvl;// pwrLevel
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+}
+
+VOID
+halbtc8812a2ant_DecBtPwr(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte decBtPwrLvl
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power level = %d\n",
+ (bForceExec? "force to":""), decBtPwrLvl));
+ pCoexDm->curBtDecPwrLvl = decBtPwrLvl;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preBtDecPwrLvl=%d, curBtDecPwrLvl=%d\n",
+ pCoexDm->preBtDecPwrLvl, pCoexDm->curBtDecPwrLvl));
+
+ if(pCoexDm->preBtDecPwrLvl == pCoexDm->curBtDecPwrLvl)
+ return;
+ }
+ halbtc8812a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->curBtDecPwrLvl);
+
+ pCoexDm->preBtDecPwrLvl = pCoexDm->curBtDecPwrLvl;
+}
+
+VOID
+halbtc8812a2ant_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;
+ }
+
+ halbtc8812a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
+
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
+}
+
+VOID
+halbtc8812a2ant_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
+halbtc8812a2ant_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;
+ }
+ halbtc8812a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
+
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
+}
+
+VOID
+halbtc8812a2ant_SetSwPenaltyTxRateAdaptive(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ u1Byte tmpU1;
+
+ tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
+ tmpU1 |= BIT0;
+ if(bLowPenaltyRa)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
+ tmpU1 &= ~BIT2;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
+ tmpU1 |= BIT2;
+ }
+
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
+}
+
+VOID
+halbtc8812a2ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ return;
+ 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;
+ }
+ halbtc8812a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8812a2ant_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
+halbtc8812a2ant_SetSwFullTimeDacSwing(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSwDacSwingOn,
+ IN u4Byte swDacSwingLvl
+ )
+{
+ if(bSwDacSwingOn)
+ {
+ halbtc8812a2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
+ }
+ else
+ {
+ halbtc8812a2ant_SetDacSwingReg(pBtCoexist, 0x18);
+ }
+}
+
+
+VOID
+halbtc8812a2ant_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);
+ halbtc8812a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
+
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
+}
+
+VOID
+halbtc8812a2ant_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
+halbtc8812a2ant_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;
+ }
+ halbtc8812a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
+
+ pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
+}
+
+VOID
+halbtc8812a2ant_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
+halbtc8812a2ant_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;
+ }
+ halbtc8812a2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
+
+ pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
+}
+
+VOID
+halbtc8812a2ant_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
+halbtc8812a2ant_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;
+ }
+ halbtc8812a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8812a2ant_CoexTableWithType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type
+ )
+{
+ switch(type)
+ {
+ case 0:
+ halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 1:
+ halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 2:
+ halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5ffb5ffb, 0xffffff, 0x3);
+ break;
+ case 3:
+ halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x5fdf5fdf, 0x5fdb5fdb, 0xffffff, 0x3);
+ break;
+ case 4:
+ halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0xdfffdfff, 0x5fdb5fdb, 0xffffff, 0x3);
+ break;
+ case 5:
+ halbtc8812a2ant_CoexTable(pBtCoexist, bForceExec, 0x5ddd5ddd, 0x5fdb5fdb, 0xffffff, 0x3);
+ break;
+
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8812a2ant_SetFwIgnoreWlanAct(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bEnable
+ )
+{
+ u1Byte dataLen=3;
+ u1Byte buf[5] = {0};
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], %s BT Ignore Wlan_Act\n",
+ (bEnable? "Enable":"Disable")));
+
+ buf[0] = dataLen;
+ buf[1] = 0x1; // OP_Code
+ buf[2] = 0x1; // OP_Code_Length
+ if(bEnable)
+ buf[3] = 0x1; // OP_Code_Content
+ else
+ buf[3] = 0x0;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+}
+
+VOID
+halbtc8812a2ant_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;
+ }
+ halbtc8812a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8812a2ant_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};
+
+ H2C_Parameter[0] = byte1;
+ H2C_Parameter[1] = byte2;
+ H2C_Parameter[2] = byte3;
+ H2C_Parameter[3] = byte4;
+ H2C_Parameter[4] = byte5;
+
+ pCoexDm->psTdmaPara[0] = byte1;
+ pCoexDm->psTdmaPara[1] = byte2;
+ pCoexDm->psTdmaPara[2] = byte3;
+ pCoexDm->psTdmaPara[3] = byte4;
+ pCoexDm->psTdmaPara[4] = byte5;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
+halbtc8812a2ant_SetLpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ u1Byte lps=lpsVal;
+ u1Byte rpwm=rpwmVal;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
+}
+
+VOID
+halbtc8812a2ant_LpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bForceExecPwrCmd=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
+ (bForceExec? "force to":""), lpsVal, rpwmVal));
+ pCoexDm->curLps = lpsVal;
+ pCoexDm->curRpwm = rpwmVal;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preLps/curLps=0x%x/0x%x, preRpwm/curRpwm=0x%x/0x%x!!\n",
+ pCoexDm->preLps, pCoexDm->curLps, pCoexDm->preRpwm, pCoexDm->curRpwm));
+
+ if( (pCoexDm->preLps == pCoexDm->curLps) &&
+ (pCoexDm->preRpwm == pCoexDm->curRpwm) )
+ {
+ return;
+ }
+ }
+ halbtc8812a2ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
+
+ pCoexDm->preLps = pCoexDm->curLps;
+ pCoexDm->preRpwm = pCoexDm->curRpwm;
+}
+
+VOID
+halbtc8812a2ant_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;
+ }
+ */
+
+ halbtc8812a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF);
+ //halbtc8812a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
+}
+
+VOID
+halbtc8812a2ant_SwMechanism2(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAGCTableShift,
+ IN BOOLEAN bADCBackOff,
+ IN BOOLEAN bSWDACSwing,
+ IN u4Byte dacSwingLvl
+ )
+{
+ //halbtc8812a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift);
+ halbtc8812a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff);
+ halbtc8812a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl);
+}
+
+VOID
+halbtc8812a2ant_SetAntPath(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte antPosType,
+ IN BOOLEAN bInitHwCfg,
+ IN BOOLEAN bWifiOff
+ )
+{
+ u1Byte u1Tmp=0;
+
+ if(bInitHwCfg)
+ {
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x900, 0x00000400);
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76d, 0x1);
+ }
+ else if(bWifiOff)
+ {
+
+ }
+
+ // ext switch setting
+ switch(antPosType)
+ {
+ case BTC_ANT_WIFI_AT_CPL_MAIN:
+ break;
+ case BTC_ANT_WIFI_AT_CPL_AUX:
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
+ u1Tmp &= ~BIT3;
+ u1Tmp |= BIT2;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb7, u1Tmp);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8812a2ant_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:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xa1, 0x90);
+ break;
+ case 2:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xa1, 0x90);
+ break;
+ case 3:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xb1, 0x90);
+ break;
+ case 4:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xb1, 0x90);
+ break;
+ case 5:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x21, 0x10);
+ break;
+ case 6:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x21, 0x10);
+ break;
+ case 7:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x21, 0x10);
+ break;
+ case 8:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x3, 0x21, 0x10);
+ break;
+ case 9:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xa1, 0x10);
+ break;
+ case 10:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xa1, 0x10);
+ break;
+ case 11:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x03, 0xb1, 0x10);
+ break;
+ case 12:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xb1, 0x10);
+ break;
+ case 13:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x21, 0x10);
+ break;
+ case 14:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x21, 0x10);
+ break;
+ case 15:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x03, 0x21, 0x10);
+ break;
+ case 16:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0x21, 0x10);
+ break;
+ case 17:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0xb1, 0x10);
+ break;
+ case 18:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
+ break;
+ case 19:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90);
+ break;
+ case 20:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);
+ break;
+ case 21:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);
+ break;
+ case 71:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+
+ // following cases is for wifi rssi low, started from 81
+ case 81:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x3a, 0x3, 0x90, 0x50);
+ break;
+ case 82:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x2b, 0x3, 0x90, 0x50);
+ break;
+ case 83:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x21, 0x3, 0x90, 0x50);
+ break;
+ case 84:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x15, 0x3, 0x90, 0x50);
+ break;
+ case 85:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1d, 0x1d, 0x80, 0x50);
+ break;
+ case 86:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0xd3, 0x15, 0x15, 0x80, 0x50);
+ break;
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(type)
+ {
+ case 0: //ANT2PTA, 0x778=0x1
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
+ break;
+ case 1: //ANT2BT, 0x778=3
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x08, 0x0);
+ delay_ms(5);
+ halbtc8812a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_CPL_AUX, FALSE, FALSE);
+ break;
+ default:
+ halbtc8812a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x00, 0x0);
+ break;
+ }
+ }
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+VOID
+halbtc8812a2ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // fw all off
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ // sw all off
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ // hw all off
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+VOID
+halbtc8812a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+
+ halbtc8812a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, 0);
+
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+}
+
+VOID
+halbtc8812a2ant_PsTdmaCheckForPowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bNewPsState
+ )
+{
+ u1Byte lpsMode=0x0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
+
+ if(lpsMode) // already under LPS state
+ {
+ if(bNewPsState)
+ {
+ // keep state under LPS, do nothing.
+ }
+ else
+ {
+ // will leave LPS state, turn off psTdma first
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ }
+ else // NO PS state
+ {
+ if(bNewPsState)
+ {
+ // will enter LPS state, turn off psTdma first
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ // keep state under NO PS state, do nothing.
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_PowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte psType,
+ IN BOOLEAN bLowPwrDisable,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ switch(psType)
+ {
+ case BTC_PS_WIFI_NATIVE:
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ break;
+ case BTC_PS_LPS_ON:
+ halbtc8812a2ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
+ halbtc8812a2ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
+ 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);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionBtInquiry(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+}
+
+BOOLEAN
+halbtc8812a2ant_IsCommonAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
+ BOOLEAN bBtHsOn=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if(pBtLinkInfo->bScoExist || pBtLinkInfo->bHidExist)
+ {
+ halbtc8812a2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 0, 0, 0);
+ }
+ else
+ {
+ halbtc8812a2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+ }
+
+ if(!bWifiConnected)
+ {
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, FALSE, 0x0, 0x0);
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-connected idle!!\n"));
+
+ if( (BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) ||
+ (BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ if(BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, FALSE, 0x0, 0x0);
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else if(BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ if(bBtHsOn)
+ return FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ if(bWifiBusy)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n"));
+ bCommon = FALSE;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
+
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 17);
+ else
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ bCommon = TRUE;
+ }
+ }
+ }
+
+ return bCommon;
+}
+
+VOID
+halbtc8812a2ant_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"));
+
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;
+
+ if(!pCoexDm->bAutoTdmaAdjust)
+ {
+ pCoexDm->bAutoTdmaAdjust = TRUE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
+ {
+ if(bScoHid)
+ {
+ if(bTxPause)
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ }
+ else
+ {
+ if(bTxPause)
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else
+ {
+ halbtc8812a2ant_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)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_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)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
+ pCoexDm->psTdmaDuAdjType = 71;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 71)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
+ pCoexDm->psTdmaDuAdjType = 71;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_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)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_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)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_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)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_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)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8812a2ant_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)
+ {
+ halbtc8812a2ant_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"));
+ }
+ }
+}
+
+//==================
+// pstdma for wifi rssi low
+//==================
+VOID
+halbtc8812a2ant_TdmaDurationAdjustForWifiRssiLow(
+ IN PBTC_COEXIST pBtCoexist//,
+ //IN u1Byte wifiStatus
+ )
+{
+ static s4Byte up,dn,m,n,WaitCount;
+ s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
+ u1Byte retryCount=0, btInfoExt;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], halbtc8812a2ant_TdmaDurationAdjustForWifiRssiLow()\n"));
+#if 0
+ if( (BT_8812A_2ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
+ (BT_8812A_2ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
+ (BT_8812A_2ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
+ {
+ if( pCoexDm->curPsTdma != 81 &&
+ pCoexDm->curPsTdma != 82 &&
+ pCoexDm->curPsTdma != 83 &&
+ pCoexDm->curPsTdma != 84 )
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
+ pCoexDm->psTdmaDuAdjType = 82;
+
+ up = 0;
+ dn = 0;
+ m = 1;
+ n= 3;
+ result = 0;
+ WaitCount = 0;
+ }
+ return;
+ }
+#endif
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+
+ if(!pCoexDm->bAutoTdmaAdjustLowRssi)
+ {
+ pCoexDm->bAutoTdmaAdjustLowRssi = TRUE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjustForWifiRssiLow()!!\n"));
+
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
+ pCoexDm->psTdmaDuAdjType = 82;
+ //============
+ 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;
+ btInfoExt = pCoexSta->btInfoExt;
+ 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"));
+ }
+
+ if(result == -1)
+ {
+ if( (BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 81) ||(pCoexDm->curPsTdma == 82)) )
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
+ pCoexDm->psTdmaDuAdjType = 83;
+ }
+ else if(pCoexDm->curPsTdma == 81)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
+ pCoexDm->psTdmaDuAdjType = 82;
+ }
+ else if(pCoexDm->curPsTdma == 82)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
+ pCoexDm->psTdmaDuAdjType = 83;
+ }
+ else if(pCoexDm->curPsTdma == 83)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 84);
+ pCoexDm->psTdmaDuAdjType = 84;
+ }
+ }
+ else if(result == 1)
+ {
+ if( (BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 81) ||(pCoexDm->curPsTdma == 82)) )
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
+ pCoexDm->psTdmaDuAdjType = 83;
+ }
+ else if(pCoexDm->curPsTdma == 84)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);
+ pCoexDm->psTdmaDuAdjType = 83;
+ }
+ else if(pCoexDm->curPsTdma == 83)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
+ pCoexDm->psTdmaDuAdjType = 82;
+ }
+ else if(pCoexDm->curPsTdma == 82)
+ {
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 81);
+ pCoexDm->psTdmaDuAdjType = 81;
+ }
+ }
+
+ if( pCoexDm->curPsTdma != 81 &&
+ pCoexDm->curPsTdma != 82 &&
+ pCoexDm->curPsTdma != 83 &&
+ pCoexDm->curPsTdma != 84 )
+ {
+ // recover to previous adjust type
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+
+ // coex table
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
+
+ // pstdma
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ else
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionScoHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+
+ // coex table
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
+
+ // pstdma
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ else
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ else
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
+
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8812a2ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
+ else
+ halbtc8812a2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);
+ else
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ else
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 85);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ // sw mechanism
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//PAN(HS) only
+VOID
+halbtc8812a2ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+
+ // coex table
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+
+ // pstdma
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8812a2ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ else
+ {
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 86);
+ }
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ else
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 85);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8812a2ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ else
+ {
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 86);
+ }
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
+
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionHidA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ else
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8812a2ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8812a2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);
+ btRssiState = halbtc8812a2ant_BtRssiState(3, 34, 42);
+
+ // power save state
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, TRUE, 0x0, 0x0);
+ else
+ halbtc8812a2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);
+
+ // coex table
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5);
+ else
+ halbtc8812a2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+
+ // pstdma
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ else
+ {
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ halbtc8812a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);
+ }
+
+ // decrease BT power
+ if(BTC_RSSI_LOW(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);
+ else if(BTC_RSSI_MEDIUM(btRssiState))
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);
+ else
+ halbtc8812a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);
+
+ // limited Rx
+ if(BTC_RSSI_HIGH(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else if(BTC_RSSI_LOW(wifiRssiState) && BTC_RSSI_HIGH(btRssiState))
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);
+ else
+ halbtc8812a2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8);
+
+ // fw dac swing level
+ halbtc8812a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
+ // sw mechanism
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ if(BTC_RSSI_HIGH(wifiRssiState))
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8812a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8812a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+
+VOID
+halbtc8812a2ant_CoexUnder5G(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8812a2ant_CoexAllOff(pBtCoexist);
+
+ halbtc8812a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, TRUE);
+}
+//====================================================
+VOID
+halbtc8812a2ant_RunCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiUnder5G=FALSE, bBtHsOn=FALSE;
+ u1Byte btInfoOriginal=0, btRetryCnt=0;
+ u1Byte algorithm=0;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
+ return;
+ }
+
+ if(pCoexSta->bUnderIps)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\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"));
+ halbtc8812a2ant_CoexUnder5G(pBtCoexist);
+ return;
+ }
+
+ algorithm = halbtc8812a2ant_ActionAlgorithm(pBtCoexist);
+ if(pCoexSta->bC2hBtInquiryPage && (BT_8812A_2ANT_COEX_ALGO_PANHS!=algorithm))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));
+ halbtc8812a2ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+
+ pCoexDm->curAlgorithm = algorithm;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
+
+ if(halbtc8812a2ant_IsCommonAction(pBtCoexist))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n"));
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;
+ }
+ else
+ {
+ if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n",
+ pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;
+ }
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8812A_2ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
+ halbtc8812a2ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_SCO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO+HID.\n"));
+ halbtc8812a2ant_ActionScoHid(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
+ halbtc8812a2ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
+ halbtc8812a2ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));
+ halbtc8812a2ant_ActionA2dpPanHs(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
+ halbtc8812a2ant_ActionPanEdr(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
+ halbtc8812a2ant_ActionPanHs(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
+ halbtc8812a2ant_ActionPanEdrA2dp(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_PANEDR_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
+ halbtc8812a2ant_ActionPanEdrHid(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
+ halbtc8812a2ant_ActionHidA2dpPanEdr(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN(HS).\n"));
+ halbtc8812a2ant_ActionHidA2dpPanHs(pBtCoexist);
+ break;
+ case BT_8812A_2ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
+ halbtc8812a2ant_ActionHidA2dp(pBtCoexist);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
+ halbtc8812a2ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+}
+
+VOID
+halbtc8812a2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bBackUp
+ )
+{
+ u4Byte u4Tmp=0;
+ u2Byte u2Tmp=0;
+ u1Byte u1Tmp=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));
+
+ 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);
+ }
+
+ //ant sw control to BT
+ halbtc8812a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_CPL_AUX, TRUE, FALSE);
+
+ // 0x790[5:0]=0x5
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
+ u1Tmp &= 0xc0;
+ u1Tmp |= 0x5;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
+
+ // PTA parameter
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, 0x0);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, 0xffff);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, 0x55555555);
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c0, 0x55555555);
+
+ // coex parameters
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x1);
+
+ // enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
+
+ // enable PTA
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
+
+ // bt clock related
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4);
+ u1Tmp |= BIT7;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4, u1Tmp);
+
+ // bt clock related
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x7);
+ u1Tmp |= BIT1;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x7, u1Tmp);
+}
+
+//============================================================
+// work around function start with wa_halbtc8812a2ant_
+//============================================================
+//============================================================
+// extern function start with EXhalbtc8812a2ant_
+//============================================================
+VOID
+EXhalbtc8812a2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8812a2ant_InitHwConfig(pBtCoexist, TRUE);
+}
+
+VOID
+EXhalbtc8812a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ halbtc8812a2ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8812a2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ pu1Byte cliBuf=pBtCoexist->cliBuf;
+ u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0;
+ u2Byte u2Tmp[4];
+ 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);
+
+ if(pBtCoexist->bManualControl)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ 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);
+
+ 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", \
+ GLCoexVerDate8812a2Ant, GLCoexVer8812a2Ant, 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]", \
+ ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle":
+ ( (BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))),
+ pCoexSta->btRssi, pCoexSta->btRetryCnt);
+ CL_PRINTF(cliBuf);
+
+ 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);
+ 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; i<BT_INFO_SRC_8812A_2ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8812a2Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
+ ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
+ ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
+ pBtCoexist->btInfo.lpsVal,
+ pBtCoexist->btInfo.rpwmVal);
+ 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);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
+ pBtCoexist->btInfo.raMask);
+ CL_PRINTF(cliBuf);
+
+ // Fw mechanism
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
+ CL_PRINTF(cliBuf);
+
+ psTdmaCase = pCoexDm->curPsTdma;
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d/%d)", "PS TDMA", \
+ pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
+ pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
+ pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust, pCoexDm->bAutoTdmaAdjustLowRssi);
+ CL_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \
+ pCoexDm->curBtDecPwrLvl, 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);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "backup ARFR1/ARFR2/RL/AMaxTime", \
+ pCoexDm->backupArfrCnt1, pCoexDm->backupArfrCnt2, pCoexDm->backupRetryLimit, pCoexDm->backupAmpduMaxTime);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
+ u2Tmp[0] = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "0x430/0x434/0x42a/0x456", \
+ u4Tmp[0], u4Tmp[1], u2Tmp[0], u1Tmp[0]);
+ 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);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb3);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xcb7);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xcb3/ 0xcb7", \
+ u1Tmp[0], u1Tmp[1]);
+ 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", "0xf48/ 0xa5b (FA cnt-- OFDM : CCK)", \
+ 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);
+ 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_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(high-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);
+#if(BT_AUTO_REPORT_ONLY_8812A_2ANT == 1)
+ halbtc8812a2ant_MonitorBtCtr(pBtCoexist);
+#endif
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8812a2ant_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;
+ halbtc8812a2ant_CoexAllOff(pBtCoexist);
+ halbtc8812a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_CPL_AUX, FALSE, TRUE);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ pCoexSta->bUnderIps = FALSE;
+ }
+}
+
+VOID
+EXhalbtc8812a2ant_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
+EXhalbtc8812a2ant_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
+EXhalbtc8812a2ant_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
+EXhalbtc8812a2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u1Byte dataLen=5;
+ u1Byte buf[6] = {0};
+ u1Byte H2C_Parameter[3] ={0};
+ u4Byte wifiBw;
+ u1Byte wifiCentralChnl;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ 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;
+ }
+
+ pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0];
+ pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1];
+ pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2];
+
+ buf[0] = dataLen;
+ buf[1] = 0x5; // OP_Code
+ buf[2] = 0x3; // OP_Code_Length
+ buf[3] = H2C_Parameter[0]; // OP_Code_Content
+ buf[4] = H2C_Parameter[1];
+ buf[5] = H2C_Parameter[2];
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+}
+
+VOID
+EXhalbtc8812a2ant_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
+EXhalbtc8812a2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ 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_8812A_2ANT_MAX)
+ rspSource = BT_INFO_SRC_8812A_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; i<length; i++)
+ {
+ 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]));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
+ }
+ }
+
+ if(BT_INFO_SRC_8812A_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];
+
+ // Here we need to resend some wifi info to BT
+ // because bt is reset and loss of the info.
+ if( (pCoexSta->btInfoExt & BIT1) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ EXhalbtc8812a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ EXhalbtc8812a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+ }
+
+ if( (pCoexSta->btInfoExt&BIT3) && !bWifiUnder5G)
+ {
+ if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
+ halbtc8812a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+ }
+ }
+ else
+ {
+ // BT already NOT ignore Wlan active, do nothing here.
+ }
+ }
+
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8812A_2ANT_B_INQ_PAGE)
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ else
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+
+ // set link exist status
+ if(!(btInfo&BT_INFO_8812A_2ANT_B_CONNECTION))
+ {
+ pCoexSta->bBtLinkExist = FALSE;
+ pCoexSta->bPanExist = FALSE;
+ pCoexSta->bA2dpExist = FALSE;
+ pCoexSta->bHidExist = FALSE;
+ pCoexSta->bScoExist = FALSE;
+ }
+ else // connection exists
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ if(btInfo & BT_INFO_8812A_2ANT_B_FTP)
+ pCoexSta->bPanExist = TRUE;
+ else
+ pCoexSta->bPanExist = FALSE;
+ if(btInfo & BT_INFO_8812A_2ANT_B_A2DP)
+ pCoexSta->bA2dpExist = TRUE;
+ else
+ pCoexSta->bA2dpExist = FALSE;
+ if(btInfo & BT_INFO_8812A_2ANT_B_HID)
+ pCoexSta->bHidExist = TRUE;
+ else
+ pCoexSta->bHidExist = FALSE;
+ if(btInfo & BT_INFO_8812A_2ANT_B_SCO_ESCO)
+ pCoexSta->bScoExist = TRUE;
+ else
+ pCoexSta->bScoExist = FALSE;
+ }
+
+ halbtc8812a2ant_UpdateBtLinkInfo(pBtCoexist);
+
+ if(!(btInfo&BT_INFO_8812A_2ANT_B_CONNECTION))
+ {
+ pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
+ }
+ else if(btInfo == BT_INFO_8812A_2ANT_B_CONNECTION) // connection exists but no busy
+ {
+ pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
+ }
+ else if((btInfo&BT_INFO_8812A_2ANT_B_SCO_ESCO) ||
+ (btInfo&BT_INFO_8812A_2ANT_B_SCO_BUSY))
+ {
+ pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_SCO_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
+ }
+ else if(btInfo&BT_INFO_8812A_2ANT_B_ACL_BUSY)
+ {
+ pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_ACL_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
+ }
+ else
+ {
+ pCoexDm->btStatus = BT_8812A_2ANT_BT_STATUS_MAX;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
+ }
+
+ if( (BT_8812A_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8812A_2ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8812A_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ bBtBusy = TRUE;
+ if(!bWifiUnder5G)
+ bLimitedDig = TRUE;
+ }
+ else
+ {
+ bBtBusy = FALSE;
+ bLimitedDig = FALSE;
+ }
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+
+ pCoexDm->bLimitedDig = bLimitedDig;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
+
+ halbtc8812a2ant_RunCoexistMechanism(pBtCoexist);
+}
+
+VOID
+EXhalbtc8812a2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte u1Tmp=0;
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ halbtc8812a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_CPL_AUX, FALSE, TRUE);
+ halbtc8812a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ EXhalbtc8812a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+
+ // 0x522=0xff, pause tx
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x522, 0xff);
+ // 0x40[7:6]=2'b01, modify BT mode.
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0xc0, 0x2);
+}
+
+VOID
+EXhalbtc8812a2ant_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", \
+ GLCoexVerDate8812a2Ant, GLCoexVer8812a2Ant, fwVer, btPatchVer, btPatchVer));
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
+ }
+
+#if(BT_AUTO_REPORT_ONLY_8812A_2ANT == 0)
+ halbtc8812a2ant_QueryBtInfo(pBtCoexist);
+ halbtc8812a2ant_MonitorBtCtr(pBtCoexist);
+ halbtc8812a2ant_MonitorBtEnableDisable(pBtCoexist);
+#else
+ if( halbtc8812a2ant_IsWifiStatusChanged(pBtCoexist) ||
+ pCoexDm->bAutoTdmaAdjust ||
+ pCoexDm->bAutoTdmaAdjustLowRssi)
+ {
+ halbtc8812a2ant_RunCoexistMechanism(pBtCoexist);
+ }
+#endif
+}
+
+VOID
+EXhalbtc8812a2ant_DbgControl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte opCode,
+ IN u1Byte opLen,
+ IN pu1Byte pData
+ )
+{
+ switch(opCode)
+ {
+ case BTC_DBG_SET_COEX_DEC_BT_PWR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set Dec BT power\n"));
+ {
+ u1Byte dataLen=4;
+ u1Byte buf[6] = {0};
+ u1Byte decBtPwr=0, pwrLevel=0;
+ if(opLen == 2)
+ {
+ decBtPwr = pData[0];
+ pwrLevel = pData[1];
+
+ buf[0] = dataLen;
+ buf[1] = 0x3; // OP_Code
+ buf[2] = 0x2; // OP_Code_Length
+
+ buf[3] = decBtPwr; // OP_Code_Content
+ buf[4] = pwrLevel;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set Dec BT power=%d, pwrLevel=%d\n", decBtPwr, pwrLevel));
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+ }
+ }
+ break;
+
+ case BTC_DBG_SET_COEX_BT_AFH_MAP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT AFH Map\n"));
+ {
+ u1Byte dataLen=5;
+ u1Byte buf[6] = {0};
+ if(opLen == 3)
+ {
+ buf[0] = dataLen;
+ buf[1] = 0x5; // OP_Code
+ buf[2] = 0x3; // OP_Code_Length
+
+ buf[3] = pData[0]; // OP_Code_Content
+ buf[4] = pData[1];
+ buf[5] = pData[2];
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT AFH Map = %02x %02x %02x\n",
+ pData[0], pData[1], pData[2]));
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+ }
+ }
+ break;
+
+ case BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT Ignore Wlan Active\n"));
+ {
+ u1Byte dataLen=3;
+ u1Byte buf[6] = {0};
+ if(opLen == 1)
+ {
+ buf[0] = dataLen;
+ buf[1] = 0x1; // OP_Code
+ buf[2] = 0x1; // OP_Code_Length
+
+ buf[3] = pData[0]; // OP_Code_Content
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Set BT Ignore Wlan Active = 0x%x\n",
+ pData[0]));
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h
index 31c78d3..c46ee74 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h
@@ -1,213 +1,213 @@
-//===========================================
-// The following is for 8812A 2Ant BT Co-exist definition
-//===========================================
-#define BT_AUTO_REPORT_ONLY_8812A_2ANT 0
-
-#define BT_INFO_8812A_2ANT_B_FTP BIT7
-#define BT_INFO_8812A_2ANT_B_A2DP BIT6
-#define BT_INFO_8812A_2ANT_B_HID BIT5
-#define BT_INFO_8812A_2ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8812A_2ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8812A_2ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8812A_2ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8812A_2ANT_B_CONNECTION BIT0
-
-#define BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
- (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
-
-#define BTC_RSSI_COEX_THRESH_TOL_8812A_2ANT 2
-
-typedef enum _BT_INFO_SRC_8812A_2ANT{
- BT_INFO_SRC_8812A_2ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8812A_2ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8812A_2ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8812A_2ANT_MAX
-}BT_INFO_SRC_8812A_2ANT,*PBT_INFO_SRC_8812A_2ANT;
-
-typedef enum _BT_8812A_2ANT_BT_STATUS{
- BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8812A_2ANT_BT_STATUS_INQ_PAGE = 0x2,
- BT_8812A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
- BT_8812A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
- BT_8812A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
- BT_8812A_2ANT_BT_STATUS_MAX
-}BT_8812A_2ANT_BT_STATUS,*PBT_8812A_2ANT_BT_STATUS;
-
-typedef enum _BT_8812A_2ANT_COEX_ALGO{
- BT_8812A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8812A_2ANT_COEX_ALGO_SCO = 0x1,
- BT_8812A_2ANT_COEX_ALGO_SCO_HID = 0x2,
- BT_8812A_2ANT_COEX_ALGO_HID = 0x3,
- BT_8812A_2ANT_COEX_ALGO_A2DP = 0x4,
- BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
- BT_8812A_2ANT_COEX_ALGO_PANEDR = 0x6,
- BT_8812A_2ANT_COEX_ALGO_PANHS = 0x7,
- BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
- BT_8812A_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
- BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
- BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS = 0xb,
- BT_8812A_2ANT_COEX_ALGO_HID_A2DP = 0xc,
- BT_8812A_2ANT_COEX_ALGO_MAX = 0xd
-}BT_8812A_2ANT_COEX_ALGO,*PBT_8812A_2ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8812A_2ANT{
- // fw mechanism
- u1Byte preBtDecPwrLvl;
- u1Byte curBtDecPwrLvl;
- u1Byte preFwDacSwingLvl;
- u1Byte curFwDacSwingLvl;
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- u1Byte psTdmaDuAdjType;
- BOOLEAN bAutoTdmaAdjust;
- BOOLEAN bAutoTdmaAdjustLowRssi;
- BOOLEAN bPrePsTdmaOn;
- BOOLEAN bCurPsTdmaOn;
- BOOLEAN bPreBtAutoReport;
- BOOLEAN bCurBtAutoReport;
- u1Byte preLps;
- u1Byte curLps;
- u1Byte preRpwm;
- u1Byte curRpwm;
-
- // 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 backupArfrCnt1; // Auto Rate Fallback Retry cnt
- u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt
- u2Byte backupRetryLimit;
- u1Byte backupAmpduMaxTime;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-
- u4Byte preRaMask;
- u4Byte curRaMask;
- u1Byte curRaMaskType;
- u1Byte preArfrType;
- u1Byte curArfrType;
- u1Byte preRetryLimitType;
- u1Byte curRetryLimitType;
- u1Byte preAmpduTimeType;
- u1Byte curAmpduTimeType;
-} COEX_DM_8812A_2ANT, *PCOEX_DM_8812A_2ANT;
-
-typedef struct _COEX_STA_8812A_2ANT{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bA2dpExist;
- 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_8812A_2ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8812A_2ANT_MAX];
- u4Byte btInfoQueryCnt;
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
-}COEX_STA_8812A_2ANT, *PCOEX_STA_8812A_2ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8812a2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a2ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a2ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a2ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a2ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a2ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8812a2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8812a2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8812a2ant_DbgControl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte opCode,
- IN u1Byte opLen,
- IN pu1Byte pData
- );
-
+//===========================================
+// The following is for 8812A 2Ant BT Co-exist definition
+//===========================================
+#define BT_AUTO_REPORT_ONLY_8812A_2ANT 0
+
+#define BT_INFO_8812A_2ANT_B_FTP BIT7
+#define BT_INFO_8812A_2ANT_B_A2DP BIT6
+#define BT_INFO_8812A_2ANT_B_HID BIT5
+#define BT_INFO_8812A_2ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8812A_2ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8812A_2ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8812A_2ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8812A_2ANT_B_CONNECTION BIT0
+
+#define BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
+ (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
+
+#define BTC_RSSI_COEX_THRESH_TOL_8812A_2ANT 2
+
+typedef enum _BT_INFO_SRC_8812A_2ANT{
+ BT_INFO_SRC_8812A_2ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8812A_2ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8812A_2ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8812A_2ANT_MAX
+}BT_INFO_SRC_8812A_2ANT,*PBT_INFO_SRC_8812A_2ANT;
+
+typedef enum _BT_8812A_2ANT_BT_STATUS{
+ BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8812A_2ANT_BT_STATUS_INQ_PAGE = 0x2,
+ BT_8812A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
+ BT_8812A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
+ BT_8812A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
+ BT_8812A_2ANT_BT_STATUS_MAX
+}BT_8812A_2ANT_BT_STATUS,*PBT_8812A_2ANT_BT_STATUS;
+
+typedef enum _BT_8812A_2ANT_COEX_ALGO{
+ BT_8812A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8812A_2ANT_COEX_ALGO_SCO = 0x1,
+ BT_8812A_2ANT_COEX_ALGO_SCO_HID = 0x2,
+ BT_8812A_2ANT_COEX_ALGO_HID = 0x3,
+ BT_8812A_2ANT_COEX_ALGO_A2DP = 0x4,
+ BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
+ BT_8812A_2ANT_COEX_ALGO_PANEDR = 0x6,
+ BT_8812A_2ANT_COEX_ALGO_PANHS = 0x7,
+ BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
+ BT_8812A_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
+ BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
+ BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS = 0xb,
+ BT_8812A_2ANT_COEX_ALGO_HID_A2DP = 0xc,
+ BT_8812A_2ANT_COEX_ALGO_MAX = 0xd
+}BT_8812A_2ANT_COEX_ALGO,*PBT_8812A_2ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8812A_2ANT{
+ // fw mechanism
+ u1Byte preBtDecPwrLvl;
+ u1Byte curBtDecPwrLvl;
+ u1Byte preFwDacSwingLvl;
+ u1Byte curFwDacSwingLvl;
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ u1Byte psTdmaDuAdjType;
+ BOOLEAN bAutoTdmaAdjust;
+ BOOLEAN bAutoTdmaAdjustLowRssi;
+ BOOLEAN bPrePsTdmaOn;
+ BOOLEAN bCurPsTdmaOn;
+ BOOLEAN bPreBtAutoReport;
+ BOOLEAN bCurBtAutoReport;
+ u1Byte preLps;
+ u1Byte curLps;
+ u1Byte preRpwm;
+ u1Byte curRpwm;
+
+ // 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 backupArfrCnt1; // Auto Rate Fallback Retry cnt
+ u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt
+ u2Byte backupRetryLimit;
+ u1Byte backupAmpduMaxTime;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+
+ u4Byte preRaMask;
+ u4Byte curRaMask;
+ u1Byte curRaMaskType;
+ u1Byte preArfrType;
+ u1Byte curArfrType;
+ u1Byte preRetryLimitType;
+ u1Byte curRetryLimitType;
+ u1Byte preAmpduTimeType;
+ u1Byte curAmpduTimeType;
+} COEX_DM_8812A_2ANT, *PCOEX_DM_8812A_2ANT;
+
+typedef struct _COEX_STA_8812A_2ANT{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bA2dpExist;
+ 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_8812A_2ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8812A_2ANT_MAX];
+ u4Byte btInfoQueryCnt;
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+}COEX_STA_8812A_2ANT, *PCOEX_STA_8812A_2ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8812a2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a2ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a2ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a2ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a2ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a2ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8812a2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8812a2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8812a2ant_DbgControl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte opCode,
+ IN u1Byte opLen,
+ IN pu1Byte pData
+ );
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c
index 8728a47..77934a6 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c
@@ -1,3223 +1,3223 @@
-//============================================================
-// Description:
-//
-// This file is for RTL8821A Co-exist mechanism
-//
-// History
-// 2012/11/15 Cosa first check in.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8821A_1ANT GLCoexDm8821a1Ant;
-static PCOEX_DM_8821A_1ANT pCoexDm=&GLCoexDm8821a1Ant;
-static COEX_STA_8821A_1ANT GLCoexSta8821a1Ant;
-static PCOEX_STA_8821A_1ANT pCoexSta=&GLCoexSta8821a1Ant;
-
-const char *const GLBtInfoSrc8821a1Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-u4Byte GLCoexVerDate8821a1Ant=20130816;
-u4Byte GLCoexVer8821a1Ant=0x41;
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8821a1ant_
-//============================================================
-u1Byte
-halbtc8821a1ant_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_1ANT))
- {
- 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_1ANT))
- {
- 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_1ANT))
- {
- 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
-halbtc8821a1ant_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_1ANT))
- {
- 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_1ANT))
- {
- 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_1ANT))
- {
- 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
-halbtc8821a1ant_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
-halbtc8821a1ant_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
-halbtc8821a1ant_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
-halbtc8821a1ant_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;
- default:
- break;
- }
- }
-
- pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType;
-}
-
-VOID
-halbtc8821a1ant_LimitedTx(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte raMaskType,
- IN u1Byte arfrType,
- IN u1Byte retryLimitType,
- IN u1Byte ampduTimeType
- )
-{
- switch(raMaskType)
- {
- case 0: // normal mode
- halbtc8821a1ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0);
- break;
- case 1: // disable cck 1/2
- halbtc8821a1ant_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
- halbtc8821a1ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0001f1f7);
- break;
- default:
- break;
- }
-
- halbtc8821a1ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType);
- halbtc8821a1ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType);
- halbtc8821a1ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType);
-}
-
-VOID
-halbtc8821a1ant_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
-halbtc8821a1ant_MonitorBtCtr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u4Byte regHPTxRx, regLPTxRx, u4Tmp, u4Tmp1;
- u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0;
- u1Byte u1Tmp, u1Tmp1;
- s4Byte wifiRssi;
-
- 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;
-
- // reset counter
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);
-}
-
-VOID
-halbtc8821a1ant_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);
-}
-
-BOOLEAN
-halbtc8821a1ant_IsWifiStatusChanged(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
- BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
- BOOLEAN bWifiConnected=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
-
- if(bWifiConnected)
- {
- if(bWifiBusy != bPreWifiBusy)
- {
- bPreWifiBusy = bWifiBusy;
- return TRUE;
- }
- if(bUnder4way != bPreUnder4way)
- {
- bPreUnder4way = bUnder4way;
- return TRUE;
- }
- if(bBtHsOn != bPreBtHsOn)
- {
- bPreBtHsOn = bBtHsOn;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-VOID
-halbtc8821a1ant_UpdateBtLinkInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
- pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
- pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
- pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
- pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
-
- // work around for HS mode.
- if(bBtHsOn)
- {
- pBtLinkInfo->bPanExist = TRUE;
- pBtLinkInfo->bBtLinkExist = TRUE;
- }
-
- // check if Sco only
- if( pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bScoOnly = TRUE;
- else
- pBtLinkInfo->bScoOnly = FALSE;
-
- // check if A2dp only
- if( !pBtLinkInfo->bScoExist &&
- pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bA2dpOnly = TRUE;
- else
- pBtLinkInfo->bA2dpOnly = FALSE;
-
- // check if Pan only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- pBtLinkInfo->bPanExist &&
- !pBtLinkInfo->bHidExist )
- pBtLinkInfo->bPanOnly = TRUE;
- else
- pBtLinkInfo->bPanOnly = FALSE;
-
- // check if Hid only
- if( !pBtLinkInfo->bScoExist &&
- !pBtLinkInfo->bA2dpExist &&
- !pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bHidExist )
- pBtLinkInfo->bHidOnly = TRUE;
- else
- pBtLinkInfo->bHidOnly = FALSE;
-}
-
-u1Byte
-halbtc8821a1ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8821A_1ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- if(!pBtLinkInfo->bBtLinkExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
- return algorithm;
- }
-
- if(pBtLinkInfo->bScoExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bHidExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bPanExist)
- numOfDiffProfile++;
- if(pBtLinkInfo->bA2dpExist)
- numOfDiffProfile++;
-
- if(numOfDiffProfile == 1)
- {
- if(pBtLinkInfo->bScoExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO only\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID only\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP only\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_A2DP;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = PAN(HS) only\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = PAN(EDR) only\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile == 2)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if(pBtLinkInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
- }
- else if(pBtLinkInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP ==> SCO\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
- }
- else if(pBtLinkInfo->bPanExist)
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + PAN(HS)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + PAN(EDR)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + PAN(HS)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + PAN(EDR)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP + PAN(HS)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP + PAN(EDR)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP;
- }
- }
- }
- }
- else if(numOfDiffProfile == 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bA2dpExist )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + A2DP ==> HID\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
- }
- else if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + PAN(HS)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- else if( pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP + PAN(HS)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- else
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP + PAN(HS)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- }
- }
- }
- else if(numOfDiffProfile >= 3)
- {
- if(pBtLinkInfo->bScoExist)
- {
- if( pBtLinkInfo->bHidExist &&
- pBtLinkInfo->bPanExist &&
- pBtLinkInfo->bA2dpExist )
- {
- if(bBtHsOn)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! BT Profile = SCO + HID + A2DP + PAN(HS)\n"));
-
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"));
- algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-VOID
-halbtc8821a1ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8821a1ant_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;
- }
- halbtc8821a1ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
-
- pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
-}
-
-VOID
-halbtc8821a1ant_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
-halbtc8821a1ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa;
-
- if(!bForceExec)
- {
- if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa)
- return;
- }
- halbtc8821a1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8821a1ant_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
-halbtc8821a1ant_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)
- {
- if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&
- (pCoexDm->preVal0x6c4 == pCoexDm->curVal0x6c4) &&
- (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
- (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
- return;
- }
- halbtc8821a1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8821a1ant_CoexTableWithType(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte type
- )
-{
- switch(type)
- {
- case 0:
- halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffffff, 0x3);
- break;
- case 1:
- halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 2:
- halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 3:
- halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3);
- break;
- case 4:
- halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffffff, 0x3);
- break;
- case 5:
- halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffffff, 0x3);
- break;
- case 6:
- halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffffff, 0x3);
- break;
- case 7:
- halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5afa5afa, 0x5afa5afa, 0xffffff, 0x3);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8821a1ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8821a1ant_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;
- }
- halbtc8821a1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8821a1ant_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};
-
- H2C_Parameter[0] = byte1;
- H2C_Parameter[1] = byte2;
- H2C_Parameter[2] = byte3;
- H2C_Parameter[3] = byte4;
- H2C_Parameter[4] = byte5;
-
- pCoexDm->psTdmaPara[0] = byte1;
- pCoexDm->psTdmaPara[1] = byte2;
- pCoexDm->psTdmaPara[2] = byte3;
- pCoexDm->psTdmaPara[3] = byte4;
- pCoexDm->psTdmaPara[4] = byte5;
-
- 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
-halbtc8821a1ant_SetLpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- u1Byte lps=lpsVal;
- u1Byte rpwm=rpwmVal;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
-}
-
-VOID
-halbtc8821a1ant_LpsRpwm(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bForceExecPwrCmd=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
- (bForceExec? "force to":""), lpsVal, rpwmVal));
- pCoexDm->curLps = lpsVal;
- pCoexDm->curRpwm = rpwmVal;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], LPS-RxBeaconMode=0x%x , LPS-RPWM=0x%x!!\n",
- pCoexDm->curLps, pCoexDm->curRpwm));
-
- if( (pCoexDm->preLps == pCoexDm->curLps) &&
- (pCoexDm->preRpwm == pCoexDm->curRpwm) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], LPS-RPWM_Last=0x%x , LPS-RPWM_Now=0x%x!!\n",
- pCoexDm->preRpwm, pCoexDm->curRpwm));
-
- return;
- }
- }
- halbtc8821a1ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
-
- pCoexDm->preLps = pCoexDm->curLps;
- pCoexDm->preRpwm = pCoexDm->curRpwm;
-}
-
-VOID
-halbtc8821a1ant_SwMechanism(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bLowPenaltyRA
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], SM[LpRA] = %d \n", bLowPenaltyRA));
-
- halbtc8821a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
-}
-
-VOID
-halbtc8821a1ant_SetAntPath(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte antPosType,
- IN BOOLEAN bInitHwCfg,
- IN BOOLEAN bWifiOff
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- u4Byte fwVer=0, 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->fBtcWrite1ByteBitMask(pBtCoexist, 0x975, 0x3, 0x3);
- 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);
-
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x1); //Main Ant to BT for IPS case 0x4c[23]=1
- }
- 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);
-
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0); //Aux Ant to BT for IPS case 0x4c[23]=1
- }
- }
- else if(bWifiOff)
- {
- // 0x4c[24:23]=00, Set Antenna control by BT_RFE_CTRL BT Vendor 0xac=0xf002
- u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u4Tmp &= ~BIT23;
- u4Tmp &= ~BIT24;
- pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
- }
-
- // ext switch setting
- switch(antPosType)
- {
- case BTC_ANT_PATH_WIFI:
- 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:
- if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT)
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x2);
- else
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x1);
- break;
- default:
- case BTC_ANT_PATH_PTA:
- if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT)
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x1);
- else
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x2);
- break;
- }
-}
-
-VOID
-halbtc8821a1ant_PsTdma(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bTurnOn,
- IN u1Byte type
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- BOOLEAN bTurnOnByCnt=FALSE;
- u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=0;
- u4Byte fwVer=0;
-
- pCoexDm->bCurPsTdmaOn = bTurnOn;
- pCoexDm->curPsTdma = type;
-
- 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;
- }
- if(bTurnOn)
- {
- switch(type)
- {
- default:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1a, 0x1a, 0x0, 0x50);
- break;
- case 1:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x3a, 0x03, 0x10, 0x50);
- rssiAdjustVal = 11;
- break;
- case 2:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x2b, 0x03, 0x10, 0x50);
- rssiAdjustVal = 14;
- break;
- case 3:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1d, 0x1d, 0x0, 0x10);
- break;
- case 4:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
- rssiAdjustVal = 17;
- break;
- case 5:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x11, 0x10);
- break;
- case 6:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x0, 0x0);
- break;
- case 7:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0);
- break;
- case 8:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
- break;
- case 9:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x50);
- rssiAdjustVal = 18;
- break;
- case 10:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40);
- break;
- case 11:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x14, 0x03, 0x10, 0x10);
- rssiAdjustVal = 20;
- break;
- case 12:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x0a, 0x0a, 0x0, 0x50);
- break;
- case 13:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x18, 0x18, 0x0, 0x10);
- break;
- case 14:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x10);
- break;
- case 15:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x8, 0x0);
- break;
- case 16:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x10, 0x0);
- rssiAdjustVal = 18;
- break;
- case 18:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
- rssiAdjustVal = 14;
- break;
- case 20:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x35, 0x03, 0x11, 0x10);
- break;
- case 21:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x03, 0x11, 0x10);
- break;
- case 22:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x10);
- break;
- case 23:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 24:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 25:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 26:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
- rssiAdjustVal = 22;
- break;
- case 27:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x98);
- rssiAdjustVal = 22;
- break;
- case 28:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x69, 0x25, 0x3, 0x31, 0x0);
- break;
- case 29:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10);
- break;
- case 30:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x14, 0x3, 0x10, 0x50);
- break;
- case 31:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58);
- break;
- case 32:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0xa, 0x3, 0x10, 0x0);
- break;
- case 33:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90);
- break;
- case 34:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x53, 0x1a, 0x1a, 0x0, 0x10);
- break;
- case 35:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x63, 0x1a, 0x1a, 0x0, 0x10);
- break;
- case 36:
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x3, 0x14, 0x50);
- break;
- }
- }
- else
- {
- // disable PS tdma
- switch(type)
- {
- case 8: //PTA Control
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
- halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE);
- break;
- case 0:
- default: //Software control, Antenna at BT side
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
- halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
- break;
- case 9: //Software control, Antenna at WiFi side
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
- halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE);
- break;
- case 10: // under 5G
- halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
- halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
- break;
- }
- }
- rssiAdjustVal =0;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal);
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-VOID
-halbtc8821a1ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // sw all off
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-
- // hw all off
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-}
-
-BOOLEAN
-halbtc8821a1ant_IsCommonAction(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
-
- if(!bWifiConnected &&
- BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"));
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"));
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) )
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n"));
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-
- bCommon = TRUE;
- }
- else
- {
- if (bWifiBusy)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n"));
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
- }
-
- bCommon = FALSE;
- }
-
- return bCommon;
-}
-
-
-VOID
-halbtc8821a1ant_TdmaDurationAdjustForAcl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- static s4Byte up,dn,m,n,WaitCount;
- s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
- u1Byte retryCount=0, btInfoExt;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjustForAcl()\n"));
-
- if( (BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
- (BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
- (BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
- {
- if( pCoexDm->curPsTdma != 1 &&
- pCoexDm->curPsTdma != 2 &&
- pCoexDm->curPsTdma != 3 &&
- pCoexDm->curPsTdma != 9 )
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
-
- up = 0;
- dn = 0;
- m = 1;
- n= 3;
- result = 0;
- WaitCount = 0;
- }
- return;
- }
-
- if(!pCoexDm->bAutoTdmaAdjust)
- {
- pCoexDm->bAutoTdmaAdjust = TRUE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
-
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- //============
- 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;
- btInfoExt = pCoexSta->btInfoExt;
- //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"));
- }
-
- if(result == -1)
- {
- if( (BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- else if(result == 1)
- {
- if( (BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
- ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- }
- else //no change
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], ********** TDMA(on, %d) **********\n",
- pCoexDm->curPsTdma));
- }
-
- if( pCoexDm->curPsTdma != 1 &&
- pCoexDm->curPsTdma != 2 &&
- pCoexDm->curPsTdma != 9 &&
- pCoexDm->curPsTdma != 11 )
- {
- // recover to previous adjust type
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
- }
- }
-}
-
-VOID
-halbtc8821a1ant_PsTdmaCheckForPowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bNewPsState
- )
-{
- u1Byte lpsMode=0x0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
-
- if(lpsMode) // already under LPS state
- {
- if(bNewPsState)
- {
- // keep state under LPS, do nothing.
- }
- else
- {
- // will leave LPS state, turn off psTdma first
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- }
- else // NO PS state
- {
- if(bNewPsState)
- {
- // will enter LPS state, turn off psTdma first
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
- }
- else
- {
- // keep state under NO PS state, do nothing.
- }
- }
-}
-
-VOID
-halbtc8821a1ant_PowerSaveState(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte psType,
- IN u1Byte lpsVal,
- IN u1Byte rpwmVal
- )
-{
- BOOLEAN bLowPwrDisable=FALSE;
-
- switch(psType)
- {
- case BTC_PS_WIFI_NATIVE:
- // recover to original 32k low power setting
- bLowPwrDisable = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- break;
- case BTC_PS_LPS_ON:
- halbtc8821a1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
- halbtc8821a1ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
- // when coex force to enter LPS, do not enter 32k low power.
- bLowPwrDisable = TRUE;
- 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);
- break;
- case BTC_PS_LPS_OFF:
- halbtc8821a1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
- break;
- default:
- break;
- }
-}
-
-VOID
-halbtc8821a1ant_CoexUnder5G(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- halbtc8821a1ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, TRUE);
-
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 10);
-
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
-
- halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
-
- halbtc8821a1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 5);
-}
-
-#define WIFI_ONLY_CHECK_UNDER_5G
-#ifdef WIFI_ONLY_CHECK_UNDER_5G
-VOID
-halbtc8821a1ant_ActionWifiOnly(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiUnder5G=FALSE;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G);
-
- if (bWifiUnder5G)
- {
- halbtc8821a1ant_CoexUnder5G(pBtCoexist);
- return;
- }
- else
- {
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
- }
-}
-#else
-VOID
-halbtc8821a1ant_ActionWifiOnly(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
-}
-#endif
-
-VOID
-halbtc8821a1ant_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"));
- halbtc8821a1ant_ActionWifiOnly(pBtCoexist);
- }
- }
- 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
- {
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
- }
- }
-}
-
-//=============================================
-//
-// Software Coex Mechanism start
-//
-//=============================================
-
-// SCO only or SCO+PAN(HS)
-VOID
-halbtc8821a1ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-VOID
-halbtc8821a1ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8821a1ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-VOID
-halbtc8821a1ant_ActionA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-VOID
-halbtc8821a1ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-//PAN(HS) only
-VOID
-halbtc8821a1ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8821a1ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-}
-
-VOID
-halbtc8821a1ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8821a1ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-VOID
-halbtc8821a1ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
-}
-
-//=============================================
-//
-// Non-Software Coex Mechanism start
-//
-//=============================================
-
-VOID
-halbtc8821a1ant_ActionHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, FORCE_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);
-
- if(!bWifiConnected)
- {
- halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else if( (pBtLinkInfo->bScoExist) ||
- (pBtLinkInfo->bHidOnly) )
- {
- // SCO/HID-only busy
- halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else
- {
- halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 30);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
-}
-
-VOID
-halbtc8821a1ant_ActionBtScoHidOnlyBusy(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- // tdma and coex table
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
-
- 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);
-}
-
-VOID
-halbtc8821a1ant_ActionWifiConnectedBtAclBusy(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte wifiStatus
- )
-{
- u1Byte btRssiState;
-
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- btRssiState = halbtc8821a1ant_BtRssiState(2, 28, 0);
-
- if(pBtLinkInfo->bHidOnly) //HID
- {
- halbtc8821a1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- return;
- }
- else if(pBtLinkInfo->bA2dpOnly) //A2DP
- {
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus);
- }
- else //for low BT RSSI
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
-
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- else if(pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) //HID+A2DP
- {
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- else //for low BT RSSI
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
-
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
- 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);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- else if ( ((pBtLinkInfo->bA2dpExist) && (pBtLinkInfo->bPanExist)) ||
- (pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist&&pBtLinkInfo->bPanExist) ) //A2DP+PAN(OPP,FTP), HID+A2DP+PAN(OPP,FTP)
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
- else
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- pCoexDm->bAutoTdmaAdjust = FALSE;
- }
-}
-
-VOID
-halbtc8821a1ant_ActionWifiNotConnected(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // power save state
- halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-
- // tdma and coex table
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_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(
- 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)
- {
- 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);
- }
- }
- 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);
- }
-}
-
-VOID
-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->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);
- }
- }
- else
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
- }
-}
-
-VOID
-halbtc8821a1ant_ActionWifiConnected(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bWifiBusy=FALSE;
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
- BOOLEAN bUnder4way=FALSE;
- u4Byte wifiBw;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n"));
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
- if(bUnder4way)
- {
- halbtc8821a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n"));
- return;
- }
-
- 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)
- {
- halbtc8821a1ant_ActionWifiConnectedScan(pBtCoexist);
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under scan<===\n"));
- return;
- }
-
- // 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);
- 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)
- {
- halbtc8821a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE);
- }
- 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_IDLE);
- }
- else
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- }
- else
- {
- if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
- {
- halbtc8821a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
- BT_8821A_1ANT_WIFI_STATUS_CONNECTED_BUSY);
- }
- 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_BUSY);
- }
- else
- {
- halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
- }
- }
-}
-
-VOID
-halbtc8821a1ant_RunSwCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte algorithm=0;
-
- algorithm = halbtc8821a1ant_ActionAlgorithm(pBtCoexist);
- pCoexDm->curAlgorithm = algorithm;
-
- if(halbtc8821a1ant_IsCommonAction(pBtCoexist))
- {
-
- }
- else
- {
- switch(pCoexDm->curAlgorithm)
- {
- case BT_8821A_1ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n"));
- halbtc8821a1ant_ActionSco(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID.\n"));
- halbtc8821a1ant_ActionHid(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n"));
- halbtc8821a1ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP+PAN(HS).\n"));
- halbtc8821a1ant_ActionA2dpPanHs(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n"));
- halbtc8821a1ant_ActionPanEdr(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HS mode.\n"));
- halbtc8821a1ant_ActionPanHs(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN+A2DP.\n"));
- halbtc8821a1ant_ActionPanEdrA2dp(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_PANEDR_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR)+HID.\n"));
- halbtc8821a1ant_ActionPanEdrHid(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP+PAN.\n"));
- halbtc8821a1ant_ActionHidA2dpPanEdr(pBtCoexist);
- break;
- case BT_8821A_1ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP.\n"));
- halbtc8821a1ant_ActionHidA2dp(pBtCoexist);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n"));
- //halbtc8821a1ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
-}
-
-VOID
-halbtc8821a1ant_RunCoexistMechanism(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
- BOOLEAN bIncreaseScanDevNum=FALSE;
- BOOLEAN bBtCtrlAggBufSize=FALSE;
- u1Byte aggBufSize=5;
- u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
- BOOLEAN bWifiUnder5G=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
-
- if(pBtCoexist->bManualControl)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
- return;
- }
-
- if(pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n"));
- return;
- }
-
- if(pCoexSta->bUnderIps)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
- return;
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G);
- if(bWifiUnder5G)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for 5G <===\n"));
- halbtc8821a1ant_CoexUnder5G(pBtCoexist);
- return;
- }
-
- if( (BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- {
- bIncreaseScanDevNum = TRUE;
- }
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_INC_SCAN_DEV_NUM, &bIncreaseScanDevNum);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- if(!pBtLinkInfo->bScoExist && !pBtLinkInfo->bHidExist)
- {
- halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
- }
- else
- {
- if(bWifiConnected)
- {
- wifiRssiState = halbtc8821a1ant_WifiRssiState(pBtCoexist, 1, 2, 30, 0);
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 1, 1);
- }
- else
- {
- halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 1, 1);
- }
- }
- else
- {
- halbtc8821a1ant_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;
- }
- halbtc8821a1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
-
- halbtc8821a1ant_RunSwCoexistMechanism(pBtCoexist);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8821a1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8821a1ant_ActionHs(pBtCoexist);
- return;
- }
-
-
- if(!bWifiConnected)
- {
- BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n"));
-
- 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)
- halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- else
- halbtc8821a1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else // wifi LPS/Busy
- {
- halbtc8821a1ant_ActionWifiConnected(pBtCoexist);
- }
-}
-
-VOID
-halbtc8821a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
- // sw all off
- halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
-
- halbtc8821a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
- halbtc8821a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-}
-
-VOID
-halbtc8821a1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bBackUp
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- u4Byte u4Tmp=0;
- u2Byte u2Tmp=0;
- u1Byte u1Tmp=0;
- u1Byte H2C_Parameter[2] ={0};
- BOOLEAN bWifiUnder5G=FALSE;
-
-
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
-
- if(bBackUp)
- {
- pCoexDm->backupArfrCnt1 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
- pCoexDm->backupArfrCnt2 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
- pCoexDm->backupRetryLimit = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
- pCoexDm->backupAmpduMaxTime = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
- }
-
- // 0x790[5:0]=0x5
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
- u1Tmp &= 0xc0;
- u1Tmp |= 0x5;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G);
-
- //Antenna config
- if(bWifiUnder5G)
- 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);
-
- // Enable counter statistics
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); //0x76e[3] =1, WLAN_Act control by PTA
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1);
-}
-
-//============================================================
-// work around function start with wa_halbtc8821a1ant_
-//============================================================
-//============================================================
-// extern function start with EXhalbtc8821a1ant_
-//============================================================
-VOID
-EXhalbtc8821a1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a1ant_InitHwConfig(pBtCoexist, TRUE);
-}
-
-VOID
-EXhalbtc8821a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- pBtCoexist->bStopCoexDm = FALSE;
-
- halbtc8821a1ant_InitCoexDm(pBtCoexist);
-
- halbtc8821a1ant_QueryBtInfo(pBtCoexist);
-}
-
-VOID
-EXhalbtc8821a1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- pu1Byte cliBuf=pBtCoexist->cliBuf;
- u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0;
- u2Byte u2Tmp[4];
- 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);
-
- if(pBtCoexist->bManualControl)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- CL_PRINTF(cliBuf);
- }
- if(pBtCoexist->bStopCoexDm)
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============");
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
- 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);
-
- 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_%x/ 0x%x/ 0x%x(%d)", "CoexVer/ FwVer/ PatchVer", \
- GLCoexVerDate8821a1Ant, GLCoexVer8821a1Ant, 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 / HsChnl(HsMode)", \
- wifiDot11Chnl, wifiHsChnl, bBtHsOn);
- 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]", \
- ((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")))),
- pCoexSta->btRssi, pCoexSta->btRetryCnt);
- CL_PRINTF(cliBuf);
-
- 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);
- 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; i<BT_INFO_SRC_8821A_1ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8821a1Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
- ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
- ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
- pBtCoexist->btInfo.lpsVal,
- pBtCoexist->btInfo.rpwmVal);
- CL_PRINTF(cliBuf);
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
-
- if(!pBtCoexist->bManualControl)
- {
- // 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", "SM[LowPenaltyRA]", \
- pCoexDm->bCurLowPenaltyRa);
- CL_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s/ %d ", "DelBA/ BtCtrlAgg/ AggSize", \
- (pBtCoexist->btInfo.bRejectAggPkt? "Yes":"No"), (pBtCoexist->btInfo.bBtCtrlAggBufSize? "Yes":"No"),
- pBtCoexist->btInfo.aggBufSize);
- CL_PRINTF(cliBuf);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
- pBtCoexist->btInfo.raMask);
- CL_PRINTF(cliBuf);
-
- // Fw mechanism
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
- CL_PRINTF(cliBuf);
-
- psTdmaCase = pCoexDm->curPsTdma;
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
- pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
- pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
- 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);
- }
-
- // 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/0x%x/0x%x/0x%x", "backup ARFR1/ARFR2/RL/AMaxTime", \
- pCoexDm->backupArfrCnt1, pCoexDm->backupArfrCnt2, pCoexDm->backupRetryLimit, pCoexDm->backupAmpduMaxTime);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
- u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
- u2Tmp[0] = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "0x430/0x434/0x42a/0x456", \
- u4Tmp[0], u4Tmp[1], u2Tmp[0], u1Tmp[0]);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc58);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x778/ 0xc58[29:25]", \
- u1Tmp[0], (u4Tmp[0]&0x3e000000) >> 25);
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x8db);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x8db[6:5]", \
- ((u1Tmp[0]&0x60)>>5));
- CL_PRINTF(cliBuf);
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x975);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xcb4);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0xcb4[29:28]/0xcb4[7:0]/0x974[9:8]", \
- (u4Tmp[0]&0x30000000)>>28, u4Tmp[0]&0xff, u1Tmp[0]& 0x3);
- CL_PRINTF(cliBuf);
-
-
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
- u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x64);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x40/0x4c[24:23]/0x64[0]", \
- u1Tmp[0], ((u4Tmp[0]&0x01800000)>>23), u1Tmp[1]&0x1);
- 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);
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
- u4Tmp[0]&0xff);
- CL_PRINTF(cliBuf);
-
- u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xf48);
- u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5d);
- 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);
- 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_PRINTF(cliBuf);
-
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(high-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);
-#if(BT_AUTO_REPORT_ONLY_8821A_1ANT == 1)
- halbtc8821a1ant_MonitorBtCtr(pBtCoexist);
-#endif
- pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-
-VOID
-EXhalbtc8821a1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u4Byte u4Tmp=0;
-
- if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
- return;
-
- if(BTC_IPS_ENTER == type)
- {
- 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_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- pCoexSta->bUnderIps = FALSE;
-
- halbtc8821a1ant_RunCoexistMechanism(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8821a1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
- return;
-
- 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
-EXhalbtc8821a1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
-
- halbtc8821a1ant_QueryBtInfo(pBtCoexist);
-
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8821a1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8821a1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if(BTC_SCAN_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- }
- else // wifi is connected
- {
- halbtc8821a1ant_ActionWifiConnectedScan(pBtCoexist);
- }
- }
- else if(BTC_SCAN_FINISH == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
- if(!bWifiConnected) // non-connected scan
- {
- halbtc8821a1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8821a1ant_ActionWifiConnected(pBtCoexist);
- }
- }
-}
-
-VOID
-EXhalbtc8821a1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8821a1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8821a1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if(BTC_ASSOCIATE_START == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
- halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
- }
- else if(BTC_ASSOCIATE_FINISH == type)
- {
- 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
- {
- halbtc8821a1ant_ActionWifiNotConnected(pBtCoexist);
- }
- else
- {
- halbtc8821a1ant_ActionWifiConnected(pBtCoexist);
- }
- }
-}
-
-VOID
-EXhalbtc8821a1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- u1Byte H2C_Parameter[3] ={0};
- u4Byte wifiBw;
- u1Byte wifiCentralChnl;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- 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[0] = 0x0;
- 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;
- }
-
- 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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
-}
-
-VOID
-EXhalbtc8821a1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- )
-{
- BOOLEAN bBtHsOn=FALSE;
-
- if(pBtCoexist->bManualControl ||
- pBtCoexist->bStopCoexDm ||
- pBtCoexist->btInfo.bBtDisabled )
- return;
-
- pCoexSta->specialPktPeriodCnt = 0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- if(pCoexSta->bC2hBtInquiryPage)
- {
- halbtc8821a1ant_ActionBtInquiry(pBtCoexist);
- return;
- }
- else if(bBtHsOn)
- {
- halbtc8821a1ant_ActionHs(pBtCoexist);
- return;
- }
-
- if( BTC_PACKET_DHCP == type ||
- BTC_PACKET_EAPOL == type )
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type));
- halbtc8821a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8821a1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
- u1Byte btInfo=0;
- u1Byte i, rspSource=0;
- BOOLEAN bWifiConnected=FALSE;
- BOOLEAN bBtBusy=FALSE;
- BOOLEAN 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_1ANT_MAX)
- rspSource = BT_INFO_SRC_8821A_1ANT_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; i<length; i++)
- {
- 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]));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
- }
- }
-
- if(BT_INFO_SRC_8821A_1ANT_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];
-
- // Here we need to resend some wifi info to BT
- // because bt is reset and loss of the info.
- if(pCoexSta->btInfoExt & BIT1)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- EXhalbtc8821a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- EXhalbtc8821a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
- }
-
- if( (pCoexSta->btInfoExt & BIT3) && !bWifiUnder5G)
- {
- if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
- halbtc8821a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
- }
- }
- else
- {
- // BT already NOT ignore Wlan active, do nothing here.
- }
-#if(BT_AUTO_REPORT_ONLY_8821A_1ANT == 0)
- if( (pCoexSta->btInfoExt & BIT4) )
- {
- // BT auto report already enabled, do nothing
- }
- 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
- }
-
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8821A_1ANT_B_INQ_PAGE)
- pCoexSta->bC2hBtInquiryPage = TRUE;
- else
- pCoexSta->bC2hBtInquiryPage = FALSE;
-
- // set link exist status
- if(!(btInfo&BT_INFO_8821A_1ANT_B_CONNECTION))
- {
- pCoexSta->bBtLinkExist = FALSE;
- pCoexSta->bPanExist = FALSE;
- pCoexSta->bA2dpExist = FALSE;
- pCoexSta->bHidExist = FALSE;
- pCoexSta->bScoExist = FALSE;
- }
- else // connection exists
- {
- pCoexSta->bBtLinkExist = TRUE;
- if(btInfo & BT_INFO_8821A_1ANT_B_FTP)
- pCoexSta->bPanExist = TRUE;
- else
- pCoexSta->bPanExist = FALSE;
- if(btInfo & BT_INFO_8821A_1ANT_B_A2DP)
- pCoexSta->bA2dpExist = TRUE;
- else
- pCoexSta->bA2dpExist = FALSE;
- if(btInfo & BT_INFO_8821A_1ANT_B_HID)
- pCoexSta->bHidExist = TRUE;
- else
- pCoexSta->bHidExist = FALSE;
- if(btInfo & BT_INFO_8821A_1ANT_B_SCO_ESCO)
- pCoexSta->bScoExist = TRUE;
- else
- pCoexSta->bScoExist = FALSE;
- }
-
- halbtc8821a1ant_UpdateBtLinkInfo(pBtCoexist);
-
- if(!(btInfo&BT_INFO_8821A_1ANT_B_CONNECTION))
- {
- pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
- }
- else if(btInfo == BT_INFO_8821A_1ANT_B_CONNECTION) // connection exists but no busy
- {
- pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
- }
- else if((btInfo&BT_INFO_8821A_1ANT_B_SCO_ESCO) ||
- (btInfo&BT_INFO_8821A_1ANT_B_SCO_BUSY))
- {
- pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_SCO_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
- }
- else if(btInfo&BT_INFO_8821A_1ANT_B_ACL_BUSY)
- {
- if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
- pCoexDm->bAutoTdmaAdjust = FALSE;
- pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_ACL_BUSY;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
- }
- else
- {
- pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_MAX;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
- }
-
- if( (BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
- bBtBusy = TRUE;
- else
- bBtBusy = FALSE;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
-
- halbtc8821a1ant_RunCoexistMechanism(pBtCoexist);
-}
-
-VOID
-EXhalbtc8821a1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u4Byte u4Tmp;
-
- 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);
-
- EXhalbtc8821a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8821a1ant_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"));
- 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);
- }
- 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_InitCoexDm(pBtCoexist);
- halbtc8821a1ant_QueryBtInfo(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8821a1ant_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", \
- GLCoexVerDate8821a1Ant, GLCoexVer8821a1Ant, fwVer, btPatchVer, btPatchVer));
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
- }
-
-#if(BT_AUTO_REPORT_ONLY_8821A_1ANT == 0)
- halbtc8821a1ant_QueryBtInfo(pBtCoexist);
- halbtc8821a1ant_MonitorBtCtr(pBtCoexist);
- halbtc8821a1ant_MonitorBtEnableDisable(pBtCoexist);
-#else
- if( halbtc8821a1ant_IsWifiStatusChanged(pBtCoexist) ||
- pCoexDm->bAutoTdmaAdjust )
- {
- if(pCoexSta->specialPktPeriodCnt > 2)
- {
- halbtc8821a1ant_RunCoexistMechanism(pBtCoexist);
- }
- }
-
- pCoexSta->specialPktPeriodCnt++;
-#endif
-}
-
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for RTL8821A Co-exist mechanism
+//
+// History
+// 2012/11/15 Cosa first check in.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8821A_1ANT GLCoexDm8821a1Ant;
+static PCOEX_DM_8821A_1ANT pCoexDm=&GLCoexDm8821a1Ant;
+static COEX_STA_8821A_1ANT GLCoexSta8821a1Ant;
+static PCOEX_STA_8821A_1ANT pCoexSta=&GLCoexSta8821a1Ant;
+
+const char *const GLBtInfoSrc8821a1Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+u4Byte GLCoexVerDate8821a1Ant=20130816;
+u4Byte GLCoexVer8821a1Ant=0x41;
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8821a1ant_
+//============================================================
+u1Byte
+halbtc8821a1ant_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_1ANT))
+ {
+ 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_1ANT))
+ {
+ 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_1ANT))
+ {
+ 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
+halbtc8821a1ant_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_1ANT))
+ {
+ 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_1ANT))
+ {
+ 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_1ANT))
+ {
+ 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
+halbtc8821a1ant_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
+halbtc8821a1ant_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
+halbtc8821a1ant_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
+halbtc8821a1ant_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;
+ default:
+ break;
+ }
+ }
+
+ pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType;
+}
+
+VOID
+halbtc8821a1ant_LimitedTx(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte raMaskType,
+ IN u1Byte arfrType,
+ IN u1Byte retryLimitType,
+ IN u1Byte ampduTimeType
+ )
+{
+ switch(raMaskType)
+ {
+ case 0: // normal mode
+ halbtc8821a1ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0);
+ break;
+ case 1: // disable cck 1/2
+ halbtc8821a1ant_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
+ halbtc8821a1ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0001f1f7);
+ break;
+ default:
+ break;
+ }
+
+ halbtc8821a1ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType);
+ halbtc8821a1ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType);
+ halbtc8821a1ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType);
+}
+
+VOID
+halbtc8821a1ant_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
+halbtc8821a1ant_MonitorBtCtr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u4Byte regHPTxRx, regLPTxRx, u4Tmp, u4Tmp1;
+ u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0;
+ u1Byte u1Tmp, u1Tmp1;
+ s4Byte wifiRssi;
+
+ 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;
+
+ // reset counter
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);
+}
+
+VOID
+halbtc8821a1ant_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);
+}
+
+BOOLEAN
+halbtc8821a1ant_IsWifiStatusChanged(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;
+ BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;
+ BOOLEAN bWifiConnected=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+
+ if(bWifiConnected)
+ {
+ if(bWifiBusy != bPreWifiBusy)
+ {
+ bPreWifiBusy = bWifiBusy;
+ return TRUE;
+ }
+ if(bUnder4way != bPreUnder4way)
+ {
+ bPreUnder4way = bUnder4way;
+ return TRUE;
+ }
+ if(bBtHsOn != bPreBtHsOn)
+ {
+ bPreBtHsOn = bBtHsOn;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+VOID
+halbtc8821a1ant_UpdateBtLinkInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ pBtLinkInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+ pBtLinkInfo->bScoExist = pCoexSta->bScoExist;
+ pBtLinkInfo->bA2dpExist = pCoexSta->bA2dpExist;
+ pBtLinkInfo->bPanExist = pCoexSta->bPanExist;
+ pBtLinkInfo->bHidExist = pCoexSta->bHidExist;
+
+ // work around for HS mode.
+ if(bBtHsOn)
+ {
+ pBtLinkInfo->bPanExist = TRUE;
+ pBtLinkInfo->bBtLinkExist = TRUE;
+ }
+
+ // check if Sco only
+ if( pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bScoOnly = TRUE;
+ else
+ pBtLinkInfo->bScoOnly = FALSE;
+
+ // check if A2dp only
+ if( !pBtLinkInfo->bScoExist &&
+ pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bA2dpOnly = TRUE;
+ else
+ pBtLinkInfo->bA2dpOnly = FALSE;
+
+ // check if Pan only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ pBtLinkInfo->bPanExist &&
+ !pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bPanOnly = TRUE;
+ else
+ pBtLinkInfo->bPanOnly = FALSE;
+
+ // check if Hid only
+ if( !pBtLinkInfo->bScoExist &&
+ !pBtLinkInfo->bA2dpExist &&
+ !pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bHidExist )
+ pBtLinkInfo->bHidOnly = TRUE;
+ else
+ pBtLinkInfo->bHidOnly = FALSE;
+}
+
+u1Byte
+halbtc8821a1ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8821A_1ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ if(!pBtLinkInfo->bBtLinkExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));
+ return algorithm;
+ }
+
+ if(pBtLinkInfo->bScoExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bHidExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bPanExist)
+ numOfDiffProfile++;
+ if(pBtLinkInfo->bA2dpExist)
+ numOfDiffProfile++;
+
+ if(numOfDiffProfile == 1)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO only\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID only\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP only\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_A2DP;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = PAN(HS) only\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = PAN(EDR) only\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 2)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if(pBtLinkInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
+ }
+ else if(pBtLinkInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
+ }
+ else if(pBtLinkInfo->bPanExist)
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + PAN(HS)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + PAN(EDR)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + PAN(HS)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + PAN(EDR)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP + PAN(HS)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = A2DP + PAN(EDR)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile == 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + A2DP ==> HID\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
+ }
+ else if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + PAN(HS)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ else if( pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP + PAN(HS)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ else
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP + PAN(HS)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ }
+ }
+ }
+ else if(numOfDiffProfile >= 3)
+ {
+ if(pBtLinkInfo->bScoExist)
+ {
+ if( pBtLinkInfo->bHidExist &&
+ pBtLinkInfo->bPanExist &&
+ pBtLinkInfo->bA2dpExist )
+ {
+ if(bBtHsOn)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! BT Profile = SCO + HID + A2DP + PAN(HS)\n"));
+
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT Profile = SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"));
+ algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+VOID
+halbtc8821a1ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8821a1ant_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;
+ }
+ halbtc8821a1ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
+
+ pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
+}
+
+VOID
+halbtc8821a1ant_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
+halbtc8821a1ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa;
+
+ if(!bForceExec)
+ {
+ if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa)
+ return;
+ }
+ halbtc8821a1ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8821a1ant_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
+halbtc8821a1ant_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)
+ {
+ if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&
+ (pCoexDm->preVal0x6c4 == pCoexDm->curVal0x6c4) &&
+ (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
+ (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
+ return;
+ }
+ halbtc8821a1ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8821a1ant_CoexTableWithType(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte type
+ )
+{
+ switch(type)
+ {
+ case 0:
+ halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffffff, 0x3);
+ break;
+ case 1:
+ halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 2:
+ halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 3:
+ halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3);
+ break;
+ case 4:
+ halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffffff, 0x3);
+ break;
+ case 5:
+ halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffffff, 0x3);
+ break;
+ case 6:
+ halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffffff, 0x3);
+ break;
+ case 7:
+ halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5afa5afa, 0x5afa5afa, 0xffffff, 0x3);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8821a1ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8821a1ant_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;
+ }
+ halbtc8821a1ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8821a1ant_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};
+
+ H2C_Parameter[0] = byte1;
+ H2C_Parameter[1] = byte2;
+ H2C_Parameter[2] = byte3;
+ H2C_Parameter[3] = byte4;
+ H2C_Parameter[4] = byte5;
+
+ pCoexDm->psTdmaPara[0] = byte1;
+ pCoexDm->psTdmaPara[1] = byte2;
+ pCoexDm->psTdmaPara[2] = byte3;
+ pCoexDm->psTdmaPara[3] = byte4;
+ pCoexDm->psTdmaPara[4] = byte5;
+
+ 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
+halbtc8821a1ant_SetLpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ u1Byte lps=lpsVal;
+ u1Byte rpwm=rpwmVal;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
+}
+
+VOID
+halbtc8821a1ant_LpsRpwm(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bForceExecPwrCmd=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n",
+ (bForceExec? "force to":""), lpsVal, rpwmVal));
+ pCoexDm->curLps = lpsVal;
+ pCoexDm->curRpwm = rpwmVal;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], LPS-RxBeaconMode=0x%x , LPS-RPWM=0x%x!!\n",
+ pCoexDm->curLps, pCoexDm->curRpwm));
+
+ if( (pCoexDm->preLps == pCoexDm->curLps) &&
+ (pCoexDm->preRpwm == pCoexDm->curRpwm) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], LPS-RPWM_Last=0x%x , LPS-RPWM_Now=0x%x!!\n",
+ pCoexDm->preRpwm, pCoexDm->curRpwm));
+
+ return;
+ }
+ }
+ halbtc8821a1ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);
+
+ pCoexDm->preLps = pCoexDm->curLps;
+ pCoexDm->preRpwm = pCoexDm->curRpwm;
+}
+
+VOID
+halbtc8821a1ant_SwMechanism(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bLowPenaltyRA
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], SM[LpRA] = %d \n", bLowPenaltyRA));
+
+ halbtc8821a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
+}
+
+VOID
+halbtc8821a1ant_SetAntPath(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte antPosType,
+ IN BOOLEAN bInitHwCfg,
+ IN BOOLEAN bWifiOff
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ u4Byte fwVer=0, 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->fBtcWrite1ByteBitMask(pBtCoexist, 0x975, 0x3, 0x3);
+ 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);
+
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x1); //Main Ant to BT for IPS case 0x4c[23]=1
+ }
+ 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);
+
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0); //Aux Ant to BT for IPS case 0x4c[23]=1
+ }
+ }
+ else if(bWifiOff)
+ {
+ // 0x4c[24:23]=00, Set Antenna control by BT_RFE_CTRL BT Vendor 0xac=0xf002
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u4Tmp &= ~BIT23;
+ u4Tmp &= ~BIT24;
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp);
+ }
+
+ // ext switch setting
+ switch(antPosType)
+ {
+ case BTC_ANT_PATH_WIFI:
+ 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:
+ if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT)
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x2);
+ else
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x1);
+ break;
+ default:
+ case BTC_ANT_PATH_PTA:
+ if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT)
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x1);
+ else
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x2);
+ break;
+ }
+}
+
+VOID
+halbtc8821a1ant_PsTdma(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bTurnOn,
+ IN u1Byte type
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ BOOLEAN bTurnOnByCnt=FALSE;
+ u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=0;
+ u4Byte fwVer=0;
+
+ pCoexDm->bCurPsTdmaOn = bTurnOn;
+ pCoexDm->curPsTdma = type;
+
+ 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;
+ }
+ if(bTurnOn)
+ {
+ switch(type)
+ {
+ default:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1a, 0x1a, 0x0, 0x50);
+ break;
+ case 1:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x3a, 0x03, 0x10, 0x50);
+ rssiAdjustVal = 11;
+ break;
+ case 2:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x2b, 0x03, 0x10, 0x50);
+ rssiAdjustVal = 14;
+ break;
+ case 3:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1d, 0x1d, 0x0, 0x10);
+ break;
+ case 4:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0);
+ rssiAdjustVal = 17;
+ break;
+ case 5:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x11, 0x10);
+ break;
+ case 6:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x0, 0x0);
+ break;
+ case 7:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0);
+ break;
+ case 8:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
+ break;
+ case 9:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x50);
+ rssiAdjustVal = 18;
+ break;
+ case 10:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40);
+ break;
+ case 11:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x14, 0x03, 0x10, 0x10);
+ rssiAdjustVal = 20;
+ break;
+ case 12:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x0a, 0x0a, 0x0, 0x50);
+ break;
+ case 13:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x18, 0x18, 0x0, 0x10);
+ break;
+ case 14:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x10);
+ break;
+ case 15:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x8, 0x0);
+ break;
+ case 16:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x10, 0x0);
+ rssiAdjustVal = 18;
+ break;
+ case 18:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0);
+ rssiAdjustVal = 14;
+ break;
+ case 20:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x35, 0x03, 0x11, 0x10);
+ break;
+ case 21:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x03, 0x11, 0x10);
+ break;
+ case 22:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x10);
+ break;
+ case 23:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 24:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 25:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 26:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18);
+ rssiAdjustVal = 22;
+ break;
+ case 27:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x98);
+ rssiAdjustVal = 22;
+ break;
+ case 28:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x69, 0x25, 0x3, 0x31, 0x0);
+ break;
+ case 29:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10);
+ break;
+ case 30:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x14, 0x3, 0x10, 0x50);
+ break;
+ case 31:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58);
+ break;
+ case 32:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0xa, 0x3, 0x10, 0x0);
+ break;
+ case 33:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90);
+ break;
+ case 34:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x53, 0x1a, 0x1a, 0x0, 0x10);
+ break;
+ case 35:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x63, 0x1a, 0x1a, 0x0, 0x10);
+ break;
+ case 36:
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x3, 0x14, 0x50);
+ break;
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(type)
+ {
+ case 8: //PTA Control
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0);
+ halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE);
+ break;
+ case 0:
+ default: //Software control, Antenna at BT side
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
+ halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
+ break;
+ case 9: //Software control, Antenna at WiFi side
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
+ halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE);
+ break;
+ case 10: // under 5G
+ halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
+ halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE);
+ break;
+ }
+ }
+ rssiAdjustVal =0;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal);
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+VOID
+halbtc8821a1ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // sw all off
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+
+ // hw all off
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+}
+
+BOOLEAN
+halbtc8821a1ant_IsCommonAction(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
+
+ if(!bWifiConnected &&
+ BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"));
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"));
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) )
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n"));
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+
+ bCommon = TRUE;
+ }
+ else
+ {
+ if (bWifiBusy)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n"));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));
+ }
+
+ bCommon = FALSE;
+ }
+
+ return bCommon;
+}
+
+
+VOID
+halbtc8821a1ant_TdmaDurationAdjustForAcl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ static s4Byte up,dn,m,n,WaitCount;
+ s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
+ u1Byte retryCount=0, btInfoExt;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjustForAcl()\n"));
+
+ if( (BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
+ (BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
+ (BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )
+ {
+ if( pCoexDm->curPsTdma != 1 &&
+ pCoexDm->curPsTdma != 2 &&
+ pCoexDm->curPsTdma != 3 &&
+ pCoexDm->curPsTdma != 9 )
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+
+ up = 0;
+ dn = 0;
+ m = 1;
+ n= 3;
+ result = 0;
+ WaitCount = 0;
+ }
+ return;
+ }
+
+ if(!pCoexDm->bAutoTdmaAdjust)
+ {
+ pCoexDm->bAutoTdmaAdjust = TRUE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
+
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ //============
+ 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;
+ btInfoExt = pCoexSta->btInfoExt;
+ //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"));
+ }
+
+ if(result == -1)
+ {
+ if( (BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ else if(result == 1)
+ {
+ if( (BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(btInfoExt)) &&
+ ((pCoexDm->curPsTdma == 1) ||(pCoexDm->curPsTdma == 2)) )
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ }
+ else //no change
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], ********** TDMA(on, %d) **********\n",
+ pCoexDm->curPsTdma));
+ }
+
+ if( pCoexDm->curPsTdma != 1 &&
+ pCoexDm->curPsTdma != 2 &&
+ pCoexDm->curPsTdma != 9 &&
+ pCoexDm->curPsTdma != 11 )
+ {
+ // recover to previous adjust type
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
+ }
+ }
+}
+
+VOID
+halbtc8821a1ant_PsTdmaCheckForPowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bNewPsState
+ )
+{
+ u1Byte lpsMode=0x0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);
+
+ if(lpsMode) // already under LPS state
+ {
+ if(bNewPsState)
+ {
+ // keep state under LPS, do nothing.
+ }
+ else
+ {
+ // will leave LPS state, turn off psTdma first
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ }
+ else // NO PS state
+ {
+ if(bNewPsState)
+ {
+ // will enter LPS state, turn off psTdma first
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
+ }
+ else
+ {
+ // keep state under NO PS state, do nothing.
+ }
+ }
+}
+
+VOID
+halbtc8821a1ant_PowerSaveState(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte psType,
+ IN u1Byte lpsVal,
+ IN u1Byte rpwmVal
+ )
+{
+ BOOLEAN bLowPwrDisable=FALSE;
+
+ switch(psType)
+ {
+ case BTC_PS_WIFI_NATIVE:
+ // recover to original 32k low power setting
+ bLowPwrDisable = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ break;
+ case BTC_PS_LPS_ON:
+ halbtc8821a1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);
+ halbtc8821a1ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal);
+ // when coex force to enter LPS, do not enter 32k low power.
+ bLowPwrDisable = TRUE;
+ 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);
+ break;
+ case BTC_PS_LPS_OFF:
+ halbtc8821a1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+VOID
+halbtc8821a1ant_CoexUnder5G(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ halbtc8821a1ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, TRUE);
+
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 10);
+
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+
+ halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+
+ halbtc8821a1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 5);
+}
+
+#define WIFI_ONLY_CHECK_UNDER_5G
+#ifdef WIFI_ONLY_CHECK_UNDER_5G
+VOID
+halbtc8821a1ant_ActionWifiOnly(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiUnder5G=FALSE;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G);
+
+ if (bWifiUnder5G)
+ {
+ halbtc8821a1ant_CoexUnder5G(pBtCoexist);
+ return;
+ }
+ else
+ {
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+ }
+}
+#else
+VOID
+halbtc8821a1ant_ActionWifiOnly(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9);
+}
+#endif
+
+VOID
+halbtc8821a1ant_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"));
+ halbtc8821a1ant_ActionWifiOnly(pBtCoexist);
+ }
+ }
+ 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
+ {
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
+ }
+ }
+}
+
+//=============================================
+//
+// Software Coex Mechanism start
+//
+//=============================================
+
+// SCO only or SCO+PAN(HS)
+VOID
+halbtc8821a1ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+VOID
+halbtc8821a1ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8821a1ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+VOID
+halbtc8821a1ant_ActionA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+VOID
+halbtc8821a1ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+//PAN(HS) only
+VOID
+halbtc8821a1ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8821a1ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+}
+
+VOID
+halbtc8821a1ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8821a1ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+VOID
+halbtc8821a1ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_SwMechanism(pBtCoexist, TRUE);
+}
+
+//=============================================
+//
+// Non-Software Coex Mechanism start
+//
+//=============================================
+
+VOID
+halbtc8821a1ant_ActionHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, FORCE_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);
+
+ if(!bWifiConnected)
+ {
+ halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else if( (pBtLinkInfo->bScoExist) ||
+ (pBtLinkInfo->bHidOnly) )
+ {
+ // SCO/HID-only busy
+ halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else
+ {
+ halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 30);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+}
+
+VOID
+halbtc8821a1ant_ActionBtScoHidOnlyBusy(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ // tdma and coex table
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+
+ 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);
+}
+
+VOID
+halbtc8821a1ant_ActionWifiConnectedBtAclBusy(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte wifiStatus
+ )
+{
+ u1Byte btRssiState;
+
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ btRssiState = halbtc8821a1ant_BtRssiState(2, 28, 0);
+
+ if(pBtLinkInfo->bHidOnly) //HID
+ {
+ halbtc8821a1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ return;
+ }
+ else if(pBtLinkInfo->bA2dpOnly) //A2DP
+ {
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus);
+ }
+ else //for low BT RSSI
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ else if(pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) //HID+A2DP
+ {
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ else //for low BT RSSI
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+ 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);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ else if ( ((pBtLinkInfo->bA2dpExist) && (pBtLinkInfo->bPanExist)) ||
+ (pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist&&pBtLinkInfo->bPanExist) ) //A2DP+PAN(OPP,FTP), HID+A2DP+PAN(OPP,FTP)
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+ else
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ }
+}
+
+VOID
+halbtc8821a1ant_ActionWifiNotConnected(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // power save state
+ halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+
+ // tdma and coex table
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_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(
+ 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)
+ {
+ 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);
+ }
+ }
+ 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);
+ }
+}
+
+VOID
+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->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);
+ }
+ }
+ else
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);
+ }
+}
+
+VOID
+halbtc8821a1ant_ActionWifiConnected(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bWifiBusy=FALSE;
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+ BOOLEAN bUnder4way=FALSE;
+ u4Byte wifiBw;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n"));
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way);
+ if(bUnder4way)
+ {
+ halbtc8821a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n"));
+ return;
+ }
+
+ 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)
+ {
+ halbtc8821a1ant_ActionWifiConnectedScan(pBtCoexist);
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under scan<===\n"));
+ return;
+ }
+
+ // 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);
+ 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)
+ {
+ halbtc8821a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE);
+ }
+ 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_IDLE);
+ }
+ else
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ }
+ else
+ {
+ if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus)
+ {
+ halbtc8821a1ant_ActionWifiConnectedBtAclBusy(pBtCoexist,
+ BT_8821A_1ANT_WIFI_STATUS_CONNECTED_BUSY);
+ }
+ 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_BUSY);
+ }
+ else
+ {
+ halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
+ }
+ }
+}
+
+VOID
+halbtc8821a1ant_RunSwCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte algorithm=0;
+
+ algorithm = halbtc8821a1ant_ActionAlgorithm(pBtCoexist);
+ pCoexDm->curAlgorithm = algorithm;
+
+ if(halbtc8821a1ant_IsCommonAction(pBtCoexist))
+ {
+
+ }
+ else
+ {
+ switch(pCoexDm->curAlgorithm)
+ {
+ case BT_8821A_1ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n"));
+ halbtc8821a1ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID.\n"));
+ halbtc8821a1ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n"));
+ halbtc8821a1ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP+PAN(HS).\n"));
+ halbtc8821a1ant_ActionA2dpPanHs(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n"));
+ halbtc8821a1ant_ActionPanEdr(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HS mode.\n"));
+ halbtc8821a1ant_ActionPanHs(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN+A2DP.\n"));
+ halbtc8821a1ant_ActionPanEdrA2dp(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_PANEDR_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR)+HID.\n"));
+ halbtc8821a1ant_ActionPanEdrHid(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP+PAN.\n"));
+ halbtc8821a1ant_ActionHidA2dpPanEdr(pBtCoexist);
+ break;
+ case BT_8821A_1ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP.\n"));
+ halbtc8821a1ant_ActionHidA2dp(pBtCoexist);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n"));
+ //halbtc8821a1ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+}
+
+VOID
+halbtc8821a1ant_RunCoexistMechanism(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+ BOOLEAN bIncreaseScanDevNum=FALSE;
+ BOOLEAN bBtCtrlAggBufSize=FALSE;
+ u1Byte aggBufSize=5;
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;
+ BOOLEAN bWifiUnder5G=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));
+
+ if(pBtCoexist->bManualControl)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));
+ return;
+ }
+
+ if(pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n"));
+ return;
+ }
+
+ if(pCoexSta->bUnderIps)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));
+ return;
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G);
+ if(bWifiUnder5G)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for 5G <===\n"));
+ halbtc8821a1ant_CoexUnder5G(pBtCoexist);
+ return;
+ }
+
+ if( (BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ {
+ bIncreaseScanDevNum = TRUE;
+ }
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_INC_SCAN_DEV_NUM, &bIncreaseScanDevNum);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ if(!pBtLinkInfo->bScoExist && !pBtLinkInfo->bHidExist)
+ {
+ halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
+ }
+ else
+ {
+ if(bWifiConnected)
+ {
+ wifiRssiState = halbtc8821a1ant_WifiRssiState(pBtCoexist, 1, 2, 30, 0);
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 1, 1);
+ }
+ else
+ {
+ halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 1, 1);
+ }
+ }
+ else
+ {
+ halbtc8821a1ant_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;
+ }
+ halbtc8821a1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize);
+
+ halbtc8821a1ant_RunSwCoexistMechanism(pBtCoexist);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8821a1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8821a1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+
+ if(!bWifiConnected)
+ {
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n"));
+
+ 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)
+ halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ else
+ halbtc8821a1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else // wifi LPS/Busy
+ {
+ halbtc8821a1ant_ActionWifiConnected(pBtCoexist);
+ }
+}
+
+VOID
+halbtc8821a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+ // sw all off
+ halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE);
+
+ halbtc8821a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8);
+ halbtc8821a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
+}
+
+VOID
+halbtc8821a1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bBackUp
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ u4Byte u4Tmp=0;
+ u2Byte u2Tmp=0;
+ u1Byte u1Tmp=0;
+ u1Byte H2C_Parameter[2] ={0};
+ BOOLEAN bWifiUnder5G=FALSE;
+
+
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n"));
+
+ if(bBackUp)
+ {
+ pCoexDm->backupArfrCnt1 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
+ pCoexDm->backupArfrCnt2 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
+ pCoexDm->backupRetryLimit = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
+ pCoexDm->backupAmpduMaxTime = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
+ }
+
+ // 0x790[5:0]=0x5
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
+ u1Tmp &= 0xc0;
+ u1Tmp |= 0x5;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G);
+
+ //Antenna config
+ if(bWifiUnder5G)
+ 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);
+
+ // Enable counter statistics
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); //0x76e[3] =1, WLAN_Act control by PTA
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1);
+}
+
+//============================================================
+// work around function start with wa_halbtc8821a1ant_
+//============================================================
+//============================================================
+// extern function start with EXhalbtc8821a1ant_
+//============================================================
+VOID
+EXhalbtc8821a1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a1ant_InitHwConfig(pBtCoexist, TRUE);
+}
+
+VOID
+EXhalbtc8821a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ pBtCoexist->bStopCoexDm = FALSE;
+
+ halbtc8821a1ant_InitCoexDm(pBtCoexist);
+
+ halbtc8821a1ant_QueryBtInfo(pBtCoexist);
+}
+
+VOID
+EXhalbtc8821a1ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ pu1Byte cliBuf=pBtCoexist->cliBuf;
+ u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0;
+ u2Byte u2Tmp[4];
+ 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);
+
+ if(pBtCoexist->bManualControl)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ CL_PRINTF(cliBuf);
+ }
+ if(pBtCoexist->bStopCoexDm)
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============");
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ==========================================");
+ 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);
+
+ 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_%x/ 0x%x/ 0x%x(%d)", "CoexVer/ FwVer/ PatchVer", \
+ GLCoexVerDate8821a1Ant, GLCoexVer8821a1Ant, 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 / HsChnl(HsMode)", \
+ wifiDot11Chnl, wifiHsChnl, bBtHsOn);
+ 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]", \
+ ((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")))),
+ pCoexSta->btRssi, pCoexSta->btRetryCnt);
+ CL_PRINTF(cliBuf);
+
+ 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);
+ 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; i<BT_INFO_SRC_8821A_1ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8821a1Ant[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, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \
+ ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")),
+ ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF")),
+ pBtCoexist->btInfo.lpsVal,
+ pBtCoexist->btInfo.rpwmVal);
+ CL_PRINTF(cliBuf);
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
+
+ if(!pBtCoexist->bManualControl)
+ {
+ // 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", "SM[LowPenaltyRA]", \
+ pCoexDm->bCurLowPenaltyRa);
+ CL_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s/ %d ", "DelBA/ BtCtrlAgg/ AggSize", \
+ (pBtCoexist->btInfo.bRejectAggPkt? "Yes":"No"), (pBtCoexist->btInfo.bBtCtrlAggBufSize? "Yes":"No"),
+ pBtCoexist->btInfo.aggBufSize);
+ CL_PRINTF(cliBuf);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Rate Mask", \
+ pBtCoexist->btInfo.raMask);
+ CL_PRINTF(cliBuf);
+
+ // Fw mechanism
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
+ CL_PRINTF(cliBuf);
+
+ psTdmaCase = pCoexDm->curPsTdma;
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \
+ pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
+ pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
+ 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);
+ }
+
+ // 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/0x%x/0x%x/0x%x", "backup ARFR1/ARFR2/RL/AMaxTime", \
+ pCoexDm->backupArfrCnt1, pCoexDm->backupArfrCnt2, pCoexDm->backupRetryLimit, pCoexDm->backupAmpduMaxTime);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430);
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434);
+ u2Tmp[0] = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a);
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x", "0x430/0x434/0x42a/0x456", \
+ u4Tmp[0], u4Tmp[1], u2Tmp[0], u1Tmp[0]);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc58);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x778/ 0xc58[29:25]", \
+ u1Tmp[0], (u4Tmp[0]&0x3e000000) >> 25);
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x8db);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x8db[6:5]", \
+ ((u1Tmp[0]&0x60)>>5));
+ CL_PRINTF(cliBuf);
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x975);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xcb4);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0xcb4[29:28]/0xcb4[7:0]/0x974[9:8]", \
+ (u4Tmp[0]&0x30000000)>>28, u4Tmp[0]&0xff, u1Tmp[0]& 0x3);
+ CL_PRINTF(cliBuf);
+
+
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c);
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x64);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x40/0x4c[24:23]/0x64[0]", \
+ u1Tmp[0], ((u4Tmp[0]&0x01800000)>>23), u1Tmp[1]&0x1);
+ 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);
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
+ u4Tmp[0]&0xff);
+ CL_PRINTF(cliBuf);
+
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xf48);
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5d);
+ 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);
+ 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_PRINTF(cliBuf);
+
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(high-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);
+#if(BT_AUTO_REPORT_ONLY_8821A_1ANT == 1)
+ halbtc8821a1ant_MonitorBtCtr(pBtCoexist);
+#endif
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
+}
+
+
+VOID
+EXhalbtc8821a1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u4Byte u4Tmp=0;
+
+ if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
+ return;
+
+ if(BTC_IPS_ENTER == type)
+ {
+ 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_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ pCoexSta->bUnderIps = FALSE;
+
+ halbtc8821a1ant_RunCoexistMechanism(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8821a1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
+ return;
+
+ 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
+EXhalbtc8821a1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+
+ halbtc8821a1ant_QueryBtInfo(pBtCoexist);
+
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8821a1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8821a1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if(BTC_SCAN_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ }
+ else // wifi is connected
+ {
+ halbtc8821a1ant_ActionWifiConnectedScan(pBtCoexist);
+ }
+ }
+ else if(BTC_SCAN_FINISH == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));
+ if(!bWifiConnected) // non-connected scan
+ {
+ halbtc8821a1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8821a1ant_ActionWifiConnected(pBtCoexist);
+ }
+ }
+}
+
+VOID
+EXhalbtc8821a1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8821a1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8821a1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if(BTC_ASSOCIATE_START == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));
+ halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist);
+ }
+ else if(BTC_ASSOCIATE_FINISH == type)
+ {
+ 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
+ {
+ halbtc8821a1ant_ActionWifiNotConnected(pBtCoexist);
+ }
+ else
+ {
+ halbtc8821a1ant_ActionWifiConnected(pBtCoexist);
+ }
+ }
+}
+
+VOID
+EXhalbtc8821a1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ u1Byte H2C_Parameter[3] ={0};
+ u4Byte wifiBw;
+ u1Byte wifiCentralChnl;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ 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[0] = 0x0;
+ 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;
+ }
+
+ 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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
+}
+
+VOID
+EXhalbtc8821a1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ )
+{
+ BOOLEAN bBtHsOn=FALSE;
+
+ if(pBtCoexist->bManualControl ||
+ pBtCoexist->bStopCoexDm ||
+ pBtCoexist->btInfo.bBtDisabled )
+ return;
+
+ pCoexSta->specialPktPeriodCnt = 0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ if(pCoexSta->bC2hBtInquiryPage)
+ {
+ halbtc8821a1ant_ActionBtInquiry(pBtCoexist);
+ return;
+ }
+ else if(bBtHsOn)
+ {
+ halbtc8821a1ant_ActionHs(pBtCoexist);
+ return;
+ }
+
+ if( BTC_PACKET_DHCP == type ||
+ BTC_PACKET_EAPOL == type )
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type));
+ halbtc8821a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8821a1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo;
+ u1Byte btInfo=0;
+ u1Byte i, rspSource=0;
+ BOOLEAN bWifiConnected=FALSE;
+ BOOLEAN bBtBusy=FALSE;
+ BOOLEAN 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_1ANT_MAX)
+ rspSource = BT_INFO_SRC_8821A_1ANT_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; i<length; i++)
+ {
+ 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]));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
+ }
+ }
+
+ if(BT_INFO_SRC_8821A_1ANT_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];
+
+ // Here we need to resend some wifi info to BT
+ // because bt is reset and loss of the info.
+ if(pCoexSta->btInfoExt & BIT1)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ EXhalbtc8821a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ EXhalbtc8821a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+ }
+
+ if( (pCoexSta->btInfoExt & BIT3) && !bWifiUnder5G)
+ {
+ if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));
+ halbtc8821a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+ }
+ }
+ else
+ {
+ // BT already NOT ignore Wlan active, do nothing here.
+ }
+#if(BT_AUTO_REPORT_ONLY_8821A_1ANT == 0)
+ if( (pCoexSta->btInfoExt & BIT4) )
+ {
+ // BT auto report already enabled, do nothing
+ }
+ 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
+ }
+
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8821A_1ANT_B_INQ_PAGE)
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ else
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+
+ // set link exist status
+ if(!(btInfo&BT_INFO_8821A_1ANT_B_CONNECTION))
+ {
+ pCoexSta->bBtLinkExist = FALSE;
+ pCoexSta->bPanExist = FALSE;
+ pCoexSta->bA2dpExist = FALSE;
+ pCoexSta->bHidExist = FALSE;
+ pCoexSta->bScoExist = FALSE;
+ }
+ else // connection exists
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ if(btInfo & BT_INFO_8821A_1ANT_B_FTP)
+ pCoexSta->bPanExist = TRUE;
+ else
+ pCoexSta->bPanExist = FALSE;
+ if(btInfo & BT_INFO_8821A_1ANT_B_A2DP)
+ pCoexSta->bA2dpExist = TRUE;
+ else
+ pCoexSta->bA2dpExist = FALSE;
+ if(btInfo & BT_INFO_8821A_1ANT_B_HID)
+ pCoexSta->bHidExist = TRUE;
+ else
+ pCoexSta->bHidExist = FALSE;
+ if(btInfo & BT_INFO_8821A_1ANT_B_SCO_ESCO)
+ pCoexSta->bScoExist = TRUE;
+ else
+ pCoexSta->bScoExist = FALSE;
+ }
+
+ halbtc8821a1ant_UpdateBtLinkInfo(pBtCoexist);
+
+ if(!(btInfo&BT_INFO_8821A_1ANT_B_CONNECTION))
+ {
+ pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));
+ }
+ else if(btInfo == BT_INFO_8821A_1ANT_B_CONNECTION) // connection exists but no busy
+ {
+ pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));
+ }
+ else if((btInfo&BT_INFO_8821A_1ANT_B_SCO_ESCO) ||
+ (btInfo&BT_INFO_8821A_1ANT_B_SCO_BUSY))
+ {
+ pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_SCO_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));
+ }
+ else if(btInfo&BT_INFO_8821A_1ANT_B_ACL_BUSY)
+ {
+ if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
+ pCoexDm->bAutoTdmaAdjust = FALSE;
+ pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_ACL_BUSY;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));
+ }
+ else
+ {
+ pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_MAX;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));
+ }
+
+ if( (BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
+ (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
+ (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) )
+ bBtBusy = TRUE;
+ else
+ bBtBusy = FALSE;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
+
+ halbtc8821a1ant_RunCoexistMechanism(pBtCoexist);
+}
+
+VOID
+EXhalbtc8821a1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u4Byte u4Tmp;
+
+ 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);
+
+ EXhalbtc8821a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8821a1ant_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"));
+ 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);
+ }
+ 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_InitCoexDm(pBtCoexist);
+ halbtc8821a1ant_QueryBtInfo(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8821a1ant_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", \
+ GLCoexVerDate8821a1Ant, GLCoexVer8821a1Ant, fwVer, btPatchVer, btPatchVer));
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
+ }
+
+#if(BT_AUTO_REPORT_ONLY_8821A_1ANT == 0)
+ halbtc8821a1ant_QueryBtInfo(pBtCoexist);
+ halbtc8821a1ant_MonitorBtCtr(pBtCoexist);
+ halbtc8821a1ant_MonitorBtEnableDisable(pBtCoexist);
+#else
+ if( halbtc8821a1ant_IsWifiStatusChanged(pBtCoexist) ||
+ pCoexDm->bAutoTdmaAdjust )
+ {
+ if(pCoexSta->specialPktPeriodCnt > 2)
+ {
+ halbtc8821a1ant_RunCoexistMechanism(pBtCoexist);
+ }
+ }
+
+ pCoexSta->specialPktPeriodCnt++;
+#endif
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h
index a9656ab..aa0caa4 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h
@@ -1,210 +1,210 @@
-//===========================================
-// The following is for 8821A 1ANT BT Co-exist definition
-//===========================================
-#define BT_AUTO_REPORT_ONLY_8821A_1ANT 0
-
-#define BT_INFO_8821A_1ANT_B_FTP BIT7
-#define BT_INFO_8821A_1ANT_B_A2DP BIT6
-#define BT_INFO_8821A_1ANT_B_HID BIT5
-#define BT_INFO_8821A_1ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8821A_1ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8821A_1ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8821A_1ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8821A_1ANT_B_CONNECTION BIT0
-
-#define BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
- (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
-
-#define BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT 2
-
-typedef enum _BT_INFO_SRC_8821A_1ANT{
- BT_INFO_SRC_8821A_1ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8821A_1ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8821A_1ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8821A_1ANT_MAX
-}BT_INFO_SRC_8821A_1ANT,*PBT_INFO_SRC_8821A_1ANT;
-
-typedef enum _BT_8821A_1ANT_BT_STATUS{
- BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8821A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
- BT_8821A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
- BT_8821A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
- BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
- BT_8821A_1ANT_BT_STATUS_MAX
-}BT_8821A_1ANT_BT_STATUS,*PBT_8821A_1ANT_BT_STATUS;
-
-typedef enum _BT_8821A_1ANT_WIFI_STATUS{
- BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
- BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
- BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
- BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
- BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
- BT_8821A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
- BT_8821A_1ANT_WIFI_STATUS_MAX
-}BT_8821A_1ANT_WIFI_STATUS,*PBT_8821A_1ANT_WIFI_STATUS;
-
-typedef enum _BT_8821A_1ANT_COEX_ALGO{
- BT_8821A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8821A_1ANT_COEX_ALGO_SCO = 0x1,
- BT_8821A_1ANT_COEX_ALGO_HID = 0x2,
- BT_8821A_1ANT_COEX_ALGO_A2DP = 0x3,
- BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
- BT_8821A_1ANT_COEX_ALGO_PANEDR = 0x5,
- BT_8821A_1ANT_COEX_ALGO_PANHS = 0x6,
- BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
- BT_8821A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
- BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
- BT_8821A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
- BT_8821A_1ANT_COEX_ALGO_MAX = 0xb,
-}BT_8821A_1ANT_COEX_ALGO,*PBT_8821A_1ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8821A_1ANT{
- // fw mechanism
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- u1Byte psTdmaDuAdjType;
- BOOLEAN bAutoTdmaAdjust;
- BOOLEAN bPrePsTdmaOn;
- BOOLEAN bCurPsTdmaOn;
- BOOLEAN bPreBtAutoReport;
- BOOLEAN bCurBtAutoReport;
- u1Byte preLps;
- u1Byte curLps;
- u1Byte preRpwm;
- u1Byte curRpwm;
-
- // sw mechanism
- BOOLEAN bPreLowPenaltyRa;
- BOOLEAN bCurLowPenaltyRa;
- u4Byte preVal0x6c0;
- u4Byte curVal0x6c0;
- u4Byte preVal0x6c4;
- u4Byte curVal0x6c4;
- u4Byte preVal0x6c8;
- u4Byte curVal0x6c8;
- u1Byte preVal0x6cc;
- u1Byte curVal0x6cc;
-
- u4Byte backupArfrCnt1; // Auto Rate Fallback Retry cnt
- u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt
- u2Byte backupRetryLimit;
- u1Byte backupAmpduMaxTime;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-
- u4Byte preRaMask;
- u4Byte curRaMask;
- u1Byte preArfrType;
- u1Byte curArfrType;
- u1Byte preRetryLimitType;
- u1Byte curRetryLimitType;
- u1Byte preAmpduTimeType;
- u1Byte curAmpduTimeType;
-
- u1Byte errorCondition;
-} COEX_DM_8821A_1ANT, *PCOEX_DM_8821A_1ANT;
-
-typedef struct _COEX_STA_8821A_1ANT{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bA2dpExist;
- BOOLEAN bHidExist;
- BOOLEAN bPanExist;
-
- BOOLEAN bUnderLps;
- BOOLEAN bUnderIps;
- u4Byte specialPktPeriodCnt;
- u4Byte highPriorityTx;
- u4Byte highPriorityRx;
- u4Byte lowPriorityTx;
- u4Byte lowPriorityRx;
- u1Byte btRssi;
- 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;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
-}COEX_STA_8821A_1ANT, *PCOEX_STA_8821A_1ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8821a1ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a1ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a1ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a1ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a1ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a1ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a1ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a1ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a1ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8821a1ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a1ant_PnpNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte pnpState
- );
-VOID
-EXhalbtc8821a1ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a1ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a1ant_DbgControl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte opCode,
- IN u1Byte opLen,
- IN pu1Byte pData
- );
+//===========================================
+// The following is for 8821A 1ANT BT Co-exist definition
+//===========================================
+#define BT_AUTO_REPORT_ONLY_8821A_1ANT 0
+
+#define BT_INFO_8821A_1ANT_B_FTP BIT7
+#define BT_INFO_8821A_1ANT_B_A2DP BIT6
+#define BT_INFO_8821A_1ANT_B_HID BIT5
+#define BT_INFO_8821A_1ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8821A_1ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8821A_1ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8821A_1ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8821A_1ANT_B_CONNECTION BIT0
+
+#define BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
+ (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
+
+#define BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT 2
+
+typedef enum _BT_INFO_SRC_8821A_1ANT{
+ BT_INFO_SRC_8821A_1ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8821A_1ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8821A_1ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8821A_1ANT_MAX
+}BT_INFO_SRC_8821A_1ANT,*PBT_INFO_SRC_8821A_1ANT;
+
+typedef enum _BT_8821A_1ANT_BT_STATUS{
+ BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8821A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
+ BT_8821A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
+ BT_8821A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
+ BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
+ BT_8821A_1ANT_BT_STATUS_MAX
+}BT_8821A_1ANT_BT_STATUS,*PBT_8821A_1ANT_BT_STATUS;
+
+typedef enum _BT_8821A_1ANT_WIFI_STATUS{
+ BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
+ BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
+ BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
+ BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
+ BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
+ BT_8821A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
+ BT_8821A_1ANT_WIFI_STATUS_MAX
+}BT_8821A_1ANT_WIFI_STATUS,*PBT_8821A_1ANT_WIFI_STATUS;
+
+typedef enum _BT_8821A_1ANT_COEX_ALGO{
+ BT_8821A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8821A_1ANT_COEX_ALGO_SCO = 0x1,
+ BT_8821A_1ANT_COEX_ALGO_HID = 0x2,
+ BT_8821A_1ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
+ BT_8821A_1ANT_COEX_ALGO_PANEDR = 0x5,
+ BT_8821A_1ANT_COEX_ALGO_PANHS = 0x6,
+ BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
+ BT_8821A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
+ BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
+ BT_8821A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
+ BT_8821A_1ANT_COEX_ALGO_MAX = 0xb,
+}BT_8821A_1ANT_COEX_ALGO,*PBT_8821A_1ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8821A_1ANT{
+ // fw mechanism
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ u1Byte psTdmaDuAdjType;
+ BOOLEAN bAutoTdmaAdjust;
+ BOOLEAN bPrePsTdmaOn;
+ BOOLEAN bCurPsTdmaOn;
+ BOOLEAN bPreBtAutoReport;
+ BOOLEAN bCurBtAutoReport;
+ u1Byte preLps;
+ u1Byte curLps;
+ u1Byte preRpwm;
+ u1Byte curRpwm;
+
+ // sw mechanism
+ BOOLEAN bPreLowPenaltyRa;
+ BOOLEAN bCurLowPenaltyRa;
+ u4Byte preVal0x6c0;
+ u4Byte curVal0x6c0;
+ u4Byte preVal0x6c4;
+ u4Byte curVal0x6c4;
+ u4Byte preVal0x6c8;
+ u4Byte curVal0x6c8;
+ u1Byte preVal0x6cc;
+ u1Byte curVal0x6cc;
+
+ u4Byte backupArfrCnt1; // Auto Rate Fallback Retry cnt
+ u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt
+ u2Byte backupRetryLimit;
+ u1Byte backupAmpduMaxTime;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+
+ u4Byte preRaMask;
+ u4Byte curRaMask;
+ u1Byte preArfrType;
+ u1Byte curArfrType;
+ u1Byte preRetryLimitType;
+ u1Byte curRetryLimitType;
+ u1Byte preAmpduTimeType;
+ u1Byte curAmpduTimeType;
+
+ u1Byte errorCondition;
+} COEX_DM_8821A_1ANT, *PCOEX_DM_8821A_1ANT;
+
+typedef struct _COEX_STA_8821A_1ANT{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bA2dpExist;
+ BOOLEAN bHidExist;
+ BOOLEAN bPanExist;
+
+ BOOLEAN bUnderLps;
+ BOOLEAN bUnderIps;
+ u4Byte specialPktPeriodCnt;
+ u4Byte highPriorityTx;
+ u4Byte highPriorityRx;
+ u4Byte lowPriorityTx;
+ u4Byte lowPriorityRx;
+ u1Byte btRssi;
+ 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;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+}COEX_STA_8821A_1ANT, *PCOEX_STA_8821A_1ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8821a1ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8821a1ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8821a1ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a1ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a1ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a1ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a1ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a1ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a1ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8821a1ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8821a1ant_PnpNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte pnpState
+ );
+VOID
+EXhalbtc8821a1ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+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/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c
index 0d51379..a76b7ac 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c
@@ -1,4222 +1,4222 @@
-//============================================================
-// Description:
-//
-// This file is for RTL8821A Co-exist mechanism
-//
-// History
-// 2012/08/22 Cosa first check in.
-// 2012/11/14 Cosa Revise for 8821A 2Ant out sourcing.
-//
-//============================================================
-
-//============================================================
-// include files
-//============================================================
-#include "Mp_Precomp.h"
-#if(BT_30_SUPPORT == 1)
-//============================================================
-// Global variables, these are static variables
-//============================================================
-static COEX_DM_8821A_2ANT GLCoexDm8821a2Ant;
-static PCOEX_DM_8821A_2ANT pCoexDm=&GLCoexDm8821a2Ant;
-static COEX_STA_8821A_2ANT GLCoexSta8821a2Ant;
-static PCOEX_STA_8821A_2ANT pCoexSta=&GLCoexSta8821a2Ant;
-
-const char *const GLBtInfoSrc8821a2Ant[]={
- "BT Info[wifi fw]",
- "BT Info[bt rsp]",
- "BT Info[bt auto report]",
-};
-
-u4Byte GLCoexVerDate8821a2Ant=20130618;
-u4Byte GLCoexVer8821a2Ant=0x5050;
-
-//============================================================
-// local function proto type if needed
-//============================================================
-//============================================================
-// local function start with halbtc8821a2ant_
-//============================================================
-u1Byte
-halbtc8821a2ant_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_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_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_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
-halbtc8821a2ant_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_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_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_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
-halbtc8821a2ant_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
-halbtc8821a2ant_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, 0xc);
-}
-
-VOID
-halbtc8821a2ant_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);
-}
-u1Byte
-halbtc8821a2ant_ActionAlgorithm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
- BOOLEAN bBtHsOn=FALSE;
- u1Byte algorithm=BT_8821A_2ANT_COEX_ALGO_UNDEFINED;
- u1Byte numOfDiffProfile=0;
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
-
- //for win-8 stack HID report error
- if(!pStackInfo->bHidExist)
- pStackInfo->bHidExist = pCoexSta->bHidExist; //sync BTInfo with BT firmware and stack
- // when stack HID report error, here we use the info from bt fw.
- if(!pStackInfo->bBtLinkExist)
- pStackInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
-
- 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_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- if(pStackInfo->bHidExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
- algorithm = BT_8821A_2ANT_COEX_ALGO_HID;
- }
- else if(pStackInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else if(pStackInfo->bA2dpExist)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_SCO;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_A2DP_PANHS;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
- algorithm = BT_8821A_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_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_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_PANEDR_HID;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_HID_A2DP;
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
- algorithm = BT_8821A_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_2ANT_COEX_ALGO_PANEDR_HID;
- }
- }
- }
- }
-
- return algorithm;
-}
-
-BOOLEAN
-halbtc8821a2ant_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 = halbtc8821a2ant_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
-halbtc8821a2ant_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
-halbtc8821a2ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8821a2ant_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;
- }
- halbtc8821a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr);
-
- pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr;
-}
-
-VOID
-halbtc8821a2ant_SetFwBtLnaConstrain(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bBtLnaConsOn
- )
-{
- u1Byte H2C_Parameter[2] ={0};
-
- H2C_Parameter[0] = 0x3; // opCode, 0x3=BT_SET_LNA_CONSTRAIN
-
- if(bBtLnaConsOn)
- {
- H2C_Parameter[1] |= BIT0;
- }
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set BT LNA Constrain: %s, FW write 0x69=0x%x\n",
- (bBtLnaConsOn? "ON!!":"OFF!!"),
- H2C_Parameter[0]<<8|H2C_Parameter[1]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x69, 2, H2C_Parameter);
-}
-
-VOID
-halbtc8821a2ant_SetBtLnaConstrain(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bBtLnaConsOn
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT Constrain = %s\n",
- (bForceExec? "force":""), ((bBtLnaConsOn)? "ON":"OFF")));
- pCoexDm->bCurBtLnaConstrain = bBtLnaConsOn;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBtLnaConstrain=%d, bCurBtLnaConstrain=%d\n",
- pCoexDm->bPreBtLnaConstrain, pCoexDm->bCurBtLnaConstrain));
-
- if(pCoexDm->bPreBtLnaConstrain == pCoexDm->bCurBtLnaConstrain)
- return;
- }
- halbtc8821a2ant_SetFwBtLnaConstrain(pBtCoexist, pCoexDm->bCurBtLnaConstrain);
-
- pCoexDm->bPreBtLnaConstrain = pCoexDm->bCurBtLnaConstrain;
-}
-
-VOID
-halbtc8821a2ant_SetFwBtPsdMode(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte btPsdMode
- )
-{
- u1Byte H2C_Parameter[2] ={0};
-
- H2C_Parameter[0] = 0x2; // opCode, 0x2=BT_SET_PSD_MODE
-
- H2C_Parameter[1] = btPsdMode;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set BT PSD mode=0x%x, FW write 0x69=0x%x\n",
- H2C_Parameter[1],
- H2C_Parameter[0]<<8|H2C_Parameter[1]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x69, 2, H2C_Parameter);
-}
-
-
-VOID
-halbtc8821a2ant_SetBtPsdMode(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN u1Byte btPsdMode
- )
-{
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT PSD mode = 0x%x\n",
- (bForceExec? "force":""), btPsdMode));
- pCoexDm->bCurBtPsdMode = btPsdMode;
-
- if(!bForceExec)
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBtPsdMode=0x%x, bCurBtPsdMode=0x%x\n",
- pCoexDm->bPreBtPsdMode, pCoexDm->bCurBtPsdMode));
-
- if(pCoexDm->bPreBtPsdMode == pCoexDm->bCurBtPsdMode)
- return;
- }
- halbtc8821a2ant_SetFwBtPsdMode(pBtCoexist, pCoexDm->bCurBtPsdMode);
-
- pCoexDm->bPreBtPsdMode = pCoexDm->bCurBtPsdMode;
-}
-
-
-VOID
-halbtc8821a2ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8821a2ant_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;
- }
- halbtc8821a2ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
-
- pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
-}
-
-VOID
-halbtc8821a2ant_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;
- }
-
- halbtc8821a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
-
- pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
-}
-
-VOID
-halbtc8821a2ant_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
-halbtc8821a2ant_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;
- }
- halbtc8821a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
-
- pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
-}
-
-VOID
-halbtc8821a2ant_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
-halbtc8821a2ant_LowPenaltyRa(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bForceExec,
- IN BOOLEAN bLowPenaltyRa
- )
-{
- //return;
- 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;
- }
- halbtc8821a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
-
- pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
-}
-
-VOID
-halbtc8821a2ant_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
-halbtc8821a2ant_SetSwFullTimeDacSwing(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bSwDacSwingOn,
- IN u4Byte swDacSwingLvl
- )
-{
- if(bSwDacSwingOn)
- {
- halbtc8821a2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
- }
- else
- {
- halbtc8821a2ant_SetDacSwingReg(pBtCoexist, 0x18);
- }
-}
-
-
-VOID
-halbtc8821a2ant_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);
- halbtc8821a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
-
- pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
- pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
-}
-
-VOID
-halbtc8821a2ant_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
-halbtc8821a2ant_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;
- }
- halbtc8821a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
-
- pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
-}
-
-VOID
-halbtc8821a2ant_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
-halbtc8821a2ant_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;
- }
- halbtc8821a2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
-
- pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
-}
-
-VOID
-halbtc8821a2ant_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
-halbtc8821a2ant_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;
- }
- halbtc8821a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
-
- pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
- pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
- pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
- pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
-}
-
-VOID
-halbtc8821a2ant_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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
-}
-
-VOID
-halbtc8821a2ant_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;
- }
- halbtc8821a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
-
- pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
-}
-
-VOID
-halbtc8821a2ant_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};
-
- H2C_Parameter[0] = byte1;
- H2C_Parameter[1] = byte2;
- H2C_Parameter[2] = byte3;
- H2C_Parameter[3] = byte4;
- H2C_Parameter[4] = byte5;
-
- pCoexDm->psTdmaPara[0] = byte1;
- pCoexDm->psTdmaPara[1] = byte2;
- pCoexDm->psTdmaPara[2] = byte3;
- pCoexDm->psTdmaPara[3] = byte4;
- pCoexDm->psTdmaPara[4] = byte5;
-
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
-halbtc8821a2ant_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;
- }
-
- halbtc8821a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF);
- halbtc8821a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
-
- //no limited DIG
- //halbtc8821a2ant_SetBtLnaConstrain(pBtCoexist, NORMAL_EXEC, bBTLNAConstrain);
-}
-
-VOID
-halbtc8821a2ant_SwMechanism2(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN bAGCTableShift,
- IN BOOLEAN bADCBackOff,
- IN BOOLEAN bSWDACSwing,
- IN u4Byte dacSwingLvl
- )
-{
- //halbtc8821a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift);
- halbtc8821a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff);
- halbtc8821a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl);
-}
-
-VOID
-halbtc8821a2ant_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
-halbtc8821a2ant_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:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
- case 2:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
- break;
- case 3:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90);
- break;
- case 4:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xf1, 0x90);
- break;
- case 5:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
- break;
- case 6:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
- break;
- case 7:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90);
- break;
- case 8:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90);
- break;
- case 9:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
- case 10:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
- break;
- case 11:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x90);
- break;
- case 12:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
- break;
- case 13:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
- break;
- case 14:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
- break;
- case 15:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x90);
- break;
- case 16:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x90);
- break;
- case 17:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x90);
- break;
- case 18:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
- break;
- case 19:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90);
- break;
- case 20:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);
- break;
- case 21:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);
- break;
- case 71:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
- break;
- }
- }
- else
- {
- // disable PS tdma
- switch(type)
- {
- case 0:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0);
- break;
- case 1:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x48, 0x0);
- break;
- default:
- halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0);
- break;
- }
- }
-
- // update pre state
- pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
- pCoexDm->prePsTdma = pCoexDm->curPsTdma;
-}
-
-VOID
-halbtc8821a2ant_CoexAllOff(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // fw all off
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- // sw all off
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- // hw all off
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3);
-}
-
-VOID
-halbtc8821a2ant_CoexUnder5G(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- halbtc8821a2ant_CoexAllOff(pBtCoexist);
-}
-
-VOID
-halbtc8821a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- // force to reset coex mechanism
- halbtc8821a2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3);
-
- halbtc8821a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
- halbtc8821a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE);
-
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-}
-
-VOID
-halbtc8821a2ant_BtInquiryPage(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BOOLEAN bLowPwrDisable=TRUE;
-
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
-
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3);
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
-}
-BOOLEAN
-halbtc8821a2ant_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);
-
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3);
-
- if(!bWifiConnected &&
- BT_8821A_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"));
-
-
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8821A_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"));
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi LPS + BT IPS!!\n"));
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
-
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8821A_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"));
-
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else if(bWifiConnected &&
- (BT_8821A_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"));
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
- else
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi LPS + BT LPS!!\n"));
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
-
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,TRUE,TRUE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- bCommon = TRUE;
- }
- else if(!bWifiConnected &&
- (BT_8821A_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"));
-
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
-
- 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"));
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21);
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
-
- bCommon = TRUE;
- }
-
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,TRUE,TRUE);
- }
-
- return bCommon;
-}
-VOID
-halbtc8821a2ant_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)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(maxInterval == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(maxInterval == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(maxInterval == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(maxInterval == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- }
- }
- else
- {
- if(bTxPause)
- {
- if(maxInterval == 1)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(maxInterval == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(maxInterval == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- }
- else
- {
- if(maxInterval == 1)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(maxInterval == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(maxInterval == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else
- {
- halbtc8821a2ant_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)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- pCoexDm->psTdmaDuAdjType = 13;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- pCoexDm->psTdmaDuAdjType = 5;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_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)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
- pCoexDm->psTdmaDuAdjType = 71;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- pCoexDm->psTdmaDuAdjType = 9;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
-
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 71)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- pCoexDm->psTdmaDuAdjType = 1;
- }
- else if(pCoexDm->curPsTdma == 1)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
- pCoexDm->psTdmaDuAdjType = 71;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_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)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
- pCoexDm->psTdmaDuAdjType = 6;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- pCoexDm->psTdmaDuAdjType = 14;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_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)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
- pCoexDm->psTdmaDuAdjType = 2;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- pCoexDm->psTdmaDuAdjType = 10;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_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)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 4)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- if(pCoexDm->curPsTdma == 9)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 5)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
- pCoexDm->psTdmaDuAdjType = 8;
- }
- else if(pCoexDm->curPsTdma == 13)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
- pCoexDm->psTdmaDuAdjType = 16;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 8)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
- pCoexDm->psTdmaDuAdjType = 7;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
- pCoexDm->psTdmaDuAdjType = 15;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_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)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 6)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 7)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 8)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- if(pCoexDm->curPsTdma == 13)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 14)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 15)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 16)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- if(result == -1)
- {
- if(pCoexDm->curPsTdma == 1)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
- pCoexDm->psTdmaDuAdjType = 4;
- }
- else if(pCoexDm->curPsTdma == 9)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
- pCoexDm->psTdmaDuAdjType = 12;
- }
- }
- else if (result == 1)
- {
- if(pCoexDm->curPsTdma == 4)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 3)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 2)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
- pCoexDm->psTdmaDuAdjType = 3;
- }
- else if(pCoexDm->curPsTdma == 12)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 11)
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
- pCoexDm->psTdmaDuAdjType = 11;
- }
- else if(pCoexDm->curPsTdma == 10)
- {
- halbtc8821a2ant_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)
- {
- halbtc8821a2ant_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 halbtc8821a2ant_TdmaDurationAdjust() is called, fw dac swing is included in the function.
- //if(pCoexDm->psTdmaDuAdjType == 71)
- // halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xc); //Skip because A2DP get worse at HT40
- //else
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x6);
-}
-
-// SCO only or SCO+PAN(HS)
-VOID
-halbtc8821a2ant_ActionSco(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState,btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 4);
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3);
- }
- else //for SCO quality & wifi performance balance at 11n mode
- {
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3);
- }
-
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
-
- // fw mechanism
- //halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- // fw mechanism
- //halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-
-VOID
-halbtc8821a2ant_ActionHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
- }
- else //for HID quality & wifi performance balance at 11n mode
- {
- halbtc8821a2ant_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) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- // fw mechanism
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
-VOID
-halbtc8821a2ant_ActionA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- //fw dac swing is called in halbtc8821a2ant_TdmaDurationAdjust()
- //halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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) )
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
- }
- else
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- // fw mechanism
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
- }
- else
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8821a2ant_ActionA2dpPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2,35, 0);
-
- //fw dac swing is called in halbtc8821a2ant_TdmaDurationAdjust()
- //halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- // fw mechanism
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8821a2ant_ActionPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5aff5aff, 0xffff, 0x3);
- }
- else //for HID quality & wifi performance balance at 11n mode
- {
- halbtc8821a2ant_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) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- // fw mechanism
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-
-//PAN(HS) only
-VOID
-halbtc8821a2ant_ActionPanHs(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- halbtc8821a2ant_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) )
- {
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- }
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- // fw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- }
- else
- {
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
- }
-
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-//PAN(EDR)+A2DP
-VOID
-halbtc8821a2ant_ActionPanEdrA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3);
- }
- else //for HID quality & wifi performance balance at 11n mode
- {
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8821a2ant_ActionPanEdrHid(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState;
- u4Byte wifiBw;
-
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3);
- }
- else //for HID quality & wifi performance balance at 11n mode
- {
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3);
- }
-
- if(BTC_WIFI_BW_HT40 == wifiBw)
- {
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 3);
- // fw mechanism
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
- else
- {
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
- // fw mechanism
- if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
- }
- else
- {
- halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-// HID+A2DP+PAN(EDR)
-VOID
-halbtc8821a2ant_ActionHidA2dpPanEdr(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
- }
- else //for HID quality & wifi performance balance at 11n mode
- {
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8821a2ant_ActionHidA2dp(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- u1Byte wifiRssiState, btRssiState, btInfoExt;
- u4Byte wifiBw;
-
- btInfoExt = pCoexSta->btInfoExt;
- wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
- btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
-
- if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
- halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
- else
- halbtc8821a2ant_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 halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
- halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5f5b5f5b, 0xffffff, 0x3);
- }
- else //for HID quality & wifi performance balance at 11n mode
- {
-//Allen halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
- halbtc8821a2ant_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
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_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
- {
-// halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
-
- }
- else //a2dp edr rate
- {
-//Allen halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
- }
- else
- {
- if(btInfoExt&BIT0) //a2dp basic rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
- else //a2dp edr rate
- {
- halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
- }
- }
-
- // sw mechanism
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
- }
- else
- {
- halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
- halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
- }
- }
-}
-
-VOID
-halbtc8821a2ant_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"));
- halbtc8821a2ant_CoexUnder5G(pBtCoexist);
- return;
- }
-
- if(pStackInfo->bProfileNotified)
- {
- algorithm = halbtc8821a2ant_ActionAlgorithm(pBtCoexist);
- if(pCoexSta->bC2hBtInquiryPage && (BT_8821A_2ANT_COEX_ALGO_PANHS!=algorithm))
- {
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));
- halbtc8821a2ant_BtInquiryPage(pBtCoexist);
- return;
- }
-
- pCoexDm->curAlgorithm = algorithm;
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
-
- if(halbtc8821a2ant_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_2ANT_COEX_ALGO_SCO:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
- halbtc8821a2ant_ActionSco(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
- halbtc8821a2ant_ActionHid(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
- halbtc8821a2ant_ActionA2dp(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));
- halbtc8821a2ant_ActionA2dpPanHs(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
- halbtc8821a2ant_ActionPanEdr(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_PANHS:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
- halbtc8821a2ant_ActionPanHs(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
- halbtc8821a2ant_ActionPanEdrA2dp(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_PANEDR_HID:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
- halbtc8821a2ant_ActionPanEdrHid(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
- halbtc8821a2ant_ActionHidA2dpPanEdr(pBtCoexist);
- break;
- case BT_8821A_2ANT_COEX_ALGO_HID_A2DP:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
- halbtc8821a2ant_ActionHidA2dp(pBtCoexist);
- break;
- default:
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
- halbtc8821a2ant_CoexAllOff(pBtCoexist);
- break;
- }
- pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
- }
- }
- else
- { // stack doesn't notify profile info.
- // use the following profile info from bt fw.
- //pCoexSta->bBtLinkExist
- //pCoexSta->bScoExist
- //pCoexSta->bA2dpExist
- //pCoexSta->bHidExist
- //pCoexSta->bPanExist
-}
-}
-
-
-
-//============================================================
-// work around function start with wa_halbtc8821a2ant_
-//============================================================
-//============================================================
-// extern function start with EXhalbtc8821a2ant_
-//============================================================
-VOID
-EXhalbtc8821a2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- 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"));
-
- // backup rf 0x1e value
- pCoexDm->btRf0x1eBackup =
- pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
-
- // 0x790[5:0]=0x5
- u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
- u1Tmp &= 0xc0;
- u1Tmp |= 0x5;
- pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
-
- //Antenna config
- halbtc8821a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_MAIN, TRUE, FALSE);
-
- // PTA parameter
- halbtc8821a2ant_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);
- pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1);
-}
-
-VOID
-EXhalbtc8821a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
-
- halbtc8821a2ant_InitCoexDm(pBtCoexist);
-}
-
-VOID
-EXhalbtc8821a2ant_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);
-
- 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);
-
- 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", \
- GLCoexVerDate8821a2Ant, GLCoexVer8821a2Ant, 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_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8821A_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; i<BT_INFO_SRC_8821A_2ANT_MAX; i++)
- {
- if(pCoexSta->btInfoC2hCnt[i])
- {
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8821a2Ant[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/ %d ", "SM1[ShRf/ LpRA/ LimDig/ btLna]", \
- pCoexDm->bCurRfRxLpfShrink, pCoexDm->bCurLowPenaltyRa, pCoexDm->bLimitedDig, pCoexDm->bCurBtLnaConstrain);
- 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
-EXhalbtc8821a2ant_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;
- halbtc8821a2ant_CoexAllOff(pBtCoexist);
- }
- else if(BTC_IPS_LEAVE == type)
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
- pCoexSta->bUnderIps = FALSE;
- //halbtc8821a2ant_InitCoexDm(pBtCoexist);
- }
-}
-
-VOID
-EXhalbtc8821a2ant_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
-EXhalbtc8821a2ant_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
-EXhalbtc8821a2ant_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
-EXhalbtc8821a2ant_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;
- }
-
- 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]));
-
- pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
-}
-
-VOID
-EXhalbtc8821a2ant_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
-EXhalbtc8821a2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- )
-{
- u1Byte btInfo=0;
- u1Byte i, rspSource=0;
- static u4Byte setBtLnaCnt=0, setBtPsdMode=0;
- BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE;
- BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
-
- pCoexSta->bC2hBtInfoReqSent = FALSE;
-
- rspSource = tmpBuf[0]&0xf;
- if(rspSource >= BT_INFO_SRC_8821A_2ANT_MAX)
- rspSource = BT_INFO_SRC_8821A_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; i<length; i++)
- {
- 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]));
- }
- else
- {
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
- }
- }
-
- if(BT_INFO_SRC_8821A_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];
-
- // Here we need to resend some wifi info to BT
- // because bt is reset and loss of the info.
- if( (pCoexSta->btInfoExt & BIT1) )
- {
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
- if(bWifiConnected)
- {
- EXhalbtc8821a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
- }
- else
- {
- EXhalbtc8821a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
- }
-
- setBtPsdMode = 0;
- }
- if(setBtPsdMode <= 3)
- {
- halbtc8821a2ant_SetBtPsdMode(pBtCoexist, FORCE_EXEC, 0x0); //fix CH-BW mode
- setBtPsdMode++;
- }
-
- if(pCoexDm->bCurBtLnaConstrain)
- {
- if( (pCoexSta->btInfoExt & BIT2) )
- {
- }
- else
- {
- if(setBtLnaCnt <= 3)
- {
- halbtc8821a2ant_SetBtLnaConstrain(pBtCoexist, FORCE_EXEC, TRUE);
- setBtLnaCnt++;
- }
- }
- }
- else
- {
- setBtLnaCnt = 0;
- }
-
- if( (pCoexSta->btInfoExt & BIT3) )
- {
- halbtc8821a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
- }
- else
- {
- // BT already NOT ignore Wlan active, do nothing here.
- }
-
- if( (pCoexSta->btInfoExt & BIT4) )
- {
- // BT auto report already enabled, do nothing
- }
- else
- {
- halbtc8821a2ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
- }
- }
-
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
- // check BIT2 first ==> check if bt is under inquiry or page scan
- if(btInfo & BT_INFO_8821A_2ANT_B_INQ_PAGE)
- {
- pCoexSta->bC2hBtInquiryPage = TRUE;
- pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
- }
- else
- {
- pCoexSta->bC2hBtInquiryPage = FALSE;
- if(btInfo == 0x1) // connection exists but no busy
- {
- pCoexSta->bBtLinkExist = TRUE;
- pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_CONNECTED_IDLE;
- }
- else if(btInfo & BT_INFO_8821A_2ANT_B_CONNECTION) // connection exists and some link is busy
- {
- pCoexSta->bBtLinkExist = TRUE;
- if(btInfo & BT_INFO_8821A_2ANT_B_FTP)
- pCoexSta->bPanExist = TRUE;
- else
- pCoexSta->bPanExist = FALSE;
- if(btInfo & BT_INFO_8821A_2ANT_B_A2DP)
- pCoexSta->bA2dpExist = TRUE;
- else
- pCoexSta->bA2dpExist = FALSE;
- if(btInfo & BT_INFO_8821A_2ANT_B_HID)
- pCoexSta->bHidExist = TRUE;
- else
- pCoexSta->bHidExist = FALSE;
- if(btInfo & BT_INFO_8821A_2ANT_B_SCO_ESCO)
- pCoexSta->bScoExist = TRUE;
- else
- pCoexSta->bScoExist = FALSE;
- pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
- }
- else
- {
- pCoexSta->bBtLinkExist = FALSE;
- pCoexSta->bPanExist = FALSE;
- pCoexSta->bA2dpExist = FALSE;
- pCoexSta->bHidExist = FALSE;
- pCoexSta->bScoExist = FALSE;
- pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_IDLE;
- }
-
- if(bBtHsOn)
- {
- pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
- }
- }
-
- if(BT_8821A_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_2ANT_BT_STATUS_IDLE != pCoexDm->btStatus)
- {
- bLimitedDig = TRUE;
- }
- else
- {
- bLimitedDig = FALSE;
- }
- pCoexDm->bLimitedDig = bLimitedDig;
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
-
- halbtc8821a2ant_RunCoexistMechanism(pBtCoexist);
-}
-
-VOID
-EXhalbtc8821a2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- )
-{
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
-
- halbtc8821a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
- EXhalbtc8821a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
-}
-
-VOID
-EXhalbtc8821a2ant_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", \
- GLCoexVerDate8821a2Ant, GLCoexVer8821a2Ant, fwVer, btPatchVer, btPatchVer));
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
- }
-
- halbtc8821a2ant_QueryBtInfo(pBtCoexist);
- halbtc8821a2ant_MonitorBtCtr(pBtCoexist);
- halbtc8821a2ant_MonitorBtEnableDisable(pBtCoexist);
-}
-
-
-#endif
-
+//============================================================
+// Description:
+//
+// This file is for RTL8821A Co-exist mechanism
+//
+// History
+// 2012/08/22 Cosa first check in.
+// 2012/11/14 Cosa Revise for 8821A 2Ant out sourcing.
+//
+//============================================================
+
+//============================================================
+// include files
+//============================================================
+#include "Mp_Precomp.h"
+#if(BT_30_SUPPORT == 1)
+//============================================================
+// Global variables, these are static variables
+//============================================================
+static COEX_DM_8821A_2ANT GLCoexDm8821a2Ant;
+static PCOEX_DM_8821A_2ANT pCoexDm=&GLCoexDm8821a2Ant;
+static COEX_STA_8821A_2ANT GLCoexSta8821a2Ant;
+static PCOEX_STA_8821A_2ANT pCoexSta=&GLCoexSta8821a2Ant;
+
+const char *const GLBtInfoSrc8821a2Ant[]={
+ "BT Info[wifi fw]",
+ "BT Info[bt rsp]",
+ "BT Info[bt auto report]",
+};
+
+u4Byte GLCoexVerDate8821a2Ant=20130618;
+u4Byte GLCoexVer8821a2Ant=0x5050;
+
+//============================================================
+// local function proto type if needed
+//============================================================
+//============================================================
+// local function start with halbtc8821a2ant_
+//============================================================
+u1Byte
+halbtc8821a2ant_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_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_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_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
+halbtc8821a2ant_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_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_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_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
+halbtc8821a2ant_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
+halbtc8821a2ant_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, 0xc);
+}
+
+VOID
+halbtc8821a2ant_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);
+}
+u1Byte
+halbtc8821a2ant_ActionAlgorithm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
+ BOOLEAN bBtHsOn=FALSE;
+ u1Byte algorithm=BT_8821A_2ANT_COEX_ALGO_UNDEFINED;
+ u1Byte numOfDiffProfile=0;
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+
+ //for win-8 stack HID report error
+ if(!pStackInfo->bHidExist)
+ pStackInfo->bHidExist = pCoexSta->bHidExist; //sync BTInfo with BT firmware and stack
+ // when stack HID report error, here we use the info from bt fw.
+ if(!pStackInfo->bBtLinkExist)
+ pStackInfo->bBtLinkExist = pCoexSta->bBtLinkExist;
+
+ 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_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ if(pStackInfo->bHidExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));
+ algorithm = BT_8821A_2ANT_COEX_ALGO_HID;
+ }
+ else if(pStackInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else if(pStackInfo->bA2dpExist)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_SCO;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_A2DP_PANHS;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));
+ algorithm = BT_8821A_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_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_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_HID_A2DP;
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
+ algorithm = BT_8821A_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_2ANT_COEX_ALGO_PANEDR_HID;
+ }
+ }
+ }
+ }
+
+ return algorithm;
+}
+
+BOOLEAN
+halbtc8821a2ant_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 = halbtc8821a2ant_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
+halbtc8821a2ant_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
+halbtc8821a2ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8821a2ant_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;
+ }
+ halbtc8821a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr);
+
+ pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr;
+}
+
+VOID
+halbtc8821a2ant_SetFwBtLnaConstrain(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bBtLnaConsOn
+ )
+{
+ u1Byte H2C_Parameter[2] ={0};
+
+ H2C_Parameter[0] = 0x3; // opCode, 0x3=BT_SET_LNA_CONSTRAIN
+
+ if(bBtLnaConsOn)
+ {
+ H2C_Parameter[1] |= BIT0;
+ }
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set BT LNA Constrain: %s, FW write 0x69=0x%x\n",
+ (bBtLnaConsOn? "ON!!":"OFF!!"),
+ H2C_Parameter[0]<<8|H2C_Parameter[1]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x69, 2, H2C_Parameter);
+}
+
+VOID
+halbtc8821a2ant_SetBtLnaConstrain(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bBtLnaConsOn
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT Constrain = %s\n",
+ (bForceExec? "force":""), ((bBtLnaConsOn)? "ON":"OFF")));
+ pCoexDm->bCurBtLnaConstrain = bBtLnaConsOn;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBtLnaConstrain=%d, bCurBtLnaConstrain=%d\n",
+ pCoexDm->bPreBtLnaConstrain, pCoexDm->bCurBtLnaConstrain));
+
+ if(pCoexDm->bPreBtLnaConstrain == pCoexDm->bCurBtLnaConstrain)
+ return;
+ }
+ halbtc8821a2ant_SetFwBtLnaConstrain(pBtCoexist, pCoexDm->bCurBtLnaConstrain);
+
+ pCoexDm->bPreBtLnaConstrain = pCoexDm->bCurBtLnaConstrain;
+}
+
+VOID
+halbtc8821a2ant_SetFwBtPsdMode(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte btPsdMode
+ )
+{
+ u1Byte H2C_Parameter[2] ={0};
+
+ H2C_Parameter[0] = 0x2; // opCode, 0x2=BT_SET_PSD_MODE
+
+ H2C_Parameter[1] = btPsdMode;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set BT PSD mode=0x%x, FW write 0x69=0x%x\n",
+ H2C_Parameter[1],
+ H2C_Parameter[0]<<8|H2C_Parameter[1]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x69, 2, H2C_Parameter);
+}
+
+
+VOID
+halbtc8821a2ant_SetBtPsdMode(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN u1Byte btPsdMode
+ )
+{
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT PSD mode = 0x%x\n",
+ (bForceExec? "force":""), btPsdMode));
+ pCoexDm->bCurBtPsdMode = btPsdMode;
+
+ if(!bForceExec)
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBtPsdMode=0x%x, bCurBtPsdMode=0x%x\n",
+ pCoexDm->bPreBtPsdMode, pCoexDm->bCurBtPsdMode));
+
+ if(pCoexDm->bPreBtPsdMode == pCoexDm->bCurBtPsdMode)
+ return;
+ }
+ halbtc8821a2ant_SetFwBtPsdMode(pBtCoexist, pCoexDm->bCurBtPsdMode);
+
+ pCoexDm->bPreBtPsdMode = pCoexDm->bCurBtPsdMode;
+}
+
+
+VOID
+halbtc8821a2ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8821a2ant_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;
+ }
+ halbtc8821a2ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport);
+
+ pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport;
+}
+
+VOID
+halbtc8821a2ant_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;
+ }
+
+ halbtc8821a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
+
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
+}
+
+VOID
+halbtc8821a2ant_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
+halbtc8821a2ant_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;
+ }
+ halbtc8821a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
+
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
+}
+
+VOID
+halbtc8821a2ant_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
+halbtc8821a2ant_LowPenaltyRa(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bForceExec,
+ IN BOOLEAN bLowPenaltyRa
+ )
+{
+ //return;
+ 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;
+ }
+ halbtc8821a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
+
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
+}
+
+VOID
+halbtc8821a2ant_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
+halbtc8821a2ant_SetSwFullTimeDacSwing(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bSwDacSwingOn,
+ IN u4Byte swDacSwingLvl
+ )
+{
+ if(bSwDacSwingOn)
+ {
+ halbtc8821a2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl);
+ }
+ else
+ {
+ halbtc8821a2ant_SetDacSwingReg(pBtCoexist, 0x18);
+ }
+}
+
+
+VOID
+halbtc8821a2ant_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);
+ halbtc8821a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
+
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
+}
+
+VOID
+halbtc8821a2ant_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
+halbtc8821a2ant_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;
+ }
+ halbtc8821a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
+
+ pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
+}
+
+VOID
+halbtc8821a2ant_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
+halbtc8821a2ant_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;
+ }
+ halbtc8821a2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
+
+ pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
+}
+
+VOID
+halbtc8821a2ant_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
+halbtc8821a2ant_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;
+ }
+ halbtc8821a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc);
+
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
+ pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4;
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
+}
+
+VOID
+halbtc8821a2ant_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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);
+}
+
+VOID
+halbtc8821a2ant_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;
+ }
+ halbtc8821a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
+
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
+}
+
+VOID
+halbtc8821a2ant_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};
+
+ H2C_Parameter[0] = byte1;
+ H2C_Parameter[1] = byte2;
+ H2C_Parameter[2] = byte3;
+ H2C_Parameter[3] = byte4;
+ H2C_Parameter[4] = byte5;
+
+ pCoexDm->psTdmaPara[0] = byte1;
+ pCoexDm->psTdmaPara[1] = byte2;
+ pCoexDm->psTdmaPara[2] = byte3;
+ pCoexDm->psTdmaPara[3] = byte4;
+ pCoexDm->psTdmaPara[4] = byte5;
+
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=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
+halbtc8821a2ant_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;
+ }
+
+ halbtc8821a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF);
+ halbtc8821a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
+
+ //no limited DIG
+ //halbtc8821a2ant_SetBtLnaConstrain(pBtCoexist, NORMAL_EXEC, bBTLNAConstrain);
+}
+
+VOID
+halbtc8821a2ant_SwMechanism2(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN bAGCTableShift,
+ IN BOOLEAN bADCBackOff,
+ IN BOOLEAN bSWDACSwing,
+ IN u4Byte dacSwingLvl
+ )
+{
+ //halbtc8821a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift);
+ halbtc8821a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff);
+ halbtc8821a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl);
+}
+
+VOID
+halbtc8821a2ant_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
+halbtc8821a2ant_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:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+ case 2:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
+ break;
+ case 3:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90);
+ break;
+ case 4:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xf1, 0x90);
+ break;
+ case 5:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
+ break;
+ case 6:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
+ break;
+ case 7:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90);
+ break;
+ case 8:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90);
+ break;
+ case 9:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+ case 10:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);
+ break;
+ case 11:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x90);
+ break;
+ case 12:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
+ break;
+ case 13:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);
+ break;
+ case 14:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);
+ break;
+ case 15:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x90);
+ break;
+ case 16:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x90);
+ break;
+ case 17:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x90);
+ break;
+ case 18:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90);
+ break;
+ case 19:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90);
+ break;
+ case 20:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);
+ break;
+ case 21:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);
+ break;
+ case 71:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);
+ break;
+ }
+ }
+ else
+ {
+ // disable PS tdma
+ switch(type)
+ {
+ case 0:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0);
+ break;
+ case 1:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x48, 0x0);
+ break;
+ default:
+ halbtc8821a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0);
+ break;
+ }
+ }
+
+ // update pre state
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;
+}
+
+VOID
+halbtc8821a2ant_CoexAllOff(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // fw all off
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ // sw all off
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ // hw all off
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3);
+}
+
+VOID
+halbtc8821a2ant_CoexUnder5G(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ halbtc8821a2ant_CoexAllOff(pBtCoexist);
+}
+
+VOID
+halbtc8821a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ // force to reset coex mechanism
+ halbtc8821a2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3);
+
+ halbtc8821a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE);
+
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+}
+
+VOID
+halbtc8821a2ant_BtInquiryPage(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BOOLEAN bLowPwrDisable=TRUE;
+
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
+
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3);
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+}
+BOOLEAN
+halbtc8821a2ant_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);
+
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3);
+
+ if(!bWifiConnected &&
+ BT_8821A_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"));
+
+
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8821A_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"));
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi LPS + BT IPS!!\n"));
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8821A_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"));
+
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else if(bWifiConnected &&
+ (BT_8821A_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"));
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi LPS + BT LPS!!\n"));
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,TRUE,TRUE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ bCommon = TRUE;
+ }
+ else if(!bWifiConnected &&
+ (BT_8821A_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"));
+
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+
+ 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"));
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21);
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+
+ bCommon = TRUE;
+ }
+
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,TRUE,TRUE);
+ }
+
+ return bCommon;
+}
+VOID
+halbtc8821a2ant_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)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ }
+ }
+ else
+ {
+ if(bTxPause)
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ }
+ else
+ {
+ if(maxInterval == 1)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(maxInterval == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(maxInterval == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else
+ {
+ halbtc8821a2ant_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)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ pCoexDm->psTdmaDuAdjType = 13;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ pCoexDm->psTdmaDuAdjType = 5;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_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)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
+ pCoexDm->psTdmaDuAdjType = 71;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ pCoexDm->psTdmaDuAdjType = 9;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 71)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ pCoexDm->psTdmaDuAdjType = 1;
+ }
+ else if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);
+ pCoexDm->psTdmaDuAdjType = 71;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_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)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
+ pCoexDm->psTdmaDuAdjType = 6;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ pCoexDm->psTdmaDuAdjType = 14;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_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)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
+ pCoexDm->psTdmaDuAdjType = 2;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ pCoexDm->psTdmaDuAdjType = 10;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_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)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 5)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
+ pCoexDm->psTdmaDuAdjType = 8;
+ }
+ else if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
+ pCoexDm->psTdmaDuAdjType = 16;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
+ pCoexDm->psTdmaDuAdjType = 7;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
+ pCoexDm->psTdmaDuAdjType = 15;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_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)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 6)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 7)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 8)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ if(pCoexDm->curPsTdma == 13)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 14)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 15)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 16)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ if(result == -1)
+ {
+ if(pCoexDm->curPsTdma == 1)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
+ pCoexDm->psTdmaDuAdjType = 4;
+ }
+ else if(pCoexDm->curPsTdma == 9)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
+ pCoexDm->psTdmaDuAdjType = 12;
+ }
+ }
+ else if (result == 1)
+ {
+ if(pCoexDm->curPsTdma == 4)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 3)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 2)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
+ pCoexDm->psTdmaDuAdjType = 3;
+ }
+ else if(pCoexDm->curPsTdma == 12)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 11)
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
+ pCoexDm->psTdmaDuAdjType = 11;
+ }
+ else if(pCoexDm->curPsTdma == 10)
+ {
+ halbtc8821a2ant_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)
+ {
+ halbtc8821a2ant_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 halbtc8821a2ant_TdmaDurationAdjust() is called, fw dac swing is included in the function.
+ //if(pCoexDm->psTdmaDuAdjType == 71)
+ // halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xc); //Skip because A2DP get worse at HT40
+ //else
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x6);
+}
+
+// SCO only or SCO+PAN(HS)
+VOID
+halbtc8821a2ant_ActionSco(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState,btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 4);
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3);
+ }
+ else //for SCO quality & wifi performance balance at 11n mode
+ {
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3);
+ }
+
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+
+ // fw mechanism
+ //halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ // fw mechanism
+ //halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+
+VOID
+halbtc8821a2ant_ActionHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
+ }
+ else //for HID quality & wifi performance balance at 11n mode
+ {
+ halbtc8821a2ant_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) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ // fw mechanism
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
+VOID
+halbtc8821a2ant_ActionA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ //fw dac swing is called in halbtc8821a2ant_TdmaDurationAdjust()
+ //halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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) )
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
+ }
+ else
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ // fw mechanism
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
+ }
+ else
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8821a2ant_ActionA2dpPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2,35, 0);
+
+ //fw dac swing is called in halbtc8821a2ant_TdmaDurationAdjust()
+ //halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ // fw mechanism
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8821a2ant_ActionPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5aff5aff, 0xffff, 0x3);
+ }
+ else //for HID quality & wifi performance balance at 11n mode
+ {
+ halbtc8821a2ant_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) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ // fw mechanism
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+
+//PAN(HS) only
+VOID
+halbtc8821a2ant_ActionPanHs(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ halbtc8821a2ant_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) )
+ {
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ // fw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ }
+ else
+ {
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
+ }
+
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+//PAN(EDR)+A2DP
+VOID
+halbtc8821a2ant_ActionPanEdrA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3);
+ }
+ else //for HID quality & wifi performance balance at 11n mode
+ {
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8821a2ant_ActionPanEdrHid(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState;
+ u4Byte wifiBw;
+
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3);
+ }
+ else //for HID quality & wifi performance balance at 11n mode
+ {
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3);
+ }
+
+ if(BTC_WIFI_BW_HT40 == wifiBw)
+ {
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 3);
+ // fw mechanism
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+ else
+ {
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+ // fw mechanism
+ if( (btRssiState == BTC_RSSI_STATE_HIGH) ||
+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
+ }
+ else
+ {
+ halbtc8821a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+// HID+A2DP+PAN(EDR)
+VOID
+halbtc8821a2ant_ActionHidA2dpPanEdr(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ halbtc8821a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
+ }
+ else //for HID quality & wifi performance balance at 11n mode
+ {
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8821a2ant_ActionHidA2dp(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ u1Byte wifiRssiState, btRssiState, btInfoExt;
+ u4Byte wifiBw;
+
+ btInfoExt = pCoexSta->btInfoExt;
+ wifiRssiState = halbtc8821a2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);
+ btRssiState = halbtc8821a2ant_BtRssiState(2, 35, 0);
+
+ if(halbtc8821a2ant_NeedToDecBtPwr(pBtCoexist))
+ halbtc8821a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
+ else
+ halbtc8821a2ant_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 halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
+ halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5f5b5f5b, 0xffffff, 0x3);
+ }
+ else //for HID quality & wifi performance balance at 11n mode
+ {
+//Allen halbtc8821a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3);
+ halbtc8821a2ant_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
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_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
+ {
+// halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+
+ }
+ else //a2dp edr rate
+ {
+//Allen halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+ }
+ else
+ {
+ if(btInfoExt&BIT0) //a2dp basic rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+ else //a2dp edr rate
+ {
+ halbtc8821a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);
+ }
+ }
+
+ // sw mechanism
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);
+ }
+ else
+ {
+ halbtc8821a2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);
+ halbtc8821a2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);
+ }
+ }
+}
+
+VOID
+halbtc8821a2ant_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"));
+ halbtc8821a2ant_CoexUnder5G(pBtCoexist);
+ return;
+ }
+
+ if(pStackInfo->bProfileNotified)
+ {
+ algorithm = halbtc8821a2ant_ActionAlgorithm(pBtCoexist);
+ if(pCoexSta->bC2hBtInquiryPage && (BT_8821A_2ANT_COEX_ALGO_PANHS!=algorithm))
+ {
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));
+ halbtc8821a2ant_BtInquiryPage(pBtCoexist);
+ return;
+ }
+
+ pCoexDm->curAlgorithm = algorithm;
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
+
+ if(halbtc8821a2ant_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_2ANT_COEX_ALGO_SCO:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
+ halbtc8821a2ant_ActionSco(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
+ halbtc8821a2ant_ActionHid(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
+ halbtc8821a2ant_ActionA2dp(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));
+ halbtc8821a2ant_ActionA2dpPanHs(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
+ halbtc8821a2ant_ActionPanEdr(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_PANHS:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
+ halbtc8821a2ant_ActionPanHs(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
+ halbtc8821a2ant_ActionPanEdrA2dp(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_PANEDR_HID:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
+ halbtc8821a2ant_ActionPanEdrHid(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
+ halbtc8821a2ant_ActionHidA2dpPanEdr(pBtCoexist);
+ break;
+ case BT_8821A_2ANT_COEX_ALGO_HID_A2DP:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
+ halbtc8821a2ant_ActionHidA2dp(pBtCoexist);
+ break;
+ default:
+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
+ halbtc8821a2ant_CoexAllOff(pBtCoexist);
+ break;
+ }
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
+ }
+ }
+ else
+ { // stack doesn't notify profile info.
+ // use the following profile info from bt fw.
+ //pCoexSta->bBtLinkExist
+ //pCoexSta->bScoExist
+ //pCoexSta->bA2dpExist
+ //pCoexSta->bHidExist
+ //pCoexSta->bPanExist
+}
+}
+
+
+
+//============================================================
+// work around function start with wa_halbtc8821a2ant_
+//============================================================
+//============================================================
+// extern function start with EXhalbtc8821a2ant_
+//============================================================
+VOID
+EXhalbtc8821a2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ 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"));
+
+ // backup rf 0x1e value
+ pCoexDm->btRf0x1eBackup =
+ pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
+
+ // 0x790[5:0]=0x5
+ u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790);
+ u1Tmp &= 0xc0;
+ u1Tmp |= 0x5;
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp);
+
+ //Antenna config
+ halbtc8821a2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_MAIN, TRUE, FALSE);
+
+ // PTA parameter
+ halbtc8821a2ant_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);
+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1);
+}
+
+VOID
+EXhalbtc8821a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));
+
+ halbtc8821a2ant_InitCoexDm(pBtCoexist);
+}
+
+VOID
+EXhalbtc8821a2ant_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);
+
+ 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);
+
+ 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", \
+ GLCoexVerDate8821a2Ant, GLCoexVer8821a2Ant, 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_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8821A_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; i<BT_INFO_SRC_8821A_2ANT_MAX; i++)
+ {
+ if(pCoexSta->btInfoC2hCnt[i])
+ {
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8821a2Ant[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/ %d ", "SM1[ShRf/ LpRA/ LimDig/ btLna]", \
+ pCoexDm->bCurRfRxLpfShrink, pCoexDm->bCurLowPenaltyRa, pCoexDm->bLimitedDig, pCoexDm->bCurBtLnaConstrain);
+ 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
+EXhalbtc8821a2ant_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;
+ halbtc8821a2ant_CoexAllOff(pBtCoexist);
+ }
+ else if(BTC_IPS_LEAVE == type)
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));
+ pCoexSta->bUnderIps = FALSE;
+ //halbtc8821a2ant_InitCoexDm(pBtCoexist);
+ }
+}
+
+VOID
+EXhalbtc8821a2ant_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
+EXhalbtc8821a2ant_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
+EXhalbtc8821a2ant_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
+EXhalbtc8821a2ant_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;
+ }
+
+ 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]));
+
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter);
+}
+
+VOID
+EXhalbtc8821a2ant_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
+EXhalbtc8821a2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ )
+{
+ u1Byte btInfo=0;
+ u1Byte i, rspSource=0;
+ static u4Byte setBtLnaCnt=0, setBtPsdMode=0;
+ BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE;
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
+
+ pCoexSta->bC2hBtInfoReqSent = FALSE;
+
+ rspSource = tmpBuf[0]&0xf;
+ if(rspSource >= BT_INFO_SRC_8821A_2ANT_MAX)
+ rspSource = BT_INFO_SRC_8821A_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; i<length; i++)
+ {
+ 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]));
+ }
+ else
+ {
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));
+ }
+ }
+
+ if(BT_INFO_SRC_8821A_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];
+
+ // Here we need to resend some wifi info to BT
+ // because bt is reset and loss of the info.
+ if( (pCoexSta->btInfoExt & BIT1) )
+ {
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
+ if(bWifiConnected)
+ {
+ EXhalbtc8821a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT);
+ }
+ else
+ {
+ EXhalbtc8821a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+ }
+
+ setBtPsdMode = 0;
+ }
+ if(setBtPsdMode <= 3)
+ {
+ halbtc8821a2ant_SetBtPsdMode(pBtCoexist, FORCE_EXEC, 0x0); //fix CH-BW mode
+ setBtPsdMode++;
+ }
+
+ if(pCoexDm->bCurBtLnaConstrain)
+ {
+ if( (pCoexSta->btInfoExt & BIT2) )
+ {
+ }
+ else
+ {
+ if(setBtLnaCnt <= 3)
+ {
+ halbtc8821a2ant_SetBtLnaConstrain(pBtCoexist, FORCE_EXEC, TRUE);
+ setBtLnaCnt++;
+ }
+ }
+ }
+ else
+ {
+ setBtLnaCnt = 0;
+ }
+
+ if( (pCoexSta->btInfoExt & BIT3) )
+ {
+ halbtc8821a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
+ }
+ else
+ {
+ // BT already NOT ignore Wlan active, do nothing here.
+ }
+
+ if( (pCoexSta->btInfoExt & BIT4) )
+ {
+ // BT auto report already enabled, do nothing
+ }
+ else
+ {
+ halbtc8821a2ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE);
+ }
+ }
+
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
+ // check BIT2 first ==> check if bt is under inquiry or page scan
+ if(btInfo & BT_INFO_8821A_2ANT_B_INQ_PAGE)
+ {
+ pCoexSta->bC2hBtInquiryPage = TRUE;
+ pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
+ }
+ else
+ {
+ pCoexSta->bC2hBtInquiryPage = FALSE;
+ if(btInfo == 0x1) // connection exists but no busy
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_CONNECTED_IDLE;
+ }
+ else if(btInfo & BT_INFO_8821A_2ANT_B_CONNECTION) // connection exists and some link is busy
+ {
+ pCoexSta->bBtLinkExist = TRUE;
+ if(btInfo & BT_INFO_8821A_2ANT_B_FTP)
+ pCoexSta->bPanExist = TRUE;
+ else
+ pCoexSta->bPanExist = FALSE;
+ if(btInfo & BT_INFO_8821A_2ANT_B_A2DP)
+ pCoexSta->bA2dpExist = TRUE;
+ else
+ pCoexSta->bA2dpExist = FALSE;
+ if(btInfo & BT_INFO_8821A_2ANT_B_HID)
+ pCoexSta->bHidExist = TRUE;
+ else
+ pCoexSta->bHidExist = FALSE;
+ if(btInfo & BT_INFO_8821A_2ANT_B_SCO_ESCO)
+ pCoexSta->bScoExist = TRUE;
+ else
+ pCoexSta->bScoExist = FALSE;
+ pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
+ }
+ else
+ {
+ pCoexSta->bBtLinkExist = FALSE;
+ pCoexSta->bPanExist = FALSE;
+ pCoexSta->bA2dpExist = FALSE;
+ pCoexSta->bHidExist = FALSE;
+ pCoexSta->bScoExist = FALSE;
+ pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_IDLE;
+ }
+
+ if(bBtHsOn)
+ {
+ pCoexDm->btStatus = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
+ }
+ }
+
+ if(BT_8821A_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_2ANT_BT_STATUS_IDLE != pCoexDm->btStatus)
+ {
+ bLimitedDig = TRUE;
+ }
+ else
+ {
+ bLimitedDig = FALSE;
+ }
+ pCoexDm->bLimitedDig = bLimitedDig;
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
+
+ halbtc8821a2ant_RunCoexistMechanism(pBtCoexist);
+}
+
+VOID
+EXhalbtc8821a2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ )
+{
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));
+
+ halbtc8821a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
+ EXhalbtc8821a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
+}
+
+VOID
+EXhalbtc8821a2ant_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", \
+ GLCoexVerDate8821a2Ant, GLCoexVer8821a2Ant, fwVer, btPatchVer, btPatchVer));
+ BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));
+ }
+
+ halbtc8821a2ant_QueryBtInfo(pBtCoexist);
+ halbtc8821a2ant_MonitorBtCtr(pBtCoexist);
+ halbtc8821a2ant_MonitorBtEnableDisable(pBtCoexist);
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h
index 95266a1..46b87ee 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h
@@ -1,180 +1,180 @@
-//===========================================
-// The following is for 8821A 2Ant BT Co-exist definition
-//===========================================
-#define BT_INFO_8821A_2ANT_B_FTP BIT7
-#define BT_INFO_8821A_2ANT_B_A2DP BIT6
-#define BT_INFO_8821A_2ANT_B_HID BIT5
-#define BT_INFO_8821A_2ANT_B_SCO_BUSY BIT4
-#define BT_INFO_8821A_2ANT_B_ACL_BUSY BIT3
-#define BT_INFO_8821A_2ANT_B_INQ_PAGE BIT2
-#define BT_INFO_8821A_2ANT_B_SCO_ESCO BIT1
-#define BT_INFO_8821A_2ANT_B_CONNECTION BIT0
-
-#define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT 2
-
-typedef enum _BT_INFO_SRC_8821A_2ANT{
- BT_INFO_SRC_8821A_2ANT_WIFI_FW = 0x0,
- BT_INFO_SRC_8821A_2ANT_BT_RSP = 0x1,
- BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND = 0x2,
- BT_INFO_SRC_8821A_2ANT_MAX
-}BT_INFO_SRC_8821A_2ANT,*PBT_INFO_SRC_8821A_2ANT;
-
-typedef enum _BT_8821A_2ANT_BT_STATUS{
- BT_8821A_2ANT_BT_STATUS_IDLE = 0x0,
- BT_8821A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
- BT_8821A_2ANT_BT_STATUS_NON_IDLE = 0x2,
- BT_8821A_2ANT_BT_STATUS_MAX
-}BT_8821A_2ANT_BT_STATUS,*PBT_8821A_2ANT_BT_STATUS;
-
-typedef enum _BT_8821A_2ANT_COEX_ALGO{
- BT_8821A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
- BT_8821A_2ANT_COEX_ALGO_SCO = 0x1,
- BT_8821A_2ANT_COEX_ALGO_HID = 0x2,
- BT_8821A_2ANT_COEX_ALGO_A2DP = 0x3,
- BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
- BT_8821A_2ANT_COEX_ALGO_PANEDR = 0x5,
- BT_8821A_2ANT_COEX_ALGO_PANHS = 0x6,
- BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
- BT_8821A_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
- BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
- BT_8821A_2ANT_COEX_ALGO_HID_A2DP = 0xa,
- BT_8821A_2ANT_COEX_ALGO_MAX = 0xb,
-}BT_8821A_2ANT_COEX_ALGO,*PBT_8821A_2ANT_COEX_ALGO;
-
-typedef struct _COEX_DM_8821A_2ANT{
- // fw mechanism
- BOOLEAN bPreDecBtPwr;
- BOOLEAN bCurDecBtPwr;
- BOOLEAN bPreBtLnaConstrain;
- BOOLEAN bCurBtLnaConstrain;
- u1Byte bPreBtPsdMode;
- u1Byte bCurBtPsdMode;
- u1Byte preFwDacSwingLvl;
- u1Byte curFwDacSwingLvl;
- BOOLEAN bCurIgnoreWlanAct;
- BOOLEAN bPreIgnoreWlanAct;
- u1Byte prePsTdma;
- u1Byte curPsTdma;
- u1Byte psTdmaPara[5];
- 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;
-
- // algorithm related
- u1Byte preAlgorithm;
- u1Byte curAlgorithm;
- u1Byte btStatus;
- u1Byte wifiChnlInfo[3];
-} COEX_DM_8821A_2ANT, *PCOEX_DM_8821A_2ANT;
-
-typedef struct _COEX_STA_8821A_2ANT{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bA2dpExist;
- 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_2ANT_MAX][10];
- u4Byte btInfoC2hCnt[BT_INFO_SRC_8821A_2ANT_MAX];
- BOOLEAN bC2hBtInquiryPage;
- u1Byte btRetryCnt;
- u1Byte btInfoExt;
-}COEX_STA_8821A_2ANT, *PCOEX_STA_8821A_2ANT;
-
-//===========================================
-// The following is interface which will notify coex module.
-//===========================================
-VOID
-EXhalbtc8821a2ant_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a2ant_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a2ant_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a2ant_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a2ant_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a2ant_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a2ant_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a2ant_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtc8821a2ant_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtc8821a2ant_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a2ant_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtc8821a2ant_DisplayCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-
+//===========================================
+// The following is for 8821A 2Ant BT Co-exist definition
+//===========================================
+#define BT_INFO_8821A_2ANT_B_FTP BIT7
+#define BT_INFO_8821A_2ANT_B_A2DP BIT6
+#define BT_INFO_8821A_2ANT_B_HID BIT5
+#define BT_INFO_8821A_2ANT_B_SCO_BUSY BIT4
+#define BT_INFO_8821A_2ANT_B_ACL_BUSY BIT3
+#define BT_INFO_8821A_2ANT_B_INQ_PAGE BIT2
+#define BT_INFO_8821A_2ANT_B_SCO_ESCO BIT1
+#define BT_INFO_8821A_2ANT_B_CONNECTION BIT0
+
+#define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT 2
+
+typedef enum _BT_INFO_SRC_8821A_2ANT{
+ BT_INFO_SRC_8821A_2ANT_WIFI_FW = 0x0,
+ BT_INFO_SRC_8821A_2ANT_BT_RSP = 0x1,
+ BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND = 0x2,
+ BT_INFO_SRC_8821A_2ANT_MAX
+}BT_INFO_SRC_8821A_2ANT,*PBT_INFO_SRC_8821A_2ANT;
+
+typedef enum _BT_8821A_2ANT_BT_STATUS{
+ BT_8821A_2ANT_BT_STATUS_IDLE = 0x0,
+ BT_8821A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
+ BT_8821A_2ANT_BT_STATUS_NON_IDLE = 0x2,
+ BT_8821A_2ANT_BT_STATUS_MAX
+}BT_8821A_2ANT_BT_STATUS,*PBT_8821A_2ANT_BT_STATUS;
+
+typedef enum _BT_8821A_2ANT_COEX_ALGO{
+ BT_8821A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
+ BT_8821A_2ANT_COEX_ALGO_SCO = 0x1,
+ BT_8821A_2ANT_COEX_ALGO_HID = 0x2,
+ BT_8821A_2ANT_COEX_ALGO_A2DP = 0x3,
+ BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
+ BT_8821A_2ANT_COEX_ALGO_PANEDR = 0x5,
+ BT_8821A_2ANT_COEX_ALGO_PANHS = 0x6,
+ BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
+ BT_8821A_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
+ BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
+ BT_8821A_2ANT_COEX_ALGO_HID_A2DP = 0xa,
+ BT_8821A_2ANT_COEX_ALGO_MAX = 0xb,
+}BT_8821A_2ANT_COEX_ALGO,*PBT_8821A_2ANT_COEX_ALGO;
+
+typedef struct _COEX_DM_8821A_2ANT{
+ // fw mechanism
+ BOOLEAN bPreDecBtPwr;
+ BOOLEAN bCurDecBtPwr;
+ BOOLEAN bPreBtLnaConstrain;
+ BOOLEAN bCurBtLnaConstrain;
+ u1Byte bPreBtPsdMode;
+ u1Byte bCurBtPsdMode;
+ u1Byte preFwDacSwingLvl;
+ u1Byte curFwDacSwingLvl;
+ BOOLEAN bCurIgnoreWlanAct;
+ BOOLEAN bPreIgnoreWlanAct;
+ u1Byte prePsTdma;
+ u1Byte curPsTdma;
+ u1Byte psTdmaPara[5];
+ 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;
+
+ // algorithm related
+ u1Byte preAlgorithm;
+ u1Byte curAlgorithm;
+ u1Byte btStatus;
+ u1Byte wifiChnlInfo[3];
+} COEX_DM_8821A_2ANT, *PCOEX_DM_8821A_2ANT;
+
+typedef struct _COEX_STA_8821A_2ANT{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bA2dpExist;
+ 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_2ANT_MAX][10];
+ u4Byte btInfoC2hCnt[BT_INFO_SRC_8821A_2ANT_MAX];
+ BOOLEAN bC2hBtInquiryPage;
+ u1Byte btRetryCnt;
+ u1Byte btInfoExt;
+}COEX_STA_8821A_2ANT, *PCOEX_STA_8821A_2ANT;
+
+//===========================================
+// The following is interface which will notify coex module.
+//===========================================
+VOID
+EXhalbtc8821a2ant_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8821a2ant_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8821a2ant_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a2ant_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a2ant_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a2ant_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a2ant_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a2ant_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtc8821a2ant_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtc8821a2ant_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8821a2ant_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtc8821a2ant_DisplayCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+
diff --git a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h
index 9a56381..8345925 100755
--- a/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h
+++ b/rtl8xxx_EU/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h
@@ -1,681 +1,681 @@
-#ifndef __HALBTC_OUT_SRC_H__
-#define __HALBTC_OUT_SRC_H__
-
-#define NORMAL_EXEC FALSE
-#define FORCE_EXEC TRUE
-
-#define BTC_RF_A 0x0
-#define BTC_RF_B 0x1
-#define BTC_RF_C 0x2
-#define BTC_RF_D 0x3
-
-#define BTC_SMSP SINGLEMAC_SINGLEPHY
-#define BTC_DMDP DUALMAC_DUALPHY
-#define BTC_DMSP DUALMAC_SINGLEPHY
-#define BTC_MP_UNKNOWN 0xff
-
-#define BT_COEX_ANT_TYPE_PG 0
-#define BT_COEX_ANT_TYPE_ANTDIV 1
-#define BT_COEX_ANT_TYPE_DETECTED 2
-
-#define BTC_MIMO_PS_STATIC 0 // 1ss
-#define BTC_MIMO_PS_DYNAMIC 1 // 2ss
-
-#define BTC_RATE_DISABLE 0
-#define BTC_RATE_ENABLE 1
-
-// single Antenna definition
-#define BTC_ANT_PATH_WIFI 0
-#define BTC_ANT_PATH_BT 1
-#define BTC_ANT_PATH_PTA 2
-// dual Antenna definition
-#define BTC_ANT_WIFI_AT_MAIN 0
-#define BTC_ANT_WIFI_AT_AUX 1
-// coupler Antenna definition
-#define BTC_ANT_WIFI_AT_CPL_MAIN 0
-#define BTC_ANT_WIFI_AT_CPL_AUX 1
-
-typedef enum _BTC_POWERSAVE_TYPE{
- BTC_PS_WIFI_NATIVE = 0, // wifi original power save behavior
- BTC_PS_LPS_ON = 1,
- BTC_PS_LPS_OFF = 2,
- BTC_PS_MAX
-} BTC_POWERSAVE_TYPE, *PBTC_POWERSAVE_TYPE;
-
-typedef enum _BTC_CHIP_INTERFACE{
- BTC_INTF_UNKNOWN = 0,
- BTC_INTF_PCI = 1,
- BTC_INTF_USB = 2,
- BTC_INTF_SDIO = 3,
- BTC_INTF_MAX
-} BTC_CHIP_INTERFACE, *PBTC_CHIP_INTERFACE;
-
-typedef enum _BTC_CHIP_TYPE{
- BTC_CHIP_UNDEF = 0,
- BTC_CHIP_CSR_BC4 = 1,
- BTC_CHIP_CSR_BC8 = 2,
- BTC_CHIP_RTL8723A = 3,
- BTC_CHIP_RTL8821 = 4,
- BTC_CHIP_RTL8723B = 5,
- BTC_CHIP_MAX
-} BTC_CHIP_TYPE, *PBTC_CHIP_TYPE;
-
-typedef enum _BTC_MSG_TYPE{
- BTC_MSG_INTERFACE = 0x0,
- BTC_MSG_ALGORITHM = 0x1,
- BTC_MSG_MAX
-}BTC_MSG_TYPE;
-extern u4Byte GLBtcDbgType[];
-
-// following is for BTC_MSG_INTERFACE
-#define INTF_INIT BIT0
-#define INTF_NOTIFY BIT2
-
-// following is for BTC_ALGORITHM
-#define ALGO_BT_RSSI_STATE BIT0
-#define ALGO_WIFI_RSSI_STATE BIT1
-#define ALGO_BT_MONITOR BIT2
-#define ALGO_TRACE BIT3
-#define ALGO_TRACE_FW BIT4
-#define ALGO_TRACE_FW_DETAIL BIT5
-#define ALGO_TRACE_FW_EXEC BIT6
-#define ALGO_TRACE_SW BIT7
-#define ALGO_TRACE_SW_DETAIL BIT8
-#define ALGO_TRACE_SW_EXEC BIT9
-
-// following is for wifi link status
-#define WIFI_STA_CONNECTED BIT0
-#define WIFI_AP_CONNECTED BIT1
-#define WIFI_HS_CONNECTED BIT2
-#define WIFI_P2P_GO_CONNECTED BIT3
-#define WIFI_P2P_GC_CONNECTED BIT4
-
-// following is for command line utility
-#define CL_SPRINTF rsprintf
-#define CL_PRINTF DCMD_Printf
-
-// The following is for dbgview print
-#if DBG
-#define BTC_PRINT(dbgtype, dbgflag, printstr)\
-{\
- if (GLBtcDbgType[dbgtype] & dbgflag)\
- {\
- DbgPrint printstr;\
- }\
-}
-
-#define BTC_PRINT_F(dbgtype, dbgflag, printstr)\
-{\
- if (GLBtcDbgType[dbgtype] & dbgflag)\
- {\
- DbgPrint("%s(): ", __FUNCTION__);\
- DbgPrint printstr;\
- }\
-}
-
-#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)\
-{\
- if (GLBtcDbgType[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 BTC_PRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)\
-{\
- if (GLBtcDbgType[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"); \
- }\
-}
-
-#else
-#define BTC_PRINT(dbgtype, dbgflag, printstr)
-#define BTC_PRINT_F(dbgtype, dbgflag, printstr)
-#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)
-#define BTC_PRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)
-#endif
-
-typedef struct _BTC_BOARD_INFO{
- // The following is some board information
- u1Byte btChipType;
- 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;
-} BTC_BOARD_INFO, *PBTC_BOARD_INFO;
-
-typedef enum _BTC_DBG_OPCODE{
- BTC_DBG_SET_COEX_NORMAL = 0x0,
- BTC_DBG_SET_COEX_WIFI_ONLY = 0x1,
- BTC_DBG_SET_COEX_BT_ONLY = 0x2,
- BTC_DBG_SET_COEX_DEC_BT_PWR = 0x3,
- BTC_DBG_SET_COEX_BT_AFH_MAP = 0x4,
- BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT = 0x5,
- BTC_DBG_MAX
-}BTC_DBG_OPCODE,*PBTC_DBG_OPCODE;
-
-typedef enum _BTC_RSSI_STATE{
- BTC_RSSI_STATE_HIGH = 0x0,
- BTC_RSSI_STATE_MEDIUM = 0x1,
- BTC_RSSI_STATE_LOW = 0x2,
- BTC_RSSI_STATE_STAY_HIGH = 0x3,
- BTC_RSSI_STATE_STAY_MEDIUM = 0x4,
- BTC_RSSI_STATE_STAY_LOW = 0x5,
- BTC_RSSI_MAX
-}BTC_RSSI_STATE,*PBTC_RSSI_STATE;
-#define BTC_RSSI_HIGH(_rssi_) ((_rssi_==BTC_RSSI_STATE_HIGH||_rssi_==BTC_RSSI_STATE_STAY_HIGH)? TRUE:FALSE)
-#define BTC_RSSI_MEDIUM(_rssi_) ((_rssi_==BTC_RSSI_STATE_MEDIUM||_rssi_==BTC_RSSI_STATE_STAY_MEDIUM)? TRUE:FALSE)
-#define BTC_RSSI_LOW(_rssi_) ((_rssi_==BTC_RSSI_STATE_LOW||_rssi_==BTC_RSSI_STATE_STAY_LOW)? TRUE:FALSE)
-
-typedef enum _BTC_WIFI_ROLE{
- BTC_ROLE_STATION = 0x0,
- BTC_ROLE_AP = 0x1,
- BTC_ROLE_IBSS = 0x2,
- BTC_ROLE_HS_MODE = 0x3,
- BTC_ROLE_MAX
-}BTC_WIFI_ROLE,*PBTC_WIFI_ROLE;
-
-typedef enum _BTC_WIFI_BW_MODE{
- BTC_WIFI_BW_LEGACY = 0x0,
- BTC_WIFI_BW_HT20 = 0x1,
- BTC_WIFI_BW_HT40 = 0x2,
- BTC_WIFI_BW_MAX
-}BTC_WIFI_BW_MODE,*PBTC_WIFI_BW_MODE;
-
-typedef enum _BTC_WIFI_TRAFFIC_DIR{
- BTC_WIFI_TRAFFIC_TX = 0x0,
- BTC_WIFI_TRAFFIC_RX = 0x1,
- BTC_WIFI_TRAFFIC_MAX
-}BTC_WIFI_TRAFFIC_DIR,*PBTC_WIFI_TRAFFIC_DIR;
-
-typedef enum _BTC_WIFI_PNP{
- BTC_WIFI_PNP_WAKE_UP = 0x0,
- BTC_WIFI_PNP_SLEEP = 0x1,
- BTC_WIFI_PNP_MAX
-}BTC_WIFI_PNP,*PBTC_WIFI_PNP;
-
-// defined for BFP_BTC_GET
-typedef enum _BTC_GET_TYPE{
- // type BOOLEAN
- BTC_GET_BL_HS_OPERATION,
- BTC_GET_BL_HS_CONNECTING,
- BTC_GET_BL_WIFI_CONNECTED,
- BTC_GET_BL_WIFI_BUSY,
- BTC_GET_BL_WIFI_SCAN,
- BTC_GET_BL_WIFI_LINK,
- BTC_GET_BL_WIFI_ROAM,
- BTC_GET_BL_WIFI_4_WAY_PROGRESS,
- BTC_GET_BL_WIFI_UNDER_5G,
- BTC_GET_BL_WIFI_AP_MODE_ENABLE,
- BTC_GET_BL_WIFI_ENABLE_ENCRYPTION,
- BTC_GET_BL_WIFI_UNDER_B_MODE,
- BTC_GET_BL_EXT_SWITCH,
-
- // type s4Byte
- BTC_GET_S4_WIFI_RSSI,
- BTC_GET_S4_HS_RSSI,
-
- // type u4Byte
- BTC_GET_U4_WIFI_BW,
- BTC_GET_U4_WIFI_TRAFFIC_DIRECTION,
- BTC_GET_U4_WIFI_FW_VER,
- BTC_GET_U4_WIFI_LINK_STATUS,
- BTC_GET_U4_BT_PATCH_VER,
-
- // type u1Byte
- BTC_GET_U1_WIFI_DOT11_CHNL,
- BTC_GET_U1_WIFI_CENTRAL_CHNL,
- BTC_GET_U1_WIFI_HS_CHNL,
- BTC_GET_U1_MAC_PHY_MODE,
- BTC_GET_U1_AP_NUM,
-
- //===== for 1Ant ======
- BTC_GET_U1_LPS_MODE,
-
- BTC_GET_MAX
-}BTC_GET_TYPE,*PBTC_GET_TYPE;
-
-// defined for BFP_BTC_SET
-typedef enum _BTC_SET_TYPE{
- // type BOOLEAN
- BTC_SET_BL_BT_DISABLE,
- BTC_SET_BL_BT_TRAFFIC_BUSY,
- BTC_SET_BL_BT_LIMITED_DIG,
- BTC_SET_BL_FORCE_TO_ROAM,
- BTC_SET_BL_TO_REJ_AP_AGG_PKT,
- BTC_SET_BL_BT_CTRL_AGG_SIZE,
- BTC_SET_BL_INC_SCAN_DEV_NUM,
-
- // type u1Byte
- BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON,
- BTC_SET_U1_AGG_BUF_SIZE,
-
- // type trigger some action
- BTC_SET_ACT_GET_BT_RSSI,
- BTC_SET_ACT_AGGREGATE_CTRL,
- //===== for 1Ant ======
- // type BOOLEAN
-
- // type u1Byte
- BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE,
- BTC_SET_U1_LPS_VAL,
- BTC_SET_U1_RPWM_VAL,
- // type trigger some action
- BTC_SET_ACT_LEAVE_LPS,
- BTC_SET_ACT_ENTER_LPS,
- BTC_SET_ACT_NORMAL_LPS,
- BTC_SET_ACT_DISABLE_LOW_POWER,
- BTC_SET_ACT_UPDATE_RAMASK,
- BTC_SET_ACT_SEND_MIMO_PS,
- // BT Coex related
- BTC_SET_ACT_CTRL_BT_INFO,
- BTC_SET_ACT_CTRL_BT_COEX,
- //=================
- BTC_SET_MAX
-}BTC_SET_TYPE,*PBTC_SET_TYPE;
-
-typedef enum _BTC_DBG_DISP_TYPE{
- BTC_DBG_DISP_COEX_STATISTICS = 0x0,
- BTC_DBG_DISP_BT_LINK_INFO = 0x1,
- BTC_DBG_DISP_FW_PWR_MODE_CMD = 0x2,
- BTC_DBG_DISP_MAX
-}BTC_DBG_DISP_TYPE,*PBTC_DBG_DISP_TYPE;
-
-typedef enum _BTC_NOTIFY_TYPE_IPS{
- BTC_IPS_LEAVE = 0x0,
- BTC_IPS_ENTER = 0x1,
- BTC_IPS_MAX
-}BTC_NOTIFY_TYPE_IPS,*PBTC_NOTIFY_TYPE_IPS;
-typedef enum _BTC_NOTIFY_TYPE_LPS{
- BTC_LPS_DISABLE = 0x0,
- BTC_LPS_ENABLE = 0x1,
- BTC_LPS_MAX
-}BTC_NOTIFY_TYPE_LPS,*PBTC_NOTIFY_TYPE_LPS;
-typedef enum _BTC_NOTIFY_TYPE_SCAN{
- BTC_SCAN_FINISH = 0x0,
- BTC_SCAN_START = 0x1,
- BTC_SCAN_MAX
-}BTC_NOTIFY_TYPE_SCAN,*PBTC_NOTIFY_TYPE_SCAN;
-typedef enum _BTC_NOTIFY_TYPE_ASSOCIATE{
- BTC_ASSOCIATE_FINISH = 0x0,
- BTC_ASSOCIATE_START = 0x1,
- BTC_ASSOCIATE_MAX
-}BTC_NOTIFY_TYPE_ASSOCIATE,*PBTC_NOTIFY_TYPE_ASSOCIATE;
-typedef enum _BTC_NOTIFY_TYPE_MEDIA_STATUS{
- BTC_MEDIA_DISCONNECT = 0x0,
- BTC_MEDIA_CONNECT = 0x1,
- BTC_MEDIA_MAX
-}BTC_NOTIFY_TYPE_MEDIA_STATUS,*PBTC_NOTIFY_TYPE_MEDIA_STATUS;
-typedef enum _BTC_NOTIFY_TYPE_SPECIAL_PACKET{
- BTC_PACKET_UNKNOWN = 0x0,
- BTC_PACKET_DHCP = 0x1,
- BTC_PACKET_ARP = 0x2,
- BTC_PACKET_EAPOL = 0x3,
- BTC_PACKET_MAX
-}BTC_NOTIFY_TYPE_SPECIAL_PACKET,*PBTC_NOTIFY_TYPE_SPECIAL_PACKET;
-typedef enum _BTC_NOTIFY_TYPE_STACK_OPERATION{
- BTC_STACK_OP_NONE = 0x0,
- BTC_STACK_OP_INQ_PAGE_PAIR_START = 0x1,
- BTC_STACK_OP_INQ_PAGE_PAIR_FINISH = 0x2,
- BTC_STACK_OP_MAX
-}BTC_NOTIFY_TYPE_STACK_OPERATION,*PBTC_NOTIFY_TYPE_STACK_OPERATION;
-
-//Bryant Add
-typedef enum _BTC_ANTENNA_POS{
- BTC_ANTENNA_AT_MAIN_PORT = 0x1,
- BTC_ANTENNA_AT_AUX_PORT = 0x2,
-}BTC_ANTENNA_POS,*PBTC_ANTENNA_POS;
-
-typedef u1Byte
-(*BFP_BTC_R1)(
- IN PVOID pBtcContext,
- IN u4Byte RegAddr
- );
-typedef u2Byte
-(*BFP_BTC_R2)(
- IN PVOID pBtcContext,
- IN u4Byte RegAddr
- );
-typedef u4Byte
-(*BFP_BTC_R4)(
- IN PVOID pBtcContext,
- IN u4Byte RegAddr
- );
-typedef VOID
-(*BFP_BTC_W1)(
- IN PVOID pBtcContext,
- IN u4Byte RegAddr,
- IN u1Byte Data
- );
-typedef VOID
-(*BFP_BTC_W1_BIT_MASK)(
- IN PVOID pBtcContext,
- IN u4Byte regAddr,
- IN u1Byte bitMask,
- IN u1Byte data1b
- );
-typedef VOID
-(*BFP_BTC_W2)(
- IN PVOID pBtcContext,
- IN u4Byte RegAddr,
- IN u2Byte Data
- );
-typedef VOID
-(*BFP_BTC_W4)(
- IN PVOID pBtcContext,
- IN u4Byte RegAddr,
- IN u4Byte Data
- );
-typedef VOID
-(*BFP_BTC_SET_BB_REG)(
- IN PVOID pBtcContext,
- IN u4Byte RegAddr,
- IN u4Byte BitMask,
- IN u4Byte Data
- );
-typedef u4Byte
-(*BFP_BTC_GET_BB_REG)(
- IN PVOID pBtcContext,
- IN u4Byte RegAddr,
- IN u4Byte BitMask
- );
-typedef VOID
-(*BFP_BTC_SET_RF_REG)(
- IN PVOID pBtcContext,
- IN u1Byte eRFPath,
- IN u4Byte RegAddr,
- IN u4Byte BitMask,
- IN u4Byte Data
- );
-typedef u4Byte
-(*BFP_BTC_GET_RF_REG)(
- IN PVOID pBtcContext,
- IN u1Byte eRFPath,
- IN u4Byte RegAddr,
- IN u4Byte BitMask
- );
-typedef VOID
-(*BFP_BTC_SET_BT_REG)(
- IN PVOID pBtcContext,
- IN u1Byte RegType,
- IN u4Byte RegAddr,
- IN u4Byte Data
- );
-typedef VOID
-(*BFP_BTC_FILL_H2C)(
- IN PVOID pBtcContext,
- IN u1Byte elementId,
- IN u4Byte cmdLen,
- IN pu1Byte pCmdBuffer
- );
-
-typedef BOOLEAN
-(*BFP_BTC_GET)(
- IN PVOID pBtCoexist,
- IN u1Byte getType,
- OUT PVOID pOutBuf
- );
-
-typedef BOOLEAN
-(*BFP_BTC_SET)(
- IN PVOID pBtCoexist,
- IN u1Byte setType,
- OUT PVOID pInBuf
- );
-typedef VOID
-(*BFP_BTC_DISP_DBG_MSG)(
- IN PVOID pBtCoexist,
- IN u1Byte dispType
- );
-
-typedef struct _BTC_BT_INFO{
- BOOLEAN bBtDisabled;
- u1Byte rssiAdjustForAgcTableOn;
- u1Byte rssiAdjustFor1AntCoexType;
- BOOLEAN bPreBtCtrlAggBufSize;
- BOOLEAN bBtCtrlAggBufSize;
- BOOLEAN bRejectAggPkt;
- BOOLEAN bIncreaseScanDevNum;
- u1Byte preAggBufSize;
- u1Byte aggBufSize;
- BOOLEAN bBtBusy;
- BOOLEAN bLimitedDig;
- u2Byte btHciVer;
- u2Byte btRealFwVer;
- u1Byte btFwVer;
-
- BOOLEAN bBtDisableLowPwr;
-
- BOOLEAN bBtCtrlLps;
- BOOLEAN bBtLpsOn;
- BOOLEAN bForceToRoam; // for 1Ant solution
- u1Byte lpsVal;
- u1Byte rpwmVal;
- u4Byte raMask;
-} BTC_BT_INFO, *PBTC_BT_INFO;
-
-typedef struct _BTC_STACK_INFO{
- BOOLEAN bProfileNotified;
- u2Byte hciVersion; // stack hci version
- u1Byte numOfLink;
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bAclExist;
- BOOLEAN bA2dpExist;
- BOOLEAN bHidExist;
- u1Byte numOfHid;
- BOOLEAN bPanExist;
- BOOLEAN bUnknownAclExist;
- s1Byte minBtRssi;
-} BTC_STACK_INFO, *PBTC_STACK_INFO;
-
-typedef struct _BTC_BT_LINK_INFO{
- BOOLEAN bBtLinkExist;
- BOOLEAN bScoExist;
- BOOLEAN bScoOnly;
- BOOLEAN bA2dpExist;
- BOOLEAN bA2dpOnly;
- BOOLEAN bHidExist;
- BOOLEAN bHidOnly;
- BOOLEAN bPanExist;
- BOOLEAN bPanOnly;
-} BTC_BT_LINK_INFO, *PBTC_BT_LINK_INFO;
-
-typedef struct _BTC_STATISTICS{
- u4Byte cntBind;
- u4Byte cntInitHwConfig;
- u4Byte cntInitCoexDm;
- u4Byte cntIpsNotify;
- u4Byte cntLpsNotify;
- u4Byte cntScanNotify;
- u4Byte cntConnectNotify;
- u4Byte cntMediaStatusNotify;
- u4Byte cntSpecialPacketNotify;
- u4Byte cntBtInfoNotify;
- u4Byte cntPeriodical;
- u4Byte cntCoexDmSwitch;
- u4Byte cntStackOperationNotify;
- u4Byte cntDbgCtrl;
-} BTC_STATISTICS, *PBTC_STATISTICS;
-
-typedef struct _BTC_COEXIST{
- BOOLEAN bBinded; // make sure only one adapter can bind the data context
- PVOID Adapter; // default adapter
- BTC_BOARD_INFO boardInfo;
- BTC_BT_INFO btInfo; // some bt info referenced by non-bt module
- BTC_STACK_INFO stackInfo;
- BTC_BT_LINK_INFO btLinkInfo;
- BTC_CHIP_INTERFACE chipInterface;
-
- BOOLEAN bInitilized;
- BOOLEAN bStopCoexDm;
- BOOLEAN bManualControl;
- pu1Byte cliBuf;
- BTC_STATISTICS statistics;
- u1Byte pwrModeVal[10];
-
- // function pointers
- // io related
- BFP_BTC_R1 fBtcRead1Byte;
- BFP_BTC_W1 fBtcWrite1Byte;
- BFP_BTC_W1_BIT_MASK fBtcWrite1ByteBitMask;
- BFP_BTC_R2 fBtcRead2Byte;
- BFP_BTC_W2 fBtcWrite2Byte;
- BFP_BTC_R4 fBtcRead4Byte;
- BFP_BTC_W4 fBtcWrite4Byte;
- // read/write bb related
- BFP_BTC_SET_BB_REG fBtcSetBbReg;
- BFP_BTC_GET_BB_REG fBtcGetBbReg;
-
- // read/write rf related
- BFP_BTC_SET_RF_REG fBtcSetRfReg;
- BFP_BTC_GET_RF_REG fBtcGetRfReg;
-
- //write bt reg related
- BFP_BTC_SET_BT_REG fBtcSetBtReg;
-
- // fill h2c related
- BFP_BTC_FILL_H2C fBtcFillH2c;
- // other
- BFP_BTC_DISP_DBG_MSG fBtcDispDbgMsg;
- // normal get/set related
- BFP_BTC_GET fBtcGet;
- BFP_BTC_SET fBtcSet;
-} BTC_COEXIST, *PBTC_COEXIST;
-
-extern BTC_COEXIST GLBtCoexist;
-
-BOOLEAN
-EXhalbtcoutsrc_InitlizeVariables(
- IN PVOID Adapter
- );
-VOID
-EXhalbtcoutsrc_InitHwConfig(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtcoutsrc_InitCoexDm(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtcoutsrc_IpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtcoutsrc_LpsNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtcoutsrc_ScanNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtcoutsrc_ConnectNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte action
- );
-VOID
-EXhalbtcoutsrc_MediaStatusNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN RT_MEDIA_STATUS mediaStatus
- );
-VOID
-EXhalbtcoutsrc_SpecialPacketNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte pktType
- );
-VOID
-EXhalbtcoutsrc_BtInfoNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN pu1Byte tmpBuf,
- IN u1Byte length
- );
-VOID
-EXhalbtcoutsrc_StackOperationNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte type
- );
-VOID
-EXhalbtcoutsrc_HaltNotify(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtcoutsrc_SwitchGntBt(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtcoutsrc_PnpNotify(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte pnpState
- );
-VOID
-EXhalbtcoutsrc_CoexDmSwitch(
- IN PBTC_COEXIST pBtCoexist,
- IN BOOLEAN antInverse
- );
-VOID
-EXhalbtcoutsrc_Periodical(
- IN PBTC_COEXIST pBtCoexist
- );
-VOID
-EXhalbtcoutsrc_DbgControl(
- IN PBTC_COEXIST pBtCoexist,
- IN u1Byte opCode,
- IN u1Byte opLen,
- IN pu1Byte pData
- );
-VOID
-EXhalbtcoutsrc_StackUpdateProfileInfo(
- VOID
- );
-VOID
-EXhalbtcoutsrc_SetHciVersion(
- IN u2Byte hciVersion
- );
-VOID
-EXhalbtcoutsrc_SetBtPatchVersion(
- IN u2Byte btHciVersion,
- IN u2Byte btPatchVersion
- );
-VOID
-EXhalbtcoutsrc_UpdateMinBtRssi(
- IN s1Byte btRssi
- );
-VOID
-EXhalbtcoutsrc_SetBtExist(
- IN BOOLEAN bBtExist
- );
-VOID
-EXhalbtcoutsrc_SetChipType(
- IN u1Byte chipType
- );
-VOID
-EXhalbtcoutsrc_SetAntNum(
- IN u1Byte type,
- IN u1Byte antNum,
- IN BOOLEAN antInverse
- );
-VOID
-EXhalbtcoutsrc_DisplayBtCoexInfo(
- IN PBTC_COEXIST pBtCoexist
- );
-
-#endif
+#ifndef __HALBTC_OUT_SRC_H__
+#define __HALBTC_OUT_SRC_H__
+
+#define NORMAL_EXEC FALSE
+#define FORCE_EXEC TRUE
+
+#define BTC_RF_A 0x0
+#define BTC_RF_B 0x1
+#define BTC_RF_C 0x2
+#define BTC_RF_D 0x3
+
+#define BTC_SMSP SINGLEMAC_SINGLEPHY
+#define BTC_DMDP DUALMAC_DUALPHY
+#define BTC_DMSP DUALMAC_SINGLEPHY
+#define BTC_MP_UNKNOWN 0xff
+
+#define BT_COEX_ANT_TYPE_PG 0
+#define BT_COEX_ANT_TYPE_ANTDIV 1
+#define BT_COEX_ANT_TYPE_DETECTED 2
+
+#define BTC_MIMO_PS_STATIC 0 // 1ss
+#define BTC_MIMO_PS_DYNAMIC 1 // 2ss
+
+#define BTC_RATE_DISABLE 0
+#define BTC_RATE_ENABLE 1
+
+// single Antenna definition
+#define BTC_ANT_PATH_WIFI 0
+#define BTC_ANT_PATH_BT 1
+#define BTC_ANT_PATH_PTA 2
+// dual Antenna definition
+#define BTC_ANT_WIFI_AT_MAIN 0
+#define BTC_ANT_WIFI_AT_AUX 1
+// coupler Antenna definition
+#define BTC_ANT_WIFI_AT_CPL_MAIN 0
+#define BTC_ANT_WIFI_AT_CPL_AUX 1
+
+typedef enum _BTC_POWERSAVE_TYPE{
+ BTC_PS_WIFI_NATIVE = 0, // wifi original power save behavior
+ BTC_PS_LPS_ON = 1,
+ BTC_PS_LPS_OFF = 2,
+ BTC_PS_MAX
+} BTC_POWERSAVE_TYPE, *PBTC_POWERSAVE_TYPE;
+
+typedef enum _BTC_CHIP_INTERFACE{
+ BTC_INTF_UNKNOWN = 0,
+ BTC_INTF_PCI = 1,
+ BTC_INTF_USB = 2,
+ BTC_INTF_SDIO = 3,
+ BTC_INTF_MAX
+} BTC_CHIP_INTERFACE, *PBTC_CHIP_INTERFACE;
+
+typedef enum _BTC_CHIP_TYPE{
+ BTC_CHIP_UNDEF = 0,
+ BTC_CHIP_CSR_BC4 = 1,
+ BTC_CHIP_CSR_BC8 = 2,
+ BTC_CHIP_RTL8723A = 3,
+ BTC_CHIP_RTL8821 = 4,
+ BTC_CHIP_RTL8723B = 5,
+ BTC_CHIP_MAX
+} BTC_CHIP_TYPE, *PBTC_CHIP_TYPE;
+
+typedef enum _BTC_MSG_TYPE{
+ BTC_MSG_INTERFACE = 0x0,
+ BTC_MSG_ALGORITHM = 0x1,
+ BTC_MSG_MAX
+}BTC_MSG_TYPE;
+extern u4Byte GLBtcDbgType[];
+
+// following is for BTC_MSG_INTERFACE
+#define INTF_INIT BIT0
+#define INTF_NOTIFY BIT2
+
+// following is for BTC_ALGORITHM
+#define ALGO_BT_RSSI_STATE BIT0
+#define ALGO_WIFI_RSSI_STATE BIT1
+#define ALGO_BT_MONITOR BIT2
+#define ALGO_TRACE BIT3
+#define ALGO_TRACE_FW BIT4
+#define ALGO_TRACE_FW_DETAIL BIT5
+#define ALGO_TRACE_FW_EXEC BIT6
+#define ALGO_TRACE_SW BIT7
+#define ALGO_TRACE_SW_DETAIL BIT8
+#define ALGO_TRACE_SW_EXEC BIT9
+
+// following is for wifi link status
+#define WIFI_STA_CONNECTED BIT0
+#define WIFI_AP_CONNECTED BIT1
+#define WIFI_HS_CONNECTED BIT2
+#define WIFI_P2P_GO_CONNECTED BIT3
+#define WIFI_P2P_GC_CONNECTED BIT4
+
+// following is for command line utility
+#define CL_SPRINTF rsprintf
+#define CL_PRINTF DCMD_Printf
+
+// The following is for dbgview print
+#if DBG
+#define BTC_PRINT(dbgtype, dbgflag, printstr)\
+{\
+ if (GLBtcDbgType[dbgtype] & dbgflag)\
+ {\
+ DbgPrint printstr;\
+ }\
+}
+
+#define BTC_PRINT_F(dbgtype, dbgflag, printstr)\
+{\
+ if (GLBtcDbgType[dbgtype] & dbgflag)\
+ {\
+ DbgPrint("%s(): ", __FUNCTION__);\
+ DbgPrint printstr;\
+ }\
+}
+
+#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)\
+{\
+ if (GLBtcDbgType[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 BTC_PRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)\
+{\
+ if (GLBtcDbgType[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"); \
+ }\
+}
+
+#else
+#define BTC_PRINT(dbgtype, dbgflag, printstr)
+#define BTC_PRINT_F(dbgtype, dbgflag, printstr)
+#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)
+#define BTC_PRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)
+#endif
+
+typedef struct _BTC_BOARD_INFO{
+ // The following is some board information
+ u1Byte btChipType;
+ 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;
+} BTC_BOARD_INFO, *PBTC_BOARD_INFO;
+
+typedef enum _BTC_DBG_OPCODE{
+ BTC_DBG_SET_COEX_NORMAL = 0x0,
+ BTC_DBG_SET_COEX_WIFI_ONLY = 0x1,
+ BTC_DBG_SET_COEX_BT_ONLY = 0x2,
+ BTC_DBG_SET_COEX_DEC_BT_PWR = 0x3,
+ BTC_DBG_SET_COEX_BT_AFH_MAP = 0x4,
+ BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT = 0x5,
+ BTC_DBG_MAX
+}BTC_DBG_OPCODE,*PBTC_DBG_OPCODE;
+
+typedef enum _BTC_RSSI_STATE{
+ BTC_RSSI_STATE_HIGH = 0x0,
+ BTC_RSSI_STATE_MEDIUM = 0x1,
+ BTC_RSSI_STATE_LOW = 0x2,
+ BTC_RSSI_STATE_STAY_HIGH = 0x3,
+ BTC_RSSI_STATE_STAY_MEDIUM = 0x4,
+ BTC_RSSI_STATE_STAY_LOW = 0x5,
+ BTC_RSSI_MAX
+}BTC_RSSI_STATE,*PBTC_RSSI_STATE;
+#define BTC_RSSI_HIGH(_rssi_) ((_rssi_==BTC_RSSI_STATE_HIGH||_rssi_==BTC_RSSI_STATE_STAY_HIGH)? TRUE:FALSE)
+#define BTC_RSSI_MEDIUM(_rssi_) ((_rssi_==BTC_RSSI_STATE_MEDIUM||_rssi_==BTC_RSSI_STATE_STAY_MEDIUM)? TRUE:FALSE)
+#define BTC_RSSI_LOW(_rssi_) ((_rssi_==BTC_RSSI_STATE_LOW||_rssi_==BTC_RSSI_STATE_STAY_LOW)? TRUE:FALSE)
+
+typedef enum _BTC_WIFI_ROLE{
+ BTC_ROLE_STATION = 0x0,
+ BTC_ROLE_AP = 0x1,
+ BTC_ROLE_IBSS = 0x2,
+ BTC_ROLE_HS_MODE = 0x3,
+ BTC_ROLE_MAX
+}BTC_WIFI_ROLE,*PBTC_WIFI_ROLE;
+
+typedef enum _BTC_WIFI_BW_MODE{
+ BTC_WIFI_BW_LEGACY = 0x0,
+ BTC_WIFI_BW_HT20 = 0x1,
+ BTC_WIFI_BW_HT40 = 0x2,
+ BTC_WIFI_BW_MAX
+}BTC_WIFI_BW_MODE,*PBTC_WIFI_BW_MODE;
+
+typedef enum _BTC_WIFI_TRAFFIC_DIR{
+ BTC_WIFI_TRAFFIC_TX = 0x0,
+ BTC_WIFI_TRAFFIC_RX = 0x1,
+ BTC_WIFI_TRAFFIC_MAX
+}BTC_WIFI_TRAFFIC_DIR,*PBTC_WIFI_TRAFFIC_DIR;
+
+typedef enum _BTC_WIFI_PNP{
+ BTC_WIFI_PNP_WAKE_UP = 0x0,
+ BTC_WIFI_PNP_SLEEP = 0x1,
+ BTC_WIFI_PNP_MAX
+}BTC_WIFI_PNP,*PBTC_WIFI_PNP;
+
+// defined for BFP_BTC_GET
+typedef enum _BTC_GET_TYPE{
+ // type BOOLEAN
+ BTC_GET_BL_HS_OPERATION,
+ BTC_GET_BL_HS_CONNECTING,
+ BTC_GET_BL_WIFI_CONNECTED,
+ BTC_GET_BL_WIFI_BUSY,
+ BTC_GET_BL_WIFI_SCAN,
+ BTC_GET_BL_WIFI_LINK,
+ BTC_GET_BL_WIFI_ROAM,
+ BTC_GET_BL_WIFI_4_WAY_PROGRESS,
+ BTC_GET_BL_WIFI_UNDER_5G,
+ BTC_GET_BL_WIFI_AP_MODE_ENABLE,
+ BTC_GET_BL_WIFI_ENABLE_ENCRYPTION,
+ BTC_GET_BL_WIFI_UNDER_B_MODE,
+ BTC_GET_BL_EXT_SWITCH,
+
+ // type s4Byte
+ BTC_GET_S4_WIFI_RSSI,
+ BTC_GET_S4_HS_RSSI,
+
+ // type u4Byte
+ BTC_GET_U4_WIFI_BW,
+ BTC_GET_U4_WIFI_TRAFFIC_DIRECTION,
+ BTC_GET_U4_WIFI_FW_VER,
+ BTC_GET_U4_WIFI_LINK_STATUS,
+ BTC_GET_U4_BT_PATCH_VER,
+
+ // type u1Byte
+ BTC_GET_U1_WIFI_DOT11_CHNL,
+ BTC_GET_U1_WIFI_CENTRAL_CHNL,
+ BTC_GET_U1_WIFI_HS_CHNL,
+ BTC_GET_U1_MAC_PHY_MODE,
+ BTC_GET_U1_AP_NUM,
+
+ //===== for 1Ant ======
+ BTC_GET_U1_LPS_MODE,
+
+ BTC_GET_MAX
+}BTC_GET_TYPE,*PBTC_GET_TYPE;
+
+// defined for BFP_BTC_SET
+typedef enum _BTC_SET_TYPE{
+ // type BOOLEAN
+ BTC_SET_BL_BT_DISABLE,
+ BTC_SET_BL_BT_TRAFFIC_BUSY,
+ BTC_SET_BL_BT_LIMITED_DIG,
+ BTC_SET_BL_FORCE_TO_ROAM,
+ BTC_SET_BL_TO_REJ_AP_AGG_PKT,
+ BTC_SET_BL_BT_CTRL_AGG_SIZE,
+ BTC_SET_BL_INC_SCAN_DEV_NUM,
+
+ // type u1Byte
+ BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON,
+ BTC_SET_U1_AGG_BUF_SIZE,
+
+ // type trigger some action
+ BTC_SET_ACT_GET_BT_RSSI,
+ BTC_SET_ACT_AGGREGATE_CTRL,
+ //===== for 1Ant ======
+ // type BOOLEAN
+
+ // type u1Byte
+ BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE,
+ BTC_SET_U1_LPS_VAL,
+ BTC_SET_U1_RPWM_VAL,
+ // type trigger some action
+ BTC_SET_ACT_LEAVE_LPS,
+ BTC_SET_ACT_ENTER_LPS,
+ BTC_SET_ACT_NORMAL_LPS,
+ BTC_SET_ACT_DISABLE_LOW_POWER,
+ BTC_SET_ACT_UPDATE_RAMASK,
+ BTC_SET_ACT_SEND_MIMO_PS,
+ // BT Coex related
+ BTC_SET_ACT_CTRL_BT_INFO,
+ BTC_SET_ACT_CTRL_BT_COEX,
+ //=================
+ BTC_SET_MAX
+}BTC_SET_TYPE,*PBTC_SET_TYPE;
+
+typedef enum _BTC_DBG_DISP_TYPE{
+ BTC_DBG_DISP_COEX_STATISTICS = 0x0,
+ BTC_DBG_DISP_BT_LINK_INFO = 0x1,
+ BTC_DBG_DISP_FW_PWR_MODE_CMD = 0x2,
+ BTC_DBG_DISP_MAX
+}BTC_DBG_DISP_TYPE,*PBTC_DBG_DISP_TYPE;
+
+typedef enum _BTC_NOTIFY_TYPE_IPS{
+ BTC_IPS_LEAVE = 0x0,
+ BTC_IPS_ENTER = 0x1,
+ BTC_IPS_MAX
+}BTC_NOTIFY_TYPE_IPS,*PBTC_NOTIFY_TYPE_IPS;
+typedef enum _BTC_NOTIFY_TYPE_LPS{
+ BTC_LPS_DISABLE = 0x0,
+ BTC_LPS_ENABLE = 0x1,
+ BTC_LPS_MAX
+}BTC_NOTIFY_TYPE_LPS,*PBTC_NOTIFY_TYPE_LPS;
+typedef enum _BTC_NOTIFY_TYPE_SCAN{
+ BTC_SCAN_FINISH = 0x0,
+ BTC_SCAN_START = 0x1,
+ BTC_SCAN_MAX
+}BTC_NOTIFY_TYPE_SCAN,*PBTC_NOTIFY_TYPE_SCAN;
+typedef enum _BTC_NOTIFY_TYPE_ASSOCIATE{
+ BTC_ASSOCIATE_FINISH = 0x0,
+ BTC_ASSOCIATE_START = 0x1,
+ BTC_ASSOCIATE_MAX
+}BTC_NOTIFY_TYPE_ASSOCIATE,*PBTC_NOTIFY_TYPE_ASSOCIATE;
+typedef enum _BTC_NOTIFY_TYPE_MEDIA_STATUS{
+ BTC_MEDIA_DISCONNECT = 0x0,
+ BTC_MEDIA_CONNECT = 0x1,
+ BTC_MEDIA_MAX
+}BTC_NOTIFY_TYPE_MEDIA_STATUS,*PBTC_NOTIFY_TYPE_MEDIA_STATUS;
+typedef enum _BTC_NOTIFY_TYPE_SPECIAL_PACKET{
+ BTC_PACKET_UNKNOWN = 0x0,
+ BTC_PACKET_DHCP = 0x1,
+ BTC_PACKET_ARP = 0x2,
+ BTC_PACKET_EAPOL = 0x3,
+ BTC_PACKET_MAX
+}BTC_NOTIFY_TYPE_SPECIAL_PACKET,*PBTC_NOTIFY_TYPE_SPECIAL_PACKET;
+typedef enum _BTC_NOTIFY_TYPE_STACK_OPERATION{
+ BTC_STACK_OP_NONE = 0x0,
+ BTC_STACK_OP_INQ_PAGE_PAIR_START = 0x1,
+ BTC_STACK_OP_INQ_PAGE_PAIR_FINISH = 0x2,
+ BTC_STACK_OP_MAX
+}BTC_NOTIFY_TYPE_STACK_OPERATION,*PBTC_NOTIFY_TYPE_STACK_OPERATION;
+
+//Bryant Add
+typedef enum _BTC_ANTENNA_POS{
+ BTC_ANTENNA_AT_MAIN_PORT = 0x1,
+ BTC_ANTENNA_AT_AUX_PORT = 0x2,
+}BTC_ANTENNA_POS,*PBTC_ANTENNA_POS;
+
+typedef u1Byte
+(*BFP_BTC_R1)(
+ IN PVOID pBtcContext,
+ IN u4Byte RegAddr
+ );
+typedef u2Byte
+(*BFP_BTC_R2)(
+ IN PVOID pBtcContext,
+ IN u4Byte RegAddr
+ );
+typedef u4Byte
+(*BFP_BTC_R4)(
+ IN PVOID pBtcContext,
+ IN u4Byte RegAddr
+ );
+typedef VOID
+(*BFP_BTC_W1)(
+ IN PVOID pBtcContext,
+ IN u4Byte RegAddr,
+ IN u1Byte Data
+ );
+typedef VOID
+(*BFP_BTC_W1_BIT_MASK)(
+ IN PVOID pBtcContext,
+ IN u4Byte regAddr,
+ IN u1Byte bitMask,
+ IN u1Byte data1b
+ );
+typedef VOID
+(*BFP_BTC_W2)(
+ IN PVOID pBtcContext,
+ IN u4Byte RegAddr,
+ IN u2Byte Data
+ );
+typedef VOID
+(*BFP_BTC_W4)(
+ IN PVOID pBtcContext,
+ IN u4Byte RegAddr,
+ IN u4Byte Data
+ );
+typedef VOID
+(*BFP_BTC_SET_BB_REG)(
+ IN PVOID pBtcContext,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask,
+ IN u4Byte Data
+ );
+typedef u4Byte
+(*BFP_BTC_GET_BB_REG)(
+ IN PVOID pBtcContext,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask
+ );
+typedef VOID
+(*BFP_BTC_SET_RF_REG)(
+ IN PVOID pBtcContext,
+ IN u1Byte eRFPath,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask,
+ IN u4Byte Data
+ );
+typedef u4Byte
+(*BFP_BTC_GET_RF_REG)(
+ IN PVOID pBtcContext,
+ IN u1Byte eRFPath,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask
+ );
+typedef VOID
+(*BFP_BTC_SET_BT_REG)(
+ IN PVOID pBtcContext,
+ IN u1Byte RegType,
+ IN u4Byte RegAddr,
+ IN u4Byte Data
+ );
+typedef VOID
+(*BFP_BTC_FILL_H2C)(
+ IN PVOID pBtcContext,
+ IN u1Byte elementId,
+ IN u4Byte cmdLen,
+ IN pu1Byte pCmdBuffer
+ );
+
+typedef BOOLEAN
+(*BFP_BTC_GET)(
+ IN PVOID pBtCoexist,
+ IN u1Byte getType,
+ OUT PVOID pOutBuf
+ );
+
+typedef BOOLEAN
+(*BFP_BTC_SET)(
+ IN PVOID pBtCoexist,
+ IN u1Byte setType,
+ OUT PVOID pInBuf
+ );
+typedef VOID
+(*BFP_BTC_DISP_DBG_MSG)(
+ IN PVOID pBtCoexist,
+ IN u1Byte dispType
+ );
+
+typedef struct _BTC_BT_INFO{
+ BOOLEAN bBtDisabled;
+ u1Byte rssiAdjustForAgcTableOn;
+ u1Byte rssiAdjustFor1AntCoexType;
+ BOOLEAN bPreBtCtrlAggBufSize;
+ BOOLEAN bBtCtrlAggBufSize;
+ BOOLEAN bRejectAggPkt;
+ BOOLEAN bIncreaseScanDevNum;
+ u1Byte preAggBufSize;
+ u1Byte aggBufSize;
+ BOOLEAN bBtBusy;
+ BOOLEAN bLimitedDig;
+ u2Byte btHciVer;
+ u2Byte btRealFwVer;
+ u1Byte btFwVer;
+
+ BOOLEAN bBtDisableLowPwr;
+
+ BOOLEAN bBtCtrlLps;
+ BOOLEAN bBtLpsOn;
+ BOOLEAN bForceToRoam; // for 1Ant solution
+ u1Byte lpsVal;
+ u1Byte rpwmVal;
+ u4Byte raMask;
+} BTC_BT_INFO, *PBTC_BT_INFO;
+
+typedef struct _BTC_STACK_INFO{
+ BOOLEAN bProfileNotified;
+ u2Byte hciVersion; // stack hci version
+ u1Byte numOfLink;
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bAclExist;
+ BOOLEAN bA2dpExist;
+ BOOLEAN bHidExist;
+ u1Byte numOfHid;
+ BOOLEAN bPanExist;
+ BOOLEAN bUnknownAclExist;
+ s1Byte minBtRssi;
+} BTC_STACK_INFO, *PBTC_STACK_INFO;
+
+typedef struct _BTC_BT_LINK_INFO{
+ BOOLEAN bBtLinkExist;
+ BOOLEAN bScoExist;
+ BOOLEAN bScoOnly;
+ BOOLEAN bA2dpExist;
+ BOOLEAN bA2dpOnly;
+ BOOLEAN bHidExist;
+ BOOLEAN bHidOnly;
+ BOOLEAN bPanExist;
+ BOOLEAN bPanOnly;
+} BTC_BT_LINK_INFO, *PBTC_BT_LINK_INFO;
+
+typedef struct _BTC_STATISTICS{
+ u4Byte cntBind;
+ u4Byte cntInitHwConfig;
+ u4Byte cntInitCoexDm;
+ u4Byte cntIpsNotify;
+ u4Byte cntLpsNotify;
+ u4Byte cntScanNotify;
+ u4Byte cntConnectNotify;
+ u4Byte cntMediaStatusNotify;
+ u4Byte cntSpecialPacketNotify;
+ u4Byte cntBtInfoNotify;
+ u4Byte cntPeriodical;
+ u4Byte cntCoexDmSwitch;
+ u4Byte cntStackOperationNotify;
+ u4Byte cntDbgCtrl;
+} BTC_STATISTICS, *PBTC_STATISTICS;
+
+typedef struct _BTC_COEXIST{
+ BOOLEAN bBinded; // make sure only one adapter can bind the data context
+ PVOID Adapter; // default adapter
+ BTC_BOARD_INFO boardInfo;
+ BTC_BT_INFO btInfo; // some bt info referenced by non-bt module
+ BTC_STACK_INFO stackInfo;
+ BTC_BT_LINK_INFO btLinkInfo;
+ BTC_CHIP_INTERFACE chipInterface;
+
+ BOOLEAN bInitilized;
+ BOOLEAN bStopCoexDm;
+ BOOLEAN bManualControl;
+ pu1Byte cliBuf;
+ BTC_STATISTICS statistics;
+ u1Byte pwrModeVal[10];
+
+ // function pointers
+ // io related
+ BFP_BTC_R1 fBtcRead1Byte;
+ BFP_BTC_W1 fBtcWrite1Byte;
+ BFP_BTC_W1_BIT_MASK fBtcWrite1ByteBitMask;
+ BFP_BTC_R2 fBtcRead2Byte;
+ BFP_BTC_W2 fBtcWrite2Byte;
+ BFP_BTC_R4 fBtcRead4Byte;
+ BFP_BTC_W4 fBtcWrite4Byte;
+ // read/write bb related
+ BFP_BTC_SET_BB_REG fBtcSetBbReg;
+ BFP_BTC_GET_BB_REG fBtcGetBbReg;
+
+ // read/write rf related
+ BFP_BTC_SET_RF_REG fBtcSetRfReg;
+ BFP_BTC_GET_RF_REG fBtcGetRfReg;
+
+ //write bt reg related
+ BFP_BTC_SET_BT_REG fBtcSetBtReg;
+
+ // fill h2c related
+ BFP_BTC_FILL_H2C fBtcFillH2c;
+ // other
+ BFP_BTC_DISP_DBG_MSG fBtcDispDbgMsg;
+ // normal get/set related
+ BFP_BTC_GET fBtcGet;
+ BFP_BTC_SET fBtcSet;
+} BTC_COEXIST, *PBTC_COEXIST;
+
+extern BTC_COEXIST GLBtCoexist;
+
+BOOLEAN
+EXhalbtcoutsrc_InitlizeVariables(
+ IN PVOID Adapter
+ );
+VOID
+EXhalbtcoutsrc_InitHwConfig(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtcoutsrc_InitCoexDm(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtcoutsrc_IpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtcoutsrc_LpsNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtcoutsrc_ScanNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtcoutsrc_ConnectNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte action
+ );
+VOID
+EXhalbtcoutsrc_MediaStatusNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN RT_MEDIA_STATUS mediaStatus
+ );
+VOID
+EXhalbtcoutsrc_SpecialPacketNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte pktType
+ );
+VOID
+EXhalbtcoutsrc_BtInfoNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN pu1Byte tmpBuf,
+ IN u1Byte length
+ );
+VOID
+EXhalbtcoutsrc_StackOperationNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte type
+ );
+VOID
+EXhalbtcoutsrc_HaltNotify(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtcoutsrc_SwitchGntBt(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtcoutsrc_PnpNotify(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte pnpState
+ );
+VOID
+EXhalbtcoutsrc_CoexDmSwitch(
+ IN PBTC_COEXIST pBtCoexist,
+ IN BOOLEAN antInverse
+ );
+VOID
+EXhalbtcoutsrc_Periodical(
+ IN PBTC_COEXIST pBtCoexist
+ );
+VOID
+EXhalbtcoutsrc_DbgControl(
+ IN PBTC_COEXIST pBtCoexist,
+ IN u1Byte opCode,
+ IN u1Byte opLen,
+ IN pu1Byte pData
+ );
+VOID
+EXhalbtcoutsrc_StackUpdateProfileInfo(
+ VOID
+ );
+VOID
+EXhalbtcoutsrc_SetHciVersion(
+ IN u2Byte hciVersion
+ );
+VOID
+EXhalbtcoutsrc_SetBtPatchVersion(
+ IN u2Byte btHciVersion,
+ IN u2Byte btPatchVersion
+ );
+VOID
+EXhalbtcoutsrc_UpdateMinBtRssi(
+ IN s1Byte btRssi
+ );
+VOID
+EXhalbtcoutsrc_SetBtExist(
+ IN BOOLEAN bBtExist
+ );
+VOID
+EXhalbtcoutsrc_SetChipType(
+ IN u1Byte chipType
+ );
+VOID
+EXhalbtcoutsrc_SetAntNum(
+ IN u1Byte type,
+ IN u1Byte antNum,
+ IN BOOLEAN antInverse
+ );
+VOID
+EXhalbtcoutsrc_DisplayBtCoexInfo(
+ IN PBTC_COEXIST pBtCoexist
+ );
+
+#endif
diff --git a/rtl8xxx_EU/hal/OUTSRC/PhyDM_Adaptivity.c b/rtl8xxx_EU/hal/OUTSRC/PhyDM_Adaptivity.c
new file mode 100755
index 0000000..ec9240f
--- a/dev/null
+++ b/rtl8xxx_EU/hal/OUTSRC/PhyDM_Adaptivity.c
@@ -0,0 +1,873 @@
+/******************************************************************************
+ *
+ * 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)
+#if WPP_SOFTWARE_TRACE
+#include "PhyDM_Adaptivity.tmh"
+#endif
+#endif
+
+
+VOID
+Phydm_CheckAdaptivity(
+ IN PVOID pDM_VOID
+)
+{
+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
+ PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
+
+ if (pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) {
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ if (pDM_Odm->APTotalNum > Adaptivity->APNumTH) {
+ pDM_Odm->Adaptivity_enable = FALSE;
+ pDM_Odm->adaptivity_flag = FALSE;
+ Phydm_SetEDCCAThreshold(pDM_Odm, 0x7f, 0x7f);
+ ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("AP total num > %d!!, disable adaptivity\n", Adaptivity->APNumTH));
+ } else
+#endif
+ {
+ if (Adaptivity->DynamicLinkAdaptivity == TRUE) {
+ if (pDM_Odm->bLinked && Adaptivity->bCheck == FALSE) {
+ Phydm_NHMCounterStatistics(pDM_Odm);
+ Phydm_CheckEnvironment(pDM_Odm);
+ } else if (!pDM_Odm->bLinked)
+ Adaptivity->bCheck = FALSE;
+ } else {
+ pDM_Odm->Adaptivity_enable = TRUE;
+
+ if (pDM_Odm->SupportICType & (ODM_RTL8814A|ODM_RTL8195A))
+ pDM_Odm->adaptivity_flag = FALSE;
+ else
+ pDM_Odm->adaptivity_flag = TRUE;
+ }
+ }
+ } else {
+ pDM_Odm->Adaptivity_enable = FALSE;
+ pDM_Odm->adaptivity_flag = FALSE;
+ }
+
+
+
+}
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+BOOLEAN
+Phydm_CheckChannelPlan(
+ 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);
+ PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo);
+
+ if (pMgntInfo->RegEnableAdaptivity == 2) {
+ 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 TRUE;
+ } 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 TRUE;
+
+ } 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 TRUE;
+ }
+ } else {
+ if ((*pDM_Odm->pBandType == ODM_BAND_5G) &&
+ !(pDM_Odm->odm_Regulation5G == REGULATION_MKK || 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 TRUE;
+ }
+
+ else if ((*pDM_Odm->pBandType == ODM_BAND_2_4G) &&
+ !(pDM_Odm->odm_Regulation2_4G == REGULATION_MKK || 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 TRUE;
+
+ } 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 TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+
+}
+#endif
+
+VOID
+Phydm_NHMCounterStatisticsInit(
+ IN PVOID pDM_VOID
+)
+{
+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
+
+ 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_TH9_TH10_11N + 2, 0xffff); /*0x890[31:16]=0xffff th_9, th_10*/
+ 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, 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*/
+ }
+#if (RTL8195A_SUPPORT == 0)
+ else 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, 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, 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*/
+
+ }
+#endif
+}
+
+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 (RTL8195A_SUPPORT == 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)
+#endif
+ 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_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);
+ }
+#if (RTL8195A_SUPPORT == 0)
+ else 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);
+ }
+
+#endif
+
+}
+
+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);
+ }
+#if (RTL8195A_SUPPORT == 0)
+ 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);
+ }
+#endif
+
+}
+
+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*/
+ }
+ }
+#if (RTL8195A_SUPPORT == 0)
+ 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*/
+ }
+ }
+#endif
+
+}
+
+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 */
+ }
+ 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;
+ PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
+ BOOLEAN isCleanEnvironment = FALSE;
+
+ if (Adaptivity->bFirstLink == TRUE) {
+ if (pDM_Odm->SupportICType & (ODM_RTL8814A|ODM_RTL8195A))
+ pDM_Odm->adaptivity_flag = FALSE;
+ else
+ pDM_Odm->adaptivity_flag = TRUE;
+
+ Adaptivity->bFirstLink = FALSE;
+ return;
+ } else {
+ if (Adaptivity->NHMWait < 3) { /*Start enter NHM after 4 NHMWait*/
+ Adaptivity->NHMWait++;
+ Phydm_NHMCounterStatistics(pDM_Odm);
+ return;
+ } else {
+ Phydm_NHMCounterStatistics(pDM_Odm);
+ isCleanEnvironment = Phydm_CalNHMcnt(pDM_Odm);
+ if (isCleanEnvironment == TRUE) {
+#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 = Adaptivity->TH_EDCCA_HL_diff_backup;
+#endif
+ pDM_Odm->Adaptivity_enable = TRUE;
+
+ if (pDM_Odm->SupportICType & (ODM_RTL8814A|ODM_RTL8195A))
+ pDM_Odm->adaptivity_flag = FALSE;
+ else
+ pDM_Odm->adaptivity_flag = TRUE;
+ } else {
+#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+ Phydm_SetEDCCAThreshold(pDM_Odm, 0x7f, 0x7f);
+#else
+ pDM_Odm->TH_L2H_ini = Adaptivity->TH_L2H_ini_mode2; /*for AP mode 2*/
+ pDM_Odm->TH_EDCCA_HL_diff = Adaptivity->TH_EDCCA_HL_diff_mode2;
+#endif
+ pDM_Odm->adaptivity_flag = FALSE;
+ pDM_Odm->Adaptivity_enable = FALSE;
+ }
+ Adaptivity->NHMWait = 0;
+ Adaptivity->bFirstLink = TRUE;
+ Adaptivity->bCheck = TRUE;
+ }
+
+ }
+
+
+}
+
+VOID
+Phydm_SearchPwdBLowerBound(
+ IN PVOID pDM_VOID
+)
+{
+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
+ PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
+ u4Byte value32 = 0;
+ u1Byte cnt, IGI_Pause = 0x7f, IGI_Resume = 0x20, IGI = 0x45; /*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);
+#if (RTL8195A_SUPPORT == 0)
+ else if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
+ value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_RPT_11AC, bMaskDWord);
+#endif
+ 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 > 1) {
+ 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);
+ if (TH_L2H_dmc == 10) {
+ bAdjust = FALSE;
+ Adaptivity->H2L_lb = TH_H2L_dmc;
+ Adaptivity->L2H_lb = TH_L2H_dmc;
+ pDM_Odm->Adaptivity_IGI_upper = IGI;
+ }
+
+ txEdcca1 = 0;
+ txEdcca0 = 0;
+
+ } else {
+ bAdjust = FALSE;
+ Adaptivity->H2L_lb = TH_H2L_dmc;
+ Adaptivity->L2H_lb = TH_L2H_dmc;
+ pDM_Odm->Adaptivity_IGI_upper = IGI;
+ txEdcca1 = 0;
+ txEdcca0 = 0;
+ }
+ }
+
+ pDM_Odm->Adaptivity_IGI_upper = pDM_Odm->Adaptivity_IGI_upper - pDM_Odm->DCbackoff;
+ Adaptivity->H2L_lb = Adaptivity->H2L_lb + pDM_Odm->DCbackoff;
+ Adaptivity->L2H_lb = Adaptivity->L2H_lb + pDM_Odm->DCbackoff;
+
+ 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;
+ PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
+#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->DCbackoff = (u1Byte)pMgntInfo->RegDCbackoff;
+ Adaptivity->DynamicLinkAdaptivity = (BOOLEAN)pMgntInfo->RegDmLinkAdaptivity;
+ Adaptivity->APNumTH = (u1Byte)pMgntInfo->RegAPNumTH;
+#elif(DM_ODM_SUPPORT_TYPE == ODM_CE)
+ pDM_Odm->Carrier_Sense_enable = (pDM_Odm->Adapter->registrypriv.adaptivity_mode != 0) ? TRUE : FALSE;
+ pDM_Odm->DCbackoff = pDM_Odm->Adapter->registrypriv.adaptivity_dc_backoff;
+ Adaptivity->DynamicLinkAdaptivity = (pDM_Odm->Adapter->registrypriv.adaptivity_dml != 0) ? TRUE : FALSE;
+#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;
+ }
+ } 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;
+ }
+
+#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 = 0xa;
+ pDM_Odm->TH_EDCCA_HL_diff = 7;
+ } else {
+ pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_backup; /*set by mib*/
+ pDM_Odm->TH_EDCCA_HL_diff = 7;
+ }
+
+ Adaptivity->TH_L2H_ini_mode2 = 20;
+ Adaptivity->TH_EDCCA_HL_diff_mode2 = 8;
+ Adaptivity->TH_EDCCA_HL_diff_backup = pDM_Odm->TH_EDCCA_HL_diff;
+ if (priv->pshare->rf_ft_var.adaptivity_enable == 2)
+ Adaptivity->DynamicLinkAdaptivity = TRUE;
+ else
+ Adaptivity->DynamicLinkAdaptivity = FALSE;
+
+#endif
+
+ pDM_Odm->Adaptivity_IGI_upper = 0;
+ pDM_Odm->Adaptivity_enable = FALSE; /*use this flag to decide enable or disable*/
+
+ Adaptivity->IGI_Base = 0x32;
+ Adaptivity->IGI_target = 0x1c;
+ Adaptivity->H2L_lb = 0;
+ Adaptivity->L2H_lb = 0;
+ Adaptivity->NHMWait = 0;
+ Adaptivity->bCheck = FALSE;
+ Adaptivity->bFirstLink = TRUE;
+
+ Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA);
+
+ /*Search pwdB lower bound*/
+ if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
+ ODM_SetBBReg(pDM_Odm, ODM_REG_DBG_RPT_11N, bMaskDWord, 0x208);
+#if (RTL8195A_SUPPORT == 0)
+ else if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
+ ODM_SetBBReg(pDM_Odm, ODM_REG_DBG_RPT_11AC, bMaskDWord, 0x209);
+#endif
+
+#if (RTL8195A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType & ODM_RTL8195A) {
+ ODM_SetBBReg(pDM_Odm, ODM_REG_EDCCA_DOWN_OPT_11N, BIT12 | BIT11 | BIT10, 0x7); /*interfernce need > 2^x us, and then EDCCA will be 1*/
+ ODM_SetBBReg(pDM_Odm, DOM_REG_EDCCA_DCNF_11N, BIT21 | BIT20, 0x1); /*0:rx_dfir, 1: dcnf_out, 2 :rx_iq, 3: rx_nbi_nf_out*/
+ }
+#else
+ if (pDM_Odm->SupportICType & ODM_RTL8814A) { /*8814a no need to find pwdB lower bound, maybe*/
+ ODM_SetBBReg(pDM_Odm, ODM_REG_EDCCA_DOWN_OPT, BIT30 | BIT29 | BIT28, 0x7); /*interfernce need > 2^x us, and then EDCCA will be 1*/
+ ODM_SetBBReg(pDM_Odm, ODM_REG_ACBB_EDCCA_ENHANCE, BIT29 | BIT28, 0x1); /*0:rx_dfir, 1: dcnf_out, 2 :rx_iq, 3: rx_nbi_nf_out*/
+ } else
+ Phydm_SearchPwdBLowerBound(pDM_Odm);
+#endif
+
+}
+
+
+VOID
+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;
+ s1Byte Diff, IGI_target;
+ PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ PADAPTER pAdapter = pDM_Odm->Adapter;
+ 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, 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;
+ }
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ if (Phydm_CheckChannelPlan(pDM_Odm))
+ return;
+ if (pDM_Odm->APTotalNum > Adaptivity->APNumTH)
+ return;
+#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, ("IGI_Base=0x%x, TH_L2H_ini = %d, TH_EDCCA_HL_diff = %d\n",
+ Adaptivity->IGI_Base, pDM_Odm->TH_L2H_ini, pDM_Odm->TH_EDCCA_HL_diff));
+#if (RTL8195A_SUPPORT == 0)
+ if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) {
+ /*fix AC series when enable EDCCA hang issue*/
+ ODM_SetBBReg(pDM_Odm, 0x800, BIT10, 1); /*ADC_mask disable*/
+ ODM_SetBBReg(pDM_Odm, 0x800, BIT10, 0); /*ADC_mask enable*/
+ }
+#endif
+ if (*pDM_Odm->pBandWidth == ODM_BW20M) /*CHANNEL_WIDTH_20*/
+ IGI_target = Adaptivity->IGI_Base;
+ else if (*pDM_Odm->pBandWidth == ODM_BW40M)
+ IGI_target = Adaptivity->IGI_Base + 2;
+#if (RTL8195A_SUPPORT == 0)
+ else if (*pDM_Odm->pBandWidth == ODM_BW80M)
+ IGI_target = Adaptivity->IGI_Base + 2;
+#endif
+ else
+ IGI_target = Adaptivity->IGI_Base;
+ Adaptivity->IGI_target = (u1Byte) IGI_target;
+
+ if (*pDM_Odm->pChannel >= 149) { /*Band4 -> for AP : mode2*/
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ s1Byte L2H_nolink_Band4 = 0x7f, H2L_nolink_Band4 = 0x7f;
+ if (pDM_Odm->bLinked) {
+ if (pDM_Odm->SupportICType & ODM_RTL8814A) {
+ L2H_nolink_Band4 = (s1Byte)Adaptivity->TH_L2H_ini_mode2 + IGI_target;
+ H2L_nolink_Band4 = L2H_nolink_Band4 - Adaptivity->TH_EDCCA_HL_diff_mode2;
+ } else {
+ Diff = IGI_target - (s1Byte)IGI;
+ L2H_nolink_Band4 = Adaptivity->TH_L2H_ini_mode2 + Diff;
+ if (L2H_nolink_Band4 > 10)
+ L2H_nolink_Band4 = 10;
+ H2L_nolink_Band4 = L2H_nolink_Band4 - Adaptivity->TH_EDCCA_HL_diff_mode2;
+ }
+ } else {
+ L2H_nolink_Band4 = 0x7f;
+ H2L_nolink_Band4 = 0x7f;
+ }
+ Phydm_SetEDCCAThreshold(pDM_Odm, H2L_nolink_Band4, L2H_nolink_Band4);
+ return;
+#endif
+ }
+
+ ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("BandWidth=%s, IGI_target=0x%x, DynamicLinkAdaptivity = %d\n",
+ (*pDM_Odm->pBandWidth == ODM_BW80M) ? "80M" : ((*pDM_Odm->pBandWidth == ODM_BW40M) ? "40M" : "20M"), IGI_target, Adaptivity->DynamicLinkAdaptivity));
+ ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("RSSI_min = %d, AdapIGIUpper= 0x%x, adaptivity_flag = %d, Adaptivity_enable = %d\n",
+ pDM_Odm->RSSI_Min, pDM_Odm->Adaptivity_IGI_upper, pDM_Odm->adaptivity_flag, pDM_Odm->Adaptivity_enable));
+
+ if ((Adaptivity->DynamicLinkAdaptivity == TRUE) && (!pDM_Odm->bLinked) && (pDM_Odm->Adaptivity_enable == FALSE)) {
+ Phydm_SetEDCCAThreshold(pDM_Odm, 0x7f, 0x7f);
+ ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("In DynamicLink mode(noisy) and No link, Turn off EDCCA!!\n"));
+ return;
+ }
+#if (!(DM_ODM_SUPPORT_TYPE & ODM_AP))
+ else if ((Adaptivity->DynamicLinkAdaptivity == TRUE) && (pDM_Odm->Adaptivity_enable == FALSE)) {
+ Phydm_SetEDCCAThreshold(pDM_Odm, 0x7f, 0x7f);
+ ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("In DynamicLink mode(noisy) disable EDCCA, return!!\n"));
+ return;
+ }
+#endif
+
+ if (pDM_Odm->SupportICType & (ODM_RTL8814A|ODM_RTL8195A)) {
+ TH_L2H_dmc = (s1Byte)pDM_Odm->TH_L2H_ini + IGI_target;
+ TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff;
+ }
+#if (RTL8195A_SUPPORT == 0)
+ else {
+ 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 < Adaptivity->H2L_lb)
+ TH_H2L_dmc = Adaptivity->H2L_lb;
+ if (TH_L2H_dmc < Adaptivity->L2H_lb)
+ TH_L2H_dmc = Adaptivity->L2H_lb;
+ }
+#endif
+ ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d\n", IGI, TH_L2H_dmc, TH_H2L_dmc));
+ ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Adaptivity_IGI_upper=0x%x, H2L_lb = 0x%x, L2H_lb = 0x%x\n", pDM_Odm->Adaptivity_IGI_upper, Adaptivity->H2L_lb, Adaptivity->L2H_lb));
+
+ Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc);
+ return;
+}
+
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+
+VOID
+Phydm_AdaptivityBSOD(
+ IN PVOID pDM_VOID
+)
+{
+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
+ PADAPTER pAdapter = pDM_Odm->Adapter;
+ PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo);
+ u1Byte count = 0;
+ u4Byte u4Value;
+
+ /*
+ 1. turn off RF (TRX Mux in standby mode)
+ 2. H2C mac id drop
+ 3. ignore EDCCA
+ 4. wait for clear FIFO
+ 5. don't ignore EDCCA
+ 6. turn on RF (TRX Mux in TRx mdoe)
+ 7. H2C mac id resume
+ */
+
+ RT_TRACE(COMP_MLME, DBG_WARNING, ("MAC id drop packet!!!!!\n"));
+
+ pAdapter->dropPktByMacIdCnt++;
+ pMgntInfo->bDropPktInProgress = TRUE;
+
+ pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_MAX_Q_PAGE_NUM, (pu1Byte)(&u4Value));
+ RT_TRACE(COMP_INIT, DBG_LOUD, ("Queue Reserved Page Number = 0x%08x\n", u4Value));
+ pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_AVBL_Q_PAGE_NUM, (pu1Byte)(&u4Value));
+ RT_TRACE(COMP_INIT, DBG_LOUD, ("Available Queue Page Number = 0x%08x\n", u4Value));
+
+#if 1
+
+ /*Standby mode*/
+ Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE);
+ ODM_Write_DIG(pDM_Odm, 0x20);
+
+ /*H2C mac id drop*/
+ MacIdIndicateDisconnect(pAdapter);
+
+ /*Ignore EDCCA*/
+ Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA);
+
+ delay_ms(50);
+ count = 5;
+
+#else
+
+ do {
+
+ u8Byte diffTime, curTime, oldestTime;
+ u1Byte queueIdx
+
+ //3 Standby mode
+ Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE);
+ ODM_Write_DIG(pDM_Odm, 0x20);
+
+ //3 H2C mac id drop
+ MacIdIndicateDisconnect(pAdapter);
+
+ //3 Ignore EDCCA
+ Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA);
+
+ count++;
+ delay_ms(10);
+
+ // Check latest packet
+ curTime = PlatformGetCurrentTime();
+ oldestTime = 0xFFFFFFFFFFFFFFFF;
+
+ for (queueIdx = 0; queueIdx < MAX_TX_QUEUE; queueIdx++) {
+ if (!IS_DATA_QUEUE(queueIdx))
+ continue;
+
+ if (!pAdapter->bTcbBusyQEmpty[queueIdx]) {
+ RT_TRACE(COMP_MLME, DBG_WARNING, ("oldestTime = %llu\n", oldestTime));
+ RT_TRACE(COMP_MLME, DBG_WARNING, ("Q[%d] = %llu\n", queueIdx, pAdapter->firstTcbSysTime[queueIdx]));
+ if (pAdapter->firstTcbSysTime[queueIdx] < oldestTime)
+ oldestTime = pAdapter->firstTcbSysTime[queueIdx];
+ }
+ }
+
+ diffTime = curTime - oldestTime;
+
+ RT_TRACE(COMP_MLME, DBG_WARNING, ("diff s = %llu\n", (diffTime / 1000000)));
+
+ } while (((diffTime / 1000000) >= 4) && (oldestTime != 0xFFFFFFFFFFFFFFFF));
+#endif
+
+ /*Resume EDCCA*/
+ Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA);
+
+ /*Turn on TRx mode*/
+ Phydm_SetTRxMux(pDM_Odm, PhyDM_TX_MODE, PhyDM_RX_MODE);
+ ODM_Write_DIG(pDM_Odm, 0x20);
+
+ /*Resume H2C macid*/
+ MacIdRecoverMediaStatus(pAdapter);
+
+ pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_AVBL_Q_PAGE_NUM, (pu1Byte)(&u4Value));
+ RT_TRACE(COMP_INIT, DBG_LOUD, ("Available Queue Page Number = 0x%08x\n", u4Value));
+
+ pMgntInfo->bDropPktInProgress = FALSE;
+ RT_TRACE(COMP_MLME, DBG_WARNING, ("End of MAC id drop packet, spent %dms\n", count * 10));
+
+}
+
+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))) {
+ ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold, 0x00);
+ ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold + 2, 0xFD);
+ } else {
+ ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold, 0x03);
+ ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold + 2, 0x00);
+ }
+}
+
+VOID
+Phydm_DisableEDCCA(
+ IN PVOID pDM_VOID
+)
+{
+ 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);
+}
+
+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;
+
+#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))) {
+ 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/rtl8xxx_EU/hal/OUTSRC/PhyDM_Adaptivity.h b/rtl8xxx_EU/hal/OUTSRC/PhyDM_Adaptivity.h
new file mode 100755
index 0000000..0787d5d
--- a/dev/null
+++ b/rtl8xxx_EU/hal/OUTSRC/PhyDM_Adaptivity.h
@@ -0,0 +1,157 @@
+/******************************************************************************
+ *
+ * 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 "8.5.1"
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
+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;
+
+typedef struct _ADAPTIVITY_STATISTICS {
+ s1Byte TH_L2H_ini_mode2;
+ s1Byte TH_EDCCA_HL_diff_mode2;
+ s1Byte TH_EDCCA_HL_diff_backup;
+ s1Byte IGI_Base;
+ u1Byte IGI_target;
+ u1Byte NHMWait;
+ s1Byte H2L_lb;
+ s1Byte L2H_lb;
+ BOOLEAN bFirstLink;
+ BOOLEAN bCheck;
+ BOOLEAN DynamicLinkAdaptivity;
+ u1Byte APNumTH;
+} ADAPTIVITY_STATISTICS, *PADAPTIVITY_STATISTICS;
+
+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_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
+ );
+
+VOID
+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
+);
+
+VOID
+Phydm_AdaptivityBSOD(
+ IN PVOID pDM_VOID
+);
+
+#endif
+
+
+#endif
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm.c b/rtl8xxx_EU/hal/OUTSRC/odm.c
index fd6474e..df459f5 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm.c
+++ b/rtl8xxx_EU/hal/OUTSRC/odm.c
@@ -465,16 +465,6 @@ 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-----------------------//
@@ -923,7 +913,7 @@ ODM_DMInit(
odm_CommonInfoSelfInit(pDM_Odm);
odm_CmnInfoInit_Debug(pDM_Odm);
odm_DIGInit(pDM_Odm);
- odm_AdaptivityInit(pDM_Odm);
+ Phydm_AdaptivityInit(pDM_Odm);
odm_RateAdaptiveMaskInit(pDM_Odm);
odm_RSSIMonitorInit(pDM_Odm);
@@ -1046,17 +1036,25 @@ ODM_DMWatchdog(
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);
+ {
+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable;
+ Phydm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue);
+ }
+
}
else
//#endif
#endif
+
+ Phydm_CheckAdaptivity(pDM_Odm);
+
{
odm_DIG(pDM_Odm);
}
{
pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable;
- odm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue);
+ Phydm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue);
}
odm_CCKPacketDetectionThresh(pDM_Odm);
@@ -2027,36 +2025,6 @@ int getIGIForDiff(int 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)
@@ -2150,119 +2118,6 @@ odm_DynamicEDCCA(
#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
)
@@ -2518,41 +2373,77 @@ ODM_Write_DIG(
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)
+ //1 Check initial gain by upper bound
+ //if(!pDM_DigTable->bPSDInProgress)
{
- if(pDM_Odm->SupportPlatform & (ODM_CE|ODM_WIN))
+ 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;
+ }
+ if(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY && pDM_Odm->adaptivity_flag == TRUE)
+ {
+ if(CurrentIGI > pDM_Odm->Adaptivity_IGI_upper)
+ CurrentIGI = pDM_Odm->Adaptivity_IGI_upper;
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_write_DIG(): Adaptivity case: Force upper bound to 0x%x !!!!!!\n", CurrentIGI));
+ }
+ }
+
+ if(pDM_DigTable->CurIGValue != CurrentIGI)
+ {
+
+ /*Add by YuChen for USB IO too slow issue*/
+ if ((pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) && (CurrentIGI > pDM_DigTable->CurIGValue))
+ Phydm_Adaptivity(pDM_Odm, CurrentIGI);
+
+
+ //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_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);
- break;
- case ODM_CCA_1R_A:
- ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI);
+ 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));
+ 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);
+ 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));
+ }
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("CurrentIGI(0x%02x). \n",CurrentIGI));
}
@@ -2710,7 +2601,6 @@ odm_DIG(
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
@@ -2722,10 +2612,6 @@ odm_DIG(
return;
}
#endif
-/*
- if (pDM_Odm->SupportICType==ODM_RTL8723B)
- return;
-*/
if(pDM_Odm->bBtHsOperation)
{
@@ -2793,7 +2679,9 @@ odm_DIG(
return;
}
}
-
+
+ //1 Update status
+#if (RTL8192D_SUPPORT==1)
if(pDM_Odm->SupportICType == ODM_RTL8192D)
{
if(*(pDM_Odm->pMacPhyMode) == ODM_DMSP)
@@ -2801,13 +2689,13 @@ odm_DIG(
if(*(pDM_Odm->pbMasterOfDMSP))
{
DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0;
- FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE);
+ 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);
+ FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE);
FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == TRUE);
}
}
@@ -2828,6 +2716,7 @@ odm_DIG(
}
}
else
+#endif
{
DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0;
FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE);
@@ -2835,11 +2724,12 @@ odm_DIG(
}
//1 Boundary Decision
- if(pDM_Odm->SupportICType & (ODM_RTL8192C) &&(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)))
+#if (RTL8192C_SUPPORT==1)
+ 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;
}
@@ -2851,6 +2741,7 @@ odm_DIG(
DIG_MaxOfMin = DM_DIG_MAX_AP_HP;
}
else
+#endif
{
if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL))
{
@@ -3185,49 +3076,21 @@ odm_DIG(
}
}
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;
+ //1 Check initial gain by upper/lower bound
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));
- }
+ 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(): 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;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue=0x%x, TotalFA=%d\n\n", CurrentIGI, pFalseAlmCnt->Cnt_all));
- //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
+ //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
@@ -3239,60 +3102,27 @@ odm_DIG(
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))
+ if((pDM_Odm->SupportICType & ODM_RTL8723A) && IS_WIRELESS_MODE_G(pAdapter))
{
- 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 > 0x28)
{
- if(pHalData->UndecoratedSmoothedPWDB < 12)
+ if(CurrentIGI < DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND)
{
- 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
-}
+ //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, (u1Byte)CurrentIGI);//ODM_Write_DIG_DMSP(pDM_Odm, pDM_DigTable->CurIGValue);
+ 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;
@@ -3322,39 +3152,31 @@ odm_DIG(
else
#endif
{
+#if ((DM_ODM_SUPPORT_TYPE & ODM_WIN) || ((DM_ODM_SUPPORT_TYPE & ODM_CE) && (ODM_CONFIG_BT_COEXIST == 1)))
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;
@@ -3363,7 +3185,6 @@ odm_DIG(
}
}
-
BOOLEAN
odm_DigAbort(
IN PDM_ODM_T pDM_Odm
@@ -14192,3 +14013,51 @@ void odm_dtc(PDM_ODM_T pDM_Odm)
#endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_CE) */
+PVOID
+PhyDM_Get_Structure(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte Structure_Type
+)
+
+{
+ PVOID pStruct = NULL;
+#if RTL8195A_SUPPORT
+ switch (Structure_Type){
+ case PHYDM_FALSEALMCNT:
+ pStruct = &FalseAlmCnt;
+ break;
+
+ case PHYDM_CFOTRACK:
+ pStruct = &DM_CfoTrack;
+ break;
+
+ case PHYDM_ADAPTIVITY:
+ pStruct = &(pDM_Odm->Adaptivity);
+ break;
+
+ default:
+ break;
+ }
+
+#else
+ switch (Structure_Type){
+ case PHYDM_FALSEALMCNT:
+ pStruct = &(pDM_Odm->FalseAlmCnt);
+ break;
+
+ //case PHYDM_CFOTRACK:
+ // pStruct = &(pDM_Odm->DM_CfoTrack);
+ //break;
+
+ case PHYDM_ADAPTIVITY:
+ pStruct = &(pDM_Odm->Adaptivity);
+ break;
+
+ default:
+ break;
+ }
+
+#endif
+ return pStruct;
+}
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm.h b/rtl8xxx_EU/hal/OUTSRC/odm.h
index d5983d2..e8003f3 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm.h
@@ -1,2370 +1,2409 @@
-/******************************************************************************
- *
- * 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 __HALDMOUTSRC_H__
-#define __HALDMOUTSRC_H__
-
-//============================================================
-// Definition
-//============================================================
-//
-// 2011/09/22 MH Define all team supprt ability.
-//
-
-//
-// 2011/09/22 MH Define for all teams. Please Define the constan in your precomp header.
-//
-//#define DM_ODM_SUPPORT_AP 0
-//#define DM_ODM_SUPPORT_ADSL 0
-//#define DM_ODM_SUPPORT_CE 0
-//#define DM_ODM_SUPPORT_MP 1
-
-//
-// 2011/09/28 MH Define ODM SW team support flag.
-//
-
-
-
-//
-// Antenna Switch Relative Definition.
-//
-
-//
-// 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.
-//
-#define TP_MODE 0
-#define RSSI_MODE 1
-#define TRAFFIC_LOW 0
-#define TRAFFIC_HIGH 1
-
-
-//============================================================
-//3 Tx Power Tracking
-//3============================================================
-#define DPK_DELTA_MAPPING_NUM 13
-#define index_mapping_HP_NUM 15
-#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
-//3============================================================
-
-#define AFH_PSD 1 //0:normal PSD scan, 1: only do 20 pts PSD
-#define MODE_40M 0 //0:20M, 1:40M
-#define PSD_TH2 3
-#define PSD_CHMIN 20 // Minimum channel number for BT AFH
-#define SIR_STEP_SIZE 3
-#define Smooth_Size_1 5
-#define Smooth_TH_1 3
-#define Smooth_Size_2 10
-#define Smooth_TH_2 4
-#define Smooth_Size_3 20
-#define Smooth_TH_3 4
-#define Smooth_Step_Size 5
-#define Adaptive_SIR 1
-#if(RTL8723_FPGA_VERIFICATION == 1)
-#define PSD_RESCAN 1
-#else
-#define PSD_RESCAN 4
-#endif
-#define PSD_SCAN_INTERVAL 700 //ms
-
-
-
-//8723A High Power IGI Setting
-#define DM_DIG_HIGH_PWR_IGI_LOWER_BOUND 0x22
-#define DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND 0x28
-#define DM_DIG_HIGH_PWR_THRESHOLD 0x3a
-#define DM_DIG_LOW_PWR_THRESHOLD 0x14
-
-//ANT Test
-#define ANTTESTALL 0x00 //Ant A or B will be Testing
-#define ANTTESTA 0x01 //Ant A will be Testing
-#define ANTTESTB 0x02 //Ant B will be testing
-
-// 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
-#define MAX_ANT 3 // 3 for AP using
-
-
-//Antenna Diversity Type
-#define SW_ANTDIV 0
-#define HW_ANTDIV 1
-//============================================================
-// structure and define
-//============================================================
-
-//
-// 2011/09/20 MH Add for AP/ADSLpseudo DM structuer requirement.
-// We need to remove to other position???
-//
-#if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
-typedef struct rtl8192cd_priv {
- u1Byte temp;
-
-}rtl8192cd_priv, *prtl8192cd_priv;
-#endif
-
-
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-typedef struct _ADAPTER{
- u1Byte temp;
- #ifdef AP_BUILD_WORKAROUND
- HAL_DATA_TYPE* temp2;
- prtl8192cd_priv priv;
- #endif
-}ADAPTER, *PADAPTER;
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
-typedef struct _WLAN_STA{
- u1Byte temp;
-} WLAN_STA, *PRT_WLAN_STA;
-
-#endif
-
-typedef struct _Dynamic_Initial_Gain_Threshold_
-{
- 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 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;
-
-typedef struct _Dynamic_Primary_CCA{
- u1Byte PriCCA_flag;
- u1Byte intf_flag;
- u1Byte intf_type;
- u1Byte DupRTS_flag;
- u1Byte Monitor_flag;
- u1Byte CH_offset;
- u1Byte MF_state;
-}Pri_CCA_T, *pPri_CCA_T;
-
-typedef struct _Rate_Adaptive_Table_{
- u1Byte firstconnect;
-}RA_T, *pRA_T;
-
-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 (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #if USE_WORKITEM
- RT_WORK_ITEM PSDTimeWorkitem;
- #endif
-#endif
-
-}RXHP_T, *pRXHP_T;
-
-#if(DM_ODM_SUPPORT_TYPE & (ODM_CE))
-#define ASSOCIATE_ENTRY_NUM 32 // Max size of AsocEntry[].
-#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM
-
-#elif(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-#define ASSOCIATE_ENTRY_NUM NUM_STAT
-#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM+1
-
-#else
-//
-// 2012/01/12 MH Revise for compatiable with other SW team.
-// 0 is for STA 1-n is for AP clients.
-//
-#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM+1// Default port only one
-#endif
-
-//#ifdef CONFIG_ANTENNA_DIVERSITY
-// This indicates two different the steps.
-// In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
-// In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
-// with original RSSI to determine if it is necessary to switch antenna.
-#define SWAW_STEP_PEAK 0
-#define SWAW_STEP_DETERMINE 1
-
-#define TP_MODE 0
-#define RSSI_MODE 1
-#define TRAFFIC_LOW 0
-#define TRAFFIC_HIGH 1
-#define TRAFFIC_UltraLOW 2
-
-typedef struct _SW_Antenna_Switch_
-{
- u1Byte Double_chk_flag;
- u1Byte try_flag;
- s4Byte PreRSSI;
- u1Byte CurAntenna;
- u1Byte PreAntenna;
- u1Byte RSSI_Trying;
- u1Byte TestMode;
- u1Byte bTriggerAntennaSwitch;
- u1Byte SelectAntennaMap;
- u1Byte RSSI_target;
- u1Byte reset_idx;
-
- // Before link Antenna Switch check
- u1Byte SWAS_NoLink_State;
- u4Byte SWAS_NoLink_BK_Reg860;
- u4Byte SWAS_NoLink_BK_Reg92c;
- BOOLEAN ANTA_ON; //To indicate Ant A is or not
- BOOLEAN ANTB_ON; //To indicate Ant B is on or not
- u1Byte Ant5G;
- u1Byte Ant2G;
-
- s4Byte RSSI_sum_A;
- s4Byte RSSI_sum_B;
- s4Byte RSSI_cnt_A;
- s4Byte RSSI_cnt_B;
-
- u8Byte lastTxOkCnt;
- u8Byte lastRxOkCnt;
- u8Byte TXByteCnt_A;
- u8Byte TXByteCnt_B;
- u8Byte RXByteCnt_A;
- u8Byte RXByteCnt_B;
- u1Byte TrafficLoad;
- u1Byte Train_time;
- u1Byte Train_time_flag;
- RT_TIMER SwAntennaSwitchTimer;
- RT_TIMER SwAntennaSwitchTimer_8723B;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #if USE_WORKITEM
- RT_WORK_ITEM SwAntennaSwitchWorkitem;
- RT_WORK_ITEM SwAntennaSwitchWorkitem_8723B;
- #endif
-#endif
-/* CE Platform use
-#ifdef CONFIG_SW_ANTENNA_DIVERSITY
- _timer SwAntennaSwitchTimer;
- u8Byte lastTxOkCnt;
- u8Byte lastRxOkCnt;
- u8Byte TXByteCnt_A;
- u8Byte TXByteCnt_B;
- u8Byte RXByteCnt_A;
- u8Byte RXByteCnt_B;
- u1Byte DoubleComfirm;
- u1Byte TrafficLoad;
- //SW Antenna Switch
-
-
-#endif
-*/
-#ifdef CONFIG_HW_ANTENNA_DIVERSITY
- //Hybrid Antenna Diversity
- u4Byte CCK_Ant1_Cnt[ASSOCIATE_ENTRY_NUM+1];
- u4Byte CCK_Ant2_Cnt[ASSOCIATE_ENTRY_NUM+1];
- u4Byte OFDM_Ant1_Cnt[ASSOCIATE_ENTRY_NUM+1];
- u4Byte OFDM_Ant2_Cnt[ASSOCIATE_ENTRY_NUM+1];
- u4Byte RSSI_Ant1_Sum[ASSOCIATE_ENTRY_NUM+1];
- u4Byte RSSI_Ant2_Sum[ASSOCIATE_ENTRY_NUM+1];
- u1Byte TxAnt[ASSOCIATE_ENTRY_NUM+1];
- u1Byte TargetSTA;
- u1Byte antsel;
- u1Byte RxIdleAnt;
-
-#endif
-
-}SWAT_T, *pSWAT_T;
-//#endif
-
-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;
-
-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;
-
-
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-
-#ifdef ADSL_AP_BUILD_WORKAROUND
-#define MAX_TOLERANCE 5
-#define IQK_DELAY_TIME 1 //ms
-#endif
-
-//
-// Indicate different AP vendor for IOT issue.
-//
-typedef enum _HT_IOT_PEER
-{
- HT_IOT_PEER_UNKNOWN = 0,
- HT_IOT_PEER_REALTEK = 1,
- HT_IOT_PEER_REALTEK_92SE = 2,
- HT_IOT_PEER_BROADCOM = 3,
- HT_IOT_PEER_RALINK = 4,
- HT_IOT_PEER_ATHEROS = 5,
- HT_IOT_PEER_CISCO = 6,
- HT_IOT_PEER_MERU = 7,
- HT_IOT_PEER_MARVELL = 8,
- HT_IOT_PEER_REALTEK_SOFTAP = 9,// peer is RealTek SOFT_AP, by Bohn, 2009.12.17
- HT_IOT_PEER_SELF_SOFTAP = 10, // Self is SoftAP
- HT_IOT_PEER_AIRGO = 11,
- HT_IOT_PEER_INTEL = 12,
- HT_IOT_PEER_RTK_APCLIENT = 13,
- HT_IOT_PEER_REALTEK_81XX = 14,
- HT_IOT_PEER_REALTEK_WOW = 15,
- HT_IOT_PEER_MAX = 16
-}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
-
-//
-// Declare for common info
-//
-#define MAX_PATH_NUM_92CS 2
-#define MAX_PATH_NUM_8188E 1
-#define MAX_PATH_NUM_8192E 2
-#define MAX_PATH_NUM_8723B 1
-#define MAX_PATH_NUM_8812A 2
-#define MAX_PATH_NUM_8821A 1
-
-#define IQK_THRESHOLD 8
-
-typedef struct _ODM_Phy_Status_Info_
-{
- //
- // Be care, if you want to add any element please insert between
- // RxPWDBAll & SignalStrength.
- //
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- u4Byte RxPWDBAll;
-#else
- u1Byte RxPWDBAll;
-#endif
-
- u1Byte SignalQuality; // in 0-100 index.
- s1Byte RxMIMOSignalQuality[4]; //per-path's EVM
- u1Byte RxMIMOEVMdbm[4]; //per-path's EVM dbm
-
- u1Byte RxMIMOSignalStrength[4];// in 0~100 index
-
- u2Byte Cfo_short[4]; // per-path's Cfo_short
- u2Byte Cfo_tail[4]; // per-path's Cfo_tail
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
- s1Byte RxPower; // in dBm Translate from PWdB
- s1Byte RecvSignalPower; // Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures.
- u1Byte BTRxRSSIPercentage;
- u1Byte SignalStrength; // in 0-100 index.
-
- s1Byte RxPwr[4]; //per-path's pwdb
-#endif
- u1Byte RxSNR[4]; //per-path's SNR
- u1Byte BandWidth;
- u1Byte btCoexPwrAdjust;
-}ODM_PHY_INFO_T,*PODM_PHY_INFO_T;
-
-
-typedef struct _ODM_Per_Pkt_Info_
-{
- //u1Byte Rate;
- u1Byte DataRate;
- u1Byte StationID;
- BOOLEAN bPacketMatchBSSID;
- BOOLEAN bPacketToSelf;
- BOOLEAN bPacketBeacon;
-}ODM_PACKET_INFO_T,*PODM_PACKET_INFO_T;
-
-
-typedef struct _ODM_Phy_Dbg_Info_
-{
- //ODM Write,debug info
- s1Byte RxSNRdB[4];
- u8Byte NumQryPhyStatus;
- u8Byte NumQryPhyStatusCCK;
- u8Byte NumQryPhyStatusOFDM;
- u1Byte NumQryBeaconPkt;
- //Others
- s4Byte RxEVM[4];
-
-}ODM_PHY_DBG_INFO_T;
-
-
-typedef struct _ODM_Mac_Status_Info_
-{
- u1Byte test;
-
-}ODM_MAC_INFO;
-
-
-typedef enum tag_Dynamic_ODM_Support_Ability_Type
-{
- // BB Team
- ODM_DIG = 0x00000001,
- ODM_HIGH_POWER = 0x00000002,
- ODM_CCK_CCA_TH = 0x00000004,
- ODM_FA_STATISTICS = 0x00000008,
- ODM_RAMASK = 0x00000010,
- ODM_RSSI_MONITOR = 0x00000020,
- ODM_SW_ANTDIV = 0x00000040,
- ODM_HW_ANTDIV = 0x00000080,
- ODM_BB_PWRSV = 0x00000100,
- ODM_2TPATHDIV = 0x00000200,
- ODM_1TPATHDIV = 0x00000400,
- ODM_PSD2AFH = 0x00000800
-}ODM_Ability_E;
-
-//
-// 2011/20/20 MH For MP driver RT_WLAN_STA = STA_INFO_T
-// Please declare below ODM relative info in your STA info structure.
-//
-#if 1
-typedef struct _ODM_STA_INFO{
- // Driver Write
- BOOLEAN bUsed; // record the sta status link or not?
- //u1Byte WirelessMode; //
- u1Byte IOTPeer; // Enum value. HT_IOT_PEER_E
-
- // ODM Write
- //1 PHY_STATUS_INFO
- u1Byte RSSI_Path[4]; //
- u1Byte RSSI_Ave;
- u1Byte RXEVM[4];
- u1Byte RXSNR[4];
-
- // ODM Write
- //1 TX_INFO (may changed by IC)
- //TX_INFO_T pTxInfo; // Define in IC folder. Move lower layer.
-#if 0
- u1Byte ANTSEL_A; //in Jagar: 4bit; others: 2bit
- u1Byte ANTSEL_B; //in Jagar: 4bit; others: 2bit
- u1Byte ANTSEL_C; //only in Jagar: 4bit
- u1Byte ANTSEL_D; //only in Jagar: 4bit
- u1Byte TX_ANTL; //not in Jagar: 2bit
- u1Byte TX_ANT_HT; //not in Jagar: 2bit
- u1Byte TX_ANT_CCK; //not in Jagar: 2bit
- u1Byte TXAGC_A; //not in Jagar: 4bit
- u1Byte TXAGC_B; //not in Jagar: 4bit
- u1Byte TXPWR_OFFSET; //only in Jagar: 3bit
- u1Byte TX_ANT; //only in Jagar: 4bit for TX_ANTL/TX_ANTHT/TX_ANT_CCK
-#endif
-
- //
- // Please use compile flag to disabe the strcutrue for other IC except 88E.
- // Move To lower layer.
- //
- // ODM Write Wilson will handle this part(said by Luke.Lee)
- //TX_RPT_T pTxRpt; // Define in IC folder. Move lower layer.
-#if 0
- //1 For 88E RA (don't redefine the naming)
- u1Byte rate_id;
- u1Byte rate_SGI;
- u1Byte rssi_sta_ra;
- u1Byte SGI_enable;
- u1Byte Decision_rate;
- u1Byte Pre_rate;
- u1Byte Active;
-
- // Driver write Wilson handle.
- //1 TX_RPT (don't redefine the naming)
- u2Byte RTY[4]; // ???
- u2Byte TOTAL; // ???
- u2Byte DROP; // ???
- //
- // Please use compile flag to disabe the strcutrue for other IC except 88E.
- //
-#endif
-
-}ODM_STA_INFO_T, *PODM_STA_INFO_T;
-#endif
-
-//
-// 2011/10/20 MH Define Common info enum for all team.
-//
-typedef enum _ODM_Common_Info_Definition
-{
-//-------------REMOVED CASE-----------//
- //ODM_CMNINFO_CCK_HP,
- //ODM_CMNINFO_RFPATH_ENABLE, // Define as ODM write???
- //ODM_CMNINFO_BT_COEXIST, // ODM_BT_COEXIST_E
- //ODM_CMNINFO_OP_MODE, // ODM_OPERATION_MODE_E
-//-------------REMOVED CASE-----------//
-
- //
- // Fixed value:
- //
-
- //-----------HOOK BEFORE REG INIT-----------//
- ODM_CMNINFO_PLATFORM = 0,
- ODM_CMNINFO_ABILITY, // ODM_ABILITY_E
- ODM_CMNINFO_INTERFACE, // ODM_INTERFACE_E
- ODM_CMNINFO_MP_TEST_CHIP,
- ODM_CMNINFO_IC_TYPE, // ODM_IC_TYPE_E
- ODM_CMNINFO_CUT_VER, // ODM_CUT_VERSION_E
- ODM_CMNINFO_FAB_VER, // ODM_FAB_E
- ODM_CMNINFO_RF_TYPE, // ODM_RF_PATH_E or ODM_RF_TYPE_E?
- ODM_CMNINFO_RFE_TYPE,
- ODM_CMNINFO_BOARD_TYPE, // ODM_BOARD_TYPE_E
- ODM_CMNINFO_PACKAGE_TYPE,
- ODM_CMNINFO_EXT_LNA, // TRUE
- ODM_CMNINFO_5G_EXT_LNA,
- ODM_CMNINFO_EXT_PA,
- ODM_CMNINFO_5G_EXT_PA,
- ODM_CMNINFO_GPA,
- ODM_CMNINFO_APA,
- ODM_CMNINFO_GLNA,
- ODM_CMNINFO_ALNA,
- ODM_CMNINFO_EXT_TRSW,
- ODM_CMNINFO_PATCH_ID, //CUSTOMER ID
- ODM_CMNINFO_BINHCT_TEST,
- ODM_CMNINFO_BWIFI_TEST,
- ODM_CMNINFO_SMART_CONCURRENT,
- //-----------HOOK BEFORE REG INIT-----------//
-
-
- //
- // Dynamic value:
- //
-//--------- POINTER REFERENCE-----------//
- ODM_CMNINFO_MAC_PHY_MODE, // ODM_MAC_PHY_MODE_E
- ODM_CMNINFO_TX_UNI,
- ODM_CMNINFO_RX_UNI,
- ODM_CMNINFO_WM_MODE, // ODM_WIRELESS_MODE_E
- ODM_CMNINFO_BAND, // ODM_BAND_TYPE_E
- ODM_CMNINFO_SEC_CHNL_OFFSET, // ODM_SEC_CHNL_OFFSET_E
- ODM_CMNINFO_SEC_MODE, // ODM_SECURITY_E
- ODM_CMNINFO_BW, // ODM_BW_E
- ODM_CMNINFO_CHNL,
- ODM_CMNINFO_FORCED_RATE,
-
- ODM_CMNINFO_DMSP_GET_VALUE,
- ODM_CMNINFO_BUDDY_ADAPTOR,
- ODM_CMNINFO_DMSP_IS_MASTER,
- ODM_CMNINFO_SCAN,
- ODM_CMNINFO_POWER_SAVING,
- ODM_CMNINFO_ONE_PATH_CCA, // ODM_CCA_PATH_E
- ODM_CMNINFO_DRV_STOP,
- ODM_CMNINFO_PNP_IN,
- 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,
-//--------- POINTER REFERENCE-----------//
-
-//------------CALL BY VALUE-------------//
- ODM_CMNINFO_WIFI_DIRECT,
- ODM_CMNINFO_WIFI_DISPLAY,
- ODM_CMNINFO_LINK_IN_PROGRESS,
- ODM_CMNINFO_LINK,
- ODM_CMNINFO_STATION_STATE,
- ODM_CMNINFO_RSSI_MIN,
- ODM_CMNINFO_DBG_COMP, // u8Byte
- ODM_CMNINFO_DBG_LEVEL, // u4Byte
- 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_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,
-//------------CALL BY VALUE-------------//
-
- //
- // Dynamic ptr array hook itms.
- //
- ODM_CMNINFO_STA_STATUS,
- ODM_CMNINFO_PHY_STATUS,
- ODM_CMNINFO_MAC_STATUS,
-
- ODM_CMNINFO_MAX,
-
-
-}ODM_CMNINFO_E;
-
-//
-// 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY
-//
-typedef enum _ODM_Support_Ability_Definition
-{
- //
- // BB ODM section BIT 0-15
- //
- ODM_BB_DIG = BIT0,
- ODM_BB_RA_MASK = BIT1,
- ODM_BB_DYNAMIC_TXPWR = BIT2,
- ODM_BB_FA_CNT = BIT3,
- ODM_BB_RSSI_MONITOR = BIT4,
- ODM_BB_CCK_PD = BIT5,
- ODM_BB_ANT_DIV = BIT6,
- ODM_BB_PWR_SAVE = BIT7,
- ODM_BB_PWR_TRAIN = BIT8,
- ODM_BB_RATE_ADAPTIVE = BIT9,
- ODM_BB_PATH_DIV = BIT10,
- ODM_BB_PSD = BIT11,
- ODM_BB_RXHP = BIT12,
- ODM_BB_ADAPTIVITY = BIT13,
- ODM_BB_DYNAMIC_ATC = BIT14,
-
- //
- // MAC DM section BIT 16-23
- //
- ODM_MAC_EDCA_TURBO = BIT16,
- ODM_MAC_EARLY_MODE = BIT17,
-
- //
- // RF ODM section BIT 24-31
- //
- ODM_RF_TX_PWR_TRACK = BIT24,
- ODM_RF_RX_GAIN_TRACK = BIT25,
- ODM_RF_CALIBRATION = BIT26,
-
-}ODM_ABILITY_E;
-
-// ODM_CMNINFO_INTERFACE
-typedef enum tag_ODM_Support_Interface_Definition
-{
- ODM_ITRF_PCIE = 0x1,
- ODM_ITRF_USB = 0x2,
- ODM_ITRF_SDIO = 0x4,
- ODM_ITRF_ALL = 0x7,
-}ODM_INTERFACE_E;
-
-// ODM_CMNINFO_IC_TYPE
-typedef enum tag_ODM_Support_IC_Type_Definition
-{
- ODM_RTL8192S = BIT0,
- ODM_RTL8192C = BIT1,
- ODM_RTL8192D = BIT2,
- ODM_RTL8723A = BIT3,
- ODM_RTL8188E = BIT4,
- ODM_RTL8812 = BIT5,
- ODM_RTL8821 = BIT6,
- ODM_RTL8192E = BIT7,
- ODM_RTL8723B = BIT8,
- ODM_RTL8813A = BIT9,
- ODM_RTL8881A = BIT10
-}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)
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-#ifdef RTK_AC_SUPPORT
-#define ODM_IC_11AC_SERIES_SUPPORT 1
-#else
-#define ODM_IC_11AC_SERIES_SUPPORT 0
-#endif
-#else
-#define ODM_IC_11AC_SERIES_SUPPORT 1
-#endif
-
-//ODM_CMNINFO_CUT_VER
-typedef enum tag_ODM_Cut_Version_Definition
-{
- ODM_CUT_A = 0,
- ODM_CUT_B = 1,
- ODM_CUT_C = 2,
- ODM_CUT_D = 3,
- ODM_CUT_E = 4,
- ODM_CUT_F = 5,
-
- ODM_CUT_I = 8,
- ODM_CUT_TEST = 15,
-}ODM_CUT_VERSION_E;
-
-// ODM_CMNINFO_FAB_VER
-typedef enum tag_ODM_Fab_Version_Definition
-{
- ODM_TSMC = 0,
- ODM_UMC = 1,
-}ODM_FAB_E;
-
-// ODM_CMNINFO_RF_TYPE
-//
-// For example 1T2R (A+AB = BIT0|BIT4|BIT5)
-//
-typedef enum tag_ODM_RF_Path_Bit_Definition
-{
- ODM_RF_TX_A = BIT0,
- ODM_RF_TX_B = BIT1,
- ODM_RF_TX_C = BIT2,
- ODM_RF_TX_D = BIT3,
- ODM_RF_RX_A = BIT4,
- ODM_RF_RX_B = BIT5,
- ODM_RF_RX_C = BIT6,
- ODM_RF_RX_D = BIT7,
-}ODM_RF_PATH_E;
-
-
-typedef enum tag_ODM_RF_Type_Definition
-{
- ODM_1T1R = 0,
- ODM_1T2R = 1,
- ODM_2T2R = 2,
- ODM_2T3R = 3,
- ODM_2T4R = 4,
- ODM_3T3R = 5,
- ODM_3T4R = 6,
- ODM_4T4R = 7,
-}ODM_RF_TYPE_E;
-
-
-//
-// ODM Dynamic common info value definition
-//
-
-//typedef enum _MACPHY_MODE_8192D{
-// SINGLEMAC_SINGLEPHY,
-// DUALMAC_DUALPHY,
-// DUALMAC_SINGLEPHY,
-//}MACPHY_MODE_8192D,*PMACPHY_MODE_8192D;
-// Above is the original define in MP driver. Please use the same define. THX.
-typedef enum tag_ODM_MAC_PHY_Mode_Definition
-{
- ODM_SMSP = 0,
- ODM_DMSP = 1,
- ODM_DMDP = 2,
-}ODM_MAC_PHY_MODE_E;
-
-
-typedef enum tag_BT_Coexist_Definition
-{
- ODM_BT_BUSY = 1,
- ODM_BT_ON = 2,
- ODM_BT_OFF = 3,
- ODM_BT_NONE = 4,
-}ODM_BT_COEXIST_E;
-
-// ODM_CMNINFO_OP_MODE
-typedef enum tag_Operation_Mode_Definition
-{
- ODM_NO_LINK = BIT0,
- ODM_LINK = BIT1,
- ODM_SCAN = BIT2,
- ODM_POWERSAVE = BIT3,
- ODM_AP_MODE = BIT4,
- ODM_CLIENT_MODE = BIT5,
- ODM_AD_HOC = BIT6,
- ODM_WIFI_DIRECT = BIT7,
- ODM_WIFI_DISPLAY = BIT8,
-}ODM_OPERATION_MODE_E;
-
-// ODM_CMNINFO_WM_MODE
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_CE))
-typedef enum tag_Wireless_Mode_Definition
-{
- ODM_WM_UNKNOW = 0x0,
- ODM_WM_B = BIT0,
- ODM_WM_G = BIT1,
- ODM_WM_A = BIT2,
- ODM_WM_N24G = BIT3,
- ODM_WM_N5G = BIT4,
- ODM_WM_AUTO = BIT5,
- ODM_WM_AC = BIT6,
-}ODM_WIRELESS_MODE_E;
-#else
-typedef enum tag_Wireless_Mode_Definition
-{
- ODM_WM_UNKNOWN = 0x00,
- ODM_WM_A = BIT0,
- ODM_WM_B = BIT1,
- ODM_WM_G = BIT2,
- ODM_WM_AUTO = BIT3,
- ODM_WM_N24G = BIT4,
- ODM_WM_N5G = BIT5,
- ODM_WM_AC_5G = BIT6,
- ODM_WM_AC_24G = BIT7,
- ODM_WM_AC_ONLY = BIT8,
- ODM_WM_MAX = BIT9
-}ODM_WIRELESS_MODE_E;
-#endif
-
-// ODM_CMNINFO_BAND
-typedef enum tag_Band_Type_Definition
-{
- ODM_BAND_2_4G = 0,
- ODM_BAND_5G,
- ODM_BAND_ON_BOTH,
- ODM_BANDMAX
-
-}ODM_BAND_TYPE_E;
-
-// ODM_CMNINFO_SEC_CHNL_OFFSET
-typedef enum tag_Secondary_Channel_Offset_Definition
-{
- ODM_DONT_CARE = 0,
- ODM_BELOW = 1,
- ODM_ABOVE = 2
-}ODM_SEC_CHNL_OFFSET_E;
-
-// ODM_CMNINFO_SEC_MODE
-typedef enum tag_Security_Definition
-{
- ODM_SEC_OPEN = 0,
- ODM_SEC_WEP40 = 1,
- ODM_SEC_TKIP = 2,
- ODM_SEC_RESERVE = 3,
- ODM_SEC_AESCCMP = 4,
- ODM_SEC_WEP104 = 5,
- ODM_WEP_WPA_MIXED = 6, // WEP + WPA
- ODM_SEC_SMS4 = 7,
-}ODM_SECURITY_E;
-
-// ODM_CMNINFO_BW
-typedef enum tag_Bandwidth_Definition
-{
- ODM_BW20M = 0,
- ODM_BW40M = 1,
- ODM_BW80M = 2,
- ODM_BW160M = 3,
- ODM_BW10M = 4,
-}ODM_BW_E;
-
-
-// ODM_CMNINFO_BOARD_TYPE
-// For non-AC-series IC , ODM_BOARD_5G_EXT_PA and ODM_BOARD_5G_EXT_LNA are ignored
-// For AC-series IC, external PA & LNA can be indivisuallly added on 2.4G and/or 5G
-typedef enum tag_Board_Definition
-{
- ODM_BOARD_DEFAULT = 0, // The DEFAULT case.
- ODM_BOARD_MINICARD = BIT(0), // 0 = non-mini card, 1= mini card.
- ODM_BOARD_SLIM = BIT(1), // 0 = non-slim card, 1 = slim card
- ODM_BOARD_BT = BIT(2), // 0 = without BT card, 1 = with BT
- ODM_BOARD_EXT_PA = BIT(3), // 0 = no 2G ext-PA, 1 = existing 2G ext-PA
- ODM_BOARD_EXT_LNA = BIT(4), // 0 = no 2G ext-LNA, 1 = existing 2G ext-LNA
- ODM_BOARD_EXT_TRSW = BIT(5), // 0 = no ext-TRSW, 1 = existing ext-TRSW
- ODM_BOARD_EXT_PA_5G = BIT(6), // 0 = no 5G ext-PA, 1 = existing 5G ext-PA
- ODM_BOARD_EXT_LNA_5G= BIT(7), // 0 = no 5G ext-LNA, 1 = existing 5G ext-LNA
-}ODM_BOARD_TYPE_E;
-
-typedef enum tag_ODM_Package_Definition
-{
- ODM_PACKAGE_DEFAULT = 0,
- ODM_PACKAGE_QFN68 = BIT(0),
- ODM_PACKAGE_TFBGA90 = BIT(1),
- ODM_PACKAGE_TFBGA79 = BIT(2),
-}ODM_Package_TYPE_E;
-
-typedef enum tag_ODM_TYPE_GPA_Definition
-{
- TYPE_GPA0 = 0,
- TYPE_GPA1 = BIT(1)|BIT(0)
-}ODM_TYPE_GPA_E;
-
-typedef enum tag_ODM_TYPE_APA_Definition
-{
- TYPE_APA0 = 0,
- TYPE_APA1 = BIT(1)|BIT(0)
-}ODM_TYPE_APA_E;
-
-typedef enum tag_ODM_TYPE_GLNA_Definition
-{
- TYPE_GLNA0 = 0,
- TYPE_GLNA1 = BIT(2)|BIT(0),
- TYPE_GLNA2 = BIT(3)|BIT(1),
- TYPE_GLNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0)
-}ODM_TYPE_GLNA_E;
-
-typedef enum tag_ODM_TYPE_ALNA_Definition
-{
- TYPE_ALNA0 = 0,
- TYPE_ALNA1 = BIT(2)|BIT(0),
- TYPE_ALNA2 = BIT(3)|BIT(1),
- TYPE_ALNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0)
-}ODM_TYPE_ALNA_E;
-
-// ODM_CMNINFO_ONE_PATH_CCA
-typedef enum tag_CCA_Path
-{
- ODM_CCA_2R = 0,
- ODM_CCA_1R_A = 1,
- ODM_CCA_1R_B = 2,
-}ODM_CCA_PATH_E;
-
-
-typedef struct _ODM_RA_Info_
-{
- u1Byte RateID;
- u4Byte RateMask;
- u4Byte RAUseRate;
- u1Byte RateSGI;
- u1Byte RssiStaRA;
- u1Byte PreRssiStaRA;
- u1Byte SGIEnable;
- u1Byte DecisionRate;
- u1Byte PreRate;
- u1Byte HighestRate;
- u1Byte LowestRate;
- u4Byte NscUp;
- u4Byte NscDown;
- u2Byte RTY[5];
- u4Byte TOTAL;
- u2Byte DROP;
- u1Byte Active;
- u2Byte RptTime;
- u1Byte RAWaitingCounter;
- u1Byte RAPendingCounter;
-#if 1 //POWER_TRAINING_ACTIVE == 1 // For compile pass only~!
- u1Byte PTActive; // on or off
- u1Byte PTTryState; // 0 trying state, 1 for decision state
- u1Byte PTStage; // 0~6
- u1Byte PTStopCount; //Stop PT counter
- u1Byte PTPreRate; // if rate change do PT
- u1Byte PTPreRssi; // if RSSI change 5% do PT
- u1Byte PTModeSS; // decide whitch rate should do PT
- u1Byte RAstage; // StageRA, decide how many times RA will be done between PT
- u1Byte PTSmoothFactor;
-#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;
-
-#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;
-
- 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
-//
-
-typedef struct _FAST_ANTENNA_TRAINNING_
-{
- u1Byte Bssid[6];
- u1Byte antsel_rx_keep_0;
- u1Byte antsel_rx_keep_1;
- u1Byte antsel_rx_keep_2;
- u4Byte antSumRSSI[7];
- u4Byte antRSSIcnt[7];
- u4Byte antAveRSSI[7];
- u1Byte FAT_State;
- u4Byte TrainIdx;
- u1Byte antsel_a[ODM_ASSOCIATE_ENTRY_NUM];
- u1Byte antsel_b[ODM_ASSOCIATE_ENTRY_NUM];
- u1Byte antsel_c[ODM_ASSOCIATE_ENTRY_NUM];
- u4Byte MainAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM];
- u4Byte AuxAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM];
- u4Byte MainAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
- u4Byte AuxAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
- u1Byte RxIdleAnt;
- BOOLEAN bBecomeLinked;
- u4Byte MinMaxRSSI;
- u1Byte idx_AntDiv_counter_2G;
- u1Byte idx_AntDiv_counter_5G;
- u4Byte AntDiv_2G_5G;
- u4Byte CCK_counter_main;
- u4Byte CCK_counter_aux;
- u4Byte OFDM_counter_main;
- u4Byte OFDM_counter_aux;
-
-}FAT_T,*pFAT_T;
-
-typedef enum _FAT_STATE
-{
- FAT_NORMAL_STATE = 0,
- FAT_TRAINING_STATE = 1,
-}FAT_STATE_E, *PFAT_STATE_E;
-
-typedef enum _ANT_DIV_TYPE
-{
- NO_ANTDIV = 0xFF,
- CG_TRX_HW_ANTDIV = 0x01,
- CGCS_RX_HW_ANTDIV = 0x02,
- FIXED_HW_ANTDIV = 0x03,
- CG_TRX_SMART_ANTDIV = 0x04,
- CGCS_RX_SW_ANTDIV = 0x05,
- S0S1_SW_ANTDIV = 0x06 //8723B intrnal switch S0 S1
-}ANT_DIV_TYPE_E, *PANT_DIV_TYPE_E;
-
-typedef struct _ODM_PATH_DIVERSITY_
-{
- u1Byte RespTxPath;
- u1Byte PathSel[ODM_ASSOCIATE_ENTRY_NUM];
- u4Byte PathA_Sum[ODM_ASSOCIATE_ENTRY_NUM];
- u4Byte PathB_Sum[ODM_ASSOCIATE_ENTRY_NUM];
- u4Byte PathA_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
- u4Byte PathB_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
-}PATHDIV_T, *pPATHDIV_T;
-
-
-typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE{
- PHY_REG_PG_RELATIVE_VALUE = 0,
- PHY_REG_PG_EXACT_VALUE = 1
-} PHY_REG_PG_TYPE;
-
-
-//
-// Antenna detection information from single tone mechanism, added by Roger, 2012.11.27.
-//
-typedef struct _ANT_DETECTED_INFO{
- BOOLEAN bAntDetected;
- u4Byte dBForAntA;
- u4Byte dBForAntB;
- u4Byte dBForAntO;
-}ANT_DETECTED_INFO, *PANT_DETECTED_INFO;
-
-//
-// 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration.
-//
-#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (RT_PLATFORM != PLATFORM_LINUX)
-typedef
-#endif
-struct DM_Out_Source_Dynamic_Mechanism_Structure
-#else// for AP,ADSL,CE Team
-typedef struct DM_Out_Source_Dynamic_Mechanism_Structure
-#endif
-{
- //RT_TIMER FastAntTrainingTimer;
- //
- // Add for different team use temporarily
- //
- PADAPTER Adapter; // For CE/NIC team
- prtl8192cd_priv priv; // For AP/ADSL team
- // WHen you use Adapter or priv pointer, you must make sure the pointer is ready.
- BOOLEAN odm_ready;
-
-#if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
- rtl8192cd_priv fake_priv;
-#endif
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- // ADSL_AP_BUILD_WORKAROUND
- ADAPTER fake_adapter;
-#endif
-
- PHY_REG_PG_TYPE PhyRegPgValueType;
- u1Byte PhyRegPgVersion;
-
- u8Byte DebugComponents;
- u4Byte DebugLevel;
-
- u8Byte NumQryPhyStatusAll; //CCK + OFDM
- u8Byte LastNumQryPhyStatusAll;
- u8Byte RxPWDBAve;
- u8Byte RxPWDBAve_final;
- BOOLEAN MPDIG_2G; //off MPDIG
- u1Byte Times_2G;
-
-//------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------//
- BOOLEAN bCckHighPower;
- u1Byte RFPathRxEnable; // ODM_CMNINFO_RFPATH_ENABLE
- u1Byte ControlChannel;
-//------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------//
-
-//--------REMOVED COMMON INFO----------//
- //u1Byte PseudoMacPhyMode;
- //BOOLEAN *BTCoexist;
- //BOOLEAN PseudoBtCoexist;
- //u1Byte OPMode;
- //BOOLEAN bAPMode;
- //BOOLEAN bClientMode;
- //BOOLEAN bAdHocMode;
- //BOOLEAN bSlaveOfDMSP;
-//--------REMOVED COMMON INFO----------//
-
-
-//1 COMMON INFORMATION
-
- //
- // Init Value
- //
-//-----------HOOK BEFORE REG INIT-----------//
- // ODM Platform info AP/ADSL/CE/MP = 1/2/3/4
- u1Byte SupportPlatform;
- // ODM Support Ability DIG/RATR/TX_PWR_TRACK/ ¡K¡K = 1/2/3/¡K
- u4Byte SupportAbility;
- // ODM PCIE/USB/SDIO = 1/2/3
- u1Byte SupportInterface;
- // ODM composite or independent. Bit oriented/ 92C+92D+ .... or any other type = 1/2/3/...
- u4Byte SupportICType;
- // Cut Version TestChip/A-cut/B-cut... = 0/1/2/3/...
- u1Byte CutVersion;
- // Fab Version TSMC/UMC = 0/1
- u1Byte FabVersion;
- // RF Type 4T4R/3T3R/2T2R/1T2R/1T1R/...
- u1Byte RFType;
- u1Byte RFEType;
- // Board Type Normal/HighPower/MiniCard/SLIM/Combo/... = 0/1/2/3/4/...
- u1Byte BoardType;
- u1Byte PackageType;
- u1Byte TypeGLNA;
- u1Byte TypeGPA;
- u1Byte TypeALNA;
- u1Byte TypeAPA;
- // with external LNA NO/Yes = 0/1
- u1Byte ExtLNA;
- u1Byte ExtLNA5G;
- // with external PA NO/Yes = 0/1
- u1Byte ExtPA;
- u1Byte ExtPA5G;
- // with external TRSW NO/Yes = 0/1
- u1Byte ExtTRSW;
- u1Byte PatchID; //Customer ID
- BOOLEAN bInHctTest;
- BOOLEAN bWIFITest;
-
- BOOLEAN bDualMacSmartConcurrent;
- u4Byte BK_SupportAbility;
- u1Byte AntDivType;
-//-----------HOOK BEFORE REG INIT-----------//
-
- //
- // Dynamic Value
- //
-//--------- POINTER REFERENCE-----------//
-
- u1Byte u1Byte_temp;
- BOOLEAN BOOLEAN_temp;
- PADAPTER PADAPTER_temp;
-
- // MAC PHY Mode SMSP/DMSP/DMDP = 0/1/2
- u1Byte *pMacPhyMode;
- //TX Unicast byte count
- u8Byte *pNumTxBytesUnicast;
- //RX Unicast byte count
- u8Byte *pNumRxBytesUnicast;
- // Wireless mode B/G/A/N = BIT0/BIT1/BIT2/BIT3
- u1Byte *pWirelessMode; //ODM_WIRELESS_MODE_E
- // Frequence band 2.4G/5G = 0/1
- u1Byte *pBandType;
- // Secondary channel offset don't_care/below/above = 0/1/2
- u1Byte *pSecChOffset;
- // Security mode Open/WEP/AES/TKIP = 0/1/2/3
- u1Byte *pSecurity;
- // BW info 20M/40M/80M = 0/1/2
- u1Byte *pBandWidth;
- // Central channel location Ch1/Ch2/....
- u1Byte *pChannel; //central channel number
- BOOLEAN DPK_Done;
- // Common info for 92D DMSP
-
- BOOLEAN *pbGetValueFromOtherMac;
- PADAPTER *pBuddyAdapter;
- BOOLEAN *pbMasterOfDMSP; //MAC0: master, MAC1: slave
- // Common info for Status
- BOOLEAN *pbScanInProcess;
- BOOLEAN *pbPowerSaving;
- // CCA Path 2-path/path-A/path-B = 0/1/2; using ODM_CCA_PATH_E.
- u1Byte *pOnePathCCA;
- //pMgntInfo->AntennaTest
- u1Byte *pAntennaTest;
- BOOLEAN *pbNet_closed;
- u1Byte *mp_mode;
- //u1Byte *pAidMap;
- u1Byte *pu1ForcedIgiLb;
-//--------- POINTER REFERENCE-----------//
- pu2Byte pForcedDataRate;
-//------------CALL BY VALUE-------------//
- BOOLEAN bLinkInProcess;
- 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;
- // Common info for BTDM
- BOOLEAN bBtDisabled; // BT is disabled
- BOOLEAN bBtConnectProcess; // BT HS is under connection progress.
- u1Byte btHsRssi; // BT HS mode wifi rssi value.
- BOOLEAN bBtHsOperation; // BT HS mode is under progress
- BOOLEAN bBtDisableEdcaTurbo; // Under some condition, don't enable the EDCA Turbo
- BOOLEAN bBtLimitedDig; // BT is busy.
-//------------CALL BY VALUE-------------//
- u1Byte RSSI_A;
- u1Byte RSSI_B;
- 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;
- u1Byte preChannel;
- u4Byte TxagcOffsetValueA;
- BOOLEAN IsTxagcOffsetPositiveA;
- u4Byte TxagcOffsetValueB;
- BOOLEAN IsTxagcOffsetPositiveB;
- u8Byte lastTxOkCnt;
- u8Byte lastRxOkCnt;
- u4Byte BbSwingOffsetA;
- BOOLEAN IsBbSwingOffsetPositiveA;
- u4Byte BbSwingOffsetB;
- BOOLEAN IsBbSwingOffsetPositiveB;
- s1Byte TH_L2H_ini;
- s1Byte TH_EDCCA_HL_diff;
- s1Byte IGI_Base;
- u1Byte IGI_target;
- BOOLEAN ForceEDCCA;
- u1Byte AdapEn_RSSI;
- s1Byte Force_TH_H;
- s1Byte Force_TH_L;
- u1Byte IGI_LowerBound;
- u1Byte antdiv_rssi;
- u1Byte AntType;
- u1Byte pre_AntType;
- u1Byte antdiv_period;
- u1Byte antdiv_select;
- //2 Define STA info.
- // _ODM_STA_INFO
- // 2012/01/12 MH For MP, we need to reduce one array pointer for default port.??
- PSTA_INFO_T pODM_StaInfo[ODM_ASSOCIATE_ENTRY_NUM];
-
-#if (RATE_ADAPTIVE_SUPPORT == 1)
- u2Byte CurrminRptTime;
- ODM_RA_INFO_T RAInfo[ODM_ASSOCIATE_ENTRY_NUM]; //See HalMacID support
-#endif
- //
- // 2012/02/14 MH Add to share 88E ra with other SW team.
- // We need to colelct all support abilit to a proper area.
- //
- BOOLEAN RaSupport88E;
-
- // Define ...........
-
- // Latest packet phy info (ODM write)
- ODM_PHY_DBG_INFO_T PhyDbgInfo;
- //PHY_INFO_88E PhyInfo;
-
- // Latest packet phy info (ODM write)
- ODM_MAC_INFO *pMacInfo;
- //MAC_INFO_88E MacInfo;
-
- // Different Team independt structure??
-
- //
- //TX_RTP_CMN TX_retrpo;
- //TX_RTP_88E TX_retrpo;
- //TX_RTP_8195 TX_retrpo;
-
- //
- //ODM Structure
- //
- 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;
- //#ifdef CONFIG_ANTENNA_DIVERSITY
- SWAT_T DM_SWAT_Table;
- BOOLEAN RSSI_test;
- //#endif
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- //Path Div Struct
- PATHDIV_PARA pathIQK;
-#endif
-
- EDCA_T DM_EDCA_Table;
- u4Byte WMMEDCA_BE;
- PATHDIV_T DM_PathDiv;
- // Copy from SD4 structure
- //
- // ==================================================
- //
-
- //common
- //u1Byte DM_Type;
- //u1Byte PSD_Report_RXHP[80]; // Add By Gary
- //u1Byte PSD_func_flag; // Add By Gary
- //for DIG
- //u1Byte bDMInitialGainEnable;
- //u1Byte binitialized; // for dm_initial_gain_Multi_STA use.
- //for Antenna diversity
- //u8 AntDivCfg;// 0:OFF , 1:ON, 2:by efuse
- //PSTA_INFO_T RSSI_target;
-
- BOOLEAN *pbDriverStopped;
- BOOLEAN *pbDriverIsGoingToPnpSetPowerSleep;
- BOOLEAN *pinit_adpt_in_progress;
-
- //PSD
- BOOLEAN bUserAssignLevel;
- RT_TIMER PSDTimer;
- u1Byte RSSI_BT; //come from BT
- BOOLEAN bPSDinProcess;
- BOOLEAN bPSDactive;
- BOOLEAN bDMInitialGainEnable;
-
- //MPT DIG
- RT_TIMER MPT_DIGTimer;
-
- //for rate adaptive, in fact, 88c/92c fw will handle this
- u1Byte bUseRAMask;
-
- ODM_RATE_ADAPTIVE RateAdaptive;
-
- ANT_DETECTED_INFO AntDetectedInfo; // Antenna detected information for RSSI tool
-
- ODM_RF_CAL_T RFCalibrateInfo;
-
- //
- // TX power tracking
- //
- u1Byte BbSwingIdxOfdm[MAX_RF_PATH];
- u1Byte BbSwingIdxOfdmCurrent;
- u1Byte BbSwingIdxOfdmBase[MAX_RF_PATH];
- BOOLEAN BbSwingFlagOfdm;
- u1Byte BbSwingIdxCck;
- u1Byte BbSwingIdxCckCurrent;
- u1Byte BbSwingIdxCckBase;
- u1Byte DefaultOfdmIndex;
- u1Byte DefaultCckIndex;
- BOOLEAN BbSwingFlagCck;
-
- s1Byte Absolute_OFDMSwingIdx[MAX_RF_PATH];
- s1Byte Remnant_OFDMSwingIdx[MAX_RF_PATH];
- s1Byte Remnant_CCKSwingIdx;
- s1Byte Modify_TxAGC_Value; //Remnat compensate value at TxAGC
- BOOLEAN Modify_TxAGC_Flag_PathA;
- BOOLEAN Modify_TxAGC_Flag_PathB;
- BOOLEAN Modify_TxAGC_Flag_PathA_CCK;
-
- //
- // 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;
-
- //
- // ODM system resource.
- //
-
- // ODM relative time.
- RT_TIMER PathDivSwitchTimer;
- //2011.09.27 add for Path Diversity
- RT_TIMER CCKPathDiversityTimer;
- RT_TIMER FastAntTrainingTimer;
-
- // ODM relative workitem.
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #if USE_WORKITEM
- RT_WORK_ITEM PathDivSwitchWorkitem;
- RT_WORK_ITEM CCKPathDiversityWorkitem;
- RT_WORK_ITEM FastAntTrainingWorkitem;
- RT_WORK_ITEM MPT_DIGWorkitem;
- RT_WORK_ITEM RaRptWorkitem;
- #endif
-#endif
-
-#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
-#if (RT_PLATFORM != PLATFORM_LINUX)
-} DM_ODM_T, *PDM_ODM_T; // DM_Dynamic_Mechanism_Structure
-#else
-};
-#endif
-
-#else// for AP,ADSL,CE Team
-} DM_ODM_T, *PDM_ODM_T; // DM_Dynamic_Mechanism_Structure
-#endif
-
-
-
-#if 1 //92c-series
-#define ODM_RF_PATH_MAX 2
-#else //jaguar - series
-#define ODM_RF_PATH_MAX 4
-#endif
-
-typedef enum _ODM_RF_RADIO_PATH {
- ODM_RF_PATH_A = 0, //Radio Path A
- ODM_RF_PATH_B = 1, //Radio Path B
- ODM_RF_PATH_C = 2, //Radio Path C
- ODM_RF_PATH_D = 3, //Radio Path D
- ODM_RF_PATH_AB,
- ODM_RF_PATH_AC,
- ODM_RF_PATH_AD,
- ODM_RF_PATH_BC,
- ODM_RF_PATH_BD,
- ODM_RF_PATH_CD,
- ODM_RF_PATH_ABC,
- ODM_RF_PATH_ACD,
- ODM_RF_PATH_BCD,
- ODM_RF_PATH_ABCD,
- // ODM_RF_PATH_MAX, //Max RF number 90 support
-} ODM_RF_RADIO_PATH_E, *PODM_RF_RADIO_PATH_E;
-
- typedef enum _ODM_RF_CONTENT{
- odm_radioa_txt = 0x1000,
- odm_radiob_txt = 0x1001,
- odm_radioc_txt = 0x1002,
- odm_radiod_txt = 0x1003
-} ODM_RF_CONTENT;
-
-typedef enum _ODM_BB_Config_Type{
- CONFIG_BB_PHY_REG,
- CONFIG_BB_AGC_TAB,
- CONFIG_BB_AGC_TAB_2G,
- CONFIG_BB_AGC_TAB_5G,
- CONFIG_BB_PHY_REG_PG,
- CONFIG_BB_PHY_REG_MP,
- CONFIG_BB_AGC_TAB_DIFF,
-} ODM_BB_Config_Type, *PODM_BB_Config_Type;
-
-typedef enum _ODM_RF_Config_Type{
- CONFIG_RF_RADIO,
- CONFIG_RF_TXPWR_LMT,
-} ODM_RF_Config_Type, *PODM_RF_Config_Type;
-
-typedef enum _ODM_FW_Config_Type{
- CONFIG_FW_NIC,
- CONFIG_FW_NIC_2,
- CONFIG_FW_AP,
- CONFIG_FW_MP,
- CONFIG_FW_WoWLAN,
- CONFIG_FW_WoWLAN_2,
- CONFIG_FW_AP_WoWLAN,
- CONFIG_FW_BT,
-} ODM_FW_Config_Type;
-
-// Status code
-#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
-typedef enum _RT_STATUS{
- RT_STATUS_SUCCESS,
- RT_STATUS_FAILURE,
- RT_STATUS_PENDING,
- RT_STATUS_RESOURCE,
- RT_STATUS_INVALID_CONTEXT,
- RT_STATUS_INVALID_PARAMETER,
- RT_STATUS_NOT_SUPPORT,
- RT_STATUS_OS_API_FAILED,
-}RT_STATUS,*PRT_STATUS;
-#endif // end of RT_STATUS definition
-
-#ifdef REMOVE_PACK
-#pragma pack()
-#endif
-
-//#include "odm_function.h"
-
-//3===========================================================
-//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
-
-//3===========================================================
-//3 AGC RX High Power Mode
-//3===========================================================
-#define LNA_Low_Gain_1 0x64
-#define LNA_Low_Gain_2 0x5A
-#define LNA_Low_Gain_3 0x58
-
-#define FA_RXHP_TH1 5000
-#define FA_RXHP_TH2 1500
-#define FA_RXHP_TH3 800
-#define FA_RXHP_TH4 600
-#define FA_RXHP_TH5 500
-
-//3===========================================================
-//3 EDCA
-//3===========================================================
-
-//3===========================================================
-//3 Dynamic Tx Power
-//3===========================================================
-//Dynamic Tx Power Control Threshold
-#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
-#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
-#define TX_POWER_NEAR_FIELD_THRESH_AP 0x3F
-
-#define TxHighPwrLevel_Normal 0
-#define TxHighPwrLevel_Level1 1
-#define TxHighPwrLevel_Level2 2
-#define TxHighPwrLevel_BT1 3
-#define TxHighPwrLevel_BT2 4
-#define TxHighPwrLevel_15 5
-#define TxHighPwrLevel_35 6
-#define TxHighPwrLevel_50 7
-#define TxHighPwrLevel_70 8
-#define TxHighPwrLevel_100 9
-
-//3===========================================================
-//3 Tx Power Tracking
-//3===========================================================
-#if 0 //mask this, since these have been defined in typdef.h, vivi
-#define OFDM_TABLE_SIZE 43
-#define CCK_TABLE_SIZE 33
-#endif
-
-
-//3===========================================================
-//3 Rate Adaptive
-//3===========================================================
-#define DM_RATR_STA_INIT 0
-#define DM_RATR_STA_HIGH 1
-#define DM_RATR_STA_MIDDLE 2
-#define DM_RATR_STA_LOW 3
-
-//3===========================================================
-//3 BB Power Save
-//3===========================================================
-
-
-//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,
- CCA_2R = 1,
- CCA_MAX = 2,
-}DM_1R_CCA_E;
-
-typedef enum tag_RF_Type_Definition
-{
- RF_Save =0,
- RF_Normal = 1,
- RF_MAX = 2,
-}DM_RF_E;
-
-//3===========================================================
-//3 Antenna Diversity
-//3===========================================================
-typedef enum tag_SW_Antenna_Switch_Definition
-{
- Antenna_A = 1,
- Antenna_B = 2,
- Antenna_MAX = 3,
-}DM_SWAS_E;
-
-
-// Maximal number of antenna detection mechanism needs to perform, added by Roger, 2011.12.28.
-#define MAX_ANTENNA_DETECTION_CNT 10
-
-//
-// 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};
-
-//
-// check Sta pointer valid or not
-//
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-#define IS_STA_VALID(pSta) (pSta && pSta->expire_to)
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#define IS_STA_VALID(pSta) (pSta && pSta->bUsed)
-#else
-#define IS_STA_VALID(pSta) (pSta)
-#endif
-// 20100514 Joseph: Add definition for antenna switching test after link.
-// This indicates two different the steps.
-// In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
-// In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
-// with original RSSI to determine if it is necessary to switch antenna.
-#define SWAW_STEP_PEAK 0
-#define SWAW_STEP_DETERMINE 1
-
-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);
-
-
-#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
- );
-
-#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_AP|ODM_ADSL))
-//============================================================
-// function prototype
-//============================================================
-//#define DM_ChangeDynamicInitGainThresh ODM_ChangeDynamicInitGainThresh
-//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
- );
-
-BOOLEAN
-ODM_CheckPowerStatus(
- IN PADAPTER Adapter
- );
-
-
-#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
- );
-
-
-#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);
-
-u4Byte
-GetPSDData(
- PDM_ODM_T pDM_Odm,
- unsigned int point,
- u1Byte initial_gain_psd);
-
-#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
-
-
-#if (BEAMFORMING_SUPPORT == 1)
-BEAMFORMING_CAP
-Beamforming_GetEntryBeamCapByMacId(
- IN PMGNT_INFO pMgntInfo,
- IN u1Byte MacId
- );
-#endif
-
-VOID
-odm_TXPowerTrackingInit(
- IN PDM_ODM_T pDM_Odm
- );
-
-
-VOID ODM_DMInit( IN PDM_ODM_T pDM_Odm);
-
-VOID
-ODM_DMWatchdog(
- IN PDM_ODM_T pDM_Odm // For common use in the future
- );
-
-VOID
-ODM_CmnInfoInit(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_CMNINFO_E CmnInfo,
- IN u4Byte Value
- );
-
-VOID
-ODM_CmnInfoHook(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_CMNINFO_E CmnInfo,
- IN PVOID pValue
- );
-
-VOID
-ODM_CmnInfoPtrArrayHook(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_CMNINFO_E CmnInfo,
- IN u2Byte Index,
- IN PVOID pValue
- );
-
-VOID
-ODM_CmnInfoUpdate(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte CmnInfo,
- IN u8Byte Value
- );
-
-VOID
-ODM_InitAllTimers(
- IN PDM_ODM_T pDM_Odm
- );
-
-VOID
-ODM_CancelAllTimers(
- IN PDM_ODM_T pDM_Odm
- );
-
-VOID
-ODM_ReleaseAllTimers(
- IN PDM_ODM_T pDM_Odm
- );
-
-VOID
-ODM_ResetIQKResult(
- IN PDM_ODM_T pDM_Odm
- );
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-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--
-
-//3 Path Diversity
-//===========================================================
-
-#define TP_MODE 0
-#define RSSI_MODE 1
-#define TRAFFIC_LOW 0
-#define TRAFFIC_HIGH 1
-
-//#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 );
-
-u8Byte
-PlatformDivision64(
- IN u8Byte x,
- IN u8Byte y
-);
-
-
-// 20100514 Joseph: Add definition for antenna switching test after link.
-// This indicates two different the steps.
-// In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
-// In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
-// with original RSSI to determine if it is necessary to switch antenna.
-#define SWAW_STEP_PEAK 0
-#define SWAW_STEP_DETERMINE 1
-
-//====================================================
-//3 PathDiV End
-//====================================================
-
-#define PathDivCheckBeforeLink8192C ODM_PathDiversityBeforeLink92C
-BOOLEAN
-ODM_PathDiversityBeforeLink92C(
- //IN PADAPTER Adapter
- IN PDM_ODM_T pDM_Odm
- );
-
-#define DM_ChangeDynamicInitGainThresh ODM_ChangeDynamicInitGainThresh
-//void ODM_ChangeDynamicInitGainThresh(IN PADAPTER pAdapter,
-// IN INT32 DM_Type,
-// 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,
- DIG_STA_CONNECT = 1,
- DIG_STA_BEFORE_CONNECT = 2,
- DIG_MultiSTA_DISCONNECT = 3,
- DIG_MultiSTA_CONNECT = 4,
- DIG_CONNECT_MAX
-}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.
-//
-#define HAL_ADAPTER_STS_CHK(pDM_Odm)\
- if (pDM_Odm->Adapter == NULL)\
- {\
- return;\
- }\
-
-
-//
-// For new definition in MP temporarily fro power tracking,
-//
-#define odm_TXPowerTrackingDirectCall(_Adapter) \
- IS_HARDWARE_TYPE_8192D(_Adapter) ? odm_TXPowerTrackingCallback_ThermalMeter_92D(_Adapter) : \
- IS_HARDWARE_TYPE_8192C(_Adapter) ? odm_TXPowerTrackingCallback_ThermalMeter_92C(_Adapter) : \
- 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))
-
-VOID
-ODM_SingleDualAntennaDefaultSetting(
- IN PDM_ODM_T pDM_Odm
- );
-
-BOOLEAN
-ODM_SingleDualAntennaDetection(
- IN PDM_ODM_T pDM_Odm,
- 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(
- IN PDM_ODM_T pDM_Odm,
- IN BOOLEAN bNoisyStateFromC2H
-);
-
-u4Byte
-Set_RA_DM_Ratrbitmap_by_Noisy(
- IN PDM_ODM_T pDM_Odm,
- IN WIRELESS_MODE WirelessMode,
- IN u4Byte ratr_bitmap,
- IN u1Byte rssi_level
-);
-
-VOID
-ODM_UpdateInitRate(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte Rate
- );
-
-VOID
-ODM_DynamicARFBSelect(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte rate,
- IN BOOLEAN Collision_State
- );
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
-void odm_dtc(PDM_ODM_T pDM_Odm);
-#endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_CE) */
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __HALDMOUTSRC_H__
+#define __HALDMOUTSRC_H__
+
+#include "PhyDM_Adaptivity.h"
+
+//============================================================
+// Definition
+//============================================================
+//
+// 2011/09/22 MH Define all team supprt ability.
+//
+
+//
+// 2011/09/22 MH Define for all teams. Please Define the constan in your precomp header.
+//
+//#define DM_ODM_SUPPORT_AP 0
+//#define DM_ODM_SUPPORT_ADSL 0
+//#define DM_ODM_SUPPORT_CE 0
+//#define DM_ODM_SUPPORT_MP 1
+
+//
+// 2011/09/28 MH Define ODM SW team support flag.
+//
+
+
+
+//
+// Antenna Switch Relative Definition.
+//
+
+//
+// 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.
+//
+#define TP_MODE 0
+#define RSSI_MODE 1
+#define TRAFFIC_LOW 0
+#define TRAFFIC_HIGH 1
+
+
+//============================================================
+//3 Tx Power Tracking
+//3============================================================
+#define DPK_DELTA_MAPPING_NUM 13
+#define index_mapping_HP_NUM 15
+#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
+//3============================================================
+
+#define AFH_PSD 1 //0:normal PSD scan, 1: only do 20 pts PSD
+#define MODE_40M 0 //0:20M, 1:40M
+#define PSD_TH2 3
+#define PSD_CHMIN 20 // Minimum channel number for BT AFH
+#define SIR_STEP_SIZE 3
+#define Smooth_Size_1 5
+#define Smooth_TH_1 3
+#define Smooth_Size_2 10
+#define Smooth_TH_2 4
+#define Smooth_Size_3 20
+#define Smooth_TH_3 4
+#define Smooth_Step_Size 5
+#define Adaptive_SIR 1
+#if(RTL8723_FPGA_VERIFICATION == 1)
+#define PSD_RESCAN 1
+#else
+#define PSD_RESCAN 4
+#endif
+#define PSD_SCAN_INTERVAL 700 //ms
+
+
+
+//8723A High Power IGI Setting
+#define DM_DIG_HIGH_PWR_IGI_LOWER_BOUND 0x22
+#define DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND 0x28
+#define DM_DIG_HIGH_PWR_THRESHOLD 0x3a
+#define DM_DIG_LOW_PWR_THRESHOLD 0x14
+
+//ANT Test
+#define ANTTESTALL 0x00 //Ant A or B will be Testing
+#define ANTTESTA 0x01 //Ant A will be Testing
+#define ANTTESTB 0x02 //Ant B will be testing
+
+// 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
+#define MAX_ANT 3 // 3 for AP using
+
+
+//Antenna Diversity Type
+#define SW_ANTDIV 0
+#define HW_ANTDIV 1
+//============================================================
+// structure and define
+//============================================================
+
+//
+// 2011/09/20 MH Add for AP/ADSLpseudo DM structuer requirement.
+// We need to remove to other position???
+//
+#if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+typedef struct rtl8192cd_priv {
+ u1Byte temp;
+
+}rtl8192cd_priv, *prtl8192cd_priv;
+#endif
+
+
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+typedef struct _ADAPTER{
+ u1Byte temp;
+ #ifdef AP_BUILD_WORKAROUND
+ HAL_DATA_TYPE* temp2;
+ prtl8192cd_priv priv;
+ #endif
+}ADAPTER, *PADAPTER;
+#endif
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+
+typedef struct _WLAN_STA{
+ u1Byte temp;
+} WLAN_STA, *PRT_WLAN_STA;
+
+#endif
+
+typedef struct _Dynamic_Initial_Gain_Threshold_
+{
+ 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 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;
+
+typedef struct _Dynamic_Primary_CCA{
+ u1Byte PriCCA_flag;
+ u1Byte intf_flag;
+ u1Byte intf_type;
+ u1Byte DupRTS_flag;
+ u1Byte Monitor_flag;
+ u1Byte CH_offset;
+ u1Byte MF_state;
+}Pri_CCA_T, *pPri_CCA_T;
+
+typedef struct _Rate_Adaptive_Table_{
+ u1Byte firstconnect;
+}RA_T, *pRA_T;
+
+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 (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ #if USE_WORKITEM
+ RT_WORK_ITEM PSDTimeWorkitem;
+ #endif
+#endif
+
+}RXHP_T, *pRXHP_T;
+
+#if(DM_ODM_SUPPORT_TYPE & (ODM_CE))
+#define ASSOCIATE_ENTRY_NUM 32 // Max size of AsocEntry[].
+#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM
+
+#elif(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+#define ASSOCIATE_ENTRY_NUM NUM_STAT
+#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM+1
+
+#else
+//
+// 2012/01/12 MH Revise for compatiable with other SW team.
+// 0 is for STA 1-n is for AP clients.
+//
+#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM+1// Default port only one
+#endif
+
+//#ifdef CONFIG_ANTENNA_DIVERSITY
+// This indicates two different the steps.
+// In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
+// In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
+// with original RSSI to determine if it is necessary to switch antenna.
+#define SWAW_STEP_PEAK 0
+#define SWAW_STEP_DETERMINE 1
+
+#define TP_MODE 0
+#define RSSI_MODE 1
+#define TRAFFIC_LOW 0
+#define TRAFFIC_HIGH 1
+#define TRAFFIC_UltraLOW 2
+
+typedef struct _SW_Antenna_Switch_
+{
+ u1Byte Double_chk_flag;
+ u1Byte try_flag;
+ s4Byte PreRSSI;
+ u1Byte CurAntenna;
+ u1Byte PreAntenna;
+ u1Byte RSSI_Trying;
+ u1Byte TestMode;
+ u1Byte bTriggerAntennaSwitch;
+ u1Byte SelectAntennaMap;
+ u1Byte RSSI_target;
+ u1Byte reset_idx;
+
+ // Before link Antenna Switch check
+ u1Byte SWAS_NoLink_State;
+ u4Byte SWAS_NoLink_BK_Reg860;
+ u4Byte SWAS_NoLink_BK_Reg92c;
+ BOOLEAN ANTA_ON; //To indicate Ant A is or not
+ BOOLEAN ANTB_ON; //To indicate Ant B is on or not
+ u1Byte Ant5G;
+ u1Byte Ant2G;
+
+ s4Byte RSSI_sum_A;
+ s4Byte RSSI_sum_B;
+ s4Byte RSSI_cnt_A;
+ s4Byte RSSI_cnt_B;
+
+ u8Byte lastTxOkCnt;
+ u8Byte lastRxOkCnt;
+ u8Byte TXByteCnt_A;
+ u8Byte TXByteCnt_B;
+ u8Byte RXByteCnt_A;
+ u8Byte RXByteCnt_B;
+ u1Byte TrafficLoad;
+ u1Byte Train_time;
+ u1Byte Train_time_flag;
+ RT_TIMER SwAntennaSwitchTimer;
+ RT_TIMER SwAntennaSwitchTimer_8723B;
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ #if USE_WORKITEM
+ RT_WORK_ITEM SwAntennaSwitchWorkitem;
+ RT_WORK_ITEM SwAntennaSwitchWorkitem_8723B;
+ #endif
+#endif
+/* CE Platform use
+#ifdef CONFIG_SW_ANTENNA_DIVERSITY
+ _timer SwAntennaSwitchTimer;
+ u8Byte lastTxOkCnt;
+ u8Byte lastRxOkCnt;
+ u8Byte TXByteCnt_A;
+ u8Byte TXByteCnt_B;
+ u8Byte RXByteCnt_A;
+ u8Byte RXByteCnt_B;
+ u1Byte DoubleComfirm;
+ u1Byte TrafficLoad;
+ //SW Antenna Switch
+
+
+#endif
+*/
+#ifdef CONFIG_HW_ANTENNA_DIVERSITY
+ //Hybrid Antenna Diversity
+ u4Byte CCK_Ant1_Cnt[ASSOCIATE_ENTRY_NUM+1];
+ u4Byte CCK_Ant2_Cnt[ASSOCIATE_ENTRY_NUM+1];
+ u4Byte OFDM_Ant1_Cnt[ASSOCIATE_ENTRY_NUM+1];
+ u4Byte OFDM_Ant2_Cnt[ASSOCIATE_ENTRY_NUM+1];
+ u4Byte RSSI_Ant1_Sum[ASSOCIATE_ENTRY_NUM+1];
+ u4Byte RSSI_Ant2_Sum[ASSOCIATE_ENTRY_NUM+1];
+ u1Byte TxAnt[ASSOCIATE_ENTRY_NUM+1];
+ u1Byte TargetSTA;
+ u1Byte antsel;
+ u1Byte RxIdleAnt;
+
+#endif
+
+}SWAT_T, *pSWAT_T;
+//#endif
+
+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;
+
+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;
+
+
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+
+#ifdef ADSL_AP_BUILD_WORKAROUND
+#define MAX_TOLERANCE 5
+#define IQK_DELAY_TIME 1 //ms
+#endif
+
+//
+// Indicate different AP vendor for IOT issue.
+//
+typedef enum _HT_IOT_PEER
+{
+ HT_IOT_PEER_UNKNOWN = 0,
+ HT_IOT_PEER_REALTEK = 1,
+ HT_IOT_PEER_REALTEK_92SE = 2,
+ HT_IOT_PEER_BROADCOM = 3,
+ HT_IOT_PEER_RALINK = 4,
+ HT_IOT_PEER_ATHEROS = 5,
+ HT_IOT_PEER_CISCO = 6,
+ HT_IOT_PEER_MERU = 7,
+ HT_IOT_PEER_MARVELL = 8,
+ HT_IOT_PEER_REALTEK_SOFTAP = 9,// peer is RealTek SOFT_AP, by Bohn, 2009.12.17
+ HT_IOT_PEER_SELF_SOFTAP = 10, // Self is SoftAP
+ HT_IOT_PEER_AIRGO = 11,
+ HT_IOT_PEER_INTEL = 12,
+ HT_IOT_PEER_RTK_APCLIENT = 13,
+ HT_IOT_PEER_REALTEK_81XX = 14,
+ HT_IOT_PEER_REALTEK_WOW = 15,
+ HT_IOT_PEER_MAX = 16
+}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
+
+//
+// Declare for common info
+//
+#define MAX_PATH_NUM_92CS 2
+#define MAX_PATH_NUM_8188E 1
+#define MAX_PATH_NUM_8192E 2
+#define MAX_PATH_NUM_8723B 1
+#define MAX_PATH_NUM_8812A 2
+#define MAX_PATH_NUM_8821A 1
+
+#define IQK_THRESHOLD 8
+
+typedef struct _ODM_Phy_Status_Info_
+{
+ //
+ // Be care, if you want to add any element please insert between
+ // RxPWDBAll & SignalStrength.
+ //
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
+ u4Byte RxPWDBAll;
+#else
+ u1Byte RxPWDBAll;
+#endif
+
+ u1Byte SignalQuality; // in 0-100 index.
+ s1Byte RxMIMOSignalQuality[4]; //per-path's EVM
+ u1Byte RxMIMOEVMdbm[4]; //per-path's EVM dbm
+
+ u1Byte RxMIMOSignalStrength[4];// in 0~100 index
+
+ u2Byte Cfo_short[4]; // per-path's Cfo_short
+ u2Byte Cfo_tail[4]; // per-path's Cfo_tail
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+ s1Byte RxPower; // in dBm Translate from PWdB
+ s1Byte RecvSignalPower; // Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures.
+ u1Byte BTRxRSSIPercentage;
+ u1Byte SignalStrength; // in 0-100 index.
+
+ s1Byte RxPwr[4]; //per-path's pwdb
+#endif
+ u1Byte RxSNR[4]; //per-path's SNR
+ u1Byte BandWidth;
+ u1Byte btCoexPwrAdjust;
+}ODM_PHY_INFO_T,*PODM_PHY_INFO_T;
+
+
+typedef struct _ODM_Per_Pkt_Info_
+{
+ //u1Byte Rate;
+ u1Byte DataRate;
+ u1Byte StationID;
+ BOOLEAN bPacketMatchBSSID;
+ BOOLEAN bPacketToSelf;
+ BOOLEAN bPacketBeacon;
+}ODM_PACKET_INFO_T,*PODM_PACKET_INFO_T;
+
+
+typedef struct _ODM_Phy_Dbg_Info_
+{
+ //ODM Write,debug info
+ s1Byte RxSNRdB[4];
+ u8Byte NumQryPhyStatus;
+ u8Byte NumQryPhyStatusCCK;
+ u8Byte NumQryPhyStatusOFDM;
+ u1Byte NumQryBeaconPkt;
+ //Others
+ s4Byte RxEVM[4];
+
+}ODM_PHY_DBG_INFO_T;
+
+
+typedef struct _ODM_Mac_Status_Info_
+{
+ u1Byte test;
+
+}ODM_MAC_INFO;
+
+
+typedef enum tag_Dynamic_ODM_Support_Ability_Type
+{
+ // BB Team
+ ODM_DIG = 0x00000001,
+ ODM_HIGH_POWER = 0x00000002,
+ ODM_CCK_CCA_TH = 0x00000004,
+ ODM_FA_STATISTICS = 0x00000008,
+ ODM_RAMASK = 0x00000010,
+ ODM_RSSI_MONITOR = 0x00000020,
+ ODM_SW_ANTDIV = 0x00000040,
+ ODM_HW_ANTDIV = 0x00000080,
+ ODM_BB_PWRSV = 0x00000100,
+ ODM_2TPATHDIV = 0x00000200,
+ ODM_1TPATHDIV = 0x00000400,
+ ODM_PSD2AFH = 0x00000800
+}ODM_Ability_E;
+
+//
+// 2011/20/20 MH For MP driver RT_WLAN_STA = STA_INFO_T
+// Please declare below ODM relative info in your STA info structure.
+//
+#if 1
+typedef struct _ODM_STA_INFO{
+ // Driver Write
+ BOOLEAN bUsed; // record the sta status link or not?
+ //u1Byte WirelessMode; //
+ u1Byte IOTPeer; // Enum value. HT_IOT_PEER_E
+
+ // ODM Write
+ //1 PHY_STATUS_INFO
+ u1Byte RSSI_Path[4]; //
+ u1Byte RSSI_Ave;
+ u1Byte RXEVM[4];
+ u1Byte RXSNR[4];
+
+ // ODM Write
+ //1 TX_INFO (may changed by IC)
+ //TX_INFO_T pTxInfo; // Define in IC folder. Move lower layer.
+#if 0
+ u1Byte ANTSEL_A; //in Jagar: 4bit; others: 2bit
+ u1Byte ANTSEL_B; //in Jagar: 4bit; others: 2bit
+ u1Byte ANTSEL_C; //only in Jagar: 4bit
+ u1Byte ANTSEL_D; //only in Jagar: 4bit
+ u1Byte TX_ANTL; //not in Jagar: 2bit
+ u1Byte TX_ANT_HT; //not in Jagar: 2bit
+ u1Byte TX_ANT_CCK; //not in Jagar: 2bit
+ u1Byte TXAGC_A; //not in Jagar: 4bit
+ u1Byte TXAGC_B; //not in Jagar: 4bit
+ u1Byte TXPWR_OFFSET; //only in Jagar: 3bit
+ u1Byte TX_ANT; //only in Jagar: 4bit for TX_ANTL/TX_ANTHT/TX_ANT_CCK
+#endif
+
+ //
+ // Please use compile flag to disabe the strcutrue for other IC except 88E.
+ // Move To lower layer.
+ //
+ // ODM Write Wilson will handle this part(said by Luke.Lee)
+ //TX_RPT_T pTxRpt; // Define in IC folder. Move lower layer.
+#if 0
+ //1 For 88E RA (don't redefine the naming)
+ u1Byte rate_id;
+ u1Byte rate_SGI;
+ u1Byte rssi_sta_ra;
+ u1Byte SGI_enable;
+ u1Byte Decision_rate;
+ u1Byte Pre_rate;
+ u1Byte Active;
+
+ // Driver write Wilson handle.
+ //1 TX_RPT (don't redefine the naming)
+ u2Byte RTY[4]; // ???
+ u2Byte TOTAL; // ???
+ u2Byte DROP; // ???
+ //
+ // Please use compile flag to disabe the strcutrue for other IC except 88E.
+ //
+#endif
+
+}ODM_STA_INFO_T, *PODM_STA_INFO_T;
+#endif
+
+//
+// 2011/10/20 MH Define Common info enum for all team.
+//
+typedef enum _ODM_Common_Info_Definition
+{
+//-------------REMOVED CASE-----------//
+ //ODM_CMNINFO_CCK_HP,
+ //ODM_CMNINFO_RFPATH_ENABLE, // Define as ODM write???
+ //ODM_CMNINFO_BT_COEXIST, // ODM_BT_COEXIST_E
+ //ODM_CMNINFO_OP_MODE, // ODM_OPERATION_MODE_E
+//-------------REMOVED CASE-----------//
+
+ //
+ // Fixed value:
+ //
+
+ //-----------HOOK BEFORE REG INIT-----------//
+ ODM_CMNINFO_PLATFORM = 0,
+ ODM_CMNINFO_ABILITY, // ODM_ABILITY_E
+ ODM_CMNINFO_INTERFACE, // ODM_INTERFACE_E
+ ODM_CMNINFO_MP_TEST_CHIP,
+ ODM_CMNINFO_IC_TYPE, // ODM_IC_TYPE_E
+ ODM_CMNINFO_CUT_VER, // ODM_CUT_VERSION_E
+ ODM_CMNINFO_FAB_VER, // ODM_FAB_E
+ ODM_CMNINFO_RF_TYPE, // ODM_RF_PATH_E or ODM_RF_TYPE_E?
+ ODM_CMNINFO_RFE_TYPE,
+ ODM_CMNINFO_BOARD_TYPE, // ODM_BOARD_TYPE_E
+ ODM_CMNINFO_PACKAGE_TYPE,
+ ODM_CMNINFO_EXT_LNA, // TRUE
+ ODM_CMNINFO_5G_EXT_LNA,
+ ODM_CMNINFO_EXT_PA,
+ ODM_CMNINFO_5G_EXT_PA,
+ ODM_CMNINFO_GPA,
+ ODM_CMNINFO_APA,
+ ODM_CMNINFO_GLNA,
+ ODM_CMNINFO_ALNA,
+ ODM_CMNINFO_EXT_TRSW,
+ ODM_CMNINFO_PATCH_ID, //CUSTOMER ID
+ ODM_CMNINFO_BINHCT_TEST,
+ ODM_CMNINFO_BWIFI_TEST,
+ ODM_CMNINFO_SMART_CONCURRENT,
+ //-----------HOOK BEFORE REG INIT-----------//
+
+
+ //
+ // Dynamic value:
+ //
+//--------- POINTER REFERENCE-----------//
+ ODM_CMNINFO_MAC_PHY_MODE, // ODM_MAC_PHY_MODE_E
+ ODM_CMNINFO_TX_UNI,
+ ODM_CMNINFO_RX_UNI,
+ ODM_CMNINFO_WM_MODE, // ODM_WIRELESS_MODE_E
+ ODM_CMNINFO_BAND, // ODM_BAND_TYPE_E
+ ODM_CMNINFO_SEC_CHNL_OFFSET, // ODM_SEC_CHNL_OFFSET_E
+ ODM_CMNINFO_SEC_MODE, // ODM_SECURITY_E
+ ODM_CMNINFO_BW, // ODM_BW_E
+ ODM_CMNINFO_CHNL,
+ ODM_CMNINFO_FORCED_RATE,
+
+ ODM_CMNINFO_DMSP_GET_VALUE,
+ ODM_CMNINFO_BUDDY_ADAPTOR,
+ ODM_CMNINFO_DMSP_IS_MASTER,
+ ODM_CMNINFO_SCAN,
+ ODM_CMNINFO_POWER_SAVING,
+ ODM_CMNINFO_ONE_PATH_CCA, // ODM_CCA_PATH_E
+ ODM_CMNINFO_DRV_STOP,
+ ODM_CMNINFO_PNP_IN,
+ 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,
+//--------- POINTER REFERENCE-----------//
+
+//------------CALL BY VALUE-------------//
+ ODM_CMNINFO_WIFI_DIRECT,
+ ODM_CMNINFO_WIFI_DISPLAY,
+ ODM_CMNINFO_LINK_IN_PROGRESS,
+ ODM_CMNINFO_LINK,
+ ODM_CMNINFO_STATION_STATE,
+ ODM_CMNINFO_RSSI_MIN,
+ ODM_CMNINFO_DBG_COMP, // u8Byte
+ ODM_CMNINFO_DBG_LEVEL, // u4Byte
+ 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_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,
+//------------CALL BY VALUE-------------//
+
+ //
+ // Dynamic ptr array hook itms.
+ //
+ ODM_CMNINFO_STA_STATUS,
+ ODM_CMNINFO_PHY_STATUS,
+ ODM_CMNINFO_MAC_STATUS,
+
+ ODM_CMNINFO_MAX,
+
+
+}ODM_CMNINFO_E;
+
+//
+// 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY
+//
+typedef enum _ODM_Support_Ability_Definition
+{
+ //
+ // BB ODM section BIT 0-15
+ //
+ ODM_BB_DIG = BIT0,
+ ODM_BB_RA_MASK = BIT1,
+ ODM_BB_DYNAMIC_TXPWR = BIT2,
+ ODM_BB_FA_CNT = BIT3,
+ ODM_BB_RSSI_MONITOR = BIT4,
+ ODM_BB_CCK_PD = BIT5,
+ ODM_BB_ANT_DIV = BIT6,
+ ODM_BB_PWR_SAVE = BIT7,
+ ODM_BB_PWR_TRAIN = BIT8,
+ ODM_BB_RATE_ADAPTIVE = BIT9,
+ ODM_BB_PATH_DIV = BIT10,
+ ODM_BB_PSD = BIT11,
+ ODM_BB_RXHP = BIT12,
+ ODM_BB_ADAPTIVITY = BIT13,
+ ODM_BB_DYNAMIC_ATC = BIT14,
+ ODM_BB_NHM_CNT = BIT15,
+ ODM_BB_PRIMARY_CCA = BIT16,
+ ODM_BB_TXBF = BIT17,
+
+ //
+ // MAC DM section BIT 20-23
+ //
+ ODM_MAC_EDCA_TURBO = BIT20,
+ ODM_MAC_EARLY_MODE = BIT21,
+
+ //
+ // RF ODM section BIT 24-31
+ //
+ ODM_RF_TX_PWR_TRACK = BIT24,
+ ODM_RF_RX_GAIN_TRACK = BIT25,
+ ODM_RF_CALIBRATION = BIT26,
+
+}ODM_ABILITY_E;
+
+// ODM_CMNINFO_INTERFACE
+typedef enum tag_ODM_Support_Interface_Definition
+{
+ ODM_ITRF_PCIE = 0x1,
+ ODM_ITRF_USB = 0x2,
+ ODM_ITRF_SDIO = 0x4,
+ ODM_ITRF_ALL = 0x7,
+}ODM_INTERFACE_E;
+
+// ODM_CMNINFO_IC_TYPE
+typedef enum tag_ODM_Support_IC_Type_Definition
+{
+ ODM_RTL8192S = BIT0,
+ ODM_RTL8192C = BIT1,
+ ODM_RTL8192D = BIT2,
+ ODM_RTL8723A = BIT3,
+ ODM_RTL8188E = BIT4,
+ ODM_RTL8812 = BIT5,
+ ODM_RTL8821 = BIT6,
+ ODM_RTL8192E = BIT7,
+ ODM_RTL8723B = BIT8,
+ ODM_RTL8814A = BIT9,
+ ODM_RTL8881A = BIT10,
+ ODM_RTL8821B = BIT11,
+ ODM_RTL8822B = BIT12,
+ ODM_RTL8703B = BIT13,
+ ODM_RTL8195A = BIT14,
+ ODM_RTL8188F = BIT15
+}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_RTL8814A|ODM_RTL8881A)
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+#ifdef RTK_AC_SUPPORT
+#define ODM_IC_11AC_SERIES_SUPPORT 1
+#else
+#define ODM_IC_11AC_SERIES_SUPPORT 0
+#endif
+#else
+#define ODM_IC_11AC_SERIES_SUPPORT 1
+#endif
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+#ifdef CONFIG_BT_COEXIST
+#define ODM_CONFIG_BT_COEXIST 1
+#else
+#define ODM_CONFIG_BT_COEXIST 0
+#endif
+#endif
+
+//ODM_CMNINFO_CUT_VER
+typedef enum tag_ODM_Cut_Version_Definition
+{
+ ODM_CUT_A = 0,
+ ODM_CUT_B = 1,
+ ODM_CUT_C = 2,
+ ODM_CUT_D = 3,
+ ODM_CUT_E = 4,
+ ODM_CUT_F = 5,
+
+ ODM_CUT_I = 8,
+ ODM_CUT_TEST = 15,
+}ODM_CUT_VERSION_E;
+
+// ODM_CMNINFO_FAB_VER
+typedef enum tag_ODM_Fab_Version_Definition
+{
+ ODM_TSMC = 0,
+ ODM_UMC = 1,
+}ODM_FAB_E;
+
+// ODM_CMNINFO_RF_TYPE
+//
+// For example 1T2R (A+AB = BIT0|BIT4|BIT5)
+//
+typedef enum tag_ODM_RF_Path_Bit_Definition
+{
+ ODM_RF_TX_A = BIT0,
+ ODM_RF_TX_B = BIT1,
+ ODM_RF_TX_C = BIT2,
+ ODM_RF_TX_D = BIT3,
+ ODM_RF_RX_A = BIT4,
+ ODM_RF_RX_B = BIT5,
+ ODM_RF_RX_C = BIT6,
+ ODM_RF_RX_D = BIT7,
+}ODM_RF_PATH_E;
+
+
+typedef enum tag_ODM_RF_Type_Definition
+{
+ ODM_1T1R = 0,
+ ODM_1T2R = 1,
+ ODM_2T2R = 2,
+ ODM_2T3R = 3,
+ ODM_2T4R = 4,
+ ODM_3T3R = 5,
+ ODM_3T4R = 6,
+ ODM_4T4R = 7,
+}ODM_RF_TYPE_E;
+
+
+//
+// ODM Dynamic common info value definition
+//
+
+//typedef enum _MACPHY_MODE_8192D{
+// SINGLEMAC_SINGLEPHY,
+// DUALMAC_DUALPHY,
+// DUALMAC_SINGLEPHY,
+//}MACPHY_MODE_8192D,*PMACPHY_MODE_8192D;
+// Above is the original define in MP driver. Please use the same define. THX.
+typedef enum tag_ODM_MAC_PHY_Mode_Definition
+{
+ ODM_SMSP = 0,
+ ODM_DMSP = 1,
+ ODM_DMDP = 2,
+}ODM_MAC_PHY_MODE_E;
+
+
+typedef enum tag_BT_Coexist_Definition
+{
+ ODM_BT_BUSY = 1,
+ ODM_BT_ON = 2,
+ ODM_BT_OFF = 3,
+ ODM_BT_NONE = 4,
+}ODM_BT_COEXIST_E;
+
+// ODM_CMNINFO_OP_MODE
+typedef enum tag_Operation_Mode_Definition
+{
+ ODM_NO_LINK = BIT0,
+ ODM_LINK = BIT1,
+ ODM_SCAN = BIT2,
+ ODM_POWERSAVE = BIT3,
+ ODM_AP_MODE = BIT4,
+ ODM_CLIENT_MODE = BIT5,
+ ODM_AD_HOC = BIT6,
+ ODM_WIFI_DIRECT = BIT7,
+ ODM_WIFI_DISPLAY = BIT8,
+}ODM_OPERATION_MODE_E;
+
+// ODM_CMNINFO_WM_MODE
+#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_CE))
+typedef enum tag_Wireless_Mode_Definition
+{
+ ODM_WM_UNKNOW = 0x0,
+ ODM_WM_B = BIT0,
+ ODM_WM_G = BIT1,
+ ODM_WM_A = BIT2,
+ ODM_WM_N24G = BIT3,
+ ODM_WM_N5G = BIT4,
+ ODM_WM_AUTO = BIT5,
+ ODM_WM_AC = BIT6,
+}ODM_WIRELESS_MODE_E;
+#else
+typedef enum tag_Wireless_Mode_Definition
+{
+ ODM_WM_UNKNOWN = 0x00,
+ ODM_WM_A = BIT0,
+ ODM_WM_B = BIT1,
+ ODM_WM_G = BIT2,
+ ODM_WM_AUTO = BIT3,
+ ODM_WM_N24G = BIT4,
+ ODM_WM_N5G = BIT5,
+ ODM_WM_AC_5G = BIT6,
+ ODM_WM_AC_24G = BIT7,
+ ODM_WM_AC_ONLY = BIT8,
+ ODM_WM_MAX = BIT9
+}ODM_WIRELESS_MODE_E;
+#endif
+
+// ODM_CMNINFO_BAND
+typedef enum tag_Band_Type_Definition
+{
+ ODM_BAND_2_4G = 0,
+ ODM_BAND_5G,
+ ODM_BAND_ON_BOTH,
+ ODM_BANDMAX
+
+}ODM_BAND_TYPE_E;
+
+// ODM_CMNINFO_SEC_CHNL_OFFSET
+typedef enum tag_Secondary_Channel_Offset_Definition
+{
+ ODM_DONT_CARE = 0,
+ ODM_BELOW = 1,
+ ODM_ABOVE = 2
+}ODM_SEC_CHNL_OFFSET_E;
+
+// ODM_CMNINFO_SEC_MODE
+typedef enum tag_Security_Definition
+{
+ ODM_SEC_OPEN = 0,
+ ODM_SEC_WEP40 = 1,
+ ODM_SEC_TKIP = 2,
+ ODM_SEC_RESERVE = 3,
+ ODM_SEC_AESCCMP = 4,
+ ODM_SEC_WEP104 = 5,
+ ODM_WEP_WPA_MIXED = 6, // WEP + WPA
+ ODM_SEC_SMS4 = 7,
+}ODM_SECURITY_E;
+
+// ODM_CMNINFO_BW
+typedef enum tag_Bandwidth_Definition
+{
+ ODM_BW20M = 0,
+ ODM_BW40M = 1,
+ ODM_BW80M = 2,
+ ODM_BW160M = 3,
+ ODM_BW10M = 4,
+}ODM_BW_E;
+
+
+// ODM_CMNINFO_BOARD_TYPE
+// For non-AC-series IC , ODM_BOARD_5G_EXT_PA and ODM_BOARD_5G_EXT_LNA are ignored
+// For AC-series IC, external PA & LNA can be indivisuallly added on 2.4G and/or 5G
+typedef enum tag_Board_Definition
+{
+ ODM_BOARD_DEFAULT = 0, // The DEFAULT case.
+ ODM_BOARD_MINICARD = BIT(0), // 0 = non-mini card, 1= mini card.
+ ODM_BOARD_SLIM = BIT(1), // 0 = non-slim card, 1 = slim card
+ ODM_BOARD_BT = BIT(2), // 0 = without BT card, 1 = with BT
+ ODM_BOARD_EXT_PA = BIT(3), // 0 = no 2G ext-PA, 1 = existing 2G ext-PA
+ ODM_BOARD_EXT_LNA = BIT(4), // 0 = no 2G ext-LNA, 1 = existing 2G ext-LNA
+ ODM_BOARD_EXT_TRSW = BIT(5), // 0 = no ext-TRSW, 1 = existing ext-TRSW
+ ODM_BOARD_EXT_PA_5G = BIT(6), // 0 = no 5G ext-PA, 1 = existing 5G ext-PA
+ ODM_BOARD_EXT_LNA_5G= BIT(7), // 0 = no 5G ext-LNA, 1 = existing 5G ext-LNA
+}ODM_BOARD_TYPE_E;
+
+typedef enum tag_ODM_Package_Definition
+{
+ ODM_PACKAGE_DEFAULT = 0,
+ ODM_PACKAGE_QFN68 = BIT(0),
+ ODM_PACKAGE_TFBGA90 = BIT(1),
+ ODM_PACKAGE_TFBGA79 = BIT(2),
+}ODM_Package_TYPE_E;
+
+typedef enum tag_ODM_TYPE_GPA_Definition
+{
+ TYPE_GPA0 = 0,
+ TYPE_GPA1 = BIT(1)|BIT(0)
+}ODM_TYPE_GPA_E;
+
+typedef enum tag_ODM_TYPE_APA_Definition
+{
+ TYPE_APA0 = 0,
+ TYPE_APA1 = BIT(1)|BIT(0)
+}ODM_TYPE_APA_E;
+
+typedef enum tag_ODM_TYPE_GLNA_Definition
+{
+ TYPE_GLNA0 = 0,
+ TYPE_GLNA1 = BIT(2)|BIT(0),
+ TYPE_GLNA2 = BIT(3)|BIT(1),
+ TYPE_GLNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0)
+}ODM_TYPE_GLNA_E;
+
+typedef enum tag_ODM_TYPE_ALNA_Definition
+{
+ TYPE_ALNA0 = 0,
+ TYPE_ALNA1 = BIT(2)|BIT(0),
+ TYPE_ALNA2 = BIT(3)|BIT(1),
+ TYPE_ALNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0)
+}ODM_TYPE_ALNA_E;
+
+// ODM_CMNINFO_ONE_PATH_CCA
+typedef enum tag_CCA_Path
+{
+ ODM_CCA_2R = 0,
+ ODM_CCA_1R_A = 1,
+ ODM_CCA_1R_B = 2,
+}ODM_CCA_PATH_E;
+
+
+typedef struct _ODM_RA_Info_
+{
+ u1Byte RateID;
+ u4Byte RateMask;
+ u4Byte RAUseRate;
+ u1Byte RateSGI;
+ u1Byte RssiStaRA;
+ u1Byte PreRssiStaRA;
+ u1Byte SGIEnable;
+ u1Byte DecisionRate;
+ u1Byte PreRate;
+ u1Byte HighestRate;
+ u1Byte LowestRate;
+ u4Byte NscUp;
+ u4Byte NscDown;
+ u2Byte RTY[5];
+ u4Byte TOTAL;
+ u2Byte DROP;
+ u1Byte Active;
+ u2Byte RptTime;
+ u1Byte RAWaitingCounter;
+ u1Byte RAPendingCounter;
+#if 1 //POWER_TRAINING_ACTIVE == 1 // For compile pass only~!
+ u1Byte PTActive; // on or off
+ u1Byte PTTryState; // 0 trying state, 1 for decision state
+ u1Byte PTStage; // 0~6
+ u1Byte PTStopCount; //Stop PT counter
+ u1Byte PTPreRate; // if rate change do PT
+ u1Byte PTPreRssi; // if RSSI change 5% do PT
+ u1Byte PTModeSS; // decide whitch rate should do PT
+ u1Byte RAstage; // StageRA, decide how many times RA will be done between PT
+ u1Byte PTSmoothFactor;
+#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;
+
+#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;
+
+ 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
+//
+
+typedef struct _FAST_ANTENNA_TRAINNING_
+{
+ u1Byte Bssid[6];
+ u1Byte antsel_rx_keep_0;
+ u1Byte antsel_rx_keep_1;
+ u1Byte antsel_rx_keep_2;
+ u4Byte antSumRSSI[7];
+ u4Byte antRSSIcnt[7];
+ u4Byte antAveRSSI[7];
+ u1Byte FAT_State;
+ u4Byte TrainIdx;
+ u1Byte antsel_a[ODM_ASSOCIATE_ENTRY_NUM];
+ u1Byte antsel_b[ODM_ASSOCIATE_ENTRY_NUM];
+ u1Byte antsel_c[ODM_ASSOCIATE_ENTRY_NUM];
+ u4Byte MainAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM];
+ u4Byte AuxAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM];
+ u4Byte MainAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
+ u4Byte AuxAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
+ u1Byte RxIdleAnt;
+ BOOLEAN bBecomeLinked;
+ u4Byte MinMaxRSSI;
+ u1Byte idx_AntDiv_counter_2G;
+ u1Byte idx_AntDiv_counter_5G;
+ u4Byte AntDiv_2G_5G;
+ u4Byte CCK_counter_main;
+ u4Byte CCK_counter_aux;
+ u4Byte OFDM_counter_main;
+ u4Byte OFDM_counter_aux;
+
+}FAT_T,*pFAT_T;
+
+typedef enum _FAT_STATE
+{
+ FAT_NORMAL_STATE = 0,
+ FAT_TRAINING_STATE = 1,
+}FAT_STATE_E, *PFAT_STATE_E;
+
+typedef enum _ANT_DIV_TYPE
+{
+ NO_ANTDIV = 0xFF,
+ CG_TRX_HW_ANTDIV = 0x01,
+ CGCS_RX_HW_ANTDIV = 0x02,
+ FIXED_HW_ANTDIV = 0x03,
+ CG_TRX_SMART_ANTDIV = 0x04,
+ CGCS_RX_SW_ANTDIV = 0x05,
+ S0S1_SW_ANTDIV = 0x06 //8723B intrnal switch S0 S1
+}ANT_DIV_TYPE_E, *PANT_DIV_TYPE_E;
+
+typedef struct _ODM_PATH_DIVERSITY_
+{
+ u1Byte RespTxPath;
+ u1Byte PathSel[ODM_ASSOCIATE_ENTRY_NUM];
+ u4Byte PathA_Sum[ODM_ASSOCIATE_ENTRY_NUM];
+ u4Byte PathB_Sum[ODM_ASSOCIATE_ENTRY_NUM];
+ u4Byte PathA_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
+ u4Byte PathB_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
+}PATHDIV_T, *pPATHDIV_T;
+
+
+typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE{
+ PHY_REG_PG_RELATIVE_VALUE = 0,
+ PHY_REG_PG_EXACT_VALUE = 1
+} PHY_REG_PG_TYPE;
+
+
+//
+// Antenna detection information from single tone mechanism, added by Roger, 2012.11.27.
+//
+typedef struct _ANT_DETECTED_INFO{
+ BOOLEAN bAntDetected;
+ u4Byte dBForAntA;
+ u4Byte dBForAntB;
+ u4Byte dBForAntO;
+}ANT_DETECTED_INFO, *PANT_DETECTED_INFO;
+
+//
+// 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration.
+//
+#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+#if (RT_PLATFORM != PLATFORM_LINUX)
+typedef
+#endif
+struct DM_Out_Source_Dynamic_Mechanism_Structure
+#else// for AP,ADSL,CE Team
+typedef struct DM_Out_Source_Dynamic_Mechanism_Structure
+#endif
+{
+ //RT_TIMER FastAntTrainingTimer;
+ //
+ // Add for different team use temporarily
+ //
+ PADAPTER Adapter; // For CE/NIC team
+ prtl8192cd_priv priv; // For AP/ADSL team
+ // WHen you use Adapter or priv pointer, you must make sure the pointer is ready.
+ BOOLEAN odm_ready;
+
+#if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+ rtl8192cd_priv fake_priv;
+#endif
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ // ADSL_AP_BUILD_WORKAROUND
+ ADAPTER fake_adapter;
+#endif
+
+ PHY_REG_PG_TYPE PhyRegPgValueType;
+ u1Byte PhyRegPgVersion;
+
+ u8Byte DebugComponents;
+ u4Byte DebugLevel;
+
+ u8Byte NumQryPhyStatusAll; //CCK + OFDM
+ u8Byte LastNumQryPhyStatusAll;
+ u8Byte RxPWDBAve;
+ u8Byte RxPWDBAve_final;
+ BOOLEAN MPDIG_2G; //off MPDIG
+ u1Byte Times_2G;
+
+//------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------//
+ BOOLEAN bCckHighPower;
+ u1Byte RFPathRxEnable; // ODM_CMNINFO_RFPATH_ENABLE
+ u1Byte ControlChannel;
+//------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------//
+
+//--------REMOVED COMMON INFO----------//
+ //u1Byte PseudoMacPhyMode;
+ //BOOLEAN *BTCoexist;
+ //BOOLEAN PseudoBtCoexist;
+ //u1Byte OPMode;
+ //BOOLEAN bAPMode;
+ //BOOLEAN bClientMode;
+ //BOOLEAN bAdHocMode;
+ //BOOLEAN bSlaveOfDMSP;
+//--------REMOVED COMMON INFO----------//
+
+
+//1 COMMON INFORMATION
+
+ //
+ // Init Value
+ //
+//-----------HOOK BEFORE REG INIT-----------//
+ // ODM Platform info AP/ADSL/CE/MP = 1/2/3/4
+ u1Byte SupportPlatform;
+ // ODM Support Ability DIG/RATR/TX_PWR_TRACK/ ¡K¡K = 1/2/3/¡K
+ u4Byte SupportAbility;
+ // ODM PCIE/USB/SDIO = 1/2/3
+ u1Byte SupportInterface;
+ // ODM composite or independent. Bit oriented/ 92C+92D+ .... or any other type = 1/2/3/...
+ u4Byte SupportICType;
+ // Cut Version TestChip/A-cut/B-cut... = 0/1/2/3/...
+ u1Byte CutVersion;
+ // Fab Version TSMC/UMC = 0/1
+ u1Byte FabVersion;
+ // RF Type 4T4R/3T3R/2T2R/1T2R/1T1R/...
+ u1Byte RFType;
+ u1Byte RFEType;
+ // Board Type Normal/HighPower/MiniCard/SLIM/Combo/... = 0/1/2/3/4/...
+ u1Byte BoardType;
+ u1Byte PackageType;
+ u1Byte TypeGLNA;
+ u1Byte TypeGPA;
+ u1Byte TypeALNA;
+ u1Byte TypeAPA;
+ // with external LNA NO/Yes = 0/1
+ u1Byte ExtLNA;
+ u1Byte ExtLNA5G;
+ // with external PA NO/Yes = 0/1
+ u1Byte ExtPA;
+ u1Byte ExtPA5G;
+ // with external TRSW NO/Yes = 0/1
+ u1Byte ExtTRSW;
+ u1Byte PatchID; //Customer ID
+ BOOLEAN bInHctTest;
+ BOOLEAN bWIFITest;
+
+ BOOLEAN bDualMacSmartConcurrent;
+ u4Byte BK_SupportAbility;
+ u1Byte AntDivType;
+//-----------HOOK BEFORE REG INIT-----------//
+
+ //
+ // Dynamic Value
+ //
+//--------- POINTER REFERENCE-----------//
+
+ u1Byte u1Byte_temp;
+ BOOLEAN BOOLEAN_temp;
+ PADAPTER PADAPTER_temp;
+
+ // MAC PHY Mode SMSP/DMSP/DMDP = 0/1/2
+ u1Byte *pMacPhyMode;
+ //TX Unicast byte count
+ u8Byte *pNumTxBytesUnicast;
+ //RX Unicast byte count
+ u8Byte *pNumRxBytesUnicast;
+ // Wireless mode B/G/A/N = BIT0/BIT1/BIT2/BIT3
+ u1Byte *pWirelessMode; //ODM_WIRELESS_MODE_E
+ // Frequence band 2.4G/5G = 0/1
+ u1Byte *pBandType;
+ // Secondary channel offset don't_care/below/above = 0/1/2
+ u1Byte *pSecChOffset;
+ // Security mode Open/WEP/AES/TKIP = 0/1/2/3
+ u1Byte *pSecurity;
+ // BW info 20M/40M/80M = 0/1/2
+ u1Byte *pBandWidth;
+ // Central channel location Ch1/Ch2/....
+ u1Byte *pChannel; //central channel number
+ BOOLEAN DPK_Done;
+ // Common info for 92D DMSP
+
+ BOOLEAN *pbGetValueFromOtherMac;
+ PADAPTER *pBuddyAdapter;
+ BOOLEAN *pbMasterOfDMSP; //MAC0: master, MAC1: slave
+ // Common info for Status
+ BOOLEAN *pbScanInProcess;
+ BOOLEAN *pbPowerSaving;
+ // CCA Path 2-path/path-A/path-B = 0/1/2; using ODM_CCA_PATH_E.
+ u1Byte *pOnePathCCA;
+ //pMgntInfo->AntennaTest
+ u1Byte *pAntennaTest;
+ BOOLEAN *pbNet_closed;
+ u1Byte *mp_mode;
+ //u1Byte *pAidMap;
+ u1Byte *pu1ForcedIgiLb;
+//--------- POINTER REFERENCE-----------//
+ pu2Byte pForcedDataRate;
+//------------CALL BY VALUE-------------//
+ BOOLEAN bLinkInProcess;
+ 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;
+ // Common info for BTDM
+ BOOLEAN bBtDisabled; // BT is disabled
+ BOOLEAN bBtConnectProcess; // BT HS is under connection progress.
+ u1Byte btHsRssi; // BT HS mode wifi rssi value.
+ BOOLEAN bBtHsOperation; // BT HS mode is under progress
+ BOOLEAN bBtDisableEdcaTurbo; // Under some condition, don't enable the EDCA Turbo
+ BOOLEAN bBtLimitedDig; // BT is busy.
+//------------CALL BY VALUE-------------//
+ u1Byte RSSI_A;
+ u1Byte RSSI_B;
+ 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;
+ u1Byte preChannel;
+ u4Byte TxagcOffsetValueA;
+ BOOLEAN IsTxagcOffsetPositiveA;
+ u4Byte TxagcOffsetValueB;
+ BOOLEAN IsTxagcOffsetPositiveB;
+ u8Byte lastTxOkCnt;
+ u8Byte lastRxOkCnt;
+ u4Byte BbSwingOffsetA;
+ BOOLEAN IsBbSwingOffsetPositiveA;
+ u4Byte BbSwingOffsetB;
+ BOOLEAN IsBbSwingOffsetPositiveB;
+
+ //For Adaptivtiy
+ u2Byte NHM_cnt_0;
+ u2Byte NHM_cnt_1;
+ s1Byte TH_L2H_ini;
+ s1Byte TH_EDCCA_HL_diff;
+ s1Byte TH_L2H_ini_backup;
+ BOOLEAN Carrier_Sense_enable;
+ u1Byte Adaptivity_IGI_upper;
+ BOOLEAN adaptivity_flag;
+ u1Byte DCbackoff;
+ BOOLEAN Adaptivity_enable;
+ u1Byte APTotalNum;
+ ADAPTIVITY_STATISTICS Adaptivity;
+ //For Adaptivtiy
+
+ u1Byte antdiv_rssi;
+ u1Byte AntType;
+ u1Byte pre_AntType;
+ u1Byte antdiv_period;
+ u1Byte antdiv_select;
+ //2 Define STA info.
+ // _ODM_STA_INFO
+ // 2012/01/12 MH For MP, we need to reduce one array pointer for default port.??
+ PSTA_INFO_T pODM_StaInfo[ODM_ASSOCIATE_ENTRY_NUM];
+
+#if (RATE_ADAPTIVE_SUPPORT == 1)
+ u2Byte CurrminRptTime;
+ ODM_RA_INFO_T RAInfo[ODM_ASSOCIATE_ENTRY_NUM]; //See HalMacID support
+#endif
+ //
+ // 2012/02/14 MH Add to share 88E ra with other SW team.
+ // We need to colelct all support abilit to a proper area.
+ //
+ BOOLEAN RaSupport88E;
+
+ // Define ...........
+
+ // Latest packet phy info (ODM write)
+ ODM_PHY_DBG_INFO_T PhyDbgInfo;
+ //PHY_INFO_88E PhyInfo;
+
+ // Latest packet phy info (ODM write)
+ ODM_MAC_INFO *pMacInfo;
+ //MAC_INFO_88E MacInfo;
+
+ // Different Team independt structure??
+
+ //
+ //TX_RTP_CMN TX_retrpo;
+ //TX_RTP_88E TX_retrpo;
+ //TX_RTP_8195 TX_retrpo;
+
+ //
+ //ODM Structure
+ //
+ 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;
+ //#ifdef CONFIG_ANTENNA_DIVERSITY
+ SWAT_T DM_SWAT_Table;
+ BOOLEAN RSSI_test;
+ //#endif
+
+#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ //Path Div Struct
+ PATHDIV_PARA pathIQK;
+#endif
+
+ EDCA_T DM_EDCA_Table;
+ u4Byte WMMEDCA_BE;
+ PATHDIV_T DM_PathDiv;
+ // Copy from SD4 structure
+ //
+ // ==================================================
+ //
+
+ //common
+ //u1Byte DM_Type;
+ //u1Byte PSD_Report_RXHP[80]; // Add By Gary
+ //u1Byte PSD_func_flag; // Add By Gary
+ //for DIG
+ //u1Byte bDMInitialGainEnable;
+ //u1Byte binitialized; // for dm_initial_gain_Multi_STA use.
+ //for Antenna diversity
+ //u8 AntDivCfg;// 0:OFF , 1:ON, 2:by efuse
+ //PSTA_INFO_T RSSI_target;
+
+ BOOLEAN *pbDriverStopped;
+ BOOLEAN *pbDriverIsGoingToPnpSetPowerSleep;
+ BOOLEAN *pinit_adpt_in_progress;
+
+ //PSD
+ BOOLEAN bUserAssignLevel;
+ RT_TIMER PSDTimer;
+ u1Byte RSSI_BT; //come from BT
+ BOOLEAN bPSDinProcess;
+ BOOLEAN bPSDactive;
+ BOOLEAN bDMInitialGainEnable;
+
+ //MPT DIG
+ RT_TIMER MPT_DIGTimer;
+
+ //for rate adaptive, in fact, 88c/92c fw will handle this
+ u1Byte bUseRAMask;
+
+ ODM_RATE_ADAPTIVE RateAdaptive;
+
+ ANT_DETECTED_INFO AntDetectedInfo; // Antenna detected information for RSSI tool
+
+ ODM_RF_CAL_T RFCalibrateInfo;
+
+ //
+ // TX power tracking
+ //
+ u1Byte BbSwingIdxOfdm[MAX_RF_PATH];
+ u1Byte BbSwingIdxOfdmCurrent;
+ u1Byte BbSwingIdxOfdmBase[MAX_RF_PATH];
+ BOOLEAN BbSwingFlagOfdm;
+ u1Byte BbSwingIdxCck;
+ u1Byte BbSwingIdxCckCurrent;
+ u1Byte BbSwingIdxCckBase;
+ u1Byte DefaultOfdmIndex;
+ u1Byte DefaultCckIndex;
+ BOOLEAN BbSwingFlagCck;
+
+ s1Byte Absolute_OFDMSwingIdx[MAX_RF_PATH];
+ s1Byte Remnant_OFDMSwingIdx[MAX_RF_PATH];
+ s1Byte Remnant_CCKSwingIdx;
+ s1Byte Modify_TxAGC_Value; //Remnat compensate value at TxAGC
+ BOOLEAN Modify_TxAGC_Flag_PathA;
+ BOOLEAN Modify_TxAGC_Flag_PathB;
+ BOOLEAN Modify_TxAGC_Flag_PathA_CCK;
+
+ //
+ // 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;
+
+ //
+ // ODM system resource.
+ //
+
+ // ODM relative time.
+ RT_TIMER PathDivSwitchTimer;
+ //2011.09.27 add for Path Diversity
+ RT_TIMER CCKPathDiversityTimer;
+ RT_TIMER FastAntTrainingTimer;
+
+ // ODM relative workitem.
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ #if USE_WORKITEM
+ RT_WORK_ITEM PathDivSwitchWorkitem;
+ RT_WORK_ITEM CCKPathDiversityWorkitem;
+ RT_WORK_ITEM FastAntTrainingWorkitem;
+ RT_WORK_ITEM MPT_DIGWorkitem;
+ RT_WORK_ITEM RaRptWorkitem;
+ #endif
+#endif
+
+#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+
+#if (RT_PLATFORM != PLATFORM_LINUX)
+} DM_ODM_T, *PDM_ODM_T; // DM_Dynamic_Mechanism_Structure
+#else
+};
+#endif
+
+#else// for AP,ADSL,CE Team
+} DM_ODM_T, *PDM_ODM_T; // DM_Dynamic_Mechanism_Structure
+#endif
+
+
+
+#if 1 //92c-series
+#define ODM_RF_PATH_MAX 2
+#else //jaguar - series
+#define ODM_RF_PATH_MAX 4
+#endif
+
+typedef enum _ODM_RF_RADIO_PATH {
+ ODM_RF_PATH_A = 0, //Radio Path A
+ ODM_RF_PATH_B = 1, //Radio Path B
+ ODM_RF_PATH_C = 2, //Radio Path C
+ ODM_RF_PATH_D = 3, //Radio Path D
+ ODM_RF_PATH_AB,
+ ODM_RF_PATH_AC,
+ ODM_RF_PATH_AD,
+ ODM_RF_PATH_BC,
+ ODM_RF_PATH_BD,
+ ODM_RF_PATH_CD,
+ ODM_RF_PATH_ABC,
+ ODM_RF_PATH_ACD,
+ ODM_RF_PATH_BCD,
+ ODM_RF_PATH_ABCD,
+ // ODM_RF_PATH_MAX, //Max RF number 90 support
+} ODM_RF_RADIO_PATH_E, *PODM_RF_RADIO_PATH_E;
+
+ typedef enum _ODM_RF_CONTENT{
+ odm_radioa_txt = 0x1000,
+ odm_radiob_txt = 0x1001,
+ odm_radioc_txt = 0x1002,
+ odm_radiod_txt = 0x1003
+} ODM_RF_CONTENT;
+
+typedef enum _ODM_BB_Config_Type{
+ CONFIG_BB_PHY_REG,
+ CONFIG_BB_AGC_TAB,
+ CONFIG_BB_AGC_TAB_2G,
+ CONFIG_BB_AGC_TAB_5G,
+ CONFIG_BB_PHY_REG_PG,
+ CONFIG_BB_PHY_REG_MP,
+ CONFIG_BB_AGC_TAB_DIFF,
+} ODM_BB_Config_Type, *PODM_BB_Config_Type;
+
+typedef enum _ODM_RF_Config_Type{
+ CONFIG_RF_RADIO,
+ CONFIG_RF_TXPWR_LMT,
+} ODM_RF_Config_Type, *PODM_RF_Config_Type;
+
+typedef enum _ODM_FW_Config_Type{
+ CONFIG_FW_NIC,
+ CONFIG_FW_NIC_2,
+ CONFIG_FW_AP,
+ CONFIG_FW_MP,
+ CONFIG_FW_WoWLAN,
+ CONFIG_FW_WoWLAN_2,
+ CONFIG_FW_AP_WoWLAN,
+ CONFIG_FW_BT,
+} ODM_FW_Config_Type;
+
+// Status code
+#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
+typedef enum _RT_STATUS{
+ RT_STATUS_SUCCESS,
+ RT_STATUS_FAILURE,
+ RT_STATUS_PENDING,
+ RT_STATUS_RESOURCE,
+ RT_STATUS_INVALID_CONTEXT,
+ RT_STATUS_INVALID_PARAMETER,
+ RT_STATUS_NOT_SUPPORT,
+ RT_STATUS_OS_API_FAILED,
+}RT_STATUS,*PRT_STATUS;
+#endif // end of RT_STATUS definition
+
+#ifdef REMOVE_PACK
+#pragma pack()
+#endif
+
+//#include "odm_function.h"
+
+//3===========================================================
+//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
+
+//3===========================================================
+//3 AGC RX High Power Mode
+//3===========================================================
+#define LNA_Low_Gain_1 0x64
+#define LNA_Low_Gain_2 0x5A
+#define LNA_Low_Gain_3 0x58
+
+#define FA_RXHP_TH1 5000
+#define FA_RXHP_TH2 1500
+#define FA_RXHP_TH3 800
+#define FA_RXHP_TH4 600
+#define FA_RXHP_TH5 500
+
+//3===========================================================
+//3 EDCA
+//3===========================================================
+
+//3===========================================================
+//3 Dynamic Tx Power
+//3===========================================================
+//Dynamic Tx Power Control Threshold
+#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
+#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
+#define TX_POWER_NEAR_FIELD_THRESH_AP 0x3F
+
+#define TxHighPwrLevel_Normal 0
+#define TxHighPwrLevel_Level1 1
+#define TxHighPwrLevel_Level2 2
+#define TxHighPwrLevel_BT1 3
+#define TxHighPwrLevel_BT2 4
+#define TxHighPwrLevel_15 5
+#define TxHighPwrLevel_35 6
+#define TxHighPwrLevel_50 7
+#define TxHighPwrLevel_70 8
+#define TxHighPwrLevel_100 9
+
+//3===========================================================
+//3 Tx Power Tracking
+//3===========================================================
+#if 0 //mask this, since these have been defined in typdef.h, vivi
+#define OFDM_TABLE_SIZE 43
+#define CCK_TABLE_SIZE 33
+#endif
+
+
+//3===========================================================
+//3 Rate Adaptive
+//3===========================================================
+#define DM_RATR_STA_INIT 0
+#define DM_RATR_STA_HIGH 1
+#define DM_RATR_STA_MIDDLE 2
+#define DM_RATR_STA_LOW 3
+
+//3===========================================================
+//3 BB Power Save
+//3===========================================================
+
+
+//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,
+ CCA_2R = 1,
+ CCA_MAX = 2,
+}DM_1R_CCA_E;
+
+typedef enum tag_RF_Type_Definition
+{
+ RF_Save =0,
+ RF_Normal = 1,
+ RF_MAX = 2,
+}DM_RF_E;
+
+//3===========================================================
+//3 Antenna Diversity
+//3===========================================================
+typedef enum tag_SW_Antenna_Switch_Definition
+{
+ Antenna_A = 1,
+ Antenna_B = 2,
+ Antenna_MAX = 3,
+}DM_SWAS_E;
+
+
+// Maximal number of antenna detection mechanism needs to perform, added by Roger, 2011.12.28.
+#define MAX_ANTENNA_DETECTION_CNT 10
+
+//
+// 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};
+
+//
+// check Sta pointer valid or not
+//
+#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+#define IS_STA_VALID(pSta) (pSta && pSta->expire_to)
+#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
+#define IS_STA_VALID(pSta) (pSta && pSta->bUsed)
+#else
+#define IS_STA_VALID(pSta) (pSta)
+#endif
+// 20100514 Joseph: Add definition for antenna switching test after link.
+// This indicates two different the steps.
+// In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
+// In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
+// with original RSSI to determine if it is necessary to switch antenna.
+#define SWAW_STEP_PEAK 0
+#define SWAW_STEP_DETERMINE 1
+
+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);
+
+
+#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
+ );
+
+#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_AP|ODM_ADSL))
+//============================================================
+// function prototype
+//============================================================
+//#define DM_ChangeDynamicInitGainThresh ODM_ChangeDynamicInitGainThresh
+//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
+ );
+
+BOOLEAN
+ODM_CheckPowerStatus(
+ IN PADAPTER Adapter
+ );
+
+
+#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
+ );
+
+
+#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);
+
+u4Byte
+GetPSDData(
+ PDM_ODM_T pDM_Odm,
+ unsigned int point,
+ u1Byte initial_gain_psd);
+
+#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
+
+
+#if (BEAMFORMING_SUPPORT == 1)
+BEAMFORMING_CAP
+Beamforming_GetEntryBeamCapByMacId(
+ IN PMGNT_INFO pMgntInfo,
+ IN u1Byte MacId
+ );
+#endif
+
+VOID
+odm_TXPowerTrackingInit(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+
+VOID ODM_DMInit( IN PDM_ODM_T pDM_Odm);
+
+VOID
+ODM_DMWatchdog(
+ IN PDM_ODM_T pDM_Odm // For common use in the future
+ );
+
+VOID
+ODM_CmnInfoInit(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_CMNINFO_E CmnInfo,
+ IN u4Byte Value
+ );
+
+VOID
+ODM_CmnInfoHook(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_CMNINFO_E CmnInfo,
+ IN PVOID pValue
+ );
+
+VOID
+ODM_CmnInfoPtrArrayHook(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_CMNINFO_E CmnInfo,
+ IN u2Byte Index,
+ IN PVOID pValue
+ );
+
+VOID
+ODM_CmnInfoUpdate(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte CmnInfo,
+ IN u8Byte Value
+ );
+
+VOID
+ODM_InitAllTimers(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+VOID
+ODM_CancelAllTimers(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+VOID
+ODM_ReleaseAllTimers(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+VOID
+ODM_ResetIQKResult(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+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--
+
+//3 Path Diversity
+//===========================================================
+
+#define TP_MODE 0
+#define RSSI_MODE 1
+#define TRAFFIC_LOW 0
+#define TRAFFIC_HIGH 1
+
+//#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 );
+
+u8Byte
+PlatformDivision64(
+ IN u8Byte x,
+ IN u8Byte y
+);
+
+
+// 20100514 Joseph: Add definition for antenna switching test after link.
+// This indicates two different the steps.
+// In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
+// In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
+// with original RSSI to determine if it is necessary to switch antenna.
+#define SWAW_STEP_PEAK 0
+#define SWAW_STEP_DETERMINE 1
+
+//====================================================
+//3 PathDiV End
+//====================================================
+
+#define PathDivCheckBeforeLink8192C ODM_PathDiversityBeforeLink92C
+BOOLEAN
+ODM_PathDiversityBeforeLink92C(
+ //IN PADAPTER Adapter
+ IN PDM_ODM_T pDM_Odm
+ );
+
+#define DM_ChangeDynamicInitGainThresh ODM_ChangeDynamicInitGainThresh
+//void ODM_ChangeDynamicInitGainThresh(IN PADAPTER pAdapter,
+// IN INT32 DM_Type,
+// 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,
+ DIG_STA_CONNECT = 1,
+ DIG_STA_BEFORE_CONNECT = 2,
+ DIG_MultiSTA_DISCONNECT = 3,
+ DIG_MultiSTA_CONNECT = 4,
+ DIG_CONNECT_MAX
+}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.
+//
+#define HAL_ADAPTER_STS_CHK(pDM_Odm)\
+ if (pDM_Odm->Adapter == NULL)\
+ {\
+ return;\
+ }\
+
+
+//
+// For new definition in MP temporarily fro power tracking,
+//
+#define odm_TXPowerTrackingDirectCall(_Adapter) \
+ IS_HARDWARE_TYPE_8192D(_Adapter) ? odm_TXPowerTrackingCallback_ThermalMeter_92D(_Adapter) : \
+ IS_HARDWARE_TYPE_8192C(_Adapter) ? odm_TXPowerTrackingCallback_ThermalMeter_92C(_Adapter) : \
+ 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))
+
+VOID
+ODM_SingleDualAntennaDefaultSetting(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+BOOLEAN
+ODM_SingleDualAntennaDetection(
+ IN PDM_ODM_T pDM_Odm,
+ 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(
+ IN PDM_ODM_T pDM_Odm,
+ IN BOOLEAN bNoisyStateFromC2H
+);
+
+u4Byte
+Set_RA_DM_Ratrbitmap_by_Noisy(
+ IN PDM_ODM_T pDM_Odm,
+ IN WIRELESS_MODE WirelessMode,
+ IN u4Byte ratr_bitmap,
+ IN u1Byte rssi_level
+);
+
+VOID
+ODM_UpdateInitRate(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte Rate
+ );
+
+VOID
+ODM_DynamicARFBSelect(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte rate,
+ IN BOOLEAN Collision_State
+ );
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+void odm_dtc(PDM_ODM_T pDM_Odm);
+#endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_CE) */
+
+typedef enum _PHYDM_STRUCTURE_TYPE{
+ PHYDM_FALSEALMCNT,
+ PHYDM_CFOTRACK,
+ PHYDM_ADAPTIVITY,
+ PHYDM_ROMINFO,
+
+}PHYDM_STRUCTURE_TYPE;
+
+PVOID
+PhyDM_Get_Structure(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte Structure_Type
+);
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_AntDiv.c b/rtl8xxx_EU/hal/OUTSRC/odm_AntDiv.c
index 4b361e2..38b224b 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_AntDiv.c
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_AntDiv.c
@@ -1,2269 +1,2269 @@
-/******************************************************************************
- *
- * 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 "odm_precomp.h"
-
-#if (defined(CONFIG_HW_ANTENNA_DIVERSITY))
-VOID
-odm_AntDiv_on_off( IN PDM_ODM_T pDM_Odm ,IN u1Byte swch)
-{
- if(pDM_Odm->AntDivType==S0S1_SW_ANTDIV || pDM_Odm->AntDivType==CGCS_RX_SW_ANTDIV)
- return;
-
- 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_SetBBReg(pDM_Odm, 0xc50 , BIT7, swch); //OFDM AntDiv function block enable
- 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"));
- 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
- }
- 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
- }
- }
-}
-
-VOID
-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(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(Ant == MAIN_ANT)
- {
- DefaultAnt = ANT1_2G;
- OptionalAnt = ANT2_2G;
- }
- else
- {
- DefaultAnt = ANT2_2G;
- OptionalAnt = ANT1_2G;
- }
-
- if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
- {
- if(pDM_Odm->SupportICType==ODM_RTL8192E)
- {
- ODM_SetBBReg(pDM_Odm, 0xB38 , BIT5|BIT4|BIT3, DefaultAnt); //Default RX
- ODM_SetBBReg(pDM_Odm, 0xB38 , BIT8|BIT7|BIT6, OptionalAnt);//Optional RX
- }
- 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
- }
- 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
- }
- ODM_SetMACReg(pDM_Odm, 0x6D8 , BIT10|BIT9|BIT8, DefaultAnt); //PathA Resp Tx
- }
- else// pDM_FatTable->RxIdleAnt == Ant
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Stay in Ori-Ant ] RxIdleAnt =%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"));
- pDM_FatTable->RxIdleAnt = Ant;
- }
-}
-
-
-VOID
-odm_UpdateTxAnt(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant, IN u4Byte MacId)
-{
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
- u1Byte TxAnt;
-
- if(Ant == MAIN_ANT)
- TxAnt = ANT1_2G;
- else
- TxAnt = ANT2_2G;
-
- pDM_FatTable->antsel_a[MacId] = TxAnt&BIT0;
- pDM_FatTable->antsel_b[MacId] = (TxAnt&BIT1)>>1;
- pDM_FatTable->antsel_c[MacId] = (TxAnt&BIT2)>>2;
- #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (pDM_Odm->antdiv_rssi)
- {
- //panic_printk("[Tx from TxInfo]: MacID:(( %d )), TxAnt = (( %s ))\n",MacId,(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT");
- //panic_printk("antsel_tr_mux=(( 3'b%d%d%d ))\n", pDM_FatTable->antsel_c[MacId] , pDM_FatTable->antsel_b[MacId] , pDM_FatTable->antsel_a[MacId] );
- }
- #endif
- //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Tx from TxInfo]: MacID:(( %d )), TxAnt = (( %s ))\n",
- // MacId,(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"));
- //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=(( 3'b%d%d%d ))\n",
- //pDM_FatTable->antsel_c[MacId] , pDM_FatTable->antsel_b[MacId] , pDM_FatTable->antsel_a[MacId] ));
-
-}
-
-
-
-#if (RTL8188E_SUPPORT == 1)
-
-
-VOID
-odm_RX_HWAntDiv_Init_88E(
- IN PDM_ODM_T pDM_Odm
-)
-{
- u4Byte value32;
-
- pDM_Odm->AntType = ODM_AUTO_ANT;
-
- #if (MP_DRIVER == 1)
- 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"));
-
- //MAC Setting
- value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord);
- ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output
- //Pin Settings
- ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW
- ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW
- ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 1); //Regb2c[22]=1'b0 //disable CS/CG switch
- ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only
- //OFDM Settings
- ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0);
- //CCK Settings
- 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
-
-}
-
-VOID
-odm_TRX_HWAntDiv_Init_88E(
- IN PDM_ODM_T pDM_Odm
-)
-{
- u4Byte value32;
-
- #if (MP_DRIVER == 1)
- 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"));
-
- //MAC Setting
- value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord);
- ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output
- //Pin Settings
- ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW
- ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW
- ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 0); //Regb2c[22]=1'b0 //disable CS/CG switch
- ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only
- //OFDM Settings
- ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0);
- //CCK Settings
- 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
-
- //antenna mapping table
- if(!pDM_Odm->bIsMPChip) //testchip
- {
- ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT10|BIT9|BIT8, 1); //Reg858[10:8]=3'b001
- 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
-}
-
-VOID
-odm_Smart_HWAntDiv_Init_88E(
- IN PDM_ODM_T pDM_Odm
-)
-{
- u4Byte value32, i;
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
- u4Byte AntCombination = 2;
-
- 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)
- 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++)
- {
- pDM_FatTable->Bssid[i] = 0;
- pDM_FatTable->antSumRSSI[i] = 0;
- pDM_FatTable->antRSSIcnt[i] = 0;
- pDM_FatTable->antAveRSSI[i] = 0;
- }
- pDM_FatTable->TrainIdx = 0;
- pDM_FatTable->FAT_State = FAT_NORMAL_STATE;
-
- //MAC Setting
- value32 = ODM_GetMACReg(pDM_Odm, 0x4c, bMaskDWord);
- ODM_SetMACReg(pDM_Odm, 0x4c, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output
- value32 = ODM_GetMACReg(pDM_Odm, 0x7B4, bMaskDWord);
- ODM_SetMACReg(pDM_Odm, 0x7b4, bMaskDWord, value32|(BIT16|BIT17)); //Reg7B4[16]=1 enable antenna training, Reg7B4[17]=1 enable A2 match
- //value32 = PlatformEFIORead4Byte(Adapter, 0x7B4);
- //PlatformEFIOWrite4Byte(Adapter, 0x7b4, value32|BIT18); //append MACID in reponse packet
-
- //Match MAC ADDR
- ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, 0);
- ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, 0);
-
- ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW
- ODM_SetBBReg(pDM_Odm, 0x864 , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW
- ODM_SetBBReg(pDM_Odm, 0xb2c , BIT22, 0); //Regb2c[22]=1'b0 //disable CS/CG switch
- ODM_SetBBReg(pDM_Odm, 0xb2c , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only
- ODM_SetBBReg(pDM_Odm, 0xca4 , bMaskDWord, 0x000000a0);
-
- //antenna mapping table
- if(AntCombination == 2)
- {
- if(!pDM_Odm->bIsMPChip) //testchip
- {
- ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 1); //Reg858[10:8]=3'b001
- ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 2); //Reg858[13:11]=3'b010
- }
- else //MPchip
- {
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 1);
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 2);
- }
- }
- else if(AntCombination == 7)
- {
- if(!pDM_Odm->bIsMPChip) //testchip
- {
- ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 0); //Reg858[10:8]=3'b000
- ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 1); //Reg858[13:11]=3'b001
- ODM_SetBBReg(pDM_Odm, 0x878 , BIT16, 0);
- ODM_SetBBReg(pDM_Odm, 0x858 , BIT15|BIT14, 2); //(Reg878[0],Reg858[14:15])=3'b010
- ODM_SetBBReg(pDM_Odm, 0x878 , BIT19|BIT18|BIT17, 3);//Reg878[3:1]=3b'011
- ODM_SetBBReg(pDM_Odm, 0x878 , BIT22|BIT21|BIT20, 4);//Reg878[6:4]=3b'100
- ODM_SetBBReg(pDM_Odm, 0x878 , BIT25|BIT24|BIT23, 5);//Reg878[9:7]=3b'101
- ODM_SetBBReg(pDM_Odm, 0x878 , BIT28|BIT27|BIT26, 6);//Reg878[12:10]=3b'110
- ODM_SetBBReg(pDM_Odm, 0x878 , BIT31|BIT30|BIT29, 7);//Reg878[15:13]=3b'111
- }
- else //MPchip
- {
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0);
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1);
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte2, 2);
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte3, 3);
- ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte0, 4);
- ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte1, 5);
- ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte2, 6);
- ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte3, 7);
- }
- }
-
- //Default Ant Setting when no fast training
- ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info
- ODM_SetBBReg(pDM_Odm, 0x864 , BIT5|BIT4|BIT3, 0); //Default RX
- ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, 1); //Optional RX
- //ODM_SetBBReg(pDM_Odm, 0x860 , BIT14|BIT13|BIT12, 1); //Default TX
-
- //Enter Traing state
- ODM_SetBBReg(pDM_Odm, 0x864 , BIT2|BIT1|BIT0, (AntCombination-1)); //Reg864[2:0]=3'd6 //ant combination=reg864[2:0]+1
- //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv
- //ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training
- //ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 1); //RegE08[16]=1'b1 //enable fast training
- ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv
-
- //SW Control
- //PHY_SetBBReg(Adapter, 0x864 , BIT10, 1);
- //PHY_SetBBReg(Adapter, 0x870 , BIT9, 1);
- //PHY_SetBBReg(Adapter, 0x870 , BIT8, 1);
- //PHY_SetBBReg(Adapter, 0x864 , BIT11, 1);
- //PHY_SetBBReg(Adapter, 0x860 , BIT9, 0);
- //PHY_SetBBReg(Adapter, 0x860 , BIT8, 0);
-}
-#endif //#if (RTL8188E_SUPPORT == 1)
-
-
-#if (RTL8192E_SUPPORT == 1)
-VOID
-odm_RX_HWAntDiv_Init_92E(
- IN PDM_ODM_T pDM_Odm
-)
-{
-
-#if (MP_DRIVER == 1)
- //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
- ODM_SetBBReg(pDM_Odm, 0x870 , BIT8, 0);//Reg870[8]=1'b0, // "antsel" is controled by HWs
- ODM_SetBBReg(pDM_Odm, 0xc50 , BIT8, 1); //Regc50[8]=1'b1 //" CS/CG switching" is controled by HWs
-
- //Mapping table
- ODM_SetBBReg(pDM_Odm, 0x914 , 0xFFFF, 0x0100); //antenna mapping table
-
- //OFDM Settings
- ODM_SetBBReg(pDM_Odm, 0xca4 , 0x7FF, 0xA0); //thershold
- ODM_SetBBReg(pDM_Odm, 0xca4 , 0x7FF000, 0x0); //bias
-
- //CCK Settings
- ODM_SetBBReg(pDM_Odm, 0xa04 , 0xF000000, 0); //Select which path to receive for CCK_1 & CCK_2
- ODM_SetBBReg(pDM_Odm, 0xb34 , BIT30, 1); //(92E) ANTSEL_CCK_opt = r_en_antsel_cck? ANTSEL_CCK: 1'b0
- ODM_SetBBReg(pDM_Odm, 0xa74 , BIT7, 1); //Fix CCK PHY status report issue
- ODM_SetBBReg(pDM_Odm, 0xa0c , BIT4, 1); //CCK complete HW AntDiv within 64 samples
-}
-
-VOID
-odm_TRX_HWAntDiv_Init_92E(
- IN PDM_ODM_T pDM_Odm
-)
-{
-
-#if (MP_DRIVER == 1)
- //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;
-#endif
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8192E AntDiv_Init => AntDivType=[CG_TRX_HW_ANTDIV]\n"));
-
- //3 --RFE pin setting---------
- //[MAC]
- ODM_SetMACReg(pDM_Odm, 0x38, BIT11, 1); //DBG PAD Driving control (GPIO 8)
- ODM_SetMACReg(pDM_Odm, 0x4c, BIT23, 0); //path-A , RFE_CTRL_3 & RFE_CTRL_4
- //[BB]
- ODM_SetBBReg(pDM_Odm, 0x944 , BIT4|BIT3, 0x3); //RFE_buffer
- ODM_SetBBReg(pDM_Odm, 0x940 , BIT7|BIT6, 0x0); // r_rfe_path_sel_ (RFE_CTRL_3)
- ODM_SetBBReg(pDM_Odm, 0x940 , BIT9|BIT8, 0x0); // r_rfe_path_sel_ (RFE_CTRL_4)
- ODM_SetBBReg(pDM_Odm, 0x944 , BIT31, 0); //RFE_buffer
- ODM_SetBBReg(pDM_Odm, 0x92C , BIT3, 0); //rfe_inv (RFE_CTRL_3)
- ODM_SetBBReg(pDM_Odm, 0x92C , BIT4, 1); //rfe_inv (RFE_CTRL_4)
- ODM_SetBBReg(pDM_Odm, 0x930 , 0xFF000, 0x88); //path-A , RFE_CTRL_3 & 4=> ANTSEL[0]
- //3 -------------------------
-
- //Pin Settings
- ODM_SetBBReg(pDM_Odm, 0xC50 , BIT8, 0); //path-A //disable CS/CG switch
- ODM_SetBBReg(pDM_Odm, 0xC50 , BIT9, 1); //path-A //output at CG only
- ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0); //path-A //antsel antselb by HW
- ODM_SetBBReg(pDM_Odm, 0xB38 , BIT10, 0); //path-A //antsel2 by HW
-
- //Mapping table
- ODM_SetBBReg(pDM_Odm, 0x914 , 0xFFFF, 0x0100); //antenna mapping table
-
- //OFDM Settings
- ODM_SetBBReg(pDM_Odm, 0xca4 , 0x7FF, 0xA0); //thershold
- ODM_SetBBReg(pDM_Odm, 0xca4 , 0x7FF000, 0x0); //bias
-
- //CCK Settings
- ODM_SetBBReg(pDM_Odm, 0xa04 , 0xF000000, 0); //Select which path to receive for CCK_1 & CCK_2
- ODM_SetBBReg(pDM_Odm, 0xb34 , BIT30, 1); //(92E) ANTSEL_CCK_opt = r_en_antsel_cck? ANTSEL_CCK: 1'b0
- ODM_SetBBReg(pDM_Odm, 0xa74 , BIT7, 1); //Fix CCK PHY status report issue
- ODM_SetBBReg(pDM_Odm, 0xa0c , BIT4, 1); //CCK complete HW AntDiv within 64 samples
-
- //Timming issue
- ODM_SetBBReg(pDM_Odm, 0xE20 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
-}
-
-VOID
-odm_Smart_HWAntDiv_Init_92E(
- IN PDM_ODM_T pDM_Odm
-)
-{
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8188E AntDiv_Init => AntDivType=[CG_TRX_SMART_ANTDIV]\n"));
-}
-#endif //#if (RTL8192E_SUPPORT == 1)
-
-
-#if (RTL8723B_SUPPORT == 1)
-VOID
-odm_TRX_HWAntDiv_Init_8723B(
- IN PDM_ODM_T pDM_Odm
-)
-{
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8723B AntDiv_Init => AntDivType=[CG_TRX_HW_ANTDIV(DPDT)]\n"));
-
- //Mapping Table
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0);
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1);
-
- //OFDM HW AntDiv Parameters
- ODM_SetBBReg(pDM_Odm, 0xCA4 , 0x7FF, 0xa0); //thershold
- ODM_SetBBReg(pDM_Odm, 0xCA4 , 0x7FF000, 0x00); //bias
-
- //CCK HW AntDiv Parameters
- ODM_SetBBReg(pDM_Odm, 0xA74 , BIT7, 1); //patch for clk from 88M to 80M
- ODM_SetBBReg(pDM_Odm, 0xA0C , BIT4, 1); //do 64 samples
-
- //BT Coexistence
- ODM_SetBBReg(pDM_Odm, 0x864, BIT12, 0); //keep antsel_map when GNT_BT = 1
- ODM_SetBBReg(pDM_Odm, 0x874 , BIT23, 0); //Disable hw antsw & fast_train.antsw when GNT_BT=1
-
- //Output Pin Settings
- ODM_SetBBReg(pDM_Odm, 0x870 , BIT8, 0); //
-
- ODM_SetBBReg(pDM_Odm, 0x948 , BIT6, 0); //WL_BB_SEL_BTG_TRXG_anta, (1: HW CTRL 0: SW CTRL)
- ODM_SetBBReg(pDM_Odm, 0x948 , BIT7, 0);
-
- ODM_SetMACReg(pDM_Odm, 0x40 , BIT3, 1);
- ODM_SetMACReg(pDM_Odm, 0x38 , BIT11, 1);
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT24|BIT23, 2); //select DPDT_P and DPDT_N as output pin
-
- ODM_SetBBReg(pDM_Odm, 0x944 , BIT0|BIT1, 3); //in/out
- ODM_SetBBReg(pDM_Odm, 0x944 , BIT31, 0); //
-
- ODM_SetBBReg(pDM_Odm, 0x92C , BIT1, 0); //DPDT_P non-inverse
- ODM_SetBBReg(pDM_Odm, 0x92C , BIT0, 1); //DPDT_N inverse
-
- ODM_SetBBReg(pDM_Odm, 0x930 , 0xF0, 8); // DPDT_P = ANTSEL[0]
- ODM_SetBBReg(pDM_Odm, 0x930 , 0xF, 8); // DPDT_N = ANTSEL[0]
-
- //Timming issue
- ODM_SetBBReg(pDM_Odm, 0xE20 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
-
- //2 [--For HW Bug Setting]
- if(pDM_Odm->AntType == ODM_AUTO_ANT)
- ODM_SetBBReg(pDM_Odm, 0xA00 , BIT15, 0); //CCK AntDiv function block enable
-
- //ODM_SetBBReg(pDM_Odm, 0x80C , BIT21, 0); //TX Ant by Reg
-
-
-}
-
-
-
-VOID
-odm_S0S1_SWAntDiv_Init_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;
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8723B AntDiv_Init => AntDivType=[ S0S1_SW_AntDiv] \n"));
-
- //Mapping Table
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0);
- ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1);
-
- //Output Pin Settings
- //ODM_SetBBReg(pDM_Odm, 0x948 , BIT6, 0x1);
- ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0);
-
- pDM_FatTable->bBecomeLinked =FALSE;
- pDM_SWAT_Table->try_flag = 0xff;
- pDM_SWAT_Table->Double_chk_flag = 0;
- pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW;
-
- //Timming issue
- ODM_SetBBReg(pDM_Odm, 0xE20 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
-
- //2 [--For HW Bug Setting]
- ODM_SetBBReg(pDM_Odm, 0x80C , BIT21, 0); //TX Ant by Reg
-
-}
-#endif //#if (RTL8723B_SUPPORT == 1)
-
-
-#if (RTL8821A_SUPPORT == 1)
-VOID
-odm_TRX_HWAntDiv_Init_8821A(
- IN PDM_ODM_T pDM_Odm
-)
-{
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
- PADAPTER pAdapter = pDM_Odm->Adapter;
- pAdapter->HalFunc.GetHalDefVarHandler(pAdapter, HAL_DEF_5G_ANT_SELECT, (pu1Byte)(&pDM_Odm->AntType));
-#else
- pDM_Odm->AntType = ODM_AUTO_ANT;
-#endif
- pAdapter->HalFunc.GetHalDefVarHandler(pAdapter, HAL_DEF_5G_ANT_SELECT, (pu1Byte)(&pDM_Odm->AntType));
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821A AntDiv_Init => AntDivType=[ CG_TRX_HW_ANTDIV (DPDT)] \n"));
-
- //Output Pin Settings
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT25, 0);
-
- ODM_SetMACReg(pDM_Odm, 0x64 , BIT29, 1); //PAPE by WLAN control
- ODM_SetMACReg(pDM_Odm, 0x64 , BIT28, 1); //LNAON by WLAN control
-
- ODM_SetBBReg(pDM_Odm, 0xCB0 , bMaskDWord, 0x77775745);
- ODM_SetBBReg(pDM_Odm, 0xCB8 , BIT16, 0);
-
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT23, 0); //select DPDT_P and DPDT_N as output pin
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT24, 1); //by WLAN control
- ODM_SetBBReg(pDM_Odm, 0xCB4 , 0xF, 8); // DPDT_P = ANTSEL[0]
- ODM_SetBBReg(pDM_Odm, 0xCB4 , 0xF0, 8); // DPDT_N = ANTSEL[0]
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT29, 0); //DPDT_P non-inverse
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT28, 1); //DPDT_N inverse
-
- //Mapping Table
- ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte0, 0);
- ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte1, 1);
-
- //Set ANT1_8821A as MAIN_ANT
- if((pDM_Odm->AntType == ODM_FIX_MAIN_ANT) || (pDM_Odm->AntType == ODM_AUTO_ANT))
- ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
- else
- ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
-
- //OFDM HW AntDiv Parameters
- ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF, 0xA0); //thershold
- ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF000, 0x10); //bias
-
- //CCK HW AntDiv Parameters
- 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
-
- //BT Coexistence
- ODM_SetBBReg(pDM_Odm, 0xCAC , BIT9, 1); //keep antsel_map when GNT_BT = 1
- ODM_SetBBReg(pDM_Odm, 0x804 , BIT4, 1); //Disable hw antsw & fast_train.antsw when GNT_BT=1
-
- //Timming issue
- ODM_SetBBReg(pDM_Odm, 0x818 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
- ODM_SetBBReg(pDM_Odm, 0x8CC , BIT20|BIT19|BIT18, 3); //settling time of antdiv by RF LNA = 100ns
-
- //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
-
-}
-
-VOID
-odm_S0S1_SWAntDiv_Init_8821A(
- IN PDM_ODM_T pDM_Odm
-)
-{
- pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
-
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
- PADAPTER pAdapter = pDM_Odm->Adapter;
- pAdapter->HalFunc.GetHalDefVarHandler(pAdapter, HAL_DEF_5G_ANT_SELECT, (pu1Byte)(&pDM_Odm->AntType));
-#else
- pDM_Odm->AntType = ODM_AUTO_ANT;
-#endif
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821A AntDiv_Init => AntDivType=[ S0S1_SW_AntDiv] \n"));
-
- //Output Pin Settings
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT25, 0);
-
- ODM_SetMACReg(pDM_Odm, 0x64 , BIT29, 1); //PAPE by WLAN control
- ODM_SetMACReg(pDM_Odm, 0x64 , BIT28, 1); //LNAON by WLAN control
-
- ODM_SetBBReg(pDM_Odm, 0xCB0 , bMaskDWord, 0x77775745);
- ODM_SetBBReg(pDM_Odm, 0xCB8 , BIT16, 0);
-
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT23, 0); //select DPDT_P and DPDT_N as output pin
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT24, 1); //by WLAN control
- ODM_SetBBReg(pDM_Odm, 0xCB4 , 0xF, 8); // DPDT_P = ANTSEL[0]
- ODM_SetBBReg(pDM_Odm, 0xCB4 , 0xF0, 8); // DPDT_N = ANTSEL[0]
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT29, 0); //DPDT_P non-inverse
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT28, 1); //DPDT_N inverse
-
- //Mapping Table
- ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte0, 0);
- ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte1, 1);
-
- //Set ANT1_8821A as MAIN_ANT
- if((pDM_Odm->AntType == ODM_FIX_MAIN_ANT) || (pDM_Odm->AntType == ODM_AUTO_ANT))
- ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
- else
- ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
-
- //OFDM HW AntDiv Parameters
- ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF, 0xA0); //thershold
- ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF000, 0x10); //bias
-
- //CCK HW AntDiv Parameters
- 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
-
- //BT Coexistence
- ODM_SetBBReg(pDM_Odm, 0xCAC , BIT9, 1); //keep antsel_map when GNT_BT = 1
- ODM_SetBBReg(pDM_Odm, 0x804 , BIT4, 1); //Disable hw antsw & fast_train.antsw when GNT_BT=1
-
- //Timming issue
- ODM_SetBBReg(pDM_Odm, 0x818 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
- ODM_SetBBReg(pDM_Odm, 0x8CC , BIT20|BIT19|BIT18, 3); //settling time of antdiv by RF LNA = 100ns
-
- //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);
-
- pDM_SWAT_Table->try_flag = 0xff;
- pDM_SWAT_Table->Double_chk_flag = 0;
- pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW;
- pDM_SWAT_Table->CurAntenna = MAIN_ANT;
- pDM_SWAT_Table->PreAntenna = MAIN_ANT;
- pDM_SWAT_Table->SWAS_NoLink_State = 0;
-
-}
-#endif //#if (RTL8821A_SUPPORT == 1)
-
-#if (RTL8881A_SUPPORT == 1)
-VOID
-odm_RX_HWAntDiv_Init_8881A(
- IN PDM_ODM_T pDM_Odm
-)
-{
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8881A AntDiv_Init => AntDivType=[ CGCS_RX_HW_ANTDIV] \n"));
-
-}
-
-VOID
-odm_TRX_HWAntDiv_Init_8881A(
- IN PDM_ODM_T pDM_Odm
-)
-{
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8881A AntDiv_Init => AntDivType=[ CG_TRX_HW_ANTDIV (SPDT)] \n"));
-
- //Output Pin Settings
- // [SPDT related]
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT25, 0);
- ODM_SetMACReg(pDM_Odm, 0x4C , BIT26, 0);
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT31, 0); //delay buffer
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT22, 0);
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT24, 1);
- ODM_SetBBReg(pDM_Odm, 0xCB0 , 0xF00, 8); // DPDT_P = ANTSEL[0]
- ODM_SetBBReg(pDM_Odm, 0xCB0 , 0xF0000, 8); // DPDT_N = ANTSEL[0]
-
- //Mapping Table
- ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte0, 0);
- ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte1, 1);
-
- //OFDM HW AntDiv Parameters
- ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF, 0xA0); //thershold
- ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF000, 0x0); //bias
- ODM_SetBBReg(pDM_Odm, 0x8CC , BIT20|BIT19|BIT18, 3); //settling time of antdiv by RF LNA = 100ns
-
- //CCK HW AntDiv Parameters
- ODM_SetBBReg(pDM_Odm, 0xA74 , BIT7, 1); //patch for clk from 88M to 80M
- ODM_SetBBReg(pDM_Odm, 0xA0C , BIT4, 1); //do 64 samples
-
- //Timming issue
- ODM_SetBBReg(pDM_Odm, 0x818 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
-
- //2 [--For HW Bug Setting]
-
- ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0); //TX Ant by Reg // A-cut bug
-}
-
-#endif //#if (RTL8881A_SUPPORT == 1)
-
-
-#if (RTL8812A_SUPPORT == 1)
-VOID
-odm_TRX_HWAntDiv_Init_8812A(
- IN PDM_ODM_T pDM_Odm
-)
-{
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8812A AntDiv_Init => AntDivType=[ CG_TRX_HW_ANTDIV (SPDT)] \n"));
-
- //3 //3 --RFE pin setting---------
- //[BB]
- ODM_SetBBReg(pDM_Odm, 0x900 , BIT10|BIT9|BIT8, 0x0); //disable SW switch
- ODM_SetBBReg(pDM_Odm, 0x900 , BIT17|BIT16, 0x0);
- ODM_SetBBReg(pDM_Odm, 0x974 , BIT7|BIT6, 0x3); // in/out
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT31, 0); //delay buffer
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT26, 0);
- ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT27, 1);
- ODM_SetBBReg(pDM_Odm, 0xCB0 , 0xF000000, 8); // DPDT_P = ANTSEL[0]
- ODM_SetBBReg(pDM_Odm, 0xCB0 , 0xF0000000, 8); // DPDT_N = ANTSEL[0]
- //3 -------------------------
-
- //Mapping Table
- ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte0, 0);
- ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte1, 1);
-
- //OFDM HW AntDiv Parameters
- ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF, 0xA0); //thershold
- ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF000, 0x0); //bias
- ODM_SetBBReg(pDM_Odm, 0x8CC , BIT20|BIT19|BIT18, 3); //settling time of antdiv by RF LNA = 100ns
-
- //CCK HW AntDiv Parameters
- ODM_SetBBReg(pDM_Odm, 0xA74 , BIT7, 1); //patch for clk from 88M to 80M
- ODM_SetBBReg(pDM_Odm, 0xA0C , BIT4, 1); //do 64 samples
-
- //Timming issue
- ODM_SetBBReg(pDM_Odm, 0x818 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
-
- //2 [--For HW Bug Setting]
-
- ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0); //TX Ant by Reg // A-cut bug
-
-}
-
-#endif //#if (RTL8812A_SUPPORT == 1)
-
-VOID
-odm_HW_AntDiv(
- IN PDM_ODM_T pDM_Odm
-)
-{
- u4Byte i,MinMaxRSSI=0xFF, AntDivMaxRSSI=0, MaxRSSI=0, LocalMaxRSSI;
- u4Byte Main_RSSI, Aux_RSSI, pkt_ratio_m=0, pkt_ratio_a=0,pkt_threshold=10;
- u1Byte RxIdleAnt=0, TargetAnt=7;
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
- pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable;
- PSTA_INFO_T pEntry;
-
- if(!pDM_Odm->bLinked) //bLinked==False
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[No Link!!!]\n"));
-
- #if(DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (pDM_Odm->antdiv_rssi)
- panic_printk("[No Link!!!]\n");
- #endif
-
- if(pDM_FatTable->bBecomeLinked == TRUE)
- {
- odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
- ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
-
- pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
- }
- return;
- }
- else
- {
- if(pDM_FatTable->bBecomeLinked ==FALSE)
- {
- 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(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
-
- pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
-
- if(pDM_Odm->SupportICType==ODM_RTL8723B && pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
- {
- ODM_SetBBReg(pDM_Odm, 0x930 , 0xF0, 8); // DPDT_P = ANTSEL[0] // for 8723B AntDiv function patch. BB Dino 130412
- ODM_SetBBReg(pDM_Odm, 0x930 , 0xF, 8); // DPDT_N = ANTSEL[0]
- }
- }
- }
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("\n[HW AntDiv] Start =>\n"));
-
- for (i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
- {
- pEntry = pDM_Odm->pODM_StaInfo[i];
- if(IS_STA_VALID(pEntry))
- {
- //2 Caculate RSSI per Antenna
- Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0;
- Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0;
- TargetAnt = (Main_RSSI==Aux_RSSI)?pDM_FatTable->RxIdleAnt:((Main_RSSI>=Aux_RSSI)?MAIN_ANT:AUX_ANT);
- /*
- if( pDM_FatTable->MainAnt_Cnt[i]!=0 && pDM_FatTable->AuxAnt_Cnt[i]!=0 )
- {
- pkt_ratio_m=( pDM_FatTable->MainAnt_Cnt[i] / pDM_FatTable->AuxAnt_Cnt[i] );
- pkt_ratio_a=( pDM_FatTable->AuxAnt_Cnt[i] / pDM_FatTable->MainAnt_Cnt[i] );
-
- if (pkt_ratio_m >= pkt_threshold)
- TargetAnt=MAIN_ANT;
-
- else if(pkt_ratio_a >= pkt_threshold)
- 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,("*** 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)));
- #if(DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (pDM_Odm->antdiv_rssi)
- {
- panic_printk("*** SupportICType=[%lu] \n",pDM_Odm->SupportICType);
- //panic_printk("*** 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));
- //panic_printk("*** Phy_AntSel_B=[ %d, %d, %d] \n",((pDM_Odm->DM_FatTable.antsel_rx_keep_1)&BIT2)>>2,
- // ((pDM_Odm->DM_FatTable.antsel_rx_keep_1)&BIT1) >>1, ((pDM_Odm->DM_FatTable.antsel_rx_keep_1)&BIT0))
- panic_printk("*** Client[ %lu ] , Main_Cnt = (( %lu )) , Main_RSSI= (( %lu )) \n",i, pDM_FatTable->MainAnt_Cnt[i], Main_RSSI);
- panic_printk("*** Client[ %lu ] , Aux_Cnt = (( %lu )) , Aux_RSSI = (( %lu )) \n" ,i, pDM_FatTable->AuxAnt_Cnt[i] , Aux_RSSI);
- }
- #endif
-
-
- LocalMaxRSSI = (Main_RSSI>Aux_RSSI)?Main_RSSI:Aux_RSSI;
- //2 Select MaxRSSI for DIG
- if((LocalMaxRSSI > AntDivMaxRSSI) && (LocalMaxRSSI < 40))
- AntDivMaxRSSI = LocalMaxRSSI;
- if(LocalMaxRSSI > MaxRSSI)
- MaxRSSI = LocalMaxRSSI;
-
- //2 Select RX Idle Antenna
- if ( (LocalMaxRSSI != 0) && (LocalMaxRSSI < MinMaxRSSI) )
- {
- RxIdleAnt = TargetAnt;
- MinMaxRSSI = LocalMaxRSSI;
- }
- /*
- if((pDM_FatTable->RxIdleAnt == MAIN_ANT) && (Main_RSSI == 0))
- Main_RSSI = Aux_RSSI;
- else if((pDM_FatTable->RxIdleAnt == AUX_ANT) && (Aux_RSSI == 0))
- Aux_RSSI = Main_RSSI;
-
- LocalMinRSSI = (Main_RSSI>Aux_RSSI)?Aux_RSSI:Main_RSSI;
- if(LocalMinRSSI < MinRSSI)
- {
- MinRSSI = LocalMinRSSI;
- RxIdleAnt = TargetAnt;
- }
- */
- //2 Select TX Antenna
-
- #if TX_BY_REG
-
- #else
- if(pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV)
- odm_UpdateTxAnt(pDM_Odm, TargetAnt, i);
- #endif
-
- }
- pDM_FatTable->MainAnt_Sum[i] = 0;
- pDM_FatTable->AuxAnt_Sum[i] = 0;
- pDM_FatTable->MainAnt_Cnt[i] = 0;
- pDM_FatTable->AuxAnt_Cnt[i] = 0;
- }
-
- //2 Set RX Idle Antenna
- ODM_UpdateRxIdleAnt(pDM_Odm, RxIdleAnt);
-
- #if(DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (pDM_Odm->antdiv_rssi)
- panic_printk("*** RxIdleAnt = (( %s )) \n \n", ( RxIdleAnt ==MAIN_ANT)?"MAIN_ANT":"AUX_ANT");
- #endif
-
- pDM_DigTable->AntDiv_RSSI_max = AntDivMaxRSSI;
- pDM_DigTable->RSSI_max = MaxRSSI;
-}
-
-
-
-#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1)
-VOID
-odm_S0S1_SwAntDiv(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte Step
- )
-{
- 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;
- pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
- PSTA_INFO_T pEntry=NULL;
- //static u1Byte reset_idx;
- u4Byte value32;
- PADAPTER Adapter = pDM_Odm->Adapter;
- u8Byte curTxOkCnt=0, curRxOkCnt=0,TxCntOffset, RxCntOffset;
-
- if(!pDM_Odm->bLinked) //bLinked==False
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[No Link!!!]\n"));
- if(pDM_FatTable->bBecomeLinked == TRUE)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Set REG 948[9:6]=0x0 \n"));
- if(pDM_Odm->SupportICType == ODM_RTL8723B)
- ODM_SetBBReg(pDM_Odm, 0x948 , BIT9|BIT8|BIT7|BIT6, 0x0);
-
- pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
- }
- return;
- }
- else
- {
- if(pDM_FatTable->bBecomeLinked ==FALSE)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Linked !!!]\n"));
-
- if(pDM_Odm->SupportICType == ODM_RTL8723B)
- {
- value32 = ODM_GetBBReg(pDM_Odm, 0x864, BIT5|BIT4|BIT3);
-
- if (value32==0x0)
- ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
- else if (value32==0x1)
- ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
-
- 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 ));
- }
-
- pDM_SWAT_Table->lastTxOkCnt = 0;
- pDM_SWAT_Table->lastRxOkCnt =0;
- TxCntOffset = Adapter->TxStats.NumTxBytesUnicast;
- RxCntOffset = Adapter->RxStats.NumRxBytesUnicast;
-
- pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
- }
- else
- {
- TxCntOffset = 0;
- RxCntOffset = 0;
- }
- }
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[%d] { try_flag=(( %d )), Step=(( %d )), Double_chk_flag = (( %d )) }\n",
- __LINE__,pDM_SWAT_Table->try_flag,Step,pDM_SWAT_Table->Double_chk_flag));
-
- // 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_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Step != try_flag] Need to Reset After Link\n"));
- ODM_SwAntDivRestAfterLink(pDM_Odm);
- }
-
- if(pDM_SWAT_Table->try_flag == 0xff)
- {
- pDM_SWAT_Table->try_flag = 0;
- pDM_SWAT_Table->Train_time_flag=0;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("[set try_flag = 0] Prepare for peak!\n\n"));
- return;
- }
- else//if( try_flag != 0xff )
- {
- //1 Normal State (Begin Trying)
- if(pDM_SWAT_Table->try_flag == 0)
- {
-
- //---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;
-
- if (curTxOkCnt > 1875000 || curRxOkCnt > 1875000)//if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) ( 1.875M * 8bit ) / 2= 7.5M bits /sec )
- {
- pDM_SWAT_Table->TrafficLoad = TRAFFIC_HIGH;
- Train_time_temp=pDM_SWAT_Table->Train_time ;
-
- if(pDM_SWAT_Table->Train_time_flag==3)
- {
- HighTraffic_TrainTime_L=0xa;
-
- if(Train_time_temp<=16)
- Train_time_temp=HighTraffic_TrainTime_L;
- else
- Train_time_temp-=16;
-
- }
- else if(pDM_SWAT_Table->Train_time_flag==2)
- {
- Train_time_temp-=8;
- HighTraffic_TrainTime_L=0xf;
- }
- else if(pDM_SWAT_Table->Train_time_flag==1)
- {
- Train_time_temp-=4;
- HighTraffic_TrainTime_L=0x1e;
- }
- else if(pDM_SWAT_Table->Train_time_flag==0)
- {
- Train_time_temp+=8;
- HighTraffic_TrainTime_L=0x28;
- }
-
-
- //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Train_time_temp = ((%d))\n",Train_time_temp));
-
- //--
- if(Train_time_temp > HighTraffic_TrainTime_U)
- Train_time_temp=HighTraffic_TrainTime_U;
-
- else if(Train_time_temp < HighTraffic_TrainTime_L)
- Train_time_temp=HighTraffic_TrainTime_L;
-
- pDM_SWAT_Table->Train_time = Train_time_temp; //50ms~10ms
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" Train_time_flag=((%d)) , Train_time=((%d)) \n",pDM_SWAT_Table->Train_time_flag, pDM_SWAT_Table->Train_time));
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" [HIGH Traffic] \n" ));
- }
- else if (curTxOkCnt > 125000 || curRxOkCnt > 125000) // ( 0.125M * 8bit ) / 2 = 0.5M bits /sec )
- {
- pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW;
- Train_time_temp=pDM_SWAT_Table->Train_time ;
-
- if(pDM_SWAT_Table->Train_time_flag==3)
- {
- LowTraffic_TrainTime_L=10;
- if(Train_time_temp<50)
- Train_time_temp=LowTraffic_TrainTime_L;
- else
- Train_time_temp-=50;
- }
- else if(pDM_SWAT_Table->Train_time_flag==2)
- {
- Train_time_temp-=30;
- LowTraffic_TrainTime_L=36;
- }
- else if(pDM_SWAT_Table->Train_time_flag==1)
- {
- Train_time_temp-=10;
- LowTraffic_TrainTime_L=40;
- }
- else
- Train_time_temp+=10;
-
- //--
- if(Train_time_temp >= LowTraffic_TrainTime_U)
- Train_time_temp=LowTraffic_TrainTime_U;
-
- else if(Train_time_temp <= LowTraffic_TrainTime_L)
- Train_time_temp=LowTraffic_TrainTime_L;
-
- pDM_SWAT_Table->Train_time = Train_time_temp; //50ms~20ms
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" Train_time_flag=((%d)) , Train_time=((%d)) \n",pDM_SWAT_Table->Train_time_flag, pDM_SWAT_Table->Train_time));
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" [Low Traffic] \n" ));
- }
- else
- {
- pDM_SWAT_Table->TrafficLoad = TRAFFIC_UltraLOW;
- pDM_SWAT_Table->Train_time = 0xc8; //200ms
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" [Ultra-Low Traffic] \n" ));
- }
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TxOkCnt=(( %llu )), RxOkCnt=(( %llu )) \n",
- curTxOkCnt ,curRxOkCnt ));
-
- //-----------------
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" Current MinMaxRSSI is ((%d)) \n",pDM_FatTable->MinMaxRSSI));
-
- //---reset index---
- if(pDM_SWAT_Table->reset_idx>=reset_period)
- {
- pDM_FatTable->MinMaxRSSI=0; //
- pDM_SWAT_Table->reset_idx=0;
- }
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("reset_idx = (( %d )) \n",pDM_SWAT_Table->reset_idx ));
- //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("reset_idx=%d\n",pDM_SWAT_Table->reset_idx));
- pDM_SWAT_Table->reset_idx++;
-
- //---double check flag---
- if(pDM_FatTable->MinMaxRSSI > SWAntDiv_threshold && pDM_SWAT_Table->Double_chk_flag== 0)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" MinMaxRSSI is ((%d)), and > %d \n",
- pDM_FatTable->MinMaxRSSI,SWAntDiv_threshold));
-
- pDM_SWAT_Table->Double_chk_flag =1;
- pDM_SWAT_Table->try_flag = 1;
- pDM_SWAT_Table->RSSI_Trying = 0;
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" Test the current Ant for (( %d )) ms again \n", pDM_SWAT_Table->Train_time));
- ODM_UpdateRxIdleAnt(pDM_Odm, pDM_FatTable->RxIdleAnt);
- ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer_8723B, pDM_SWAT_Table->Train_time ); //ms
- return;
- }
-
- nextAnt = (pDM_FatTable->RxIdleAnt == MAIN_ANT)? AUX_ANT : MAIN_ANT;
-
- pDM_SWAT_Table->try_flag = 1;
-
- if(pDM_SWAT_Table->reset_idx<=1)
- pDM_SWAT_Table->RSSI_Trying = 2;
- else
- pDM_SWAT_Table->RSSI_Trying = 1;
-
- 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)
- {
- nextAnt = (pDM_FatTable->RxIdleAnt == MAIN_ANT)? AUX_ANT : MAIN_ANT;
- pDM_SWAT_Table->RSSI_Trying--;
- }
-
- //1 Decision State
- if((pDM_SWAT_Table->try_flag == 1)&&(pDM_SWAT_Table->RSSI_Trying == 0) )
- {
-
- for (i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
- {
- pEntry = pDM_Odm->pODM_StaInfo[i];
- if(IS_STA_VALID(pEntry))
- {
- //2 Caculate RSSI per Antenna
- Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0;
- Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0;
-
- if(pDM_FatTable->MainAnt_Cnt[i]<=1 && pDM_FatTable->CCK_counter_main>=1)
- Main_RSSI=0;
-
- if(pDM_FatTable->AuxAnt_Cnt[i]<=1 && pDM_FatTable->CCK_counter_aux>=1)
- Aux_RSSI=0;
-
- TargetAnt = (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;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** CCK_counter_main = (( %d )) , CCK_counter_aux= (( %d )) \n", pDM_FatTable->CCK_counter_main, pDM_FatTable->CCK_counter_aux));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** OFDM_counter_main = (( %d )) , OFDM_counter_aux= (( %d )) \n", pDM_FatTable->OFDM_counter_main, pDM_FatTable->OFDM_counter_aux));
- 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"));
-
- //2 Select RX Idle Antenna
-
- if (LocalMaxRSSI != 0 && LocalMaxRSSI < MinMaxRSSI)
- {
- RxIdleAnt = TargetAnt;
- MinMaxRSSI = LocalMaxRSSI;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** LocalMaxRSSI-LocalMinRSSI = ((%d))\n",(LocalMaxRSSI-LocalMinRSSI)));
-
- if((LocalMaxRSSI-LocalMinRSSI)>8)
- {
- if(LocalMinRSSI != 0)
- pDM_SWAT_Table->Train_time_flag=3;
- else
- {
- if(MinMaxRSSI > SWAntDiv_threshold)
- pDM_SWAT_Table->Train_time_flag=0;
- else
- 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;
-
- }
-
- //2 Select TX Antenna
- if(TargetAnt == MAIN_ANT)
- pDM_FatTable->antsel_a[i] = ANT1_2G;
- else
- pDM_FatTable->antsel_a[i] = ANT2_2G;
-
- }
- pDM_FatTable->MainAnt_Sum[i] = 0;
- pDM_FatTable->AuxAnt_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;
-
- }
-
-
- pDM_FatTable->MinMaxRSSI=MinMaxRSSI;
- pDM_SWAT_Table->try_flag = 0;
-
- if( pDM_SWAT_Table->Double_chk_flag==1)
- {
- pDM_SWAT_Table->Double_chk_flag=0;
- if(pDM_FatTable->MinMaxRSSI > SWAntDiv_threshold)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" [Double check] MinMaxRSSI ((%d)) > %d again!! \n",
- pDM_FatTable->MinMaxRSSI,SWAntDiv_threshold));
-
- 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"));
- return;
- }
- else
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" [Double check] MinMaxRSSI ((%d)) <= %d !! \n",
- pDM_FatTable->MinMaxRSSI,SWAntDiv_threshold));
-
- nextAnt = (pDM_FatTable->RxIdleAnt == MAIN_ANT)? AUX_ANT : MAIN_ANT;
- pDM_SWAT_Table->try_flag = 0;
- pDM_SWAT_Table->reset_idx=reset_period;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("[set try_flag=0] Normal State: Need to tryg again!! \n\n\n"));
- return;
- }
- }
- else
- {
- 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"));
- return;
- }
-
- }
-
- }
-
- //1 4.Change TRX antenna
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RSSI_Trying = (( %d )), Ant: (( %s )) >>> (( %s )) \n",
- pDM_SWAT_Table->RSSI_Trying, (pDM_FatTable->RxIdleAnt == MAIN_ANT?"MAIN":"AUX"),(nextAnt == MAIN_ANT?"MAIN":"AUX")));
-
- ODM_UpdateRxIdleAnt(pDM_Odm, nextAnt);
-
- //1 5.Reset Statistics
-
- pDM_FatTable->RxIdleAnt = nextAnt;
-
- //1 6.Set next timer (Trying State)
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" Test ((%s)) Ant for (( %d )) ms \n", (nextAnt == MAIN_ANT?"MAIN":"AUX"), pDM_SWAT_Table->Train_time));
- ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer_8723B, pDM_SWAT_Table->Train_time ); //ms
-}
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-VOID
-ODM_SW_AntDiv_Callback(
- 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_8723B);
- #else
- {
- //DbgPrint("SW_antdiv_Callback");
- odm_S0S1_SwAntDiv(&pHalData->DM_OutSrc, SWAW_STEP_DETERMINE);
- }
- #endif
- #else
- ODM_ScheduleWorkItem(&pDM_SWAT_Table->SwAntennaSwitchWorkitem_8723B);
- #endif
-}
-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->DM_OutSrc, SWAW_STEP_DETERMINE);
-}
-#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
-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);
-}
-#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
-
-#endif //#if (RTL8723B_SUPPORT == 1)
-
-
-#if(RTL8188E_SUPPORT == 1 || RTL8192E_SUPPORT == 1)
-#if (!(DM_ODM_SUPPORT_TYPE == ODM_CE))
-VOID
-odm_SetNextMACAddrTarget(
- IN PDM_ODM_T pDM_Odm
-)
-{
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
- PSTA_INFO_T pEntry;
- //u1Byte Bssid[6];
- u4Byte value32, i;
-
- //
- //2012.03.26 LukeLee: The MAC address is changed according to MACID in turn
- //
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SetNextMACAddrTarget() ==>\n"));
- if(pDM_Odm->bLinked)
- {
- for (i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
- {
- if((pDM_FatTable->TrainIdx+1) == ODM_ASSOCIATE_ENTRY_NUM)
- pDM_FatTable->TrainIdx = 0;
- else
- pDM_FatTable->TrainIdx++;
-
- pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx];
- if(IS_STA_VALID(pEntry))
- {
- //Match MAC ADDR
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- value32 = (pEntry->hwaddr[5]<<8)|pEntry->hwaddr[4];
-#else
- value32 = (pEntry->MacAddr[5]<<8)|pEntry->MacAddr[4];
-#endif
- ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, value32);
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- value32 = (pEntry->hwaddr[3]<<24)|(pEntry->hwaddr[2]<<16) |(pEntry->hwaddr[1]<<8) |pEntry->hwaddr[0];
-#else
- value32 = (pEntry->MacAddr[3]<<24)|(pEntry->MacAddr[2]<<16) |(pEntry->MacAddr[1]<<8) |pEntry->MacAddr[0];
-#endif
- ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, value32);
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_FatTable->TrainIdx=%lu\n",pDM_FatTable->TrainIdx));
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC Addr = %x:%x:%x:%x:%x:%x\n",
- pEntry->hwaddr[5],pEntry->hwaddr[4],pEntry->hwaddr[3],pEntry->hwaddr[2],pEntry->hwaddr[1],pEntry->hwaddr[0]));
-#else
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC Addr = %x:%x:%x:%x:%x:%x\n",
- pEntry->MacAddr[5],pEntry->MacAddr[4],pEntry->MacAddr[3],pEntry->MacAddr[2],pEntry->MacAddr[1],pEntry->MacAddr[0]));
-#endif
-
- break;
- }
- }
-
- }
-
-#if 0
- //
- //2012.03.26 LukeLee: This should be removed later, the MAC address is changed according to MACID in turn
- //
- #if( DM_ODM_SUPPORT_TYPE & ODM_WIN)
- {
- PADAPTER Adapter = pDM_Odm->Adapter;
- PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
-
- for (i=0; i<6; i++)
- {
- Bssid[i] = pMgntInfo->Bssid[i];
- //DbgPrint("Bssid[%d]=%x\n", i, Bssid[i]);
- }
- }
- #endif
-
- //odm_SetNextMACAddrTarget(pDM_Odm);
-
- //1 Select MAC Address Filter
- for (i=0; i<6; i++)
- {
- if(Bssid[i] != pDM_FatTable->Bssid[i])
- {
- bMatchBSSID = FALSE;
- break;
- }
- }
- if(bMatchBSSID == FALSE)
- {
- //Match MAC ADDR
- value32 = (Bssid[5]<<8)|Bssid[4];
- ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, value32);
- value32 = (Bssid[3]<<24)|(Bssid[2]<<16) |(Bssid[1]<<8) |Bssid[0];
- ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, value32);
- }
-
- return bMatchBSSID;
-#endif
-
-}
-
-VOID
-odm_FastAntTraining(
- IN PDM_ODM_T pDM_Odm
-)
-{
- u4Byte i, MaxRSSI=0;
- u1Byte TargetAnt=2;
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
- BOOLEAN bPktFilterMacth = FALSE;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("==>odm_FastAntTraining()\n"));
-
- //1 TRAINING STATE
- if(pDM_FatTable->FAT_State == FAT_TRAINING_STATE)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Enter FAT_TRAINING_STATE\n"));
- //2 Caculate RSSI per Antenna
- for (i=0; i<7; i++)
- {
- if(pDM_FatTable->antRSSIcnt[i] == 0)
- pDM_FatTable->antAveRSSI[i] = 0;
- else
- {
- pDM_FatTable->antAveRSSI[i] = pDM_FatTable->antSumRSSI[i] /pDM_FatTable->antRSSIcnt[i];
- bPktFilterMacth = TRUE;
- }
- if(pDM_FatTable->antAveRSSI[i] > MaxRSSI)
- {
- MaxRSSI = pDM_FatTable->antAveRSSI[i];
- TargetAnt = (u1Byte) i;
- }
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_FatTable->antAveRSSI[%lu] = %lu, pDM_FatTable->antRSSIcnt[%lu] = %lu\n",
- i, pDM_FatTable->antAveRSSI[i], i, pDM_FatTable->antRSSIcnt[i]));
- }
-
- //2 Select TRX Antenna
- if(bPktFilterMacth == FALSE)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("None Packet is matched\n"));
-
- ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training
- ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv
- }
- else
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TargetAnt=%d, MaxRSSI=%lu\n",TargetAnt,MaxRSSI));
-
- ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training
- //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv
- ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, TargetAnt); //Default RX is Omni, Optional RX is the best decision by FAT
- //ODM_SetBBReg(pDM_Odm, 0x860 , BIT14|BIT13|BIT12, TargetAnt); //Default TX
- ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info
-
-#if 0
- pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx];
-
- if(IS_STA_VALID(pEntry))
- {
- pEntry->antsel_a = TargetAnt&BIT0;
- pEntry->antsel_b = (TargetAnt&BIT1)>>1;
- pEntry->antsel_c = (TargetAnt&BIT2)>>2;
- }
-#else
- pDM_FatTable->antsel_a[pDM_FatTable->TrainIdx] = TargetAnt&BIT0;
- pDM_FatTable->antsel_b[pDM_FatTable->TrainIdx] = (TargetAnt&BIT1)>>1;
- pDM_FatTable->antsel_c[pDM_FatTable->TrainIdx] = (TargetAnt&BIT2)>>2;
-#endif
-
-
- if(TargetAnt == 0)
- ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv
-
- }
-
- //2 Reset Counter
- for(i=0; i<7; i++)
- {
- pDM_FatTable->antSumRSSI[i] = 0;
- pDM_FatTable->antRSSIcnt[i] = 0;
- }
-
- pDM_FatTable->FAT_State = FAT_NORMAL_STATE;
- return;
- }
-
- //1 NORMAL STATE
- if(pDM_FatTable->FAT_State == FAT_NORMAL_STATE)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Enter FAT_NORMAL_STATE\n"));
-
- odm_SetNextMACAddrTarget(pDM_Odm);
-
-#if 0
- pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx];
- if(IS_STA_VALID(pEntry))
- {
- pEntry->antsel_a = TargetAnt&BIT0;
- pEntry->antsel_b = (TargetAnt&BIT1)>>1;
- pEntry->antsel_c = (TargetAnt&BIT2)>>2;
- }
-#endif
-
- //2 Prepare Training
- pDM_FatTable->FAT_State = FAT_TRAINING_STATE;
- ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 1); //RegE08[16]=1'b1 //enable fast training
- ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Start FAT_TRAINING_STATE\n"));
- ODM_SetTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer, 500 ); //ms
-
- }
-
-}
-
-VOID
-odm_FastAntTrainingCallback(
- IN PDM_ODM_T pDM_Odm
-)
-{
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- PADAPTER padapter = pDM_Odm->Adapter;
- if(padapter->net_closed == _TRUE)
- return;
- //if(*pDM_Odm->pbNet_closed == TRUE)
- // return;
-#endif
-
-#if USE_WORKITEM
- ODM_ScheduleWorkItem(&pDM_Odm->FastAntTrainingWorkitem);
-#else
- odm_FastAntTraining(pDM_Odm);
-#endif
-}
-
-VOID
-odm_FastAntTrainingWorkItemCallback(
- IN PDM_ODM_T pDM_Odm
-)
-{
- odm_FastAntTraining(pDM_Odm);
-}
-#endif
-
-#endif
-
-
-VOID
-ODM_AntDivInit(
- IN PDM_ODM_T pDM_Odm
- )
-{
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
- pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
-
-
- if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] Not Support Antenna Diversity Function\n"));
- return;
- }
- //---
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if(pDM_FatTable->AntDiv_2G_5G == ODM_ANTDIV_2G)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[2G AntDiv Init]: Only Support 2G Antenna Diversity Function\n"));
- if(!(pDM_Odm->SupportICType & ODM_ANTDIV_2G_SUPPORT_IC))
- return;
- }
- else if(pDM_FatTable->AntDiv_2G_5G == ODM_ANTDIV_5G)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[5G AntDiv Init]: Only Support 5G Antenna Diversity Function\n"));
- if(!(pDM_Odm->SupportICType & ODM_ANTDIV_5G_SUPPORT_IC))
- return;
- }
- else if(pDM_FatTable->AntDiv_2G_5G == (ODM_ANTDIV_2G|ODM_ANTDIV_5G))
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[2G & 5G AntDiv Init]:Support Both 2G & 5G Antenna Diversity Function\n"));
- }
-
- pDM_Odm->antdiv_rssi=0;
-
-#endif
- //---
-
- //2 [--General---]
- pDM_Odm->antdiv_period=0;
- pDM_Odm->antdiv_select=0;
- pDM_SWAT_Table->Ant5G = MAIN_ANT;
- pDM_SWAT_Table->Ant2G = MAIN_ANT;
- pDM_FatTable->CCK_counter_main=0;
- pDM_FatTable->CCK_counter_aux=0;
- pDM_FatTable->OFDM_counter_main=0;
- pDM_FatTable->OFDM_counter_aux=0;
-
- //3 [Set MAIN_ANT as default antenna if Auto-Ant enable]
- if (pDM_Odm->antdiv_select==1)
- pDM_Odm->AntType = ODM_FIX_MAIN_ANT;
- else if (pDM_Odm->antdiv_select==2)
- pDM_Odm->AntType = ODM_FIX_AUX_ANT;
- else if(pDM_Odm->antdiv_select==0)
- pDM_Odm->AntType = ODM_AUTO_ANT;
-
- if(pDM_Odm->AntType == ODM_AUTO_ANT)
- {
- odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
- ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
- }
- else
- {
- odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
-
- if(pDM_Odm->AntType == ODM_FIX_MAIN_ANT)
- {
- ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
- return;
- }
- else if(pDM_Odm->AntType == ODM_FIX_AUX_ANT)
- {
- ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
- return;
- }
- }
- //---
- if(pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV)
- {
- if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
- {
- #if TX_BY_REG
- ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 0); //Reg80c[21]=1'b0 //from Reg
- #else
- ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1);
- #endif
- }
- else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT)
- {
- #if TX_BY_REG
- ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0);
- #else
- ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 1);
- #endif
- }
- }
-
- //2 [--88E---]
- if(pDM_Odm->SupportICType == ODM_RTL8188E)
- {
- #if (RTL8188E_SUPPORT == 1)
- //pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV;
- //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
- //pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV;
-
- if( (pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV) && (pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV) && (pDM_Odm->AntDivType != CG_TRX_SMART_ANTDIV))
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 88E Not Supprrt This AntDiv Type\n"));
- pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
- return;
- }
-
- if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
- odm_RX_HWAntDiv_Init_88E(pDM_Odm);
- else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
- odm_TRX_HWAntDiv_Init_88E(pDM_Odm);
- else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)
- odm_Smart_HWAntDiv_Init_88E(pDM_Odm);
- #endif
- }
-
- //2 [--92E---]
- #if (RTL8192E_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8192E)
- {
- //pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV;
- //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
- //pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV;
-
- if( (pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV) && (pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV) && (pDM_Odm->AntDivType != CG_TRX_SMART_ANTDIV))
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8192E Not Supprrt This AntDiv Type\n"));
- pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
- return;
- }
-
- if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
- odm_RX_HWAntDiv_Init_92E(pDM_Odm);
- else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
- odm_TRX_HWAntDiv_Init_92E(pDM_Odm);
- else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)
- odm_Smart_HWAntDiv_Init_92E(pDM_Odm);
-
- }
- #endif
-
- //2 [--8723B---]
- #if (RTL8723B_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8723B)
- {
- //pDM_Odm->AntDivType = S0S1_SW_ANTDIV;
- //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
-
- if(pDM_Odm->AntDivType != S0S1_SW_ANTDIV && pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8723B Not Supprrt This AntDiv Type\n"));
- pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
- return;
- }
-
- if( pDM_Odm->AntDivType==S0S1_SW_ANTDIV)
- odm_S0S1_SWAntDiv_Init_8723B(pDM_Odm);
- else if(pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV)
- odm_TRX_HWAntDiv_Init_8723B(pDM_Odm);
- }
- #endif
-
- //2 [--8811A 8821A---]
- #if (RTL8821A_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8821)
- {
- //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
- pDM_Odm->AntDivType = S0S1_SW_ANTDIV;
-
- if( pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV && pDM_Odm->AntDivType != S0S1_SW_ANTDIV)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8821A & 8811A Not Supprrt This AntDiv Type\n"));
- pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
- return;
- }
- if(pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV)
- odm_TRX_HWAntDiv_Init_8821A(pDM_Odm);
- else if( pDM_Odm->AntDivType==S0S1_SW_ANTDIV)
- odm_S0S1_SWAntDiv_Init_8821A(pDM_Odm);
- }
- #endif
-
- //2 [--8881A---]
- #if (RTL8881A_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8881A)
- {
- //pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV;
- //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
-
- if(pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV && pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8881A Not Supprrt This AntDiv Type\n"));
- pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
- return;
- }
- if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
- odm_RX_HWAntDiv_Init_8881A(pDM_Odm);
- else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
- odm_TRX_HWAntDiv_Init_8881A(pDM_Odm);
- }
- #endif
-
- //2 [--8812---]
- #if (RTL8812A_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8812)
- {
- //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
-
- if( pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8812A Not Supprrt This AntDiv Type\n"));
- pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
- return;
- }
- odm_TRX_HWAntDiv_Init_8812A(pDM_Odm);
- }
- #endif
- //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,("*** AntDiv SupportAbility=[%lu] \n",(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)>>6));
- //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("*** AntDiv Type=[%d] \n",pDM_Odm->AntDivType));
-
-}
-
-VOID
-ODM_AntDiv(
- IN PDM_ODM_T pDM_Odm
-)
-{
- PADAPTER pAdapter = pDM_Odm->Adapter;
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
-
-//#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if(*pDM_Odm->pBandType == ODM_BAND_5G )
- {
- if(pDM_FatTable->idx_AntDiv_counter_5G < pDM_Odm->antdiv_period )
- {
- pDM_FatTable->idx_AntDiv_counter_5G++;
- return;
- }
- else
- pDM_FatTable->idx_AntDiv_counter_5G=0;
- }
- else if(*pDM_Odm->pBandType == ODM_BAND_2_4G )
- {
- if(pDM_FatTable->idx_AntDiv_counter_2G < pDM_Odm->antdiv_period )
- {
- pDM_FatTable->idx_AntDiv_counter_2G++;
- return;
- }
- else
- pDM_FatTable->idx_AntDiv_counter_2G=0;
- }
-//#endif
- //----------
- if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] Not Support Antenna Diversity Function\n"));
- return;
- }
-
- //----------
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if(pAdapter->MgntInfo.AntennaTest)
- return;
-
- {
- #if (BEAMFORMING_SUPPORT == 1)
- BEAMFORMING_CAP BeamformCap = (pAdapter->MgntInfo.BeamformingInfo.BeamformCap);
-
- if( BeamformCap & BEAMFORMEE_CAP ) // BFmee On && Div On -> Div Off
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ AntDiv : OFF ] BFmee ==1 \n"));
- if(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)
- {
- odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
- pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
- return;
- }
- }
- else // BFmee Off && Div Off -> Div On
- #endif
- {
- if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV) && pDM_Odm->bLinked)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ AntDiv : ON ] BFmee ==0 \n"));
- if((pDM_Odm->AntDivType!=S0S1_SW_ANTDIV) )
- odm_AntDiv_on_off(pDM_Odm, ANTDIV_ON);
-
- pDM_Odm->SupportAbility |= (ODM_BB_ANT_DIV);
- }
- }
- }
-#endif
-
- //----------
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if(pDM_FatTable->AntDiv_2G_5G == ODM_ANTDIV_2G)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 2G AntDiv Running ]\n"));
- if(!(pDM_Odm->SupportICType & ODM_ANTDIV_2G_SUPPORT_IC))
- return;
- }
- else if(pDM_FatTable->AntDiv_2G_5G == ODM_ANTDIV_5G)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 5G AntDiv Running ]\n"));
- if(!(pDM_Odm->SupportICType & ODM_ANTDIV_5G_SUPPORT_IC))
- return;
- }
- else if(pDM_FatTable->AntDiv_2G_5G == (ODM_ANTDIV_2G|ODM_ANTDIV_5G))
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 2G & 5G AntDiv Running ]\n"));
- }
-#endif
-
- //----------
-
- if (pDM_Odm->antdiv_select==1)
- pDM_Odm->AntType = ODM_FIX_MAIN_ANT;
- else if (pDM_Odm->antdiv_select==2)
- pDM_Odm->AntType = ODM_FIX_AUX_ANT;
- else if (pDM_Odm->antdiv_select==0)
- pDM_Odm->AntType = ODM_AUTO_ANT;
-
- //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("AntType= (( %d )) , pre_AntType= (( %d )) \n",pDM_Odm->AntType,pDM_Odm->pre_AntType));
-
- if(pDM_Odm->AntType != ODM_AUTO_ANT)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Fix Antenna at (( %s ))\n",(pDM_Odm->AntType == ODM_FIX_MAIN_ANT)?"MAIN":"AUX"));
-
- if(pDM_Odm->AntType != pDM_Odm->pre_AntType)
- {
- odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
-
- if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
- ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 0);
- else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT)
- ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0);
-
- if(pDM_Odm->AntType == ODM_FIX_MAIN_ANT)
- ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
- else if(pDM_Odm->AntType == ODM_FIX_AUX_ANT)
- ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
- }
- pDM_Odm->pre_AntType=pDM_Odm->AntType;
- return;
- }
- else
- {
- if(pDM_Odm->AntType != pDM_Odm->pre_AntType)
- {
- odm_AntDiv_on_off(pDM_Odm, ANTDIV_ON);
- if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
- ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1);
- else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT)
- ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 1);
- }
- pDM_Odm->pre_AntType=pDM_Odm->AntType;
- }
-
-
- //3 -----------------------------------------------------------------------------------------------------------
- //2 [--88E---]
- if(pDM_Odm->SupportICType == ODM_RTL8188E)
- {
- #if (RTL8188E_SUPPORT == 1)
- if(pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV ||pDM_Odm->AntDivType==CGCS_RX_HW_ANTDIV)
- odm_HW_AntDiv(pDM_Odm);
- #if (!(DM_ODM_SUPPORT_TYPE == ODM_CE))
- else if (pDM_Odm->AntDivType==CG_TRX_SMART_ANTDIV)
- odm_FastAntTraining(pDM_Odm);
- #endif
- #endif
- }
- //2 [--92E---]
- #if (RTL8192E_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8192E)
- {
- if(pDM_Odm->AntDivType==CGCS_RX_HW_ANTDIV)
- odm_HW_AntDiv(pDM_Odm);
- #if (!(DM_ODM_SUPPORT_TYPE == ODM_CE))
- else if (pDM_Odm->AntDivType==CG_TRX_SMART_ANTDIV)
- odm_FastAntTraining(pDM_Odm);
- #endif
- }
- #endif
-
- #if (RTL8723B_SUPPORT == 1)
- //2 [--8723B---]
- else if(pDM_Odm->SupportICType == ODM_RTL8723B)
- {
- if (pDM_Odm->AntDivType==S0S1_SW_ANTDIV)
- odm_S0S1_SwAntDiv(pDM_Odm, SWAW_STEP_PEAK);
- else if (pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV)
- odm_HW_AntDiv(pDM_Odm);
- }
- #endif
-
- //2 [--8821A---]
- #if (RTL8821A_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8821)
- {
- if(pDM_Odm->bBtDisabled) //BT disabled
- {
- if(pDM_Odm->AntDivType == S0S1_SW_ANTDIV)
- {
- pDM_Odm->AntDivType=CG_TRX_HW_ANTDIV;
- ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, 1);
- }
- }
- else //BT enabled
- {
- if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
- {
- pDM_Odm->AntDivType=S0S1_SW_ANTDIV;
- ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, 0);
- }
- }
-
- if (pDM_Odm->AntDivType==S0S1_SW_ANTDIV)
- odm_S0S1_SwAntDiv(pDM_Odm, SWAW_STEP_PEAK);
- else if (pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV)
- odm_HW_AntDiv(pDM_Odm);
- }
- #endif
- //2 [--8881A---]
- #if (RTL8881A_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8881A)
- odm_HW_AntDiv(pDM_Odm);
- #endif
- //2 [--8812A---]
- #if (RTL8812A_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8812)
- odm_HW_AntDiv(pDM_Odm);
- #endif
-}
-
-
-VOID
-odm_AntselStatistics(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte antsel_tr_mux,
- IN u4Byte MacId,
- IN u4Byte RxPWDBAll
-)
-{
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
-
- if(antsel_tr_mux == ANT1_2G)
- {
- pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll;
- pDM_FatTable->MainAnt_Cnt[MacId]++;
- }
- else
- {
- pDM_FatTable->AuxAnt_Sum[MacId]+=RxPWDBAll;
- pDM_FatTable->AuxAnt_Cnt[MacId]++;
- }
-}
-
-
-VOID
-ODM_Process_RSSIForAntDiv(
- IN OUT PDM_ODM_T pDM_Odm,
- IN PODM_PHY_INFO_T pPhyInfo,
- IN PODM_PACKET_INFO_T pPktinfo
- )
-{
-u1Byte isCCKrate=0,CCKMaxRate=DESC_RATE11M;
-pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- u4Byte RxPower_Ant0, RxPower_Ant1;
-#else
- u1Byte RxPower_Ant0, RxPower_Ant1;
-#endif
-
- if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
- CCKMaxRate=DESC_RATE11M;
- else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT)
- CCKMaxRate=DESC_RATE11M;
- isCCKrate = (pPktinfo->DataRate <= CCKMaxRate)?TRUE:FALSE;
-
-#if ((RTL8192C_SUPPORT == 1) ||(RTL8192D_SUPPORT == 1))
- if(pDM_Odm->SupportICType & ODM_RTL8192C|ODM_RTL8192D)
- {
- if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
- {
- //if(pPktinfo->bPacketBeacon)
- //{
- // DbgPrint("This is beacon, isCCKrate=%d\n", isCCKrate);
- //}
- ODM_AntselStatistics_88C(pDM_Odm, pPktinfo->StationID, pPhyInfo->RxPWDBAll, isCCKrate);
- }
- }
-#endif
-
- if( (pDM_Odm->SupportICType == ODM_RTL8192E||pDM_Odm->SupportICType == ODM_RTL8812) && (pPktinfo->DataRate > CCKMaxRate) )
- {
- RxPower_Ant0 = pPhyInfo->RxMIMOSignalStrength[0];
- RxPower_Ant1= pPhyInfo->RxMIMOSignalStrength[1];
- }
- else
- RxPower_Ant0=pPhyInfo->RxPWDBAll;
-
- if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)
- {
- if( (pDM_Odm->SupportICType & ODM_SMART_ANT_SUPPORT) && pPktinfo->bPacketToSelf && pDM_FatTable->FAT_State == FAT_TRAINING_STATE )//(pPktinfo->bPacketMatchBSSID && (!pPktinfo->bPacketBeacon))
- {
- u1Byte antsel_tr_mux;
- antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0;
- pDM_FatTable->antSumRSSI[antsel_tr_mux] += RxPower_Ant0;
- pDM_FatTable->antRSSIcnt[antsel_tr_mux]++;
- }
- }
- else //AntDivType != CG_TRX_SMART_ANTDIV
- {
- if( ( pDM_Odm->SupportICType & ODM_ANTDIV_SUPPORT ) && (pPktinfo->bPacketToSelf || pPktinfo->bPacketMatchBSSID) )
- {
- if(pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8192E)
- odm_AntselStatistics(pDM_Odm, pDM_FatTable->antsel_rx_keep_0, pPktinfo->StationID,RxPower_Ant0);
- else// SupportICType == ODM_RTL8821 and ODM_RTL8723B and ODM_RTL8812)
- {
- if(isCCKrate && (pDM_Odm->AntDivType == S0S1_SW_ANTDIV))
- {
- 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_counter_main++;
- else// if(pDM_FatTable->antsel_rx_keep_0==ANT2_2G)
- pDM_FatTable->CCK_counter_aux++;
-
- odm_AntselStatistics(pDM_Odm, pDM_FatTable->antsel_rx_keep_0, pPktinfo->StationID, RxPower_Ant0);
- }
- 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)
- pDM_FatTable->OFDM_counter_aux++;
- odm_AntselStatistics(pDM_Odm, pDM_FatTable->antsel_rx_keep_0, pPktinfo->StationID, RxPower_Ant0);
- }
- }
- }
- }
- //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("isCCKrate=%d, PWDB_ALL=%d\n",isCCKrate, pPhyInfo->RxPWDBAll));
- //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n",pDM_FatTable->antsel_rx_keep_2, pDM_FatTable->antsel_rx_keep_1, pDM_FatTable->antsel_rx_keep_0));
-}
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
-VOID
-ODM_SetTxAntByTxInfo(
- IN PDM_ODM_T pDM_Odm,
- IN pu1Byte pDesc,
- IN u1Byte macId
-)
-{
- pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
-
- if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))
- return;
-
- if(pDM_Odm->AntDivType==CGCS_RX_HW_ANTDIV)
- return;
-
-
- if(pDM_Odm->SupportICType == ODM_RTL8723B)
- {
-#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
- }
- else if(pDM_Odm->SupportICType == ODM_RTL8821)
- {
-#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
- }
- else if(pDM_Odm->SupportICType == ODM_RTL8188E)
- {
-#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
- }
- else if(pDM_Odm->SupportICType == ODM_RTL8192E)
- {
-
-
- }
-}
-#else// (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
-VOID
-ODM_SetTxAntByTxInfo(
- //IN PDM_ODM_T pDM_Odm,
- struct rtl8192cd_priv *priv,
- struct tx_desc *pdesc,
- struct tx_insn *txcfg,
- unsigned short aid
-)
-{
- pFAT_T pDM_FatTable = &priv->pshare->_dmODM.DM_FatTable;
- u4Byte SupportICType=priv->pshare->_dmODM.SupportICType;
-
- if(SupportICType == ODM_RTL8881A)
- {
- //panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8881E****** \n",__FUNCTION__,__LINE__);
- pdesc->Dword6 &= set_desc(~ (BIT(18)|BIT(17)|BIT(16)));
- pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_a[aid]<<16);
- }
- else if(SupportICType == ODM_RTL8192E)
- {
- //panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8192E****** \n",__FUNCTION__,__LINE__);
- pdesc->Dword6 &= set_desc(~ (BIT(18)|BIT(17)|BIT(16)));
- pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_a[aid]<<16);
- }
- else if(SupportICType == ODM_RTL8812)
- {
- //3 [path-A]
- //panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8881E****** \n",__FUNCTION__,__LINE__);
-
- pdesc->Dword6 &= set_desc(~ BIT(16));
- pdesc->Dword6 &= set_desc(~ BIT(17));
- pdesc->Dword6 &= set_desc(~ BIT(18));
- if(txcfg->pstat)
- {
- pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_a[aid]<<16);
- pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_b[aid]<<17);
- pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_c[aid]<<18);
- }
- }
-}
-#endif
-
-#else
-
-VOID ODM_AntDivInit( IN PDM_ODM_T pDM_Odm ){}
-VOID ODM_AntDiv( IN PDM_ODM_T pDM_Odm){}
-
-#endif //#if (defined(CONFIG_HW_ANTENNA_DIVERSITY))
-
-
+/******************************************************************************
+ *
+ * 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 "odm_precomp.h"
+
+#if (defined(CONFIG_HW_ANTENNA_DIVERSITY))
+VOID
+odm_AntDiv_on_off( IN PDM_ODM_T pDM_Odm ,IN u1Byte swch)
+{
+ if(pDM_Odm->AntDivType==S0S1_SW_ANTDIV || pDM_Odm->AntDivType==CGCS_RX_SW_ANTDIV)
+ return;
+
+ 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_SetBBReg(pDM_Odm, 0xc50 , BIT7, swch); //OFDM AntDiv function block enable
+ 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"));
+ 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
+ }
+ 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
+ }
+ }
+}
+
+VOID
+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(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(Ant == MAIN_ANT)
+ {
+ DefaultAnt = ANT1_2G;
+ OptionalAnt = ANT2_2G;
+ }
+ else
+ {
+ DefaultAnt = ANT2_2G;
+ OptionalAnt = ANT1_2G;
+ }
+
+ if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
+ {
+ if(pDM_Odm->SupportICType==ODM_RTL8192E)
+ {
+ ODM_SetBBReg(pDM_Odm, 0xB38 , BIT5|BIT4|BIT3, DefaultAnt); //Default RX
+ ODM_SetBBReg(pDM_Odm, 0xB38 , BIT8|BIT7|BIT6, OptionalAnt);//Optional RX
+ }
+ 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
+ }
+ 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
+ }
+ ODM_SetMACReg(pDM_Odm, 0x6D8 , BIT10|BIT9|BIT8, DefaultAnt); //PathA Resp Tx
+ }
+ else// pDM_FatTable->RxIdleAnt == Ant
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Stay in Ori-Ant ] RxIdleAnt =%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"));
+ pDM_FatTable->RxIdleAnt = Ant;
+ }
+}
+
+
+VOID
+odm_UpdateTxAnt(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant, IN u4Byte MacId)
+{
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+ u1Byte TxAnt;
+
+ if(Ant == MAIN_ANT)
+ TxAnt = ANT1_2G;
+ else
+ TxAnt = ANT2_2G;
+
+ pDM_FatTable->antsel_a[MacId] = TxAnt&BIT0;
+ pDM_FatTable->antsel_b[MacId] = (TxAnt&BIT1)>>1;
+ pDM_FatTable->antsel_c[MacId] = (TxAnt&BIT2)>>2;
+ #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+ if (pDM_Odm->antdiv_rssi)
+ {
+ //panic_printk("[Tx from TxInfo]: MacID:(( %d )), TxAnt = (( %s ))\n",MacId,(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT");
+ //panic_printk("antsel_tr_mux=(( 3'b%d%d%d ))\n", pDM_FatTable->antsel_c[MacId] , pDM_FatTable->antsel_b[MacId] , pDM_FatTable->antsel_a[MacId] );
+ }
+ #endif
+ //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Tx from TxInfo]: MacID:(( %d )), TxAnt = (( %s ))\n",
+ // MacId,(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"));
+ //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=(( 3'b%d%d%d ))\n",
+ //pDM_FatTable->antsel_c[MacId] , pDM_FatTable->antsel_b[MacId] , pDM_FatTable->antsel_a[MacId] ));
+
+}
+
+
+
+#if (RTL8188E_SUPPORT == 1)
+
+
+VOID
+odm_RX_HWAntDiv_Init_88E(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ u4Byte value32;
+
+ pDM_Odm->AntType = ODM_AUTO_ANT;
+
+ #if (MP_DRIVER == 1)
+ 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"));
+
+ //MAC Setting
+ value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord);
+ ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output
+ //Pin Settings
+ ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW
+ ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW
+ ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 1); //Regb2c[22]=1'b0 //disable CS/CG switch
+ ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only
+ //OFDM Settings
+ ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0);
+ //CCK Settings
+ 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
+
+}
+
+VOID
+odm_TRX_HWAntDiv_Init_88E(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ u4Byte value32;
+
+ #if (MP_DRIVER == 1)
+ 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"));
+
+ //MAC Setting
+ value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord);
+ ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output
+ //Pin Settings
+ ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW
+ ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW
+ ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 0); //Regb2c[22]=1'b0 //disable CS/CG switch
+ ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only
+ //OFDM Settings
+ ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0);
+ //CCK Settings
+ 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
+
+ //antenna mapping table
+ if(!pDM_Odm->bIsMPChip) //testchip
+ {
+ ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT10|BIT9|BIT8, 1); //Reg858[10:8]=3'b001
+ 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
+}
+
+VOID
+odm_Smart_HWAntDiv_Init_88E(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ u4Byte value32, i;
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+ u4Byte AntCombination = 2;
+
+ 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)
+ 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++)
+ {
+ pDM_FatTable->Bssid[i] = 0;
+ pDM_FatTable->antSumRSSI[i] = 0;
+ pDM_FatTable->antRSSIcnt[i] = 0;
+ pDM_FatTable->antAveRSSI[i] = 0;
+ }
+ pDM_FatTable->TrainIdx = 0;
+ pDM_FatTable->FAT_State = FAT_NORMAL_STATE;
+
+ //MAC Setting
+ value32 = ODM_GetMACReg(pDM_Odm, 0x4c, bMaskDWord);
+ ODM_SetMACReg(pDM_Odm, 0x4c, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output
+ value32 = ODM_GetMACReg(pDM_Odm, 0x7B4, bMaskDWord);
+ ODM_SetMACReg(pDM_Odm, 0x7b4, bMaskDWord, value32|(BIT16|BIT17)); //Reg7B4[16]=1 enable antenna training, Reg7B4[17]=1 enable A2 match
+ //value32 = PlatformEFIORead4Byte(Adapter, 0x7B4);
+ //PlatformEFIOWrite4Byte(Adapter, 0x7b4, value32|BIT18); //append MACID in reponse packet
+
+ //Match MAC ADDR
+ ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, 0);
+ ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, 0);
+
+ ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW
+ ODM_SetBBReg(pDM_Odm, 0x864 , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW
+ ODM_SetBBReg(pDM_Odm, 0xb2c , BIT22, 0); //Regb2c[22]=1'b0 //disable CS/CG switch
+ ODM_SetBBReg(pDM_Odm, 0xb2c , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only
+ ODM_SetBBReg(pDM_Odm, 0xca4 , bMaskDWord, 0x000000a0);
+
+ //antenna mapping table
+ if(AntCombination == 2)
+ {
+ if(!pDM_Odm->bIsMPChip) //testchip
+ {
+ ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 1); //Reg858[10:8]=3'b001
+ ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 2); //Reg858[13:11]=3'b010
+ }
+ else //MPchip
+ {
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 1);
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 2);
+ }
+ }
+ else if(AntCombination == 7)
+ {
+ if(!pDM_Odm->bIsMPChip) //testchip
+ {
+ ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 0); //Reg858[10:8]=3'b000
+ ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 1); //Reg858[13:11]=3'b001
+ ODM_SetBBReg(pDM_Odm, 0x878 , BIT16, 0);
+ ODM_SetBBReg(pDM_Odm, 0x858 , BIT15|BIT14, 2); //(Reg878[0],Reg858[14:15])=3'b010
+ ODM_SetBBReg(pDM_Odm, 0x878 , BIT19|BIT18|BIT17, 3);//Reg878[3:1]=3b'011
+ ODM_SetBBReg(pDM_Odm, 0x878 , BIT22|BIT21|BIT20, 4);//Reg878[6:4]=3b'100
+ ODM_SetBBReg(pDM_Odm, 0x878 , BIT25|BIT24|BIT23, 5);//Reg878[9:7]=3b'101
+ ODM_SetBBReg(pDM_Odm, 0x878 , BIT28|BIT27|BIT26, 6);//Reg878[12:10]=3b'110
+ ODM_SetBBReg(pDM_Odm, 0x878 , BIT31|BIT30|BIT29, 7);//Reg878[15:13]=3b'111
+ }
+ else //MPchip
+ {
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0);
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1);
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte2, 2);
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte3, 3);
+ ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte0, 4);
+ ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte1, 5);
+ ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte2, 6);
+ ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte3, 7);
+ }
+ }
+
+ //Default Ant Setting when no fast training
+ ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info
+ ODM_SetBBReg(pDM_Odm, 0x864 , BIT5|BIT4|BIT3, 0); //Default RX
+ ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, 1); //Optional RX
+ //ODM_SetBBReg(pDM_Odm, 0x860 , BIT14|BIT13|BIT12, 1); //Default TX
+
+ //Enter Traing state
+ ODM_SetBBReg(pDM_Odm, 0x864 , BIT2|BIT1|BIT0, (AntCombination-1)); //Reg864[2:0]=3'd6 //ant combination=reg864[2:0]+1
+ //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv
+ //ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training
+ //ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 1); //RegE08[16]=1'b1 //enable fast training
+ ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv
+
+ //SW Control
+ //PHY_SetBBReg(Adapter, 0x864 , BIT10, 1);
+ //PHY_SetBBReg(Adapter, 0x870 , BIT9, 1);
+ //PHY_SetBBReg(Adapter, 0x870 , BIT8, 1);
+ //PHY_SetBBReg(Adapter, 0x864 , BIT11, 1);
+ //PHY_SetBBReg(Adapter, 0x860 , BIT9, 0);
+ //PHY_SetBBReg(Adapter, 0x860 , BIT8, 0);
+}
+#endif //#if (RTL8188E_SUPPORT == 1)
+
+
+#if (RTL8192E_SUPPORT == 1)
+VOID
+odm_RX_HWAntDiv_Init_92E(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+
+#if (MP_DRIVER == 1)
+ //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
+ ODM_SetBBReg(pDM_Odm, 0x870 , BIT8, 0);//Reg870[8]=1'b0, // "antsel" is controled by HWs
+ ODM_SetBBReg(pDM_Odm, 0xc50 , BIT8, 1); //Regc50[8]=1'b1 //" CS/CG switching" is controled by HWs
+
+ //Mapping table
+ ODM_SetBBReg(pDM_Odm, 0x914 , 0xFFFF, 0x0100); //antenna mapping table
+
+ //OFDM Settings
+ ODM_SetBBReg(pDM_Odm, 0xca4 , 0x7FF, 0xA0); //thershold
+ ODM_SetBBReg(pDM_Odm, 0xca4 , 0x7FF000, 0x0); //bias
+
+ //CCK Settings
+ ODM_SetBBReg(pDM_Odm, 0xa04 , 0xF000000, 0); //Select which path to receive for CCK_1 & CCK_2
+ ODM_SetBBReg(pDM_Odm, 0xb34 , BIT30, 1); //(92E) ANTSEL_CCK_opt = r_en_antsel_cck? ANTSEL_CCK: 1'b0
+ ODM_SetBBReg(pDM_Odm, 0xa74 , BIT7, 1); //Fix CCK PHY status report issue
+ ODM_SetBBReg(pDM_Odm, 0xa0c , BIT4, 1); //CCK complete HW AntDiv within 64 samples
+}
+
+VOID
+odm_TRX_HWAntDiv_Init_92E(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+
+#if (MP_DRIVER == 1)
+ //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;
+#endif
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8192E AntDiv_Init => AntDivType=[CG_TRX_HW_ANTDIV]\n"));
+
+ //3 --RFE pin setting---------
+ //[MAC]
+ ODM_SetMACReg(pDM_Odm, 0x38, BIT11, 1); //DBG PAD Driving control (GPIO 8)
+ ODM_SetMACReg(pDM_Odm, 0x4c, BIT23, 0); //path-A , RFE_CTRL_3 & RFE_CTRL_4
+ //[BB]
+ ODM_SetBBReg(pDM_Odm, 0x944 , BIT4|BIT3, 0x3); //RFE_buffer
+ ODM_SetBBReg(pDM_Odm, 0x940 , BIT7|BIT6, 0x0); // r_rfe_path_sel_ (RFE_CTRL_3)
+ ODM_SetBBReg(pDM_Odm, 0x940 , BIT9|BIT8, 0x0); // r_rfe_path_sel_ (RFE_CTRL_4)
+ ODM_SetBBReg(pDM_Odm, 0x944 , BIT31, 0); //RFE_buffer
+ ODM_SetBBReg(pDM_Odm, 0x92C , BIT3, 0); //rfe_inv (RFE_CTRL_3)
+ ODM_SetBBReg(pDM_Odm, 0x92C , BIT4, 1); //rfe_inv (RFE_CTRL_4)
+ ODM_SetBBReg(pDM_Odm, 0x930 , 0xFF000, 0x88); //path-A , RFE_CTRL_3 & 4=> ANTSEL[0]
+ //3 -------------------------
+
+ //Pin Settings
+ ODM_SetBBReg(pDM_Odm, 0xC50 , BIT8, 0); //path-A //disable CS/CG switch
+ ODM_SetBBReg(pDM_Odm, 0xC50 , BIT9, 1); //path-A //output at CG only
+ ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0); //path-A //antsel antselb by HW
+ ODM_SetBBReg(pDM_Odm, 0xB38 , BIT10, 0); //path-A //antsel2 by HW
+
+ //Mapping table
+ ODM_SetBBReg(pDM_Odm, 0x914 , 0xFFFF, 0x0100); //antenna mapping table
+
+ //OFDM Settings
+ ODM_SetBBReg(pDM_Odm, 0xca4 , 0x7FF, 0xA0); //thershold
+ ODM_SetBBReg(pDM_Odm, 0xca4 , 0x7FF000, 0x0); //bias
+
+ //CCK Settings
+ ODM_SetBBReg(pDM_Odm, 0xa04 , 0xF000000, 0); //Select which path to receive for CCK_1 & CCK_2
+ ODM_SetBBReg(pDM_Odm, 0xb34 , BIT30, 1); //(92E) ANTSEL_CCK_opt = r_en_antsel_cck? ANTSEL_CCK: 1'b0
+ ODM_SetBBReg(pDM_Odm, 0xa74 , BIT7, 1); //Fix CCK PHY status report issue
+ ODM_SetBBReg(pDM_Odm, 0xa0c , BIT4, 1); //CCK complete HW AntDiv within 64 samples
+
+ //Timming issue
+ ODM_SetBBReg(pDM_Odm, 0xE20 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
+}
+
+VOID
+odm_Smart_HWAntDiv_Init_92E(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8188E AntDiv_Init => AntDivType=[CG_TRX_SMART_ANTDIV]\n"));
+}
+#endif //#if (RTL8192E_SUPPORT == 1)
+
+
+#if (RTL8723B_SUPPORT == 1)
+VOID
+odm_TRX_HWAntDiv_Init_8723B(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8723B AntDiv_Init => AntDivType=[CG_TRX_HW_ANTDIV(DPDT)]\n"));
+
+ //Mapping Table
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0);
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1);
+
+ //OFDM HW AntDiv Parameters
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , 0x7FF, 0xa0); //thershold
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , 0x7FF000, 0x00); //bias
+
+ //CCK HW AntDiv Parameters
+ ODM_SetBBReg(pDM_Odm, 0xA74 , BIT7, 1); //patch for clk from 88M to 80M
+ ODM_SetBBReg(pDM_Odm, 0xA0C , BIT4, 1); //do 64 samples
+
+ //BT Coexistence
+ ODM_SetBBReg(pDM_Odm, 0x864, BIT12, 0); //keep antsel_map when GNT_BT = 1
+ ODM_SetBBReg(pDM_Odm, 0x874 , BIT23, 0); //Disable hw antsw & fast_train.antsw when GNT_BT=1
+
+ //Output Pin Settings
+ ODM_SetBBReg(pDM_Odm, 0x870 , BIT8, 0); //
+
+ ODM_SetBBReg(pDM_Odm, 0x948 , BIT6, 0); //WL_BB_SEL_BTG_TRXG_anta, (1: HW CTRL 0: SW CTRL)
+ ODM_SetBBReg(pDM_Odm, 0x948 , BIT7, 0);
+
+ ODM_SetMACReg(pDM_Odm, 0x40 , BIT3, 1);
+ ODM_SetMACReg(pDM_Odm, 0x38 , BIT11, 1);
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT24|BIT23, 2); //select DPDT_P and DPDT_N as output pin
+
+ ODM_SetBBReg(pDM_Odm, 0x944 , BIT0|BIT1, 3); //in/out
+ ODM_SetBBReg(pDM_Odm, 0x944 , BIT31, 0); //
+
+ ODM_SetBBReg(pDM_Odm, 0x92C , BIT1, 0); //DPDT_P non-inverse
+ ODM_SetBBReg(pDM_Odm, 0x92C , BIT0, 1); //DPDT_N inverse
+
+ ODM_SetBBReg(pDM_Odm, 0x930 , 0xF0, 8); // DPDT_P = ANTSEL[0]
+ ODM_SetBBReg(pDM_Odm, 0x930 , 0xF, 8); // DPDT_N = ANTSEL[0]
+
+ //Timming issue
+ ODM_SetBBReg(pDM_Odm, 0xE20 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
+
+ //2 [--For HW Bug Setting]
+ if(pDM_Odm->AntType == ODM_AUTO_ANT)
+ ODM_SetBBReg(pDM_Odm, 0xA00 , BIT15, 0); //CCK AntDiv function block enable
+
+ //ODM_SetBBReg(pDM_Odm, 0x80C , BIT21, 0); //TX Ant by Reg
+
+
+}
+
+
+
+VOID
+odm_S0S1_SWAntDiv_Init_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;
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8723B AntDiv_Init => AntDivType=[ S0S1_SW_AntDiv] \n"));
+
+ //Mapping Table
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0);
+ ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1);
+
+ //Output Pin Settings
+ //ODM_SetBBReg(pDM_Odm, 0x948 , BIT6, 0x1);
+ ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0);
+
+ pDM_FatTable->bBecomeLinked =FALSE;
+ pDM_SWAT_Table->try_flag = 0xff;
+ pDM_SWAT_Table->Double_chk_flag = 0;
+ pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW;
+
+ //Timming issue
+ ODM_SetBBReg(pDM_Odm, 0xE20 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
+
+ //2 [--For HW Bug Setting]
+ ODM_SetBBReg(pDM_Odm, 0x80C , BIT21, 0); //TX Ant by Reg
+
+}
+#endif //#if (RTL8723B_SUPPORT == 1)
+
+
+#if (RTL8821A_SUPPORT == 1)
+VOID
+odm_TRX_HWAntDiv_Init_8821A(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+
+ PADAPTER pAdapter = pDM_Odm->Adapter;
+ pAdapter->HalFunc.GetHalDefVarHandler(pAdapter, HAL_DEF_5G_ANT_SELECT, (pu1Byte)(&pDM_Odm->AntType));
+#else
+ pDM_Odm->AntType = ODM_AUTO_ANT;
+#endif
+ pAdapter->HalFunc.GetHalDefVarHandler(pAdapter, HAL_DEF_5G_ANT_SELECT, (pu1Byte)(&pDM_Odm->AntType));
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821A AntDiv_Init => AntDivType=[ CG_TRX_HW_ANTDIV (DPDT)] \n"));
+
+ //Output Pin Settings
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT25, 0);
+
+ ODM_SetMACReg(pDM_Odm, 0x64 , BIT29, 1); //PAPE by WLAN control
+ ODM_SetMACReg(pDM_Odm, 0x64 , BIT28, 1); //LNAON by WLAN control
+
+ ODM_SetBBReg(pDM_Odm, 0xCB0 , bMaskDWord, 0x77775745);
+ ODM_SetBBReg(pDM_Odm, 0xCB8 , BIT16, 0);
+
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT23, 0); //select DPDT_P and DPDT_N as output pin
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT24, 1); //by WLAN control
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , 0xF, 8); // DPDT_P = ANTSEL[0]
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , 0xF0, 8); // DPDT_N = ANTSEL[0]
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT29, 0); //DPDT_P non-inverse
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT28, 1); //DPDT_N inverse
+
+ //Mapping Table
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte0, 0);
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte1, 1);
+
+ //Set ANT1_8821A as MAIN_ANT
+ if((pDM_Odm->AntType == ODM_FIX_MAIN_ANT) || (pDM_Odm->AntType == ODM_AUTO_ANT))
+ ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
+ else
+ ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
+
+ //OFDM HW AntDiv Parameters
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF, 0xA0); //thershold
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF000, 0x10); //bias
+
+ //CCK HW AntDiv Parameters
+ 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
+
+ //BT Coexistence
+ ODM_SetBBReg(pDM_Odm, 0xCAC , BIT9, 1); //keep antsel_map when GNT_BT = 1
+ ODM_SetBBReg(pDM_Odm, 0x804 , BIT4, 1); //Disable hw antsw & fast_train.antsw when GNT_BT=1
+
+ //Timming issue
+ ODM_SetBBReg(pDM_Odm, 0x818 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
+ ODM_SetBBReg(pDM_Odm, 0x8CC , BIT20|BIT19|BIT18, 3); //settling time of antdiv by RF LNA = 100ns
+
+ //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
+
+}
+
+VOID
+odm_S0S1_SWAntDiv_Init_8821A(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+
+
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+
+ PADAPTER pAdapter = pDM_Odm->Adapter;
+ pAdapter->HalFunc.GetHalDefVarHandler(pAdapter, HAL_DEF_5G_ANT_SELECT, (pu1Byte)(&pDM_Odm->AntType));
+#else
+ pDM_Odm->AntType = ODM_AUTO_ANT;
+#endif
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821A AntDiv_Init => AntDivType=[ S0S1_SW_AntDiv] \n"));
+
+ //Output Pin Settings
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT25, 0);
+
+ ODM_SetMACReg(pDM_Odm, 0x64 , BIT29, 1); //PAPE by WLAN control
+ ODM_SetMACReg(pDM_Odm, 0x64 , BIT28, 1); //LNAON by WLAN control
+
+ ODM_SetBBReg(pDM_Odm, 0xCB0 , bMaskDWord, 0x77775745);
+ ODM_SetBBReg(pDM_Odm, 0xCB8 , BIT16, 0);
+
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT23, 0); //select DPDT_P and DPDT_N as output pin
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT24, 1); //by WLAN control
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , 0xF, 8); // DPDT_P = ANTSEL[0]
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , 0xF0, 8); // DPDT_N = ANTSEL[0]
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT29, 0); //DPDT_P non-inverse
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT28, 1); //DPDT_N inverse
+
+ //Mapping Table
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte0, 0);
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte1, 1);
+
+ //Set ANT1_8821A as MAIN_ANT
+ if((pDM_Odm->AntType == ODM_FIX_MAIN_ANT) || (pDM_Odm->AntType == ODM_AUTO_ANT))
+ ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
+ else
+ ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
+
+ //OFDM HW AntDiv Parameters
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF, 0xA0); //thershold
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF000, 0x10); //bias
+
+ //CCK HW AntDiv Parameters
+ 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
+
+ //BT Coexistence
+ ODM_SetBBReg(pDM_Odm, 0xCAC , BIT9, 1); //keep antsel_map when GNT_BT = 1
+ ODM_SetBBReg(pDM_Odm, 0x804 , BIT4, 1); //Disable hw antsw & fast_train.antsw when GNT_BT=1
+
+ //Timming issue
+ ODM_SetBBReg(pDM_Odm, 0x818 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
+ ODM_SetBBReg(pDM_Odm, 0x8CC , BIT20|BIT19|BIT18, 3); //settling time of antdiv by RF LNA = 100ns
+
+ //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);
+
+ pDM_SWAT_Table->try_flag = 0xff;
+ pDM_SWAT_Table->Double_chk_flag = 0;
+ pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW;
+ pDM_SWAT_Table->CurAntenna = MAIN_ANT;
+ pDM_SWAT_Table->PreAntenna = MAIN_ANT;
+ pDM_SWAT_Table->SWAS_NoLink_State = 0;
+
+}
+#endif //#if (RTL8821A_SUPPORT == 1)
+
+#if (RTL8881A_SUPPORT == 1)
+VOID
+odm_RX_HWAntDiv_Init_8881A(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8881A AntDiv_Init => AntDivType=[ CGCS_RX_HW_ANTDIV] \n"));
+
+}
+
+VOID
+odm_TRX_HWAntDiv_Init_8881A(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8881A AntDiv_Init => AntDivType=[ CG_TRX_HW_ANTDIV (SPDT)] \n"));
+
+ //Output Pin Settings
+ // [SPDT related]
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT25, 0);
+ ODM_SetMACReg(pDM_Odm, 0x4C , BIT26, 0);
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT31, 0); //delay buffer
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT22, 0);
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT24, 1);
+ ODM_SetBBReg(pDM_Odm, 0xCB0 , 0xF00, 8); // DPDT_P = ANTSEL[0]
+ ODM_SetBBReg(pDM_Odm, 0xCB0 , 0xF0000, 8); // DPDT_N = ANTSEL[0]
+
+ //Mapping Table
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte0, 0);
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte1, 1);
+
+ //OFDM HW AntDiv Parameters
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF, 0xA0); //thershold
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF000, 0x0); //bias
+ ODM_SetBBReg(pDM_Odm, 0x8CC , BIT20|BIT19|BIT18, 3); //settling time of antdiv by RF LNA = 100ns
+
+ //CCK HW AntDiv Parameters
+ ODM_SetBBReg(pDM_Odm, 0xA74 , BIT7, 1); //patch for clk from 88M to 80M
+ ODM_SetBBReg(pDM_Odm, 0xA0C , BIT4, 1); //do 64 samples
+
+ //Timming issue
+ ODM_SetBBReg(pDM_Odm, 0x818 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
+
+ //2 [--For HW Bug Setting]
+
+ ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0); //TX Ant by Reg // A-cut bug
+}
+
+#endif //#if (RTL8881A_SUPPORT == 1)
+
+
+#if (RTL8812A_SUPPORT == 1)
+VOID
+odm_TRX_HWAntDiv_Init_8812A(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8812A AntDiv_Init => AntDivType=[ CG_TRX_HW_ANTDIV (SPDT)] \n"));
+
+ //3 //3 --RFE pin setting---------
+ //[BB]
+ ODM_SetBBReg(pDM_Odm, 0x900 , BIT10|BIT9|BIT8, 0x0); //disable SW switch
+ ODM_SetBBReg(pDM_Odm, 0x900 , BIT17|BIT16, 0x0);
+ ODM_SetBBReg(pDM_Odm, 0x974 , BIT7|BIT6, 0x3); // in/out
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT31, 0); //delay buffer
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT26, 0);
+ ODM_SetBBReg(pDM_Odm, 0xCB4 , BIT27, 1);
+ ODM_SetBBReg(pDM_Odm, 0xCB0 , 0xF000000, 8); // DPDT_P = ANTSEL[0]
+ ODM_SetBBReg(pDM_Odm, 0xCB0 , 0xF0000000, 8); // DPDT_N = ANTSEL[0]
+ //3 -------------------------
+
+ //Mapping Table
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte0, 0);
+ ODM_SetBBReg(pDM_Odm, 0xCA4 , bMaskByte1, 1);
+
+ //OFDM HW AntDiv Parameters
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF, 0xA0); //thershold
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , 0x7FF000, 0x0); //bias
+ ODM_SetBBReg(pDM_Odm, 0x8CC , BIT20|BIT19|BIT18, 3); //settling time of antdiv by RF LNA = 100ns
+
+ //CCK HW AntDiv Parameters
+ ODM_SetBBReg(pDM_Odm, 0xA74 , BIT7, 1); //patch for clk from 88M to 80M
+ ODM_SetBBReg(pDM_Odm, 0xA0C , BIT4, 1); //do 64 samples
+
+ //Timming issue
+ ODM_SetBBReg(pDM_Odm, 0x818 , BIT23|BIT22|BIT21|BIT20, 8); //keep antidx after tx for ACK ( unit x 32 mu sec)
+
+ //2 [--For HW Bug Setting]
+
+ ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0); //TX Ant by Reg // A-cut bug
+
+}
+
+#endif //#if (RTL8812A_SUPPORT == 1)
+
+VOID
+odm_HW_AntDiv(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ u4Byte i,MinMaxRSSI=0xFF, AntDivMaxRSSI=0, MaxRSSI=0, LocalMaxRSSI;
+ u4Byte Main_RSSI, Aux_RSSI, pkt_ratio_m=0, pkt_ratio_a=0,pkt_threshold=10;
+ u1Byte RxIdleAnt=0, TargetAnt=7;
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable;
+ PSTA_INFO_T pEntry;
+
+ if(!pDM_Odm->bLinked) //bLinked==False
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[No Link!!!]\n"));
+
+ #if(DM_ODM_SUPPORT_TYPE == ODM_AP)
+ if (pDM_Odm->antdiv_rssi)
+ panic_printk("[No Link!!!]\n");
+ #endif
+
+ if(pDM_FatTable->bBecomeLinked == TRUE)
+ {
+ odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
+ ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
+
+ pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
+ }
+ return;
+ }
+ else
+ {
+ if(pDM_FatTable->bBecomeLinked ==FALSE)
+ {
+ 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(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
+
+ pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
+
+ if(pDM_Odm->SupportICType==ODM_RTL8723B && pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
+ {
+ ODM_SetBBReg(pDM_Odm, 0x930 , 0xF0, 8); // DPDT_P = ANTSEL[0] // for 8723B AntDiv function patch. BB Dino 130412
+ ODM_SetBBReg(pDM_Odm, 0x930 , 0xF, 8); // DPDT_N = ANTSEL[0]
+ }
+ }
+ }
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("\n[HW AntDiv] Start =>\n"));
+
+ for (i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
+ {
+ pEntry = pDM_Odm->pODM_StaInfo[i];
+ if(IS_STA_VALID(pEntry))
+ {
+ //2 Caculate RSSI per Antenna
+ Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0;
+ Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0;
+ TargetAnt = (Main_RSSI==Aux_RSSI)?pDM_FatTable->RxIdleAnt:((Main_RSSI>=Aux_RSSI)?MAIN_ANT:AUX_ANT);
+ /*
+ if( pDM_FatTable->MainAnt_Cnt[i]!=0 && pDM_FatTable->AuxAnt_Cnt[i]!=0 )
+ {
+ pkt_ratio_m=( pDM_FatTable->MainAnt_Cnt[i] / pDM_FatTable->AuxAnt_Cnt[i] );
+ pkt_ratio_a=( pDM_FatTable->AuxAnt_Cnt[i] / pDM_FatTable->MainAnt_Cnt[i] );
+
+ if (pkt_ratio_m >= pkt_threshold)
+ TargetAnt=MAIN_ANT;
+
+ else if(pkt_ratio_a >= pkt_threshold)
+ 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,("*** 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)));
+ #if(DM_ODM_SUPPORT_TYPE == ODM_AP)
+ if (pDM_Odm->antdiv_rssi)
+ {
+ panic_printk("*** SupportICType=[%lu] \n",pDM_Odm->SupportICType);
+ //panic_printk("*** 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));
+ //panic_printk("*** Phy_AntSel_B=[ %d, %d, %d] \n",((pDM_Odm->DM_FatTable.antsel_rx_keep_1)&BIT2)>>2,
+ // ((pDM_Odm->DM_FatTable.antsel_rx_keep_1)&BIT1) >>1, ((pDM_Odm->DM_FatTable.antsel_rx_keep_1)&BIT0))
+ panic_printk("*** Client[ %lu ] , Main_Cnt = (( %lu )) , Main_RSSI= (( %lu )) \n",i, pDM_FatTable->MainAnt_Cnt[i], Main_RSSI);
+ panic_printk("*** Client[ %lu ] , Aux_Cnt = (( %lu )) , Aux_RSSI = (( %lu )) \n" ,i, pDM_FatTable->AuxAnt_Cnt[i] , Aux_RSSI);
+ }
+ #endif
+
+
+ LocalMaxRSSI = (Main_RSSI>Aux_RSSI)?Main_RSSI:Aux_RSSI;
+ //2 Select MaxRSSI for DIG
+ if((LocalMaxRSSI > AntDivMaxRSSI) && (LocalMaxRSSI < 40))
+ AntDivMaxRSSI = LocalMaxRSSI;
+ if(LocalMaxRSSI > MaxRSSI)
+ MaxRSSI = LocalMaxRSSI;
+
+ //2 Select RX Idle Antenna
+ if ( (LocalMaxRSSI != 0) && (LocalMaxRSSI < MinMaxRSSI) )
+ {
+ RxIdleAnt = TargetAnt;
+ MinMaxRSSI = LocalMaxRSSI;
+ }
+ /*
+ if((pDM_FatTable->RxIdleAnt == MAIN_ANT) && (Main_RSSI == 0))
+ Main_RSSI = Aux_RSSI;
+ else if((pDM_FatTable->RxIdleAnt == AUX_ANT) && (Aux_RSSI == 0))
+ Aux_RSSI = Main_RSSI;
+
+ LocalMinRSSI = (Main_RSSI>Aux_RSSI)?Aux_RSSI:Main_RSSI;
+ if(LocalMinRSSI < MinRSSI)
+ {
+ MinRSSI = LocalMinRSSI;
+ RxIdleAnt = TargetAnt;
+ }
+ */
+ //2 Select TX Antenna
+
+ #if TX_BY_REG
+
+ #else
+ if(pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV)
+ odm_UpdateTxAnt(pDM_Odm, TargetAnt, i);
+ #endif
+
+ }
+ pDM_FatTable->MainAnt_Sum[i] = 0;
+ pDM_FatTable->AuxAnt_Sum[i] = 0;
+ pDM_FatTable->MainAnt_Cnt[i] = 0;
+ pDM_FatTable->AuxAnt_Cnt[i] = 0;
+ }
+
+ //2 Set RX Idle Antenna
+ ODM_UpdateRxIdleAnt(pDM_Odm, RxIdleAnt);
+
+ #if(DM_ODM_SUPPORT_TYPE == ODM_AP)
+ if (pDM_Odm->antdiv_rssi)
+ panic_printk("*** RxIdleAnt = (( %s )) \n \n", ( RxIdleAnt ==MAIN_ANT)?"MAIN_ANT":"AUX_ANT");
+ #endif
+
+ pDM_DigTable->AntDiv_RSSI_max = AntDivMaxRSSI;
+ pDM_DigTable->RSSI_max = MaxRSSI;
+}
+
+
+
+#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1)
+VOID
+odm_S0S1_SwAntDiv(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte Step
+ )
+{
+ 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;
+ pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+ PSTA_INFO_T pEntry=NULL;
+ //static u1Byte reset_idx;
+ u4Byte value32;
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ u8Byte curTxOkCnt=0, curRxOkCnt=0,TxCntOffset, RxCntOffset;
+
+ if(!pDM_Odm->bLinked) //bLinked==False
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[No Link!!!]\n"));
+ if(pDM_FatTable->bBecomeLinked == TRUE)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Set REG 948[9:6]=0x0 \n"));
+ if(pDM_Odm->SupportICType == ODM_RTL8723B)
+ ODM_SetBBReg(pDM_Odm, 0x948 , BIT9|BIT8|BIT7|BIT6, 0x0);
+
+ pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
+ }
+ return;
+ }
+ else
+ {
+ if(pDM_FatTable->bBecomeLinked ==FALSE)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Linked !!!]\n"));
+
+ if(pDM_Odm->SupportICType == ODM_RTL8723B)
+ {
+ value32 = ODM_GetBBReg(pDM_Odm, 0x864, BIT5|BIT4|BIT3);
+
+ if (value32==0x0)
+ ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
+ else if (value32==0x1)
+ ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
+
+ 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 ));
+ }
+
+ pDM_SWAT_Table->lastTxOkCnt = 0;
+ pDM_SWAT_Table->lastRxOkCnt =0;
+ TxCntOffset = Adapter->TxStats.NumTxBytesUnicast;
+ RxCntOffset = Adapter->RxStats.NumRxBytesUnicast;
+
+ pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
+ }
+ else
+ {
+ TxCntOffset = 0;
+ RxCntOffset = 0;
+ }
+ }
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[%d] { try_flag=(( %d )), Step=(( %d )), Double_chk_flag = (( %d )) }\n",
+ __LINE__,pDM_SWAT_Table->try_flag,Step,pDM_SWAT_Table->Double_chk_flag));
+
+ // 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_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Step != try_flag] Need to Reset After Link\n"));
+ ODM_SwAntDivRestAfterLink(pDM_Odm);
+ }
+
+ if(pDM_SWAT_Table->try_flag == 0xff)
+ {
+ pDM_SWAT_Table->try_flag = 0;
+ pDM_SWAT_Table->Train_time_flag=0;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("[set try_flag = 0] Prepare for peak!\n\n"));
+ return;
+ }
+ else//if( try_flag != 0xff )
+ {
+ //1 Normal State (Begin Trying)
+ if(pDM_SWAT_Table->try_flag == 0)
+ {
+
+ //---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;
+
+ if (curTxOkCnt > 1875000 || curRxOkCnt > 1875000)//if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) ( 1.875M * 8bit ) / 2= 7.5M bits /sec )
+ {
+ pDM_SWAT_Table->TrafficLoad = TRAFFIC_HIGH;
+ Train_time_temp=pDM_SWAT_Table->Train_time ;
+
+ if(pDM_SWAT_Table->Train_time_flag==3)
+ {
+ HighTraffic_TrainTime_L=0xa;
+
+ if(Train_time_temp<=16)
+ Train_time_temp=HighTraffic_TrainTime_L;
+ else
+ Train_time_temp-=16;
+
+ }
+ else if(pDM_SWAT_Table->Train_time_flag==2)
+ {
+ Train_time_temp-=8;
+ HighTraffic_TrainTime_L=0xf;
+ }
+ else if(pDM_SWAT_Table->Train_time_flag==1)
+ {
+ Train_time_temp-=4;
+ HighTraffic_TrainTime_L=0x1e;
+ }
+ else if(pDM_SWAT_Table->Train_time_flag==0)
+ {
+ Train_time_temp+=8;
+ HighTraffic_TrainTime_L=0x28;
+ }
+
+
+ //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Train_time_temp = ((%d))\n",Train_time_temp));
+
+ //--
+ if(Train_time_temp > HighTraffic_TrainTime_U)
+ Train_time_temp=HighTraffic_TrainTime_U;
+
+ else if(Train_time_temp < HighTraffic_TrainTime_L)
+ Train_time_temp=HighTraffic_TrainTime_L;
+
+ pDM_SWAT_Table->Train_time = Train_time_temp; //50ms~10ms
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" Train_time_flag=((%d)) , Train_time=((%d)) \n",pDM_SWAT_Table->Train_time_flag, pDM_SWAT_Table->Train_time));
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" [HIGH Traffic] \n" ));
+ }
+ else if (curTxOkCnt > 125000 || curRxOkCnt > 125000) // ( 0.125M * 8bit ) / 2 = 0.5M bits /sec )
+ {
+ pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW;
+ Train_time_temp=pDM_SWAT_Table->Train_time ;
+
+ if(pDM_SWAT_Table->Train_time_flag==3)
+ {
+ LowTraffic_TrainTime_L=10;
+ if(Train_time_temp<50)
+ Train_time_temp=LowTraffic_TrainTime_L;
+ else
+ Train_time_temp-=50;
+ }
+ else if(pDM_SWAT_Table->Train_time_flag==2)
+ {
+ Train_time_temp-=30;
+ LowTraffic_TrainTime_L=36;
+ }
+ else if(pDM_SWAT_Table->Train_time_flag==1)
+ {
+ Train_time_temp-=10;
+ LowTraffic_TrainTime_L=40;
+ }
+ else
+ Train_time_temp+=10;
+
+ //--
+ if(Train_time_temp >= LowTraffic_TrainTime_U)
+ Train_time_temp=LowTraffic_TrainTime_U;
+
+ else if(Train_time_temp <= LowTraffic_TrainTime_L)
+ Train_time_temp=LowTraffic_TrainTime_L;
+
+ pDM_SWAT_Table->Train_time = Train_time_temp; //50ms~20ms
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" Train_time_flag=((%d)) , Train_time=((%d)) \n",pDM_SWAT_Table->Train_time_flag, pDM_SWAT_Table->Train_time));
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" [Low Traffic] \n" ));
+ }
+ else
+ {
+ pDM_SWAT_Table->TrafficLoad = TRAFFIC_UltraLOW;
+ pDM_SWAT_Table->Train_time = 0xc8; //200ms
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" [Ultra-Low Traffic] \n" ));
+ }
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TxOkCnt=(( %llu )), RxOkCnt=(( %llu )) \n",
+ curTxOkCnt ,curRxOkCnt ));
+
+ //-----------------
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" Current MinMaxRSSI is ((%d)) \n",pDM_FatTable->MinMaxRSSI));
+
+ //---reset index---
+ if(pDM_SWAT_Table->reset_idx>=reset_period)
+ {
+ pDM_FatTable->MinMaxRSSI=0; //
+ pDM_SWAT_Table->reset_idx=0;
+ }
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("reset_idx = (( %d )) \n",pDM_SWAT_Table->reset_idx ));
+ //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("reset_idx=%d\n",pDM_SWAT_Table->reset_idx));
+ pDM_SWAT_Table->reset_idx++;
+
+ //---double check flag---
+ if(pDM_FatTable->MinMaxRSSI > SWAntDiv_threshold && pDM_SWAT_Table->Double_chk_flag== 0)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" MinMaxRSSI is ((%d)), and > %d \n",
+ pDM_FatTable->MinMaxRSSI,SWAntDiv_threshold));
+
+ pDM_SWAT_Table->Double_chk_flag =1;
+ pDM_SWAT_Table->try_flag = 1;
+ pDM_SWAT_Table->RSSI_Trying = 0;
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" Test the current Ant for (( %d )) ms again \n", pDM_SWAT_Table->Train_time));
+ ODM_UpdateRxIdleAnt(pDM_Odm, pDM_FatTable->RxIdleAnt);
+ ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer_8723B, pDM_SWAT_Table->Train_time ); //ms
+ return;
+ }
+
+ nextAnt = (pDM_FatTable->RxIdleAnt == MAIN_ANT)? AUX_ANT : MAIN_ANT;
+
+ pDM_SWAT_Table->try_flag = 1;
+
+ if(pDM_SWAT_Table->reset_idx<=1)
+ pDM_SWAT_Table->RSSI_Trying = 2;
+ else
+ pDM_SWAT_Table->RSSI_Trying = 1;
+
+ 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)
+ {
+ nextAnt = (pDM_FatTable->RxIdleAnt == MAIN_ANT)? AUX_ANT : MAIN_ANT;
+ pDM_SWAT_Table->RSSI_Trying--;
+ }
+
+ //1 Decision State
+ if((pDM_SWAT_Table->try_flag == 1)&&(pDM_SWAT_Table->RSSI_Trying == 0) )
+ {
+
+ for (i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
+ {
+ pEntry = pDM_Odm->pODM_StaInfo[i];
+ if(IS_STA_VALID(pEntry))
+ {
+ //2 Caculate RSSI per Antenna
+ Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0;
+ Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0;
+
+ if(pDM_FatTable->MainAnt_Cnt[i]<=1 && pDM_FatTable->CCK_counter_main>=1)
+ Main_RSSI=0;
+
+ if(pDM_FatTable->AuxAnt_Cnt[i]<=1 && pDM_FatTable->CCK_counter_aux>=1)
+ Aux_RSSI=0;
+
+ TargetAnt = (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;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** CCK_counter_main = (( %d )) , CCK_counter_aux= (( %d )) \n", pDM_FatTable->CCK_counter_main, pDM_FatTable->CCK_counter_aux));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** OFDM_counter_main = (( %d )) , OFDM_counter_aux= (( %d )) \n", pDM_FatTable->OFDM_counter_main, pDM_FatTable->OFDM_counter_aux));
+ 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"));
+
+ //2 Select RX Idle Antenna
+
+ if (LocalMaxRSSI != 0 && LocalMaxRSSI < MinMaxRSSI)
+ {
+ RxIdleAnt = TargetAnt;
+ MinMaxRSSI = LocalMaxRSSI;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** LocalMaxRSSI-LocalMinRSSI = ((%d))\n",(LocalMaxRSSI-LocalMinRSSI)));
+
+ if((LocalMaxRSSI-LocalMinRSSI)>8)
+ {
+ if(LocalMinRSSI != 0)
+ pDM_SWAT_Table->Train_time_flag=3;
+ else
+ {
+ if(MinMaxRSSI > SWAntDiv_threshold)
+ pDM_SWAT_Table->Train_time_flag=0;
+ else
+ 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;
+
+ }
+
+ //2 Select TX Antenna
+ if(TargetAnt == MAIN_ANT)
+ pDM_FatTable->antsel_a[i] = ANT1_2G;
+ else
+ pDM_FatTable->antsel_a[i] = ANT2_2G;
+
+ }
+ pDM_FatTable->MainAnt_Sum[i] = 0;
+ pDM_FatTable->AuxAnt_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;
+
+ }
+
+
+ pDM_FatTable->MinMaxRSSI=MinMaxRSSI;
+ pDM_SWAT_Table->try_flag = 0;
+
+ if( pDM_SWAT_Table->Double_chk_flag==1)
+ {
+ pDM_SWAT_Table->Double_chk_flag=0;
+ if(pDM_FatTable->MinMaxRSSI > SWAntDiv_threshold)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" [Double check] MinMaxRSSI ((%d)) > %d again!! \n",
+ pDM_FatTable->MinMaxRSSI,SWAntDiv_threshold));
+
+ 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"));
+ return;
+ }
+ else
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,(" [Double check] MinMaxRSSI ((%d)) <= %d !! \n",
+ pDM_FatTable->MinMaxRSSI,SWAntDiv_threshold));
+
+ nextAnt = (pDM_FatTable->RxIdleAnt == MAIN_ANT)? AUX_ANT : MAIN_ANT;
+ pDM_SWAT_Table->try_flag = 0;
+ pDM_SWAT_Table->reset_idx=reset_period;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("[set try_flag=0] Normal State: Need to tryg again!! \n\n\n"));
+ return;
+ }
+ }
+ else
+ {
+ 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"));
+ return;
+ }
+
+ }
+
+ }
+
+ //1 4.Change TRX antenna
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RSSI_Trying = (( %d )), Ant: (( %s )) >>> (( %s )) \n",
+ pDM_SWAT_Table->RSSI_Trying, (pDM_FatTable->RxIdleAnt == MAIN_ANT?"MAIN":"AUX"),(nextAnt == MAIN_ANT?"MAIN":"AUX")));
+
+ ODM_UpdateRxIdleAnt(pDM_Odm, nextAnt);
+
+ //1 5.Reset Statistics
+
+ pDM_FatTable->RxIdleAnt = nextAnt;
+
+ //1 6.Set next timer (Trying State)
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" Test ((%s)) Ant for (( %d )) ms \n", (nextAnt == MAIN_ANT?"MAIN":"AUX"), pDM_SWAT_Table->Train_time));
+ ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer_8723B, pDM_SWAT_Table->Train_time ); //ms
+}
+
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+VOID
+ODM_SW_AntDiv_Callback(
+ 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_8723B);
+ #else
+ {
+ //DbgPrint("SW_antdiv_Callback");
+ odm_S0S1_SwAntDiv(&pHalData->DM_OutSrc, SWAW_STEP_DETERMINE);
+ }
+ #endif
+ #else
+ ODM_ScheduleWorkItem(&pDM_SWAT_Table->SwAntennaSwitchWorkitem_8723B);
+ #endif
+}
+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->DM_OutSrc, SWAW_STEP_DETERMINE);
+}
+#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+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);
+}
+#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+
+#endif //#if (RTL8723B_SUPPORT == 1)
+
+
+#if(RTL8188E_SUPPORT == 1 || RTL8192E_SUPPORT == 1)
+#if (!(DM_ODM_SUPPORT_TYPE == ODM_CE))
+VOID
+odm_SetNextMACAddrTarget(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+ PSTA_INFO_T pEntry;
+ //u1Byte Bssid[6];
+ u4Byte value32, i;
+
+ //
+ //2012.03.26 LukeLee: The MAC address is changed according to MACID in turn
+ //
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SetNextMACAddrTarget() ==>\n"));
+ if(pDM_Odm->bLinked)
+ {
+ for (i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
+ {
+ if((pDM_FatTable->TrainIdx+1) == ODM_ASSOCIATE_ENTRY_NUM)
+ pDM_FatTable->TrainIdx = 0;
+ else
+ pDM_FatTable->TrainIdx++;
+
+ pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx];
+ if(IS_STA_VALID(pEntry))
+ {
+ //Match MAC ADDR
+#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ value32 = (pEntry->hwaddr[5]<<8)|pEntry->hwaddr[4];
+#else
+ value32 = (pEntry->MacAddr[5]<<8)|pEntry->MacAddr[4];
+#endif
+ ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, value32);
+#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ value32 = (pEntry->hwaddr[3]<<24)|(pEntry->hwaddr[2]<<16) |(pEntry->hwaddr[1]<<8) |pEntry->hwaddr[0];
+#else
+ value32 = (pEntry->MacAddr[3]<<24)|(pEntry->MacAddr[2]<<16) |(pEntry->MacAddr[1]<<8) |pEntry->MacAddr[0];
+#endif
+ ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, value32);
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_FatTable->TrainIdx=%lu\n",pDM_FatTable->TrainIdx));
+#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC Addr = %x:%x:%x:%x:%x:%x\n",
+ pEntry->hwaddr[5],pEntry->hwaddr[4],pEntry->hwaddr[3],pEntry->hwaddr[2],pEntry->hwaddr[1],pEntry->hwaddr[0]));
+#else
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC Addr = %x:%x:%x:%x:%x:%x\n",
+ pEntry->MacAddr[5],pEntry->MacAddr[4],pEntry->MacAddr[3],pEntry->MacAddr[2],pEntry->MacAddr[1],pEntry->MacAddr[0]));
+#endif
+
+ break;
+ }
+ }
+
+ }
+
+#if 0
+ //
+ //2012.03.26 LukeLee: This should be removed later, the MAC address is changed according to MACID in turn
+ //
+ #if( DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ {
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
+
+ for (i=0; i<6; i++)
+ {
+ Bssid[i] = pMgntInfo->Bssid[i];
+ //DbgPrint("Bssid[%d]=%x\n", i, Bssid[i]);
+ }
+ }
+ #endif
+
+ //odm_SetNextMACAddrTarget(pDM_Odm);
+
+ //1 Select MAC Address Filter
+ for (i=0; i<6; i++)
+ {
+ if(Bssid[i] != pDM_FatTable->Bssid[i])
+ {
+ bMatchBSSID = FALSE;
+ break;
+ }
+ }
+ if(bMatchBSSID == FALSE)
+ {
+ //Match MAC ADDR
+ value32 = (Bssid[5]<<8)|Bssid[4];
+ ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, value32);
+ value32 = (Bssid[3]<<24)|(Bssid[2]<<16) |(Bssid[1]<<8) |Bssid[0];
+ ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, value32);
+ }
+
+ return bMatchBSSID;
+#endif
+
+}
+
+VOID
+odm_FastAntTraining(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ u4Byte i, MaxRSSI=0;
+ u1Byte TargetAnt=2;
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+ BOOLEAN bPktFilterMacth = FALSE;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("==>odm_FastAntTraining()\n"));
+
+ //1 TRAINING STATE
+ if(pDM_FatTable->FAT_State == FAT_TRAINING_STATE)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Enter FAT_TRAINING_STATE\n"));
+ //2 Caculate RSSI per Antenna
+ for (i=0; i<7; i++)
+ {
+ if(pDM_FatTable->antRSSIcnt[i] == 0)
+ pDM_FatTable->antAveRSSI[i] = 0;
+ else
+ {
+ pDM_FatTable->antAveRSSI[i] = pDM_FatTable->antSumRSSI[i] /pDM_FatTable->antRSSIcnt[i];
+ bPktFilterMacth = TRUE;
+ }
+ if(pDM_FatTable->antAveRSSI[i] > MaxRSSI)
+ {
+ MaxRSSI = pDM_FatTable->antAveRSSI[i];
+ TargetAnt = (u1Byte) i;
+ }
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_FatTable->antAveRSSI[%lu] = %lu, pDM_FatTable->antRSSIcnt[%lu] = %lu\n",
+ i, pDM_FatTable->antAveRSSI[i], i, pDM_FatTable->antRSSIcnt[i]));
+ }
+
+ //2 Select TRX Antenna
+ if(bPktFilterMacth == FALSE)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("None Packet is matched\n"));
+
+ ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training
+ ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv
+ }
+ else
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TargetAnt=%d, MaxRSSI=%lu\n",TargetAnt,MaxRSSI));
+
+ ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training
+ //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv
+ ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, TargetAnt); //Default RX is Omni, Optional RX is the best decision by FAT
+ //ODM_SetBBReg(pDM_Odm, 0x860 , BIT14|BIT13|BIT12, TargetAnt); //Default TX
+ ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info
+
+#if 0
+ pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx];
+
+ if(IS_STA_VALID(pEntry))
+ {
+ pEntry->antsel_a = TargetAnt&BIT0;
+ pEntry->antsel_b = (TargetAnt&BIT1)>>1;
+ pEntry->antsel_c = (TargetAnt&BIT2)>>2;
+ }
+#else
+ pDM_FatTable->antsel_a[pDM_FatTable->TrainIdx] = TargetAnt&BIT0;
+ pDM_FatTable->antsel_b[pDM_FatTable->TrainIdx] = (TargetAnt&BIT1)>>1;
+ pDM_FatTable->antsel_c[pDM_FatTable->TrainIdx] = (TargetAnt&BIT2)>>2;
+#endif
+
+
+ if(TargetAnt == 0)
+ ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv
+
+ }
+
+ //2 Reset Counter
+ for(i=0; i<7; i++)
+ {
+ pDM_FatTable->antSumRSSI[i] = 0;
+ pDM_FatTable->antRSSIcnt[i] = 0;
+ }
+
+ pDM_FatTable->FAT_State = FAT_NORMAL_STATE;
+ return;
+ }
+
+ //1 NORMAL STATE
+ if(pDM_FatTable->FAT_State == FAT_NORMAL_STATE)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Enter FAT_NORMAL_STATE\n"));
+
+ odm_SetNextMACAddrTarget(pDM_Odm);
+
+#if 0
+ pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx];
+ if(IS_STA_VALID(pEntry))
+ {
+ pEntry->antsel_a = TargetAnt&BIT0;
+ pEntry->antsel_b = (TargetAnt&BIT1)>>1;
+ pEntry->antsel_c = (TargetAnt&BIT2)>>2;
+ }
+#endif
+
+ //2 Prepare Training
+ pDM_FatTable->FAT_State = FAT_TRAINING_STATE;
+ ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 1); //RegE08[16]=1'b1 //enable fast training
+ ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Start FAT_TRAINING_STATE\n"));
+ ODM_SetTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer, 500 ); //ms
+
+ }
+
+}
+
+VOID
+odm_FastAntTrainingCallback(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ PADAPTER padapter = pDM_Odm->Adapter;
+ if(padapter->net_closed == _TRUE)
+ return;
+ //if(*pDM_Odm->pbNet_closed == TRUE)
+ // return;
+#endif
+
+#if USE_WORKITEM
+ ODM_ScheduleWorkItem(&pDM_Odm->FastAntTrainingWorkitem);
+#else
+ odm_FastAntTraining(pDM_Odm);
+#endif
+}
+
+VOID
+odm_FastAntTrainingWorkItemCallback(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ odm_FastAntTraining(pDM_Odm);
+}
+#endif
+
+#endif
+
+
+VOID
+ODM_AntDivInit(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+ pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
+
+
+ if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] Not Support Antenna Diversity Function\n"));
+ return;
+ }
+ //---
+#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+ if(pDM_FatTable->AntDiv_2G_5G == ODM_ANTDIV_2G)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[2G AntDiv Init]: Only Support 2G Antenna Diversity Function\n"));
+ if(!(pDM_Odm->SupportICType & ODM_ANTDIV_2G_SUPPORT_IC))
+ return;
+ }
+ else if(pDM_FatTable->AntDiv_2G_5G == ODM_ANTDIV_5G)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[5G AntDiv Init]: Only Support 5G Antenna Diversity Function\n"));
+ if(!(pDM_Odm->SupportICType & ODM_ANTDIV_5G_SUPPORT_IC))
+ return;
+ }
+ else if(pDM_FatTable->AntDiv_2G_5G == (ODM_ANTDIV_2G|ODM_ANTDIV_5G))
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[2G & 5G AntDiv Init]:Support Both 2G & 5G Antenna Diversity Function\n"));
+ }
+
+ pDM_Odm->antdiv_rssi=0;
+
+#endif
+ //---
+
+ //2 [--General---]
+ pDM_Odm->antdiv_period=0;
+ pDM_Odm->antdiv_select=0;
+ pDM_SWAT_Table->Ant5G = MAIN_ANT;
+ pDM_SWAT_Table->Ant2G = MAIN_ANT;
+ pDM_FatTable->CCK_counter_main=0;
+ pDM_FatTable->CCK_counter_aux=0;
+ pDM_FatTable->OFDM_counter_main=0;
+ pDM_FatTable->OFDM_counter_aux=0;
+
+ //3 [Set MAIN_ANT as default antenna if Auto-Ant enable]
+ if (pDM_Odm->antdiv_select==1)
+ pDM_Odm->AntType = ODM_FIX_MAIN_ANT;
+ else if (pDM_Odm->antdiv_select==2)
+ pDM_Odm->AntType = ODM_FIX_AUX_ANT;
+ else if(pDM_Odm->antdiv_select==0)
+ pDM_Odm->AntType = ODM_AUTO_ANT;
+
+ if(pDM_Odm->AntType == ODM_AUTO_ANT)
+ {
+ odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
+ ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
+ }
+ else
+ {
+ odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
+
+ if(pDM_Odm->AntType == ODM_FIX_MAIN_ANT)
+ {
+ ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
+ return;
+ }
+ else if(pDM_Odm->AntType == ODM_FIX_AUX_ANT)
+ {
+ ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
+ return;
+ }
+ }
+ //---
+ if(pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV)
+ {
+ if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
+ {
+ #if TX_BY_REG
+ ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 0); //Reg80c[21]=1'b0 //from Reg
+ #else
+ ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1);
+ #endif
+ }
+ else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT)
+ {
+ #if TX_BY_REG
+ ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0);
+ #else
+ ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 1);
+ #endif
+ }
+ }
+
+ //2 [--88E---]
+ if(pDM_Odm->SupportICType == ODM_RTL8188E)
+ {
+ #if (RTL8188E_SUPPORT == 1)
+ //pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV;
+ //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
+ //pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV;
+
+ if( (pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV) && (pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV) && (pDM_Odm->AntDivType != CG_TRX_SMART_ANTDIV))
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 88E Not Supprrt This AntDiv Type\n"));
+ pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
+ return;
+ }
+
+ if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
+ odm_RX_HWAntDiv_Init_88E(pDM_Odm);
+ else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
+ odm_TRX_HWAntDiv_Init_88E(pDM_Odm);
+ else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)
+ odm_Smart_HWAntDiv_Init_88E(pDM_Odm);
+ #endif
+ }
+
+ //2 [--92E---]
+ #if (RTL8192E_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8192E)
+ {
+ //pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV;
+ //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
+ //pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV;
+
+ if( (pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV) && (pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV) && (pDM_Odm->AntDivType != CG_TRX_SMART_ANTDIV))
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8192E Not Supprrt This AntDiv Type\n"));
+ pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
+ return;
+ }
+
+ if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
+ odm_RX_HWAntDiv_Init_92E(pDM_Odm);
+ else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
+ odm_TRX_HWAntDiv_Init_92E(pDM_Odm);
+ else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)
+ odm_Smart_HWAntDiv_Init_92E(pDM_Odm);
+
+ }
+ #endif
+
+ //2 [--8723B---]
+ #if (RTL8723B_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8723B)
+ {
+ //pDM_Odm->AntDivType = S0S1_SW_ANTDIV;
+ //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
+
+ if(pDM_Odm->AntDivType != S0S1_SW_ANTDIV && pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8723B Not Supprrt This AntDiv Type\n"));
+ pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
+ return;
+ }
+
+ if( pDM_Odm->AntDivType==S0S1_SW_ANTDIV)
+ odm_S0S1_SWAntDiv_Init_8723B(pDM_Odm);
+ else if(pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV)
+ odm_TRX_HWAntDiv_Init_8723B(pDM_Odm);
+ }
+ #endif
+
+ //2 [--8811A 8821A---]
+ #if (RTL8821A_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+ //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
+ pDM_Odm->AntDivType = S0S1_SW_ANTDIV;
+
+ if( pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV && pDM_Odm->AntDivType != S0S1_SW_ANTDIV)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8821A & 8811A Not Supprrt This AntDiv Type\n"));
+ pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
+ return;
+ }
+ if(pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV)
+ odm_TRX_HWAntDiv_Init_8821A(pDM_Odm);
+ else if( pDM_Odm->AntDivType==S0S1_SW_ANTDIV)
+ odm_S0S1_SWAntDiv_Init_8821A(pDM_Odm);
+ }
+ #endif
+
+ //2 [--8881A---]
+ #if (RTL8881A_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8881A)
+ {
+ //pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV;
+ //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
+
+ if(pDM_Odm->AntDivType != CGCS_RX_HW_ANTDIV && pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8881A Not Supprrt This AntDiv Type\n"));
+ pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
+ return;
+ }
+ if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
+ odm_RX_HWAntDiv_Init_8881A(pDM_Odm);
+ else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
+ odm_TRX_HWAntDiv_Init_8881A(pDM_Odm);
+ }
+ #endif
+
+ //2 [--8812---]
+ #if (RTL8812A_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8812)
+ {
+ //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV;
+
+ if( pDM_Odm->AntDivType != CG_TRX_HW_ANTDIV)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] 8812A Not Supprrt This AntDiv Type\n"));
+ pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
+ return;
+ }
+ odm_TRX_HWAntDiv_Init_8812A(pDM_Odm);
+ }
+ #endif
+ //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,("*** AntDiv SupportAbility=[%lu] \n",(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)>>6));
+ //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("*** AntDiv Type=[%d] \n",pDM_Odm->AntDivType));
+
+}
+
+VOID
+ODM_AntDiv(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ PADAPTER pAdapter = pDM_Odm->Adapter;
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+
+//#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+ if(*pDM_Odm->pBandType == ODM_BAND_5G )
+ {
+ if(pDM_FatTable->idx_AntDiv_counter_5G < pDM_Odm->antdiv_period )
+ {
+ pDM_FatTable->idx_AntDiv_counter_5G++;
+ return;
+ }
+ else
+ pDM_FatTable->idx_AntDiv_counter_5G=0;
+ }
+ else if(*pDM_Odm->pBandType == ODM_BAND_2_4G )
+ {
+ if(pDM_FatTable->idx_AntDiv_counter_2G < pDM_Odm->antdiv_period )
+ {
+ pDM_FatTable->idx_AntDiv_counter_2G++;
+ return;
+ }
+ else
+ pDM_FatTable->idx_AntDiv_counter_2G=0;
+ }
+//#endif
+ //----------
+ if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[Return!!!] Not Support Antenna Diversity Function\n"));
+ return;
+ }
+
+ //----------
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ if(pAdapter->MgntInfo.AntennaTest)
+ return;
+
+ {
+ #if (BEAMFORMING_SUPPORT == 1)
+ BEAMFORMING_CAP BeamformCap = (pAdapter->MgntInfo.BeamformingInfo.BeamformCap);
+
+ if( BeamformCap & BEAMFORMEE_CAP ) // BFmee On && Div On -> Div Off
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ AntDiv : OFF ] BFmee ==1 \n"));
+ if(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)
+ {
+ odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
+ pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV);
+ return;
+ }
+ }
+ else // BFmee Off && Div Off -> Div On
+ #endif
+ {
+ if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV) && pDM_Odm->bLinked)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ AntDiv : ON ] BFmee ==0 \n"));
+ if((pDM_Odm->AntDivType!=S0S1_SW_ANTDIV) )
+ odm_AntDiv_on_off(pDM_Odm, ANTDIV_ON);
+
+ pDM_Odm->SupportAbility |= (ODM_BB_ANT_DIV);
+ }
+ }
+ }
+#endif
+
+ //----------
+#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+ if(pDM_FatTable->AntDiv_2G_5G == ODM_ANTDIV_2G)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 2G AntDiv Running ]\n"));
+ if(!(pDM_Odm->SupportICType & ODM_ANTDIV_2G_SUPPORT_IC))
+ return;
+ }
+ else if(pDM_FatTable->AntDiv_2G_5G == ODM_ANTDIV_5G)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 5G AntDiv Running ]\n"));
+ if(!(pDM_Odm->SupportICType & ODM_ANTDIV_5G_SUPPORT_IC))
+ return;
+ }
+ else if(pDM_FatTable->AntDiv_2G_5G == (ODM_ANTDIV_2G|ODM_ANTDIV_5G))
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 2G & 5G AntDiv Running ]\n"));
+ }
+#endif
+
+ //----------
+
+ if (pDM_Odm->antdiv_select==1)
+ pDM_Odm->AntType = ODM_FIX_MAIN_ANT;
+ else if (pDM_Odm->antdiv_select==2)
+ pDM_Odm->AntType = ODM_FIX_AUX_ANT;
+ else if (pDM_Odm->antdiv_select==0)
+ pDM_Odm->AntType = ODM_AUTO_ANT;
+
+ //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("AntType= (( %d )) , pre_AntType= (( %d )) \n",pDM_Odm->AntType,pDM_Odm->pre_AntType));
+
+ if(pDM_Odm->AntType != ODM_AUTO_ANT)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Fix Antenna at (( %s ))\n",(pDM_Odm->AntType == ODM_FIX_MAIN_ANT)?"MAIN":"AUX"));
+
+ if(pDM_Odm->AntType != pDM_Odm->pre_AntType)
+ {
+ odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF);
+
+ if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
+ ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 0);
+ else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT)
+ ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0);
+
+ if(pDM_Odm->AntType == ODM_FIX_MAIN_ANT)
+ ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT);
+ else if(pDM_Odm->AntType == ODM_FIX_AUX_ANT)
+ ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT);
+ }
+ pDM_Odm->pre_AntType=pDM_Odm->AntType;
+ return;
+ }
+ else
+ {
+ if(pDM_Odm->AntType != pDM_Odm->pre_AntType)
+ {
+ odm_AntDiv_on_off(pDM_Odm, ANTDIV_ON);
+ if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
+ ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1);
+ else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT)
+ ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 1);
+ }
+ pDM_Odm->pre_AntType=pDM_Odm->AntType;
+ }
+
+
+ //3 -----------------------------------------------------------------------------------------------------------
+ //2 [--88E---]
+ if(pDM_Odm->SupportICType == ODM_RTL8188E)
+ {
+ #if (RTL8188E_SUPPORT == 1)
+ if(pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV ||pDM_Odm->AntDivType==CGCS_RX_HW_ANTDIV)
+ odm_HW_AntDiv(pDM_Odm);
+ #if (!(DM_ODM_SUPPORT_TYPE == ODM_CE))
+ else if (pDM_Odm->AntDivType==CG_TRX_SMART_ANTDIV)
+ odm_FastAntTraining(pDM_Odm);
+ #endif
+ #endif
+ }
+ //2 [--92E---]
+ #if (RTL8192E_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8192E)
+ {
+ if(pDM_Odm->AntDivType==CGCS_RX_HW_ANTDIV)
+ odm_HW_AntDiv(pDM_Odm);
+ #if (!(DM_ODM_SUPPORT_TYPE == ODM_CE))
+ else if (pDM_Odm->AntDivType==CG_TRX_SMART_ANTDIV)
+ odm_FastAntTraining(pDM_Odm);
+ #endif
+ }
+ #endif
+
+ #if (RTL8723B_SUPPORT == 1)
+ //2 [--8723B---]
+ else if(pDM_Odm->SupportICType == ODM_RTL8723B)
+ {
+ if (pDM_Odm->AntDivType==S0S1_SW_ANTDIV)
+ odm_S0S1_SwAntDiv(pDM_Odm, SWAW_STEP_PEAK);
+ else if (pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV)
+ odm_HW_AntDiv(pDM_Odm);
+ }
+ #endif
+
+ //2 [--8821A---]
+ #if (RTL8821A_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+ if(pDM_Odm->bBtDisabled) //BT disabled
+ {
+ if(pDM_Odm->AntDivType == S0S1_SW_ANTDIV)
+ {
+ pDM_Odm->AntDivType=CG_TRX_HW_ANTDIV;
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, 1);
+ }
+ }
+ else //BT enabled
+ {
+ if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
+ {
+ pDM_Odm->AntDivType=S0S1_SW_ANTDIV;
+ ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, 0);
+ }
+ }
+
+ if (pDM_Odm->AntDivType==S0S1_SW_ANTDIV)
+ odm_S0S1_SwAntDiv(pDM_Odm, SWAW_STEP_PEAK);
+ else if (pDM_Odm->AntDivType==CG_TRX_HW_ANTDIV)
+ odm_HW_AntDiv(pDM_Odm);
+ }
+ #endif
+ //2 [--8881A---]
+ #if (RTL8881A_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8881A)
+ odm_HW_AntDiv(pDM_Odm);
+ #endif
+ //2 [--8812A---]
+ #if (RTL8812A_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8812)
+ odm_HW_AntDiv(pDM_Odm);
+ #endif
+}
+
+
+VOID
+odm_AntselStatistics(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte antsel_tr_mux,
+ IN u4Byte MacId,
+ IN u4Byte RxPWDBAll
+)
+{
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+
+ if(antsel_tr_mux == ANT1_2G)
+ {
+ pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll;
+ pDM_FatTable->MainAnt_Cnt[MacId]++;
+ }
+ else
+ {
+ pDM_FatTable->AuxAnt_Sum[MacId]+=RxPWDBAll;
+ pDM_FatTable->AuxAnt_Cnt[MacId]++;
+ }
+}
+
+
+VOID
+ODM_Process_RSSIForAntDiv(
+ IN OUT PDM_ODM_T pDM_Odm,
+ IN PODM_PHY_INFO_T pPhyInfo,
+ IN PODM_PACKET_INFO_T pPktinfo
+ )
+{
+u1Byte isCCKrate=0,CCKMaxRate=DESC_RATE11M;
+pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
+ u4Byte RxPower_Ant0, RxPower_Ant1;
+#else
+ u1Byte RxPower_Ant0, RxPower_Ant1;
+#endif
+
+ if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT)
+ CCKMaxRate=DESC_RATE11M;
+ else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT)
+ CCKMaxRate=DESC_RATE11M;
+ isCCKrate = (pPktinfo->DataRate <= CCKMaxRate)?TRUE:FALSE;
+
+#if ((RTL8192C_SUPPORT == 1) ||(RTL8192D_SUPPORT == 1))
+ if(pDM_Odm->SupportICType & ODM_RTL8192C|ODM_RTL8192D)
+ {
+ if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
+ {
+ //if(pPktinfo->bPacketBeacon)
+ //{
+ // DbgPrint("This is beacon, isCCKrate=%d\n", isCCKrate);
+ //}
+ ODM_AntselStatistics_88C(pDM_Odm, pPktinfo->StationID, pPhyInfo->RxPWDBAll, isCCKrate);
+ }
+ }
+#endif
+
+ if( (pDM_Odm->SupportICType == ODM_RTL8192E||pDM_Odm->SupportICType == ODM_RTL8812) && (pPktinfo->DataRate > CCKMaxRate) )
+ {
+ RxPower_Ant0 = pPhyInfo->RxMIMOSignalStrength[0];
+ RxPower_Ant1= pPhyInfo->RxMIMOSignalStrength[1];
+ }
+ else
+ RxPower_Ant0=pPhyInfo->RxPWDBAll;
+
+ if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)
+ {
+ if( (pDM_Odm->SupportICType & ODM_SMART_ANT_SUPPORT) && pPktinfo->bPacketToSelf && pDM_FatTable->FAT_State == FAT_TRAINING_STATE )//(pPktinfo->bPacketMatchBSSID && (!pPktinfo->bPacketBeacon))
+ {
+ u1Byte antsel_tr_mux;
+ antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0;
+ pDM_FatTable->antSumRSSI[antsel_tr_mux] += RxPower_Ant0;
+ pDM_FatTable->antRSSIcnt[antsel_tr_mux]++;
+ }
+ }
+ else //AntDivType != CG_TRX_SMART_ANTDIV
+ {
+ if( ( pDM_Odm->SupportICType & ODM_ANTDIV_SUPPORT ) && (pPktinfo->bPacketToSelf || pPktinfo->bPacketMatchBSSID) )
+ {
+ if(pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8192E)
+ odm_AntselStatistics(pDM_Odm, pDM_FatTable->antsel_rx_keep_0, pPktinfo->StationID,RxPower_Ant0);
+ else// SupportICType == ODM_RTL8821 and ODM_RTL8723B and ODM_RTL8812)
+ {
+ if(isCCKrate && (pDM_Odm->AntDivType == S0S1_SW_ANTDIV))
+ {
+ 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_counter_main++;
+ else// if(pDM_FatTable->antsel_rx_keep_0==ANT2_2G)
+ pDM_FatTable->CCK_counter_aux++;
+
+ odm_AntselStatistics(pDM_Odm, pDM_FatTable->antsel_rx_keep_0, pPktinfo->StationID, RxPower_Ant0);
+ }
+ 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)
+ pDM_FatTable->OFDM_counter_aux++;
+ odm_AntselStatistics(pDM_Odm, pDM_FatTable->antsel_rx_keep_0, pPktinfo->StationID, RxPower_Ant0);
+ }
+ }
+ }
+ }
+ //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("isCCKrate=%d, PWDB_ALL=%d\n",isCCKrate, pPhyInfo->RxPWDBAll));
+ //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n",pDM_FatTable->antsel_rx_keep_2, pDM_FatTable->antsel_rx_keep_1, pDM_FatTable->antsel_rx_keep_0));
+}
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+VOID
+ODM_SetTxAntByTxInfo(
+ IN PDM_ODM_T pDM_Odm,
+ IN pu1Byte pDesc,
+ IN u1Byte macId
+)
+{
+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
+
+ if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))
+ return;
+
+ if(pDM_Odm->AntDivType==CGCS_RX_HW_ANTDIV)
+ return;
+
+
+ if(pDM_Odm->SupportICType == ODM_RTL8723B)
+ {
+#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
+ }
+ else if(pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+#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
+ }
+ else if(pDM_Odm->SupportICType == ODM_RTL8188E)
+ {
+#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
+ }
+ else if(pDM_Odm->SupportICType == ODM_RTL8192E)
+ {
+
+
+ }
+}
+#else// (DM_ODM_SUPPORT_TYPE == ODM_AP)
+
+VOID
+ODM_SetTxAntByTxInfo(
+ //IN PDM_ODM_T pDM_Odm,
+ struct rtl8192cd_priv *priv,
+ struct tx_desc *pdesc,
+ struct tx_insn *txcfg,
+ unsigned short aid
+)
+{
+ pFAT_T pDM_FatTable = &priv->pshare->_dmODM.DM_FatTable;
+ u4Byte SupportICType=priv->pshare->_dmODM.SupportICType;
+
+ if(SupportICType == ODM_RTL8881A)
+ {
+ //panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8881E****** \n",__FUNCTION__,__LINE__);
+ pdesc->Dword6 &= set_desc(~ (BIT(18)|BIT(17)|BIT(16)));
+ pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_a[aid]<<16);
+ }
+ else if(SupportICType == ODM_RTL8192E)
+ {
+ //panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8192E****** \n",__FUNCTION__,__LINE__);
+ pdesc->Dword6 &= set_desc(~ (BIT(18)|BIT(17)|BIT(16)));
+ pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_a[aid]<<16);
+ }
+ else if(SupportICType == ODM_RTL8812)
+ {
+ //3 [path-A]
+ //panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8881E****** \n",__FUNCTION__,__LINE__);
+
+ pdesc->Dword6 &= set_desc(~ BIT(16));
+ pdesc->Dword6 &= set_desc(~ BIT(17));
+ pdesc->Dword6 &= set_desc(~ BIT(18));
+ if(txcfg->pstat)
+ {
+ pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_a[aid]<<16);
+ pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_b[aid]<<17);
+ pdesc->Dword6 |= set_desc(pDM_FatTable->antsel_c[aid]<<18);
+ }
+ }
+}
+#endif
+
+#else
+
+VOID ODM_AntDivInit( IN PDM_ODM_T pDM_Odm ){}
+VOID ODM_AntDiv( IN PDM_ODM_T pDM_Odm){}
+
+#endif //#if (defined(CONFIG_HW_ANTENNA_DIVERSITY))
+
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_AntDiv.h b/rtl8xxx_EU/hal/OUTSRC/odm_AntDiv.h
index 832ee6b..86574a3 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_AntDiv.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_AntDiv.h
@@ -1,136 +1,136 @@
-/******************************************************************************
- *
- * 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 __ODMANTDIV_H__
-#define __ODMANTDIV_H__
-
-
-
-#define ANT1_2G 0 // = ANT2_5G
-#define ANT2_2G 1 // = ANT1_5G
-
-//Antenna Diversty Control Type
-#define ODM_AUTO_ANT 0
-#define ODM_FIX_MAIN_ANT 1
-#define ODM_FIX_AUX_ANT 2
-
-#define TX_BY_REG 0
-
-#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
-#define ODM_RTL8881A 0 //Just for windows driver to jointly use ODM-driver
-#endif
-
-#define ODM_ANTDIV_SUPPORT (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812)
-#define ODM_N_ANTDIV_SUPPORT (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B)
-#define ODM_AC_ANTDIV_SUPPORT (ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812)
-#define ODM_SMART_ANT_SUPPORT (ODM_RTL8188E|ODM_RTL8192E)
-
-#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
-#define ODM_ANTDIV_5G BIT1
-
-#define ANTDIV_ON 1
-#define ANTDIV_OFF 0
-
-VOID
-ODM_AntDivInit(
- IN PDM_ODM_T pDM_Odm
-);
-
-VOID
-ODM_AntDiv(
- IN PDM_ODM_T pDM_Odm
-);
-
-#if (defined(CONFIG_HW_ANTENNA_DIVERSITY))
-
-VOID
-ODM_UpdateRxIdleAnt(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte Ant
-);
-
-#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-VOID
-ODM_SW_AntDiv_Callback(
- IN PRT_TIMER pTimer
-);
-
-VOID
-ODM_SW_AntDiv_WorkitemCallback(
- IN PVOID pContext
-);
-#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
-VOID
-ODM_SW_AntDiv_Callback(void *FunctionContext);
-#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
-#endif
-
-#if(RTL8188E_SUPPORT == 1 || RTL8192E_SUPPORT == 1)
-#if ( !(DM_ODM_SUPPORT_TYPE == ODM_CE))
-VOID
-odm_FastAntTraining(
- IN PDM_ODM_T pDM_Odm
-);
-
-VOID
-odm_FastAntTrainingCallback(
- IN PDM_ODM_T pDM_Odm
-);
-
-VOID
-odm_FastAntTrainingWorkItemCallback(
- IN PDM_ODM_T pDM_Odm
-);
-#endif
-#endif
-
-VOID
-ODM_Process_RSSIForAntDiv(
- IN OUT PDM_ODM_T pDM_Odm,
- IN PODM_PHY_INFO_T pPhyInfo,
- IN PODM_PACKET_INFO_T pPktinfo
-);
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
-VOID
-ODM_SetTxAntByTxInfo(
- IN PDM_ODM_T pDM_Odm,
- IN pu1Byte pDesc,
- IN u1Byte macId
-);
-
-#else// (DM_ODM_SUPPORT_TYPE == ODM_AP)
-VOID
-ODM_SetTxAntByTxInfo(
- //IN PDM_ODM_T pDM_Odm,
- struct rtl8192cd_priv *priv,
- struct tx_desc *pdesc,
- struct tx_insn *txcfg,
- unsigned short aid
-);
-
-#endif
-
-#endif //#if (defined(CONFIG_HW_ANTENNA_DIVERSITY))
-#endif //#ifndef __ODMANTDIV_H__
+/******************************************************************************
+ *
+ * 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 __ODMANTDIV_H__
+#define __ODMANTDIV_H__
+
+
+
+#define ANT1_2G 0 // = ANT2_5G
+#define ANT2_2G 1 // = ANT1_5G
+
+//Antenna Diversty Control Type
+#define ODM_AUTO_ANT 0
+#define ODM_FIX_MAIN_ANT 1
+#define ODM_FIX_AUX_ANT 2
+
+#define TX_BY_REG 0
+
+#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
+#define ODM_RTL8881A 0 //Just for windows driver to jointly use ODM-driver
+#endif
+
+#define ODM_ANTDIV_SUPPORT (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812)
+#define ODM_N_ANTDIV_SUPPORT (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B)
+#define ODM_AC_ANTDIV_SUPPORT (ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812)
+#define ODM_SMART_ANT_SUPPORT (ODM_RTL8188E|ODM_RTL8192E)
+
+#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
+#define ODM_ANTDIV_5G BIT1
+
+#define ANTDIV_ON 1
+#define ANTDIV_OFF 0
+
+VOID
+ODM_AntDivInit(
+ IN PDM_ODM_T pDM_Odm
+);
+
+VOID
+ODM_AntDiv(
+ IN PDM_ODM_T pDM_Odm
+);
+
+#if (defined(CONFIG_HW_ANTENNA_DIVERSITY))
+
+VOID
+ODM_UpdateRxIdleAnt(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte Ant
+);
+
+#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1)
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+VOID
+ODM_SW_AntDiv_Callback(
+ IN PRT_TIMER pTimer
+);
+
+VOID
+ODM_SW_AntDiv_WorkitemCallback(
+ IN PVOID pContext
+);
+#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+VOID
+ODM_SW_AntDiv_Callback(void *FunctionContext);
+#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+#endif
+
+#if(RTL8188E_SUPPORT == 1 || RTL8192E_SUPPORT == 1)
+#if ( !(DM_ODM_SUPPORT_TYPE == ODM_CE))
+VOID
+odm_FastAntTraining(
+ IN PDM_ODM_T pDM_Odm
+);
+
+VOID
+odm_FastAntTrainingCallback(
+ IN PDM_ODM_T pDM_Odm
+);
+
+VOID
+odm_FastAntTrainingWorkItemCallback(
+ IN PDM_ODM_T pDM_Odm
+);
+#endif
+#endif
+
+VOID
+ODM_Process_RSSIForAntDiv(
+ IN OUT PDM_ODM_T pDM_Odm,
+ IN PODM_PHY_INFO_T pPhyInfo,
+ IN PODM_PACKET_INFO_T pPktinfo
+);
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+VOID
+ODM_SetTxAntByTxInfo(
+ IN PDM_ODM_T pDM_Odm,
+ IN pu1Byte pDesc,
+ IN u1Byte macId
+);
+
+#else// (DM_ODM_SUPPORT_TYPE == ODM_AP)
+VOID
+ODM_SetTxAntByTxInfo(
+ //IN PDM_ODM_T pDM_Odm,
+ struct rtl8192cd_priv *priv,
+ struct tx_desc *pdesc,
+ struct tx_insn *txcfg,
+ unsigned short aid
+);
+
+#endif
+
+#endif //#if (defined(CONFIG_HW_ANTENNA_DIVERSITY))
+#endif //#ifndef __ODMANTDIV_H__
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_HWConfig.c b/rtl8xxx_EU/hal/OUTSRC/odm_HWConfig.c
index a5955ad..5f96c94 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_HWConfig.c
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_HWConfig.c
@@ -1,2354 +1,2363 @@
-/******************************************************************************
- *
- * 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 "odm_precomp.h"
-
-#define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig_MP_##ic##txt(pDM_Odm))
-#define READ_AND_CONFIG_TC(ic, txt) (ODM_ReadAndConfig_TC_##ic##txt(pDM_Odm))
-
-
-#if (TESTCHIP_SUPPORT == 1)
-#define READ_AND_CONFIG(ic, txt) do {\
- if (pDM_Odm->bIsMPChip)\
- READ_AND_CONFIG_MP(ic,txt);\
- else\
- READ_AND_CONFIG_TC(ic,txt);\
- } while(0)
-#else
- #define READ_AND_CONFIG READ_AND_CONFIG_MP
-#endif
-
-
-#define READ_FIRMWARE_MP(ic, txt) (ODM_ReadFirmware_MP_##ic##txt(pDM_Odm, pFirmware, pSize))
-#define READ_FIRMWARE_TC(ic, txt) (ODM_ReadFirmware_TC_##ic##txt(pDM_Odm, pFirmware, pSize))
-
-#if (TESTCHIP_SUPPORT == 1)
-#define READ_FIRMWARE(ic, txt) do {\
- if (pDM_Odm->bIsMPChip)\
- READ_FIRMWARE_MP(ic,txt);\
- else\
- READ_FIRMWARE_TC(ic,txt);\
- } while(0)
-#else
-#define READ_FIRMWARE READ_FIRMWARE_MP
-#endif
-
-#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)
-
-
-u1Byte
-odm_QueryRxPwrPercentage(
- IN s1Byte AntPower
- )
-{
- if ((AntPower <= -100) || (AntPower >= 20))
- {
- return 0;
- }
- else if (AntPower >= 0)
- {
- return 100;
- }
- else
- {
- return (100+AntPower);
- }
-
-}
-
-#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
-//
-// 2012/01/12 MH MOve some signal strength smooth method to MP HAL layer.
-// IF other SW team do not support the feature, remove this section.??
-//
-s4Byte
-odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo(
- IN OUT PDM_ODM_T pDM_Odm,
- s4Byte CurrSig
-)
-{
- s4Byte RetSig = 0;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- //if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
- {
- // Step 1. Scale mapping.
- // 20100611 Joseph: Re-tunning RSSI presentation for Lenovo.
- // 20100426 Joseph: Modify Signal strength mapping.
- // This modification makes the RSSI indication similar to Intel solution.
- // 20100414 Joseph: Tunning RSSI for Lenovo according to RTL8191SE.
- if(CurrSig >= 54 && CurrSig <= 100)
- {
- RetSig = 100;
- }
- else if(CurrSig>=42 && CurrSig <= 53 )
- {
- RetSig = 95;
- }
- else if(CurrSig>=36 && CurrSig <= 41 )
- {
- RetSig = 74 + ((CurrSig - 36) *20)/6;
- }
- else if(CurrSig>=33 && CurrSig <= 35 )
- {
- RetSig = 65 + ((CurrSig - 33) *8)/2;
- }
- else if(CurrSig>=18 && CurrSig <= 32 )
- {
- RetSig = 62 + ((CurrSig - 18) *2)/15;
- }
- else if(CurrSig>=15 && CurrSig <= 17 )
- {
- RetSig = 33 + ((CurrSig - 15) *28)/2;
- }
- else if(CurrSig>=10 && CurrSig <= 14 )
- {
- RetSig = 39;
- }
- else if(CurrSig>=8 && CurrSig <= 9 )
- {
- RetSig = 33;
- }
- else if(CurrSig <= 8 )
- {
- RetSig = 19;
- }
- }
-#endif //ENDIF (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- return RetSig;
-}
-
-s4Byte
-odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore(
- IN OUT PDM_ODM_T pDM_Odm,
- s4Byte CurrSig
-)
-{
- s4Byte RetSig = 0;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- //if(pDM_Odm->SupportInterface == ODM_ITRF_USB)
- {
- // Netcore request this modification because 2009.04.13 SU driver use it.
- if(CurrSig >= 31 && CurrSig <= 100)
- {
- RetSig = 100;
- }
- else if(CurrSig >= 21 && CurrSig <= 30)
- {
- RetSig = 90 + ((CurrSig - 20) / 1);
- }
- else if(CurrSig >= 11 && CurrSig <= 20)
- {
- RetSig = 80 + ((CurrSig - 10) / 1);
- }
- else if(CurrSig >= 7 && CurrSig <= 10)
- {
- RetSig = 69 + (CurrSig - 7);
- }
- else if(CurrSig == 6)
- {
- RetSig = 54;
- }
- else if(CurrSig == 5)
- {
- RetSig = 45;
- }
- else if(CurrSig == 4)
- {
- RetSig = 36;
- }
- else if(CurrSig == 3)
- {
- RetSig = 27;
- }
- else if(CurrSig == 2)
- {
- RetSig = 18;
- }
- else if(CurrSig == 1)
- {
- RetSig = 9;
- }
- else
- {
- RetSig = CurrSig;
- }
- }
-#endif //ENDIF (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- return RetSig;
-}
-
-
-s4Byte
-odm_SignalScaleMapping_92CSeries(
- IN OUT PDM_ODM_T pDM_Odm,
- IN s4Byte CurrSig
-)
-{
- s4Byte RetSig = 0;
-#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
- if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
- {
- // Step 1. Scale mapping.
- if(CurrSig >= 61 && CurrSig <= 100)
- {
- RetSig = 90 + ((CurrSig - 60) / 4);
- }
- else if(CurrSig >= 41 && CurrSig <= 60)
- {
- RetSig = 78 + ((CurrSig - 40) / 2);
- }
- else if(CurrSig >= 31 && CurrSig <= 40)
- {
- RetSig = 66 + (CurrSig - 30);
- }
- else if(CurrSig >= 21 && CurrSig <= 30)
- {
- RetSig = 54 + (CurrSig - 20);
- }
- else if(CurrSig >= 5 && CurrSig <= 20)
- {
- RetSig = 42 + (((CurrSig - 5) * 2) / 3);
- }
- else if(CurrSig == 4)
- {
- RetSig = 36;
- }
- else if(CurrSig == 3)
- {
- RetSig = 27;
- }
- else if(CurrSig == 2)
- {
- RetSig = 18;
- }
- else if(CurrSig == 1)
- {
- RetSig = 9;
- }
- else
- {
- RetSig = CurrSig;
- }
- }
-#endif
-
-#if ((DEV_BUS_TYPE == RT_USB_INTERFACE) ||(DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- if((pDM_Odm->SupportInterface == ODM_ITRF_USB) || (pDM_Odm->SupportInterface == ODM_ITRF_SDIO))
- {
- if(CurrSig >= 51 && CurrSig <= 100)
- {
- RetSig = 100;
- }
- else if(CurrSig >= 41 && CurrSig <= 50)
- {
- RetSig = 80 + ((CurrSig - 40)*2);
- }
- else if(CurrSig >= 31 && CurrSig <= 40)
- {
- RetSig = 66 + (CurrSig - 30);
- }
- else if(CurrSig >= 21 && CurrSig <= 30)
- {
- RetSig = 54 + (CurrSig - 20);
- }
- else if(CurrSig >= 10 && CurrSig <= 20)
- {
- RetSig = 42 + (((CurrSig - 10) * 2) / 3);
- }
- else if(CurrSig >= 5 && CurrSig <= 9)
- {
- RetSig = 22 + (((CurrSig - 5) * 3) / 2);
- }
- else if(CurrSig >= 1 && CurrSig <= 4)
- {
- RetSig = 6 + (((CurrSig - 1) * 3) / 2);
- }
- else
- {
- RetSig = CurrSig;
- }
- }
-
-#endif
- return RetSig;
-}
-s4Byte
-odm_SignalScaleMapping(
- IN OUT PDM_ODM_T pDM_Odm,
- IN s4Byte CurrSig
-)
-{
- if( (pDM_Odm->SupportPlatform == ODM_WIN) &&
- (pDM_Odm->SupportInterface != ODM_ITRF_PCIE) && //USB & SDIO
- (pDM_Odm->PatchID==10))//pMgntInfo->CustomerID == RT_CID_819x_Netcore
- {
- return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore(pDM_Odm,CurrSig);
- }
- else if( (pDM_Odm->SupportPlatform == ODM_WIN) &&
- (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) &&
- (pDM_Odm->PatchID==19))//pMgntInfo->CustomerID == RT_CID_819x_Lenovo)
- {
- return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo(pDM_Odm, CurrSig);
- }
- else{
- return odm_SignalScaleMapping_92CSeries(pDM_Odm,CurrSig);
- }
-
-}
-#endif
-
-
-static u1Byte odm_SQ_process_patch_RT_CID_819x_Lenovo(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte isCCKrate,
- IN u1Byte PWDB_ALL,
- IN u1Byte path,
- IN u1Byte RSSI
-)
-{
- u1Byte SQ = 0;
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
- if(isCCKrate){
-
- if(IS_HARDWARE_TYPE_8723AE(pDM_Odm->Adapter))
- {
-
- //
- // <Roger_Notes> Expected signal strength and bars indication at Lenovo lab. 2013.04.11
- // 802.11n, 802.11b, 802.11g only at channel 6
- //
- // Attenuation (dB) OS Signal Bars RSSI by Xirrus (dBm)
- // 50 5 -52
- // 55 5 -54
- // 60 5 -55
- // 65 5 -59
- // 70 5 -63
- // 75 5 -66
- // 80 4 -72
- // 85 3 -75
- // 90 3 -80
- // 95 2 -85
- // 100 1 -89
- // 102 1 -90
- // 104 1 -91
- //
- RT_TRACE(COMP_DBG, DBG_WARNING, ("odm_SQ_process_patch_RT_CID_819x_Lenovo\n"));
-
-#if OS_WIN_FROM_WIN8(OS_VERSION)
- if(PWDB_ALL >= 50)
- SQ = 100;
- else if(PWDB_ALL >= 23 && PWDB_ALL < 50)
- SQ = 80;
- else if(PWDB_ALL >= 18 && PWDB_ALL < 23)
- SQ = 60;
- else if(PWDB_ALL >= 8 && PWDB_ALL < 18)
- SQ = 40;
- else
- SQ = 10;
-#else
- if(PWDB_ALL >= 34)
- SQ = 100;
- else if(PWDB_ALL >= 23 && PWDB_ALL < 34)
- SQ = 80;
- else if(PWDB_ALL >= 18 && PWDB_ALL < 23)
- SQ = 60;
- else if(PWDB_ALL >= 8 && PWDB_ALL < 18)
- SQ = 40;
- else
- SQ = 10;
-
- if(PWDB_ALL == 0)// Abnormal case, do not indicate the value above 20 on Win7
- SQ = 20;
-#endif
-
- }
- else if(IS_HARDWARE_TYPE_8192E(pDM_Odm->Adapter)){
-
- //
- // <Roger_Notes> Expected signal strength and bars indication at Lenovo lab. 2013.04.11
- // 802.11n, 802.11b, 802.11g only at channel 6
- //
- // Attenuation (dB) OS Signal Bars RSSI by Xirrus (dBm)
- // 50 5 -49
- // 55 5 -49
- // 60 5 -50
- // 65 5 -51
- // 70 5 -52
- // 75 5 -54
- // 80 5 -55
- // 85 4 -60
- // 90 3 -63
- // 95 3 -65
- // 100 2 -67
- // 102 2 -67
- // 104 1 -70
- //
-
- if(PWDB_ALL >= 50)
- SQ = 100;
- else if(PWDB_ALL >= 35 && PWDB_ALL < 50)
- SQ = 80;
- else if(PWDB_ALL >= 31 && PWDB_ALL < 35)
- SQ = 60;
- else if(PWDB_ALL >= 22 && PWDB_ALL < 31)
- SQ = 40;
- else if(PWDB_ALL >= 18 && PWDB_ALL < 22)
- SQ = 20;
- else
- SQ = 10;
- }
- else
- {
- if(PWDB_ALL >= 50)
- SQ = 100;
- else if(PWDB_ALL >= 35 && PWDB_ALL < 50)
- SQ = 80;
- else if(PWDB_ALL >= 22 && PWDB_ALL < 35)
- SQ = 60;
- else if(PWDB_ALL >= 18 && PWDB_ALL < 22)
- SQ = 40;
- else
- SQ = 10;
- }
-
- }
- else
- {//OFDM rate
-
- if(IS_HARDWARE_TYPE_8723AE(pDM_Odm->Adapter) ||
- IS_HARDWARE_TYPE_8192E(pDM_Odm->Adapter))
- {
- if(RSSI >= 45)
- SQ = 100;
- else if(RSSI >= 22 && RSSI < 45)
- SQ = 80;
- else if(RSSI >= 18 && RSSI < 22)
- SQ = 40;
- else
- SQ = 20;
- }
- else
- {
- if(RSSI >= 45)
- SQ = 100;
- else if(RSSI >= 22 && RSSI < 45)
- SQ = 80;
- else if(RSSI >= 18 && RSSI < 22)
- SQ = 40;
- else
- SQ = 20;
- }
- }
-
- RT_TRACE(COMP_DBG, DBG_TRACE, ("isCCKrate(%#d), PWDB_ALL(%#d), RSSI(%#d), SQ(%#d)\n", isCCKrate, PWDB_ALL, RSSI, SQ));
-
-#endif
- return SQ;
-}
-
-static u1Byte odm_SQ_process_patch_RT_CID_819x_Acer(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte isCCKrate,
- IN u1Byte PWDB_ALL,
- IN u1Byte path,
- IN u1Byte RSSI
-)
-{
- u1Byte SQ = 0;
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
- if(isCCKrate){
-
- RT_TRACE(COMP_DBG, DBG_WARNING, ("odm_SQ_process_patch_RT_Acer\n"));
-
-#if OS_WIN_FROM_WIN8(OS_VERSION)
-
- if(PWDB_ALL >= 50)
- SQ = 100;
- else if(PWDB_ALL >= 35 && PWDB_ALL < 50)
- SQ = 80;
- else if(PWDB_ALL >= 30 && PWDB_ALL < 35)
- SQ = 60;
- else if(PWDB_ALL >= 25 && PWDB_ALL < 30)
- SQ = 40;
- else if(PWDB_ALL >= 20 && PWDB_ALL < 25)
- SQ = 20;
- else
- SQ = 10;
-#else
- if(PWDB_ALL >= 50)
- SQ = 100;
- else if(PWDB_ALL >= 35 && PWDB_ALL < 50)
- SQ = 80;
- else if(PWDB_ALL >= 30 && PWDB_ALL < 35)
- SQ = 60;
- else if(PWDB_ALL >= 25 && PWDB_ALL < 30)
- SQ = 40;
- else if(PWDB_ALL >= 20 && PWDB_ALL < 25)
- SQ = 20;
- else
- SQ = 10;
-
- if(PWDB_ALL == 0)// Abnormal case, do not indicate the value above 20 on Win7
- SQ = 20;
-#endif
-
-
-
- }
- else
- {//OFDM rate
-
- if(IS_HARDWARE_TYPE_8723AE(pDM_Odm->Adapter) ||
- IS_HARDWARE_TYPE_8192E(pDM_Odm->Adapter))
- {
- if(RSSI >= 45)
- SQ = 100;
- else if(RSSI >= 22 && RSSI < 45)
- SQ = 80;
- else if(RSSI >= 18 && RSSI < 22)
- SQ = 40;
- else
- SQ = 20;
- }
- else
- {
- if(RSSI >= 35)
- SQ = 100;
- else if(RSSI >= 30 && RSSI < 35)
- SQ = 80;
- else if(RSSI >= 25 && RSSI < 30)
- SQ = 40;
- else
- SQ = 20;
- }
- }
-
- RT_TRACE(COMP_DBG, DBG_LOUD, ("isCCKrate(%#d), PWDB_ALL(%#d), RSSI(%#d), SQ(%#d)\n", isCCKrate, PWDB_ALL, RSSI, SQ));
-
-#endif
- return SQ;
-}
-
-static u1Byte
-odm_EVMdbToPercentage(
- IN s1Byte Value
- )
-{
- //
- // -33dB~0dB to 0%~99%
- //
- s1Byte ret_val;
-
- ret_val = Value;
- ret_val /= 2;
-
- //DbgPrint("Value=%d\n", Value);
- //ODM_RT_DISP(FRX, RX_PHY_SQ, ("EVMdbToPercentage92C Value=%d / %x \n", ret_val, ret_val));
-
- if(ret_val >= 0)
- ret_val = 0;
- if(ret_val <= -33)
- ret_val = -33;
-
- ret_val = 0 - ret_val;
- ret_val*=3;
-
- if(ret_val == 99)
- ret_val = 100;
-
- return(ret_val);
-}
-
-static u1Byte
-odm_EVMdbm_JaguarSeries(
- IN s1Byte Value
- )
-{
- s1Byte ret_val = Value;
-
- // -33dB~0dB to 33dB ~ 0dB
- if(ret_val == -128)
- ret_val = 127;
- else if (ret_val < 0)
- ret_val = 0 - ret_val;
-
- ret_val = ret_val >> 1;
- return ret_val;
-}
-
-static u2Byte
-odm_Cfo(
- IN s1Byte Value
-)
-{
- s2Byte ret_val;
-
- if (Value < 0)
- {
- ret_val = 0 - Value;
- ret_val = (ret_val << 1) + (ret_val >> 1) ; // *2.5~=312.5/2^7
- ret_val = ret_val | BIT12; // set bit12 as 1 for negative cfo
- }
- else
- {
- ret_val = Value;
- ret_val = (ret_val << 1) + (ret_val>>1) ; // *2.5~=312.5/2^7
- }
- return ret_val;
-}
-
-
-VOID
-odm_RxPhyStatus92CSeries_Parsing(
- IN OUT PDM_ODM_T pDM_Odm,
- OUT PODM_PHY_INFO_T pPhyInfo,
- IN pu1Byte pPhyStatus,
- IN PODM_PACKET_INFO_T pPktinfo
- )
-{
- SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
- u1Byte i, Max_spatial_stream;
- s1Byte rx_pwr[4], rx_pwr_all=0;
- u1Byte EVM, PWDB_ALL = 0, PWDB_ALL_BT;
- u1Byte RSSI, total_rssi=0;
- BOOLEAN isCCKrate=FALSE;
- u1Byte rf_rx_num = 0;
- u1Byte cck_highpwr = 0;
- u1Byte LNA_idx, VGA_idx;
- PPHY_STATUS_RPT_8192CD_T pPhyStaRpt = (PPHY_STATUS_RPT_8192CD_T)pPhyStatus;
-
- isCCKrate = (pPktinfo->DataRate <= DESC_RATE11M)?TRUE :FALSE;
- pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = -1;
- pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1;
-
-
- if(isCCKrate)
- {
- u1Byte report;
- u1Byte cck_agc_rpt;
-
- pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++;
- //
- // (1)Hardware does not provide RSSI for CCK
- // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
- //
-
- //if(pHalData->eRFPowerState == eRfOn)
- cck_highpwr = pDM_Odm->bCckHighPower;
- //else
- // cck_highpwr = FALSE;
-
- cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ;
-
- //2011.11.28 LukeLee: 88E use different LNA & VGA gain table
- //The RSSI formula should be modified according to the gain table
- //In 88E, cck_highpwr is always set to 1
- if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B))
- {
- LNA_idx = ((cck_agc_rpt & 0xE0) >>5);
- VGA_idx = (cck_agc_rpt & 0x1F);
- if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8192E))
- {
- switch(LNA_idx)
- {
- case 7:
- if(VGA_idx <= 27)
- rx_pwr_all = -100 + 2*(27-VGA_idx); //VGA_idx = 27~2
- else
- rx_pwr_all = -100;
- break;
- case 6:
- rx_pwr_all = -48 + 2*(2-VGA_idx); //VGA_idx = 2~0
- break;
- case 5:
- rx_pwr_all = -42 + 2*(7-VGA_idx); //VGA_idx = 7~5
- break;
- case 4:
- rx_pwr_all = -36 + 2*(7-VGA_idx); //VGA_idx = 7~4
- break;
- case 3:
- //rx_pwr_all = -28 + 2*(7-VGA_idx); //VGA_idx = 7~0
- rx_pwr_all = -24 + 2*(7-VGA_idx); //VGA_idx = 7~0
- break;
- case 2:
- if(cck_highpwr)
- rx_pwr_all = -12 + 2*(5-VGA_idx); //VGA_idx = 5~0
- else
- rx_pwr_all = -6+ 2*(5-VGA_idx);
- break;
- case 1:
- rx_pwr_all = 8-2*VGA_idx;
- break;
- case 0:
- rx_pwr_all = 14-2*VGA_idx;
- break;
- default:
- //DbgPrint("CCK Exception default\n");
- break;
- }
- rx_pwr_all += 6;
-
- //2012.10.08 LukeLee: Modify for 92E CCK RSSI
- if(pDM_Odm->SupportICType == ODM_RTL8192E)
- rx_pwr_all += 10;
-
- PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
- if(cck_highpwr == FALSE)
- {
- if(PWDB_ALL >= 80)
- PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80;
- else if((PWDB_ALL <= 78) && (PWDB_ALL >= 20))
- PWDB_ALL += 3;
- if(PWDB_ALL>100)
- PWDB_ALL = 100;
- }
- }
- else if(pDM_Odm->SupportICType & (ODM_RTL8723B))
- {
-#if (RTL8723B_SUPPORT == 1)
- rx_pwr_all = odm_CCKRSSI_8723B(LNA_idx,VGA_idx);
- PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
- if(PWDB_ALL>100)
- PWDB_ALL = 100;
-#endif
- }
- }
- else
- {
- if(!cck_highpwr)
- {
- report =( cck_agc_rpt & 0xc0 )>>6;
- switch(report)
- {
- // 03312009 modified by cosa
- // Modify the RF RNA gain value to -40, -20, -2, 14 by Jenyu's suggestion
- // Note: different RF with the different RNA gain.
- case 0x3:
- rx_pwr_all = -46 - (cck_agc_rpt & 0x3e);
- break;
- case 0x2:
- rx_pwr_all = -26 - (cck_agc_rpt & 0x3e);
- break;
- case 0x1:
- rx_pwr_all = -12 - (cck_agc_rpt & 0x3e);
- break;
- case 0x0:
- rx_pwr_all = 16 - (cck_agc_rpt & 0x3e);
- break;
- }
- }
- else
- {
- //report = pDrvInfo->cfosho[0] & 0x60;
- //report = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a& 0x60;
-
- report = (cck_agc_rpt & 0x60)>>5;
- switch(report)
- {
- case 0x3:
- rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f)<<1) ;
- break;
- case 0x2:
- rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f)<<1);
- break;
- case 0x1:
- rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f)<<1) ;
- break;
- case 0x0:
- rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f)<<1) ;
- break;
- }
- }
-
- PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
-
- //Modification for ext-LNA board
- if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))
- {
- if((cck_agc_rpt>>7) == 0){
- PWDB_ALL = (PWDB_ALL>94)?100:(PWDB_ALL +6);
- }
- else
- {
- if(PWDB_ALL > 38)
- PWDB_ALL -= 16;
- else
- PWDB_ALL = (PWDB_ALL<=16)?(PWDB_ALL>>2):(PWDB_ALL -12);
- }
-
- //CCK modification
- if(PWDB_ALL > 25 && PWDB_ALL <= 60)
- PWDB_ALL += 6;
- //else if (PWDB_ALL <= 25)
- // PWDB_ALL += 8;
- }
- else//Modification for int-LNA board
- {
- if(PWDB_ALL > 99)
- PWDB_ALL -= 8;
- else if(PWDB_ALL > 50 && PWDB_ALL <= 68)
- PWDB_ALL += 4;
- }
- }
-
- pPhyInfo->RxPWDBAll = PWDB_ALL;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
- pPhyInfo->BTRxRSSIPercentage = PWDB_ALL;
- pPhyInfo->RecvSignalPower = rx_pwr_all;
-#endif
- //
- // (3) Get Signal Quality (EVM)
- //
- //if(pPktinfo->bPacketMatchBSSID)
- {
- u1Byte SQ,SQ_rpt;
-
- if((pDM_Odm->SupportPlatform == ODM_WIN) &&
- (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((pDM_Odm->SupportPlatform == ODM_WIN) &&
- (pDM_Odm->PatchID==RT_CID_819x_Acer))
- {
- SQ = odm_SQ_process_patch_RT_CID_819x_Acer(pDM_Odm,isCCKrate,PWDB_ALL,0,0);
- }
- else if(pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest){
- SQ = 100;
- }
- else{
- SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all;
-
- if(SQ_rpt > 64)
- SQ = 0;
- else if (SQ_rpt < 20)
- SQ = 100;
- else
- SQ = ((64-SQ_rpt) * 100) / 44;
-
- }
-
- //DbgPrint("cck SQ = %d\n", SQ);
- pPhyInfo->SignalQuality = SQ;
- pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = SQ;
- pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1;
- }
- }
- else //is OFDM rate
- {
- pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++;
-
- //
- // (1)Get RSSI for HT rate
- //
-
- for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++)
- {
- // 2008/01/30 MH we will judge RF RX path now.
- if (pDM_Odm->RFPathRxEnable & BIT(i))
- rf_rx_num++;
- //else
- //continue;
-
- rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain& 0x3F)*2) - 110;
-
-
- #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
- pPhyInfo->RxPwr[i] = rx_pwr[i];
- #endif
-
- /* Translate DBM to percentage. */
- RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]);
- total_rssi += RSSI;
- //RT_DISP(FRX, RX_PHY_SS, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], RSSI));
-
- //Modification for ext-LNA board
- if(pDM_Odm->SupportICType&ODM_RTL8192C)
- {
- if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))
- {
- if((pPhyStaRpt->path_agc[i].trsw) == 1)
- RSSI = (RSSI>94)?100:(RSSI +6);
- else
- RSSI = (RSSI<=16)?(RSSI>>3):(RSSI -16);
-
- if((RSSI <= 34) && (RSSI >=4))
- RSSI -= 4;
- }
- }
-
- pPhyInfo->RxMIMOSignalStrength[i] =(u1Byte) RSSI;
-
- #if (DM_ODM_SUPPORT_TYPE & (/*ODM_WIN|*/ODM_CE|ODM_AP|ODM_ADSL))
- //Get Rx snr value in DB
- pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = (s4Byte)(pPhyStaRpt->path_rxsnr[i]/2);
- #endif
-
- /* Record Signal Strength for next packet */
- //if(pPktinfo->bPacketMatchBSSID)
- {
- if((pDM_Odm->SupportPlatform == ODM_WIN) &&
- (pDM_Odm->PatchID==RT_CID_819x_Lenovo))
- {
- if(i==ODM_RF_PATH_A)
- pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,i,RSSI);
-
- }
- else if((pDM_Odm->SupportPlatform == ODM_WIN) &&
- (pDM_Odm->PatchID==RT_CID_819x_Acer))
- {
- pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Acer(pDM_Odm,isCCKrate,PWDB_ALL,0,RSSI);
- }
-
- }
- }
-
-
- //
- // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
- //
- rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1 )& 0x7f) -110;
-
- PWDB_ALL_BT = PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
- //RT_DISP(FRX, RX_PHY_SS, ("PWDB_ALL=%d\n",PWDB_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))
- pPhyInfo->BTRxRSSIPercentage = PWDB_ALL_BT;
- pPhyInfo->RxPower = rx_pwr_all;
- pPhyInfo->RecvSignalPower = rx_pwr_all;
- #endif
-
- if((pDM_Odm->SupportPlatform == ODM_WIN) &&(pDM_Odm->PatchID==19)){
- //do nothing
- }else if((pDM_Odm->SupportPlatform == ODM_WIN) &&(pDM_Odm->PatchID==25)){
- //do nothing
- }
- else{//pMgntInfo->CustomerID != RT_CID_819x_Lenovo
- //
- // (3)EVM of HT rate
- //
- if(pPktinfo->DataRate >=DESC_RATEMCS8 && pPktinfo->DataRate <=DESC_RATEMCS15)
- Max_spatial_stream = 2; //both spatial stream make sense
- else
- Max_spatial_stream = 1; //only spatial stream 1 makes sense
-
- for(i=0; i<Max_spatial_stream; i++)
- {
- // Do not use shift operation like "rx_evmX >>= 1" because the compilor of free build environment
- // fill most significant bit to "zero" when doing shifting operation which may change a negative
- // value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore.
- EVM = odm_EVMdbToPercentage( (pPhyStaRpt->stream_rxevm[i] )); //dbm
-
- //RT_DISP(FRX, RX_PHY_SQ, ("RXRATE=%x RXEVM=%x EVM=%s%d\n",
- //GET_RX_STATUS_DESC_RX_MCS(pDesc), pDrvInfo->rxevm[i], "%", EVM));
-
- //if(pPktinfo->bPacketMatchBSSID)
- {
- if(i==ODM_RF_PATH_A) // Fill value in RFD, Get the first spatial stream only
- {
- pPhyInfo->SignalQuality = (u1Byte)(EVM & 0xff);
- }
- pPhyInfo->RxMIMOSignalQuality[i] = (u1Byte)(EVM & 0xff);
- }
- }
- }
-
- //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]));
- }
- }
-
- }
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
- //UI BSS List signal strength(in percentage), make it good looking, from 0~100.
- //It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().
- if(isCCKrate)
- {
-#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
- pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));//PWDB_ALL;
-#endif
- }
- else
- {
- if (rf_rx_num != 0)
- {
-#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
- pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, total_rssi/=rf_rx_num));
-#endif
- }
- }
-#endif
-
- //DbgPrint("isCCKrate = %d, pPhyInfo->RxPWDBAll = %d, pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a = 0x%x\n",
- //isCCKrate, pPhyInfo->RxPWDBAll, pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a);
-
- //For 92C/92D HW (Hybrid) Antenna Diversity
-#if(defined(CONFIG_HW_ANTENNA_DIVERSITY))
- pDM_SWAT_Table->antsel = pPhyStaRpt->ant_sel;
- //For 88E HW Antenna Diversity
- pDM_Odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->ant_sel;
- pDM_Odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->ant_sel_b;
- pDM_Odm->DM_FatTable.antsel_rx_keep_2 = pPhyStaRpt->antsel_rx_keep_2;
-#endif
-}
-
-#if ODM_IC_11AC_SERIES_SUPPORT
-
-VOID
-odm_RxPhyStatusJaguarSeries_Parsing(
- IN OUT PDM_ODM_T pDM_Odm,
- OUT PODM_PHY_INFO_T pPhyInfo,
- IN pu1Byte pPhyStatus,
- IN PODM_PACKET_INFO_T pPktinfo
- )
-{
- u1Byte i, Max_spatial_stream;
- s1Byte rx_pwr[4], rx_pwr_all=0;
- u1Byte EVM = 0, EVMdbm, PWDB_ALL = 0, PWDB_ALL_BT;
- u1Byte RSSI, total_rssi=0;
- u1Byte isCCKrate=0;
- u1Byte rf_rx_num = 0;
- u1Byte cck_highpwr = 0;
- u1Byte LNA_idx, VGA_idx;
-
-
- PPHY_STATUS_RPT_8812_T pPhyStaRpt = (PPHY_STATUS_RPT_8812_T)pPhyStatus;
-
- if(pPktinfo->DataRate <= DESC_RATE54M)
- {
- switch(pPhyStaRpt->r_RFMOD){
- case 1:
- if(pPhyStaRpt->sub_chnl == 0)
- pPhyInfo->BandWidth = 1;
- else
- pPhyInfo->BandWidth = 0;
- break;
-
- case 2:
- if(pPhyStaRpt->sub_chnl == 0)
- pPhyInfo->BandWidth = 2;
- else if(pPhyStaRpt->sub_chnl == 9 || pPhyStaRpt->sub_chnl == 10)
- pPhyInfo->BandWidth = 1;
- else
- pPhyInfo->BandWidth = 0;
- break;
-
- default: case 0:
- pPhyInfo->BandWidth = 0;
- break;
- }
- }
-
- if(pPktinfo->DataRate <= DESC_RATE11M)
- isCCKrate = TRUE;
- else
- isCCKrate = FALSE;
-
- pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = -1;
- pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1;
-
-
- if(isCCKrate)
- {
- u1Byte cck_agc_rpt;
- pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++;
- //
- // (1)Hardware does not provide RSSI for CCK
- // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
- //
-
- //if(pHalData->eRFPowerState == eRfOn)
- cck_highpwr = pDM_Odm->bCckHighPower;
- //else
- // 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)
- {
- case 7:
- if(VGA_idx <= 27)
- rx_pwr_all = -100 + 2*(27-VGA_idx); //VGA_idx = 27~2
- else
- rx_pwr_all = -100;
- break;
- case 6:
- rx_pwr_all = -48 + 2*(2-VGA_idx); //VGA_idx = 2~0
- break;
- case 5:
- rx_pwr_all = -42 + 2*(7-VGA_idx); //VGA_idx = 7~5
- break;
- case 4:
- rx_pwr_all = -36 + 2*(7-VGA_idx); //VGA_idx = 7~4
- break;
- case 3:
- //rx_pwr_all = -28 + 2*(7-VGA_idx); //VGA_idx = 7~0
- rx_pwr_all = -24 + 2*(7-VGA_idx); //VGA_idx = 7~0
- break;
- case 2:
- if(cck_highpwr)
- rx_pwr_all = -12 + 2*(5-VGA_idx); //VGA_idx = 5~0
- else
- rx_pwr_all = -6+ 2*(5-VGA_idx);
- break;
- case 1:
- rx_pwr_all = 8-2*VGA_idx;
- break;
- case 0:
- rx_pwr_all = 14-2*VGA_idx;
- break;
- default:
- //DbgPrint("CCK Exception default\n");
- break;
- }
- rx_pwr_all += 6;
- PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
- if(cck_highpwr == FALSE)
- {
- if(PWDB_ALL >= 80)
- PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80;
- else if((PWDB_ALL <= 78) && (PWDB_ALL >= 20))
- PWDB_ALL += 3;
- if(PWDB_ALL>100)
- PWDB_ALL = 100;
- }
- }
- else if(pDM_Odm->SupportICType == ODM_RTL8821)
- {
- s1Byte Pout = -6;
-
- switch(LNA_idx)
- {
- case 5:
- rx_pwr_all = Pout -32 -(2*VGA_idx);
- break;
- case 4:
- rx_pwr_all = Pout -24 -(2*VGA_idx);
- break;
- case 2:
- rx_pwr_all = Pout -11 -(2*VGA_idx);
- break;
- case 1:
- rx_pwr_all = Pout + 5 -(2*VGA_idx);
- break;
- case 0:
- rx_pwr_all = Pout + 21 -(2*VGA_idx);
- break;
- }
- PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
- }
-
- pPhyInfo->RxPWDBAll = PWDB_ALL;
- //if(pPktinfo->StationID == 0)
- //{
- // DbgPrint("CCK: LNA_idx = %d, VGA_idx = %d, pPhyInfo->RxPWDBAll = %d\n",
- // LNA_idx, VGA_idx, pPhyInfo->RxPWDBAll);
- //}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
- pPhyInfo->BTRxRSSIPercentage = PWDB_ALL;
- pPhyInfo->RecvSignalPower = rx_pwr_all;
-#endif
- //
- // (3) Get Signal Quality (EVM)
- //
- //if(pPktinfo->bPacketMatchBSSID)
- {
- u1Byte SQ,SQ_rpt;
-
- if((pDM_Odm->SupportPlatform == ODM_WIN) &&
- (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){
- SQ = 100;
- }
- else{
- SQ_rpt = pPhyStaRpt->pwdb_all;
-
- if(SQ_rpt > 64)
- SQ = 0;
- else if (SQ_rpt < 20)
- SQ = 100;
- else
- SQ = ((64-SQ_rpt) * 100) / 44;
-
- }
-
- //DbgPrint("cck SQ = %d\n", SQ);
- pPhyInfo->SignalQuality = SQ;
- pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = SQ;
- pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1;
- }
- }
- else //is OFDM rate
- {
- pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++;
-
- //
- // (1)Get RSSI for OFDM rate
- //
-
- for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++)
- {
- // 2008/01/30 MH we will judge RF RX path now.
- //DbgPrint("pDM_Odm->RFPathRxEnable = %x\n", pDM_Odm->RFPathRxEnable);
- if (pDM_Odm->RFPathRxEnable & BIT(i))
- {
- rf_rx_num++;
- }
- //else
- //continue;
- //2012.05.25 LukeLee: Testchip AGC report is wrong, it should be restored back to old formula in MP chip
- //if((pDM_Odm->SupportICType & (ODM_RTL8812|ODM_RTL8821)) && (!pDM_Odm->bIsMPChip))
- rx_pwr[i] = (pPhyStaRpt->gain_trsw[i]&0x7F) - 110;
- //else
- // rx_pwr[i] = ((pPhyStaRpt->gain_trsw[i]& 0x3F)*2) - 110; //OLD FORMULA
-
- #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
- pPhyInfo->RxPwr[i] = rx_pwr[i];
- #endif
-
- /* Translate DBM to percentage. */
- RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]);
-
- total_rssi += RSSI;
- //RT_DISP(FRX, RX_PHY_SS, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], RSSI));
-
-
-
- pPhyInfo->RxMIMOSignalStrength[i] =(u1Byte) RSSI;
-
- #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE|ODM_AP|ODM_ADSL))
- //Get Rx snr value in DB
- pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = pPhyStaRpt->rxsnr[i]/2;
- #endif
-
- //
- // (2) CFO_short & CFO_tail
- //
- pPhyInfo->Cfo_short[i] = odm_Cfo( (pPhyStaRpt->cfosho[i]) );
- pPhyInfo->Cfo_tail[i] = odm_Cfo( (pPhyStaRpt->cfotail[i]) );
-
- /* Record Signal Strength for next packet */
- //if(pPktinfo->bPacketMatchBSSID)
- {
- if((pDM_Odm->SupportPlatform == ODM_WIN) &&
- (pDM_Odm->PatchID==RT_CID_819x_Lenovo))
- {
- if(i==ODM_RF_PATH_A)
- pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,i,RSSI);
-
- }
- }
- }
-
-
- //
- // (3)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
- //
- //2012.05.25 LukeLee: Testchip AGC report is wrong, it should be restored back to old formula in MP chip
- if((pDM_Odm->SupportICType & (ODM_RTL8812|ODM_RTL8821)) && (!pDM_Odm->bIsMPChip))
- rx_pwr_all = (pPhyStaRpt->pwdb_all& 0x7f) -110;
- 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))
- pPhyInfo->BTRxRSSIPercentage = PWDB_ALL_BT;
- pPhyInfo->RxPower = rx_pwr_all;
- pPhyInfo->RecvSignalPower = rx_pwr_all;
- #endif
-
- //DbgPrint("OFDM: pPhyInfo->RxPWDBAll = %d, pPhyInfo->RxMIMOSignalStrength[0] = %d, pPhyInfo->RxMIMOSignalStrength[1] = %d\n",
- // pPhyInfo->RxPWDBAll, pPhyInfo->RxMIMOSignalStrength[0], pPhyInfo->RxMIMOSignalStrength[1]);
-
-
- if((pDM_Odm->SupportPlatform == ODM_WIN) &&(pDM_Odm->PatchID==19)){
- //do nothing
- }
- else{//pMgntInfo->CustomerID != RT_CID_819x_Lenovo
- //
- // (4)EVM of OFDM rate
- //
- if( (pPktinfo->DataRate>=DESC_RATEMCS8) &&
- (pPktinfo->DataRate <=DESC_RATEMCS15))
- Max_spatial_stream = 2;
- else if( (pPktinfo->DataRate>=DESC_RATEVHTSS2MCS0) &&
- (pPktinfo->DataRate <=DESC_RATEVHTSS2MCS9))
- Max_spatial_stream = 2;
- else
- Max_spatial_stream = 1;
-
- //if(pPktinfo->bPacketMatchBSSID)
- {
- //DbgPrint("pPktinfo->DataRate = %d\n", pPktinfo->DataRate);
-
- for(i=0; i<Max_spatial_stream; i++)
- {
- // Do not use shift operation like "rx_evmX >>= 1" because the compilor of free build environment
- // fill most significant bit to "zero" when doing shifting operation which may change a negative
- // value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore.
- //
- // 2013/09/02 MH According to 8812AU test, when use RX evm the value sometimes
- // will be incorrect and 1SS-MCS-0-7 always incorrect. Only use LSIG the evm value
- // seems ok. This seems BB bug, we need use another way to display better SQ.
- //
- //if (pPktinfo->DataRate>=DESC8812_RATE6M && pPktinfo->DataRate<=DESC8812_RATE54M)
- {
-
- if(i==ODM_RF_PATH_A )
- {
- EVM = odm_EVMdbToPercentage( (pPhyStaRpt->sigevm )); //dbm
- EVM += 20;
- if (EVM > 100)
- EVM = 100;
- }
- }
-#if 0
- else
- {
- if (pPhyStaRpt->rxevm[i] == -128)
- {
- pPhyStaRpt->rxevm[i] = -25;
- }
- EVM = odm_EVMdbToPercentage( (pPhyStaRpt->rxevm[i] )); //dbm
- }
-#endif
- EVMdbm = odm_EVMdbm_JaguarSeries(pPhyStaRpt->rxevm[i]);
- //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
- {
- pPhyInfo->SignalQuality = EVM;
- }
- pPhyInfo->RxMIMOSignalQuality[i] = EVM;
- pPhyInfo->RxMIMOEVMdbm[i] = EVMdbm;
- }
- }
- }
- }
- //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]));
- }
- }
- }
- //DbgPrint("isCCKrate= %d, pPhyInfo->SignalStrength=%d % PWDB_AL=%d rf_rx_num=%d\n", isCCKrate, pPhyInfo->SignalStrength, PWDB_ALL, rf_rx_num);
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
- //UI BSS List signal strength(in percentage), make it good looking, from 0~100.
- //It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().
- if(isCCKrate)
- {
-#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
- pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));//PWDB_ALL;
-#endif
- }
- else
- {
- if (rf_rx_num != 0)
- {
-#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
- pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, total_rssi/=rf_rx_num));
-#endif
- }
- }
-#endif
- pDM_Odm->RxPWDBAve = pDM_Odm->RxPWDBAve + pPhyInfo->RxPWDBAll;
-
- pDM_Odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->antidx_anta;
- pDM_Odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->antidx_antb;
-
- //DbgPrint("pPhyStaRpt->antidx_anta = %d, pPhyStaRpt->antidx_antb = %d, pPhyStaRpt->resvd_1 = %d",
- // pPhyStaRpt->antidx_anta, pPhyStaRpt->antidx_antb, pPhyStaRpt->resvd_1);
-
- //DbgPrint("----------------------------\n");
- //DbgPrint("pPktinfo->StationID=%d, pPktinfo->DataRate=0x%x\n",pPktinfo->StationID, pPktinfo->DataRate);
- //DbgPrint("pPhyStaRpt->gain_trsw[0]=0x%x, pPhyStaRpt->gain_trsw[1]=0x%x, pPhyStaRpt->pwdb_all=0x%x\n",
- // pPhyStaRpt->gain_trsw[0],pPhyStaRpt->gain_trsw[1], pPhyStaRpt->pwdb_all);
- //DbgPrint("pPhyInfo->RxMIMOSignalStrength[0]=%d, pPhyInfo->RxMIMOSignalStrength[1]=%d, RxPWDBAll=%d\n",
- // pPhyInfo->RxMIMOSignalStrength[0], pPhyInfo->RxMIMOSignalStrength[1], pPhyInfo->RxPWDBAll);
-
-}
-
-#endif
-
-VOID
-odm_Init_RSSIForDM(
- IN OUT PDM_ODM_T pDM_Odm
- )
-{
-
-}
-
-VOID
-odm_Process_RSSIForDM(
- IN OUT PDM_ODM_T pDM_Odm,
- IN PODM_PHY_INFO_T pPhyInfo,
- IN PODM_PACKET_INFO_T pPktinfo
- )
-{
-
- s4Byte UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK, UndecoratedSmoothedOFDM, RSSI_Ave;
- u1Byte isCCKrate=0;
- u1Byte RSSI_max, RSSI_min, i;
- u4Byte OFDM_pkt=0;
- u4Byte Weighting=0;
- PSTA_INFO_T pEntry;
-
-
- if(pPktinfo->StationID == 0xFF)
- return;
-
- //
- // 2012/05/30 MH/Luke.Lee Add some description
- // In windows driver: AP/IBSS mode STA
- //
- //if (pDM_Odm->SupportPlatform == ODM_WIN)
- //{
- // pEntry = pDM_Odm->pODM_StaInfo[pDM_Odm->pAidMap[pPktinfo->StationID-1]];
- //}
- //else
- pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID];
-
- if(!IS_STA_VALID(pEntry) ){
- return;
- }
- if((!pPktinfo->bPacketMatchBSSID) )
- {
- return;
- }
-
- if(pPktinfo->bPacketBeacon)
- pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++;
-
- isCCKrate = (pPktinfo->DataRate <= DESC_RATE11M)?TRUE :FALSE;
- pDM_Odm->RxRate = pPktinfo->DataRate;
- /*
- if(!isCCKrate)
- {
- DbgPrint("OFDM: pPktinfo->StationID=%d, isCCKrate=%d, pPhyInfo->RxPWDBAll=%d\n",
- pPktinfo->StationID, isCCKrate, pPhyInfo->RxPWDBAll);
- }
- */
-
- //--------------Statistic for antenna/path diversity------------------
- if(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)
- {
- #if(defined(CONFIG_HW_ANTENNA_DIVERSITY))
- ODM_Process_RSSIForAntDiv(pDM_Odm,pPhyInfo,pPktinfo);
- #endif
- }
- else if(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)
- {
- #if (RTL8812A_SUPPORT == 1)
- if(pDM_Odm->SupportICType == ODM_RTL8812)
- {
- pPATHDIV_T pDM_PathDiv = &pDM_Odm->DM_PathDiv;
- if(pPktinfo->bPacketToSelf || pPktinfo->bPacketMatchBSSID)
- {
- if(pPktinfo->DataRate > DESC_RATE11M)
- ODM_PathStatistics_8812A(pDM_Odm, pPktinfo->StationID, pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A],
- pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]);
- }
- }
- #endif
- }
-
- //-----------------Smart Antenna Debug Message------------------//
-
- UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK;
- UndecoratedSmoothedOFDM = pEntry->rssi_stat.UndecoratedSmoothedOFDM;
- UndecoratedSmoothedPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB;
-
- if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
- {
-
- if(!isCCKrate)//ofdm rate
- {
- if(pPhyInfo->RxMIMOSignalStrength[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;
- }
- else
- {
- //DbgPrint("pRfd->Status.RxMIMOSignalStrength[0] = %d, pRfd->Status.RxMIMOSignalStrength[1] = %d \n",
- //pRfd->Status.RxMIMOSignalStrength[0], pRfd->Status.RxMIMOSignalStrength[1]);
- pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A];
- pDM_Odm->RSSI_B = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B];
-
- if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B])
- {
- RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A];
- RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B];
- }
- else
- {
- RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B];
- RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A];
- }
- if((RSSI_max -RSSI_min) < 3)
- RSSI_Ave = RSSI_max;
- else if((RSSI_max -RSSI_min) < 6)
- RSSI_Ave = RSSI_max - 1;
- else if((RSSI_max -RSSI_min) < 10)
- RSSI_Ave = RSSI_max - 2;
- else
- RSSI_Ave = RSSI_max - 3;
- }
-
- //1 Process OFDM RSSI
- if(UndecoratedSmoothedOFDM <= 0) // initialize
- {
- UndecoratedSmoothedOFDM = pPhyInfo->RxPWDBAll;
- }
- else
- {
- if(pPhyInfo->RxPWDBAll > (u4Byte)UndecoratedSmoothedOFDM)
- {
- UndecoratedSmoothedOFDM =
- ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) +
- (RSSI_Ave)) /(Rx_Smooth_Factor);
- UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM + 1;
- }
- else
- {
- UndecoratedSmoothedOFDM =
- ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) +
- (RSSI_Ave)) /(Rx_Smooth_Factor);
- }
- }
-
- pEntry->rssi_stat.PacketMap = (pEntry->rssi_stat.PacketMap<<1) | BIT0;
-
- }
- else
- {
- RSSI_Ave = pPhyInfo->RxPWDBAll;
- pDM_Odm->RSSI_A = (u1Byte) pPhyInfo->RxPWDBAll;
- pDM_Odm->RSSI_B = 0;
-
- //1 Process CCK RSSI
- if(UndecoratedSmoothedCCK <= 0) // initialize
- {
- UndecoratedSmoothedCCK = pPhyInfo->RxPWDBAll;
- }
- else
- {
- if(pPhyInfo->RxPWDBAll > (u4Byte)UndecoratedSmoothedCCK)
- {
- UndecoratedSmoothedCCK =
- ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) +
- (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor);
- UndecoratedSmoothedCCK = UndecoratedSmoothedCCK + 1;
- }
- else
- {
- UndecoratedSmoothedCCK =
- ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) +
- (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor);
- }
- }
- pEntry->rssi_stat.PacketMap = pEntry->rssi_stat.PacketMap<<1;
- }
-
- //if(pEntry)
- {
- //2011.07.28 LukeLee: modified to prevent unstable CCK RSSI
- if(pEntry->rssi_stat.ValidBit >= 64)
- pEntry->rssi_stat.ValidBit = 64;
- else
- pEntry->rssi_stat.ValidBit++;
-
- for(i=0; i<pEntry->rssi_stat.ValidBit; i++)
- OFDM_pkt += (u1Byte)(pEntry->rssi_stat.PacketMap>>i)&BIT0;
-
- if(pEntry->rssi_stat.ValidBit == 64)
- {
- Weighting = ((OFDM_pkt<<4) > 64)?64:(OFDM_pkt<<4);
- UndecoratedSmoothedPWDB = (Weighting*UndecoratedSmoothedOFDM+(64-Weighting)*UndecoratedSmoothedCCK)>>6;
- }
- else
- {
- if(pEntry->rssi_stat.ValidBit != 0)
- UndecoratedSmoothedPWDB = (OFDM_pkt*UndecoratedSmoothedOFDM+(pEntry->rssi_stat.ValidBit-OFDM_pkt)*UndecoratedSmoothedCCK)/pEntry->rssi_stat.ValidBit;
- else
- UndecoratedSmoothedPWDB = 0;
- }
-
- pEntry->rssi_stat.UndecoratedSmoothedCCK = UndecoratedSmoothedCCK;
- pEntry->rssi_stat.UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM;
- pEntry->rssi_stat.UndecoratedSmoothedPWDB = UndecoratedSmoothedPWDB;
-
- //DbgPrint("OFDM_pkt=%d, Weighting=%d\n", OFDM_pkt, Weighting);
- //DbgPrint("UndecoratedSmoothedOFDM=%d, UndecoratedSmoothedPWDB=%d, UndecoratedSmoothedCCK=%d\n",
- // UndecoratedSmoothedOFDM, UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK);
-
- }
-
- }
-}
-
-
-//
-// Endianness before calling this API
-//
-VOID
-ODM_PhyStatusQuery_92CSeries(
- IN OUT PDM_ODM_T pDM_Odm,
- OUT PODM_PHY_INFO_T pPhyInfo,
- IN pu1Byte pPhyStatus,
- IN PODM_PACKET_INFO_T pPktinfo
- )
-{
-
- odm_RxPhyStatus92CSeries_Parsing(
- pDM_Odm,
- pPhyInfo,
- pPhyStatus,
- pPktinfo);
-
- if( pDM_Odm->RSSI_test == TRUE)
- {
- // Select the packets to do RSSI checking for antenna switching.
- if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon )
- {
- /*
- #if 0//(DM_ODM_SUPPORT_TYPE == ODM_WIN)
- dm_SWAW_RSSI_Check(
- Adapter,
- (tmppAdapter!=NULL)?(tmppAdapter==Adapter):TRUE,
- bPacketMatchBSSID,
- pEntry,
- pRfd);
- #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- // Select the packets to do RSSI checking for antenna switching.
- //odm_SwAntDivRSSICheck8192C(padapter, precvframe->u.hdr.attrib.RxPWDBAll);
- #endif
- */
- ODM_SwAntDivChkPerPktRssi(pDM_Odm,pPktinfo->StationID,pPhyInfo);
- }
- }
- else
- {
- odm_Process_RSSIForDM(pDM_Odm,pPhyInfo,pPktinfo);
- }
-
-}
-
-
-
-//
-// Endianness before calling this API
-//
-VOID
-ODM_PhyStatusQuery_JaguarSeries(
- IN OUT PDM_ODM_T pDM_Odm,
- OUT PODM_PHY_INFO_T pPhyInfo,
- IN pu1Byte pPhyStatus,
- IN PODM_PACKET_INFO_T pPktinfo
- )
-{
- odm_RxPhyStatusJaguarSeries_Parsing(
- pDM_Odm,
- pPhyInfo,
- pPhyStatus,
- pPktinfo);
-
- odm_Process_RSSIForDM(pDM_Odm,pPhyInfo,pPktinfo);
-}
-
-VOID
-ODM_PhyStatusQuery(
- IN OUT PDM_ODM_T pDM_Odm,
- OUT PODM_PHY_INFO_T pPhyInfo,
- IN pu1Byte pPhyStatus,
- IN PODM_PACKET_INFO_T pPktinfo
- )
-{
-
- if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES )
- {
- ODM_PhyStatusQuery_JaguarSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo);
- }
- else
- {
- ODM_PhyStatusQuery_92CSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo);
- }
-}
-
-// For future use.
-VOID
-ODM_MacStatusQuery(
- IN OUT PDM_ODM_T pDM_Odm,
- IN pu1Byte pMacStatus,
- IN u1Byte MacID,
- IN BOOLEAN bPacketMatchBSSID,
- IN BOOLEAN bPacketToSelf,
- IN BOOLEAN bPacketBeacon
- )
-{
- // 2011/10/19 Driver team will handle in the future.
-
-}
-
-
-//
-// If you want to add a new IC, Please follow below template and generate a new one.
-//
-//
-
-HAL_STATUS
-ODM_ConfigRFWithHeaderFile(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_RF_Config_Type ConfigType,
- IN ODM_RF_RADIO_PATH_E eRFPath
- )
-{
- PADAPTER Adapter = pDM_Odm->Adapter;
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
- ("===>ODM_ConfigRFWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip"));
- 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 (RTL8723A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8723A)
- {
- if(ConfigType == CONFIG_RF_RADIO) {
- if(eRFPath == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8723A,_RadioA_1T);
- }
- }
-#endif
-
-#if (RTL8188E_SUPPORT == 1)
- 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);
- }
- }
- else if(ConfigType == CONFIG_RF_TXPWR_LMT) {
- READ_AND_CONFIG(8188E,_TXPWR_LMT);
- }
- }
-#endif
-
-#if (RTL8812A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8812)
- {
- if(ConfigType == CONFIG_RF_RADIO) {
- if(eRFPath == ODM_RF_PATH_A)
- {
- READ_AND_CONFIG(8812A,_RadioA);
- }
- else if(eRFPath == ODM_RF_PATH_B)
- {
- READ_AND_CONFIG(8812A,_RadioB);
- }
- }
- else if(ConfigType == CONFIG_RF_TXPWR_LMT) {
- READ_AND_CONFIG(8812A,_TXPWR_LMT);
- }
- }
-#endif
-
-#if (RTL8821A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8821)
- {
- if(ConfigType == CONFIG_RF_RADIO) {
- if(eRFPath == ODM_RF_PATH_A)
- {
- READ_AND_CONFIG(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);
- else
- READ_AND_CONFIG(8821A,_TXPWR_LMT_8811AU_IPA);
- } else {
- READ_AND_CONFIG(8821A,_TXPWR_LMT_8821A);
- }
- }
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("<===8821_ODM_ConfigRFWithHeaderFile\n"));
- }
-#endif
-
-#if (RTL8723B_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8723B)
- {
- if(ConfigType == CONFIG_RF_RADIO) {
- READ_AND_CONFIG(8723B,_RadioA);
- }
- else if(ConfigType == CONFIG_RF_TXPWR_LMT) {
- READ_AND_CONFIG(8723B,_TXPWR_LMT);
- }
- }
-#endif
-
-#if (RTL8192E_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8192E)
- {
- if(ConfigType == CONFIG_RF_RADIO) {
- if(eRFPath == ODM_RF_PATH_A)
- READ_AND_CONFIG(8192E,_RadioA);
- else if(eRFPath == ODM_RF_PATH_B)
- READ_AND_CONFIG(8192E,_RadioB);
- }
- else if(ConfigType == CONFIG_RF_TXPWR_LMT) {
- READ_AND_CONFIG(8192E,_TXPWR_LMT);
- }
- }
-#endif
-
-#if (RTL8813A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8813A)
- {
- /*
- if(ConfigType == CONFIG_RF_TXPWR_LMT) {
- READ_AND_CONFIG(8813A,_TXPWR_LMT);
- }
- */
- }
-#endif
-
- return HAL_STATUS_SUCCESS;
-}
-
-HAL_STATUS
-ODM_ConfigRFWithTxPwrTrackHeaderFile(
- IN PDM_ODM_T pDM_Odm
- )
-{
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
- ("===>ODM_ConfigRFWithTxPwrTrackHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip"));
- 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)
- {
- }
-#if (RTL8821A_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8821)
- {
- if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
- READ_AND_CONFIG(8821A,_TxPowerTrack_PCIE);
- else if (pDM_Odm->SupportInterface == ODM_ITRF_USB)
- READ_AND_CONFIG(8821A,_TxPowerTrack_USB);
- else
- READ_AND_CONFIG(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);
- 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);
- }
-
- }
-#endif
-#if (RTL8192E_SUPPORT == 1)
- else if(pDM_Odm->SupportICType == ODM_RTL8192E)
- {
- if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
- READ_AND_CONFIG(8192E,_TxPowerTrack_PCIE);
- else if (pDM_Odm->SupportInterface == ODM_ITRF_USB)
- READ_AND_CONFIG(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);
- else if (pDM_Odm->SupportInterface == ODM_ITRF_USB)
- READ_AND_CONFIG(8723B,_TxPowerTrack_USB);
- else if (pDM_Odm->SupportInterface == ODM_ITRF_SDIO)
- READ_AND_CONFIG(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);
- else if (pDM_Odm->SupportInterface == ODM_ITRF_USB)
- READ_AND_CONFIG(8188E,_TxPowerTrack_USB);
- }
-#endif
-
- return HAL_STATUS_SUCCESS;
-}
-
-HAL_STATUS
-ODM_ConfigBBWithHeaderFile(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_BB_Config_Type ConfigType
- )
-{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
- PADAPTER Adapter = pDM_Odm->Adapter;
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
-#endif
-#endif
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
- ("===>ODM_ConfigBBWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip"));
- 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 (RTL8723A_SUPPORT == 1)
- if(pDM_Odm->SupportICType == ODM_RTL8723A)
- {
- if(ConfigType == CONFIG_BB_PHY_REG)
- {
- READ_AND_CONFIG_MP(8723A,_PHY_REG_1T);
- }
- else if(ConfigType == CONFIG_BB_AGC_TAB)
- {
- READ_AND_CONFIG_MP(8723A,_AGC_TAB_1T);
- }
- }
-#endif
-
-#if (RTL8188E_SUPPORT == 1)
- if(pDM_Odm->SupportICType == ODM_RTL8188E)
- {
- 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);
- }
- 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);
- }
- else if(ConfigType == CONFIG_BB_PHY_REG_PG)
- {
- READ_AND_CONFIG(8188E,_PHY_REG_PG);
- }
- }
-#endif
-
-#if (RTL8812A_SUPPORT == 1)
- if(pDM_Odm->SupportICType == ODM_RTL8812)
- {
- if(ConfigType == CONFIG_BB_PHY_REG)
- {
- READ_AND_CONFIG(8812A,_PHY_REG);
- }
- else if(ConfigType == CONFIG_BB_AGC_TAB)
- {
- READ_AND_CONFIG(8812A,_AGC_TAB);
- }
- else if(ConfigType == CONFIG_BB_PHY_REG_PG)
- {
- if (pDM_Odm->RFEType == 3 && pDM_Odm->bIsMPChip)
- READ_AND_CONFIG_MP(8812A,_PHY_REG_PG_ASUS);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- else if (pMgntInfo->CustomerID == RT_CID_WNC_NEC && pDM_Odm->bIsMPChip)
- READ_AND_CONFIG_MP(8812A,_PHY_REG_PG_NEC);
-#endif
- else
- READ_AND_CONFIG(8812A,_PHY_REG_PG);
- }
- else if(ConfigType == CONFIG_BB_PHY_REG_MP)
- {
- READ_AND_CONFIG_MP(8812A,_PHY_REG_MP);
- }
- else if(ConfigType == CONFIG_BB_AGC_TAB_DIFF)
- {
- if ((36 <= *pDM_Odm->pChannel) && (*pDM_Odm->pChannel <= 64))
- AGC_DIFF_CONFIG_MP(8812A,LB);
- else if (100 <= *pDM_Odm->pChannel)
- AGC_DIFF_CONFIG_MP(8812A,HB);
- }
- }
-#endif
-
-#if (RTL8821A_SUPPORT == 1)
- if(pDM_Odm->SupportICType == ODM_RTL8821)
- {
- if(ConfigType == CONFIG_BB_PHY_REG)
- {
- READ_AND_CONFIG(8821A,_PHY_REG);
- }
- else if(ConfigType == CONFIG_BB_AGC_TAB)
- {
- READ_AND_CONFIG(8821A,_AGC_TAB);
- }
- else if(ConfigType == CONFIG_BB_PHY_REG_PG)
- {
- READ_AND_CONFIG(8821A,_PHY_REG_PG);
- }
- }
-#endif
-#if (RTL8723B_SUPPORT == 1)
- if(pDM_Odm->SupportICType == ODM_RTL8723B)
- {
-
- if(ConfigType == CONFIG_BB_PHY_REG)
- {
- READ_AND_CONFIG(8723B,_PHY_REG);
- }
- else if(ConfigType == CONFIG_BB_AGC_TAB)
- {
- READ_AND_CONFIG(8723B,_AGC_TAB);
- }
- else if(ConfigType == CONFIG_BB_PHY_REG_PG)
- {
- READ_AND_CONFIG(8723B,_PHY_REG_PG);
- }
- }
-#endif
-#if (RTL8192E_SUPPORT == 1)
- if(pDM_Odm->SupportICType == ODM_RTL8192E)
- {
-
- if(ConfigType == CONFIG_BB_PHY_REG)
- {
- READ_AND_CONFIG(8192E,_PHY_REG);
- }
- else if(ConfigType == CONFIG_BB_AGC_TAB)
- {
- READ_AND_CONFIG(8192E,_AGC_TAB);
- }
- else if(ConfigType == CONFIG_BB_PHY_REG_PG)
- {
- READ_AND_CONFIG(8192E,_PHY_REG_PG);
- }
- }
-#endif
-#if (RTL8813A_SUPPORT == 1)
- if(pDM_Odm->SupportICType == ODM_RTL8813A)
- {
-
- if(ConfigType == CONFIG_BB_PHY_REG)
- {
- READ_AND_CONFIG(8813A,_PHY_REG);
- }
- else if(ConfigType == CONFIG_BB_AGC_TAB)
- {
- READ_AND_CONFIG(8813A,_AGC_TAB);
- }
- else if(ConfigType == CONFIG_BB_PHY_REG_PG)
- {
- //READ_AND_CONFIG(8813A,_PHY_REG_PG);
- }
- }
-#endif
- return HAL_STATUS_SUCCESS;
-}
-
-HAL_STATUS
-ODM_ConfigMACWithHeaderFile(
- IN PDM_ODM_T pDM_Odm
- )
-{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
- PADAPTER Adapter = pDM_Odm->Adapter;
-#endif
- u1Byte result = HAL_STATUS_SUCCESS;
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
- ("===>ODM_ConfigMACWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip"));
- 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 (RTL8723A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8723A)
- {
- READ_AND_CONFIG_MP(8723A,_MAC_REG);
- }
-#endif
-#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);
- }
-#endif
-#if (RTL8812A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8812)
- {
- READ_AND_CONFIG(8812A,_MAC_REG);
- }
-#endif
-#if (RTL8821A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8821)
- {
- READ_AND_CONFIG(8821A,_MAC_REG);
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("<===8821_ODM_ConfigMACwithHeaderFile\n"));
- }
-#endif
-#if (RTL8723B_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8723B)
- {
- READ_AND_CONFIG(8723B,_MAC_REG);
- }
-#endif
-#if (RTL8192E_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8192E)
- {
- READ_AND_CONFIG(8192E,_MAC_REG);
- }
-#endif
-
- return result;
-}
-
-HAL_STATUS
-ODM_ConfigFWWithHeaderFile(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_FW_Config_Type ConfigType,
- OUT u1Byte *pFirmware,
- OUT u4Byte *pSize
- )
-{
-
-#if (RTL8188E_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8188E)
- {
- if (ConfigType == CONFIG_FW_NIC)
- {
- READ_FIRMWARE(8188E,_FW_NIC_T);
- }
- else if (ConfigType == CONFIG_FW_WoWLAN)
- {
- READ_FIRMWARE(8188E,_FW_WoWLAN_T);
- }
- else if(ConfigType == CONFIG_FW_NIC_2)
- {
- READ_FIRMWARE(8188E,_FW_NIC_S);
- }
- else if (ConfigType == CONFIG_FW_WoWLAN_2)
- {
- READ_FIRMWARE(8188E,_FW_WoWLAN_S);
- }
- }
-#endif
-#if (RTL8723B_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8723B)
- {
- if (ConfigType == CONFIG_FW_NIC)
- {
- READ_FIRMWARE(8723B,_FW_NIC);
- }
- else if (ConfigType == CONFIG_FW_WoWLAN)
- {
- READ_FIRMWARE(8723B,_FW_WoWLAN);
- }
-#ifdef CONFIG_AP_WOWLAN
- else if (ConfigType == CONFIG_FW_AP_WoWLAN)
- {
- READ_FIRMWARE(8723B,_FW_AP_WoWLAN);
- }
-#endif
- else if (ConfigType == CONFIG_FW_BT)
- {
- READ_FIRMWARE_MP(8723B,_FW_BT);
- }
- else if (ConfigType == CONFIG_FW_MP)
- {
- READ_FIRMWARE_MP(8723B,_FW_MP);
- }
- }
-#endif
-#if (RTL8812A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8812)
- {
- if (ConfigType == CONFIG_FW_NIC)
- {
- READ_FIRMWARE(8812A,_FW_NIC);
- }
- else if (ConfigType == CONFIG_FW_WoWLAN)
- {
- READ_FIRMWARE(8812A,_FW_WoWLAN);
- }
- else if (ConfigType == CONFIG_FW_BT)
- {
- READ_FIRMWARE(8812A,_FW_NIC_BT);
- }
-
- }
-#endif
-#if (RTL8821A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8821)
- {
- if (ConfigType == CONFIG_FW_NIC)
- {
- READ_FIRMWARE_MP(8821A,_FW_NIC);
- }
- else if (ConfigType == CONFIG_FW_WoWLAN)
- {
- READ_FIRMWARE(8821A,_FW_WoWLAN);
- }
- else if (ConfigType == CONFIG_FW_BT)
- {
- READ_FIRMWARE_MP(8821A,_FW_NIC_BT);
- }
- }
-#endif
-#if (RTL8192E_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8192E)
- {
- if (ConfigType == CONFIG_FW_NIC)
- {
- READ_FIRMWARE(8192E,_FW_NIC);
- }
- else if (ConfigType == CONFIG_FW_WoWLAN)
- {
- READ_FIRMWARE(8192E,_FW_WoWLAN);
- }
-#ifdef CONFIG_AP_WOWLAN
- else if (ConfigType == CONFIG_FW_AP_WoWLAN)
- {
- READ_FIRMWARE(8192E,_FW_AP_WoWLAN);
- }
-#endif
-
- }
-#endif
- return HAL_STATUS_SUCCESS;
-}
-
-
-u4Byte
-ODM_GetHWImgVersion(
- IN PDM_ODM_T pDM_Odm
- )
-{
-
-#if (RTL8812A_SUPPORT == 1)
- if (pDM_Odm->SupportICType == ODM_RTL8812)
- return GET_VERSION_MP(8812A,_MAC_REG);
-#endif
-
- return 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 files
+//============================================================
+
+
+#include "odm_precomp.h"
+
+#define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig_MP_##ic##txt(pDM_Odm))
+#define READ_AND_CONFIG_TC(ic, txt) (ODM_ReadAndConfig_TC_##ic##txt(pDM_Odm))
+
+
+#if (TESTCHIP_SUPPORT == 1)
+#define READ_AND_CONFIG(ic, txt) do {\
+ if (pDM_Odm->bIsMPChip)\
+ READ_AND_CONFIG_MP(ic,txt);\
+ else\
+ READ_AND_CONFIG_TC(ic,txt);\
+ } while(0)
+#else
+ #define READ_AND_CONFIG READ_AND_CONFIG_MP
+#endif
+
+
+#define READ_FIRMWARE_MP(ic, txt) (ODM_ReadFirmware_MP_##ic##txt(pDM_Odm, pFirmware, pSize))
+#define READ_FIRMWARE_TC(ic, txt) (ODM_ReadFirmware_TC_##ic##txt(pDM_Odm, pFirmware, pSize))
+
+#if (TESTCHIP_SUPPORT == 1)
+#define READ_FIRMWARE(ic, txt) do {\
+ if (pDM_Odm->bIsMPChip)\
+ READ_FIRMWARE_MP(ic,txt);\
+ else\
+ READ_FIRMWARE_TC(ic,txt);\
+ } while(0)
+#else
+#define READ_FIRMWARE READ_FIRMWARE_MP
+#endif
+
+#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)
+
+
+u1Byte
+odm_QueryRxPwrPercentage(
+ IN s1Byte AntPower
+ )
+{
+ if ((AntPower <= -100) || (AntPower >= 20))
+ {
+ return 0;
+ }
+ else if (AntPower >= 0)
+ {
+ return 100;
+ }
+ else
+ {
+ return (100+AntPower);
+ }
+
+}
+
+#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
+//
+// 2012/01/12 MH MOve some signal strength smooth method to MP HAL layer.
+// IF other SW team do not support the feature, remove this section.??
+//
+s4Byte
+odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo(
+ IN OUT PDM_ODM_T pDM_Odm,
+ s4Byte CurrSig
+)
+{
+ s4Byte RetSig = 0;
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ //if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
+ {
+ // Step 1. Scale mapping.
+ // 20100611 Joseph: Re-tunning RSSI presentation for Lenovo.
+ // 20100426 Joseph: Modify Signal strength mapping.
+ // This modification makes the RSSI indication similar to Intel solution.
+ // 20100414 Joseph: Tunning RSSI for Lenovo according to RTL8191SE.
+ if(CurrSig >= 54 && CurrSig <= 100)
+ {
+ RetSig = 100;
+ }
+ else if(CurrSig>=42 && CurrSig <= 53 )
+ {
+ RetSig = 95;
+ }
+ else if(CurrSig>=36 && CurrSig <= 41 )
+ {
+ RetSig = 74 + ((CurrSig - 36) *20)/6;
+ }
+ else if(CurrSig>=33 && CurrSig <= 35 )
+ {
+ RetSig = 65 + ((CurrSig - 33) *8)/2;
+ }
+ else if(CurrSig>=18 && CurrSig <= 32 )
+ {
+ RetSig = 62 + ((CurrSig - 18) *2)/15;
+ }
+ else if(CurrSig>=15 && CurrSig <= 17 )
+ {
+ RetSig = 33 + ((CurrSig - 15) *28)/2;
+ }
+ else if(CurrSig>=10 && CurrSig <= 14 )
+ {
+ RetSig = 39;
+ }
+ else if(CurrSig>=8 && CurrSig <= 9 )
+ {
+ RetSig = 33;
+ }
+ else if(CurrSig <= 8 )
+ {
+ RetSig = 19;
+ }
+ }
+#endif //ENDIF (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ return RetSig;
+}
+
+s4Byte
+odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore(
+ IN OUT PDM_ODM_T pDM_Odm,
+ s4Byte CurrSig
+)
+{
+ s4Byte RetSig = 0;
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ //if(pDM_Odm->SupportInterface == ODM_ITRF_USB)
+ {
+ // Netcore request this modification because 2009.04.13 SU driver use it.
+ if(CurrSig >= 31 && CurrSig <= 100)
+ {
+ RetSig = 100;
+ }
+ else if(CurrSig >= 21 && CurrSig <= 30)
+ {
+ RetSig = 90 + ((CurrSig - 20) / 1);
+ }
+ else if(CurrSig >= 11 && CurrSig <= 20)
+ {
+ RetSig = 80 + ((CurrSig - 10) / 1);
+ }
+ else if(CurrSig >= 7 && CurrSig <= 10)
+ {
+ RetSig = 69 + (CurrSig - 7);
+ }
+ else if(CurrSig == 6)
+ {
+ RetSig = 54;
+ }
+ else if(CurrSig == 5)
+ {
+ RetSig = 45;
+ }
+ else if(CurrSig == 4)
+ {
+ RetSig = 36;
+ }
+ else if(CurrSig == 3)
+ {
+ RetSig = 27;
+ }
+ else if(CurrSig == 2)
+ {
+ RetSig = 18;
+ }
+ else if(CurrSig == 1)
+ {
+ RetSig = 9;
+ }
+ else
+ {
+ RetSig = CurrSig;
+ }
+ }
+#endif //ENDIF (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ return RetSig;
+}
+
+
+s4Byte
+odm_SignalScaleMapping_92CSeries(
+ IN OUT PDM_ODM_T pDM_Odm,
+ IN s4Byte CurrSig
+)
+{
+ s4Byte RetSig = 0;
+#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
+ if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
+ {
+ // Step 1. Scale mapping.
+ if(CurrSig >= 61 && CurrSig <= 100)
+ {
+ RetSig = 90 + ((CurrSig - 60) / 4);
+ }
+ else if(CurrSig >= 41 && CurrSig <= 60)
+ {
+ RetSig = 78 + ((CurrSig - 40) / 2);
+ }
+ else if(CurrSig >= 31 && CurrSig <= 40)
+ {
+ RetSig = 66 + (CurrSig - 30);
+ }
+ else if(CurrSig >= 21 && CurrSig <= 30)
+ {
+ RetSig = 54 + (CurrSig - 20);
+ }
+ else if(CurrSig >= 5 && CurrSig <= 20)
+ {
+ RetSig = 42 + (((CurrSig - 5) * 2) / 3);
+ }
+ else if(CurrSig == 4)
+ {
+ RetSig = 36;
+ }
+ else if(CurrSig == 3)
+ {
+ RetSig = 27;
+ }
+ else if(CurrSig == 2)
+ {
+ RetSig = 18;
+ }
+ else if(CurrSig == 1)
+ {
+ RetSig = 9;
+ }
+ else
+ {
+ RetSig = CurrSig;
+ }
+ }
+#endif
+
+#if ((DEV_BUS_TYPE == RT_USB_INTERFACE) ||(DEV_BUS_TYPE == RT_SDIO_INTERFACE))
+ if((pDM_Odm->SupportInterface == ODM_ITRF_USB) || (pDM_Odm->SupportInterface == ODM_ITRF_SDIO))
+ {
+ if(CurrSig >= 51 && CurrSig <= 100)
+ {
+ RetSig = 100;
+ }
+ else if(CurrSig >= 41 && CurrSig <= 50)
+ {
+ RetSig = 80 + ((CurrSig - 40)*2);
+ }
+ else if(CurrSig >= 31 && CurrSig <= 40)
+ {
+ RetSig = 66 + (CurrSig - 30);
+ }
+ else if(CurrSig >= 21 && CurrSig <= 30)
+ {
+ RetSig = 54 + (CurrSig - 20);
+ }
+ else if(CurrSig >= 10 && CurrSig <= 20)
+ {
+ RetSig = 42 + (((CurrSig - 10) * 2) / 3);
+ }
+ else if(CurrSig >= 5 && CurrSig <= 9)
+ {
+ RetSig = 22 + (((CurrSig - 5) * 3) / 2);
+ }
+ else if(CurrSig >= 1 && CurrSig <= 4)
+ {
+ RetSig = 6 + (((CurrSig - 1) * 3) / 2);
+ }
+ else
+ {
+ RetSig = CurrSig;
+ }
+ }
+
+#endif
+ return RetSig;
+}
+s4Byte
+odm_SignalScaleMapping(
+ IN OUT PDM_ODM_T pDM_Odm,
+ IN s4Byte CurrSig
+)
+{
+ if( (pDM_Odm->SupportPlatform == ODM_WIN) &&
+ (pDM_Odm->SupportInterface != ODM_ITRF_PCIE) && //USB & SDIO
+ (pDM_Odm->PatchID==10))//pMgntInfo->CustomerID == RT_CID_819x_Netcore
+ {
+ return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore(pDM_Odm,CurrSig);
+ }
+ else if( (pDM_Odm->SupportPlatform == ODM_WIN) &&
+ (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) &&
+ (pDM_Odm->PatchID==19))//pMgntInfo->CustomerID == RT_CID_819x_Lenovo)
+ {
+ return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo(pDM_Odm, CurrSig);
+ }
+ else{
+ return odm_SignalScaleMapping_92CSeries(pDM_Odm,CurrSig);
+ }
+
+}
+#endif
+
+
+static u1Byte odm_SQ_process_patch_RT_CID_819x_Lenovo(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte isCCKrate,
+ IN u1Byte PWDB_ALL,
+ IN u1Byte path,
+ IN u1Byte RSSI
+)
+{
+ u1Byte SQ = 0;
+#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
+
+ if(isCCKrate){
+
+ if(IS_HARDWARE_TYPE_8723AE(pDM_Odm->Adapter))
+ {
+
+ //
+ // <Roger_Notes> Expected signal strength and bars indication at Lenovo lab. 2013.04.11
+ // 802.11n, 802.11b, 802.11g only at channel 6
+ //
+ // Attenuation (dB) OS Signal Bars RSSI by Xirrus (dBm)
+ // 50 5 -52
+ // 55 5 -54
+ // 60 5 -55
+ // 65 5 -59
+ // 70 5 -63
+ // 75 5 -66
+ // 80 4 -72
+ // 85 3 -75
+ // 90 3 -80
+ // 95 2 -85
+ // 100 1 -89
+ // 102 1 -90
+ // 104 1 -91
+ //
+ RT_TRACE(COMP_DBG, DBG_WARNING, ("odm_SQ_process_patch_RT_CID_819x_Lenovo\n"));
+
+#if OS_WIN_FROM_WIN8(OS_VERSION)
+ if(PWDB_ALL >= 50)
+ SQ = 100;
+ else if(PWDB_ALL >= 23 && PWDB_ALL < 50)
+ SQ = 80;
+ else if(PWDB_ALL >= 18 && PWDB_ALL < 23)
+ SQ = 60;
+ else if(PWDB_ALL >= 8 && PWDB_ALL < 18)
+ SQ = 40;
+ else
+ SQ = 10;
+#else
+ if(PWDB_ALL >= 34)
+ SQ = 100;
+ else if(PWDB_ALL >= 23 && PWDB_ALL < 34)
+ SQ = 80;
+ else if(PWDB_ALL >= 18 && PWDB_ALL < 23)
+ SQ = 60;
+ else if(PWDB_ALL >= 8 && PWDB_ALL < 18)
+ SQ = 40;
+ else
+ SQ = 10;
+
+ if(PWDB_ALL == 0)// Abnormal case, do not indicate the value above 20 on Win7
+ SQ = 20;
+#endif
+
+ }
+ else if(IS_HARDWARE_TYPE_8192E(pDM_Odm->Adapter)){
+
+ //
+ // <Roger_Notes> Expected signal strength and bars indication at Lenovo lab. 2013.04.11
+ // 802.11n, 802.11b, 802.11g only at channel 6
+ //
+ // Attenuation (dB) OS Signal Bars RSSI by Xirrus (dBm)
+ // 50 5 -49
+ // 55 5 -49
+ // 60 5 -50
+ // 65 5 -51
+ // 70 5 -52
+ // 75 5 -54
+ // 80 5 -55
+ // 85 4 -60
+ // 90 3 -63
+ // 95 3 -65
+ // 100 2 -67
+ // 102 2 -67
+ // 104 1 -70
+ //
+
+ if(PWDB_ALL >= 50)
+ SQ = 100;
+ else if(PWDB_ALL >= 35 && PWDB_ALL < 50)
+ SQ = 80;
+ else if(PWDB_ALL >= 31 && PWDB_ALL < 35)
+ SQ = 60;
+ else if(PWDB_ALL >= 22 && PWDB_ALL < 31)
+ SQ = 40;
+ else if(PWDB_ALL >= 18 && PWDB_ALL < 22)
+ SQ = 20;
+ else
+ SQ = 10;
+ }
+ else
+ {
+ if(PWDB_ALL >= 50)
+ SQ = 100;
+ else if(PWDB_ALL >= 35 && PWDB_ALL < 50)
+ SQ = 80;
+ else if(PWDB_ALL >= 22 && PWDB_ALL < 35)
+ SQ = 60;
+ else if(PWDB_ALL >= 18 && PWDB_ALL < 22)
+ SQ = 40;
+ else
+ SQ = 10;
+ }
+
+ }
+ else
+ {//OFDM rate
+
+ if(IS_HARDWARE_TYPE_8723AE(pDM_Odm->Adapter) ||
+ IS_HARDWARE_TYPE_8192E(pDM_Odm->Adapter))
+ {
+ if(RSSI >= 45)
+ SQ = 100;
+ else if(RSSI >= 22 && RSSI < 45)
+ SQ = 80;
+ else if(RSSI >= 18 && RSSI < 22)
+ SQ = 40;
+ else
+ SQ = 20;
+ }
+ else
+ {
+ if(RSSI >= 45)
+ SQ = 100;
+ else if(RSSI >= 22 && RSSI < 45)
+ SQ = 80;
+ else if(RSSI >= 18 && RSSI < 22)
+ SQ = 40;
+ else
+ SQ = 20;
+ }
+ }
+
+ RT_TRACE(COMP_DBG, DBG_TRACE, ("isCCKrate(%#d), PWDB_ALL(%#d), RSSI(%#d), SQ(%#d)\n", isCCKrate, PWDB_ALL, RSSI, SQ));
+
+#endif
+ return SQ;
+}
+
+static u1Byte odm_SQ_process_patch_RT_CID_819x_Acer(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte isCCKrate,
+ IN u1Byte PWDB_ALL,
+ IN u1Byte path,
+ IN u1Byte RSSI
+)
+{
+ u1Byte SQ = 0;
+
+#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
+
+ if(isCCKrate){
+
+ RT_TRACE(COMP_DBG, DBG_WARNING, ("odm_SQ_process_patch_RT_Acer\n"));
+
+#if OS_WIN_FROM_WIN8(OS_VERSION)
+
+ if(PWDB_ALL >= 50)
+ SQ = 100;
+ else if(PWDB_ALL >= 35 && PWDB_ALL < 50)
+ SQ = 80;
+ else if(PWDB_ALL >= 30 && PWDB_ALL < 35)
+ SQ = 60;
+ else if(PWDB_ALL >= 25 && PWDB_ALL < 30)
+ SQ = 40;
+ else if(PWDB_ALL >= 20 && PWDB_ALL < 25)
+ SQ = 20;
+ else
+ SQ = 10;
+#else
+ if(PWDB_ALL >= 50)
+ SQ = 100;
+ else if(PWDB_ALL >= 35 && PWDB_ALL < 50)
+ SQ = 80;
+ else if(PWDB_ALL >= 30 && PWDB_ALL < 35)
+ SQ = 60;
+ else if(PWDB_ALL >= 25 && PWDB_ALL < 30)
+ SQ = 40;
+ else if(PWDB_ALL >= 20 && PWDB_ALL < 25)
+ SQ = 20;
+ else
+ SQ = 10;
+
+ if(PWDB_ALL == 0)// Abnormal case, do not indicate the value above 20 on Win7
+ SQ = 20;
+#endif
+
+
+
+ }
+ else
+ {//OFDM rate
+
+ if(IS_HARDWARE_TYPE_8723AE(pDM_Odm->Adapter) ||
+ IS_HARDWARE_TYPE_8192E(pDM_Odm->Adapter))
+ {
+ if(RSSI >= 45)
+ SQ = 100;
+ else if(RSSI >= 22 && RSSI < 45)
+ SQ = 80;
+ else if(RSSI >= 18 && RSSI < 22)
+ SQ = 40;
+ else
+ SQ = 20;
+ }
+ else
+ {
+ if(RSSI >= 35)
+ SQ = 100;
+ else if(RSSI >= 30 && RSSI < 35)
+ SQ = 80;
+ else if(RSSI >= 25 && RSSI < 30)
+ SQ = 40;
+ else
+ SQ = 20;
+ }
+ }
+
+ RT_TRACE(COMP_DBG, DBG_LOUD, ("isCCKrate(%#d), PWDB_ALL(%#d), RSSI(%#d), SQ(%#d)\n", isCCKrate, PWDB_ALL, RSSI, SQ));
+
+#endif
+ return SQ;
+}
+
+static u1Byte
+odm_EVMdbToPercentage(
+ IN s1Byte Value
+ )
+{
+ //
+ // -33dB~0dB to 0%~99%
+ //
+ s1Byte ret_val;
+
+ ret_val = Value;
+ ret_val /= 2;
+
+ //DbgPrint("Value=%d\n", Value);
+ //ODM_RT_DISP(FRX, RX_PHY_SQ, ("EVMdbToPercentage92C Value=%d / %x \n", ret_val, ret_val));
+
+ if(ret_val >= 0)
+ ret_val = 0;
+ if(ret_val <= -33)
+ ret_val = -33;
+
+ ret_val = 0 - ret_val;
+ ret_val*=3;
+
+ if(ret_val == 99)
+ ret_val = 100;
+
+ return(ret_val);
+}
+
+static u1Byte
+odm_EVMdbm_JaguarSeries(
+ IN s1Byte Value
+ )
+{
+ s1Byte ret_val = Value;
+
+ // -33dB~0dB to 33dB ~ 0dB
+ if(ret_val == -128)
+ ret_val = 127;
+ else if (ret_val < 0)
+ ret_val = 0 - ret_val;
+
+ ret_val = ret_val >> 1;
+ return ret_val;
+}
+
+static u2Byte
+odm_Cfo(
+ IN s1Byte Value
+)
+{
+ s2Byte ret_val;
+
+ if (Value < 0)
+ {
+ ret_val = 0 - Value;
+ ret_val = (ret_val << 1) + (ret_val >> 1) ; // *2.5~=312.5/2^7
+ ret_val = ret_val | BIT12; // set bit12 as 1 for negative cfo
+ }
+ else
+ {
+ ret_val = Value;
+ ret_val = (ret_val << 1) + (ret_val>>1) ; // *2.5~=312.5/2^7
+ }
+ return ret_val;
+}
+
+
+VOID
+odm_RxPhyStatus92CSeries_Parsing(
+ IN OUT PDM_ODM_T pDM_Odm,
+ OUT PODM_PHY_INFO_T pPhyInfo,
+ IN pu1Byte pPhyStatus,
+ IN PODM_PACKET_INFO_T pPktinfo
+ )
+{
+ SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
+ u1Byte i, Max_spatial_stream;
+ s1Byte rx_pwr[4], rx_pwr_all=0;
+ u1Byte EVM, PWDB_ALL = 0, PWDB_ALL_BT;
+ u1Byte RSSI, total_rssi=0;
+ BOOLEAN isCCKrate=FALSE;
+ u1Byte rf_rx_num = 0;
+ u1Byte cck_highpwr = 0;
+ u1Byte LNA_idx, VGA_idx;
+ PPHY_STATUS_RPT_8192CD_T pPhyStaRpt = (PPHY_STATUS_RPT_8192CD_T)pPhyStatus;
+
+ isCCKrate = (pPktinfo->DataRate <= DESC_RATE11M)?TRUE :FALSE;
+ pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = -1;
+ pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1;
+
+
+ if(isCCKrate)
+ {
+ u1Byte report;
+ u1Byte cck_agc_rpt;
+
+ pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++;
+ //
+ // (1)Hardware does not provide RSSI for CCK
+ // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
+ //
+
+ //if(pHalData->eRFPowerState == eRfOn)
+ cck_highpwr = pDM_Odm->bCckHighPower;
+ //else
+ // cck_highpwr = FALSE;
+
+ cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ;
+
+ //2011.11.28 LukeLee: 88E use different LNA & VGA gain table
+ //The RSSI formula should be modified according to the gain table
+ //In 88E, cck_highpwr is always set to 1
+ if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B))
+ {
+ LNA_idx = ((cck_agc_rpt & 0xE0) >>5);
+ VGA_idx = (cck_agc_rpt & 0x1F);
+ if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8192E))
+ {
+ switch(LNA_idx)
+ {
+ case 7:
+ if(VGA_idx <= 27)
+ rx_pwr_all = -100 + 2*(27-VGA_idx); //VGA_idx = 27~2
+ else
+ rx_pwr_all = -100;
+ break;
+ case 6:
+ rx_pwr_all = -48 + 2*(2-VGA_idx); //VGA_idx = 2~0
+ break;
+ case 5:
+ rx_pwr_all = -42 + 2*(7-VGA_idx); //VGA_idx = 7~5
+ break;
+ case 4:
+ rx_pwr_all = -36 + 2*(7-VGA_idx); //VGA_idx = 7~4
+ break;
+ case 3:
+ //rx_pwr_all = -28 + 2*(7-VGA_idx); //VGA_idx = 7~0
+ rx_pwr_all = -24 + 2*(7-VGA_idx); //VGA_idx = 7~0
+ break;
+ case 2:
+ if(cck_highpwr)
+ rx_pwr_all = -12 + 2*(5-VGA_idx); //VGA_idx = 5~0
+ else
+ rx_pwr_all = -6+ 2*(5-VGA_idx);
+ break;
+ case 1:
+ rx_pwr_all = 8-2*VGA_idx;
+ break;
+ case 0:
+ rx_pwr_all = 14-2*VGA_idx;
+ break;
+ default:
+ //DbgPrint("CCK Exception default\n");
+ break;
+ }
+ rx_pwr_all += 6;
+
+ //2012.10.08 LukeLee: Modify for 92E CCK RSSI
+ if(pDM_Odm->SupportICType == ODM_RTL8192E)
+ rx_pwr_all += 10;
+
+ PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
+ if(cck_highpwr == FALSE)
+ {
+ if(PWDB_ALL >= 80)
+ PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80;
+ else if((PWDB_ALL <= 78) && (PWDB_ALL >= 20))
+ PWDB_ALL += 3;
+ if(PWDB_ALL>100)
+ PWDB_ALL = 100;
+ }
+ }
+ else if(pDM_Odm->SupportICType & (ODM_RTL8723B))
+ {
+#if (RTL8723B_SUPPORT == 1)
+ rx_pwr_all = odm_CCKRSSI_8723B(LNA_idx,VGA_idx);
+ PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
+ if(PWDB_ALL>100)
+ PWDB_ALL = 100;
+#endif
+ }
+ }
+ else
+ {
+ if(!cck_highpwr)
+ {
+ report =( cck_agc_rpt & 0xc0 )>>6;
+ switch(report)
+ {
+ // 03312009 modified by cosa
+ // Modify the RF RNA gain value to -40, -20, -2, 14 by Jenyu's suggestion
+ // Note: different RF with the different RNA gain.
+ case 0x3:
+ rx_pwr_all = -46 - (cck_agc_rpt & 0x3e);
+ break;
+ case 0x2:
+ rx_pwr_all = -26 - (cck_agc_rpt & 0x3e);
+ break;
+ case 0x1:
+ rx_pwr_all = -12 - (cck_agc_rpt & 0x3e);
+ break;
+ case 0x0:
+ rx_pwr_all = 16 - (cck_agc_rpt & 0x3e);
+ break;
+ }
+ }
+ else
+ {
+ //report = pDrvInfo->cfosho[0] & 0x60;
+ //report = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a& 0x60;
+
+ report = (cck_agc_rpt & 0x60)>>5;
+ switch(report)
+ {
+ case 0x3:
+ rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f)<<1) ;
+ break;
+ case 0x2:
+ rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f)<<1);
+ break;
+ case 0x1:
+ rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f)<<1) ;
+ break;
+ case 0x0:
+ rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f)<<1) ;
+ break;
+ }
+ }
+
+ PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
+
+ //Modification for ext-LNA board
+ if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))
+ {
+ if((cck_agc_rpt>>7) == 0){
+ PWDB_ALL = (PWDB_ALL>94)?100:(PWDB_ALL +6);
+ }
+ else
+ {
+ if(PWDB_ALL > 38)
+ PWDB_ALL -= 16;
+ else
+ PWDB_ALL = (PWDB_ALL<=16)?(PWDB_ALL>>2):(PWDB_ALL -12);
+ }
+
+ //CCK modification
+ if(PWDB_ALL > 25 && PWDB_ALL <= 60)
+ PWDB_ALL += 6;
+ //else if (PWDB_ALL <= 25)
+ // PWDB_ALL += 8;
+ }
+ else//Modification for int-LNA board
+ {
+ if(PWDB_ALL > 99)
+ PWDB_ALL -= 8;
+ else if(PWDB_ALL > 50 && PWDB_ALL <= 68)
+ PWDB_ALL += 4;
+ }
+ }
+
+ pPhyInfo->RxPWDBAll = PWDB_ALL;
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+ pPhyInfo->BTRxRSSIPercentage = PWDB_ALL;
+ pPhyInfo->RecvSignalPower = rx_pwr_all;
+#endif
+ //
+ // (3) Get Signal Quality (EVM)
+ //
+ //if(pPktinfo->bPacketMatchBSSID)
+ {
+ u1Byte SQ,SQ_rpt;
+
+ if((pDM_Odm->SupportPlatform == ODM_WIN) &&
+ (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((pDM_Odm->SupportPlatform == ODM_WIN) &&
+ (pDM_Odm->PatchID==RT_CID_819x_Acer))
+ {
+ SQ = odm_SQ_process_patch_RT_CID_819x_Acer(pDM_Odm,isCCKrate,PWDB_ALL,0,0);
+ }
+ else if(pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest){
+ SQ = 100;
+ }
+ else{
+ SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all;
+
+ if(SQ_rpt > 64)
+ SQ = 0;
+ else if (SQ_rpt < 20)
+ SQ = 100;
+ else
+ SQ = ((64-SQ_rpt) * 100) / 44;
+
+ }
+
+ //DbgPrint("cck SQ = %d\n", SQ);
+ pPhyInfo->SignalQuality = SQ;
+ pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = SQ;
+ pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1;
+ }
+ }
+ else //is OFDM rate
+ {
+ pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++;
+
+ //
+ // (1)Get RSSI for HT rate
+ //
+
+ for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++)
+ {
+ // 2008/01/30 MH we will judge RF RX path now.
+ if (pDM_Odm->RFPathRxEnable & BIT(i))
+ rf_rx_num++;
+ //else
+ //continue;
+
+ rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain& 0x3F)*2) - 110;
+
+
+ #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+ pPhyInfo->RxPwr[i] = rx_pwr[i];
+ #endif
+
+ /* Translate DBM to percentage. */
+ RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]);
+ total_rssi += RSSI;
+ //RT_DISP(FRX, RX_PHY_SS, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], RSSI));
+
+ //Modification for ext-LNA board
+ if(pDM_Odm->SupportICType&ODM_RTL8192C)
+ {
+ if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))
+ {
+ if((pPhyStaRpt->path_agc[i].trsw) == 1)
+ RSSI = (RSSI>94)?100:(RSSI +6);
+ else
+ RSSI = (RSSI<=16)?(RSSI>>3):(RSSI -16);
+
+ if((RSSI <= 34) && (RSSI >=4))
+ RSSI -= 4;
+ }
+ }
+
+ pPhyInfo->RxMIMOSignalStrength[i] =(u1Byte) RSSI;
+
+ #if (DM_ODM_SUPPORT_TYPE & (/*ODM_WIN|*/ODM_CE|ODM_AP|ODM_ADSL))
+ //Get Rx snr value in DB
+ pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = (s4Byte)(pPhyStaRpt->path_rxsnr[i]/2);
+ #endif
+
+ /* Record Signal Strength for next packet */
+ //if(pPktinfo->bPacketMatchBSSID)
+ {
+ if((pDM_Odm->SupportPlatform == ODM_WIN) &&
+ (pDM_Odm->PatchID==RT_CID_819x_Lenovo))
+ {
+ if(i==ODM_RF_PATH_A)
+ pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,i,RSSI);
+
+ }
+ else if((pDM_Odm->SupportPlatform == ODM_WIN) &&
+ (pDM_Odm->PatchID==RT_CID_819x_Acer))
+ {
+ pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Acer(pDM_Odm,isCCKrate,PWDB_ALL,0,RSSI);
+ }
+
+ }
+ }
+
+
+ //
+ // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
+ //
+ rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1 )& 0x7f) -110;
+
+ PWDB_ALL_BT = PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
+ //RT_DISP(FRX, RX_PHY_SS, ("PWDB_ALL=%d\n",PWDB_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))
+ pPhyInfo->BTRxRSSIPercentage = PWDB_ALL_BT;
+ pPhyInfo->RxPower = rx_pwr_all;
+ pPhyInfo->RecvSignalPower = rx_pwr_all;
+ #endif
+
+ if((pDM_Odm->SupportPlatform == ODM_WIN) &&(pDM_Odm->PatchID==19)){
+ //do nothing
+ }else if((pDM_Odm->SupportPlatform == ODM_WIN) &&(pDM_Odm->PatchID==25)){
+ //do nothing
+ }
+ else{//pMgntInfo->CustomerID != RT_CID_819x_Lenovo
+ //
+ // (3)EVM of HT rate
+ //
+ if(pPktinfo->DataRate >=DESC_RATEMCS8 && pPktinfo->DataRate <=DESC_RATEMCS15)
+ Max_spatial_stream = 2; //both spatial stream make sense
+ else
+ Max_spatial_stream = 1; //only spatial stream 1 makes sense
+
+ for(i=0; i<Max_spatial_stream; i++)
+ {
+ // Do not use shift operation like "rx_evmX >>= 1" because the compilor of free build environment
+ // fill most significant bit to "zero" when doing shifting operation which may change a negative
+ // value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore.
+ EVM = odm_EVMdbToPercentage( (pPhyStaRpt->stream_rxevm[i] )); //dbm
+
+ //RT_DISP(FRX, RX_PHY_SQ, ("RXRATE=%x RXEVM=%x EVM=%s%d\n",
+ //GET_RX_STATUS_DESC_RX_MCS(pDesc), pDrvInfo->rxevm[i], "%", EVM));
+
+ //if(pPktinfo->bPacketMatchBSSID)
+ {
+ if(i==ODM_RF_PATH_A) // Fill value in RFD, Get the first spatial stream only
+ {
+ pPhyInfo->SignalQuality = (u1Byte)(EVM & 0xff);
+ }
+ pPhyInfo->RxMIMOSignalQuality[i] = (u1Byte)(EVM & 0xff);
+ }
+ }
+ }
+
+ //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]));
+ }
+ }
+
+ }
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+ //UI BSS List signal strength(in percentage), make it good looking, from 0~100.
+ //It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().
+ if(isCCKrate)
+ {
+#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
+ {
+ if (rf_rx_num != 0)
+ {
+#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
+ }
+ }
+#endif
+
+ //DbgPrint("isCCKrate = %d, pPhyInfo->RxPWDBAll = %d, pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a = 0x%x\n",
+ //isCCKrate, pPhyInfo->RxPWDBAll, pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a);
+
+ //For 92C/92D HW (Hybrid) Antenna Diversity
+#if(defined(CONFIG_HW_ANTENNA_DIVERSITY))
+ pDM_SWAT_Table->antsel = pPhyStaRpt->ant_sel;
+ //For 88E HW Antenna Diversity
+ pDM_Odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->ant_sel;
+ pDM_Odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->ant_sel_b;
+ pDM_Odm->DM_FatTable.antsel_rx_keep_2 = pPhyStaRpt->antsel_rx_keep_2;
+#endif
+}
+
+#if ODM_IC_11AC_SERIES_SUPPORT
+
+VOID
+odm_RxPhyStatusJaguarSeries_Parsing(
+ IN OUT PDM_ODM_T pDM_Odm,
+ OUT PODM_PHY_INFO_T pPhyInfo,
+ IN pu1Byte pPhyStatus,
+ IN PODM_PACKET_INFO_T pPktinfo
+ )
+{
+ u1Byte i, Max_spatial_stream;
+ s1Byte rx_pwr[4], rx_pwr_all=0;
+ u1Byte EVM = 0, EVMdbm, PWDB_ALL = 0, PWDB_ALL_BT;
+ u1Byte RSSI, total_rssi=0;
+ u1Byte isCCKrate=0;
+ u1Byte rf_rx_num = 0;
+ u1Byte cck_highpwr = 0;
+ u1Byte LNA_idx, VGA_idx;
+
+
+ PPHY_STATUS_RPT_8812_T pPhyStaRpt = (PPHY_STATUS_RPT_8812_T)pPhyStatus;
+
+ if(pPktinfo->DataRate <= DESC_RATE54M)
+ {
+ switch(pPhyStaRpt->r_RFMOD){
+ case 1:
+ if(pPhyStaRpt->sub_chnl == 0)
+ pPhyInfo->BandWidth = 1;
+ else
+ pPhyInfo->BandWidth = 0;
+ break;
+
+ case 2:
+ if(pPhyStaRpt->sub_chnl == 0)
+ pPhyInfo->BandWidth = 2;
+ else if(pPhyStaRpt->sub_chnl == 9 || pPhyStaRpt->sub_chnl == 10)
+ pPhyInfo->BandWidth = 1;
+ else
+ pPhyInfo->BandWidth = 0;
+ break;
+
+ default: case 0:
+ pPhyInfo->BandWidth = 0;
+ break;
+ }
+ }
+
+ if(pPktinfo->DataRate <= DESC_RATE11M)
+ isCCKrate = TRUE;
+ else
+ isCCKrate = FALSE;
+
+ pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = -1;
+ pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1;
+
+
+ if(isCCKrate)
+ {
+ u1Byte cck_agc_rpt;
+ pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++;
+ //
+ // (1)Hardware does not provide RSSI for CCK
+ // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
+ //
+
+ //if(pHalData->eRFPowerState == eRfOn)
+ cck_highpwr = pDM_Odm->bCckHighPower;
+ //else
+ // 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)
+ {
+ case 7:
+ if(VGA_idx <= 27)
+ rx_pwr_all = -100 + 2*(27-VGA_idx); //VGA_idx = 27~2
+ else
+ rx_pwr_all = -100;
+ break;
+ case 6:
+ rx_pwr_all = -48 + 2*(2-VGA_idx); //VGA_idx = 2~0
+ break;
+ case 5:
+ rx_pwr_all = -42 + 2*(7-VGA_idx); //VGA_idx = 7~5
+ break;
+ case 4:
+ rx_pwr_all = -36 + 2*(7-VGA_idx); //VGA_idx = 7~4
+ break;
+ case 3:
+ //rx_pwr_all = -28 + 2*(7-VGA_idx); //VGA_idx = 7~0
+ rx_pwr_all = -24 + 2*(7-VGA_idx); //VGA_idx = 7~0
+ break;
+ case 2:
+ if(cck_highpwr)
+ rx_pwr_all = -12 + 2*(5-VGA_idx); //VGA_idx = 5~0
+ else
+ rx_pwr_all = -6+ 2*(5-VGA_idx);
+ break;
+ case 1:
+ rx_pwr_all = 8-2*VGA_idx;
+ break;
+ case 0:
+ rx_pwr_all = 14-2*VGA_idx;
+ break;
+ default:
+ //DbgPrint("CCK Exception default\n");
+ break;
+ }
+ rx_pwr_all += 6;
+ PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
+ if(cck_highpwr == FALSE)
+ {
+ if(PWDB_ALL >= 80)
+ PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80;
+ else if((PWDB_ALL <= 78) && (PWDB_ALL >= 20))
+ PWDB_ALL += 3;
+ if(PWDB_ALL>100)
+ PWDB_ALL = 100;
+ }
+ }
+ else if(pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+ s1Byte Pout = -6;
+
+ switch(LNA_idx)
+ {
+ case 5:
+ rx_pwr_all = Pout -32 -(2*VGA_idx);
+ break;
+ case 4:
+ rx_pwr_all = Pout -24 -(2*VGA_idx);
+ break;
+ case 2:
+ rx_pwr_all = Pout -11 -(2*VGA_idx);
+ break;
+ case 1:
+ rx_pwr_all = Pout + 5 -(2*VGA_idx);
+ break;
+ case 0:
+ rx_pwr_all = Pout + 21 -(2*VGA_idx);
+ break;
+ }
+ PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
+ }
+
+ pPhyInfo->RxPWDBAll = PWDB_ALL;
+ //if(pPktinfo->StationID == 0)
+ //{
+ // DbgPrint("CCK: LNA_idx = %d, VGA_idx = %d, pPhyInfo->RxPWDBAll = %d\n",
+ // LNA_idx, VGA_idx, pPhyInfo->RxPWDBAll);
+ //}
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+ pPhyInfo->BTRxRSSIPercentage = PWDB_ALL;
+ pPhyInfo->RecvSignalPower = rx_pwr_all;
+#endif
+ //
+ // (3) Get Signal Quality (EVM)
+ //
+ //if(pPktinfo->bPacketMatchBSSID)
+ {
+ u1Byte SQ,SQ_rpt;
+
+ if((pDM_Odm->SupportPlatform == ODM_WIN) &&
+ (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){
+ SQ = 100;
+ }
+ else{
+ SQ_rpt = pPhyStaRpt->pwdb_all;
+
+ if(SQ_rpt > 64)
+ SQ = 0;
+ else if (SQ_rpt < 20)
+ SQ = 100;
+ else
+ SQ = ((64-SQ_rpt) * 100) / 44;
+
+ }
+
+ //DbgPrint("cck SQ = %d\n", SQ);
+ pPhyInfo->SignalQuality = SQ;
+ pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = SQ;
+ pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1;
+ }
+ }
+ else //is OFDM rate
+ {
+ pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++;
+
+ //
+ // (1)Get RSSI for OFDM rate
+ //
+
+ for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++)
+ {
+ // 2008/01/30 MH we will judge RF RX path now.
+ //DbgPrint("pDM_Odm->RFPathRxEnable = %x\n", pDM_Odm->RFPathRxEnable);
+ if (pDM_Odm->RFPathRxEnable & BIT(i))
+ {
+ rf_rx_num++;
+ }
+ //else
+ //continue;
+ //2012.05.25 LukeLee: Testchip AGC report is wrong, it should be restored back to old formula in MP chip
+ //if((pDM_Odm->SupportICType & (ODM_RTL8812|ODM_RTL8821)) && (!pDM_Odm->bIsMPChip))
+ rx_pwr[i] = (pPhyStaRpt->gain_trsw[i]&0x7F) - 110;
+ //else
+ // rx_pwr[i] = ((pPhyStaRpt->gain_trsw[i]& 0x3F)*2) - 110; //OLD FORMULA
+
+ #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+ pPhyInfo->RxPwr[i] = rx_pwr[i];
+ #endif
+
+ /* Translate DBM to percentage. */
+ RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]);
+
+ total_rssi += RSSI;
+ //RT_DISP(FRX, RX_PHY_SS, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], RSSI));
+
+
+
+ pPhyInfo->RxMIMOSignalStrength[i] =(u1Byte) RSSI;
+
+ #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE|ODM_AP|ODM_ADSL))
+ //Get Rx snr value in DB
+ pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = pPhyStaRpt->rxsnr[i]/2;
+ #endif
+
+ //
+ // (2) CFO_short & CFO_tail
+ //
+ pPhyInfo->Cfo_short[i] = odm_Cfo( (pPhyStaRpt->cfosho[i]) );
+ pPhyInfo->Cfo_tail[i] = odm_Cfo( (pPhyStaRpt->cfotail[i]) );
+
+ /* Record Signal Strength for next packet */
+ //if(pPktinfo->bPacketMatchBSSID)
+ {
+ if((pDM_Odm->SupportPlatform == ODM_WIN) &&
+ (pDM_Odm->PatchID==RT_CID_819x_Lenovo))
+ {
+ if(i==ODM_RF_PATH_A)
+ pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,i,RSSI);
+
+ }
+ }
+ }
+
+
+ //
+ // (3)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
+ //
+ //2012.05.25 LukeLee: Testchip AGC report is wrong, it should be restored back to old formula in MP chip
+ if((pDM_Odm->SupportICType & (ODM_RTL8812|ODM_RTL8821)) && (!pDM_Odm->bIsMPChip))
+ rx_pwr_all = (pPhyStaRpt->pwdb_all& 0x7f) -110;
+ 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))
+ pPhyInfo->BTRxRSSIPercentage = PWDB_ALL_BT;
+ pPhyInfo->RxPower = rx_pwr_all;
+ pPhyInfo->RecvSignalPower = rx_pwr_all;
+ #endif
+
+ //DbgPrint("OFDM: pPhyInfo->RxPWDBAll = %d, pPhyInfo->RxMIMOSignalStrength[0] = %d, pPhyInfo->RxMIMOSignalStrength[1] = %d\n",
+ // pPhyInfo->RxPWDBAll, pPhyInfo->RxMIMOSignalStrength[0], pPhyInfo->RxMIMOSignalStrength[1]);
+
+
+ if((pDM_Odm->SupportPlatform == ODM_WIN) &&(pDM_Odm->PatchID==19)){
+ //do nothing
+ }
+ else{//pMgntInfo->CustomerID != RT_CID_819x_Lenovo
+ //
+ // (4)EVM of OFDM rate
+ //
+ if( (pPktinfo->DataRate>=DESC_RATEMCS8) &&
+ (pPktinfo->DataRate <=DESC_RATEMCS15))
+ Max_spatial_stream = 2;
+ else if( (pPktinfo->DataRate>=DESC_RATEVHTSS2MCS0) &&
+ (pPktinfo->DataRate <=DESC_RATEVHTSS2MCS9))
+ Max_spatial_stream = 2;
+ else
+ Max_spatial_stream = 1;
+
+ //if(pPktinfo->bPacketMatchBSSID)
+ {
+ //DbgPrint("pPktinfo->DataRate = %d\n", pPktinfo->DataRate);
+
+ for(i=0; i<Max_spatial_stream; i++)
+ {
+ // Do not use shift operation like "rx_evmX >>= 1" because the compilor of free build environment
+ // fill most significant bit to "zero" when doing shifting operation which may change a negative
+ // value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore.
+ //
+ // 2013/09/02 MH According to 8812AU test, when use RX evm the value sometimes
+ // will be incorrect and 1SS-MCS-0-7 always incorrect. Only use LSIG the evm value
+ // seems ok. This seems BB bug, we need use another way to display better SQ.
+ //
+ //if (pPktinfo->DataRate>=DESC8812_RATE6M && pPktinfo->DataRate<=DESC8812_RATE54M)
+ {
+
+ if(i==ODM_RF_PATH_A )
+ {
+ EVM = odm_EVMdbToPercentage( (pPhyStaRpt->sigevm )); //dbm
+ EVM += 20;
+ if (EVM > 100)
+ EVM = 100;
+ }
+ }
+#if 0
+ else
+ {
+ if (pPhyStaRpt->rxevm[i] == -128)
+ {
+ pPhyStaRpt->rxevm[i] = -25;
+ }
+ EVM = odm_EVMdbToPercentage( (pPhyStaRpt->rxevm[i] )); //dbm
+ }
+#endif
+ EVMdbm = odm_EVMdbm_JaguarSeries(pPhyStaRpt->rxevm[i]);
+ //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
+ {
+ pPhyInfo->SignalQuality = EVM;
+ }
+ pPhyInfo->RxMIMOSignalQuality[i] = EVM;
+ pPhyInfo->RxMIMOEVMdbm[i] = EVMdbm;
+ }
+ }
+ }
+ }
+ //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]));
+ }
+ }
+ }
+ //DbgPrint("isCCKrate= %d, pPhyInfo->SignalStrength=%d % PWDB_AL=%d rf_rx_num=%d\n", isCCKrate, pPhyInfo->SignalStrength, PWDB_ALL, rf_rx_num);
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+ //UI BSS List signal strength(in percentage), make it good looking, from 0~100.
+ //It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().
+ if(isCCKrate)
+ {
+#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
+ pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));//PWDB_ALL;
+#endif
+ }
+ else
+ {
+ if (rf_rx_num != 0)
+ {
+#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
+ pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, total_rssi/=rf_rx_num));
+#endif
+ }
+ }
+#endif
+ pDM_Odm->RxPWDBAve = pDM_Odm->RxPWDBAve + pPhyInfo->RxPWDBAll;
+
+ pDM_Odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->antidx_anta;
+ pDM_Odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->antidx_antb;
+
+ //DbgPrint("pPhyStaRpt->antidx_anta = %d, pPhyStaRpt->antidx_antb = %d, pPhyStaRpt->resvd_1 = %d",
+ // pPhyStaRpt->antidx_anta, pPhyStaRpt->antidx_antb, pPhyStaRpt->resvd_1);
+
+ //DbgPrint("----------------------------\n");
+ //DbgPrint("pPktinfo->StationID=%d, pPktinfo->DataRate=0x%x\n",pPktinfo->StationID, pPktinfo->DataRate);
+ //DbgPrint("pPhyStaRpt->gain_trsw[0]=0x%x, pPhyStaRpt->gain_trsw[1]=0x%x, pPhyStaRpt->pwdb_all=0x%x\n",
+ // pPhyStaRpt->gain_trsw[0],pPhyStaRpt->gain_trsw[1], pPhyStaRpt->pwdb_all);
+ //DbgPrint("pPhyInfo->RxMIMOSignalStrength[0]=%d, pPhyInfo->RxMIMOSignalStrength[1]=%d, RxPWDBAll=%d\n",
+ // pPhyInfo->RxMIMOSignalStrength[0], pPhyInfo->RxMIMOSignalStrength[1], pPhyInfo->RxPWDBAll);
+
+}
+
+#endif
+
+VOID
+odm_Init_RSSIForDM(
+ IN OUT PDM_ODM_T pDM_Odm
+ )
+{
+
+}
+
+VOID
+odm_Process_RSSIForDM(
+ IN OUT PDM_ODM_T pDM_Odm,
+ IN PODM_PHY_INFO_T pPhyInfo,
+ IN PODM_PACKET_INFO_T pPktinfo
+ )
+{
+
+ s4Byte UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK, UndecoratedSmoothedOFDM, RSSI_Ave;
+ u1Byte isCCKrate=0;
+ u1Byte RSSI_max, RSSI_min, i;
+ u4Byte OFDM_pkt=0;
+ u4Byte Weighting=0;
+ PSTA_INFO_T pEntry;
+
+
+ if (pPktinfo->StationID >= ODM_ASSOCIATE_ENTRY_NUM)
+ return;
+
+ //
+ // 2012/05/30 MH/Luke.Lee Add some description
+ // In windows driver: AP/IBSS mode STA
+ //
+ //if (pDM_Odm->SupportPlatform == ODM_WIN)
+ //{
+ // pEntry = pDM_Odm->pODM_StaInfo[pDM_Odm->pAidMap[pPktinfo->StationID-1]];
+ //}
+ //else
+ pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID];
+
+ if(!IS_STA_VALID(pEntry) ){
+ return;
+ }
+ if((!pPktinfo->bPacketMatchBSSID) )
+ {
+ return;
+ }
+
+ if(pPktinfo->bPacketBeacon)
+ pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++;
+
+ isCCKrate = (pPktinfo->DataRate <= DESC_RATE11M)?TRUE :FALSE;
+ pDM_Odm->RxRate = pPktinfo->DataRate;
+ /*
+ if(!isCCKrate)
+ {
+ DbgPrint("OFDM: pPktinfo->StationID=%d, isCCKrate=%d, pPhyInfo->RxPWDBAll=%d\n",
+ pPktinfo->StationID, isCCKrate, pPhyInfo->RxPWDBAll);
+ }
+ */
+
+ //--------------Statistic for antenna/path diversity------------------
+ if(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)
+ {
+ #if(defined(CONFIG_HW_ANTENNA_DIVERSITY))
+ ODM_Process_RSSIForAntDiv(pDM_Odm,pPhyInfo,pPktinfo);
+ #endif
+ }
+ else if(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)
+ {
+ #if (RTL8812A_SUPPORT == 1)
+ if(pDM_Odm->SupportICType == ODM_RTL8812)
+ {
+ pPATHDIV_T pDM_PathDiv = &pDM_Odm->DM_PathDiv;
+ if(pPktinfo->bPacketToSelf || pPktinfo->bPacketMatchBSSID)
+ {
+ if(pPktinfo->DataRate > DESC_RATE11M)
+ ODM_PathStatistics_8812A(pDM_Odm, pPktinfo->StationID, pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A],
+ pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]);
+ }
+ }
+ #endif
+ }
+
+ //-----------------Smart Antenna Debug Message------------------//
+
+ UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK;
+ UndecoratedSmoothedOFDM = pEntry->rssi_stat.UndecoratedSmoothedOFDM;
+ UndecoratedSmoothedPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB;
+
+ if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
+ {
+
+ if(!isCCKrate)//ofdm rate
+ {
+ if(pPhyInfo->RxMIMOSignalStrength[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;
+ }
+ else
+ {
+ //DbgPrint("pRfd->Status.RxMIMOSignalStrength[0] = %d, pRfd->Status.RxMIMOSignalStrength[1] = %d \n",
+ //pRfd->Status.RxMIMOSignalStrength[0], pRfd->Status.RxMIMOSignalStrength[1]);
+ pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A];
+ pDM_Odm->RSSI_B = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B];
+
+ if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B])
+ {
+ RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A];
+ RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B];
+ }
+ else
+ {
+ RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B];
+ RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A];
+ }
+ if((RSSI_max -RSSI_min) < 3)
+ RSSI_Ave = RSSI_max;
+ else if((RSSI_max -RSSI_min) < 6)
+ RSSI_Ave = RSSI_max - 1;
+ else if((RSSI_max -RSSI_min) < 10)
+ RSSI_Ave = RSSI_max - 2;
+ else
+ RSSI_Ave = RSSI_max - 3;
+ }
+
+ //1 Process OFDM RSSI
+ if(UndecoratedSmoothedOFDM <= 0) // initialize
+ {
+ UndecoratedSmoothedOFDM = pPhyInfo->RxPWDBAll;
+ }
+ else
+ {
+ if(pPhyInfo->RxPWDBAll > (u4Byte)UndecoratedSmoothedOFDM)
+ {
+ UndecoratedSmoothedOFDM =
+ ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) +
+ (RSSI_Ave)) /(Rx_Smooth_Factor);
+ UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM + 1;
+ }
+ else
+ {
+ UndecoratedSmoothedOFDM =
+ ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) +
+ (RSSI_Ave)) /(Rx_Smooth_Factor);
+ }
+ }
+
+ pEntry->rssi_stat.PacketMap = (pEntry->rssi_stat.PacketMap<<1) | BIT0;
+
+ }
+ else
+ {
+ RSSI_Ave = pPhyInfo->RxPWDBAll;
+ pDM_Odm->RSSI_A = (u1Byte) pPhyInfo->RxPWDBAll;
+ pDM_Odm->RSSI_B = 0;
+
+ //1 Process CCK RSSI
+ if(UndecoratedSmoothedCCK <= 0) // initialize
+ {
+ UndecoratedSmoothedCCK = pPhyInfo->RxPWDBAll;
+ }
+ else
+ {
+ if(pPhyInfo->RxPWDBAll > (u4Byte)UndecoratedSmoothedCCK)
+ {
+ UndecoratedSmoothedCCK =
+ ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) +
+ (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor);
+ UndecoratedSmoothedCCK = UndecoratedSmoothedCCK + 1;
+ }
+ else
+ {
+ UndecoratedSmoothedCCK =
+ ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) +
+ (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor);
+ }
+ }
+ pEntry->rssi_stat.PacketMap = pEntry->rssi_stat.PacketMap<<1;
+ }
+
+ //if(pEntry)
+ {
+ //2011.07.28 LukeLee: modified to prevent unstable CCK RSSI
+ if(pEntry->rssi_stat.ValidBit >= 64)
+ pEntry->rssi_stat.ValidBit = 64;
+ else
+ pEntry->rssi_stat.ValidBit++;
+
+ for(i=0; i<pEntry->rssi_stat.ValidBit; i++)
+ OFDM_pkt += (u1Byte)(pEntry->rssi_stat.PacketMap>>i)&BIT0;
+
+ if(pEntry->rssi_stat.ValidBit == 64)
+ {
+ Weighting = ((OFDM_pkt<<4) > 64)?64:(OFDM_pkt<<4);
+ UndecoratedSmoothedPWDB = (Weighting*UndecoratedSmoothedOFDM+(64-Weighting)*UndecoratedSmoothedCCK)>>6;
+ }
+ else
+ {
+ if(pEntry->rssi_stat.ValidBit != 0)
+ UndecoratedSmoothedPWDB = (OFDM_pkt*UndecoratedSmoothedOFDM+(pEntry->rssi_stat.ValidBit-OFDM_pkt)*UndecoratedSmoothedCCK)/pEntry->rssi_stat.ValidBit;
+ else
+ UndecoratedSmoothedPWDB = 0;
+ }
+
+ pEntry->rssi_stat.UndecoratedSmoothedCCK = UndecoratedSmoothedCCK;
+ pEntry->rssi_stat.UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM;
+ pEntry->rssi_stat.UndecoratedSmoothedPWDB = UndecoratedSmoothedPWDB;
+
+ //DbgPrint("OFDM_pkt=%d, Weighting=%d\n", OFDM_pkt, Weighting);
+ //DbgPrint("UndecoratedSmoothedOFDM=%d, UndecoratedSmoothedPWDB=%d, UndecoratedSmoothedCCK=%d\n",
+ // UndecoratedSmoothedOFDM, UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK);
+
+ }
+
+ }
+}
+
+
+//
+// Endianness before calling this API
+//
+VOID
+ODM_PhyStatusQuery_92CSeries(
+ IN OUT PDM_ODM_T pDM_Odm,
+ OUT PODM_PHY_INFO_T pPhyInfo,
+ IN pu1Byte pPhyStatus,
+ IN PODM_PACKET_INFO_T pPktinfo
+ )
+{
+
+ odm_RxPhyStatus92CSeries_Parsing(
+ pDM_Odm,
+ pPhyInfo,
+ pPhyStatus,
+ pPktinfo);
+
+ if( pDM_Odm->RSSI_test == TRUE)
+ {
+ // Select the packets to do RSSI checking for antenna switching.
+ if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon )
+ {
+ /*
+ #if 0//(DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ dm_SWAW_RSSI_Check(
+ Adapter,
+ (tmppAdapter!=NULL)?(tmppAdapter==Adapter):TRUE,
+ bPacketMatchBSSID,
+ pEntry,
+ pRfd);
+ #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ // Select the packets to do RSSI checking for antenna switching.
+ //odm_SwAntDivRSSICheck8192C(padapter, precvframe->u.hdr.attrib.RxPWDBAll);
+ #endif
+ */
+ ODM_SwAntDivChkPerPktRssi(pDM_Odm,pPktinfo->StationID,pPhyInfo);
+ }
+ }
+ else
+ {
+ odm_Process_RSSIForDM(pDM_Odm,pPhyInfo,pPktinfo);
+ }
+
+}
+
+
+
+//
+// Endianness before calling this API
+//
+VOID
+ODM_PhyStatusQuery_JaguarSeries(
+ IN OUT PDM_ODM_T pDM_Odm,
+ OUT PODM_PHY_INFO_T pPhyInfo,
+ IN pu1Byte pPhyStatus,
+ IN PODM_PACKET_INFO_T pPktinfo
+ )
+{
+ odm_RxPhyStatusJaguarSeries_Parsing(
+ pDM_Odm,
+ pPhyInfo,
+ pPhyStatus,
+ pPktinfo);
+
+ odm_Process_RSSIForDM(pDM_Odm,pPhyInfo,pPktinfo);
+}
+
+VOID
+ODM_PhyStatusQuery(
+ IN OUT PDM_ODM_T pDM_Odm,
+ OUT PODM_PHY_INFO_T pPhyInfo,
+ IN pu1Byte pPhyStatus,
+ IN PODM_PACKET_INFO_T pPktinfo
+ )
+{
+
+ if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES )
+ {
+ ODM_PhyStatusQuery_JaguarSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo);
+ }
+ else
+ {
+ ODM_PhyStatusQuery_92CSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo);
+ }
+}
+
+// For future use.
+VOID
+ODM_MacStatusQuery(
+ IN OUT PDM_ODM_T pDM_Odm,
+ IN pu1Byte pMacStatus,
+ IN u1Byte MacID,
+ IN BOOLEAN bPacketMatchBSSID,
+ IN BOOLEAN bPacketToSelf,
+ IN BOOLEAN bPacketBeacon
+ )
+{
+ // 2011/10/19 Driver team will handle in the future.
+
+}
+
+
+//
+// If you want to add a new IC, Please follow below template and generate a new one.
+//
+//
+
+HAL_STATUS
+ODM_ConfigRFWithHeaderFile(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_RF_Config_Type ConfigType,
+ IN ODM_RF_RADIO_PATH_E eRFPath
+ )
+{
+ PADAPTER Adapter = pDM_Odm->Adapter;
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
+ ("===>ODM_ConfigRFWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip"));
+ 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 (RTL8723A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8723A)
+ {
+ if(ConfigType == CONFIG_RF_RADIO) {
+ if(eRFPath == ODM_RF_PATH_A)
+ READ_AND_CONFIG_MP(8723A,_RadioA_1T);
+ }
+ }
+#endif
+
+#if (RTL8188E_SUPPORT == 1)
+ 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);
+ }
+ }
+ else if(ConfigType == CONFIG_RF_TXPWR_LMT) {
+ READ_AND_CONFIG(8188E,_TXPWR_LMT);
+ }
+ }
+#endif
+
+#if (RTL8812A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8812)
+ {
+ if(ConfigType == CONFIG_RF_RADIO) {
+ if(eRFPath == ODM_RF_PATH_A)
+ {
+ READ_AND_CONFIG(8812A,_RadioA);
+ }
+ else if(eRFPath == ODM_RF_PATH_B)
+ {
+ READ_AND_CONFIG(8812A,_RadioB);
+ }
+ }
+ else if(ConfigType == CONFIG_RF_TXPWR_LMT) {
+ READ_AND_CONFIG(8812A,_TXPWR_LMT);
+ }
+ }
+#endif
+
+#if (RTL8821A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+ if(ConfigType == CONFIG_RF_RADIO) {
+ if(eRFPath == ODM_RF_PATH_A)
+ {
+ READ_AND_CONFIG(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);
+ else
+ READ_AND_CONFIG(8821A,_TXPWR_LMT_8811AU_IPA);
+ } else {
+ READ_AND_CONFIG(8821A,_TXPWR_LMT_8821A);
+ }
+ }
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("<===8821_ODM_ConfigRFWithHeaderFile\n"));
+ }
+#endif
+
+#if (RTL8723B_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8723B)
+ {
+ if(ConfigType == CONFIG_RF_RADIO) {
+ READ_AND_CONFIG(8723B,_RadioA);
+ }
+ else if(ConfigType == CONFIG_RF_TXPWR_LMT) {
+ READ_AND_CONFIG(8723B,_TXPWR_LMT);
+ }
+ }
+#endif
+
+#if (RTL8192E_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8192E)
+ {
+ if(ConfigType == CONFIG_RF_RADIO) {
+ if(eRFPath == ODM_RF_PATH_A)
+ READ_AND_CONFIG(8192E,_RadioA);
+ else if(eRFPath == ODM_RF_PATH_B)
+ READ_AND_CONFIG(8192E,_RadioB);
+ }
+ else if(ConfigType == CONFIG_RF_TXPWR_LMT) {
+ READ_AND_CONFIG(8192E,_TXPWR_LMT);
+ }
+ }
+#endif
+
+#if (RTL8813A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8814A)
+ {
+ /*
+ if(ConfigType == CONFIG_RF_TXPWR_LMT) {
+ READ_AND_CONFIG(8813A,_TXPWR_LMT);
+ }
+ */
+ }
+#endif
+
+ return HAL_STATUS_SUCCESS;
+}
+
+HAL_STATUS
+ODM_ConfigRFWithTxPwrTrackHeaderFile(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
+ ("===>ODM_ConfigRFWithTxPwrTrackHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip"));
+ 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)
+ {
+ }
+#if (RTL8821A_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+ if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
+ READ_AND_CONFIG(8821A,_TxPowerTrack_PCIE);
+ else if (pDM_Odm->SupportInterface == ODM_ITRF_USB)
+ READ_AND_CONFIG(8821A,_TxPowerTrack_USB);
+ else
+ READ_AND_CONFIG(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);
+ 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);
+ }
+
+ }
+#endif
+#if (RTL8192E_SUPPORT == 1)
+ else if(pDM_Odm->SupportICType == ODM_RTL8192E)
+ {
+ if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
+ READ_AND_CONFIG(8192E,_TxPowerTrack_PCIE);
+ else if (pDM_Odm->SupportInterface == ODM_ITRF_USB)
+ READ_AND_CONFIG(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);
+ else if (pDM_Odm->SupportInterface == ODM_ITRF_USB)
+ READ_AND_CONFIG(8723B,_TxPowerTrack_USB);
+ else if (pDM_Odm->SupportInterface == ODM_ITRF_SDIO)
+ READ_AND_CONFIG(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);
+ else if (pDM_Odm->SupportInterface == ODM_ITRF_USB)
+ READ_AND_CONFIG(8188E,_TxPowerTrack_USB);
+ }
+#endif
+
+ return HAL_STATUS_SUCCESS;
+}
+
+HAL_STATUS
+ODM_ConfigBBWithHeaderFile(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_BB_Config_Type ConfigType
+ )
+{
+#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+ PADAPTER Adapter = pDM_Odm->Adapter;
+#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
+#endif
+#endif
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
+ ("===>ODM_ConfigBBWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip"));
+ 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 (RTL8723A_SUPPORT == 1)
+ if(pDM_Odm->SupportICType == ODM_RTL8723A)
+ {
+ if(ConfigType == CONFIG_BB_PHY_REG)
+ {
+ READ_AND_CONFIG_MP(8723A,_PHY_REG_1T);
+ }
+ else if(ConfigType == CONFIG_BB_AGC_TAB)
+ {
+ READ_AND_CONFIG_MP(8723A,_AGC_TAB_1T);
+ }
+ }
+#endif
+
+#if (RTL8188E_SUPPORT == 1)
+ if(pDM_Odm->SupportICType == ODM_RTL8188E)
+ {
+ 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);
+ }
+ 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);
+ }
+ else if(ConfigType == CONFIG_BB_PHY_REG_PG)
+ {
+ READ_AND_CONFIG(8188E,_PHY_REG_PG);
+ }
+ }
+#endif
+
+#if (RTL8812A_SUPPORT == 1)
+ if(pDM_Odm->SupportICType == ODM_RTL8812)
+ {
+ if(ConfigType == CONFIG_BB_PHY_REG)
+ {
+ READ_AND_CONFIG(8812A,_PHY_REG);
+ }
+ else if(ConfigType == CONFIG_BB_AGC_TAB)
+ {
+ READ_AND_CONFIG(8812A,_AGC_TAB);
+ }
+ else if(ConfigType == CONFIG_BB_PHY_REG_PG)
+ {
+ if (pDM_Odm->RFEType == 3 && pDM_Odm->bIsMPChip)
+ READ_AND_CONFIG_MP(8812A,_PHY_REG_PG_ASUS);
+#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ else if (pMgntInfo->CustomerID == RT_CID_WNC_NEC && pDM_Odm->bIsMPChip)
+ READ_AND_CONFIG_MP(8812A,_PHY_REG_PG_NEC);
+#endif
+ else
+ READ_AND_CONFIG(8812A,_PHY_REG_PG);
+ }
+ else if(ConfigType == CONFIG_BB_PHY_REG_MP)
+ {
+ READ_AND_CONFIG_MP(8812A,_PHY_REG_MP);
+ }
+ else if(ConfigType == CONFIG_BB_AGC_TAB_DIFF)
+ {
+ if ((36 <= *pDM_Odm->pChannel) && (*pDM_Odm->pChannel <= 64))
+ AGC_DIFF_CONFIG_MP(8812A,LB);
+ else if (100 <= *pDM_Odm->pChannel)
+ AGC_DIFF_CONFIG_MP(8812A,HB);
+ }
+ }
+#endif
+
+#if (RTL8821A_SUPPORT == 1)
+ if(pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+ if(ConfigType == CONFIG_BB_PHY_REG)
+ {
+ READ_AND_CONFIG(8821A,_PHY_REG);
+ }
+ else if(ConfigType == CONFIG_BB_AGC_TAB)
+ {
+ READ_AND_CONFIG(8821A,_AGC_TAB);
+ }
+ else if(ConfigType == CONFIG_BB_PHY_REG_PG)
+ {
+ READ_AND_CONFIG(8821A,_PHY_REG_PG);
+ }
+ }
+#endif
+#if (RTL8723B_SUPPORT == 1)
+ if(pDM_Odm->SupportICType == ODM_RTL8723B)
+ {
+
+ if(ConfigType == CONFIG_BB_PHY_REG)
+ {
+ READ_AND_CONFIG(8723B,_PHY_REG);
+ }
+ else if(ConfigType == CONFIG_BB_AGC_TAB)
+ {
+ READ_AND_CONFIG(8723B,_AGC_TAB);
+ }
+ else if(ConfigType == CONFIG_BB_PHY_REG_PG)
+ {
+ READ_AND_CONFIG(8723B,_PHY_REG_PG);
+ }
+ }
+#endif
+#if (RTL8192E_SUPPORT == 1)
+ if(pDM_Odm->SupportICType == ODM_RTL8192E)
+ {
+
+ if(ConfigType == CONFIG_BB_PHY_REG)
+ {
+ READ_AND_CONFIG(8192E,_PHY_REG);
+ }
+ else if(ConfigType == CONFIG_BB_AGC_TAB)
+ {
+ READ_AND_CONFIG(8192E,_AGC_TAB);
+ }
+ else if(ConfigType == CONFIG_BB_PHY_REG_PG)
+ {
+ READ_AND_CONFIG(8192E,_PHY_REG_PG);
+ }
+ }
+#endif
+#if (RTL8813A_SUPPORT == 1)
+ if(pDM_Odm->SupportICType == ODM_RTL8814A)
+ {
+
+ if(ConfigType == CONFIG_BB_PHY_REG)
+ {
+ READ_AND_CONFIG(8813A,_PHY_REG);
+ }
+ else if(ConfigType == CONFIG_BB_AGC_TAB)
+ {
+ READ_AND_CONFIG(8813A,_AGC_TAB);
+ }
+ else if(ConfigType == CONFIG_BB_PHY_REG_PG)
+ {
+ //READ_AND_CONFIG(8813A,_PHY_REG_PG);
+ }
+ }
+#endif
+ return HAL_STATUS_SUCCESS;
+}
+
+HAL_STATUS
+ODM_ConfigMACWithHeaderFile(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+ PADAPTER Adapter = pDM_Odm->Adapter;
+#endif
+ u1Byte result = HAL_STATUS_SUCCESS;
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
+ ("===>ODM_ConfigMACWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip"));
+ 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 (RTL8723A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8723A)
+ {
+ READ_AND_CONFIG_MP(8723A,_MAC_REG);
+ }
+#endif
+#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);
+ }
+#endif
+#if (RTL8812A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8812)
+ {
+ READ_AND_CONFIG(8812A,_MAC_REG);
+ }
+#endif
+#if (RTL8821A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+ READ_AND_CONFIG(8821A,_MAC_REG);
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("<===8821_ODM_ConfigMACwithHeaderFile\n"));
+ }
+#endif
+#if (RTL8723B_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8723B)
+ {
+ READ_AND_CONFIG(8723B,_MAC_REG);
+ }
+#endif
+#if (RTL8192E_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8192E)
+ {
+ READ_AND_CONFIG(8192E,_MAC_REG);
+ }
+#endif
+
+ return result;
+}
+
+HAL_STATUS
+ODM_ConfigFWWithHeaderFile(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_FW_Config_Type ConfigType,
+ OUT u1Byte *pFirmware,
+ OUT u4Byte *pSize
+ )
+{
+
+#if (RTL8188E_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8188E)
+ {
+ if (ConfigType == CONFIG_FW_NIC)
+ {
+ READ_FIRMWARE(8188E,_FW_NIC_T);
+ }
+ else if (ConfigType == CONFIG_FW_WoWLAN)
+ {
+ READ_FIRMWARE(8188E,_FW_WoWLAN_T);
+ }
+ else if(ConfigType == CONFIG_FW_NIC_2)
+ {
+ READ_FIRMWARE(8188E,_FW_NIC_S);
+ }
+ else if (ConfigType == CONFIG_FW_WoWLAN_2)
+ {
+ READ_FIRMWARE(8188E,_FW_WoWLAN_S);
+ }
+ }
+#endif
+#if (RTL8723B_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8723B)
+ {
+ if (ConfigType == CONFIG_FW_NIC)
+ {
+ READ_FIRMWARE(8723B,_FW_NIC);
+ }
+ else if (ConfigType == CONFIG_FW_WoWLAN)
+ {
+ READ_FIRMWARE(8723B,_FW_WoWLAN);
+ }
+#ifdef CONFIG_AP_WOWLAN
+ else if (ConfigType == CONFIG_FW_AP_WoWLAN)
+ {
+ READ_FIRMWARE(8723B,_FW_AP_WoWLAN);
+ }
+#endif
+ else if (ConfigType == CONFIG_FW_BT)
+ {
+ READ_FIRMWARE_MP(8723B,_FW_BT);
+ }
+ else if (ConfigType == CONFIG_FW_MP)
+ {
+ READ_FIRMWARE_MP(8723B,_FW_MP);
+ }
+ }
+#endif
+#if (RTL8812A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8812)
+ {
+ if (ConfigType == CONFIG_FW_NIC)
+ {
+ READ_FIRMWARE(8812A,_FW_NIC);
+ }
+ else if (ConfigType == CONFIG_FW_WoWLAN)
+ {
+ READ_FIRMWARE(8812A,_FW_WoWLAN);
+ }
+ else if (ConfigType == CONFIG_FW_BT)
+ {
+ READ_FIRMWARE(8812A,_FW_NIC_BT);
+ }
+
+ }
+#endif
+#if (RTL8821A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8821)
+ {
+ if (ConfigType == CONFIG_FW_NIC)
+ {
+ READ_FIRMWARE_MP(8821A,_FW_NIC);
+ }
+ else if (ConfigType == CONFIG_FW_WoWLAN)
+ {
+ READ_FIRMWARE(8821A,_FW_WoWLAN);
+ }
+ else if (ConfigType == CONFIG_FW_BT)
+ {
+ READ_FIRMWARE_MP(8821A,_FW_NIC_BT);
+ }
+ }
+#endif
+#if (RTL8192E_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8192E)
+ {
+ if (ConfigType == CONFIG_FW_NIC)
+ {
+ READ_FIRMWARE(8192E,_FW_NIC);
+ }
+ else if (ConfigType == CONFIG_FW_WoWLAN)
+ {
+ READ_FIRMWARE(8192E,_FW_WoWLAN);
+ }
+#ifdef CONFIG_AP_WOWLAN
+ else if (ConfigType == CONFIG_FW_AP_WoWLAN)
+ {
+ READ_FIRMWARE(8192E,_FW_AP_WoWLAN);
+ }
+#endif
+
+ }
+#endif
+ return HAL_STATUS_SUCCESS;
+}
+
+
+u4Byte
+ODM_GetHWImgVersion(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+
+#if (RTL8812A_SUPPORT == 1)
+ if (pDM_Odm->SupportICType == ODM_RTL8812)
+ return GET_VERSION_MP(8812A,_MAC_REG);
+#endif
+
+ return 0;
+}
+
+
+
+
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_HWConfig.h b/rtl8xxx_EU/hal/OUTSRC/odm_HWConfig.h
index 16a26f6..67aabcf 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_HWConfig.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_HWConfig.h
@@ -1,231 +1,237 @@
-/******************************************************************************
- *
- * 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 __HALHWOUTSRC_H__
-#define __HALHWOUTSRC_H__
-
-
-/*--------------------------Define -------------------------------------------*/
-#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, \
- sizeof(Array_TC_##ic##_AGC_TAB_DIFF_##band)/sizeof(u4Byte)))
-
-#define AGC_DIFF_CONFIG(ic, band) do {\
- if (pDM_Odm->bIsMPChip)\
- AGC_DIFF_CONFIG_MP(ic,band);\
- else\
- AGC_DIFF_CONFIG_TC(ic,band);\
- } while(0)
-
-
-//============================================================
-// structure and define
-//============================================================
-
-typedef struct _Phy_Rx_AGC_Info
-{
- #if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
- u1Byte gain:7,trsw:1;
- #else
- u1Byte trsw:1,gain:7;
- #endif
-} PHY_RX_AGC_INFO_T,*pPHY_RX_AGC_INFO_T;
-
-typedef struct _Phy_Status_Rpt_8192cd
-{
- PHY_RX_AGC_INFO_T path_agc[2];
- u1Byte ch_corr[2];
- u1Byte cck_sig_qual_ofdm_pwdb_all;
- u1Byte cck_agc_rpt_ofdm_cfosho_a;
- u1Byte cck_rpt_b_ofdm_cfosho_b;
- u1Byte rsvd_1;//ch_corr_msb;
- u1Byte noise_power_db_msb;
- s1Byte path_cfotail[2];
- u1Byte pcts_mask[2];
- s1Byte stream_rxevm[2];
- u1Byte path_rxsnr[2];
- u1Byte noise_power_db_lsb;
- u1Byte rsvd_2[3];
- u1Byte stream_csi[2];
- u1Byte stream_target_csi[2];
- s1Byte sig_evm;
- u1Byte rsvd_3;
-
-#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
- u1Byte antsel_rx_keep_2:1; //ex_intf_flg:1;
- u1Byte sgi_en:1;
- u1Byte rxsc:2;
- u1Byte idle_long:1;
- u1Byte r_ant_train_en:1;
- u1Byte ant_sel_b:1;
- u1Byte ant_sel:1;
-#else // _BIG_ENDIAN_
- u1Byte ant_sel:1;
- u1Byte ant_sel_b:1;
- u1Byte r_ant_train_en:1;
- u1Byte idle_long:1;
- u1Byte rxsc:2;
- u1Byte sgi_en:1;
- u1Byte antsel_rx_keep_2:1; //ex_intf_flg:1;
-#endif
-} PHY_STATUS_RPT_8192CD_T,*PPHY_STATUS_RPT_8192CD_T;
-
-
-typedef struct _Phy_Status_Rpt_8812
-{
-#if 0
- PHY_RX_AGC_INFO_T path_agc[2];
- u1Byte ch_num[2];
- u1Byte cck_sig_qual_ofdm_pwdb_all;
- u1Byte cck_agc_rpt_ofdm_cfosho_a;
- u1Byte cck_bb_pwr_ofdm_cfosho_b;
- u1Byte cck_rx_path; //CCK_RX_PATH [3:0] (with regA07[3:0] definition)
- u1Byte rsvd_1;
- u1Byte path_cfotail[2];
- u1Byte pcts_mask[2];
- s1Byte stream_rxevm[2];
- u1Byte path_rxsnr[2];
- u1Byte rsvd_2[2];
- u1Byte stream_snr[2];
- u1Byte stream_csi[2];
- u1Byte rsvd_3[2];
- s1Byte sig_evm;
- u1Byte rsvd_4;
-#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
- u1Byte antidx_anta:3;
- u1Byte antidx_antb:3;
- u1Byte rsvd_5:2;
-#else // _BIG_ENDIAN_
- u1Byte rsvd_5:2;
- u1Byte antidx_antb:3;
- u1Byte antidx_anta:3;
-#endif
-#endif
-
- //2012.05.24 LukeLee: This structure should take big/little endian in consideration later.....
-
- //DWORD 0
- u1Byte gain_trsw[2];
-#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
- u2Byte chl_num:10;
- u2Byte sub_chnl:4;
- u2Byte r_RFMOD:2;
-#else // _BIG_ENDIAN_
- u2Byte r_RFMOD:2;
- u2Byte sub_chnl:4;
- u2Byte chl_num:10;
-#endif
-
- //DWORD 1
- u1Byte pwdb_all;
- u1Byte cfosho[4]; // DW 1 byte 1 DW 2 byte 0
-
- //DWORD 2
- s1Byte cfotail[4]; // DW 2 byte 1 DW 3 byte 0
-
- //DWORD 3
- s1Byte rxevm[2]; // DW 3 byte 1 DW 3 byte 2
- s1Byte rxsnr[2]; // DW 3 byte 3 DW 4 byte 0
-
- //DWORD 4
- u1Byte PCTS_MSK_RPT[2];
- u1Byte pdsnr[2]; // DW 4 byte 3 DW 5 Byte 0
-
- //DWORD 5
- u1Byte csi_current[2];
- u1Byte rx_gain_c;
-
- //DWORD 6
- u1Byte rx_gain_d;
- s1Byte sigevm;
- u1Byte resvd_0;
- u1Byte antidx_anta:3;
- u1Byte antidx_antb:3;
- u1Byte resvd_1:2;
-} PHY_STATUS_RPT_8812_T,*PPHY_STATUS_RPT_8812_T;
-
-
-VOID
-odm_Init_RSSIForDM(
- IN OUT PDM_ODM_T pDM_Odm
- );
-
-VOID
-ODM_PhyStatusQuery(
- IN OUT PDM_ODM_T pDM_Odm,
- OUT PODM_PHY_INFO_T pPhyInfo,
- IN pu1Byte pPhyStatus,
- IN PODM_PACKET_INFO_T pPktinfo
- );
-
-VOID
-ODM_MacStatusQuery(
- IN OUT PDM_ODM_T pDM_Odm,
- IN pu1Byte pMacStatus,
- IN u1Byte MacID,
- IN BOOLEAN bPacketMatchBSSID,
- IN BOOLEAN bPacketToSelf,
- IN BOOLEAN bPacketBeacon
- );
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE|ODM_AP))
-
-HAL_STATUS
-ODM_ConfigRFWithTxPwrTrackHeaderFile(
- IN PDM_ODM_T pDM_Odm
- );
-
-HAL_STATUS
-ODM_ConfigRFWithHeaderFile(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_RF_Config_Type ConfigType,
- IN ODM_RF_RADIO_PATH_E eRFPath
- );
-
-HAL_STATUS
-ODM_ConfigBBWithHeaderFile(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_BB_Config_Type ConfigType
- );
-
-HAL_STATUS
-ODM_ConfigMACWithHeaderFile(
- IN PDM_ODM_T pDM_Odm
- );
-
-HAL_STATUS
-ODM_ConfigFWWithHeaderFile(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_FW_Config_Type ConfigType,
- OUT u1Byte *pFirmware,
- OUT u4Byte *pSize
- );
-
-u4Byte
-ODM_GetHWImgVersion(
- IN PDM_ODM_T pDM_Odm
- );
-
-#endif
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __HALHWOUTSRC_H__
+#define __HALHWOUTSRC_H__
+
+
+/*--------------------------Define -------------------------------------------*/
+#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, \
+ sizeof(Array_TC_##ic##_AGC_TAB_DIFF_##band)/sizeof(u4Byte)))
+
+#define AGC_DIFF_CONFIG(ic, band) do {\
+ if (pDM_Odm->bIsMPChip)\
+ AGC_DIFF_CONFIG_MP(ic,band);\
+ else\
+ AGC_DIFF_CONFIG_TC(ic,band);\
+ } while(0)
+
+
+//============================================================
+// structure and define
+//============================================================
+
+typedef struct _Phy_Rx_AGC_Info
+{
+ #if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
+ u1Byte gain:7,trsw:1;
+ #else
+ u1Byte trsw:1,gain:7;
+ #endif
+} PHY_RX_AGC_INFO_T,*pPHY_RX_AGC_INFO_T;
+
+typedef struct _Phy_Status_Rpt_8192cd
+{
+ PHY_RX_AGC_INFO_T path_agc[2];
+ u1Byte ch_corr[2];
+ u1Byte cck_sig_qual_ofdm_pwdb_all;
+ u1Byte cck_agc_rpt_ofdm_cfosho_a;
+ u1Byte cck_rpt_b_ofdm_cfosho_b;
+ u1Byte rsvd_1;//ch_corr_msb;
+ u1Byte noise_power_db_msb;
+ s1Byte path_cfotail[2];
+ u1Byte pcts_mask[2];
+ s1Byte stream_rxevm[2];
+ u1Byte path_rxsnr[2];
+ u1Byte noise_power_db_lsb;
+ u1Byte rsvd_2[3];
+ u1Byte stream_csi[2];
+ u1Byte stream_target_csi[2];
+ s1Byte sig_evm;
+ u1Byte rsvd_3;
+
+#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
+ u1Byte antsel_rx_keep_2:1; //ex_intf_flg:1;
+ u1Byte sgi_en:1;
+ u1Byte rxsc:2;
+ u1Byte idle_long:1;
+ u1Byte r_ant_train_en:1;
+ u1Byte ant_sel_b:1;
+ u1Byte ant_sel:1;
+#else // _BIG_ENDIAN_
+ u1Byte ant_sel:1;
+ u1Byte ant_sel_b:1;
+ u1Byte r_ant_train_en:1;
+ u1Byte idle_long:1;
+ u1Byte rxsc:2;
+ u1Byte sgi_en:1;
+ u1Byte antsel_rx_keep_2:1; //ex_intf_flg:1;
+#endif
+} PHY_STATUS_RPT_8192CD_T,*PPHY_STATUS_RPT_8192CD_T;
+
+
+typedef struct _Phy_Status_Rpt_8812
+{
+#if 0
+ PHY_RX_AGC_INFO_T path_agc[2];
+ u1Byte ch_num[2];
+ u1Byte cck_sig_qual_ofdm_pwdb_all;
+ u1Byte cck_agc_rpt_ofdm_cfosho_a;
+ u1Byte cck_bb_pwr_ofdm_cfosho_b;
+ u1Byte cck_rx_path; //CCK_RX_PATH [3:0] (with regA07[3:0] definition)
+ u1Byte rsvd_1;
+ u1Byte path_cfotail[2];
+ u1Byte pcts_mask[2];
+ s1Byte stream_rxevm[2];
+ u1Byte path_rxsnr[2];
+ u1Byte rsvd_2[2];
+ u1Byte stream_snr[2];
+ u1Byte stream_csi[2];
+ u1Byte rsvd_3[2];
+ s1Byte sig_evm;
+ u1Byte rsvd_4;
+#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
+ u1Byte antidx_anta:3;
+ u1Byte antidx_antb:3;
+ u1Byte rsvd_5:2;
+#else // _BIG_ENDIAN_
+ u1Byte rsvd_5:2;
+ u1Byte antidx_antb:3;
+ u1Byte antidx_anta:3;
+#endif
+#endif
+
+ //2012.05.24 LukeLee: This structure should take big/little endian in consideration later.....
+
+ //DWORD 0
+ u1Byte gain_trsw[2];
+#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
+ u2Byte chl_num:10;
+ u2Byte sub_chnl:4;
+ u2Byte r_RFMOD:2;
+#else // _BIG_ENDIAN_
+ u2Byte r_RFMOD:2;
+ u2Byte sub_chnl:4;
+ u2Byte chl_num:10;
+#endif
+
+ //DWORD 1
+ u1Byte pwdb_all;
+ u1Byte cfosho[4]; // DW 1 byte 1 DW 2 byte 0
+
+ //DWORD 2
+ s1Byte cfotail[4]; // DW 2 byte 1 DW 3 byte 0
+
+ //DWORD 3
+ s1Byte rxevm[2]; // DW 3 byte 1 DW 3 byte 2
+ s1Byte rxsnr[2]; // DW 3 byte 3 DW 4 byte 0
+
+ //DWORD 4
+ u1Byte PCTS_MSK_RPT[2];
+ u1Byte pdsnr[2]; // DW 4 byte 3 DW 5 Byte 0
+
+ //DWORD 5
+ u1Byte csi_current[2];
+ u1Byte rx_gain_c;
+
+ //DWORD 6
+ u1Byte rx_gain_d;
+ s1Byte sigevm;
+ u1Byte resvd_0;
+ u1Byte antidx_anta:3;
+ u1Byte antidx_antb:3;
+ u1Byte resvd_1:2;
+} PHY_STATUS_RPT_8812_T,*PPHY_STATUS_RPT_8812_T;
+
+
+VOID
+odm_Init_RSSIForDM(
+ IN OUT PDM_ODM_T pDM_Odm
+ );
+
+VOID
+ODM_PhyStatusQuery(
+ IN OUT PDM_ODM_T pDM_Odm,
+ OUT PODM_PHY_INFO_T pPhyInfo,
+ IN pu1Byte pPhyStatus,
+ IN PODM_PACKET_INFO_T pPktinfo
+ );
+
+VOID
+ODM_MacStatusQuery(
+ IN OUT PDM_ODM_T pDM_Odm,
+ IN pu1Byte pMacStatus,
+ IN u1Byte MacID,
+ IN BOOLEAN bPacketMatchBSSID,
+ IN BOOLEAN bPacketToSelf,
+ IN BOOLEAN bPacketBeacon
+ );
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE|ODM_AP))
+
+HAL_STATUS
+ODM_ConfigRFWithTxPwrTrackHeaderFile(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+HAL_STATUS
+ODM_ConfigRFWithHeaderFile(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_RF_Config_Type ConfigType,
+ IN ODM_RF_RADIO_PATH_E eRFPath
+ );
+
+HAL_STATUS
+ODM_ConfigBBWithHeaderFile(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_BB_Config_Type ConfigType
+ );
+
+HAL_STATUS
+ODM_ConfigMACWithHeaderFile(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+HAL_STATUS
+ODM_ConfigFWWithHeaderFile(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_FW_Config_Type ConfigType,
+ OUT u1Byte *pFirmware,
+ OUT u4Byte *pSize
+ );
+
+u4Byte
+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/rtl8xxx_EU/hal/OUTSRC/odm_RegDefine11AC.h b/rtl8xxx_EU/hal/OUTSRC/odm_RegDefine11AC.h
index 1193653..0619ccc 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_RegDefine11AC.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_RegDefine11AC.h
@@ -1,57 +1,81 @@
-/******************************************************************************
- *
- * 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 __ODM_REGDEFINE11AC_H__
-#define __ODM_REGDEFINE11AC_H__
-
-//2 RF REG LIST
-
-
-
-//2 BB REG LIST
-//PAGE 8
-#define ODM_REG_CCK_RPT_FORMAT_11AC 0x804
-#define ODM_REG_BB_RX_PATH_11AC 0x808
-//PAGE 9
-#define ODM_REG_OFDM_FA_RST_11AC 0x9A4
-//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 C
-#define ODM_REG_IGI_A_11AC 0xC50
-//PAGE E
-#define ODM_REG_IGI_B_11AC 0xE50
-//PAGE F
-#define ODM_REG_OFDM_FA_11AC 0xF48
-
-
-//2 MAC REG LIST
-#define ODM_REG_RESP_TX_11AC 0x6D8
-
-
-
-//DIG Related
-#define ODM_BIT_IGI_11AC 0xFFFFFFFF
-#define ODM_BIT_CCK_RPT_FORMAT_11AC BIT16
-#define ODM_BIT_BB_RX_PATH_11AC 0xF
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __ODM_REGDEFINE11AC_H__
+#define __ODM_REGDEFINE11AC_H__
+
+//2 RF REG LIST
+
+
+
+//2 BB REG LIST
+//PAGE 8
+#define ODM_REG_CCK_RPT_FORMAT_11AC 0x804
+#define ODM_REG_BB_RX_PATH_11AC 0x808
+#define ODM_REG_BB_TX_PATH_11AC 0x80c
+#define ODM_REG_BB_ATC_11AC 0x860
+#define ODM_REG_EDCCA_POWER_CAL 0x8dc
+#define ODM_REG_DBG_RPT_11AC 0x8fc
+//PAGE 9
+#define ODM_REG_EDCCA_DOWN_OPT 0x900
+#define ODM_REG_ACBB_EDCCA_ENHANCE 0x944
+#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
+
+
+
+//DIG Related
+#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_TX_PATH_11AC 0xF
+#define ODM_BIT_BB_ATC_11AC BIT14
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_RegDefine11N.h b/rtl8xxx_EU/hal/OUTSRC/odm_RegDefine11N.h
index b623609..e10a4ec 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_RegDefine11N.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_RegDefine11N.h
@@ -1,174 +1,187 @@
-/******************************************************************************
- *
- * 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 __ODM_REGDEFINE11N_H__
-#define __ODM_REGDEFINE11N_H__
-
-
-//2 RF REG LIST
-#define ODM_REG_RF_MODE_11N 0x00
-#define ODM_REG_RF_0B_11N 0x0B
-#define ODM_REG_CHNBW_11N 0x18
-#define ODM_REG_T_METER_11N 0x24
-#define ODM_REG_RF_25_11N 0x25
-#define ODM_REG_RF_26_11N 0x26
-#define ODM_REG_RF_27_11N 0x27
-#define ODM_REG_RF_2B_11N 0x2B
-#define ODM_REG_RF_2C_11N 0x2C
-#define ODM_REG_RXRF_A3_11N 0x3C
-#define ODM_REG_T_METER_92D_11N 0x42
-#define ODM_REG_T_METER_88E_11N 0x42
-
-
-
-//2 BB REG LIST
-//PAGE 8
-#define ODM_REG_BB_CTRL_11N 0x800
-#define ODM_REG_RF_PIN_11N 0x804
-#define ODM_REG_PSD_CTRL_11N 0x808
-#define ODM_REG_TX_ANT_CTRL_11N 0x80C
-#define ODM_REG_BB_PWR_SAV5_11N 0x818
-#define ODM_REG_CCK_RPT_FORMAT_11N 0x824
-#define ODM_REG_RX_DEFUALT_A_11N 0x858
-#define ODM_REG_RX_DEFUALT_B_11N 0x85A
-#define ODM_REG_BB_PWR_SAV3_11N 0x85C
-#define ODM_REG_ANTSEL_CTRL_11N 0x860
-#define ODM_REG_RX_ANT_CTRL_11N 0x864
-#define ODM_REG_PIN_CTRL_11N 0x870
-#define ODM_REG_BB_PWR_SAV1_11N 0x874
-#define ODM_REG_ANTSEL_PATH_11N 0x878
-#define ODM_REG_BB_3WIRE_11N 0x88C
-#define ODM_REG_SC_CNT_11N 0x8C4
-#define ODM_REG_PSD_DATA_11N 0x8B4
-//PAGE 9
-#define ODM_REG_ANT_MAPPING1_11N 0x914
-#define ODM_REG_ANT_MAPPING2_11N 0x918
-//PAGE A
-#define ODM_REG_CCK_ANTDIV_PARA1_11N 0xA00
-#define ODM_REG_CCK_CCA_11N 0xA0A
-#define ODM_REG_CCK_ANTDIV_PARA2_11N 0xA0C
-#define ODM_REG_CCK_ANTDIV_PARA3_11N 0xA10
-#define ODM_REG_CCK_ANTDIV_PARA4_11N 0xA14
-#define ODM_REG_CCK_FILTER_PARA1_11N 0xA22
-#define ODM_REG_CCK_FILTER_PARA2_11N 0xA23
-#define ODM_REG_CCK_FILTER_PARA3_11N 0xA24
-#define ODM_REG_CCK_FILTER_PARA4_11N 0xA25
-#define ODM_REG_CCK_FILTER_PARA5_11N 0xA26
-#define ODM_REG_CCK_FILTER_PARA6_11N 0xA27
-#define ODM_REG_CCK_FILTER_PARA7_11N 0xA28
-#define ODM_REG_CCK_FILTER_PARA8_11N 0xA29
-#define ODM_REG_CCK_FA_RST_11N 0xA2C
-#define ODM_REG_CCK_FA_MSB_11N 0xA58
-#define ODM_REG_CCK_FA_LSB_11N 0xA5C
-#define ODM_REG_CCK_CCA_CNT_11N 0xA60
-#define ODM_REG_BB_PWR_SAV4_11N 0xA74
-//PAGE B
-#define ODM_REG_LNA_SWITCH_11N 0xB2C
-#define ODM_REG_PATH_SWITCH_11N 0xB30
-#define ODM_REG_RSSI_CTRL_11N 0xB38
-#define ODM_REG_CONFIG_ANTA_11N 0xB68
-#define ODM_REG_RSSI_BT_11N 0xB9C
-//PAGE C
-#define ODM_REG_OFDM_FA_HOLDC_11N 0xC00
-#define ODM_REG_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_TXIQK_MATRIX_LSB1_11N 0xC4C
-#define ODM_REG_IGI_A_11N 0xC50
-#define ODM_REG_ANTDIV_PARA2_11N 0xC54
-#define ODM_REG_IGI_B_11N 0xC58
-#define ODM_REG_ANTDIV_PARA3_11N 0xC5C
-#define ODM_REG_L1SBD_PD_CH_11N 0XC6C
-#define ODM_REG_BB_PWR_SAV2_11N 0xC70
-#define ODM_REG_RX_OFF_11N 0xC7C
-#define ODM_REG_TXIQK_MATRIXA_11N 0xC80
-#define ODM_REG_TXIQK_MATRIXB_11N 0xC88
-#define ODM_REG_TXIQK_MATRIXA_LSB2_11N 0xC94
-#define ODM_REG_TXIQK_MATRIXB_LSB2_11N 0xC9C
-#define ODM_REG_RXIQK_MATRIX_LSB_11N 0xCA0
-#define ODM_REG_ANTDIV_PARA1_11N 0xCA4
-#define ODM_REG_OFDM_FA_TYPE1_11N 0xCF0
-//PAGE D
-#define ODM_REG_OFDM_FA_RSTD_11N 0xD00
-#define ODM_REG_OFDM_FA_TYPE2_11N 0xDA0
-#define ODM_REG_OFDM_FA_TYPE3_11N 0xDA4
-#define ODM_REG_OFDM_FA_TYPE4_11N 0xDA8
-//PAGE E
-#define ODM_REG_TXAGC_A_6_18_11N 0xE00
-#define ODM_REG_TXAGC_A_24_54_11N 0xE04
-#define ODM_REG_TXAGC_A_1_MCS32_11N 0xE08
-#define ODM_REG_TXAGC_A_MCS0_3_11N 0xE10
-#define ODM_REG_TXAGC_A_MCS4_7_11N 0xE14
-#define ODM_REG_TXAGC_A_MCS8_11_11N 0xE18
-#define ODM_REG_TXAGC_A_MCS12_15_11N 0xE1C
-#define ODM_REG_FPGA0_IQK_11N 0xE28
-#define ODM_REG_TXIQK_TONE_A_11N 0xE30
-#define ODM_REG_RXIQK_TONE_A_11N 0xE34
-#define ODM_REG_TXIQK_PI_A_11N 0xE38
-#define ODM_REG_RXIQK_PI_A_11N 0xE3C
-#define ODM_REG_TXIQK_11N 0xE40
-#define ODM_REG_RXIQK_11N 0xE44
-#define ODM_REG_IQK_AGC_PTS_11N 0xE48
-#define ODM_REG_IQK_AGC_RSP_11N 0xE4C
-#define ODM_REG_BLUETOOTH_11N 0xE6C
-#define ODM_REG_RX_WAIT_CCA_11N 0xE70
-#define ODM_REG_TX_CCK_RFON_11N 0xE74
-#define ODM_REG_TX_CCK_BBON_11N 0xE78
-#define ODM_REG_OFDM_RFON_11N 0xE7C
-#define ODM_REG_OFDM_BBON_11N 0xE80
-#define ODM_REG_TX2RX_11N 0xE84
-#define ODM_REG_TX2TX_11N 0xE88
-#define ODM_REG_RX_CCK_11N 0xE8C
-#define ODM_REG_RX_OFDM_11N 0xED0
-#define ODM_REG_RX_WAIT_RIFS_11N 0xED4
-#define ODM_REG_RX2RX_11N 0xED8
-#define ODM_REG_STANDBY_11N 0xEDC
-#define ODM_REG_SLEEP_11N 0xEE0
-#define ODM_REG_PMPD_ANAEN_11N 0xEEC
-
-
-
-
-
-
-
-//2 MAC REG LIST
-#define ODM_REG_BB_RST_11N 0x02
-#define ODM_REG_ANTSEL_PIN_11N 0x4C
-#define ODM_REG_EARLY_MODE_11N 0x4D0
-#define ODM_REG_RSSI_MONITOR_11N 0x4FE
-#define ODM_REG_EDCA_VO_11N 0x500
-#define ODM_REG_EDCA_VI_11N 0x504
-#define ODM_REG_EDCA_BE_11N 0x508
-#define ODM_REG_EDCA_BK_11N 0x50C
-#define ODM_REG_TXPAUSE_11N 0x522
-#define ODM_REG_RESP_TX_11N 0x6D8
-#define ODM_REG_ANT_TRAIN_PARA1_11N 0x7b0
-#define ODM_REG_ANT_TRAIN_PARA2_11N 0x7b4
-
-
-//DIG Related
-#define ODM_BIT_IGI_11N 0x0000007F
-#define ODM_BIT_CCK_RPT_FORMAT_11N BIT9
-#define ODM_BIT_BB_RX_PATH_11N 0xF
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __ODM_REGDEFINE11N_H__
+#define __ODM_REGDEFINE11N_H__
+
+
+//2 RF REG LIST
+#define ODM_REG_RF_MODE_11N 0x00
+#define ODM_REG_RF_0B_11N 0x0B
+#define ODM_REG_CHNBW_11N 0x18
+#define ODM_REG_T_METER_11N 0x24
+#define ODM_REG_RF_25_11N 0x25
+#define ODM_REG_RF_26_11N 0x26
+#define ODM_REG_RF_27_11N 0x27
+#define ODM_REG_RF_2B_11N 0x2B
+#define ODM_REG_RF_2C_11N 0x2C
+#define ODM_REG_RXRF_A3_11N 0x3C
+#define ODM_REG_T_METER_92D_11N 0x42
+#define ODM_REG_T_METER_88E_11N 0x42
+
+
+
+//2 BB REG LIST
+//PAGE 8
+#define ODM_REG_BB_CTRL_11N 0x800
+#define ODM_REG_RF_PIN_11N 0x804
+#define ODM_REG_PSD_CTRL_11N 0x808
+#define ODM_REG_TX_ANT_CTRL_11N 0x80C
+#define ODM_REG_BB_PWR_SAV5_11N 0x818
+#define ODM_REG_CCK_RPT_FORMAT_11N 0x824
+#define ODM_REG_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_ANTSEL_CTRL_11N 0x860
+#define ODM_REG_RX_ANT_CTRL_11N 0x864
+#define ODM_REG_PIN_CTRL_11N 0x870
+#define ODM_REG_BB_PWR_SAV1_11N 0x874
+#define ODM_REG_ANTSEL_PATH_11N 0x878
+#define ODM_REG_BB_3WIRE_11N 0x88C
+#define ODM_REG_SC_CNT_11N 0x8C4
+#define ODM_REG_PSD_DATA_11N 0x8B4
+#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_BB_TX_PATH_11N 0x90c
+#define ODM_REG_ANT_MAPPING1_11N 0x914
+#define ODM_REG_ANT_MAPPING2_11N 0x918
+#define ODM_REG_EDCCA_DOWN_OPT_11N 0x948
+
+//PAGE A
+#define ODM_REG_CCK_ANTDIV_PARA1_11N 0xA00
+#define ODM_REG_CCK_CCA_11N 0xA0A
+#define ODM_REG_CCK_ANTDIV_PARA2_11N 0xA0C
+#define ODM_REG_CCK_ANTDIV_PARA3_11N 0xA10
+#define ODM_REG_CCK_ANTDIV_PARA4_11N 0xA14
+#define ODM_REG_CCK_FILTER_PARA1_11N 0xA22
+#define ODM_REG_CCK_FILTER_PARA2_11N 0xA23
+#define ODM_REG_CCK_FILTER_PARA3_11N 0xA24
+#define ODM_REG_CCK_FILTER_PARA4_11N 0xA25
+#define ODM_REG_CCK_FILTER_PARA5_11N 0xA26
+#define ODM_REG_CCK_FILTER_PARA6_11N 0xA27
+#define ODM_REG_CCK_FILTER_PARA7_11N 0xA28
+#define ODM_REG_CCK_FILTER_PARA8_11N 0xA29
+#define ODM_REG_CCK_FA_RST_11N 0xA2C
+#define ODM_REG_CCK_FA_MSB_11N 0xA58
+#define ODM_REG_CCK_FA_LSB_11N 0xA5C
+#define ODM_REG_CCK_CCA_CNT_11N 0xA60
+#define ODM_REG_BB_PWR_SAV4_11N 0xA74
+//PAGE B
+#define ODM_REG_LNA_SWITCH_11N 0xB2C
+#define ODM_REG_PATH_SWITCH_11N 0xB30
+#define ODM_REG_RSSI_CTRL_11N 0xB38
+#define ODM_REG_CONFIG_ANTA_11N 0xB68
+#define ODM_REG_RSSI_BT_11N 0xB9C
+//PAGE C
+#define ODM_REG_OFDM_FA_HOLDC_11N 0xC00
+#define ODM_REG_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_TXIQK_MATRIX_LSB1_11N 0xC4C
+#define ODM_REG_IGI_A_11N 0xC50
+#define ODM_REG_ANTDIV_PARA2_11N 0xC54
+#define ODM_REG_IGI_B_11N 0xC58
+#define ODM_REG_ANTDIV_PARA3_11N 0xC5C
+#define ODM_REG_L1SBD_PD_CH_11N 0XC6C
+#define ODM_REG_BB_PWR_SAV2_11N 0xC70
+#define ODM_REG_RX_OFF_11N 0xC7C
+#define ODM_REG_TXIQK_MATRIXA_11N 0xC80
+#define ODM_REG_TXIQK_MATRIXB_11N 0xC88
+#define ODM_REG_TXIQK_MATRIXA_LSB2_11N 0xC94
+#define ODM_REG_TXIQK_MATRIXB_LSB2_11N 0xC9C
+#define ODM_REG_RXIQK_MATRIX_LSB_11N 0xCA0
+#define ODM_REG_ANTDIV_PARA1_11N 0xCA4
+#define ODM_REG_OFDM_FA_TYPE1_11N 0xCF0
+//PAGE D
+#define ODM_REG_OFDM_FA_RSTD_11N 0xD00
+#define ODM_REG_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
+#define ODM_REG_TXAGC_A_1_MCS32_11N 0xE08
+#define ODM_REG_TXAGC_A_MCS0_3_11N 0xE10
+#define ODM_REG_TXAGC_A_MCS4_7_11N 0xE14
+#define ODM_REG_TXAGC_A_MCS8_11_11N 0xE18
+#define ODM_REG_TXAGC_A_MCS12_15_11N 0xE1C
+#define DOM_REG_EDCCA_DCNF_11N 0xE24
+#define ODM_REG_FPGA0_IQK_11N 0xE28
+#define ODM_REG_TXIQK_TONE_A_11N 0xE30
+#define ODM_REG_RXIQK_TONE_A_11N 0xE34
+#define ODM_REG_TXIQK_PI_A_11N 0xE38
+#define ODM_REG_RXIQK_PI_A_11N 0xE3C
+#define ODM_REG_TXIQK_11N 0xE40
+#define ODM_REG_RXIQK_11N 0xE44
+#define ODM_REG_IQK_AGC_PTS_11N 0xE48
+#define ODM_REG_IQK_AGC_RSP_11N 0xE4C
+#define ODM_REG_BLUETOOTH_11N 0xE6C
+#define ODM_REG_RX_WAIT_CCA_11N 0xE70
+#define ODM_REG_TX_CCK_RFON_11N 0xE74
+#define ODM_REG_TX_CCK_BBON_11N 0xE78
+#define ODM_REG_OFDM_RFON_11N 0xE7C
+#define ODM_REG_OFDM_BBON_11N 0xE80
+#define ODM_REG_TX2RX_11N 0xE84
+#define ODM_REG_TX2TX_11N 0xE88
+#define ODM_REG_RX_CCK_11N 0xE8C
+#define ODM_REG_RX_OFDM_11N 0xED0
+#define ODM_REG_RX_WAIT_RIFS_11N 0xED4
+#define ODM_REG_RX2RX_11N 0xED8
+#define ODM_REG_STANDBY_11N 0xEDC
+#define ODM_REG_SLEEP_11N 0xEE0
+#define ODM_REG_PMPD_ANAEN_11N 0xEEC
+#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
+#define ODM_REG_ANTSEL_PIN_11N 0x4C
+#define ODM_REG_EARLY_MODE_11N 0x4D0
+#define ODM_REG_RSSI_MONITOR_11N 0x4FE
+#define ODM_REG_EDCA_VO_11N 0x500
+#define ODM_REG_EDCA_VI_11N 0x504
+#define ODM_REG_EDCA_BE_11N 0x508
+#define ODM_REG_EDCA_BK_11N 0x50C
+#define ODM_REG_TXPAUSE_11N 0x522
+#define ODM_REG_RESP_TX_11N 0x6D8
+#define ODM_REG_ANT_TRAIN_PARA1_11N 0x7b0
+#define ODM_REG_ANT_TRAIN_PARA2_11N 0x7b4
+
+
+//DIG Related
+#define ODM_BIT_IGI_11N 0x0000007F
+#define ODM_BIT_CCK_RPT_FORMAT_11N BIT9
+#define ODM_BIT_BB_RX_PATH_11N 0xF
+#define ODM_BIT_BB_TX_PATH_11N 0xF
+#define ODM_BIT_BB_ATC_11N BIT11
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_debug.c b/rtl8xxx_EU/hal/OUTSRC/odm_debug.c
index 1547ff1..61e7a86 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_debug.c
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_debug.c
@@ -1,629 +1,629 @@
-/******************************************************************************
- *
- * 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 "odm_precomp.h"
-
-
-VOID
-ODM_InitDebugSetting(
- IN PDM_ODM_T pDM_Odm
- )
-{
-pDM_Odm->DebugLevel = ODM_DBG_LOUD;
-
-pDM_Odm->DebugComponents =
-\
-#if DBG
-//BB Functions
-// ODM_COMP_DIG |
-// ODM_COMP_RA_MASK |
-// ODM_COMP_DYNAMIC_TXPWR |
-// ODM_COMP_FA_CNT |
-// ODM_COMP_RSSI_MONITOR |
-// ODM_COMP_CCK_PD |
-// ODM_COMP_ANT_DIV |
-// ODM_COMP_PWR_SAVE |
-// ODM_COMP_PWR_TRAIN |
-// ODM_COMP_RATE_ADAPTIVE |
-// ODM_COMP_PATH_DIV |
-// ODM_COMP_DYNAMIC_PRICCA |
-// ODM_COMP_RXHP |
-// ODM_COMP_MP |
-// ODM_COMP_DYNAMIC_ATC |
-
-//MAC Functions
-// ODM_COMP_EDCA_TURBO |
-// ODM_COMP_EARLY_MODE |
-//RF Functions
-// ODM_COMP_TX_PWR_TRACK |
-// ODM_COMP_RX_GAIN_TRACK |
-// ODM_COMP_CALIBRATION |
-//Common
-// ODM_COMP_COMMON |
-// ODM_COMP_INIT |
-// ODM_COMP_PSD |
-#endif
- 0;
-}
-
-#if 0
-/*------------------Declare variable-----------------------
-// Define debug flag array for common debug print macro. */
-u4Byte ODM_DBGP_Type[ODM_DBGP_TYPE_MAX];
-
-/* 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)
-{
- 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
-
-
-extern void DBG_PrintAllComp(void)
-{
- u1Byte i;
-
- 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"));
-
- 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++)
- {
- if (GlobalDebugComponents & ((u8Byte)0x1 << i) )
- {
- ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT%02d |\n", i));
- }
- }
- ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("\n"));
-
-} // DBG_PrintAllComp
-
-
-/*-----------------------------------------------------------------------------
- * 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)
- {
- 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;
-
- 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;
-
- 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;
-
- case FSEC:
- ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n"));
- break;
-
- case FMGNT:
- ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n"));
- break;
-
- 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;
-
- case FRESOURCE:
- ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 OS_CHK\n"));
- break;
-
- 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;
-
- case FISR:
- ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 ISR_CHK\n"));
- break;
-
- 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;
-
- 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;
-
- 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;
-
- 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"));
- 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"));
- 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;
- }
-
-} // DBG_PrintFlagEvent
-
-
-extern void DBG_DumpMem(const u1Byte DbgComp,
- const u1Byte DbgLevel,
- pu1Byte pMem,
- u2Byte Len)
-{
- u2Byte i;
-
- for (i=0;i<((Len>>3) + 1);i++)
- {
- 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))));
-
- }
-}
-
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 "odm_precomp.h"
+
+
+VOID
+ODM_InitDebugSetting(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+pDM_Odm->DebugLevel = ODM_DBG_LOUD;
+
+pDM_Odm->DebugComponents =
+\
+#if DBG
+//BB Functions
+// ODM_COMP_DIG |
+// ODM_COMP_RA_MASK |
+// ODM_COMP_DYNAMIC_TXPWR |
+// ODM_COMP_FA_CNT |
+// ODM_COMP_RSSI_MONITOR |
+// ODM_COMP_CCK_PD |
+// ODM_COMP_ANT_DIV |
+// ODM_COMP_PWR_SAVE |
+// ODM_COMP_PWR_TRAIN |
+// ODM_COMP_RATE_ADAPTIVE |
+// ODM_COMP_PATH_DIV |
+// ODM_COMP_DYNAMIC_PRICCA |
+// ODM_COMP_RXHP |
+// ODM_COMP_MP |
+// ODM_COMP_DYNAMIC_ATC |
+
+//MAC Functions
+// ODM_COMP_EDCA_TURBO |
+// ODM_COMP_EARLY_MODE |
+//RF Functions
+// ODM_COMP_TX_PWR_TRACK |
+// ODM_COMP_RX_GAIN_TRACK |
+// ODM_COMP_CALIBRATION |
+//Common
+// ODM_COMP_COMMON |
+// ODM_COMP_INIT |
+// ODM_COMP_PSD |
+#endif
+ 0;
+}
+
+#if 0
+/*------------------Declare variable-----------------------
+// Define debug flag array for common debug print macro. */
+u4Byte ODM_DBGP_Type[ODM_DBGP_TYPE_MAX];
+
+/* 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)
+{
+ 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
+
+
+extern void DBG_PrintAllComp(void)
+{
+ u1Byte i;
+
+ 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"));
+
+ 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++)
+ {
+ if (GlobalDebugComponents & ((u8Byte)0x1 << i) )
+ {
+ ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT%02d |\n", i));
+ }
+ }
+ ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("\n"));
+
+} // DBG_PrintAllComp
+
+
+/*-----------------------------------------------------------------------------
+ * 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)
+ {
+ 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;
+
+ 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;
+
+ 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;
+
+ case FSEC:
+ ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n"));
+ break;
+
+ case FMGNT:
+ ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n"));
+ break;
+
+ 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;
+
+ case FRESOURCE:
+ ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 OS_CHK\n"));
+ break;
+
+ 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;
+
+ case FISR:
+ ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 ISR_CHK\n"));
+ break;
+
+ 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;
+
+ 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;
+
+ 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;
+
+ 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"));
+ 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"));
+ 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;
+ }
+
+} // DBG_PrintFlagEvent
+
+
+extern void DBG_DumpMem(const u1Byte DbgComp,
+ const u1Byte DbgLevel,
+ pu1Byte pMem,
+ u2Byte Len)
+{
+ u2Byte i;
+
+ for (i=0;i<((Len>>3) + 1);i++)
+ {
+ 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))));
+
+ }
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_debug.h b/rtl8xxx_EU/hal/OUTSRC/odm_debug.h
index 0a32f85..a4159eb 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_debug.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_debug.h
@@ -1,892 +1,898 @@
-/******************************************************************************
- *
- * 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 __ODM_DBG_H__
-#define __ODM_DBG_H__
-
-
-//-----------------------------------------------------------------------------
-// Define the debug levels
-//
-// 1. DBG_TRACE and DBG_LOUD are used for normal cases.
-// So that, they can help SW engineer to 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()!
-//
-#define ODM_DBG_OFF 1
-
-//
-// Fatal bug.
-// For example, Tx/Rx/IO locked up, OS hangs, memory access violation,
-// resource allocation failed, unexpected HW behavior, HW BUG and so on.
-//
-#define ODM_DBG_SERIOUS 2
-
-//
-// Abnormal, rare, or unexpeted cases.
-// For example, IRP/Packet/OID canceled, device suprisely unremoved and so on.
-//
-#define ODM_DBG_WARNING 3
-
-//
-// Normal case with useful information about current SW or HW state.
-// For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status,
-// SW protocol state change, dynamic mechanism state change and so on.
-//
-#define ODM_DBG_LOUD 4
-
-//
-// Normal case with detail execution flow or information.
-//
-#define ODM_DBG_TRACE 5
-
-//-----------------------------------------------------------------------------
-// Define the tracing components
-//
-//-----------------------------------------------------------------------------
-//BB Functions
-#define ODM_COMP_DIG 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_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_DYNAMIC_PRICCA BIT12
-#define ODM_COMP_RXHP BIT13
-#define ODM_COMP_MP BIT14
-#define ODM_COMP_DYNAMIC_ATC BIT15
-//MAC Functions
-#define ODM_COMP_EDCA_TURBO BIT16
-#define ODM_COMP_EARLY_MODE BIT17
-//RF Functions
-#define ODM_COMP_TX_PWR_TRACK BIT24
-#define ODM_COMP_RX_GAIN_TRACK BIT25
-#define ODM_COMP_CALIBRATION BIT26
-//Common Functions
-#define ODM_COMP_COMMON BIT30
-#define ODM_COMP_INIT BIT31
-
-/*------------------------Export Marco Definition---------------------------*/
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #define RT_PRINTK DbgPrint
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- #define DbgPrint printk
- #define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
- #define RT_DISP(dbgtype, dbgflag, printstr)
-#else
- #define DbgPrint panic_printk
- #define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
-#endif
-
-#ifndef ASSERT
- #define ASSERT(expr)
-#endif
-
-#if DBG
-#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
- if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)) \
- { \
- RT_PRINTK fmt; \
- }
-
-#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \
- if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
- { \
- RT_PRINTK fmt; \
- }
-
-#define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
- if(!(expr)) { \
- DbgPrint( "Assertion failed! %s at ......\n", #expr); \
- DbgPrint( " ......%s,%s,line=%d\n",__FILE__,__FUNCTION__,__LINE__); \
- RT_PRINTK fmt; \
- ASSERT(FALSE); \
- }
-#define ODM_dbg_enter() { DbgPrint("==> %s\n", __FUNCTION__); }
-#define ODM_dbg_exit() { DbgPrint("<== %s\n", __FUNCTION__); }
-#define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __FUNCTION__, str); }
-
-#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
- if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
- { \
- int __i; \
- pu1Byte __ptr = (pu1Byte)ptr; \
- DbgPrint("[ODM] "); \
- DbgPrint(title_str); \
- DbgPrint(" "); \
- for( __i=0; __i<6; __i++ ) \
- DbgPrint("%02X%s", __ptr[__i], (__i==5)?"":"-"); \
- DbgPrint("\n"); \
- }
-#else
-#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)
-#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)
-#define ODM_RT_ASSERT(pDM_Odm, expr, fmt)
-#define ODM_dbg_enter()
-#define ODM_dbg_exit()
-#define ODM_dbg_trace(str)
-#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)
-#endif
-
-
-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<u4bHexDataLen;__i++) \
- { \
- if ((__i & 15) == 0) \
- { \
- DbgPrint("\n"); \
- } \
- DbgPrint("%02X%s", pbtHexData[__i], ( ((__i&3)==3) ? " " : " ") ); \
- } \
- DbgPrint("\n"); \
- }
-
-// RT_PRINT_XXX macros: implemented for debugging purpose.
-// Added by Annie, 2005-11-21.
-#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
- if(((_Comp) & ODM_GlobalDebugComponents) && (_Level <= ODM_GlobalDebugLevel)) \
- { \
- int __i; \
- pu1Byte ptr = (pu1Byte)_HexData; \
- DbgPrint("Rtl819x: "); \
- 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 RT_PRINT_ADDR(_Comp, _Level, _TitleString, _Ptr) \
- if(((_Comp) & ODM_GlobalDebugComponents) && (_Level <= ODM_GlobalDebugLevel)) \
- { \
- int __i; \
- pu1Byte ptr = (pu1Byte)_Ptr; \
- DbgPrint("Rtl819x: "); \
- DbgPrint(_TitleString); \
- DbgPrint(" "); \
- for( __i=0; __i<6; __i++ ) \
- DbgPrint("%02X%s", ptr[__i], (__i==5)?"":"-"); \
- DbgPrint("\n"); \
- }
-
-#define RT_PRINT_ADDRS(_Comp, _Level, _TitleString, _Ptr, _AddNum) \
- if(((_Comp) & ODM_GlobalDebugComponents) && (_Level <= ODM_GlobalDebugLevel)) \
- { \
- int __i, __j; \
- pu1Byte ptr = (pu1Byte)_Ptr; \
- DbgPrint("Rtl819x: "); \
- DbgPrint(_TitleString); \
- DbgPrint("\n"); \
- for( __i=0; __i<(int)_AddNum; __i++ ) \
- { \
- for( __j=0; __j<6; __j++ ) \
- DbgPrint("%02X%s", ptr[__i*6+__j], (__j==5)?"":"-"); \
- DbgPrint("\n"); \
- } \
- }
-
-// Added by Annie, 2005-11-22.
-#define MAX_STR_LEN 64
-#define PRINTABLE(_ch) (_ch>=' ' &&_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<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \
- PlatformZeroMemory( buffer, MAX_STR_LEN ); \
- PlatformMoveMemory( buffer, (pu1Byte)_Ptr, length ); \
- for( __i=0; __i<MAX_STR_LEN; __i++ ) \
- { \
- if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \
- } \
- buffer[length] = '\0'; \
- DbgPrint("Rtl819x: "); \
- DbgPrint(_TitleString); \
- DbgPrint(": %d, <%s>\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<u4bHexDataLen;__i++) \
- { \
- if ((__i & 15) == 0) \
- { \
- DbgPrint("\n"); \
- } \
- DbgPrint("%02X%s", pbtHexData[__i], ( ((__i&3)==3) ? " " : " ") ); \
- } \
- DbgPrint("\n"); \
- }
-
-// RT_PRINT_XXX macros: implemented for debugging purpose.
-// Added by Annie, 2005-11-21.
-#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
- if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
- { \
- int __i; \
- pu1Byte ptr = (pu1Byte)_HexData; \
- DbgPrint("Rtl819x: "); \
- 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 RT_PRINT_ADDR(_Comp, _Level, _TitleString, _Ptr) \
- if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
- { \
- int __i; \
- pu1Byte ptr = (pu1Byte)_Ptr; \
- DbgPrint("Rtl819x: "); \
- DbgPrint(_TitleString); \
- DbgPrint(" "); \
- for( __i=0; __i<6; __i++ ) \
- DbgPrint("%02X%s", ptr[__i], (__i==5)?"":"-"); \
- DbgPrint("\n"); \
- }
-
-#define RT_PRINT_ADDRS(_Comp, _Level, _TitleString, _Ptr, _AddNum) \
- if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
- { \
- int __i, __j; \
- pu1Byte ptr = (pu1Byte)_Ptr; \
- DbgPrint("Rtl819x: "); \
- DbgPrint(_TitleString); \
- DbgPrint("\n"); \
- for( __i=0; __i<(int)_AddNum; __i++ ) \
- { \
- for( __j=0; __j<6; __j++ ) \
- DbgPrint("%02X%s", ptr[__i*6+__j], (__j==5)?"":"-"); \
- DbgPrint("\n"); \
- } \
- }
-
-// Added by Annie, 2005-11-22.
-#define MAX_STR_LEN 64
-#define PRINTABLE(_ch) (_ch>=' ' &&_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<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \
- PlatformZeroMemory( buffer, MAX_STR_LEN ); \
- PlatformMoveMemory( buffer, (pu1Byte)_Ptr, length ); \
- for( __i=0; __i<MAX_STR_LEN; __i++ ) \
- { \
- if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \
- } \
- buffer[length] = '\0'; \
- DbgPrint("Rtl819x: "); \
- DbgPrint(_TitleString); \
- DbgPrint(": %d, <%s>\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
-
-
-#endif // __ODM_DBG_H__
-
+/******************************************************************************
+ *
+ * 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 __ODM_DBG_H__
+#define __ODM_DBG_H__
+
+
+//-----------------------------------------------------------------------------
+// Define the debug levels
+//
+// 1. DBG_TRACE and DBG_LOUD are used for normal cases.
+// So that, they can help SW engineer to 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()!
+//
+#define ODM_DBG_OFF 1
+
+//
+// Fatal bug.
+// For example, Tx/Rx/IO locked up, OS hangs, memory access violation,
+// resource allocation failed, unexpected HW behavior, HW BUG and so on.
+//
+#define ODM_DBG_SERIOUS 2
+
+//
+// Abnormal, rare, or unexpeted cases.
+// For example, IRP/Packet/OID canceled, device suprisely unremoved and so on.
+//
+#define ODM_DBG_WARNING 3
+
+//
+// Normal case with useful information about current SW or HW state.
+// For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status,
+// SW protocol state change, dynamic mechanism state change and so on.
+//
+#define ODM_DBG_LOUD 4
+
+//
+// Normal case with detail execution flow or information.
+//
+#define ODM_DBG_TRACE 5
+
+//-----------------------------------------------------------------------------
+// Define the tracing components
+//
+//-----------------------------------------------------------------------------
+//BB Functions
+#define ODM_COMP_DIG 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_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_DYNAMIC_PRICCA BIT12
+#define ODM_COMP_RXHP BIT13
+#define ODM_COMP_MP BIT14
+#define ODM_COMP_DYNAMIC_ATC BIT15
+#define ODM_COMP_ACS BIT16
+#define PHYDM_COMP_ADAPTIVITY BIT17
+#define PHYDM_COMP_RA_DBG BIT18
+#define PHYDM_COMP_TXBF BIT19
+//MAC Functions
+#define ODM_COMP_EDCA_TURBO BIT20
+#define ODM_COMP_EARLY_MODE BIT21
+#define ODM_FW_DEBUG_TRACE BIT22
+//RF Functions
+#define ODM_COMP_TX_PWR_TRACK BIT24
+#define ODM_COMP_RX_GAIN_TRACK BIT25
+#define ODM_COMP_CALIBRATION BIT26
+//Common Functions
+#define BEAMFORMING_DEBUG BIT29
+#define ODM_COMP_COMMON BIT30
+#define ODM_COMP_INIT BIT31
+
+/*------------------------Export Marco Definition---------------------------*/
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ #define RT_PRINTK DbgPrint
+#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ #define DbgPrint printk
+ #define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
+ #define RT_DISP(dbgtype, dbgflag, printstr)
+#else
+ #define DbgPrint panic_printk
+ #define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
+#endif
+
+#ifndef ASSERT
+ #define ASSERT(expr)
+#endif
+
+#if DBG
+#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
+ if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)) \
+ { \
+ RT_PRINTK fmt; \
+ }
+
+#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \
+ if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
+ { \
+ RT_PRINTK fmt; \
+ }
+
+#define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
+ if(!(expr)) { \
+ DbgPrint( "Assertion failed! %s at ......\n", #expr); \
+ DbgPrint( " ......%s,%s,line=%d\n",__FILE__,__FUNCTION__,__LINE__); \
+ RT_PRINTK fmt; \
+ ASSERT(FALSE); \
+ }
+#define ODM_dbg_enter() { DbgPrint("==> %s\n", __FUNCTION__); }
+#define ODM_dbg_exit() { DbgPrint("<== %s\n", __FUNCTION__); }
+#define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __FUNCTION__, str); }
+
+#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
+ if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
+ { \
+ int __i; \
+ pu1Byte __ptr = (pu1Byte)ptr; \
+ DbgPrint("[ODM] "); \
+ DbgPrint(title_str); \
+ DbgPrint(" "); \
+ for( __i=0; __i<6; __i++ ) \
+ DbgPrint("%02X%s", __ptr[__i], (__i==5)?"":"-"); \
+ DbgPrint("\n"); \
+ }
+#else
+#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)
+#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)
+#define ODM_RT_ASSERT(pDM_Odm, expr, fmt)
+#define ODM_dbg_enter()
+#define ODM_dbg_exit()
+#define ODM_dbg_trace(str)
+#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)
+#endif
+
+
+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<u4bHexDataLen;__i++) \
+ { \
+ if ((__i & 15) == 0) \
+ { \
+ DbgPrint("\n"); \
+ } \
+ DbgPrint("%02X%s", pbtHexData[__i], ( ((__i&3)==3) ? " " : " ") ); \
+ } \
+ DbgPrint("\n"); \
+ }
+
+// RT_PRINT_XXX macros: implemented for debugging purpose.
+// Added by Annie, 2005-11-21.
+#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
+ if(((_Comp) & ODM_GlobalDebugComponents) && (_Level <= ODM_GlobalDebugLevel)) \
+ { \
+ int __i; \
+ pu1Byte ptr = (pu1Byte)_HexData; \
+ DbgPrint("Rtl819x: "); \
+ 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 RT_PRINT_ADDR(_Comp, _Level, _TitleString, _Ptr) \
+ if(((_Comp) & ODM_GlobalDebugComponents) && (_Level <= ODM_GlobalDebugLevel)) \
+ { \
+ int __i; \
+ pu1Byte ptr = (pu1Byte)_Ptr; \
+ DbgPrint("Rtl819x: "); \
+ DbgPrint(_TitleString); \
+ DbgPrint(" "); \
+ for( __i=0; __i<6; __i++ ) \
+ DbgPrint("%02X%s", ptr[__i], (__i==5)?"":"-"); \
+ DbgPrint("\n"); \
+ }
+
+#define RT_PRINT_ADDRS(_Comp, _Level, _TitleString, _Ptr, _AddNum) \
+ if(((_Comp) & ODM_GlobalDebugComponents) && (_Level <= ODM_GlobalDebugLevel)) \
+ { \
+ int __i, __j; \
+ pu1Byte ptr = (pu1Byte)_Ptr; \
+ DbgPrint("Rtl819x: "); \
+ DbgPrint(_TitleString); \
+ DbgPrint("\n"); \
+ for( __i=0; __i<(int)_AddNum; __i++ ) \
+ { \
+ for( __j=0; __j<6; __j++ ) \
+ DbgPrint("%02X%s", ptr[__i*6+__j], (__j==5)?"":"-"); \
+ DbgPrint("\n"); \
+ } \
+ }
+
+// Added by Annie, 2005-11-22.
+#define MAX_STR_LEN 64
+#define PRINTABLE(_ch) (_ch>=' ' &&_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<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \
+ PlatformZeroMemory( buffer, MAX_STR_LEN ); \
+ PlatformMoveMemory( buffer, (pu1Byte)_Ptr, length ); \
+ for( __i=0; __i<MAX_STR_LEN; __i++ ) \
+ { \
+ if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \
+ } \
+ buffer[length] = '\0'; \
+ DbgPrint("Rtl819x: "); \
+ DbgPrint(_TitleString); \
+ DbgPrint(": %d, <%s>\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<u4bHexDataLen;__i++) \
+ { \
+ if ((__i & 15) == 0) \
+ { \
+ DbgPrint("\n"); \
+ } \
+ DbgPrint("%02X%s", pbtHexData[__i], ( ((__i&3)==3) ? " " : " ") ); \
+ } \
+ DbgPrint("\n"); \
+ }
+
+// RT_PRINT_XXX macros: implemented for debugging purpose.
+// Added by Annie, 2005-11-21.
+#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
+ if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
+ { \
+ int __i; \
+ pu1Byte ptr = (pu1Byte)_HexData; \
+ DbgPrint("Rtl819x: "); \
+ 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 RT_PRINT_ADDR(_Comp, _Level, _TitleString, _Ptr) \
+ if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
+ { \
+ int __i; \
+ pu1Byte ptr = (pu1Byte)_Ptr; \
+ DbgPrint("Rtl819x: "); \
+ DbgPrint(_TitleString); \
+ DbgPrint(" "); \
+ for( __i=0; __i<6; __i++ ) \
+ DbgPrint("%02X%s", ptr[__i], (__i==5)?"":"-"); \
+ DbgPrint("\n"); \
+ }
+
+#define RT_PRINT_ADDRS(_Comp, _Level, _TitleString, _Ptr, _AddNum) \
+ if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
+ { \
+ int __i, __j; \
+ pu1Byte ptr = (pu1Byte)_Ptr; \
+ DbgPrint("Rtl819x: "); \
+ DbgPrint(_TitleString); \
+ DbgPrint("\n"); \
+ for( __i=0; __i<(int)_AddNum; __i++ ) \
+ { \
+ for( __j=0; __j<6; __j++ ) \
+ DbgPrint("%02X%s", ptr[__i*6+__j], (__j==5)?"":"-"); \
+ DbgPrint("\n"); \
+ } \
+ }
+
+// Added by Annie, 2005-11-22.
+#define MAX_STR_LEN 64
+#define PRINTABLE(_ch) (_ch>=' ' &&_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<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \
+ PlatformZeroMemory( buffer, MAX_STR_LEN ); \
+ PlatformMoveMemory( buffer, (pu1Byte)_Ptr, length ); \
+ for( __i=0; __i<MAX_STR_LEN; __i++ ) \
+ { \
+ if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \
+ } \
+ buffer[length] = '\0'; \
+ DbgPrint("Rtl819x: "); \
+ DbgPrint(_TitleString); \
+ DbgPrint(": %d, <%s>\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
+
+
+#endif // __ODM_DBG_H__
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_interface.c b/rtl8xxx_EU/hal/OUTSRC/odm_interface.c
index 555fd7d..7a5f2f6 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_interface.c
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_interface.c
@@ -1,750 +1,750 @@
-/******************************************************************************
- *
- * 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 "odm_precomp.h"
-
-//
-// ODM IO Relative API.
-//
-
-u1Byte
-ODM_Read1Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- prtl8192cd_priv priv = pDM_Odm->priv;
- return RTL_R8(RegAddr);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- PADAPTER Adapter = pDM_Odm->Adapter;
- return rtw_read8(Adapter,RegAddr);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- return PlatformEFIORead1Byte(Adapter, RegAddr);
-#endif
-
-}
-
-
-u2Byte
-ODM_Read2Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- prtl8192cd_priv priv = pDM_Odm->priv;
- return RTL_R16(RegAddr);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- PADAPTER Adapter = pDM_Odm->Adapter;
- return rtw_read16(Adapter,RegAddr);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- return PlatformEFIORead2Byte(Adapter, RegAddr);
-#endif
-
-}
-
-
-u4Byte
-ODM_Read4Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- prtl8192cd_priv priv = pDM_Odm->priv;
- return RTL_R32(RegAddr);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- PADAPTER Adapter = pDM_Odm->Adapter;
- return rtw_read32(Adapter,RegAddr);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- return PlatformEFIORead4Byte(Adapter, RegAddr);
-#endif
-
-}
-
-
-VOID
-ODM_Write1Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u1Byte Data
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- prtl8192cd_priv priv = pDM_Odm->priv;
- RTL_W8(RegAddr, Data);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- PADAPTER Adapter = pDM_Odm->Adapter;
- rtw_write8(Adapter,RegAddr, Data);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformEFIOWrite1Byte(Adapter, RegAddr, Data);
-#endif
-
-}
-
-
-VOID
-ODM_Write2Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u2Byte Data
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- prtl8192cd_priv priv = pDM_Odm->priv;
- RTL_W16(RegAddr, Data);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- PADAPTER Adapter = pDM_Odm->Adapter;
- rtw_write16(Adapter,RegAddr, Data);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformEFIOWrite2Byte(Adapter, RegAddr, Data);
-#endif
-
-}
-
-
-VOID
-ODM_Write4Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte Data
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- prtl8192cd_priv priv = pDM_Odm->priv;
- RTL_W32(RegAddr, Data);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- PADAPTER Adapter = pDM_Odm->Adapter;
- rtw_write32(Adapter,RegAddr, Data);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformEFIOWrite4Byte(Adapter, RegAddr, Data);
-#endif
-
-}
-
-
-VOID
-ODM_SetMACReg(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte BitMask,
- IN u4Byte Data
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data);
-#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
- PADAPTER Adapter = pDM_Odm->Adapter;
- PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
-#endif
-}
-
-
-u4Byte
-ODM_GetMACReg(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte BitMask
- )
-{
-#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);
-#endif
-}
-
-
-VOID
-ODM_SetBBReg(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte BitMask,
- IN u4Byte Data
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data);
-#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
- PADAPTER Adapter = pDM_Odm->Adapter;
- PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
-#endif
-}
-
-
-u4Byte
-ODM_GetBBReg(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte BitMask
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask);
-#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
- PADAPTER Adapter = pDM_Odm->Adapter;
- return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
-#endif
-}
-
-
-VOID
-ODM_SetRFReg(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_RF_RADIO_PATH_E eRFPath,
- IN u4Byte RegAddr,
- IN u4Byte BitMask,
- IN u4Byte Data
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- PHY_SetRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, Data);
-#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
- PADAPTER Adapter = pDM_Odm->Adapter;
- PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data);
-#endif
-}
-
-
-u4Byte
-ODM_GetRFReg(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_RF_RADIO_PATH_E eRFPath,
- IN u4Byte RegAddr,
- IN u4Byte BitMask
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- return PHY_QueryRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, 1);
-#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
- PADAPTER Adapter = pDM_Odm->Adapter;
- return PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask);
-#endif
-}
-
-
-
-
-//
-// ODM Memory relative API.
-//
-VOID
-ODM_AllocateMemory(
- IN PDM_ODM_T pDM_Odm,
- OUT PVOID *pPtr,
- IN u4Byte length
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- *pPtr = kmalloc(length, GFP_ATOMIC);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
- *pPtr = rtw_zvmalloc(length);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformAllocateMemory(Adapter, pPtr, length);
-#endif
-}
-
-// length could be ignored, used to detect memory leakage.
-VOID
-ODM_FreeMemory(
- IN PDM_ODM_T pDM_Odm,
- OUT PVOID pPtr,
- IN u4Byte length
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- kfree(pPtr);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
- rtw_vmfree(pPtr, length);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- //PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformFreeMemory(pPtr, length);
-#endif
-}
-
-VOID
-ODM_MoveMemory(
- IN PDM_ODM_T pDM_Odm,
- OUT PVOID pDest,
- IN PVOID pSrc,
- IN u4Byte Length
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
- _rtw_memcpy(pDest, pSrc, Length);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformMoveMemory(pDest, pSrc, Length);
-#endif
-}
-
-s4Byte ODM_CompareMemory(
- IN PDM_ODM_T pDM_Odm,
- IN PVOID pBuf1,
- IN PVOID pBuf2,
- IN u4Byte length
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- return memcmp(pBuf1,pBuf2,length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
- return _rtw_memcmp(pBuf1,pBuf2,length);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- return PlatformCompareMemory(pBuf1,pBuf2,length);
-#endif
-}
-
-
-
-//
-// ODM MISC relative API.
-//
-VOID
-ODM_AcquireSpinLock(
- IN PDM_ODM_T pDM_Odm,
- IN RT_SPINLOCK_TYPE type
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformAcquireSpinLock(Adapter, type);
-#endif
-}
-VOID
-ODM_ReleaseSpinLock(
- IN PDM_ODM_T pDM_Odm,
- IN RT_SPINLOCK_TYPE type
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformReleaseSpinLock(Adapter, type);
-#endif
-}
-
-//
-// Work item relative API. FOr MP driver only~!
-//
-VOID
-ODM_InitializeWorkItem(
- IN PDM_ODM_T pDM_Odm,
- IN PRT_WORK_ITEM pRtWorkItem,
- IN RT_WORKITEM_CALL_BACK RtWorkItemCallback,
- IN PVOID pContext,
- IN const char* szID
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformInitializeWorkItem(Adapter, pRtWorkItem, RtWorkItemCallback, pContext, szID);
-#endif
-}
-
-
-VOID
-ODM_StartWorkItem(
- IN PRT_WORK_ITEM pRtWorkItem
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformStartWorkItem(pRtWorkItem);
-#endif
-}
-
-
-VOID
-ODM_StopWorkItem(
- IN PRT_WORK_ITEM pRtWorkItem
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformStopWorkItem(pRtWorkItem);
-#endif
-}
-
-
-VOID
-ODM_FreeWorkItem(
- IN PRT_WORK_ITEM pRtWorkItem
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformFreeWorkItem(pRtWorkItem);
-#endif
-}
-
-
-VOID
-ODM_ScheduleWorkItem(
- IN PRT_WORK_ITEM pRtWorkItem
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformScheduleWorkItem(pRtWorkItem);
-#endif
-}
-
-
-VOID
-ODM_IsWorkItemScheduled(
- IN PRT_WORK_ITEM pRtWorkItem
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformIsWorkItemScheduled(pRtWorkItem);
-#endif
-}
-
-
-
-//
-// ODM Timer relative API.
-//
-VOID
-ODM_StallExecution(
- IN u4Byte usDelay
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- rtw_udelay_os(usDelay);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformStallExecution(usDelay);
-#endif
-}
-
-VOID
-ODM_delay_ms(IN u4Byte ms)
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- delay_ms(ms);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- rtw_mdelay_os(ms);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- delay_ms(ms);
-#endif
-}
-
-VOID
-ODM_delay_us(IN u4Byte us)
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- delay_us(us);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- rtw_udelay_os(us);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformStallExecution(us);
-#endif
-}
-
-VOID
-ODM_sleep_ms(IN u4Byte ms)
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- rtw_msleep_os(ms);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#endif
-}
-
-VOID
-ODM_sleep_us(IN u4Byte us)
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- rtw_usleep_os(us);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#endif
-}
-
-VOID
-ODM_SetTimer(
- IN PDM_ODM_T pDM_Odm,
- IN PRT_TIMER pTimer,
- IN u4Byte msDelay
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- mod_timer(pTimer, jiffies + (msDelay+9)/10);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- _set_timer(pTimer,msDelay ); //ms
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformSetTimer(Adapter, pTimer, msDelay);
-#endif
-
-}
-
-VOID
-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
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- pTimer->function = CallBackFunc;
- pTimer->data = (unsigned long)pDM_Odm;
- init_timer(pTimer);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- PADAPTER Adapter = pDM_Odm->Adapter;
- _init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformInitializeTimer(Adapter, pTimer, CallBackFunc,pContext,szID);
-#endif
-}
-
-
-VOID
-ODM_CancelTimer(
- IN PDM_ODM_T pDM_Odm,
- IN PRT_TIMER pTimer
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- del_timer_sync(pTimer);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- _cancel_timer_ex(pTimer);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PADAPTER Adapter = pDM_Odm->Adapter;
- PlatformCancelTimer(Adapter, pTimer);
-#endif
-}
-
-
-VOID
-ODM_ReleaseTimer(
- IN PDM_ODM_T pDM_Odm,
- IN PRT_TIMER pTimer
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
- PADAPTER Adapter = pDM_Odm->Adapter;
-
- // <20120301, Kordan> If the initilization fails, InitializeAdapterXxx will return regardless of InitHalDm.
- // Hence, uninitialized timers cause BSOD when the driver releases resources since the init fail.
- if (pTimer == 0)
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_SERIOUS, ("=====>ODM_ReleaseTimer(), The timer is NULL! Please check it!\n"));
- return;
- }
-
- PlatformReleaseTimer(Adapter, pTimer);
-#endif
-}
-
-
-//
-// ODM FW relative API.
-//
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-VOID
-ODM_FillH2CCmd(
- IN PADAPTER Adapter,
- 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;
- }
-
- }
- else if(IS_HARDWARE_TYPE_8192E(Adapter))
- {
- 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))
- {
- //
- // <Roger_TODO> 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;
-
- default:
- break;
- }
-
- }
- else if(IS_HARDWARE_TYPE_8188E(Adapter))
- {
- 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;
- }
- }
- 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;
- }
- }
-}
-#else
-u4Byte
-ODM_FillH2CCmd(
- IN pu1Byte pH2CBuffer,
- IN u4Byte H2CBufferLen,
- IN u4Byte CmdNum,
- IN pu4Byte pElementID,
- IN pu4Byte pCmdLen,
- IN pu1Byte* pCmbBuffer,
- IN pu1Byte CmdStartSeq
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- //FillH2CCmd(pH2CBuffer, H2CBufferLen, CmdNum, pElementID, pCmdLen, pCmbBuffer, CmdStartSeq);
- return FALSE;
-#endif
-
- return TRUE;
-}
-#endif
-
-
-u4Byte
-ODM_GetCurrentTime(
- IN PDM_ODM_T pDM_Odm
- )
-{
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
- return 0;
-#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
- return rtw_get_current_time();
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- return 0;
-#endif
-}
-
-s4Byte
-ODM_GetProgressingTime(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte 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);
-#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
- return 0;
-#endif
-}
-
-
+/******************************************************************************
+ *
+ * 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 "odm_precomp.h"
+
+//
+// ODM IO Relative API.
+//
+
+u1Byte
+ODM_Read1Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ prtl8192cd_priv priv = pDM_Odm->priv;
+ return RTL_R8(RegAddr);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ return rtw_read8(Adapter,RegAddr);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ return PlatformEFIORead1Byte(Adapter, RegAddr);
+#endif
+
+}
+
+
+u2Byte
+ODM_Read2Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ prtl8192cd_priv priv = pDM_Odm->priv;
+ return RTL_R16(RegAddr);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ return rtw_read16(Adapter,RegAddr);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ return PlatformEFIORead2Byte(Adapter, RegAddr);
+#endif
+
+}
+
+
+u4Byte
+ODM_Read4Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ prtl8192cd_priv priv = pDM_Odm->priv;
+ return RTL_R32(RegAddr);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ return rtw_read32(Adapter,RegAddr);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ return PlatformEFIORead4Byte(Adapter, RegAddr);
+#endif
+
+}
+
+
+VOID
+ODM_Write1Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u1Byte Data
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ prtl8192cd_priv priv = pDM_Odm->priv;
+ RTL_W8(RegAddr, Data);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ rtw_write8(Adapter,RegAddr, Data);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformEFIOWrite1Byte(Adapter, RegAddr, Data);
+#endif
+
+}
+
+
+VOID
+ODM_Write2Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u2Byte Data
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ prtl8192cd_priv priv = pDM_Odm->priv;
+ RTL_W16(RegAddr, Data);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ rtw_write16(Adapter,RegAddr, Data);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformEFIOWrite2Byte(Adapter, RegAddr, Data);
+#endif
+
+}
+
+
+VOID
+ODM_Write4Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte Data
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ prtl8192cd_priv priv = pDM_Odm->priv;
+ RTL_W32(RegAddr, Data);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ rtw_write32(Adapter,RegAddr, Data);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformEFIOWrite4Byte(Adapter, RegAddr, Data);
+#endif
+
+}
+
+
+VOID
+ODM_SetMACReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask,
+ IN u4Byte Data
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data);
+#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
+#endif
+}
+
+
+u4Byte
+ODM_GetMACReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask
+ )
+{
+#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);
+#endif
+}
+
+
+VOID
+ODM_SetBBReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask,
+ IN u4Byte Data
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data);
+#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
+#endif
+}
+
+
+u4Byte
+ODM_GetBBReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask);
+#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
+#endif
+}
+
+
+VOID
+ODM_SetRFReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_RF_RADIO_PATH_E eRFPath,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask,
+ IN u4Byte Data
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ PHY_SetRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, Data);
+#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data);
+#endif
+}
+
+
+u4Byte
+ODM_GetRFReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_RF_RADIO_PATH_E eRFPath,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ return PHY_QueryRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, 1);
+#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ return PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask);
+#endif
+}
+
+
+
+
+//
+// ODM Memory relative API.
+//
+VOID
+ODM_AllocateMemory(
+ IN PDM_ODM_T pDM_Odm,
+ OUT PVOID *pPtr,
+ IN u4Byte length
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ *pPtr = kmalloc(length, GFP_ATOMIC);
+#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
+ *pPtr = rtw_zvmalloc(length);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformAllocateMemory(Adapter, pPtr, length);
+#endif
+}
+
+// length could be ignored, used to detect memory leakage.
+VOID
+ODM_FreeMemory(
+ IN PDM_ODM_T pDM_Odm,
+ OUT PVOID pPtr,
+ IN u4Byte length
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ kfree(pPtr);
+#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
+ rtw_vmfree(pPtr, length);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ //PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformFreeMemory(pPtr, length);
+#endif
+}
+
+VOID
+ODM_MoveMemory(
+ IN PDM_ODM_T pDM_Odm,
+ OUT PVOID pDest,
+ IN PVOID pSrc,
+ IN u4Byte Length
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
+ _rtw_memcpy(pDest, pSrc, Length);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PlatformMoveMemory(pDest, pSrc, Length);
+#endif
+}
+
+s4Byte ODM_CompareMemory(
+ IN PDM_ODM_T pDM_Odm,
+ IN PVOID pBuf1,
+ IN PVOID pBuf2,
+ IN u4Byte length
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ return memcmp(pBuf1,pBuf2,length);
+#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
+ return _rtw_memcmp(pBuf1,pBuf2,length);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ return PlatformCompareMemory(pBuf1,pBuf2,length);
+#endif
+}
+
+
+
+//
+// ODM MISC relative API.
+//
+VOID
+ODM_AcquireSpinLock(
+ IN PDM_ODM_T pDM_Odm,
+ IN RT_SPINLOCK_TYPE type
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformAcquireSpinLock(Adapter, type);
+#endif
+}
+VOID
+ODM_ReleaseSpinLock(
+ IN PDM_ODM_T pDM_Odm,
+ IN RT_SPINLOCK_TYPE type
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformReleaseSpinLock(Adapter, type);
+#endif
+}
+
+//
+// Work item relative API. FOr MP driver only~!
+//
+VOID
+ODM_InitializeWorkItem(
+ IN PDM_ODM_T pDM_Odm,
+ IN PRT_WORK_ITEM pRtWorkItem,
+ IN RT_WORKITEM_CALL_BACK RtWorkItemCallback,
+ IN PVOID pContext,
+ IN const char* szID
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformInitializeWorkItem(Adapter, pRtWorkItem, RtWorkItemCallback, pContext, szID);
+#endif
+}
+
+
+VOID
+ODM_StartWorkItem(
+ IN PRT_WORK_ITEM pRtWorkItem
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PlatformStartWorkItem(pRtWorkItem);
+#endif
+}
+
+
+VOID
+ODM_StopWorkItem(
+ IN PRT_WORK_ITEM pRtWorkItem
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PlatformStopWorkItem(pRtWorkItem);
+#endif
+}
+
+
+VOID
+ODM_FreeWorkItem(
+ IN PRT_WORK_ITEM pRtWorkItem
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PlatformFreeWorkItem(pRtWorkItem);
+#endif
+}
+
+
+VOID
+ODM_ScheduleWorkItem(
+ IN PRT_WORK_ITEM pRtWorkItem
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PlatformScheduleWorkItem(pRtWorkItem);
+#endif
+}
+
+
+VOID
+ODM_IsWorkItemScheduled(
+ IN PRT_WORK_ITEM pRtWorkItem
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PlatformIsWorkItemScheduled(pRtWorkItem);
+#endif
+}
+
+
+
+//
+// ODM Timer relative API.
+//
+VOID
+ODM_StallExecution(
+ IN u4Byte usDelay
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ rtw_udelay_os(usDelay);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PlatformStallExecution(usDelay);
+#endif
+}
+
+VOID
+ODM_delay_ms(IN u4Byte ms)
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ delay_ms(ms);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ rtw_mdelay_os(ms);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ delay_ms(ms);
+#endif
+}
+
+VOID
+ODM_delay_us(IN u4Byte us)
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ delay_us(us);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ rtw_udelay_os(us);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PlatformStallExecution(us);
+#endif
+}
+
+VOID
+ODM_sleep_ms(IN u4Byte ms)
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ rtw_msleep_os(ms);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+#endif
+}
+
+VOID
+ODM_sleep_us(IN u4Byte us)
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ rtw_usleep_os(us);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+#endif
+}
+
+VOID
+ODM_SetTimer(
+ IN PDM_ODM_T pDM_Odm,
+ IN PRT_TIMER pTimer,
+ IN u4Byte msDelay
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ mod_timer(pTimer, jiffies + (msDelay+9)/10);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ _set_timer(pTimer,msDelay ); //ms
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformSetTimer(Adapter, pTimer, msDelay);
+#endif
+
+}
+
+VOID
+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
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ pTimer->function = CallBackFunc;
+ pTimer->data = (unsigned long)pDM_Odm;
+ init_timer(pTimer);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ _init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformInitializeTimer(Adapter, pTimer, CallBackFunc,pContext,szID);
+#endif
+}
+
+
+VOID
+ODM_CancelTimer(
+ IN PDM_ODM_T pDM_Odm,
+ IN PRT_TIMER pTimer
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ del_timer_sync(pTimer);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ _cancel_timer_ex(pTimer);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PlatformCancelTimer(Adapter, pTimer);
+#endif
+}
+
+
+VOID
+ODM_ReleaseTimer(
+ IN PDM_ODM_T pDM_Odm,
+ IN PRT_TIMER pTimer
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+
+ PADAPTER Adapter = pDM_Odm->Adapter;
+
+ // <20120301, Kordan> If the initilization fails, InitializeAdapterXxx will return regardless of InitHalDm.
+ // Hence, uninitialized timers cause BSOD when the driver releases resources since the init fail.
+ if (pTimer == 0)
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_SERIOUS, ("=====>ODM_ReleaseTimer(), The timer is NULL! Please check it!\n"));
+ return;
+ }
+
+ PlatformReleaseTimer(Adapter, pTimer);
+#endif
+}
+
+
+//
+// ODM FW relative API.
+//
+#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
+VOID
+ODM_FillH2CCmd(
+ IN PADAPTER Adapter,
+ 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;
+ }
+
+ }
+ else if(IS_HARDWARE_TYPE_8192E(Adapter))
+ {
+ 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))
+ {
+ //
+ // <Roger_TODO> 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;
+
+ default:
+ break;
+ }
+
+ }
+ else if(IS_HARDWARE_TYPE_8188E(Adapter))
+ {
+ 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;
+ }
+ }
+ 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;
+ }
+ }
+}
+#else
+u4Byte
+ODM_FillH2CCmd(
+ IN pu1Byte pH2CBuffer,
+ IN u4Byte H2CBufferLen,
+ IN u4Byte CmdNum,
+ IN pu4Byte pElementID,
+ IN pu4Byte pCmdLen,
+ IN pu1Byte* pCmbBuffer,
+ IN pu1Byte CmdStartSeq
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ //FillH2CCmd(pH2CBuffer, H2CBufferLen, CmdNum, pElementID, pCmdLen, pCmbBuffer, CmdStartSeq);
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+#endif
+
+
+u4Byte
+ODM_GetCurrentTime(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+ return 0;
+#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
+ return rtw_get_current_time();
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ return 0;
+#endif
+}
+
+s4Byte
+ODM_GetProgressingTime(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte 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);
+#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+ return 0;
+#endif
+}
+
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_interface.h b/rtl8xxx_EU/hal/OUTSRC/odm_interface.h
index 8c0303b..2400d4b 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_interface.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_interface.h
@@ -1,394 +1,394 @@
-/******************************************************************************
- *
- * 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 __ODM_INTERFACE_H__
-#define __ODM_INTERFACE_H__
-
-
-
-//
-// =========== Constant/Structure/Enum/... Define
-//
-
-
-
-//
-// =========== Macro Define
-//
-
-#define _reg_all(_name) ODM_##_name
-#define _reg_ic(_name, _ic) ODM_##_name##_ic
-#define _bit_all(_name) BIT_##_name
-#define _bit_ic(_name, _ic) BIT_##_name##_ic
-
-// _cat: implemented by Token-Pasting Operator.
-#if 0
-#define _cat(_name, _ic_type, _func) \
- ( \
- _func##_all(_name) \
- )
-#endif
-
-/*===================================
-
-#define ODM_REG_DIG_11N 0xC50
-#define ODM_REG_DIG_11AC 0xDDD
-
-ODM_REG(DIG,_pDM_Odm)
-=====================================*/
-
-#define _reg_11N(_name) ODM_REG_##_name##_11N
-#define _reg_11AC(_name) ODM_REG_##_name##_11AC
-#define _bit_11N(_name) ODM_BIT_##_name##_11N
-#define _bit_11AC(_name) ODM_BIT_##_name##_11AC
-
-#if 1 //TODO: enable it if we need to support run-time to differentiate between 92C_SERIES and JAGUAR_SERIES.
-#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
-
-// _name: name of register or bit.
-// Example: "ODM_REG(R_A_AGC_CORE1, pDM_Odm)"
-// gets "ODM_R_A_AGC_CORE1" or "ODM_R_A_AGC_CORE1_8192C", depends on SupportICType.
-#define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg)
-#define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit)
-
-typedef enum _ODM_H2C_CMD
-{
- ODM_H2C_RSSI_REPORT = 0,
- ODM_H2C_PSD_RESULT=1,
- ODM_H2C_PathDiv = 2,
- ODM_MAX_H2CCMD
-}ODM_H2C_CMD;
-
-
-//
-// 2012/02/17 MH For non-MP compile pass only. Linux does not support workitem.
-// Suggest HW team to use thread instead of workitem. Windows also support the feature.
-//
-#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
-typedef void *PRT_WORK_ITEM ;
-typedef void RT_WORKITEM_HANDLE,*PRT_WORKITEM_HANDLE;
-typedef VOID (*RT_WORKITEM_CALL_BACK)(PVOID pContext);
-
-#if 0
-typedef struct tasklet_struct RT_WORKITEM_HANDLE, *PRT_WORKITEM_HANDLE;
-
-typedef struct _RT_WORK_ITEM
-{
-
- RT_WORKITEM_HANDLE Handle; // Platform-dependent handle for this workitem, e.g. Ndis Workitem object.
- PVOID Adapter; // Pointer to Adapter object.
- PVOID pContext; // Parameter to passed to CallBackFunc().
- RT_WORKITEM_CALL_BACK CallbackFunc; // Callback function of the workitem.
- u1Byte RefCount; // 0: driver is going to unload, 1: No such workitem scheduled, 2: one workitem is schedueled.
- PVOID pPlatformExt; // Pointer to platform-dependent extension.
- BOOLEAN bFree;
- char szID[36]; // An identity string of this workitem.
-}RT_WORK_ITEM, *PRT_WORK_ITEM;
-
-#endif
-
-
-#endif
-
-//
-// =========== Extern Variable ??? It should be forbidden.
-//
-
-
-//
-// =========== EXtern Function Prototype
-//
-
-
-u1Byte
-ODM_Read1Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr
- );
-
-u2Byte
-ODM_Read2Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr
- );
-
-u4Byte
-ODM_Read4Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr
- );
-
-VOID
-ODM_Write1Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u1Byte Data
- );
-
-VOID
-ODM_Write2Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u2Byte Data
- );
-
-VOID
-ODM_Write4Byte(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte Data
- );
-
-VOID
-ODM_SetMACReg(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte BitMask,
- IN u4Byte Data
- );
-
-u4Byte
-ODM_GetMACReg(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte BitMask
- );
-
-VOID
-ODM_SetBBReg(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte BitMask,
- IN u4Byte Data
- );
-
-u4Byte
-ODM_GetBBReg(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte RegAddr,
- IN u4Byte BitMask
- );
-
-VOID
-ODM_SetRFReg(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_RF_RADIO_PATH_E eRFPath,
- IN u4Byte RegAddr,
- IN u4Byte BitMask,
- IN u4Byte Data
- );
-
-u4Byte
-ODM_GetRFReg(
- IN PDM_ODM_T pDM_Odm,
- IN ODM_RF_RADIO_PATH_E eRFPath,
- IN u4Byte RegAddr,
- IN u4Byte BitMask
- );
-
-
-//
-// Memory Relative Function.
-//
-VOID
-ODM_AllocateMemory(
- IN PDM_ODM_T pDM_Odm,
- OUT PVOID *pPtr,
- IN u4Byte length
- );
-VOID
-ODM_FreeMemory(
- IN PDM_ODM_T pDM_Odm,
- OUT PVOID pPtr,
- IN u4Byte length
- );
-
-VOID
-ODM_MoveMemory(
- IN PDM_ODM_T pDM_Odm,
- OUT PVOID pDest,
- IN PVOID pSrc,
- IN u4Byte Length
- );
-
-s4Byte ODM_CompareMemory(
- IN PDM_ODM_T pDM_Odm,
- IN PVOID pBuf1,
- IN PVOID pBuf2,
- IN u4Byte length
- );
-
-//
-// ODM MISC-spin lock relative API.
-//
-VOID
-ODM_AcquireSpinLock(
- IN PDM_ODM_T pDM_Odm,
- IN RT_SPINLOCK_TYPE type
- );
-
-VOID
-ODM_ReleaseSpinLock(
- IN PDM_ODM_T pDM_Odm,
- IN RT_SPINLOCK_TYPE type
- );
-
-
-//
-// ODM MISC-workitem relative API.
-//
-VOID
-ODM_InitializeWorkItem(
- IN PDM_ODM_T pDM_Odm,
- IN PRT_WORK_ITEM pRtWorkItem,
- IN RT_WORKITEM_CALL_BACK RtWorkItemCallback,
- IN PVOID pContext,
- IN const char* szID
- );
-
-VOID
-ODM_StartWorkItem(
- IN PRT_WORK_ITEM pRtWorkItem
- );
-
-VOID
-ODM_StopWorkItem(
- IN PRT_WORK_ITEM pRtWorkItem
- );
-
-VOID
-ODM_FreeWorkItem(
- IN PRT_WORK_ITEM pRtWorkItem
- );
-
-VOID
-ODM_ScheduleWorkItem(
- IN PRT_WORK_ITEM pRtWorkItem
- );
-
-VOID
-ODM_IsWorkItemScheduled(
- IN PRT_WORK_ITEM pRtWorkItem
- );
-
-//
-// ODM Timer relative API.
-//
-VOID
-ODM_StallExecution(
- IN u4Byte usDelay
- );
-
-VOID
-ODM_delay_ms(IN u4Byte ms);
-
-
-
-VOID
-ODM_delay_us(IN u4Byte us);
-
-VOID
-ODM_sleep_ms(IN u4Byte ms);
-
-VOID
-ODM_sleep_us(IN u4Byte us);
-
-VOID
-ODM_SetTimer(
- IN PDM_ODM_T pDM_Odm,
- IN PRT_TIMER pTimer,
- IN u4Byte msDelay
- );
-
-VOID
-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_CancelTimer(
- IN PDM_ODM_T pDM_Odm,
- IN PRT_TIMER pTimer
- );
-
-VOID
-ODM_ReleaseTimer(
- IN PDM_ODM_T pDM_Odm,
- IN PRT_TIMER pTimer
- );
-
-
-//
-// ODM FW relative API.
-//
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-VOID
-ODM_FillH2CCmd(
- IN PADAPTER Adapter,
- IN u1Byte ElementID,
- IN u4Byte CmdLen,
- IN pu1Byte pCmdBuffer
-);
-#else
-u4Byte
-ODM_FillH2CCmd(
- IN pu1Byte pH2CBuffer,
- IN u4Byte H2CBufferLen,
- IN u4Byte CmdNum,
- IN pu4Byte pElementID,
- IN pu4Byte pCmdLen,
- IN pu1Byte* pCmbBuffer,
- IN pu1Byte CmdStartSeq
- );
-#endif
-
-u4Byte
-ODM_GetCurrentTime(
- IN PDM_ODM_T pDM_Odm
- );
-s4Byte
-ODM_GetProgressingTime(
- IN PDM_ODM_T pDM_Odm,
- IN u4Byte Start_Time
- );
-
-#endif // __ODM_INTERFACE_H__
-
+/******************************************************************************
+ *
+ * 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 __ODM_INTERFACE_H__
+#define __ODM_INTERFACE_H__
+
+
+
+//
+// =========== Constant/Structure/Enum/... Define
+//
+
+
+
+//
+// =========== Macro Define
+//
+
+#define _reg_all(_name) ODM_##_name
+#define _reg_ic(_name, _ic) ODM_##_name##_ic
+#define _bit_all(_name) BIT_##_name
+#define _bit_ic(_name, _ic) BIT_##_name##_ic
+
+// _cat: implemented by Token-Pasting Operator.
+#if 0
+#define _cat(_name, _ic_type, _func) \
+ ( \
+ _func##_all(_name) \
+ )
+#endif
+
+/*===================================
+
+#define ODM_REG_DIG_11N 0xC50
+#define ODM_REG_DIG_11AC 0xDDD
+
+ODM_REG(DIG,_pDM_Odm)
+=====================================*/
+
+#define _reg_11N(_name) ODM_REG_##_name##_11N
+#define _reg_11AC(_name) ODM_REG_##_name##_11AC
+#define _bit_11N(_name) ODM_BIT_##_name##_11N
+#define _bit_11AC(_name) ODM_BIT_##_name##_11AC
+
+#if 1 //TODO: enable it if we need to support run-time to differentiate between 92C_SERIES and JAGUAR_SERIES.
+#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
+
+// _name: name of register or bit.
+// Example: "ODM_REG(R_A_AGC_CORE1, pDM_Odm)"
+// gets "ODM_R_A_AGC_CORE1" or "ODM_R_A_AGC_CORE1_8192C", depends on SupportICType.
+#define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg)
+#define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit)
+
+typedef enum _ODM_H2C_CMD
+{
+ ODM_H2C_RSSI_REPORT = 0,
+ ODM_H2C_PSD_RESULT=1,
+ ODM_H2C_PathDiv = 2,
+ ODM_MAX_H2CCMD
+}ODM_H2C_CMD;
+
+
+//
+// 2012/02/17 MH For non-MP compile pass only. Linux does not support workitem.
+// Suggest HW team to use thread instead of workitem. Windows also support the feature.
+//
+#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
+typedef void *PRT_WORK_ITEM ;
+typedef void RT_WORKITEM_HANDLE,*PRT_WORKITEM_HANDLE;
+typedef VOID (*RT_WORKITEM_CALL_BACK)(PVOID pContext);
+
+#if 0
+typedef struct tasklet_struct RT_WORKITEM_HANDLE, *PRT_WORKITEM_HANDLE;
+
+typedef struct _RT_WORK_ITEM
+{
+
+ RT_WORKITEM_HANDLE Handle; // Platform-dependent handle for this workitem, e.g. Ndis Workitem object.
+ PVOID Adapter; // Pointer to Adapter object.
+ PVOID pContext; // Parameter to passed to CallBackFunc().
+ RT_WORKITEM_CALL_BACK CallbackFunc; // Callback function of the workitem.
+ u1Byte RefCount; // 0: driver is going to unload, 1: No such workitem scheduled, 2: one workitem is schedueled.
+ PVOID pPlatformExt; // Pointer to platform-dependent extension.
+ BOOLEAN bFree;
+ char szID[36]; // An identity string of this workitem.
+}RT_WORK_ITEM, *PRT_WORK_ITEM;
+
+#endif
+
+
+#endif
+
+//
+// =========== Extern Variable ??? It should be forbidden.
+//
+
+
+//
+// =========== EXtern Function Prototype
+//
+
+
+u1Byte
+ODM_Read1Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr
+ );
+
+u2Byte
+ODM_Read2Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr
+ );
+
+u4Byte
+ODM_Read4Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr
+ );
+
+VOID
+ODM_Write1Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u1Byte Data
+ );
+
+VOID
+ODM_Write2Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u2Byte Data
+ );
+
+VOID
+ODM_Write4Byte(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte Data
+ );
+
+VOID
+ODM_SetMACReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask,
+ IN u4Byte Data
+ );
+
+u4Byte
+ODM_GetMACReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask
+ );
+
+VOID
+ODM_SetBBReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask,
+ IN u4Byte Data
+ );
+
+u4Byte
+ODM_GetBBReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask
+ );
+
+VOID
+ODM_SetRFReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_RF_RADIO_PATH_E eRFPath,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask,
+ IN u4Byte Data
+ );
+
+u4Byte
+ODM_GetRFReg(
+ IN PDM_ODM_T pDM_Odm,
+ IN ODM_RF_RADIO_PATH_E eRFPath,
+ IN u4Byte RegAddr,
+ IN u4Byte BitMask
+ );
+
+
+//
+// Memory Relative Function.
+//
+VOID
+ODM_AllocateMemory(
+ IN PDM_ODM_T pDM_Odm,
+ OUT PVOID *pPtr,
+ IN u4Byte length
+ );
+VOID
+ODM_FreeMemory(
+ IN PDM_ODM_T pDM_Odm,
+ OUT PVOID pPtr,
+ IN u4Byte length
+ );
+
+VOID
+ODM_MoveMemory(
+ IN PDM_ODM_T pDM_Odm,
+ OUT PVOID pDest,
+ IN PVOID pSrc,
+ IN u4Byte Length
+ );
+
+s4Byte ODM_CompareMemory(
+ IN PDM_ODM_T pDM_Odm,
+ IN PVOID pBuf1,
+ IN PVOID pBuf2,
+ IN u4Byte length
+ );
+
+//
+// ODM MISC-spin lock relative API.
+//
+VOID
+ODM_AcquireSpinLock(
+ IN PDM_ODM_T pDM_Odm,
+ IN RT_SPINLOCK_TYPE type
+ );
+
+VOID
+ODM_ReleaseSpinLock(
+ IN PDM_ODM_T pDM_Odm,
+ IN RT_SPINLOCK_TYPE type
+ );
+
+
+//
+// ODM MISC-workitem relative API.
+//
+VOID
+ODM_InitializeWorkItem(
+ IN PDM_ODM_T pDM_Odm,
+ IN PRT_WORK_ITEM pRtWorkItem,
+ IN RT_WORKITEM_CALL_BACK RtWorkItemCallback,
+ IN PVOID pContext,
+ IN const char* szID
+ );
+
+VOID
+ODM_StartWorkItem(
+ IN PRT_WORK_ITEM pRtWorkItem
+ );
+
+VOID
+ODM_StopWorkItem(
+ IN PRT_WORK_ITEM pRtWorkItem
+ );
+
+VOID
+ODM_FreeWorkItem(
+ IN PRT_WORK_ITEM pRtWorkItem
+ );
+
+VOID
+ODM_ScheduleWorkItem(
+ IN PRT_WORK_ITEM pRtWorkItem
+ );
+
+VOID
+ODM_IsWorkItemScheduled(
+ IN PRT_WORK_ITEM pRtWorkItem
+ );
+
+//
+// ODM Timer relative API.
+//
+VOID
+ODM_StallExecution(
+ IN u4Byte usDelay
+ );
+
+VOID
+ODM_delay_ms(IN u4Byte ms);
+
+
+
+VOID
+ODM_delay_us(IN u4Byte us);
+
+VOID
+ODM_sleep_ms(IN u4Byte ms);
+
+VOID
+ODM_sleep_us(IN u4Byte us);
+
+VOID
+ODM_SetTimer(
+ IN PDM_ODM_T pDM_Odm,
+ IN PRT_TIMER pTimer,
+ IN u4Byte msDelay
+ );
+
+VOID
+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_CancelTimer(
+ IN PDM_ODM_T pDM_Odm,
+ IN PRT_TIMER pTimer
+ );
+
+VOID
+ODM_ReleaseTimer(
+ IN PDM_ODM_T pDM_Odm,
+ IN PRT_TIMER pTimer
+ );
+
+
+//
+// ODM FW relative API.
+//
+#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
+VOID
+ODM_FillH2CCmd(
+ IN PADAPTER Adapter,
+ IN u1Byte ElementID,
+ IN u4Byte CmdLen,
+ IN pu1Byte pCmdBuffer
+);
+#else
+u4Byte
+ODM_FillH2CCmd(
+ IN pu1Byte pH2CBuffer,
+ IN u4Byte H2CBufferLen,
+ IN u4Byte CmdNum,
+ IN pu4Byte pElementID,
+ IN pu4Byte pCmdLen,
+ IN pu1Byte* pCmbBuffer,
+ IN pu1Byte CmdStartSeq
+ );
+#endif
+
+u4Byte
+ODM_GetCurrentTime(
+ IN PDM_ODM_T pDM_Odm
+ );
+s4Byte
+ODM_GetProgressingTime(
+ IN PDM_ODM_T pDM_Odm,
+ IN u4Byte Start_Time
+ );
+
+#endif // __ODM_INTERFACE_H__
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/odm_precomp.h b/rtl8xxx_EU/hal/OUTSRC/odm_precomp.h
index e3c71d2..e207dce 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_precomp.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_precomp.h
@@ -1,307 +1,307 @@
-/******************************************************************************
- *
- * 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 __ODM_PRECOMP_H__
-#define __ODM_PRECOMP_H__
-
-#include "odm_types.h"
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-#include "Precomp.h" // We need to include mp_precomp.h due to batch file setting.
-
-#else
-
-#define TEST_FALG___ 1
-
-#endif
-
-//2 Config Flags and Structs - defined by each ODM Type
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- #include "../8192cd_cfg.h"
- #include "../odm_inc.h"
-
- #include "../8192cd.h"
- #include "../8192cd_util.h"
- #ifdef _BIG_ENDIAN_
- #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
- #else
- #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
- #endif
-
- #ifdef AP_BUILD_WORKAROUND
- #include "../8192cd_headers.h"
- #include "../8192cd_debug.h"
- #endif
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_ADSL)
- // Flags
- #include "../8192cd_cfg.h" // OUTSRC needs ADSL config flags.
- #include "../odm_inc.h" // OUTSRC needs some extra flags.
- // Data Structure
- #include "../common_types.h" // OUTSRC and rtl8192cd both needs basic type such as UINT8 and BIT0.
- #include "../8192cd.h" // OUTSRC needs basic ADSL struct definition.
- #include "../8192cd_util.h" // OUTSRC needs basic I/O function.
- #ifdef _BIG_ENDIAN_
- #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
- #else
- #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
- #endif
-
- #ifdef ADSL_AP_BUILD_WORKAROUND
- // NESTED_INC: Functions defined outside should not be included!! Marked by Annie, 2011-10-14.
- #include "../8192cd_headers.h"
- #include "../8192cd_debug.h"
- #endif
-
-#elif (DM_ODM_SUPPORT_TYPE ==ODM_CE)
- //#include <drv_conf.h>
- //#include <basic_types.h>
- //#include <osdep_service.h>
- //#include <drv_types.h>
- //#include <rtw_byteorder.h>
- //#include <hal_intf.h>
-#define BEAMFORMING_SUPPORT 0
-#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #include "Mp_Precomp.h"
- #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
-#endif
-
-
-//2 Hardware Parameter Files
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-#if (RTL8192C_SUPPORT==1)
- #include "rtl8192c/Hal8192CEFWImg_AP.h"
- #include "rtl8192c/Hal8192CEPHYImg_AP.h"
- #include "rtl8192c/Hal8192CEMACImg_AP.h"
-#endif
-#elif (DM_ODM_SUPPORT_TYPE == ODM_ADSL)
- #include "rtl8192c/Hal8192CEFWImg_ADSL.h"
- #include "rtl8192c/Hal8192CEPHYImg_ADSL.h"
- #include "rtl8192c/Hal8192CEMACImg_ADSL.h"
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- #if(RTL8192CE_SUPPORT ==1)
- #include "rtl8192c/Hal8192CEFWImg_CE.h"
- #include "rtl8192c/Hal8192CEPHYImg_CE.h"
- #include "rtl8192c/Hal8192CEMACImg_CE.h"
- #endif
-
- #if(RTL8192CU_SUPPORT ==1)
- #include "rtl8192c/Hal8192CUFWImg_CE.h"
- #include "rtl8192c/Hal8192CUPHYImg_CE.h"
- #include "rtl8192c/Hal8192CUMACImg_CE.h"
- #endif
-
- #if(RTL8192DE_SUPPORT ==1)
- #include "rtl8192d/Hal8192DEFWImg_CE.h"
- #include "rtl8192d/Hal8192DEPHYImg_CE.h"
- #include "rtl8192d/Hal8192DEMACImg_CE.h"
- #endif
-
- #if(RTL8192DU_SUPPORT ==1)
- #include "rtl8192d/Hal8192DUFWImg_CE.h"
- #include "rtl8192d/Hal8192DUPHYImg_CE.h"
- #include "rtl8192d/Hal8192DUMACImg_CE.h"
- #endif
-
- #if(RTL8723AS_SUPPORT==1)
- #include "rtl8723a/Hal8723SHWImg_CE.h"
- #endif
-
- #if(RTL8723AU_SUPPORT==1)
- #include "rtl8723a/Hal8723UHWImg_CE.h"
- #endif
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-#endif
-
-
-//2 OutSrc Header Files
-
-#include "odm.h"
-#include "odm_HWConfig.h"
-#include "odm_debug.h"
-#include "odm_RegDefine11AC.h"
-#include "odm_RegDefine11N.h"
-#include "odm_AntDiv.h"
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-#if (RTL8192C_SUPPORT==1)
- #include "rtl8192c/HalDMOutSrc8192C_AP.h"
-#endif
-#if (RTL8188E_SUPPORT==1)
- #include "rtl8188e/Hal8188ERateAdaptive.h"//for RA,Power training
-#endif
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_ADSL)
- #include "rtl8192c/HalDMOutSrc8192C_ADSL.h"
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- //#include "hal_com.h"
- #include "HalPhyRf.h"
- #if (RTL8192C_SUPPORT==1)
- #ifdef CONFIG_INTEL_PROXIM
- #include "../proxim/intel_proxim.h"
- #endif
- #include "rtl8192c/HalDMOutSrc8192C_CE.h"
- #include <rtl8192c_hal.h>
- #endif
-
- #if (RTL8192D_SUPPORT==1)
- #include "rtl8192d/HalDMOutSrc8192D_CE.h"
- #include "rtl8192d_hal.h"
- #endif
-
- #if (RTL8723A_SUPPORT==1)
- #include "rtl8192c/HalDMOutSrc8192C_CE.h" //for IQK,LCK,Power-tracking
- #include "rtl8723a_hal.h"
- #endif
-
- #if (RTL8188E_SUPPORT==1)
- #include "rtl8188e/HalPhyRf_8188e.h"//for IQK,LCK,Power-tracking
- #include "rtl8188e/Hal8188ERateAdaptive.h"//for RA,Power training
- #include "rtl8188e_hal.h"
- #endif
-
- #if (RTL8192E_SUPPORT==1)
- #include "rtl8192e/HalPhyRf_8192e.h"//for IQK,LCK,Power-tracking
- #include "rtl8192e_hal.h"
- #endif
-
- #if (RTL8812A_SUPPORT==1)
- #include "rtl8812a/HalPhyRf_8812A.h"//for IQK,LCK,Power-tracking
- #include "rtl8812a_hal.h"
- #endif
-
- #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"
- #endif
-
- #if (RTL8723B_SUPPORT==1)
- #include "rtl8723b/HalPhyRf_8723B.h"//for IQK,LCK,Power-tracking
- #include "rtl8723b_hal.h"
- #endif
-#endif
-
-#include "odm_interface.h"
-#include "odm_reg.h"
-
-#if (RTL8192C_SUPPORT==1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-#include "rtl8192c/Hal8192CHWImg_MAC.h"
-#include "rtl8192c/Hal8192CHWImg_RF.h"
-#include "rtl8192c/Hal8192CHWImg_BB.h"
-#include "rtl8192c/Hal8192CHWImg_FW.h"
-#endif
-#include "rtl8192c/odm_RTL8192C.h"
-#endif
-#if (RTL8192D_SUPPORT==1)
-#include "rtl8192d/odm_RTL8192D.h"
-#endif
-
-#if (RTL8723A_SUPPORT==1)
-#include "rtl8723a/HalHWImg8723A_MAC.h"
-#include "rtl8723a/HalHWImg8723A_RF.h"
-#include "rtl8723a/HalHWImg8723A_BB.h"
-#include "rtl8723a/HalHWImg8723A_FW.h"
-#include "rtl8723a/odm_RegConfig8723A.h"
-#endif
-
-#if (RTL8188E_SUPPORT==1)
-#include "rtl8188e/HalHWImg8188E_MAC.h"
-#include "rtl8188e/HalHWImg8188E_RF.h"
-#include "rtl8188e/HalHWImg8188E_BB.h"
-#include "rtl8188e/HalHWImg8188E_FW.h"
-#include "rtl8188e/Hal8188EReg.h"
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
-#include "rtl8188e/HalPhyRf_8188e.h"
-#endif
-
-#if (TESTCHIP_SUPPORT == 1)
-#include "rtl8188e/HalHWImg8188E_TestChip_MAC.h"
-#include "rtl8188e/HalHWImg8188E_TestChip_RF.h"
-#include "rtl8188e/HalHWImg8188E_TestChip_BB.h"
-#endif
-
-
-#include "rtl8188e/odm_RegConfig8188E.h"
-#include "rtl8188e/odm_RTL8188E.h"
-#endif
-
-#if (RTL8192E_SUPPORT==1)
-#include "rtl8192e/HalHWImg8192E_MAC.h"
-#include "rtl8192e/HalHWImg8192E_RF.h"
-#include "rtl8192e/HalHWImg8192E_BB.h"
-#include "rtl8192e/HalHWImg8192E_FW.h"
-#include "rtl8192e/Hal8192EReg.h"
-#include "rtl8192e/odm_RegConfig8192E.h"
-#include "rtl8192e/odm_RTL8192E.h"
-#endif
-
-#if (RTL8723B_SUPPORT==1)
-#include "rtl8723b/HalHWImg8723B_MAC.h"
-#include "rtl8723b/HalHWImg8723B_RF.h"
-#include "rtl8723b/HalHWImg8723B_BB.h"
-#include "rtl8723b/HalHWImg8723B_FW.h"
-#include "rtl8723b/HalHWImg8723B_MP.h"
-#include "rtl8723b/Hal8723BReg.h"
-#include "rtl8723b/odm_RTL8723B.h"
-#include "rtl8723b/odm_RegConfig8723B.h"
-#endif
-
-#if (RTL8812A_SUPPORT==1)
-#include "rtl8812a/HalHWImg8812A_MAC.h"
-#include "rtl8812a/HalHWImg8812A_RF.h"
-#include "rtl8812a/HalHWImg8812A_BB.h"
-#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
-
-
-#if (RTL8821A_SUPPORT==1)
-#include "rtl8821a/HalHWImg8821A_MAC.h"
-#include "rtl8821a/HalHWImg8821A_RF.h"
-#include "rtl8821a/HalHWImg8821A_BB.h"
-#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__
-
+/******************************************************************************
+ *
+ * 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 __ODM_PRECOMP_H__
+#define __ODM_PRECOMP_H__
+
+#include "odm_types.h"
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+#include "Precomp.h" // We need to include mp_precomp.h due to batch file setting.
+
+#else
+
+#define TEST_FALG___ 1
+
+#endif
+
+//2 Config Flags and Structs - defined by each ODM Type
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+ #include "../8192cd_cfg.h"
+ #include "../odm_inc.h"
+
+ #include "../8192cd.h"
+ #include "../8192cd_util.h"
+ #ifdef _BIG_ENDIAN_
+ #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
+ #else
+ #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
+ #endif
+
+ #ifdef AP_BUILD_WORKAROUND
+ #include "../8192cd_headers.h"
+ #include "../8192cd_debug.h"
+ #endif
+
+#elif (DM_ODM_SUPPORT_TYPE == ODM_ADSL)
+ // Flags
+ #include "../8192cd_cfg.h" // OUTSRC needs ADSL config flags.
+ #include "../odm_inc.h" // OUTSRC needs some extra flags.
+ // Data Structure
+ #include "../common_types.h" // OUTSRC and rtl8192cd both needs basic type such as UINT8 and BIT0.
+ #include "../8192cd.h" // OUTSRC needs basic ADSL struct definition.
+ #include "../8192cd_util.h" // OUTSRC needs basic I/O function.
+ #ifdef _BIG_ENDIAN_
+ #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
+ #else
+ #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
+ #endif
+
+ #ifdef ADSL_AP_BUILD_WORKAROUND
+ // NESTED_INC: Functions defined outside should not be included!! Marked by Annie, 2011-10-14.
+ #include "../8192cd_headers.h"
+ #include "../8192cd_debug.h"
+ #endif
+
+#elif (DM_ODM_SUPPORT_TYPE ==ODM_CE)
+ //#include <drv_conf.h>
+ //#include <basic_types.h>
+ //#include <osdep_service.h>
+ //#include <drv_types.h>
+ //#include <rtw_byteorder.h>
+ //#include <hal_intf.h>
+#define BEAMFORMING_SUPPORT 0
+#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ #include "Mp_Precomp.h"
+ #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
+#endif
+
+
+//2 Hardware Parameter Files
+
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+#if (RTL8192C_SUPPORT==1)
+ #include "rtl8192c/Hal8192CEFWImg_AP.h"
+ #include "rtl8192c/Hal8192CEPHYImg_AP.h"
+ #include "rtl8192c/Hal8192CEMACImg_AP.h"
+#endif
+#elif (DM_ODM_SUPPORT_TYPE == ODM_ADSL)
+ #include "rtl8192c/Hal8192CEFWImg_ADSL.h"
+ #include "rtl8192c/Hal8192CEPHYImg_ADSL.h"
+ #include "rtl8192c/Hal8192CEMACImg_ADSL.h"
+
+#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ #if(RTL8192CE_SUPPORT ==1)
+ #include "rtl8192c/Hal8192CEFWImg_CE.h"
+ #include "rtl8192c/Hal8192CEPHYImg_CE.h"
+ #include "rtl8192c/Hal8192CEMACImg_CE.h"
+ #endif
+
+ #if(RTL8192CU_SUPPORT ==1)
+ #include "rtl8192c/Hal8192CUFWImg_CE.h"
+ #include "rtl8192c/Hal8192CUPHYImg_CE.h"
+ #include "rtl8192c/Hal8192CUMACImg_CE.h"
+ #endif
+
+ #if(RTL8192DE_SUPPORT ==1)
+ #include "rtl8192d/Hal8192DEFWImg_CE.h"
+ #include "rtl8192d/Hal8192DEPHYImg_CE.h"
+ #include "rtl8192d/Hal8192DEMACImg_CE.h"
+ #endif
+
+ #if(RTL8192DU_SUPPORT ==1)
+ #include "rtl8192d/Hal8192DUFWImg_CE.h"
+ #include "rtl8192d/Hal8192DUPHYImg_CE.h"
+ #include "rtl8192d/Hal8192DUMACImg_CE.h"
+ #endif
+
+ #if(RTL8723AS_SUPPORT==1)
+ #include "rtl8723a/Hal8723SHWImg_CE.h"
+ #endif
+
+ #if(RTL8723AU_SUPPORT==1)
+ #include "rtl8723a/Hal8723UHWImg_CE.h"
+ #endif
+
+#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+
+#endif
+
+
+//2 OutSrc Header Files
+
+#include "odm.h"
+#include "odm_HWConfig.h"
+#include "odm_debug.h"
+#include "odm_RegDefine11AC.h"
+#include "odm_RegDefine11N.h"
+#include "odm_AntDiv.h"
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+#if (RTL8192C_SUPPORT==1)
+ #include "rtl8192c/HalDMOutSrc8192C_AP.h"
+#endif
+#if (RTL8188E_SUPPORT==1)
+ #include "rtl8188e/Hal8188ERateAdaptive.h"//for RA,Power training
+#endif
+
+#elif (DM_ODM_SUPPORT_TYPE == ODM_ADSL)
+ #include "rtl8192c/HalDMOutSrc8192C_ADSL.h"
+
+#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ //#include "hal_com.h"
+ #include "HalPhyRf.h"
+ #if (RTL8192C_SUPPORT==1)
+ #ifdef CONFIG_INTEL_PROXIM
+ #include "../proxim/intel_proxim.h"
+ #endif
+ #include "rtl8192c/HalDMOutSrc8192C_CE.h"
+ #include <rtl8192c_hal.h>
+ #endif
+
+ #if (RTL8192D_SUPPORT==1)
+ #include "rtl8192d/HalDMOutSrc8192D_CE.h"
+ #include "rtl8192d_hal.h"
+ #endif
+
+ #if (RTL8723A_SUPPORT==1)
+ #include "rtl8192c/HalDMOutSrc8192C_CE.h" //for IQK,LCK,Power-tracking
+ #include "rtl8723a_hal.h"
+ #endif
+
+ #if (RTL8188E_SUPPORT==1)
+ #include "rtl8188e/HalPhyRf_8188e.h"//for IQK,LCK,Power-tracking
+ #include "rtl8188e/Hal8188ERateAdaptive.h"//for RA,Power training
+ #include "rtl8188e_hal.h"
+ #endif
+
+ #if (RTL8192E_SUPPORT==1)
+ #include "rtl8192e/HalPhyRf_8192e.h"//for IQK,LCK,Power-tracking
+ #include "rtl8192e_hal.h"
+ #endif
+
+ #if (RTL8812A_SUPPORT==1)
+ #include "rtl8812a/HalPhyRf_8812A.h"//for IQK,LCK,Power-tracking
+ #include "rtl8812a_hal.h"
+ #endif
+
+ #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"
+ #endif
+
+ #if (RTL8723B_SUPPORT==1)
+ #include "rtl8723b/HalPhyRf_8723B.h"//for IQK,LCK,Power-tracking
+ #include "rtl8723b_hal.h"
+ #endif
+#endif
+
+#include "odm_interface.h"
+#include "odm_reg.h"
+
+#if (RTL8192C_SUPPORT==1)
+#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
+#include "rtl8192c/Hal8192CHWImg_MAC.h"
+#include "rtl8192c/Hal8192CHWImg_RF.h"
+#include "rtl8192c/Hal8192CHWImg_BB.h"
+#include "rtl8192c/Hal8192CHWImg_FW.h"
+#endif
+#include "rtl8192c/odm_RTL8192C.h"
+#endif
+#if (RTL8192D_SUPPORT==1)
+#include "rtl8192d/odm_RTL8192D.h"
+#endif
+
+#if (RTL8723A_SUPPORT==1)
+#include "rtl8723a/HalHWImg8723A_MAC.h"
+#include "rtl8723a/HalHWImg8723A_RF.h"
+#include "rtl8723a/HalHWImg8723A_BB.h"
+#include "rtl8723a/HalHWImg8723A_FW.h"
+#include "rtl8723a/odm_RegConfig8723A.h"
+#endif
+
+#if (RTL8188E_SUPPORT==1)
+#include "rtl8188e/HalHWImg8188E_MAC.h"
+#include "rtl8188e/HalHWImg8188E_RF.h"
+#include "rtl8188e/HalHWImg8188E_BB.h"
+#include "rtl8188e/HalHWImg8188E_FW.h"
+#include "rtl8188e/Hal8188EReg.h"
+
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+#include "rtl8188e/HalPhyRf_8188e.h"
+#endif
+
+#if (TESTCHIP_SUPPORT == 1)
+#include "rtl8188e/HalHWImg8188E_TestChip_MAC.h"
+#include "rtl8188e/HalHWImg8188E_TestChip_RF.h"
+#include "rtl8188e/HalHWImg8188E_TestChip_BB.h"
+#endif
+
+
+#include "rtl8188e/odm_RegConfig8188E.h"
+#include "rtl8188e/odm_RTL8188E.h"
+#endif
+
+#if (RTL8192E_SUPPORT==1)
+#include "rtl8192e/HalHWImg8192E_MAC.h"
+#include "rtl8192e/HalHWImg8192E_RF.h"
+#include "rtl8192e/HalHWImg8192E_BB.h"
+#include "rtl8192e/HalHWImg8192E_FW.h"
+#include "rtl8192e/Hal8192EReg.h"
+#include "rtl8192e/odm_RegConfig8192E.h"
+#include "rtl8192e/odm_RTL8192E.h"
+#endif
+
+#if (RTL8723B_SUPPORT==1)
+#include "rtl8723b/HalHWImg8723B_MAC.h"
+#include "rtl8723b/HalHWImg8723B_RF.h"
+#include "rtl8723b/HalHWImg8723B_BB.h"
+#include "rtl8723b/HalHWImg8723B_FW.h"
+#include "rtl8723b/HalHWImg8723B_MP.h"
+#include "rtl8723b/Hal8723BReg.h"
+#include "rtl8723b/odm_RTL8723B.h"
+#include "rtl8723b/odm_RegConfig8723B.h"
+#endif
+
+#if (RTL8812A_SUPPORT==1)
+#include "rtl8812a/HalHWImg8812A_MAC.h"
+#include "rtl8812a/HalHWImg8812A_RF.h"
+#include "rtl8812a/HalHWImg8812A_BB.h"
+#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
+
+
+#if (RTL8821A_SUPPORT==1)
+#include "rtl8821a/HalHWImg8821A_MAC.h"
+#include "rtl8821a/HalHWImg8821A_RF.h"
+#include "rtl8821a/HalHWImg8821A_BB.h"
+#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/rtl8xxx_EU/hal/OUTSRC/odm_reg.h b/rtl8xxx_EU/hal/OUTSRC/odm_reg.h
index 16999a1..dfdf467 100755
--- a/rtl8xxx_EU/hal/OUTSRC/odm_reg.h
+++ b/rtl8xxx_EU/hal/OUTSRC/odm_reg.h
@@ -1,122 +1,122 @@
-/******************************************************************************
- *
- * 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
- *
- *
- ******************************************************************************/
-//============================================================
-// File Name: odm_reg.h
-//
-// Description:
-//
-// This file is for general register definition.
-//
-//
-//============================================================
-#ifndef __HAL_ODM_REG_H__
-#define __HAL_ODM_REG_H__
-
-//
-// Register Definition
-//
-
-//MAC REG
-#define ODM_BB_RESET 0x002
-#define ODM_DUMMY 0x4fe
-#define RF_T_METER_OLD 0x24
-#define RF_T_METER_NEW 0x42
-
-#define ODM_EDCA_VO_PARAM 0x500
-#define ODM_EDCA_VI_PARAM 0x504
-#define ODM_EDCA_BE_PARAM 0x508
-#define ODM_EDCA_BK_PARAM 0x50C
-#define ODM_TXPAUSE 0x522
-
-//BB REG
-#define ODM_FPGA_PHY0_PAGE8 0x800
-#define ODM_PSD_SETTING 0x808
-#define ODM_AFE_SETTING 0x818
-#define ODM_TXAGC_B_24_54 0x834
-#define ODM_TXAGC_B_MCS32_5 0x838
-#define ODM_TXAGC_B_MCS0_MCS3 0x83c
-#define ODM_TXAGC_B_MCS4_MCS7 0x848
-#define ODM_TXAGC_B_MCS8_MCS11 0x84c
-#define ODM_ANALOG_REGISTER 0x85c
-#define ODM_RF_INTERFACE_OUTPUT 0x860
-#define ODM_TXAGC_B_MCS12_MCS15 0x868
-#define ODM_TXAGC_B_11_A_2_11 0x86c
-#define ODM_AD_DA_LSB_MASK 0x874
-#define ODM_ENABLE_3_WIRE 0x88c
-#define ODM_PSD_REPORT 0x8b4
-#define ODM_R_ANT_SELECT 0x90c
-#define ODM_CCK_ANT_SELECT 0xa07
-#define ODM_CCK_PD_THRESH 0xa0a
-#define ODM_CCK_RF_REG1 0xa11
-#define ODM_CCK_MATCH_FILTER 0xa20
-#define ODM_CCK_RAKE_MAC 0xa2e
-#define ODM_CCK_CNT_RESET 0xa2d
-#define ODM_CCK_TX_DIVERSITY 0xa2f
-#define ODM_CCK_FA_CNT_MSB 0xa5b
-#define ODM_CCK_FA_CNT_LSB 0xa5c
-#define ODM_CCK_NEW_FUNCTION 0xa75
-#define ODM_OFDM_PHY0_PAGE_C 0xc00
-#define ODM_OFDM_RX_ANT 0xc04
-#define ODM_R_A_RXIQI 0xc14
-#define ODM_R_A_AGC_CORE1 0xc50
-#define ODM_R_A_AGC_CORE2 0xc54
-#define ODM_R_B_AGC_CORE1 0xc58
-#define ODM_R_AGC_PAR 0xc70
-#define ODM_R_HTSTF_AGC_PAR 0xc7c
-#define ODM_TX_PWR_TRAINING_A 0xc90
-#define ODM_TX_PWR_TRAINING_B 0xc98
-#define ODM_OFDM_FA_CNT1 0xcf0
-#define ODM_OFDM_PHY0_PAGE_D 0xd00
-#define ODM_OFDM_FA_CNT2 0xda0
-#define ODM_OFDM_FA_CNT3 0xda4
-#define ODM_OFDM_FA_CNT4 0xda8
-#define ODM_TXAGC_A_6_18 0xe00
-#define ODM_TXAGC_A_24_54 0xe04
-#define ODM_TXAGC_A_1_MCS32 0xe08
-#define ODM_TXAGC_A_MCS0_MCS3 0xe10
-#define ODM_TXAGC_A_MCS4_MCS7 0xe14
-#define ODM_TXAGC_A_MCS8_MCS11 0xe18
-#define ODM_TXAGC_A_MCS12_MCS15 0xe1c
-
-//RF REG
-#define ODM_GAIN_SETTING 0x00
-#define ODM_CHANNEL 0x18
-
-//Ant Detect Reg
-#define ODM_DPDT 0x300
-
-//PSD Init
-#define ODM_PSDREG 0x808
-
-//92D Path Div
-#define PATHDIV_REG 0xB30
-#define PATHDIV_TRI 0xBA0
-
-
-//
-// Bitmap Definition
-//
-
-#define BIT_FA_RESET BIT0
-
-
-
-#endif
-
+/******************************************************************************
+ *
+ * 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
+ *
+ *
+ ******************************************************************************/
+//============================================================
+// File Name: odm_reg.h
+//
+// Description:
+//
+// This file is for general register definition.
+//
+//
+//============================================================
+#ifndef __HAL_ODM_REG_H__
+#define __HAL_ODM_REG_H__
+
+//
+// Register Definition
+//
+
+//MAC REG
+#define ODM_BB_RESET 0x002
+#define ODM_DUMMY 0x4fe
+#define RF_T_METER_OLD 0x24
+#define RF_T_METER_NEW 0x42
+
+#define ODM_EDCA_VO_PARAM 0x500
+#define ODM_EDCA_VI_PARAM 0x504
+#define ODM_EDCA_BE_PARAM 0x508
+#define ODM_EDCA_BK_PARAM 0x50C
+#define ODM_TXPAUSE 0x522
+
+//BB REG
+#define ODM_FPGA_PHY0_PAGE8 0x800
+#define ODM_PSD_SETTING 0x808
+#define ODM_AFE_SETTING 0x818
+#define ODM_TXAGC_B_24_54 0x834
+#define ODM_TXAGC_B_MCS32_5 0x838
+#define ODM_TXAGC_B_MCS0_MCS3 0x83c
+#define ODM_TXAGC_B_MCS4_MCS7 0x848
+#define ODM_TXAGC_B_MCS8_MCS11 0x84c
+#define ODM_ANALOG_REGISTER 0x85c
+#define ODM_RF_INTERFACE_OUTPUT 0x860
+#define ODM_TXAGC_B_MCS12_MCS15 0x868
+#define ODM_TXAGC_B_11_A_2_11 0x86c
+#define ODM_AD_DA_LSB_MASK 0x874
+#define ODM_ENABLE_3_WIRE 0x88c
+#define ODM_PSD_REPORT 0x8b4
+#define ODM_R_ANT_SELECT 0x90c
+#define ODM_CCK_ANT_SELECT 0xa07
+#define ODM_CCK_PD_THRESH 0xa0a
+#define ODM_CCK_RF_REG1 0xa11
+#define ODM_CCK_MATCH_FILTER 0xa20
+#define ODM_CCK_RAKE_MAC 0xa2e
+#define ODM_CCK_CNT_RESET 0xa2d
+#define ODM_CCK_TX_DIVERSITY 0xa2f
+#define ODM_CCK_FA_CNT_MSB 0xa5b
+#define ODM_CCK_FA_CNT_LSB 0xa5c
+#define ODM_CCK_NEW_FUNCTION 0xa75
+#define ODM_OFDM_PHY0_PAGE_C 0xc00
+#define ODM_OFDM_RX_ANT 0xc04
+#define ODM_R_A_RXIQI 0xc14
+#define ODM_R_A_AGC_CORE1 0xc50
+#define ODM_R_A_AGC_CORE2 0xc54
+#define ODM_R_B_AGC_CORE1 0xc58
+#define ODM_R_AGC_PAR 0xc70
+#define ODM_R_HTSTF_AGC_PAR 0xc7c
+#define ODM_TX_PWR_TRAINING_A 0xc90
+#define ODM_TX_PWR_TRAINING_B 0xc98
+#define ODM_OFDM_FA_CNT1 0xcf0
+#define ODM_OFDM_PHY0_PAGE_D 0xd00
+#define ODM_OFDM_FA_CNT2 0xda0
+#define ODM_OFDM_FA_CNT3 0xda4
+#define ODM_OFDM_FA_CNT4 0xda8
+#define ODM_TXAGC_A_6_18 0xe00
+#define ODM_TXAGC_A_24_54 0xe04
+#define ODM_TXAGC_A_1_MCS32 0xe08
+#define ODM_TXAGC_A_MCS0_MCS3 0xe10
+#define ODM_TXAGC_A_MCS4_MCS7 0xe14
+#define ODM_TXAGC_A_MCS8_MCS11 0xe18
+#define ODM_TXAGC_A_MCS12_MCS15 0xe1c
+
+//RF REG
+#define ODM_GAIN_SETTING 0x00
+#define ODM_CHANNEL 0x18
+
+//Ant Detect Reg
+#define ODM_DPDT 0x300
+
+//PSD Init
+#define ODM_PSDREG 0x808
+
+//92D Path Div
+#define PATHDIV_REG 0xB30
+#define PATHDIV_TRI 0xBA0
+
+
+//
+// Bitmap Definition
+//
+
+#define BIT_FA_RESET BIT0
+
+
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188ERateAdaptive.h b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188ERateAdaptive.h
index d11f228..172edf1 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188ERateAdaptive.h
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188ERateAdaptive.h
@@ -1,108 +1,108 @@
-#ifndef __INC_RA_H
-#define __INC_RA_H
-/*++
-Copyright (c) Realtek Semiconductor Corp. All rights reserved.
-
-Module Name:
- RateAdaptive.h
-
-Abstract:
- Prototype of RA and related data structure.
-
-Major Change History:
- When Who What
- ---------- --------------- -------------------------------
- 2011-08-12 Page Create.
---*/
-
-// Rate adaptive define
-#define PERENTRY 23
-#define RETRYSIZE 5
-#define RATESIZE 28
-#define TX_RPT2_ITEM_SIZE 8
-
-#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
-//
-// TX report 2 format in Rx desc
-//
-#define GET_TX_RPT2_DESC_PKT_LEN_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 9)
-#define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 0, 32)
-#define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
-
-#define GET_TX_REPORT_TYPE1_RERTY_0(__pAddr) LE_BITS_TO_4BYTE( __pAddr, 0, 16)
-#define GET_TX_REPORT_TYPE1_RERTY_1(__pAddr) LE_BITS_TO_1BYTE( __pAddr+2, 0, 8)
-#define GET_TX_REPORT_TYPE1_RERTY_2(__pAddr) LE_BITS_TO_1BYTE( __pAddr+3, 0, 8)
-#define GET_TX_REPORT_TYPE1_RERTY_3(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4, 0, 8)
-#define GET_TX_REPORT_TYPE1_RERTY_4(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+1, 0, 8)
-#define GET_TX_REPORT_TYPE1_DROP_0(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+2, 0, 8)
-#define GET_TX_REPORT_TYPE1_DROP_1(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+3, 0, 8)
-#endif
-
-// End rate adaptive define
-
-VOID
-ODM_RASupport_Init(
- IN PDM_ODM_T pDM_Odm
- );
-
-int
-ODM_RAInfo_Init_all(
- IN PDM_ODM_T pDM_Odm
- );
-
-int
-ODM_RAInfo_Init(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte MacID
- );
-
-u1Byte
-ODM_RA_GetShortGI_8188E(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte MacID
- );
-
-u1Byte
-ODM_RA_GetDecisionRate_8188E(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte MacID
- );
-
-u1Byte
-ODM_RA_GetHwPwrStatus_8188E(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte MacID
- );
-VOID
-ODM_RA_UpdateRateInfo_8188E(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte MacID,
- IN u1Byte RateID,
- IN u4Byte RateMask,
- IN u1Byte SGIEnable
- );
-
-VOID
-ODM_RA_SetRSSI_8188E(
- IN PDM_ODM_T pDM_Odm,
- IN u1Byte MacID,
- IN u1Byte Rssi
- );
-
-VOID
-ODM_RA_TxRPT2Handle_8188E(
- IN PDM_ODM_T pDM_Odm,
- IN pu1Byte TxRPT_Buf,
- IN u2Byte TxRPT_Len,
- IN u4Byte MacIDValidEntry0,
- IN u4Byte MacIDValidEntry1
- );
-
-
-VOID
-ODM_RA_Set_TxRPT_Time(
- IN PDM_ODM_T pDM_Odm,
- IN u2Byte minRptTime
- );
-#endif
-
+#ifndef __INC_RA_H
+#define __INC_RA_H
+/*++
+Copyright (c) Realtek Semiconductor Corp. All rights reserved.
+
+Module Name:
+ RateAdaptive.h
+
+Abstract:
+ Prototype of RA and related data structure.
+
+Major Change History:
+ When Who What
+ ---------- --------------- -------------------------------
+ 2011-08-12 Page Create.
+--*/
+
+// Rate adaptive define
+#define PERENTRY 23
+#define RETRYSIZE 5
+#define RATESIZE 28
+#define TX_RPT2_ITEM_SIZE 8
+
+#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
+//
+// TX report 2 format in Rx desc
+//
+#define GET_TX_RPT2_DESC_PKT_LEN_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 9)
+#define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 0, 32)
+#define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
+
+#define GET_TX_REPORT_TYPE1_RERTY_0(__pAddr) LE_BITS_TO_4BYTE( __pAddr, 0, 16)
+#define GET_TX_REPORT_TYPE1_RERTY_1(__pAddr) LE_BITS_TO_1BYTE( __pAddr+2, 0, 8)
+#define GET_TX_REPORT_TYPE1_RERTY_2(__pAddr) LE_BITS_TO_1BYTE( __pAddr+3, 0, 8)
+#define GET_TX_REPORT_TYPE1_RERTY_3(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4, 0, 8)
+#define GET_TX_REPORT_TYPE1_RERTY_4(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+1, 0, 8)
+#define GET_TX_REPORT_TYPE1_DROP_0(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+2, 0, 8)
+#define GET_TX_REPORT_TYPE1_DROP_1(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+3, 0, 8)
+#endif
+
+// End rate adaptive define
+
+VOID
+ODM_RASupport_Init(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+int
+ODM_RAInfo_Init_all(
+ IN PDM_ODM_T pDM_Odm
+ );
+
+int
+ODM_RAInfo_Init(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte MacID
+ );
+
+u1Byte
+ODM_RA_GetShortGI_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte MacID
+ );
+
+u1Byte
+ODM_RA_GetDecisionRate_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte MacID
+ );
+
+u1Byte
+ODM_RA_GetHwPwrStatus_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte MacID
+ );
+VOID
+ODM_RA_UpdateRateInfo_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte MacID,
+ IN u1Byte RateID,
+ IN u4Byte RateMask,
+ IN u1Byte SGIEnable
+ );
+
+VOID
+ODM_RA_SetRSSI_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ IN u1Byte MacID,
+ IN u1Byte Rssi
+ );
+
+VOID
+ODM_RA_TxRPT2Handle_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ IN pu1Byte TxRPT_Buf,
+ IN u2Byte TxRPT_Len,
+ IN u4Byte MacIDValidEntry0,
+ IN u4Byte MacIDValidEntry1
+ );
+
+
+VOID
+ODM_RA_Set_TxRPT_Time(
+ IN PDM_ODM_T pDM_Odm,
+ IN u2Byte minRptTime
+ );
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188EReg.h b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188EReg.h
index f540145..b31ae2d 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188EReg.h
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/Hal8188EReg.h
@@ -1,54 +1,54 @@
-/******************************************************************************
- *
- * 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
- *
- *
- ******************************************************************************/
-//============================================================
-// File Name: Hal8188EReg.h
-//
-// Description:
-//
-// This file is for RTL8188E register definition.
-//
-//
-//============================================================
-#ifndef __HAL_8188E_REG_H__
-#define __HAL_8188E_REG_H__
-
-//
-// Register Definition
-//
-#define TRX_ANTDIV_PATH 0x860
-#define RX_ANTDIV_PATH 0xb2c
-#define ODM_R_A_AGC_CORE1_8188E 0xc50
-
-
-//
-// Bitmap Definition
-//
-#define BIT_FA_RESET_8188E BIT0
-
-#define REG_DBI_WDATA_8188 0x0348 // DBI Write Data
-#define REG_DBI_RDATA_8188 0x034C // DBI Read Data
-#define REG_DBI_ADDR_8188 0x0350 // DBI Address
-#define REG_DBI_FLAG_8188 0x0352 // DBI Read/Write Flag
-#define REG_MDIO_WDATA_8188E 0x0354 // MDIO for Write PCIE PHY
-#define REG_MDIO_RDATA_8188E 0x0356 // MDIO for Reads PCIE PHY
-#define REG_MDIO_CTL_8188E 0x0358 // MDIO for Control
-
-#endif
-
+/******************************************************************************
+ *
+ * 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
+ *
+ *
+ ******************************************************************************/
+//============================================================
+// File Name: Hal8188EReg.h
+//
+// Description:
+//
+// This file is for RTL8188E register definition.
+//
+//
+//============================================================
+#ifndef __HAL_8188E_REG_H__
+#define __HAL_8188E_REG_H__
+
+//
+// Register Definition
+//
+#define TRX_ANTDIV_PATH 0x860
+#define RX_ANTDIV_PATH 0xb2c
+#define ODM_R_A_AGC_CORE1_8188E 0xc50
+
+
+//
+// Bitmap Definition
+//
+#define BIT_FA_RESET_8188E BIT0
+
+#define REG_DBI_WDATA_8188 0x0348 // DBI Write Data
+#define REG_DBI_RDATA_8188 0x034C // DBI Read Data
+#define REG_DBI_ADDR_8188 0x0350 // DBI Address
+#define REG_DBI_FLAG_8188 0x0352 // DBI Read/Write Flag
+#define REG_MDIO_WDATA_8188E 0x0354 // MDIO for Write PCIE PHY
+#define REG_MDIO_RDATA_8188E 0x0356 // MDIO for Reads PCIE PHY
+#define REG_MDIO_CTL_8188E 0x0358 // MDIO for Control
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.c b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.c
index 48945bf..0dedc46 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.c
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.c
@@ -1,1652 +1,1652 @@
-/******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-* more details.
-*
-* You should have received a copy of the GNU General Public License along with
-* this program; if not, write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-*
-*
-******************************************************************************/
-
-#include "../odm_precomp.h"
-
-#ifdef CONFIG_IOL_IOREG_CFG
-#include <rtw_iol.h>
-#endif
-
-#if (RTL8188E_SUPPORT == 1)
-static BOOLEAN
-CheckCondition(
- const u4Byte Condition,
- const u4Byte Hex
- )
-{
- u4Byte _board = (Hex & 0x000000FF);
- u4Byte _interface = (Hex & 0x0000FF00) >> 8;
- u4Byte _platform = (Hex & 0x00FF0000) >> 16;
- u4Byte cond = Condition;
-
- if ( Condition == 0xCDCDCDCD )
- return TRUE;
-
- cond = Condition & 0x000000FF;
- if ( (_board != cond) && (cond != 0xFF) )
- return FALSE;
-
- cond = Condition & 0x0000FF00;
- cond = cond >> 8;
- if ( ((_interface & cond) == 0) && (cond != 0x07) )
- return FALSE;
-
- cond = Condition & 0x00FF0000;
- cond = cond >> 16;
- if ( ((_platform & cond) == 0) && (cond != 0x0F) )
- return FALSE;
- return TRUE;
-}
-
-
-/******************************************************************************
-* AGC_TAB_1T.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_AGC_TAB_1T[] = {
- 0xFF0F0718, 0xABCD,
- 0xC78, 0xF7000001,
- 0xC78, 0xF6010001,
- 0xC78, 0xF5020001,
- 0xC78, 0xF4030001,
- 0xC78, 0xF3040001,
- 0xC78, 0xF2050001,
- 0xC78, 0xF1060001,
- 0xC78, 0xF0070001,
- 0xC78, 0xEF080001,
- 0xC78, 0xEE090001,
- 0xC78, 0xED0A0001,
- 0xC78, 0xEC0B0001,
- 0xC78, 0xEB0C0001,
- 0xC78, 0xEA0D0001,
- 0xC78, 0xE90E0001,
- 0xC78, 0xE80F0001,
- 0xC78, 0xE7100001,
- 0xC78, 0xE6110001,
- 0xC78, 0xE5120001,
- 0xC78, 0xE4130001,
- 0xC78, 0xE3140001,
- 0xC78, 0xE2150001,
- 0xC78, 0xE1160001,
- 0xC78, 0x89170001,
- 0xC78, 0x88180001,
- 0xC78, 0x87190001,
- 0xC78, 0x861A0001,
- 0xC78, 0x851B0001,
- 0xC78, 0x841C0001,
- 0xC78, 0x831D0001,
- 0xC78, 0x821E0001,
- 0xC78, 0x811F0001,
- 0xC78, 0x6B200001,
- 0xC78, 0x6A210001,
- 0xC78, 0x69220001,
- 0xC78, 0x68230001,
- 0xC78, 0x67240001,
- 0xC78, 0x66250001,
- 0xC78, 0x65260001,
- 0xC78, 0x64270001,
- 0xC78, 0x63280001,
- 0xC78, 0x62290001,
- 0xC78, 0x612A0001,
- 0xC78, 0x462B0001,
- 0xC78, 0x452C0001,
- 0xC78, 0x442D0001,
- 0xC78, 0x432E0001,
- 0xC78, 0x422F0001,
- 0xC78, 0x41300001,
- 0xC78, 0x40310001,
- 0xC78, 0x40320001,
- 0xC78, 0x40330001,
- 0xC78, 0x40340001,
- 0xC78, 0x40350001,
- 0xC78, 0x40360001,
- 0xC78, 0x40370001,
- 0xC78, 0x40380001,
- 0xC78, 0x40390001,
- 0xC78, 0x403A0001,
- 0xC78, 0x403B0001,
- 0xC78, 0x403C0001,
- 0xC78, 0x403D0001,
- 0xC78, 0x403E0001,
- 0xC78, 0x403F0001,
- 0xCDCDCDCD, 0xCDCD,
- 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, 0xE61A0001,
- 0xC78, 0xE51B0001,
- 0xC78, 0xE41C0001,
- 0xC78, 0xE31D0001,
- 0xC78, 0xE21E0001,
- 0xC78, 0xE11F0001,
- 0xC78, 0x8A200001,
- 0xC78, 0x89210001,
- 0xC78, 0x88220001,
- 0xC78, 0x87230001,
- 0xC78, 0x86240001,
- 0xC78, 0x85250001,
- 0xC78, 0x84260001,
- 0xC78, 0x83270001,
- 0xC78, 0x82280001,
- 0xC78, 0x6B290001,
- 0xC78, 0x6A2A0001,
- 0xC78, 0x692B0001,
- 0xC78, 0x682C0001,
- 0xC78, 0x672D0001,
- 0xC78, 0x662E0001,
- 0xC78, 0x652F0001,
- 0xC78, 0x64300001,
- 0xC78, 0x63310001,
- 0xC78, 0x62320001,
- 0xC78, 0x61330001,
- 0xC78, 0x46340001,
- 0xC78, 0x45350001,
- 0xC78, 0x44360001,
- 0xC78, 0x43370001,
- 0xC78, 0x42380001,
- 0xC78, 0x41390001,
- 0xC78, 0x403A0001,
- 0xC78, 0x403B0001,
- 0xC78, 0x403C0001,
- 0xC78, 0x403D0001,
- 0xC78, 0x403E0001,
- 0xC78, 0x403F0001,
- 0xFF0F0718, 0xDEAD,
- 0xFF0F0718, 0xABCD,
- 0xC78, 0xFB400001,
- 0xC78, 0xFA410001,
- 0xC78, 0xF9420001,
- 0xC78, 0xF8430001,
- 0xC78, 0xF7440001,
- 0xC78, 0xF6450001,
- 0xC78, 0xF5460001,
- 0xC78, 0xF4470001,
- 0xC78, 0xF3480001,
- 0xC78, 0xF2490001,
- 0xC78, 0xF14A0001,
- 0xC78, 0xF04B0001,
- 0xC78, 0xEF4C0001,
- 0xC78, 0xEE4D0001,
- 0xC78, 0xED4E0001,
- 0xC78, 0xEC4F0001,
- 0xC78, 0xEB500001,
- 0xC78, 0xEA510001,
- 0xC78, 0xE9520001,
- 0xC78, 0xE8530001,
- 0xC78, 0xE7540001,
- 0xC78, 0xE6550001,
- 0xC78, 0xE5560001,
- 0xC78, 0xE4570001,
- 0xC78, 0xE3580001,
- 0xC78, 0xE2590001,
- 0xC78, 0xC35A0001,
- 0xC78, 0xC25B0001,
- 0xC78, 0xC15C0001,
- 0xC78, 0x8B5D0001,
- 0xC78, 0x8A5E0001,
- 0xC78, 0x895F0001,
- 0xC78, 0x88600001,
- 0xC78, 0x87610001,
- 0xC78, 0x86620001,
- 0xC78, 0x85630001,
- 0xC78, 0x84640001,
- 0xC78, 0x67650001,
- 0xC78, 0x66660001,
- 0xC78, 0x65670001,
- 0xC78, 0x64680001,
- 0xC78, 0x63690001,
- 0xC78, 0x626A0001,
- 0xC78, 0x616B0001,
- 0xC78, 0x606C0001,
- 0xC78, 0x466D0001,
- 0xC78, 0x456E0001,
- 0xC78, 0x446F0001,
- 0xC78, 0x43700001,
- 0xC78, 0x42710001,
- 0xC78, 0x41720001,
- 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,
- 0xCDCDCDCD, 0xCDCD,
- 0xC78, 0xFB400001,
- 0xC78, 0xFB410001,
- 0xC78, 0xFB420001,
- 0xC78, 0xFB430001,
- 0xC78, 0xFB440001,
- 0xC78, 0xFB450001,
- 0xC78, 0xFB460001,
- 0xC78, 0xFB470001,
- 0xC78, 0xFB480001,
- 0xC78, 0xFA490001,
- 0xC78, 0xF94A0001,
- 0xC78, 0xF84B0001,
- 0xC78, 0xF74C0001,
- 0xC78, 0xF64D0001,
- 0xC78, 0xF54E0001,
- 0xC78, 0xF44F0001,
- 0xC78, 0xF3500001,
- 0xC78, 0xF2510001,
- 0xC78, 0xF1520001,
- 0xC78, 0xF0530001,
- 0xC78, 0xEF540001,
- 0xC78, 0xEE550001,
- 0xC78, 0xED560001,
- 0xC78, 0xEC570001,
- 0xC78, 0xEB580001,
- 0xC78, 0xEA590001,
- 0xC78, 0xE95A0001,
- 0xC78, 0xE85B0001,
- 0xC78, 0xE75C0001,
- 0xC78, 0xE65D0001,
- 0xC78, 0xE55E0001,
- 0xC78, 0xE45F0001,
- 0xC78, 0xE3600001,
- 0xC78, 0xE2610001,
- 0xC78, 0xC3620001,
- 0xC78, 0xC2630001,
- 0xC78, 0xC1640001,
- 0xC78, 0x8B650001,
- 0xC78, 0x8A660001,
- 0xC78, 0x89670001,
- 0xC78, 0x88680001,
- 0xC78, 0x87690001,
- 0xC78, 0x866A0001,
- 0xC78, 0x856B0001,
- 0xC78, 0x846C0001,
- 0xC78, 0x676D0001,
- 0xC78, 0x666E0001,
- 0xC78, 0x656F0001,
- 0xC78, 0x64700001,
- 0xC78, 0x63710001,
- 0xC78, 0x62720001,
- 0xC78, 0x61730001,
- 0xC78, 0x60740001,
- 0xC78, 0x46750001,
- 0xC78, 0x45760001,
- 0xC78, 0x44770001,
- 0xC78, 0x43780001,
- 0xC78, 0x42790001,
- 0xC78, 0x417A0001,
- 0xC78, 0x407B0001,
- 0xC78, 0x407C0001,
- 0xC78, 0x407D0001,
- 0xC78, 0x407E0001,
- 0xC78, 0x407F0001,
- 0xFF0F0718, 0xDEAD,
- 0xC50, 0x69553422,
- 0xC50, 0x69553420,
-
-};
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T(
- 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_8188E_AGC_TAB_1T)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_AGC_TAB_1T;
- BOOLEAN biol = FALSE;
-#ifdef CONFIG_IOL_IOREG_CFG
- PADAPTER Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame;
- u8 bndy_cnt=1;
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
- HAL_STATUS rst =HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += _interface << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T, hex = 0x%X\n", hex));
-#ifdef CONFIG_IOL_IOREG_CFG
- biol = rtw_IOL_applied(Adapter);
-
- if(biol){
- if((pxmit_frame= rtw_IOL_accquire_xmit_frame(Adapter)) == NULL){
- printk("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
-
- for (i = 0; i < ArrayLen; i += 2 )
- {
- u4Byte v1 = Array[i];
- u4Byte v2 = Array[i+1];
-
- // This (offset, data) pair meets the condition.
- if ( v1 < 0xCDCDCDCD )
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
- }
- continue;
- }
- else
- { // This line is the start line of branch.
- if ( !CheckCondition(Array[i], hex) )
- { // Discard the following (offset, data) pairs.
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; // prevent from for-loop += 2
- }
- else // Configure matched pairs and skip to end of if-else.
- {
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
- }
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- }
- }
- }
-#ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
- if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
- {
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- printk("~~~ %s Success !!! \n",__FUNCTION__);
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- }
- else{
- printk("~~~ %s IOL_exec_cmds Failed !!! \n",__FUNCTION__);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- rst = HAL_STATUS_FAILURE;
- }
- }
-#endif //#ifdef CONFIG_IOL_IOREG_CFG
- return rst;
-}
-
-/******************************************************************************
-* AGC_TAB_1T_ICUT.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_AGC_TAB_1T_ICUT[] = {
- 0xC78, 0xFB000001,
- 0xC78, 0xFB010001,
- 0xC78, 0xFB020001,
- 0xC78, 0xFB030001,
- 0xC78, 0xFB040001,
- 0xC78, 0xFA050001,
- 0xC78, 0xF9060001,
- 0xC78, 0xF8070001,
- 0xC78, 0xF7080001,
- 0xC78, 0xF6090001,
- 0xC78, 0xF50A0001,
- 0xC78, 0xF40B0001,
- 0xC78, 0xF30C0001,
- 0xC78, 0xF20D0001,
- 0xC78, 0xF10E0001,
- 0xC78, 0xF00F0001,
- 0xC78, 0xEF100001,
- 0xC78, 0xEE110001,
- 0xC78, 0xED120001,
- 0xC78, 0xEC130001,
- 0xC78, 0xEB140001,
- 0xC78, 0xEA150001,
- 0xC78, 0xE9160001,
- 0xC78, 0xE8170001,
- 0xC78, 0xE7180001,
- 0xC78, 0xE6190001,
- 0xC78, 0xE51A0001,
- 0xC78, 0xE41B0001,
- 0xC78, 0xC71C0001,
- 0xC78, 0xC61D0001,
- 0xC78, 0xC51E0001,
- 0xC78, 0xC41F0001,
- 0xC78, 0xC3200001,
- 0xC78, 0xC2210001,
- 0xC78, 0x88220001,
- 0xC78, 0x87230001,
- 0xC78, 0x86240001,
- 0xC78, 0x85250001,
- 0xC78, 0x84260001,
- 0xC78, 0x83270001,
- 0xC78, 0x82280001,
- 0xC78, 0x81290001,
- 0xC78, 0x242A0001,
- 0xC78, 0x232B0001,
- 0xC78, 0x222C0001,
- 0xC78, 0x672D0001,
- 0xC78, 0x662E0001,
- 0xC78, 0x652F0001,
- 0xC78, 0x64300001,
- 0xC78, 0x63310001,
- 0xC78, 0x62320001,
- 0xC78, 0x61330001,
- 0xC78, 0x60340001,
- 0xC78, 0x4A350001,
- 0xC78, 0x49360001,
- 0xC78, 0x48370001,
- 0xC78, 0x47380001,
- 0xC78, 0x46390001,
- 0xC78, 0x453A0001,
- 0xC78, 0x443B0001,
- 0xC78, 0x433C0001,
- 0xC78, 0x423D0001,
- 0xC78, 0x413E0001,
- 0xC78, 0x403F0001,
- 0xC78, 0xFB400001,
- 0xC78, 0xFB410001,
- 0xC78, 0xFB420001,
- 0xC78, 0xFB430001,
- 0xC78, 0xFB440001,
- 0xC78, 0xFB450001,
- 0xC78, 0xFB460001,
- 0xC78, 0xFB470001,
- 0xC78, 0xFA480001,
- 0xC78, 0xF9490001,
- 0xC78, 0xF84A0001,
- 0xC78, 0xF74B0001,
- 0xC78, 0xF64C0001,
- 0xC78, 0xF54D0001,
- 0xC78, 0xF44E0001,
- 0xC78, 0xF34F0001,
- 0xC78, 0xF2500001,
- 0xC78, 0xF1510001,
- 0xC78, 0xF0520001,
- 0xC78, 0xEF530001,
- 0xC78, 0xEE540001,
- 0xC78, 0xED550001,
- 0xC78, 0xEC560001,
- 0xC78, 0xEB570001,
- 0xC78, 0xEA580001,
- 0xC78, 0xE9590001,
- 0xC78, 0xE85A0001,
- 0xC78, 0xE75B0001,
- 0xC78, 0xE65C0001,
- 0xC78, 0xE55D0001,
- 0xC78, 0xC65E0001,
- 0xC78, 0xC55F0001,
- 0xC78, 0xC4600001,
- 0xC78, 0xC3610001,
- 0xC78, 0xC2620001,
- 0xC78, 0xC1630001,
- 0xC78, 0xC0640001,
- 0xC78, 0xA3650001,
- 0xC78, 0xA2660001,
- 0xC78, 0xA1670001,
- 0xC78, 0x88680001,
- 0xC78, 0x87690001,
- 0xC78, 0x866A0001,
- 0xC78, 0x856B0001,
- 0xC78, 0x846C0001,
- 0xC78, 0x836D0001,
- 0xC78, 0x826E0001,
- 0xC78, 0x666F0001,
- 0xC78, 0x65700001,
- 0xC78, 0x64710001,
- 0xC78, 0x63720001,
- 0xC78, 0x62730001,
- 0xC78, 0x61740001,
- 0xC78, 0x48750001,
- 0xC78, 0x47760001,
- 0xC78, 0x46770001,
- 0xC78, 0x45780001,
- 0xC78, 0x44790001,
- 0xC78, 0x437A0001,
- 0xC78, 0x427B0001,
- 0xC78, 0x417C0001,
- 0xC78, 0x407D0001,
- 0xC78, 0x407E0001,
- 0xC78, 0x407F0001,
- 0xC50, 0x69553422,
- 0xC50, 0x69553420,
-
-};
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT(
- 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_8188E_AGC_TAB_1T_ICUT)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_AGC_TAB_1T_ICUT;
- BOOLEAN biol = FALSE;
-#ifdef CONFIG_IOL_IOREG_CFG
- PADAPTER Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame;
- u8 bndy_cnt=1;
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
- HAL_STATUS rst =HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += _interface << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT, hex = 0x%X\n", hex));
-#ifdef CONFIG_IOL_IOREG_CFG
- biol = rtw_IOL_applied(Adapter);
-
- if(biol){
- if((pxmit_frame= rtw_IOL_accquire_xmit_frame(Adapter)) == NULL){
- printk("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
-
- for (i = 0; i < ArrayLen; i += 2 )
- {
- u4Byte v1 = Array[i];
- u4Byte v2 = Array[i+1];
-
- // This (offset, data) pair meets the condition.
- if ( v1 < 0xCDCDCDCD )
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
- }
- continue;
- }
- else
- { // This line is the start line of branch.
- if ( !CheckCondition(Array[i], hex) )
- { // Discard the following (offset, data) pairs.
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; // prevent from for-loop += 2
- }
- else // Configure matched pairs and skip to end of if-else.
- {
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
- }
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- }
- }
- }
-#ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
- if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
- {
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- printk("~~~ %s Success !!! \n",__FUNCTION__);
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- }
- else{
- printk("~~~ %s IOL_exec_cmds Failed !!! \n",__FUNCTION__);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- rst = HAL_STATUS_FAILURE;
- }
- }
-#endif //#ifdef CONFIG_IOL_IOREG_CFG
- return rst;
-}
-
-/******************************************************************************
-* PHY_REG_1T.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_PHY_REG_1T[] = {
- 0x800, 0x80040000,
- 0x804, 0x00000003,
- 0x808, 0x0000FC00,
- 0x80C, 0x0000000A,
- 0x810, 0x10001331,
- 0x814, 0x020C3D10,
- 0x818, 0x02200385,
- 0x81C, 0x00000000,
- 0x820, 0x01000100,
- 0x824, 0x00390204,
- 0x828, 0x00000000,
- 0x82C, 0x00000000,
- 0x830, 0x00000000,
- 0x834, 0x00000000,
- 0x838, 0x00000000,
- 0x83C, 0x00000000,
- 0x840, 0x00010000,
- 0x844, 0x00000000,
- 0x848, 0x00000000,
- 0x84C, 0x00000000,
- 0x850, 0x00000000,
- 0x854, 0x00000000,
- 0x858, 0x569A11A9,
- 0x85C, 0x01000014,
- 0x860, 0x66F60110,
- 0x864, 0x061F0649,
- 0x868, 0x00000000,
- 0x86C, 0x27272700,
- 0xFF0F0718, 0xABCD,
- 0x870, 0x07000300,
- 0xCDCDCDCD, 0xCDCD,
- 0x870, 0x07000760,
- 0xFF0F0718, 0xDEAD,
- 0x874, 0x25004000,
- 0x878, 0x00000808,
- 0x87C, 0x00000000,
- 0x880, 0xB0000C1C,
- 0x884, 0x00000001,
- 0x888, 0x00000000,
- 0x88C, 0xCCC000C0,
- 0x890, 0x00000800,
- 0x894, 0xFFFFFFFE,
- 0x898, 0x40302010,
- 0x89C, 0x00706050,
- 0x900, 0x00000000,
- 0x904, 0x00000023,
- 0x908, 0x00000000,
- 0x90C, 0x81121111,
- 0x910, 0x00000002,
- 0x914, 0x00000201,
- 0xA00, 0x00D047C8,
- 0xA04, 0x80FF000C,
- 0xA08, 0x8C838300,
- 0xA0C, 0x2E7F120F,
- 0xA10, 0x9500BB78,
- 0xA14, 0x1114D028,
- 0xA18, 0x00881117,
- 0xA1C, 0x89140F00,
- 0xFF0F0718, 0xABCD,
- 0xA20, 0x13130000,
- 0xA24, 0x060A0D10,
- 0xA28, 0x00000103,
- 0xCDCDCDCD, 0xCDCD,
- 0xA20, 0x1A1B0000,
- 0xA24, 0x090E1317,
- 0xA28, 0x00000204,
- 0xFF0F0718, 0xDEAD,
- 0xA2C, 0x00D30000,
- 0xA70, 0x101FBF00,
- 0xA74, 0x00000007,
- 0xA78, 0x00000900,
- 0xA7C, 0x225B0606,
- 0xA80, 0x218075B1,
- 0xFF0F0718, 0xABCD,
- 0xB2C, 0x00000000,
- 0xCDCDCDCD, 0xCDCD,
- 0xB2C, 0x80000000,
- 0xFF0F0718, 0xDEAD,
- 0xC00, 0x48071D40,
- 0xC04, 0x03A05611,
- 0xC08, 0x000000E4,
- 0xC0C, 0x6C6C6C6C,
- 0xC10, 0x08800000,
- 0xC14, 0x40000100,
- 0xC18, 0x08800000,
- 0xC1C, 0x40000100,
- 0xC20, 0x00000000,
- 0xC24, 0x00000000,
- 0xC28, 0x00000000,
- 0xC2C, 0x00000000,
- 0xC30, 0x69E9AC47,
- 0xC34, 0x469652AF,
- 0xC38, 0x49795994,
- 0xC3C, 0x0A97971C,
- 0xC40, 0x1F7C403F,
- 0xC44, 0x000100B7,
- 0xC48, 0xEC020107,
- 0xC4C, 0x007F037F,
- 0xC50, 0x69553420,
- 0xC54, 0x43BC0094,
- 0xC58, 0x00013169,
- 0xC5C, 0x00250492,
- 0xC60, 0x00000000,
- 0xC64, 0x7112848B,
- 0xC68, 0x47C00BFF,
- 0xC6C, 0x00000036,
- 0xC70, 0x2C7F000D,
- 0xC74, 0x020610DB,
- 0xC78, 0x0000001F,
- 0xC7C, 0x00B91612,
- 0xFF0F0718, 0xABCD,
- 0xC80, 0x2D4000B5,
- 0xCDCDCDCD, 0xCDCD,
- 0xC80, 0x390000E4,
- 0xFF0F0718, 0xDEAD,
- 0xC84, 0x20F60000,
- 0xC88, 0x40000100,
- 0xC8C, 0x20200000,
- 0xC90, 0x00091521,
- 0xC94, 0x00000000,
- 0xC98, 0x00121820,
- 0xC9C, 0x00007F7F,
- 0xCA0, 0x00000000,
- 0xCA4, 0x000300A0,
- 0xCA8, 0x00000000,
- 0xCAC, 0x00000000,
- 0xCB0, 0x00000000,
- 0xCB4, 0x00000000,
- 0xCB8, 0x00000000,
- 0xCBC, 0x28000000,
- 0xCC0, 0x00000000,
- 0xCC4, 0x00000000,
- 0xCC8, 0x00000000,
- 0xCCC, 0x00000000,
- 0xCD0, 0x00000000,
- 0xCD4, 0x00000000,
- 0xCD8, 0x64B22427,
- 0xCDC, 0x00766932,
- 0xCE0, 0x00222222,
- 0xCE4, 0x00000000,
- 0xCE8, 0x37644302,
- 0xCEC, 0x2F97D40C,
- 0xD00, 0x00000740,
- 0xD04, 0x00020401,
- 0xD08, 0x0000907F,
- 0xD0C, 0x20010201,
- 0xD10, 0xA0633333,
- 0xD14, 0x3333BC43,
- 0xD18, 0x7A8F5B6F,
- 0xD2C, 0xCC979975,
- 0xD30, 0x00000000,
- 0xD34, 0x80608000,
- 0xD38, 0x00000000,
- 0xD3C, 0x00127353,
- 0xD40, 0x00000000,
- 0xD44, 0x00000000,
- 0xD48, 0x00000000,
- 0xD4C, 0x00000000,
- 0xD50, 0x6437140A,
- 0xD54, 0x00000000,
- 0xD58, 0x00000282,
- 0xD5C, 0x30032064,
- 0xD60, 0x4653DE68,
- 0xD64, 0x04518A3C,
- 0xD68, 0x00002101,
- 0xD6C, 0x2A201C16,
- 0xD70, 0x1812362E,
- 0xD74, 0x322C2220,
- 0xD78, 0x000E3C24,
- 0xE00, 0x2D2D2D2D,
- 0xE04, 0x2D2D2D2D,
- 0xE08, 0x0390272D,
- 0xE10, 0x2D2D2D2D,
- 0xE14, 0x2D2D2D2D,
- 0xE18, 0x2D2D2D2D,
- 0xE1C, 0x2D2D2D2D,
- 0xE28, 0x00000000,
- 0xE30, 0x1000DC1F,
- 0xE34, 0x10008C1F,
- 0xE38, 0x02140102,
- 0xE3C, 0x681604C2,
- 0xE40, 0x01007C00,
- 0xE44, 0x01004800,
- 0xE48, 0xFB000000,
- 0xE4C, 0x000028D1,
- 0xE50, 0x1000DC1F,
- 0xE54, 0x10008C1F,
- 0xE58, 0x02140102,
- 0xE5C, 0x28160D05,
- 0xE60, 0x00000008,
- 0xE68, 0x001B25A4,
- 0xE6C, 0x00C00014,
- 0xE70, 0x00C00014,
- 0xE74, 0x01000014,
- 0xE78, 0x01000014,
- 0xE7C, 0x01000014,
- 0xE80, 0x01000014,
- 0xE84, 0x00C00014,
- 0xE88, 0x01000014,
- 0xE8C, 0x00C00014,
- 0xED0, 0x00C00014,
- 0xED4, 0x00C00014,
- 0xED8, 0x00C00014,
- 0xEDC, 0x00000014,
- 0xEE0, 0x00000014,
- 0xFF0F0718, 0xABCD,
- 0xEE8, 0x32555448,
- 0xCDCDCDCD, 0xCDCD,
- 0xEE8, 0x21555448,
- 0xFF0F0718, 0xDEAD,
- 0xEEC, 0x01C00014,
- 0xF14, 0x00000003,
- 0xF4C, 0x00000000,
- 0xF00, 0x00000300,
-
-};
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_PHY_REG_1T(
- 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_8188E_PHY_REG_1T)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_PHY_REG_1T;
- BOOLEAN biol = FALSE;
-#ifdef CONFIG_IOL_IOREG_CFG
- PADAPTER Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame;
- u8 bndy_cnt=1;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- struct cmd_cmp cmpdata[ArrayLen];
- u4Byte cmpdata_idx=0;
- #endif
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
- HAL_STATUS rst =HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += _interface << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_PHY_REG_1T, hex = 0x%X\n", hex));
-#ifdef CONFIG_IOL_IOREG_CFG
- biol = rtw_IOL_applied(Adapter);
-
- if(biol){
- if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
- {
- printk("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
-
- for (i = 0; i < ArrayLen; i += 2 )
- {
- u4Byte v1 = Array[i];
- u4Byte v2 = Array[i+1];
-
- // This (offset, data) pair meets the condition.
- if ( v1 < 0xCDCDCDCD )
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
-
-
- if (v1 == 0xfe){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfd){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xfc){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
- }
- else if (v1 == 0xfb){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfa){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
- }
- else if (v1 == 0xf9){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
- }
- else{
- if (v1 == 0xa24)
- pDM_Odm->RFCalibrateInfo.RegA24 = v2;
-
- rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
- }
- continue;
- }
- else
- { // This line is the start line of branch.
- if ( !CheckCondition(Array[i], hex) )
- { // Discard the following (offset, data) pairs.
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; // prevent from for-loop += 2
- }
- else // Configure matched pairs and skip to end of if-else.
- {
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- if (v1 == 0xfe){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfd){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xfc){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
- }
- else if (v1 == 0xfb){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfa){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xf9){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
- }
- else{
- if (v1 == 0xa24)
- pDM_Odm->RFCalibrateInfo.RegA24 = v2;
-
- rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
- }
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- }
- }
- }
-#ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
- if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
- {
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- printk("~~~ %s IOL_exec_cmds Success !!! \n",__FUNCTION__);
- {
- u4Byte idx;
- u4Byte cdata;
- printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx);
- printk("### %s data compared !!###\n",__FUNCTION__);
- for(idx=0;idx< cmpdata_idx;idx++)
- {
- cdata = ODM_Read4Byte(pDM_Odm, cmpdata[idx].addr);
- if(cdata != cmpdata[idx].value){
- printk(" addr:0x%04x, data:(0x%02x : 0x%02x) \n",
- cmpdata[idx].addr,cmpdata[idx].value,cdata);
- rst = HAL_STATUS_FAILURE;
- }
- }
- printk("### %s data compared !!###\n",__FUNCTION__);
- //if(rst == HAL_STATUS_FAILURE)
- {//dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
-
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- }
- else{
- rst = HAL_STATUS_FAILURE;
- printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
- }
- }
-#endif //#ifdef CONFIG_IOL_IOREG_CFG
- return rst;
-}
-
-/******************************************************************************
-* PHY_REG_1T_ICUT.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_PHY_REG_1T_ICUT[] = {
- 0x800, 0x80040000,
- 0x804, 0x00000003,
- 0x808, 0x0000FC00,
- 0x80C, 0x0000000A,
- 0x810, 0x10001331,
- 0x814, 0x020C3D10,
- 0x818, 0x02200385,
- 0x81C, 0x00000000,
- 0x820, 0x01000100,
- 0x824, 0x00390204,
- 0x828, 0x00000000,
- 0x82C, 0x00000000,
- 0x830, 0x00000000,
- 0x834, 0x00000000,
- 0x838, 0x00000000,
- 0x83C, 0x00000000,
- 0x840, 0x00010000,
- 0x844, 0x00000000,
- 0x848, 0x00000000,
- 0x84C, 0x00000000,
- 0x850, 0x00000000,
- 0x854, 0x00000000,
- 0x858, 0x569A11A9,
- 0x85C, 0x01000014,
- 0x860, 0x66F60110,
- 0x864, 0x061F0649,
- 0x868, 0x00000000,
- 0x86C, 0x27272700,
- 0x870, 0x07000760,
- 0x874, 0x25004000,
- 0x878, 0x00000808,
- 0x87C, 0x00000000,
- 0x880, 0xB0000C1C,
- 0x884, 0x00000001,
- 0x888, 0x00000000,
- 0x88C, 0xCCC000C0,
- 0x890, 0x00000800,
- 0x894, 0xFFFFFFFE,
- 0x898, 0x40302010,
- 0x89C, 0x00706050,
- 0x900, 0x00000000,
- 0x904, 0x00000023,
- 0x908, 0x00000000,
- 0x90C, 0x81121111,
- 0x910, 0x00000002,
- 0x914, 0x00000201,
- 0xA00, 0x00D047C8,
- 0xA04, 0x80FF000C,
- 0xA08, 0x8C838300,
- 0xA0C, 0x2E7F120F,
- 0xA10, 0x9500BB78,
- 0xA14, 0x1114D028,
- 0xA18, 0x00881117,
- 0xA1C, 0x89140F00,
- 0xA20, 0x1A1B0000,
- 0xA24, 0x090E1317,
- 0xA28, 0x00000204,
- 0xA2C, 0x00D30000,
- 0xA70, 0x101FBF00,
- 0xA74, 0x00000007,
- 0xA78, 0x00000900,
- 0xA7C, 0x225B0606,
- 0xA80, 0x218075B1,
- 0xB2C, 0x80000000,
- 0xC00, 0x48071D40,
- 0xC04, 0x03A05611,
- 0xC08, 0x000000E4,
- 0xC0C, 0x6C6C6C6C,
- 0xC10, 0x08800000,
- 0xC14, 0x40000100,
- 0xC18, 0x08800000,
- 0xC1C, 0x40000100,
- 0xC20, 0x00000000,
- 0xC24, 0x00000000,
- 0xC28, 0x00000000,
- 0xC2C, 0x00000000,
- 0xC30, 0x69E9AC47,
- 0xC34, 0x469652AF,
- 0xC38, 0x49795994,
- 0xC3C, 0x0A97971C,
- 0xC40, 0x1F7C403F,
- 0xC44, 0x000100B7,
- 0xC48, 0xEC020107,
- 0xC4C, 0x007F037F,
- 0xC50, 0x69553420,
- 0xC54, 0x43BC0094,
- 0xC58, 0x00013159,
- 0xC5C, 0x00250492,
- 0xC60, 0x00000000,
- 0xC64, 0x7112848B,
- 0xC68, 0x47C00BFF,
- 0xC6C, 0x00000036,
- 0xC70, 0x2C7F000D,
- 0xC74, 0x028610DB,
- 0xC78, 0x0000001F,
- 0xC7C, 0x00B91612,
- 0xC80, 0x390000E4,
- 0xC84, 0x20F60000,
- 0xC88, 0x40000100,
- 0xC8C, 0x20200000,
- 0xC90, 0x00091521,
- 0xC94, 0x00000000,
- 0xC98, 0x00121820,
- 0xC9C, 0x00007F7F,
- 0xCA0, 0x00000000,
- 0xCA4, 0x000300A0,
- 0xCA8, 0xFFFF0000,
- 0xCAC, 0x00000000,
- 0xCB0, 0x00000000,
- 0xCB4, 0x00000000,
- 0xCB8, 0x00000000,
- 0xCBC, 0x28000000,
- 0xCC0, 0x00000000,
- 0xCC4, 0x00000000,
- 0xCC8, 0x00000000,
- 0xCCC, 0x00000000,
- 0xCD0, 0x00000000,
- 0xCD4, 0x00000000,
- 0xCD8, 0x64B22427,
- 0xCDC, 0x00766932,
- 0xCE0, 0x00222222,
- 0xCE4, 0x00000000,
- 0xCE8, 0x37644302,
- 0xCEC, 0x2F97D40C,
- 0xD00, 0x00000740,
- 0xD04, 0x00020401,
- 0xD08, 0x0000907F,
- 0xD0C, 0x20010201,
- 0xD10, 0xA0633333,
- 0xD14, 0x3333BC43,
- 0xD18, 0x7A8F5B6F,
- 0xD2C, 0xCC979975,
- 0xD30, 0x00000000,
- 0xD34, 0x80608000,
- 0xD38, 0x00000000,
- 0xD3C, 0x00127353,
- 0xD40, 0x00000000,
- 0xD44, 0x00000000,
- 0xD48, 0x00000000,
- 0xD4C, 0x00000000,
- 0xD50, 0x6437140A,
- 0xD54, 0x00000000,
- 0xD58, 0x00000282,
- 0xD5C, 0x30032064,
- 0xD60, 0x4653DE68,
- 0xD64, 0x04518A3C,
- 0xD68, 0x00002101,
- 0xD6C, 0x2A201C16,
- 0xD70, 0x1812362E,
- 0xD74, 0x322C2220,
- 0xD78, 0x000E3C24,
- 0xE00, 0x2D2D2D2D,
- 0xE04, 0x2D2D2D2D,
- 0xE08, 0x0390272D,
- 0xE10, 0x2D2D2D2D,
- 0xE14, 0x2D2D2D2D,
- 0xE18, 0x2D2D2D2D,
- 0xE1C, 0x2D2D2D2D,
- 0xE28, 0x00000000,
- 0xE30, 0x1000DC1F,
- 0xE34, 0x10008C1F,
- 0xE38, 0x02140102,
- 0xE3C, 0x681604C2,
- 0xE40, 0x01007C00,
- 0xE44, 0x01004800,
- 0xE48, 0xFB000000,
- 0xE4C, 0x000028D1,
- 0xE50, 0x1000DC1F,
- 0xE54, 0x10008C1F,
- 0xE58, 0x02140102,
- 0xE5C, 0x28160D05,
- 0xE60, 0x00000008,
- 0xE68, 0x001B25A4,
- 0xE6C, 0x00C00014,
- 0xE70, 0x00C00014,
- 0xE74, 0x01000014,
- 0xE78, 0x01000014,
- 0xE7C, 0x01000014,
- 0xE80, 0x01000014,
- 0xE84, 0x00C00014,
- 0xE88, 0x01000014,
- 0xE8C, 0x00C00014,
- 0xED0, 0x00C00014,
- 0xED4, 0x00C00014,
- 0xED8, 0x00C00014,
- 0xEDC, 0x00000014,
- 0xEE0, 0x00000014,
- 0xEEC, 0x01C00014,
- 0xF14, 0x00000003,
- 0xF4C, 0x00000000,
- 0xF00, 0x00000300,
-
-};
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT(
- 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_8188E_PHY_REG_1T_ICUT)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_PHY_REG_1T_ICUT;
- BOOLEAN biol = FALSE;
-#ifdef CONFIG_IOL_IOREG_CFG
- PADAPTER Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame;
- u8 bndy_cnt=1;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- struct cmd_cmp cmpdata[ArrayLen];
- u4Byte cmpdata_idx=0;
- #endif
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
- HAL_STATUS rst =HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += _interface << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT, hex = 0x%X\n", hex));
-#ifdef CONFIG_IOL_IOREG_CFG
- biol = rtw_IOL_applied(Adapter);
-
- if(biol){
- if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
- {
- printk("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
-
- for (i = 0; i < ArrayLen; i += 2 )
- {
- u4Byte v1 = Array[i];
- u4Byte v2 = Array[i+1];
-
- // This (offset, data) pair meets the condition.
- if ( v1 < 0xCDCDCDCD )
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
-
-
- if (v1 == 0xfe){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfd){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xfc){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
- }
- else if (v1 == 0xfb){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfa){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
- }
- else if (v1 == 0xf9){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
- }
- else{
- if (v1 == 0xa24)
- pDM_Odm->RFCalibrateInfo.RegA24 = v2;
-
- rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
- }
- continue;
- }
- else
- { // This line is the start line of branch.
- if ( !CheckCondition(Array[i], hex) )
- { // Discard the following (offset, data) pairs.
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; // prevent from for-loop += 2
- }
- else // Configure matched pairs and skip to end of if-else.
- {
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- if (v1 == 0xfe){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfd){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xfc){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
- }
- else if (v1 == 0xfb){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfa){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xf9){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
- }
- else{
- if (v1 == 0xa24)
- pDM_Odm->RFCalibrateInfo.RegA24 = v2;
-
- rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
- }
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- }
- }
- }
-#ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
- if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
- {
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- printk("~~~ %s IOL_exec_cmds Success !!! \n",__FUNCTION__);
- {
- u4Byte idx;
- u4Byte cdata;
- printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx);
- printk("### %s data compared !!###\n",__FUNCTION__);
- for(idx=0;idx< cmpdata_idx;idx++)
- {
- cdata = ODM_Read4Byte(pDM_Odm, cmpdata[idx].addr);
- if(cdata != cmpdata[idx].value){
- printk(" addr:0x%04x, data:(0x%02x : 0x%02x) \n",
- cmpdata[idx].addr,cmpdata[idx].value,cdata);
- rst = HAL_STATUS_FAILURE;
- }
- }
- printk("### %s data compared !!###\n",__FUNCTION__);
- //if(rst == HAL_STATUS_FAILURE)
- {//dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
-
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- }
- else{
- rst = HAL_STATUS_FAILURE;
- printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
- }
- }
-#endif //#ifdef CONFIG_IOL_IOREG_CFG
- return rst;
-}
-
-/******************************************************************************
-* PHY_REG_PG.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_PHY_REG_PG[] = {
- 0, 0, 0, 0x00000e08, 0x0000ff00, 0x00004000,
- 0, 0, 0, 0x0000086c, 0xffffff00, 0x34363800,
- 0, 0, 0, 0x00000e00, 0xffffffff, 0x42444646,
- 0, 0, 0, 0x00000e04, 0xffffffff, 0x30343840,
- 0, 0, 0, 0x00000e10, 0xffffffff, 0x38404244,
- 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436
-};
-
-void
-ODM_ReadAndConfig_MP_8188E_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_8188E_PHY_REG_PG)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_PHY_REG_PG;
-
- 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];
- u4Byte v2 = Array[i+1];
- u4Byte v3 = Array[i+2];
- u4Byte v4 = Array[i+3];
- 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_8188E(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];
- }
- }
- }
- }
-}
-
-
-
-#endif // end of HWIMG_SUPPORT
-
+/******************************************************************************
+*
+* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+* more details.
+*
+* You should have received a copy of the GNU General Public License along with
+* this program; if not, write to the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+*
+*
+******************************************************************************/
+
+#include "../odm_precomp.h"
+
+#ifdef CONFIG_IOL_IOREG_CFG
+#include <rtw_iol.h>
+#endif
+
+#if (RTL8188E_SUPPORT == 1)
+static BOOLEAN
+CheckCondition(
+ const u4Byte Condition,
+ const u4Byte Hex
+ )
+{
+ u4Byte _board = (Hex & 0x000000FF);
+ u4Byte _interface = (Hex & 0x0000FF00) >> 8;
+ u4Byte _platform = (Hex & 0x00FF0000) >> 16;
+ u4Byte cond = Condition;
+
+ if ( Condition == 0xCDCDCDCD )
+ return TRUE;
+
+ cond = Condition & 0x000000FF;
+ if ( (_board != cond) && (cond != 0xFF) )
+ return FALSE;
+
+ cond = Condition & 0x0000FF00;
+ cond = cond >> 8;
+ if ( ((_interface & cond) == 0) && (cond != 0x07) )
+ return FALSE;
+
+ cond = Condition & 0x00FF0000;
+ cond = cond >> 16;
+ if ( ((_platform & cond) == 0) && (cond != 0x0F) )
+ return FALSE;
+ return TRUE;
+}
+
+
+/******************************************************************************
+* AGC_TAB_1T.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_AGC_TAB_1T[] = {
+ 0xFF0F0718, 0xABCD,
+ 0xC78, 0xF7000001,
+ 0xC78, 0xF6010001,
+ 0xC78, 0xF5020001,
+ 0xC78, 0xF4030001,
+ 0xC78, 0xF3040001,
+ 0xC78, 0xF2050001,
+ 0xC78, 0xF1060001,
+ 0xC78, 0xF0070001,
+ 0xC78, 0xEF080001,
+ 0xC78, 0xEE090001,
+ 0xC78, 0xED0A0001,
+ 0xC78, 0xEC0B0001,
+ 0xC78, 0xEB0C0001,
+ 0xC78, 0xEA0D0001,
+ 0xC78, 0xE90E0001,
+ 0xC78, 0xE80F0001,
+ 0xC78, 0xE7100001,
+ 0xC78, 0xE6110001,
+ 0xC78, 0xE5120001,
+ 0xC78, 0xE4130001,
+ 0xC78, 0xE3140001,
+ 0xC78, 0xE2150001,
+ 0xC78, 0xE1160001,
+ 0xC78, 0x89170001,
+ 0xC78, 0x88180001,
+ 0xC78, 0x87190001,
+ 0xC78, 0x861A0001,
+ 0xC78, 0x851B0001,
+ 0xC78, 0x841C0001,
+ 0xC78, 0x831D0001,
+ 0xC78, 0x821E0001,
+ 0xC78, 0x811F0001,
+ 0xC78, 0x6B200001,
+ 0xC78, 0x6A210001,
+ 0xC78, 0x69220001,
+ 0xC78, 0x68230001,
+ 0xC78, 0x67240001,
+ 0xC78, 0x66250001,
+ 0xC78, 0x65260001,
+ 0xC78, 0x64270001,
+ 0xC78, 0x63280001,
+ 0xC78, 0x62290001,
+ 0xC78, 0x612A0001,
+ 0xC78, 0x462B0001,
+ 0xC78, 0x452C0001,
+ 0xC78, 0x442D0001,
+ 0xC78, 0x432E0001,
+ 0xC78, 0x422F0001,
+ 0xC78, 0x41300001,
+ 0xC78, 0x40310001,
+ 0xC78, 0x40320001,
+ 0xC78, 0x40330001,
+ 0xC78, 0x40340001,
+ 0xC78, 0x40350001,
+ 0xC78, 0x40360001,
+ 0xC78, 0x40370001,
+ 0xC78, 0x40380001,
+ 0xC78, 0x40390001,
+ 0xC78, 0x403A0001,
+ 0xC78, 0x403B0001,
+ 0xC78, 0x403C0001,
+ 0xC78, 0x403D0001,
+ 0xC78, 0x403E0001,
+ 0xC78, 0x403F0001,
+ 0xCDCDCDCD, 0xCDCD,
+ 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, 0xE61A0001,
+ 0xC78, 0xE51B0001,
+ 0xC78, 0xE41C0001,
+ 0xC78, 0xE31D0001,
+ 0xC78, 0xE21E0001,
+ 0xC78, 0xE11F0001,
+ 0xC78, 0x8A200001,
+ 0xC78, 0x89210001,
+ 0xC78, 0x88220001,
+ 0xC78, 0x87230001,
+ 0xC78, 0x86240001,
+ 0xC78, 0x85250001,
+ 0xC78, 0x84260001,
+ 0xC78, 0x83270001,
+ 0xC78, 0x82280001,
+ 0xC78, 0x6B290001,
+ 0xC78, 0x6A2A0001,
+ 0xC78, 0x692B0001,
+ 0xC78, 0x682C0001,
+ 0xC78, 0x672D0001,
+ 0xC78, 0x662E0001,
+ 0xC78, 0x652F0001,
+ 0xC78, 0x64300001,
+ 0xC78, 0x63310001,
+ 0xC78, 0x62320001,
+ 0xC78, 0x61330001,
+ 0xC78, 0x46340001,
+ 0xC78, 0x45350001,
+ 0xC78, 0x44360001,
+ 0xC78, 0x43370001,
+ 0xC78, 0x42380001,
+ 0xC78, 0x41390001,
+ 0xC78, 0x403A0001,
+ 0xC78, 0x403B0001,
+ 0xC78, 0x403C0001,
+ 0xC78, 0x403D0001,
+ 0xC78, 0x403E0001,
+ 0xC78, 0x403F0001,
+ 0xFF0F0718, 0xDEAD,
+ 0xFF0F0718, 0xABCD,
+ 0xC78, 0xFB400001,
+ 0xC78, 0xFA410001,
+ 0xC78, 0xF9420001,
+ 0xC78, 0xF8430001,
+ 0xC78, 0xF7440001,
+ 0xC78, 0xF6450001,
+ 0xC78, 0xF5460001,
+ 0xC78, 0xF4470001,
+ 0xC78, 0xF3480001,
+ 0xC78, 0xF2490001,
+ 0xC78, 0xF14A0001,
+ 0xC78, 0xF04B0001,
+ 0xC78, 0xEF4C0001,
+ 0xC78, 0xEE4D0001,
+ 0xC78, 0xED4E0001,
+ 0xC78, 0xEC4F0001,
+ 0xC78, 0xEB500001,
+ 0xC78, 0xEA510001,
+ 0xC78, 0xE9520001,
+ 0xC78, 0xE8530001,
+ 0xC78, 0xE7540001,
+ 0xC78, 0xE6550001,
+ 0xC78, 0xE5560001,
+ 0xC78, 0xE4570001,
+ 0xC78, 0xE3580001,
+ 0xC78, 0xE2590001,
+ 0xC78, 0xC35A0001,
+ 0xC78, 0xC25B0001,
+ 0xC78, 0xC15C0001,
+ 0xC78, 0x8B5D0001,
+ 0xC78, 0x8A5E0001,
+ 0xC78, 0x895F0001,
+ 0xC78, 0x88600001,
+ 0xC78, 0x87610001,
+ 0xC78, 0x86620001,
+ 0xC78, 0x85630001,
+ 0xC78, 0x84640001,
+ 0xC78, 0x67650001,
+ 0xC78, 0x66660001,
+ 0xC78, 0x65670001,
+ 0xC78, 0x64680001,
+ 0xC78, 0x63690001,
+ 0xC78, 0x626A0001,
+ 0xC78, 0x616B0001,
+ 0xC78, 0x606C0001,
+ 0xC78, 0x466D0001,
+ 0xC78, 0x456E0001,
+ 0xC78, 0x446F0001,
+ 0xC78, 0x43700001,
+ 0xC78, 0x42710001,
+ 0xC78, 0x41720001,
+ 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,
+ 0xCDCDCDCD, 0xCDCD,
+ 0xC78, 0xFB400001,
+ 0xC78, 0xFB410001,
+ 0xC78, 0xFB420001,
+ 0xC78, 0xFB430001,
+ 0xC78, 0xFB440001,
+ 0xC78, 0xFB450001,
+ 0xC78, 0xFB460001,
+ 0xC78, 0xFB470001,
+ 0xC78, 0xFB480001,
+ 0xC78, 0xFA490001,
+ 0xC78, 0xF94A0001,
+ 0xC78, 0xF84B0001,
+ 0xC78, 0xF74C0001,
+ 0xC78, 0xF64D0001,
+ 0xC78, 0xF54E0001,
+ 0xC78, 0xF44F0001,
+ 0xC78, 0xF3500001,
+ 0xC78, 0xF2510001,
+ 0xC78, 0xF1520001,
+ 0xC78, 0xF0530001,
+ 0xC78, 0xEF540001,
+ 0xC78, 0xEE550001,
+ 0xC78, 0xED560001,
+ 0xC78, 0xEC570001,
+ 0xC78, 0xEB580001,
+ 0xC78, 0xEA590001,
+ 0xC78, 0xE95A0001,
+ 0xC78, 0xE85B0001,
+ 0xC78, 0xE75C0001,
+ 0xC78, 0xE65D0001,
+ 0xC78, 0xE55E0001,
+ 0xC78, 0xE45F0001,
+ 0xC78, 0xE3600001,
+ 0xC78, 0xE2610001,
+ 0xC78, 0xC3620001,
+ 0xC78, 0xC2630001,
+ 0xC78, 0xC1640001,
+ 0xC78, 0x8B650001,
+ 0xC78, 0x8A660001,
+ 0xC78, 0x89670001,
+ 0xC78, 0x88680001,
+ 0xC78, 0x87690001,
+ 0xC78, 0x866A0001,
+ 0xC78, 0x856B0001,
+ 0xC78, 0x846C0001,
+ 0xC78, 0x676D0001,
+ 0xC78, 0x666E0001,
+ 0xC78, 0x656F0001,
+ 0xC78, 0x64700001,
+ 0xC78, 0x63710001,
+ 0xC78, 0x62720001,
+ 0xC78, 0x61730001,
+ 0xC78, 0x60740001,
+ 0xC78, 0x46750001,
+ 0xC78, 0x45760001,
+ 0xC78, 0x44770001,
+ 0xC78, 0x43780001,
+ 0xC78, 0x42790001,
+ 0xC78, 0x417A0001,
+ 0xC78, 0x407B0001,
+ 0xC78, 0x407C0001,
+ 0xC78, 0x407D0001,
+ 0xC78, 0x407E0001,
+ 0xC78, 0x407F0001,
+ 0xFF0F0718, 0xDEAD,
+ 0xC50, 0x69553422,
+ 0xC50, 0x69553420,
+
+};
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T(
+ 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_8188E_AGC_TAB_1T)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_AGC_TAB_1T;
+ BOOLEAN biol = FALSE;
+#ifdef CONFIG_IOL_IOREG_CFG
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ struct xmit_frame *pxmit_frame;
+ u8 bndy_cnt=1;
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+ HAL_STATUS rst =HAL_STATUS_SUCCESS;
+
+ hex += board;
+ hex += _interface << 8;
+ hex += platform << 16;
+ hex += 0xFF000000;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T, hex = 0x%X\n", hex));
+#ifdef CONFIG_IOL_IOREG_CFG
+ biol = rtw_IOL_applied(Adapter);
+
+ if(biol){
+ if((pxmit_frame= rtw_IOL_accquire_xmit_frame(Adapter)) == NULL){
+ printk("rtw_IOL_accquire_xmit_frame failed\n");
+ return HAL_STATUS_FAILURE;
+ }
+ }
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+
+ for (i = 0; i < ArrayLen; i += 2 )
+ {
+ u4Byte v1 = Array[i];
+ u4Byte v2 = Array[i+1];
+
+ // This (offset, data) pair meets the condition.
+ if ( v1 < 0xCDCDCDCD )
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
+ }
+ continue;
+ }
+ else
+ { // This line is the start line of branch.
+ if ( !CheckCondition(Array[i], hex) )
+ { // Discard the following (offset, data) pairs.
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+ i -= 2; // prevent from for-loop += 2
+ }
+ else // Configure matched pairs and skip to end of if-else.
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
+ }
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ while (v2 != 0xDEAD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ }
+ }
+ }
+#ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
+ if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ printk("~~~ %s Success !!! \n",__FUNCTION__);
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ }
+ else{
+ printk("~~~ %s IOL_exec_cmds Failed !!! \n",__FUNCTION__);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ rst = HAL_STATUS_FAILURE;
+ }
+ }
+#endif //#ifdef CONFIG_IOL_IOREG_CFG
+ return rst;
+}
+
+/******************************************************************************
+* AGC_TAB_1T_ICUT.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_AGC_TAB_1T_ICUT[] = {
+ 0xC78, 0xFB000001,
+ 0xC78, 0xFB010001,
+ 0xC78, 0xFB020001,
+ 0xC78, 0xFB030001,
+ 0xC78, 0xFB040001,
+ 0xC78, 0xFA050001,
+ 0xC78, 0xF9060001,
+ 0xC78, 0xF8070001,
+ 0xC78, 0xF7080001,
+ 0xC78, 0xF6090001,
+ 0xC78, 0xF50A0001,
+ 0xC78, 0xF40B0001,
+ 0xC78, 0xF30C0001,
+ 0xC78, 0xF20D0001,
+ 0xC78, 0xF10E0001,
+ 0xC78, 0xF00F0001,
+ 0xC78, 0xEF100001,
+ 0xC78, 0xEE110001,
+ 0xC78, 0xED120001,
+ 0xC78, 0xEC130001,
+ 0xC78, 0xEB140001,
+ 0xC78, 0xEA150001,
+ 0xC78, 0xE9160001,
+ 0xC78, 0xE8170001,
+ 0xC78, 0xE7180001,
+ 0xC78, 0xE6190001,
+ 0xC78, 0xE51A0001,
+ 0xC78, 0xE41B0001,
+ 0xC78, 0xC71C0001,
+ 0xC78, 0xC61D0001,
+ 0xC78, 0xC51E0001,
+ 0xC78, 0xC41F0001,
+ 0xC78, 0xC3200001,
+ 0xC78, 0xC2210001,
+ 0xC78, 0x88220001,
+ 0xC78, 0x87230001,
+ 0xC78, 0x86240001,
+ 0xC78, 0x85250001,
+ 0xC78, 0x84260001,
+ 0xC78, 0x83270001,
+ 0xC78, 0x82280001,
+ 0xC78, 0x81290001,
+ 0xC78, 0x242A0001,
+ 0xC78, 0x232B0001,
+ 0xC78, 0x222C0001,
+ 0xC78, 0x672D0001,
+ 0xC78, 0x662E0001,
+ 0xC78, 0x652F0001,
+ 0xC78, 0x64300001,
+ 0xC78, 0x63310001,
+ 0xC78, 0x62320001,
+ 0xC78, 0x61330001,
+ 0xC78, 0x60340001,
+ 0xC78, 0x4A350001,
+ 0xC78, 0x49360001,
+ 0xC78, 0x48370001,
+ 0xC78, 0x47380001,
+ 0xC78, 0x46390001,
+ 0xC78, 0x453A0001,
+ 0xC78, 0x443B0001,
+ 0xC78, 0x433C0001,
+ 0xC78, 0x423D0001,
+ 0xC78, 0x413E0001,
+ 0xC78, 0x403F0001,
+ 0xC78, 0xFB400001,
+ 0xC78, 0xFB410001,
+ 0xC78, 0xFB420001,
+ 0xC78, 0xFB430001,
+ 0xC78, 0xFB440001,
+ 0xC78, 0xFB450001,
+ 0xC78, 0xFB460001,
+ 0xC78, 0xFB470001,
+ 0xC78, 0xFA480001,
+ 0xC78, 0xF9490001,
+ 0xC78, 0xF84A0001,
+ 0xC78, 0xF74B0001,
+ 0xC78, 0xF64C0001,
+ 0xC78, 0xF54D0001,
+ 0xC78, 0xF44E0001,
+ 0xC78, 0xF34F0001,
+ 0xC78, 0xF2500001,
+ 0xC78, 0xF1510001,
+ 0xC78, 0xF0520001,
+ 0xC78, 0xEF530001,
+ 0xC78, 0xEE540001,
+ 0xC78, 0xED550001,
+ 0xC78, 0xEC560001,
+ 0xC78, 0xEB570001,
+ 0xC78, 0xEA580001,
+ 0xC78, 0xE9590001,
+ 0xC78, 0xE85A0001,
+ 0xC78, 0xE75B0001,
+ 0xC78, 0xE65C0001,
+ 0xC78, 0xE55D0001,
+ 0xC78, 0xC65E0001,
+ 0xC78, 0xC55F0001,
+ 0xC78, 0xC4600001,
+ 0xC78, 0xC3610001,
+ 0xC78, 0xC2620001,
+ 0xC78, 0xC1630001,
+ 0xC78, 0xC0640001,
+ 0xC78, 0xA3650001,
+ 0xC78, 0xA2660001,
+ 0xC78, 0xA1670001,
+ 0xC78, 0x88680001,
+ 0xC78, 0x87690001,
+ 0xC78, 0x866A0001,
+ 0xC78, 0x856B0001,
+ 0xC78, 0x846C0001,
+ 0xC78, 0x836D0001,
+ 0xC78, 0x826E0001,
+ 0xC78, 0x666F0001,
+ 0xC78, 0x65700001,
+ 0xC78, 0x64710001,
+ 0xC78, 0x63720001,
+ 0xC78, 0x62730001,
+ 0xC78, 0x61740001,
+ 0xC78, 0x48750001,
+ 0xC78, 0x47760001,
+ 0xC78, 0x46770001,
+ 0xC78, 0x45780001,
+ 0xC78, 0x44790001,
+ 0xC78, 0x437A0001,
+ 0xC78, 0x427B0001,
+ 0xC78, 0x417C0001,
+ 0xC78, 0x407D0001,
+ 0xC78, 0x407E0001,
+ 0xC78, 0x407F0001,
+ 0xC50, 0x69553422,
+ 0xC50, 0x69553420,
+
+};
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT(
+ 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_8188E_AGC_TAB_1T_ICUT)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_AGC_TAB_1T_ICUT;
+ BOOLEAN biol = FALSE;
+#ifdef CONFIG_IOL_IOREG_CFG
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ struct xmit_frame *pxmit_frame;
+ u8 bndy_cnt=1;
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+ HAL_STATUS rst =HAL_STATUS_SUCCESS;
+
+ hex += board;
+ hex += _interface << 8;
+ hex += platform << 16;
+ hex += 0xFF000000;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT, hex = 0x%X\n", hex));
+#ifdef CONFIG_IOL_IOREG_CFG
+ biol = rtw_IOL_applied(Adapter);
+
+ if(biol){
+ if((pxmit_frame= rtw_IOL_accquire_xmit_frame(Adapter)) == NULL){
+ printk("rtw_IOL_accquire_xmit_frame failed\n");
+ return HAL_STATUS_FAILURE;
+ }
+ }
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+
+ for (i = 0; i < ArrayLen; i += 2 )
+ {
+ u4Byte v1 = Array[i];
+ u4Byte v2 = Array[i+1];
+
+ // This (offset, data) pair meets the condition.
+ if ( v1 < 0xCDCDCDCD )
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
+ }
+ continue;
+ }
+ else
+ { // This line is the start line of branch.
+ if ( !CheckCondition(Array[i], hex) )
+ { // Discard the following (offset, data) pairs.
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+ i -= 2; // prevent from for-loop += 2
+ }
+ else // Configure matched pairs and skip to end of if-else.
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
+ }
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ while (v2 != 0xDEAD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ }
+ }
+ }
+#ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
+ if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ printk("~~~ %s Success !!! \n",__FUNCTION__);
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ }
+ else{
+ printk("~~~ %s IOL_exec_cmds Failed !!! \n",__FUNCTION__);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ rst = HAL_STATUS_FAILURE;
+ }
+ }
+#endif //#ifdef CONFIG_IOL_IOREG_CFG
+ return rst;
+}
+
+/******************************************************************************
+* PHY_REG_1T.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_PHY_REG_1T[] = {
+ 0x800, 0x80040000,
+ 0x804, 0x00000003,
+ 0x808, 0x0000FC00,
+ 0x80C, 0x0000000A,
+ 0x810, 0x10001331,
+ 0x814, 0x020C3D10,
+ 0x818, 0x02200385,
+ 0x81C, 0x00000000,
+ 0x820, 0x01000100,
+ 0x824, 0x00390204,
+ 0x828, 0x00000000,
+ 0x82C, 0x00000000,
+ 0x830, 0x00000000,
+ 0x834, 0x00000000,
+ 0x838, 0x00000000,
+ 0x83C, 0x00000000,
+ 0x840, 0x00010000,
+ 0x844, 0x00000000,
+ 0x848, 0x00000000,
+ 0x84C, 0x00000000,
+ 0x850, 0x00000000,
+ 0x854, 0x00000000,
+ 0x858, 0x569A11A9,
+ 0x85C, 0x01000014,
+ 0x860, 0x66F60110,
+ 0x864, 0x061F0649,
+ 0x868, 0x00000000,
+ 0x86C, 0x27272700,
+ 0xFF0F0718, 0xABCD,
+ 0x870, 0x07000300,
+ 0xCDCDCDCD, 0xCDCD,
+ 0x870, 0x07000760,
+ 0xFF0F0718, 0xDEAD,
+ 0x874, 0x25004000,
+ 0x878, 0x00000808,
+ 0x87C, 0x00000000,
+ 0x880, 0xB0000C1C,
+ 0x884, 0x00000001,
+ 0x888, 0x00000000,
+ 0x88C, 0xCCC000C0,
+ 0x890, 0x00000800,
+ 0x894, 0xFFFFFFFE,
+ 0x898, 0x40302010,
+ 0x89C, 0x00706050,
+ 0x900, 0x00000000,
+ 0x904, 0x00000023,
+ 0x908, 0x00000000,
+ 0x90C, 0x81121111,
+ 0x910, 0x00000002,
+ 0x914, 0x00000201,
+ 0xA00, 0x00D047C8,
+ 0xA04, 0x80FF000C,
+ 0xA08, 0x8C838300,
+ 0xA0C, 0x2E7F120F,
+ 0xA10, 0x9500BB78,
+ 0xA14, 0x1114D028,
+ 0xA18, 0x00881117,
+ 0xA1C, 0x89140F00,
+ 0xFF0F0718, 0xABCD,
+ 0xA20, 0x13130000,
+ 0xA24, 0x060A0D10,
+ 0xA28, 0x00000103,
+ 0xCDCDCDCD, 0xCDCD,
+ 0xA20, 0x1A1B0000,
+ 0xA24, 0x090E1317,
+ 0xA28, 0x00000204,
+ 0xFF0F0718, 0xDEAD,
+ 0xA2C, 0x00D30000,
+ 0xA70, 0x101FBF00,
+ 0xA74, 0x00000007,
+ 0xA78, 0x00000900,
+ 0xA7C, 0x225B0606,
+ 0xA80, 0x218075B1,
+ 0xFF0F0718, 0xABCD,
+ 0xB2C, 0x00000000,
+ 0xCDCDCDCD, 0xCDCD,
+ 0xB2C, 0x80000000,
+ 0xFF0F0718, 0xDEAD,
+ 0xC00, 0x48071D40,
+ 0xC04, 0x03A05611,
+ 0xC08, 0x000000E4,
+ 0xC0C, 0x6C6C6C6C,
+ 0xC10, 0x08800000,
+ 0xC14, 0x40000100,
+ 0xC18, 0x08800000,
+ 0xC1C, 0x40000100,
+ 0xC20, 0x00000000,
+ 0xC24, 0x00000000,
+ 0xC28, 0x00000000,
+ 0xC2C, 0x00000000,
+ 0xC30, 0x69E9AC47,
+ 0xC34, 0x469652AF,
+ 0xC38, 0x49795994,
+ 0xC3C, 0x0A97971C,
+ 0xC40, 0x1F7C403F,
+ 0xC44, 0x000100B7,
+ 0xC48, 0xEC020107,
+ 0xC4C, 0x007F037F,
+ 0xC50, 0x69553420,
+ 0xC54, 0x43BC0094,
+ 0xC58, 0x00013169,
+ 0xC5C, 0x00250492,
+ 0xC60, 0x00000000,
+ 0xC64, 0x7112848B,
+ 0xC68, 0x47C00BFF,
+ 0xC6C, 0x00000036,
+ 0xC70, 0x2C7F000D,
+ 0xC74, 0x020610DB,
+ 0xC78, 0x0000001F,
+ 0xC7C, 0x00B91612,
+ 0xFF0F0718, 0xABCD,
+ 0xC80, 0x2D4000B5,
+ 0xCDCDCDCD, 0xCDCD,
+ 0xC80, 0x390000E4,
+ 0xFF0F0718, 0xDEAD,
+ 0xC84, 0x20F60000,
+ 0xC88, 0x40000100,
+ 0xC8C, 0x20200000,
+ 0xC90, 0x00091521,
+ 0xC94, 0x00000000,
+ 0xC98, 0x00121820,
+ 0xC9C, 0x00007F7F,
+ 0xCA0, 0x00000000,
+ 0xCA4, 0x000300A0,
+ 0xCA8, 0x00000000,
+ 0xCAC, 0x00000000,
+ 0xCB0, 0x00000000,
+ 0xCB4, 0x00000000,
+ 0xCB8, 0x00000000,
+ 0xCBC, 0x28000000,
+ 0xCC0, 0x00000000,
+ 0xCC4, 0x00000000,
+ 0xCC8, 0x00000000,
+ 0xCCC, 0x00000000,
+ 0xCD0, 0x00000000,
+ 0xCD4, 0x00000000,
+ 0xCD8, 0x64B22427,
+ 0xCDC, 0x00766932,
+ 0xCE0, 0x00222222,
+ 0xCE4, 0x00000000,
+ 0xCE8, 0x37644302,
+ 0xCEC, 0x2F97D40C,
+ 0xD00, 0x00000740,
+ 0xD04, 0x00020401,
+ 0xD08, 0x0000907F,
+ 0xD0C, 0x20010201,
+ 0xD10, 0xA0633333,
+ 0xD14, 0x3333BC43,
+ 0xD18, 0x7A8F5B6F,
+ 0xD2C, 0xCC979975,
+ 0xD30, 0x00000000,
+ 0xD34, 0x80608000,
+ 0xD38, 0x00000000,
+ 0xD3C, 0x00127353,
+ 0xD40, 0x00000000,
+ 0xD44, 0x00000000,
+ 0xD48, 0x00000000,
+ 0xD4C, 0x00000000,
+ 0xD50, 0x6437140A,
+ 0xD54, 0x00000000,
+ 0xD58, 0x00000282,
+ 0xD5C, 0x30032064,
+ 0xD60, 0x4653DE68,
+ 0xD64, 0x04518A3C,
+ 0xD68, 0x00002101,
+ 0xD6C, 0x2A201C16,
+ 0xD70, 0x1812362E,
+ 0xD74, 0x322C2220,
+ 0xD78, 0x000E3C24,
+ 0xE00, 0x2D2D2D2D,
+ 0xE04, 0x2D2D2D2D,
+ 0xE08, 0x0390272D,
+ 0xE10, 0x2D2D2D2D,
+ 0xE14, 0x2D2D2D2D,
+ 0xE18, 0x2D2D2D2D,
+ 0xE1C, 0x2D2D2D2D,
+ 0xE28, 0x00000000,
+ 0xE30, 0x1000DC1F,
+ 0xE34, 0x10008C1F,
+ 0xE38, 0x02140102,
+ 0xE3C, 0x681604C2,
+ 0xE40, 0x01007C00,
+ 0xE44, 0x01004800,
+ 0xE48, 0xFB000000,
+ 0xE4C, 0x000028D1,
+ 0xE50, 0x1000DC1F,
+ 0xE54, 0x10008C1F,
+ 0xE58, 0x02140102,
+ 0xE5C, 0x28160D05,
+ 0xE60, 0x00000008,
+ 0xE68, 0x001B25A4,
+ 0xE6C, 0x00C00014,
+ 0xE70, 0x00C00014,
+ 0xE74, 0x01000014,
+ 0xE78, 0x01000014,
+ 0xE7C, 0x01000014,
+ 0xE80, 0x01000014,
+ 0xE84, 0x00C00014,
+ 0xE88, 0x01000014,
+ 0xE8C, 0x00C00014,
+ 0xED0, 0x00C00014,
+ 0xED4, 0x00C00014,
+ 0xED8, 0x00C00014,
+ 0xEDC, 0x00000014,
+ 0xEE0, 0x00000014,
+ 0xFF0F0718, 0xABCD,
+ 0xEE8, 0x32555448,
+ 0xCDCDCDCD, 0xCDCD,
+ 0xEE8, 0x21555448,
+ 0xFF0F0718, 0xDEAD,
+ 0xEEC, 0x01C00014,
+ 0xF14, 0x00000003,
+ 0xF4C, 0x00000000,
+ 0xF00, 0x00000300,
+
+};
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_PHY_REG_1T(
+ 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_8188E_PHY_REG_1T)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_PHY_REG_1T;
+ BOOLEAN biol = FALSE;
+#ifdef CONFIG_IOL_IOREG_CFG
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ struct xmit_frame *pxmit_frame;
+ u8 bndy_cnt=1;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ struct cmd_cmp cmpdata[ArrayLen];
+ u4Byte cmpdata_idx=0;
+ #endif
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+ HAL_STATUS rst =HAL_STATUS_SUCCESS;
+
+ hex += board;
+ hex += _interface << 8;
+ hex += platform << 16;
+ hex += 0xFF000000;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_PHY_REG_1T, hex = 0x%X\n", hex));
+#ifdef CONFIG_IOL_IOREG_CFG
+ biol = rtw_IOL_applied(Adapter);
+
+ if(biol){
+ if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
+ {
+ printk("rtw_IOL_accquire_xmit_frame failed\n");
+ return HAL_STATUS_FAILURE;
+ }
+ }
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+
+ for (i = 0; i < ArrayLen; i += 2 )
+ {
+ u4Byte v1 = Array[i];
+ u4Byte v2 = Array[i+1];
+
+ // This (offset, data) pair meets the condition.
+ if ( v1 < 0xCDCDCDCD )
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+
+
+ if (v1 == 0xfe){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfd){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xfc){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
+ }
+ else if (v1 == 0xfb){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfa){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
+ }
+ else if (v1 == 0xf9){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
+ }
+ else{
+ if (v1 == 0xa24)
+ pDM_Odm->RFCalibrateInfo.RegA24 = v2;
+
+ rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
+ }
+ continue;
+ }
+ else
+ { // This line is the start line of branch.
+ if ( !CheckCondition(Array[i], hex) )
+ { // Discard the following (offset, data) pairs.
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+ i -= 2; // prevent from for-loop += 2
+ }
+ else // Configure matched pairs and skip to end of if-else.
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ if (v1 == 0xfe){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfd){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xfc){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
+ }
+ else if (v1 == 0xfb){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfa){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xf9){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
+ }
+ else{
+ if (v1 == 0xa24)
+ pDM_Odm->RFCalibrateInfo.RegA24 = v2;
+
+ rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
+ }
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ while (v2 != 0xDEAD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ }
+ }
+ }
+#ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
+ if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ printk("~~~ %s IOL_exec_cmds Success !!! \n",__FUNCTION__);
+ {
+ u4Byte idx;
+ u4Byte cdata;
+ printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx);
+ printk("### %s data compared !!###\n",__FUNCTION__);
+ for(idx=0;idx< cmpdata_idx;idx++)
+ {
+ cdata = ODM_Read4Byte(pDM_Odm, cmpdata[idx].addr);
+ if(cdata != cmpdata[idx].value){
+ printk(" addr:0x%04x, data:(0x%02x : 0x%02x) \n",
+ cmpdata[idx].addr,cmpdata[idx].value,cdata);
+ rst = HAL_STATUS_FAILURE;
+ }
+ }
+ printk("### %s data compared !!###\n",__FUNCTION__);
+ //if(rst == HAL_STATUS_FAILURE)
+ {//dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ }
+ else{
+ rst = HAL_STATUS_FAILURE;
+ printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+ }
+ }
+#endif //#ifdef CONFIG_IOL_IOREG_CFG
+ return rst;
+}
+
+/******************************************************************************
+* PHY_REG_1T_ICUT.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_PHY_REG_1T_ICUT[] = {
+ 0x800, 0x80040000,
+ 0x804, 0x00000003,
+ 0x808, 0x0000FC00,
+ 0x80C, 0x0000000A,
+ 0x810, 0x10001331,
+ 0x814, 0x020C3D10,
+ 0x818, 0x02200385,
+ 0x81C, 0x00000000,
+ 0x820, 0x01000100,
+ 0x824, 0x00390204,
+ 0x828, 0x00000000,
+ 0x82C, 0x00000000,
+ 0x830, 0x00000000,
+ 0x834, 0x00000000,
+ 0x838, 0x00000000,
+ 0x83C, 0x00000000,
+ 0x840, 0x00010000,
+ 0x844, 0x00000000,
+ 0x848, 0x00000000,
+ 0x84C, 0x00000000,
+ 0x850, 0x00000000,
+ 0x854, 0x00000000,
+ 0x858, 0x569A11A9,
+ 0x85C, 0x01000014,
+ 0x860, 0x66F60110,
+ 0x864, 0x061F0649,
+ 0x868, 0x00000000,
+ 0x86C, 0x27272700,
+ 0x870, 0x07000760,
+ 0x874, 0x25004000,
+ 0x878, 0x00000808,
+ 0x87C, 0x00000000,
+ 0x880, 0xB0000C1C,
+ 0x884, 0x00000001,
+ 0x888, 0x00000000,
+ 0x88C, 0xCCC000C0,
+ 0x890, 0x00000800,
+ 0x894, 0xFFFFFFFE,
+ 0x898, 0x40302010,
+ 0x89C, 0x00706050,
+ 0x900, 0x00000000,
+ 0x904, 0x00000023,
+ 0x908, 0x00000000,
+ 0x90C, 0x81121111,
+ 0x910, 0x00000002,
+ 0x914, 0x00000201,
+ 0xA00, 0x00D047C8,
+ 0xA04, 0x80FF000C,
+ 0xA08, 0x8C838300,
+ 0xA0C, 0x2E7F120F,
+ 0xA10, 0x9500BB78,
+ 0xA14, 0x1114D028,
+ 0xA18, 0x00881117,
+ 0xA1C, 0x89140F00,
+ 0xA20, 0x1A1B0000,
+ 0xA24, 0x090E1317,
+ 0xA28, 0x00000204,
+ 0xA2C, 0x00D30000,
+ 0xA70, 0x101FBF00,
+ 0xA74, 0x00000007,
+ 0xA78, 0x00000900,
+ 0xA7C, 0x225B0606,
+ 0xA80, 0x218075B1,
+ 0xB2C, 0x80000000,
+ 0xC00, 0x48071D40,
+ 0xC04, 0x03A05611,
+ 0xC08, 0x000000E4,
+ 0xC0C, 0x6C6C6C6C,
+ 0xC10, 0x08800000,
+ 0xC14, 0x40000100,
+ 0xC18, 0x08800000,
+ 0xC1C, 0x40000100,
+ 0xC20, 0x00000000,
+ 0xC24, 0x00000000,
+ 0xC28, 0x00000000,
+ 0xC2C, 0x00000000,
+ 0xC30, 0x69E9AC47,
+ 0xC34, 0x469652AF,
+ 0xC38, 0x49795994,
+ 0xC3C, 0x0A97971C,
+ 0xC40, 0x1F7C403F,
+ 0xC44, 0x000100B7,
+ 0xC48, 0xEC020107,
+ 0xC4C, 0x007F037F,
+ 0xC50, 0x69553420,
+ 0xC54, 0x43BC0094,
+ 0xC58, 0x00013159,
+ 0xC5C, 0x00250492,
+ 0xC60, 0x00000000,
+ 0xC64, 0x7112848B,
+ 0xC68, 0x47C00BFF,
+ 0xC6C, 0x00000036,
+ 0xC70, 0x2C7F000D,
+ 0xC74, 0x028610DB,
+ 0xC78, 0x0000001F,
+ 0xC7C, 0x00B91612,
+ 0xC80, 0x390000E4,
+ 0xC84, 0x20F60000,
+ 0xC88, 0x40000100,
+ 0xC8C, 0x20200000,
+ 0xC90, 0x00091521,
+ 0xC94, 0x00000000,
+ 0xC98, 0x00121820,
+ 0xC9C, 0x00007F7F,
+ 0xCA0, 0x00000000,
+ 0xCA4, 0x000300A0,
+ 0xCA8, 0xFFFF0000,
+ 0xCAC, 0x00000000,
+ 0xCB0, 0x00000000,
+ 0xCB4, 0x00000000,
+ 0xCB8, 0x00000000,
+ 0xCBC, 0x28000000,
+ 0xCC0, 0x00000000,
+ 0xCC4, 0x00000000,
+ 0xCC8, 0x00000000,
+ 0xCCC, 0x00000000,
+ 0xCD0, 0x00000000,
+ 0xCD4, 0x00000000,
+ 0xCD8, 0x64B22427,
+ 0xCDC, 0x00766932,
+ 0xCE0, 0x00222222,
+ 0xCE4, 0x00000000,
+ 0xCE8, 0x37644302,
+ 0xCEC, 0x2F97D40C,
+ 0xD00, 0x00000740,
+ 0xD04, 0x00020401,
+ 0xD08, 0x0000907F,
+ 0xD0C, 0x20010201,
+ 0xD10, 0xA0633333,
+ 0xD14, 0x3333BC43,
+ 0xD18, 0x7A8F5B6F,
+ 0xD2C, 0xCC979975,
+ 0xD30, 0x00000000,
+ 0xD34, 0x80608000,
+ 0xD38, 0x00000000,
+ 0xD3C, 0x00127353,
+ 0xD40, 0x00000000,
+ 0xD44, 0x00000000,
+ 0xD48, 0x00000000,
+ 0xD4C, 0x00000000,
+ 0xD50, 0x6437140A,
+ 0xD54, 0x00000000,
+ 0xD58, 0x00000282,
+ 0xD5C, 0x30032064,
+ 0xD60, 0x4653DE68,
+ 0xD64, 0x04518A3C,
+ 0xD68, 0x00002101,
+ 0xD6C, 0x2A201C16,
+ 0xD70, 0x1812362E,
+ 0xD74, 0x322C2220,
+ 0xD78, 0x000E3C24,
+ 0xE00, 0x2D2D2D2D,
+ 0xE04, 0x2D2D2D2D,
+ 0xE08, 0x0390272D,
+ 0xE10, 0x2D2D2D2D,
+ 0xE14, 0x2D2D2D2D,
+ 0xE18, 0x2D2D2D2D,
+ 0xE1C, 0x2D2D2D2D,
+ 0xE28, 0x00000000,
+ 0xE30, 0x1000DC1F,
+ 0xE34, 0x10008C1F,
+ 0xE38, 0x02140102,
+ 0xE3C, 0x681604C2,
+ 0xE40, 0x01007C00,
+ 0xE44, 0x01004800,
+ 0xE48, 0xFB000000,
+ 0xE4C, 0x000028D1,
+ 0xE50, 0x1000DC1F,
+ 0xE54, 0x10008C1F,
+ 0xE58, 0x02140102,
+ 0xE5C, 0x28160D05,
+ 0xE60, 0x00000008,
+ 0xE68, 0x001B25A4,
+ 0xE6C, 0x00C00014,
+ 0xE70, 0x00C00014,
+ 0xE74, 0x01000014,
+ 0xE78, 0x01000014,
+ 0xE7C, 0x01000014,
+ 0xE80, 0x01000014,
+ 0xE84, 0x00C00014,
+ 0xE88, 0x01000014,
+ 0xE8C, 0x00C00014,
+ 0xED0, 0x00C00014,
+ 0xED4, 0x00C00014,
+ 0xED8, 0x00C00014,
+ 0xEDC, 0x00000014,
+ 0xEE0, 0x00000014,
+ 0xEEC, 0x01C00014,
+ 0xF14, 0x00000003,
+ 0xF4C, 0x00000000,
+ 0xF00, 0x00000300,
+
+};
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT(
+ 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_8188E_PHY_REG_1T_ICUT)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_PHY_REG_1T_ICUT;
+ BOOLEAN biol = FALSE;
+#ifdef CONFIG_IOL_IOREG_CFG
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ struct xmit_frame *pxmit_frame;
+ u8 bndy_cnt=1;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ struct cmd_cmp cmpdata[ArrayLen];
+ u4Byte cmpdata_idx=0;
+ #endif
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+ HAL_STATUS rst =HAL_STATUS_SUCCESS;
+
+ hex += board;
+ hex += _interface << 8;
+ hex += platform << 16;
+ hex += 0xFF000000;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT, hex = 0x%X\n", hex));
+#ifdef CONFIG_IOL_IOREG_CFG
+ biol = rtw_IOL_applied(Adapter);
+
+ if(biol){
+ if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
+ {
+ printk("rtw_IOL_accquire_xmit_frame failed\n");
+ return HAL_STATUS_FAILURE;
+ }
+ }
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+
+ for (i = 0; i < ArrayLen; i += 2 )
+ {
+ u4Byte v1 = Array[i];
+ u4Byte v2 = Array[i+1];
+
+ // This (offset, data) pair meets the condition.
+ if ( v1 < 0xCDCDCDCD )
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+
+
+ if (v1 == 0xfe){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfd){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xfc){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
+ }
+ else if (v1 == 0xfb){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfa){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
+ }
+ else if (v1 == 0xf9){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
+ }
+ else{
+ if (v1 == 0xa24)
+ pDM_Odm->RFCalibrateInfo.RegA24 = v2;
+
+ rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
+ }
+ continue;
+ }
+ else
+ { // This line is the start line of branch.
+ if ( !CheckCondition(Array[i], hex) )
+ { // Discard the following (offset, data) pairs.
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+ i -= 2; // prevent from for-loop += 2
+ }
+ else // Configure matched pairs and skip to end of if-else.
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ if (v1 == 0xfe){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfd){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xfc){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
+ }
+ else if (v1 == 0xfb){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfa){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xf9){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
+ }
+ else{
+ if (v1 == 0xa24)
+ pDM_Odm->RFCalibrateInfo.RegA24 = v2;
+
+ rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
+ }
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ while (v2 != 0xDEAD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ }
+ }
+ }
+#ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
+ if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ printk("~~~ %s IOL_exec_cmds Success !!! \n",__FUNCTION__);
+ {
+ u4Byte idx;
+ u4Byte cdata;
+ printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx);
+ printk("### %s data compared !!###\n",__FUNCTION__);
+ for(idx=0;idx< cmpdata_idx;idx++)
+ {
+ cdata = ODM_Read4Byte(pDM_Odm, cmpdata[idx].addr);
+ if(cdata != cmpdata[idx].value){
+ printk(" addr:0x%04x, data:(0x%02x : 0x%02x) \n",
+ cmpdata[idx].addr,cmpdata[idx].value,cdata);
+ rst = HAL_STATUS_FAILURE;
+ }
+ }
+ printk("### %s data compared !!###\n",__FUNCTION__);
+ //if(rst == HAL_STATUS_FAILURE)
+ {//dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ }
+ else{
+ rst = HAL_STATUS_FAILURE;
+ printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+ }
+ }
+#endif //#ifdef CONFIG_IOL_IOREG_CFG
+ return rst;
+}
+
+/******************************************************************************
+* PHY_REG_PG.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_PHY_REG_PG[] = {
+ 0, 0, 0, 0x00000e08, 0x0000ff00, 0x00004000,
+ 0, 0, 0, 0x0000086c, 0xffffff00, 0x34363800,
+ 0, 0, 0, 0x00000e00, 0xffffffff, 0x42444646,
+ 0, 0, 0, 0x00000e04, 0xffffffff, 0x30343840,
+ 0, 0, 0, 0x00000e10, 0xffffffff, 0x38404244,
+ 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436
+};
+
+void
+ODM_ReadAndConfig_MP_8188E_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_8188E_PHY_REG_PG)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_PHY_REG_PG;
+
+ 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];
+ u4Byte v2 = Array[i+1];
+ u4Byte v3 = Array[i+2];
+ u4Byte v4 = Array[i+3];
+ 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_8188E(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];
+ }
+ }
+ }
+ }
+}
+
+
+
+#endif // end of HWIMG_SUPPORT
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.h b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.h
index 1bd271c..8f3e09b 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.h
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_BB.h
@@ -1,74 +1,74 @@
-/******************************************************************************
-*
-* 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 (RTL8188E_SUPPORT == 1)
-#ifndef __INC_MP_BB_HW_IMG_8188E_H
-#define __INC_MP_BB_HW_IMG_8188E_H
-
-//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex);
-
-/******************************************************************************
-* AGC_TAB_1T.TXT
-******************************************************************************/
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* AGC_TAB_1T_ICUT.TXT
-******************************************************************************/
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* PHY_REG_1T.TXT
-******************************************************************************/
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_PHY_REG_1T( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* PHY_REG_1T_ICUT.TXT
-******************************************************************************/
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* PHY_REG_PG.TXT
-******************************************************************************/
-
-void
-ODM_ReadAndConfig_MP_8188E_PHY_REG_PG( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-#endif
-#endif // end of HWIMG_SUPPORT
-
+/******************************************************************************
+*
+* 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 (RTL8188E_SUPPORT == 1)
+#ifndef __INC_MP_BB_HW_IMG_8188E_H
+#define __INC_MP_BB_HW_IMG_8188E_H
+
+//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex);
+
+/******************************************************************************
+* AGC_TAB_1T.TXT
+******************************************************************************/
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* AGC_TAB_1T_ICUT.TXT
+******************************************************************************/
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* PHY_REG_1T.TXT
+******************************************************************************/
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_PHY_REG_1T( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* PHY_REG_1T_ICUT.TXT
+******************************************************************************/
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* PHY_REG_PG.TXT
+******************************************************************************/
+
+void
+ODM_ReadAndConfig_MP_8188E_PHY_REG_PG( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+#endif
+#endif // end of HWIMG_SUPPORT
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.c b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.c
index 06455d8..5e23988 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.c
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.c
@@ -1,5010 +1,5010 @@
-/******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-* more details.
-*
-* You should have received a copy of the GNU General Public License along with
-* this program; if not, write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-*
-*
-******************************************************************************/
-
-
-#include "../odm_precomp.h"
-
-#if (RTL8188E_SUPPORT == 1)
-#if(DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-
-u1Byte Array_MP_8188E_FW_AP[] = {
-0x00, 0x95, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x18, 0x19, 0x12, 0x5A, 0x3B, 0x00, 0x00,
-0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x02, 0x49, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x59, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x59, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x5F, 0xDD, 0x00, 0x00,
-0x0F, 0xF0, 0x8F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x05, 0xF0,
-0x8F, 0x0F, 0x00, 0x00, 0x00, 0x05, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xF0, 0x8F, 0x0F,
-0x00, 0x00, 0x00, 0x0A, 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, 0x05,
-0x04, 0x03, 0x02, 0x00, 0x03, 0x06, 0x05, 0x04, 0x03, 0x00, 0x04, 0x06, 0x05, 0x04, 0x02, 0x00,
-0x04, 0x08, 0x07, 0x06, 0x04, 0x00, 0x06, 0x0A, 0x09, 0x08, 0x06, 0x00, 0x08, 0x0A, 0x09, 0x08,
-0x04, 0x00, 0x08, 0x0A, 0x09, 0x08, 0x02, 0x00, 0x08, 0x0A, 0x09, 0x08, 0x00, 0x00, 0x08, 0x12,
-0x11, 0x10, 0x08, 0x00, 0x10, 0x1A, 0x19, 0x18, 0x10, 0x00, 0x18, 0x22, 0x21, 0x20, 0x18, 0x00,
-0x20, 0x22, 0x21, 0x20, 0x10, 0x00, 0x20, 0x22, 0x21, 0x20, 0x08, 0x00, 0x20, 0x22, 0x21, 0x1C,
-0x08, 0x00, 0x20, 0x22, 0x21, 0x14, 0x08, 0x00, 0x20, 0x22, 0x20, 0x18, 0x08, 0x00, 0x20, 0x31,
-0x30, 0x20, 0x10, 0x00, 0x30, 0x31, 0x30, 0x18, 0x00, 0x00, 0x30, 0x31, 0x2F, 0x10, 0x10, 0x00,
-0x30, 0x31, 0x2C, 0x10, 0x10, 0x00, 0x30, 0x31, 0x28, 0x10, 0x00, 0x00, 0x30, 0x31, 0x20, 0x10,
-0x00, 0x00, 0x30, 0x31, 0x10, 0x10, 0x00, 0x00, 0x30, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x05,
-0x07, 0x07, 0x07, 0x08, 0x0A, 0x04, 0x04, 0x04, 0x04, 0x06, 0x0A, 0x0B, 0x0D, 0x05, 0x05, 0x07,
-0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x05, 0x05, 0x07,
-0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x0F, 0x0F, 0x05,
-0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x0F, 0x0F, 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, 0x04, 0x05, 0x05, 0x06, 0x0A, 0x11,
-0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, 0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11,
-0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, 0x13, 0x13, 0x13, 0x09, 0x09, 0x09, 0x09, 0x0C,
-0x0E, 0x11, 0x13, 0x13, 0x13, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x26, 0x2A, 0x18, 0x1A, 0x1D,
-0x1F, 0x21, 0x27, 0x29, 0x2A, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x00, 0x00, 0x00,
-0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x00, 0x00, 0x00,
-0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x2C, 0x2C, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x2C,
-0x2C, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x2C, 0x2C, 0x00, 0x00, 0x00, 0x1F, 0x23,
-0x28, 0x2A, 0x2C, 0x2C, 0x2C, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x18, 0x00,
-0x24, 0x00, 0x30, 0x00, 0x48, 0x00, 0x60, 0x00, 0x90, 0x00, 0xC0, 0x00, 0xD8, 0x00, 0x50, 0x00,
-0x78, 0x00, 0xA0, 0x00, 0xC8, 0x01, 0x40, 0x01, 0x90, 0x01, 0xE0, 0x02, 0x30, 0x01, 0x2C, 0x01,
-0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x01, 0x2C, 0x01,
-0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x01, 0x2C, 0x01,
-0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x01, 0x2C, 0x01,
-0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x07, 0xD0, 0x07,
-0xD0, 0x01, 0x2C, 0x01, 0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07,
-0xD0, 0x07, 0xD0, 0x07, 0xD0, 0x01, 0x2C, 0x01, 0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04,
-0xB0, 0x06, 0x40, 0x07, 0xD0, 0x07, 0xD0, 0x07, 0xD0, 0x01, 0x2C, 0x01, 0x40, 0x01, 0xE0, 0x02,
-0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x07, 0xD0, 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, 0x28, 0x00, 0x3C, 0x00, 0x50, 0x00, 0x64, 0x00, 0xA0, 0x00,
-0xC8, 0x00, 0xF0, 0x01, 0x18, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02,
-0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02,
-0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02,
-0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02,
-0x58, 0x03, 0x20, 0x03, 0xE8, 0x03, 0xE8, 0x03, 0xE8, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01,
-0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, 0xE8, 0x03, 0xE8, 0x03, 0xE8, 0x00, 0x64, 0x00,
-0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, 0xE8, 0x03, 0xE8, 0x03,
-0xE8, 0x00, 0x64, 0x00, 0xA0, 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, 0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x06, 0x07, 0x05, 0x05, 0x05,
-0x06, 0x06, 0x07, 0x07, 0x08, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x05, 0x06, 0x06,
-0x07, 0x07, 0x08, 0x09, 0x0A, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x05, 0x06, 0x06,
-0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A,
-0x0B, 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, 0x07, 0x08, 0x09, 0x0A, 0x0B,
-0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
-0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09,
-0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x05,
-0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x20, 0x1E, 0x1C, 0x18, 0x10, 0x18, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 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, 0x89, 0xF8, 0xE6, 0xBC, 0x03, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00,
-0x40, 0xCE, 0x79, 0x04, 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, 0x04, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30,
-0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x88, 0x25, 0x0C, 0xF8,
-0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8,
-0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5,
-0x0C, 0x24, 0x89, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD,
-0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x88,
-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, 0x88, 0xA6,
-0x81, 0x74, 0x03, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x04, 0xE4, 0x78, 0x80,
-0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x49, 0xF8, 0x74, 0x01, 0x93,
-0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2,
-0x8C, 0xD2, 0xAF, 0x22, 0x03, 0xEF, 0xD3, 0x94, 0x03, 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, 0x88, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18,
-0xBE, 0x03, 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, 0x88, 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, 0x88, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F,
-0x04, 0x90, 0x49, 0xF8, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3,
-0x94, 0x03, 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, 0x88, 0x2F,
-0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x45, 0x4D, 0x50, 0x2E, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xBF, 0x03,
-0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x88, 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, 0x89, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01,
-0x0F, 0x74, 0x88, 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, 0x03, 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, 0x4C, 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, 0x4D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF,
-0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xE7, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80,
-0x46, 0xE7, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x3E, 0x88, 0x82, 0x8C, 0x83, 0xE7, 0x09, 0xF0,
-0xA3, 0xDF, 0xFA, 0x80, 0x32, 0xE3, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x78, 0xE3, 0x09, 0xF2,
-0x08, 0xDF, 0xFA, 0x80, 0x70, 0x88, 0x82, 0x8C, 0x83, 0xE3, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80,
-0x64, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x58, 0x89, 0x82, 0x8A,
-0x83, 0xE0, 0xA3, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x4C, 0x80, 0xD2, 0x80, 0xFA, 0x80, 0xC6, 0x80,
-0xD4, 0x80, 0x69, 0x80, 0xF2, 0x80, 0x33, 0x80, 0x10, 0x80, 0xA6, 0x80, 0xEA, 0x80, 0x9A, 0x80,
-0xA8, 0x80, 0xDA, 0x80, 0xE2, 0x80, 0xCA, 0x80, 0x33, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4,
-0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8,
-0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, 0x0D, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93,
-0xA3, 0xF6, 0x08, 0xDF, 0xF9, 0xEC, 0xFA, 0xA9, 0xF0, 0xED, 0xFB, 0x22, 0x89, 0x82, 0x8A, 0x83,
-0xEC, 0xFA, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5,
-0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xEA, 0xDE, 0xE8, 0x80, 0xDB, 0x89, 0x82, 0x8A, 0x83,
-0xE4, 0x93, 0xA3, 0xF2, 0x08, 0xDF, 0xF9, 0x80, 0xCC, 0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E,
-0x60, 0xC3, 0x88, 0xF0, 0xED, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0xB9, 0xF5, 0x82, 0xEB, 0x24,
-0x02, 0xB4, 0x04, 0x00, 0x50, 0xAF, 0x23, 0x23, 0x45, 0x82, 0x23, 0x90, 0x47, 0xF9, 0x73, 0xC5,
-0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0, 0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15,
-0x83, 0xE0, 0x38, 0xF0, 0x22, 0xBB, 0x01, 0x0A, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xF5, 0xF0, 0xA3,
-0xE0, 0x22, 0x50, 0x06, 0x87, 0xF0, 0x09, 0xE7, 0x19, 0x22, 0xBB, 0xFE, 0x07, 0xE3, 0xF5, 0xF0,
-0x09, 0xE3, 0x19, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xF5, 0xF0, 0x74, 0x01, 0x93, 0x22,
-0xBB, 0x01, 0x10, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE5, 0x83, 0x3A, 0xF5, 0x83, 0xE0, 0xF5, 0xF0,
-0xA3, 0xE0, 0x22, 0x50, 0x09, 0xE9, 0x25, 0x82, 0xF8, 0x86, 0xF0, 0x08, 0xE6, 0x22, 0xBB, 0xFE,
-0x0A, 0xE9, 0x25, 0x82, 0xF8, 0xE2, 0xF5, 0xF0, 0x08, 0xE2, 0x22, 0xE5, 0x83, 0x2A, 0xF5, 0x83,
-0xE9, 0x93, 0xF5, 0xF0, 0xA3, 0xE9, 0x93, 0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFE,
-0xA3, 0xE0, 0xFF, 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, 0x49, 0xA6, 0x02, 0x45, 0xDD, 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, 0xEB, 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, 0x00, 0x41, 0x9E, 0xA8, 0x00,
-0x41, 0x9E, 0xA9, 0x00, 0x41, 0x9E, 0xBA, 0x00, 0x4A, 0xEA, 0x4D, 0xD3, 0x52, 0xD2, 0x57, 0xF6,
-0x90, 0x00, 0xF0, 0xE0, 0x7F, 0x01, 0x20, 0xE2, 0x02, 0x7F, 0x03, 0x22, 0x51, 0x00, 0x90, 0x9C,
-0x94, 0xEF, 0xF0, 0x51, 0x1E, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x02, 0x2D, 0x4A, 0x51, 0x89,
-0x51, 0xB9, 0x51, 0x4B, 0x51, 0x6A, 0xE4, 0xF5, 0x0D, 0xF5, 0x0E, 0xF5, 0x0F, 0xF5, 0x10, 0xAD,
-0x0D, 0x7F, 0x50, 0x12, 0x31, 0xE4, 0xAD, 0x0E, 0x7F, 0x51, 0x12, 0x31, 0xE4, 0xAD, 0x0F, 0x7F,
-0x52, 0x12, 0x31, 0xE4, 0xAD, 0x10, 0x7F, 0x53, 0x02, 0x31, 0xE4, 0x75, 0x15, 0x12, 0xE4, 0xF5,
-0x16, 0x75, 0x17, 0x07, 0x75, 0x18, 0x32, 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,
-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, 0x31, 0xE4, 0xE4, 0xFD, 0x7F, 0x51, 0x12, 0x31, 0xE4, 0xE4, 0xFD, 0x7F, 0x52, 0x12,
-0x31, 0xE4, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x31, 0xE4, 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, 0x31, 0xE4, 0x7D, 0xFF, 0x7F, 0x55, 0x12, 0x31, 0xE4, 0x7D, 0xFF, 0x7F, 0x56,
-0x12, 0x31, 0xE4, 0x7D, 0xFF, 0x7F, 0x57, 0x02, 0x31, 0xE4, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80,
-0xFD, 0x7F, 0x80, 0x12, 0x31, 0xE4, 0x71, 0x6B, 0x12, 0x32, 0x25, 0x71, 0x85, 0x7F, 0x01, 0x12,
-0x46, 0x15, 0x90, 0x9D, 0xCA, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x46, 0x15, 0x90, 0x9D, 0xCA, 0xE0,
-0x04, 0xF0, 0x7F, 0x03, 0x12, 0x46, 0x15, 0x90, 0x9D, 0xCA, 0xE0, 0x04, 0xF0, 0x51, 0x0C, 0x71,
-0x39, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x31, 0xE4, 0x75, 0x28, 0xFF,
-0x71, 0x5C, 0x71, 0xB5, 0xE4, 0xFF, 0x02, 0x46, 0x9E, 0x71, 0x56, 0x71, 0x63, 0x91, 0xB7, 0x91,
-0x0A, 0x71, 0x73, 0x90, 0x9D, 0xCE, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0,
-0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0x9D, 0x36, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75,
-0xA8, 0x85, 0x22, 0xE4, 0x90, 0x9D, 0x30, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44,
-0x01, 0xF0, 0x22, 0x90, 0x9D, 0xCB, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0x74, 0x0A,
-0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x01, 0x9C, 0x74,
-0x7E, 0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74, 0x24, 0xF0, 0x90, 0x01,
-0x9B, 0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01, 0x99, 0xE4, 0xF0, 0x90,
-0x01, 0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x9D, 0xD3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x98, 0xE0,
-0x7F, 0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3D, 0xC3, 0x90, 0x9D, 0xD4,
-0xE0, 0x94, 0x88, 0x90, 0x9D, 0xD3, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44,
-0x10, 0xF0, 0x22, 0x90, 0x9D, 0xD3, 0xE4, 0x75, 0xF0, 0x01, 0x11, 0x9F, 0x7F, 0x14, 0x7E, 0x00,
-0x12, 0x32, 0x58, 0xD3, 0x90, 0x9D, 0xD4, 0xE0, 0x94, 0x32, 0x90, 0x9D, 0xD3, 0xE0, 0x94, 0x00,
-0x40, 0xBA, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB3, 0x22, 0xE4, 0x90, 0x9D, 0xBA, 0xF0, 0x90,
-0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0xF0, 0x54, 0xF0, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFD, 0xF0,
-0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x9D, 0xBF, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x9D,
-0xB7, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x9D, 0xC2, 0xF0, 0x90,
-0x9D, 0xC1, 0x74, 0x07, 0xF0, 0x90, 0x9D, 0xC4, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90,
-0x9D, 0xBD, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x9D, 0xBB, 0x74, 0x0C, 0xF0,
-0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x90, 0x9D, 0xB7,
-0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54,
-0xF7, 0xF0, 0x90, 0x9C, 0x94, 0xE0, 0xFF, 0xB4, 0x01, 0x08, 0x90, 0x9D, 0xC3, 0x74, 0x93, 0xF0,
-0x80, 0x0F, 0xEF, 0x90, 0x9D, 0xC3, 0xB4, 0x03, 0x05, 0x74, 0xDC, 0xF0, 0x80, 0x03, 0x74, 0x40,
-0xF0, 0x90, 0x9D, 0xC6, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44,
-0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0xE4, 0xFF, 0xE4, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90,
-0x81, 0x00, 0xBE, 0x03, 0x11, 0x31, 0x24, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5,
-0x83, 0x74, 0x80, 0xF0, 0x80, 0x0E, 0x31, 0x24, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83,
-0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x08, 0xEF, 0x90, 0x89, 0x00, 0x31, 0x24, 0xE5, 0x82, 0x2E,
-0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE4, 0xF0, 0x0E, 0xBE, 0x10, 0xBE, 0x0F, 0xBF, 0x80,
-0xB8, 0xE4, 0x90, 0xAF, 0x71, 0xF0, 0xFF, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x01, 0x31, 0x24,
-0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x03, 0x31, 0x24, 0xE4, 0xF0, 0xA3,
-0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x05, 0x31, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0,
-0x0A, 0xEF, 0x90, 0x8D, 0x07, 0x31, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90,
-0x8D, 0x09, 0x31, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4,
-0x34, 0x92, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0x74, 0x93, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x99,
-0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x98, 0x31, 0x24, 0x74, 0x01, 0xF0,
-0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x99, 0x31, 0x24, 0xE4, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90,
-0x94, 0x97, 0x31, 0x24, 0x74, 0x01, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x95, 0x31, 0x24,
-0x74, 0x09, 0xF0, 0xF5, 0xF0, 0xEF, 0x90, 0x94, 0x96, 0x31, 0x24, 0xE4, 0xF0, 0x75, 0xF0, 0x09,
-0xEF, 0x90, 0x94, 0x93, 0x31, 0x24, 0x74, 0x13, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x94,
-0x31, 0x24, 0xE4, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x00, 0x31, 0x24, 0x74, 0x13, 0xF0,
-0x0F, 0xEF, 0x64, 0x80, 0x60, 0x02, 0xA1, 0x07, 0x7F, 0x20, 0x90, 0x9E, 0x7B, 0xE4, 0xF0, 0xA3,
-0xDF, 0xFC, 0x22, 0xE4, 0x90, 0x9D, 0xD5, 0xF0, 0x90, 0x9D, 0xD5, 0xE0, 0x64, 0x01, 0xF0, 0x24,
-0xD3, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x4D, 0xA3, 0xF0, 0x90, 0x9D, 0xBC, 0xE0, 0xFF, 0x90, 0x9D,
-0xBB, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x5F, 0xC4, 0x90, 0x9D, 0xB7, 0xE0, 0x30, 0xE0, 0x09, 0x12,
-0x67, 0xF4, 0xBF, 0x01, 0x03, 0x12, 0x6B, 0x36, 0x90, 0x9D, 0xBC, 0xE0, 0x90, 0x01, 0xBC, 0xF0,
-0x90, 0x9D, 0x36, 0xE0, 0x90, 0x01, 0xBD, 0xF0, 0xD1, 0x3B, 0x90, 0x00, 0x02, 0xE0, 0x54, 0xFE,
-0xF0, 0x7F, 0xF4, 0x7E, 0x01, 0x12, 0x32, 0x58, 0x90, 0x00, 0x02, 0xE0, 0x44, 0x01, 0xF0, 0x7F,
-0xF4, 0x7E, 0x01, 0x12, 0x32, 0x58, 0x12, 0x45, 0x4D, 0x80, 0x9D, 0x12, 0x7A, 0x45, 0x12, 0x52,
-0x73, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0x90, 0x9E, 0xAB, 0xF0, 0x90, 0x00, 0x8F,
-0xE0, 0x20, 0xE6, 0x03, 0x02, 0x51, 0x91, 0x90, 0x00, 0x8D, 0xE0, 0x90, 0x9E, 0xAA, 0xF0, 0x90,
-0x00, 0x8C, 0xE0, 0x90, 0x9E, 0xAB, 0xF0, 0x90, 0x9E, 0xAA, 0xE0, 0x31, 0x42, 0x4E, 0x86, 0x01,
-0x4E, 0x91, 0x02, 0x4E, 0x9C, 0x04, 0x4F, 0x8A, 0x05, 0x50, 0x82, 0x06, 0x51, 0x07, 0x07, 0x51,
-0x4B, 0x08, 0x00, 0x00, 0x51, 0x83, 0x90, 0x9E, 0xAB, 0xE0, 0xFF, 0x12, 0x52, 0x18, 0x02, 0x51,
-0x83, 0x90, 0x9E, 0xAB, 0xE0, 0xFF, 0x12, 0x51, 0xC4, 0x02, 0x51, 0x83, 0x90, 0x9E, 0xAB, 0xE0,
-0x75, 0xF0, 0x09, 0x90, 0x94, 0x98, 0x31, 0x24, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x12, 0x51, 0x9C,
-0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x09, 0x90, 0x94, 0x96, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB,
-0xE0, 0x75, 0xF0, 0x09, 0x90, 0x94, 0x9B, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0,
-0x09, 0x90, 0x94, 0x99, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x09, 0x90, 0x94,
-0x93, 0x31, 0x24, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75,
-0xF0, 0x09, 0x90, 0x94, 0x94, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x09, 0x90,
-0x94, 0x97, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x09, 0x90, 0x94, 0x95, 0x12,
-0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x31, 0x24, 0xE0, 0xFB,
-0xE4, 0xFD, 0x0F, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x01,
-0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x02, 0x12, 0x51, 0x96,
-0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x03, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB,
-0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x04, 0x31, 0x24, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x12, 0x51,
-0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x05, 0x12, 0x51, 0x96, 0x90, 0x9E,
-0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x06, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75,
-0xF0, 0x08, 0x90, 0x89, 0x07, 0x31, 0x24, 0x02, 0x51, 0x46, 0x90, 0x9E, 0xAB, 0xE0, 0x25, 0xE0,
-0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xA3, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x12,
-0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5,
-0x83, 0xE0, 0xFB, 0x0D, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D,
-0x01, 0x31, 0x24, 0xA3, 0xE0, 0xFB, 0x0D, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0,
-0x0A, 0x90, 0x8D, 0x01, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D,
-0x03, 0x31, 0x24, 0xA3, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0,
-0x75, 0xF0, 0x0A, 0x90, 0x8D, 0x05, 0x31, 0x24, 0xA3, 0xE0, 0xFB, 0x0D, 0x12, 0x51, 0x9C, 0x90,
-0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D, 0x07, 0x12, 0x49, 0x24, 0xA3, 0xE0, 0xFB, 0x0D,
-0x31, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D, 0x09, 0x12, 0x49, 0x24, 0xA3,
-0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x24, 0x93, 0xF5, 0x82, 0xE4, 0x34, 0x99,
-0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x25, 0xE0, 0x24,
-0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xA3, 0xE0, 0xFB, 0x7D, 0x02, 0x31, 0x9C, 0x90,
-0x9E, 0xAB, 0xE0, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xFB,
-0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x7B, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0x9C, 0x90, 0x9E, 0x7C,
-0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x7D, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x7E,
-0x21, 0x46, 0x90, 0x9E, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x31, 0x9C, 0x90, 0x9E, 0x84, 0xE0,
-0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x85, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x86, 0xE0,
-0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x87, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0x9C, 0x90, 0x9E,
-0x88, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x89, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E,
-0x8A, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x8B, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0x9C,
-0x90, 0x9E, 0x8C, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x8D, 0xE0, 0xFB, 0x0D, 0x31, 0x9C,
-0x90, 0x9E, 0x8E, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x8F, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F,
-0x31, 0x9C, 0x90, 0x9E, 0x90, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x91, 0xE0, 0xFB, 0x0D,
-0x31, 0x9C, 0x90, 0x9E, 0x92, 0x80, 0x3F, 0x90, 0x9E, 0x93, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x31,
-0x9C, 0x90, 0x9E, 0x94, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x95, 0xE0, 0xFB, 0x0D, 0x31,
-0x9C, 0x90, 0x9E, 0x96, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x97, 0xE0, 0xFB, 0xE4, 0xFD,
-0x0F, 0x31, 0x9C, 0x90, 0x9E, 0x98, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x99, 0xE0, 0xFB,
-0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x9A, 0xE0, 0xFB, 0x0D, 0x80, 0x36, 0x90, 0x9D, 0xBA, 0xE0, 0xFB,
-0xE4, 0xFD, 0xFF, 0x31, 0x9C, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0xFB, 0x0D, 0x31, 0x9C, 0x90,
-0x9D, 0xBB, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9D, 0xBC, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90,
-0x9E, 0xAB, 0xE0, 0x24, 0x36, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD,
-0x0F, 0x31, 0x9C, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x31,
-0xE4, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x49, 0x24, 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, 0x8F, 0x27, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE6, 0x4A, 0x90, 0x00, 0x8D,
-0xE0, 0x64, 0x02, 0x70, 0x42, 0x90, 0x9E, 0xB9, 0xF0, 0x90, 0x9E, 0xB9, 0xE0, 0xFD, 0xE5, 0x27,
-0x75, 0xF0, 0x08, 0xA4, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE5, 0x82, 0x2D,
-0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x31, 0x9C, 0x90, 0x9E, 0xB9,
-0xE0, 0x04, 0xF0, 0xE0, 0xC3, 0x94, 0x08, 0x40, 0xD0, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07,
-0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x31, 0xE4, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F,
-0x26, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE6, 0x46, 0x90, 0x00, 0x8D, 0xE0, 0x64, 0x01, 0x70, 0x3E,
-0x90, 0x9E, 0xB8, 0xF0, 0x90, 0x9E, 0xB8, 0xE0, 0xFD, 0x75, 0xF0, 0x10, 0xE5, 0x26, 0x90, 0x81,
-0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2D, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB,
-0xE4, 0xFF, 0x31, 0x9C, 0x90, 0x9E, 0xB8, 0xE0, 0x04, 0xF0, 0xE0, 0xC3, 0x94, 0x10, 0x40, 0xD4,
-0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x31, 0xE4, 0xD0, 0xD0,
-0x92, 0xAF, 0x22, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE6, 0x57, 0x90, 0x00, 0x8D, 0xE0, 0x64, 0x03,
-0x70, 0x4F, 0x90, 0x00, 0x8F, 0xE0, 0xFE, 0x90, 0x00, 0x8E, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x9D,
-0xD7, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0x90, 0x9D, 0xD6, 0xF0, 0x90, 0x9D, 0xD6, 0xE0, 0xFD,
-0xFF, 0x90, 0x9D, 0xD8, 0xE0, 0x2F, 0xFF, 0x90, 0x9D, 0xD7, 0xE0, 0x34, 0x00, 0x8F, 0x82, 0xF5,
-0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x31, 0x9C, 0x90, 0x9D, 0xD6, 0xE0, 0x04, 0xF0, 0xE0, 0xC3, 0x94,
-0x10, 0x40, 0xD8, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x31,
-0xE4, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x47, 0x4E, 0x90, 0x9D, 0xD9, 0xEF, 0xF0,
-0x60, 0xF0, 0x90, 0x9E, 0x93, 0xE0, 0x04, 0xF0, 0x51, 0xEC, 0x80, 0xE6, 0xD3, 0x10, 0xAF, 0x01,
-0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x9D, 0xDA, 0xF0, 0x90, 0x9D, 0xDA,
-0xE0, 0xFD, 0x70, 0x02, 0x81, 0x25, 0x90, 0x9E, 0xA8, 0xE0, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8,
-0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02,
-0x81, 0x0F, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12, 0x49, 0x24, 0xE0,
-0x90, 0x9D, 0xDB, 0xF0, 0x75, 0x40, 0x01, 0x75, 0x41, 0x9D, 0x75, 0x42, 0xDB, 0x75, 0x43, 0x01,
-0x7B, 0x01, 0x7A, 0x9D, 0x79, 0xDC, 0x12, 0x2B, 0x33, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04,
-0x90, 0x01, 0xD1, 0x12, 0x49, 0x24, 0xE0, 0x90, 0x9D, 0xDD, 0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0x75,
-0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x49, 0x24, 0xE0, 0x90, 0x9D, 0xDE, 0xF0, 0x90, 0x9E, 0xA8,
-0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x49, 0x24, 0xE0, 0x90, 0x9D, 0xDF, 0xF0, 0x90,
-0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12, 0x49, 0x24, 0xE0, 0x90, 0x9D, 0xE0,
-0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1, 0x12, 0x49, 0x24, 0xE0, 0x90,
-0x9D, 0xE1, 0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF2, 0x12, 0x49, 0x24,
-0xE0, 0x90, 0x9D, 0xE2, 0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF3, 0x12,
-0x49, 0x24, 0xE0, 0x90, 0x9D, 0xE3, 0xF0, 0x90, 0x9D, 0xDA, 0xE0, 0xFF, 0x90, 0x9E, 0xA8, 0xE0,
-0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0x9D,
-0xDA, 0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33,
-0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x9D, 0xDC, 0xE0, 0xFF, 0x7B, 0x01, 0x7A, 0x9D, 0x79,
-0xDD, 0x91, 0x2A, 0x90, 0x9E, 0xA8, 0xE0, 0x04, 0xF0, 0xE0, 0x54, 0x03, 0xF0, 0x41, 0xFD, 0x90,
-0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x01, 0x4D, 0xE0, 0x64, 0x80, 0xF0, 0x90, 0x9E, 0xA8,
-0xE0, 0x90, 0x00, 0x89, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x39,
-0xEF, 0x12, 0x49, 0x42, 0x54, 0x56, 0x00, 0x54, 0x5F, 0x01, 0x54, 0x68, 0x02, 0x54, 0x71, 0x03,
-0x54, 0x7A, 0x04, 0x54, 0x83, 0x20, 0x54, 0x8B, 0x21, 0x54, 0x94, 0x23, 0x54, 0x9C, 0x40, 0x54,
-0xAB, 0x42, 0x00, 0x00, 0x54, 0xB4, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x65, 0xE8, 0x90,
-0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x66, 0x30, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x66,
-0xC8, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x7A, 0x7D, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30,
-0x02, 0x7A, 0x9D, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x80, 0x31, 0x90, 0x9D, 0xE4, 0x12, 0x49,
-0x30, 0x02, 0x67, 0x00, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0xE1, 0xE4, 0x90, 0x9E, 0x94, 0xE0,
-0x04, 0xF0, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x79, 0x17, 0x90, 0x9D, 0xE4, 0x12, 0x49,
-0x30, 0x02, 0x79, 0xFE, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x12, 0x1F, 0x96, 0x90,
-0x9D, 0xBA, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE,
-0x90, 0x9D, 0xB9, 0xE0, 0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xAF, 0x54, 0x01,
-0x25, 0xE0, 0xFE, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54,
-0xF0, 0xFF, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xAF,
-0x90, 0x9D, 0xBB, 0xF0, 0xB1, 0x2B, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0,
-0x90, 0x9D, 0xBA, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x9D, 0xBB, 0xE0, 0x90, 0x01, 0xBB, 0xF0,
-0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x9D, 0xE7, 0x12, 0x49,
-0x39, 0x12, 0x7A, 0xC7, 0x90, 0x9D, 0xBA, 0xE0, 0xFF, 0xB1, 0x5B, 0x90, 0x9D, 0xBA, 0xE0, 0x60,
-0x19, 0x90, 0x9D, 0xE7, 0x12, 0x49, 0x30, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0x54, 0x0F, 0xFF,
-0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFD, 0x12, 0x7A, 0xD8, 0x22, 0xEF, 0x70, 0x3E, 0x7D, 0x01,
-0xFF, 0x12, 0x5E, 0x47, 0x7D, 0x78, 0x7F, 0x02, 0x12, 0x5E, 0x47, 0x7D, 0x02, 0x7F, 0x03, 0x12,
-0x5E, 0x47, 0x7D, 0xC8, 0x7F, 0x02, 0x12, 0x7A, 0x2D, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01,
-0x3C, 0x74, 0x02, 0xF0, 0x7D, 0x01, 0x7F, 0x0C, 0xB1, 0xF5, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xF7,
-0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, 0x30, 0x74,
-0x01, 0xF0, 0x90, 0x01, 0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x01, 0xE4, 0xFF,
-0xF1, 0xA9, 0x7D, 0x78, 0x7F, 0x02, 0xF1, 0xA9, 0x7D, 0x02, 0x7F, 0x03, 0xF1, 0xA9, 0x90, 0x06,
-0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x9D, 0xC4, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x9D,
-0x36, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x9D, 0xB8, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x9D, 0xBC, 0xE0,
-0x20, 0xE2, 0x0D, 0x7D, 0x01, 0x7F, 0x04, 0x80, 0x0C, 0x90, 0x9D, 0xB8, 0xE0, 0x44, 0x04, 0xF0,
-0x22, 0x7D, 0x01, 0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9E, 0xB4, 0xED,
-0xF0, 0x90, 0x9D, 0xBC, 0xE0, 0x90, 0x9E, 0xB5, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0xFE, 0xC4, 0x13,
-0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0xE1, 0x53, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30,
-0xE0, 0x02, 0xE1, 0x53, 0x90, 0x9E, 0xB5, 0xE0, 0xFE, 0x6F, 0x70, 0x02, 0xE1, 0x53, 0xEF, 0x70,
-0x02, 0xC1, 0xC4, 0x24, 0xFC, 0x60, 0x52, 0x24, 0xFE, 0x70, 0x02, 0xE1, 0x00, 0x24, 0xFE, 0x70,
-0x02, 0xE1, 0x3E, 0x24, 0xFC, 0x60, 0x02, 0xE1, 0x53, 0xEE, 0xB4, 0x0E, 0x03, 0x12, 0x7B, 0x1C,
-0x90, 0x9E, 0xB5, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12, 0x6A, 0x9A, 0x90, 0x9E, 0xB5, 0xE0, 0xB4,
-0x06, 0x02, 0xF1, 0xBE, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0x9E, 0xB4, 0xE0, 0xFF,
-0x60, 0x05, 0x12, 0x63, 0xEF, 0x80, 0x03, 0x12, 0x7B, 0x09, 0x90, 0x9E, 0xB5, 0xE0, 0x64, 0x08,
-0x60, 0x02, 0xE1, 0x53, 0x12, 0x6A, 0xB3, 0xE1, 0x53, 0x90, 0x9E, 0xB5, 0xE0, 0x70, 0x05, 0x7F,
-0x01, 0x12, 0x6A, 0x9A, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x06, 0x02, 0xF1, 0xBE, 0x90, 0x9E, 0xB5,
-0xE0, 0xB4, 0x0E, 0x08, 0xF1, 0x58, 0xBF, 0x01, 0x03, 0x12, 0x7B, 0x1C, 0x90, 0x9E, 0xB5, 0xE0,
-0x64, 0x0C, 0x60, 0x02, 0xE1, 0x53, 0xF1, 0x58, 0xEF, 0x64, 0x01, 0x60, 0x02, 0xE1, 0x53, 0x12,
-0x60, 0xE0, 0xE1, 0x53, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x0E, 0x08, 0xF1, 0x58, 0xBF, 0x01, 0x03,
-0x12, 0x7B, 0x1C, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x06, 0x02, 0xF1, 0xBE, 0x90, 0x9E, 0xB5, 0xE0,
-0xB4, 0x0C, 0x08, 0xF1, 0x58, 0xBF, 0x01, 0x03, 0x12, 0x60, 0xE0, 0x90, 0x9E, 0xB5, 0xE0, 0x64,
-0x04, 0x70, 0x60, 0x12, 0x68, 0xB1, 0xEF, 0x64, 0x01, 0x70, 0x58, 0x12, 0x69, 0xC7, 0x80, 0x53,
-0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x0E, 0x08, 0xF1, 0x58, 0xBF, 0x01, 0x03, 0x12, 0x7B, 0x1C, 0x90,
-0x9E, 0xB5, 0xE0, 0xB4, 0x06, 0x02, 0xF1, 0xBE, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x0C, 0x08, 0xF1,
-0x58, 0xBF, 0x01, 0x03, 0x12, 0x60, 0xE0, 0x90, 0x9E, 0xB5, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12,
-0x6A, 0x9A, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x04, 0x1A, 0x12, 0x7B, 0x44, 0x80, 0x15, 0x90, 0x9E,
-0xB5, 0xE0, 0xB4, 0x0C, 0x0E, 0x90, 0x9D, 0xB8, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0,
-0x02, 0xF1, 0xEC, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x68, 0x98, 0xEF, 0x64, 0x01, 0x60, 0x08,
-0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x38, 0x90, 0x9D, 0xB7, 0xE0, 0xFF, 0x13, 0x13, 0x13,
-0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x23, 0xEF, 0xC4, 0x54,
-0x0F, 0x30, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x14, 0x90, 0x9D, 0xBB, 0xE0,
-0xD3, 0x94, 0x04, 0x40, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x03, 0x7F, 0x01, 0x22,
-0x90, 0x01, 0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x74, 0x15, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE,
-0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x9D,
-0xB8, 0xE0, 0x90, 0x06, 0x04, 0x20, 0xE0, 0x0C, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x9D, 0xBC, 0x74,
-0x04, 0xF0, 0x80, 0x0A, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x90, 0x05,
-0x22, 0xE4, 0xF0, 0x22, 0x12, 0x1F, 0x96, 0x90, 0x9D, 0xC3, 0xF0, 0x22, 0x12, 0x69, 0xE3, 0x90,
-0x9D, 0xBC, 0x74, 0x08, 0xF0, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x47, 0x4E, 0x90,
-0x9D, 0xEC, 0xEF, 0xF0, 0x60, 0xF0, 0x11, 0x0A, 0x80, 0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
-0xD0, 0x90, 0x9D, 0x31, 0xE0, 0xFF, 0x90, 0x9D, 0x30, 0xE0, 0xFE, 0xB5, 0x07, 0x04, 0x7F, 0x01,
-0x80, 0x02, 0x7F, 0x00, 0xEF, 0x64, 0x01, 0x60, 0x45, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x3F, 0xEE,
-0x75, 0xF0, 0x0F, 0xA4, 0xFF, 0xAE, 0xF0, 0x24, 0x9A, 0xF9, 0x74, 0x9C, 0x3E, 0xFA, 0x7B, 0x01,
-0xC0, 0x02, 0xC0, 0x01, 0x74, 0x9C, 0x2F, 0xF9, 0x74, 0x9C, 0x3E, 0xFA, 0x90, 0x9D, 0xF0, 0x12,
-0x49, 0x39, 0xD0, 0x01, 0xD0, 0x02, 0x11, 0x73, 0x90, 0x9D, 0x30, 0xE0, 0x04, 0xF0, 0xE0, 0x7F,
-0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x9D, 0x30, 0xF0, 0xD0, 0xD0,
-0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9D, 0xED, 0x12, 0x49, 0x39,
-0x90, 0x9E, 0xA9, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xEE, 0x7F, 0xAF,
-0x7E, 0x01, 0x11, 0xE5, 0xEF, 0x60, 0x49, 0x90, 0x9D, 0xED, 0x12, 0x49, 0x30, 0x8B, 0x40, 0x8A,
-0x41, 0x89, 0x42, 0x75, 0x43, 0x02, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0x33, 0x90,
-0x9D, 0xF0, 0x12, 0x49, 0x30, 0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, 0x90, 0x9D, 0xED, 0x12, 0x49,
-0x30, 0x12, 0x1F, 0x96, 0xFF, 0xC4, 0x54, 0x0F, 0xF5, 0x43, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA2,
-0x12, 0x2B, 0x33, 0x90, 0x01, 0xAF, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB, 0xE0, 0x64, 0x80, 0xF0,
-0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9D, 0xF3, 0xEE,
-0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x9D, 0xF3, 0xE0, 0xFE, 0xA3, 0xE0,
-0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D, 0xC3, 0x90, 0x9D, 0xF6, 0xE0, 0x94, 0xE8, 0x90, 0x9D,
-0xF5, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80,
-0x15, 0x90, 0x9D, 0xF5, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x48, 0x9F, 0x7F, 0x0A, 0x7E, 0x00, 0x12,
-0x32, 0x58, 0x80, 0xC5, 0x7F, 0x01, 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, 0x90, 0x01, 0xC4, 0x74, 0x3B, 0xF0, 0x74, 0x59,
-0xA3, 0xF0, 0x53, 0x91, 0xEF, 0x31, 0x8D, 0x74, 0x3B, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x59,
-0xA3, 0xF0, 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, 0x00, 0x54,
-0xE0, 0x55, 0x0D, 0xF5, 0x11, 0xA3, 0xE0, 0x55, 0x0E, 0xF5, 0x12, 0xA3, 0xE0, 0x55, 0x0F, 0xF5,
-0x13, 0xA3, 0xE0, 0x55, 0x10, 0xF5, 0x14, 0xAD, 0x11, 0x7F, 0x54, 0x12, 0x31, 0xE4, 0xAD, 0x12,
-0x7F, 0x55, 0x12, 0x31, 0xE4, 0xAD, 0x13, 0x7F, 0x56, 0x12, 0x31, 0xE4, 0xAD, 0x14, 0x7F, 0x57,
-0x02, 0x31, 0xE4, 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,
-0x90, 0x01, 0xC4, 0x74, 0xC3, 0xF0, 0x74, 0x59, 0xA3, 0xF0, 0x12, 0x68, 0x13, 0xE5, 0x19, 0x30,
-0xE0, 0x03, 0x12, 0x68, 0x40, 0xE5, 0x19, 0x30, 0xE1, 0x02, 0x51, 0x7B, 0xE5, 0x19, 0x30, 0xE4,
-0x05, 0x7F, 0x02, 0x12, 0x47, 0x27, 0xE5, 0x1B, 0x30, 0xE0, 0x02, 0x51, 0xBE, 0xE5, 0x1B, 0x30,
-0xE1, 0x02, 0xB1, 0xDE, 0xE5, 0x1B, 0x30, 0xE2, 0x02, 0xD1, 0x5F, 0xE5, 0x1B, 0x30, 0xE3, 0x03,
-0x12, 0x69, 0x1D, 0xE5, 0x1B, 0x30, 0xE4, 0x03, 0x12, 0x69, 0x50, 0xE5, 0x1B, 0x30, 0xE5, 0x02,
-0xF1, 0x3A, 0xE5, 0x1B, 0x30, 0xE6, 0x02, 0xF1, 0x1F, 0xE5, 0x1C, 0x30, 0xE1, 0x02, 0x91, 0x32,
-0xE5, 0x1C, 0x30, 0xE4, 0x02, 0x91, 0x3B, 0xE5, 0x1C, 0x30, 0xE5, 0x02, 0x71, 0x82, 0xE5, 0x1C,
-0x30, 0xE6, 0x02, 0x71, 0x4B, 0x74, 0xC3, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x59, 0xA3, 0xF0,
-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, 0x04, 0x7E, 0xE0, 0xFF,
-0xA3, 0xE0, 0x04, 0xFE, 0xEE, 0xD3, 0x9F, 0x50, 0x2F, 0xE4, 0xFD, 0xEE, 0x75, 0xF0, 0x08, 0xA4,
-0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE5, 0x82, 0x2D, 0xF5, 0x82, 0xE4, 0x35,
-0x83, 0xF5, 0x83, 0xE0, 0xFC, 0x74, 0x72, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xAF, 0xF5, 0x83, 0xEC,
-0xF0, 0x0D, 0xBD, 0x08, 0xD6, 0x0E, 0x80, 0xCC, 0x90, 0x04, 0x7F, 0xEF, 0xF0, 0x22, 0xE4, 0xFF,
-0x90, 0x9D, 0xBA, 0xE0, 0x70, 0x02, 0x61, 0x4A, 0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x7A,
-0x90, 0x9D, 0xB9, 0xE0, 0xC4, 0x54, 0x0F, 0x60, 0x24, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x1F,
-0x90, 0x9D, 0xC0, 0xE0, 0x14, 0xF0, 0xE0, 0xFE, 0x60, 0x06, 0x90, 0x9D, 0xC2, 0xE0, 0x60, 0x0F,
-0xEE, 0x70, 0x06, 0x90, 0x9D, 0xBF, 0xE0, 0xA3, 0xF0, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x01, 0xEF,
-0x60, 0x48, 0x90, 0x9D, 0xBD, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x9D, 0xC2, 0xE0, 0x60, 0x03, 0xB4,
-0x01, 0x09, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC2, 0xE0, 0x80, 0x0D, 0xE4, 0xF5, 0x3B, 0x90, 0x9D,
-0xC2, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x9D, 0xC1, 0xE0, 0x2F, 0xF5, 0x3C,
-0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0,
-0x90, 0x9D, 0xBC, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x55, 0xF1, 0x22, 0x90, 0x07, 0x1F, 0xE0, 0x54,
-0x7F, 0xF0, 0x90, 0x07, 0x1C, 0xE0, 0x54, 0x01, 0x90, 0x9D, 0xF9, 0xF0, 0x90, 0x9D, 0xF7, 0xE0,
-0x54, 0xF0, 0x44, 0x02, 0xF0, 0x54, 0x0F, 0x44, 0x10, 0xF0, 0x7B, 0x01, 0x7A, 0x9D, 0x79, 0xF9,
-0x90, 0x9D, 0xFD, 0x12, 0x49, 0x39, 0x7A, 0x9D, 0x79, 0xF7, 0x12, 0x67, 0x46, 0x7F, 0x03, 0x02,
-0x47, 0x27, 0x90, 0x9E, 0x90, 0xE0, 0x04, 0xF0, 0xE4, 0xF5, 0x52, 0x90, 0x9D, 0x36, 0xE0, 0x70,
-0x02, 0x81, 0x26, 0xE5, 0x52, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0xE5, 0x52, 0x54, 0x07, 0xFE,
-0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xFD, 0xAF, 0x06, 0x74, 0x01,
-0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF,
-0x5D, 0x60, 0x63, 0x75, 0xF0, 0x10, 0xE5, 0x52, 0x90, 0x81, 0x01, 0x12, 0x49, 0x24, 0xE0, 0x20,
-0xE7, 0x02, 0x80, 0x10, 0x75, 0xF0, 0x10, 0xE5, 0x52, 0x90, 0x81, 0x02, 0x12, 0x49, 0x24, 0xE0,
-0xFF, 0x20, 0xE7, 0x09, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x20, 0xF0, 0x80, 0x39, 0xEF, 0x30, 0xE6,
-0x2A, 0x90, 0x9E, 0x8D, 0xE0, 0x04, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x52, 0x90, 0x81, 0x00, 0x12,
-0x49, 0x24, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xE5, 0x52, 0x90, 0x94, 0x96, 0x12, 0x49, 0x24, 0xE0,
-0xF5, 0x6A, 0xE4, 0xFB, 0xAF, 0x52, 0x12, 0x6B, 0xD1, 0x80, 0x0B, 0x90, 0x9E, 0x8E, 0xE0, 0x04,
-0xF0, 0xAF, 0x52, 0x12, 0x6F, 0x28, 0x05, 0x52, 0xE5, 0x52, 0xC3, 0x94, 0x80, 0x50, 0x02, 0x61,
-0x8B, 0x22, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x02, 0xF1, 0x92, 0x22, 0x90, 0x9E, 0x8F, 0xE0, 0x04,
-0xF0, 0xE4, 0xFF, 0x8F, 0x52, 0xE4, 0xFC, 0x74, 0xF7, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5,
-0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x03, 0x12, 0x49, 0x24, 0xE0, 0xFF, 0x30,
-0xE7, 0x0F, 0xEC, 0x70, 0x1D, 0xEF, 0x30, 0xE6, 0x19, 0x90, 0x9E, 0x8C, 0xE0, 0x04, 0xF0, 0x80,
-0x11, 0xAF, 0x04, 0xF1, 0xCE, 0x74, 0xF7, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0x74,
-0x01, 0xF0, 0x0C, 0xBC, 0x80, 0xC1, 0x7F, 0x0C, 0x7E, 0x00, 0x12, 0x32, 0x58, 0xE4, 0xFC, 0x74,
-0xF7, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0x70, 0x02, 0xA1, 0xD5, 0x75, 0xF0,
-0x10, 0xEC, 0x90, 0x81, 0x06, 0x12, 0x49, 0x24, 0xE0, 0xFD, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81,
-0x07, 0x12, 0x49, 0x24, 0xE0, 0xFE, 0xED, 0xFB, 0xEB, 0xFF, 0xEC, 0x25, 0xE0, 0x24, 0x01, 0xF5,
-0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90,
-0x81, 0x0A, 0x12, 0x49, 0x24, 0xE0, 0xFD, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0B, 0x12, 0x49,
-0x24, 0xE0, 0xFB, 0xFE, 0xED, 0xF5, 0x82, 0xE5, 0x82, 0xFF, 0x75, 0xF0, 0x0A, 0xEC, 0x90, 0x8D,
-0x01, 0x12, 0x49, 0x24, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0C,
-0x12, 0x49, 0x24, 0xE0, 0xFF, 0x75, 0xF0, 0x0A, 0xEC, 0x90, 0x8D, 0x03, 0x12, 0x49, 0x24, 0xE4,
-0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0D, 0x12, 0x49, 0x24, 0xE0, 0xFF,
-0x75, 0xF0, 0x0A, 0xEC, 0x90, 0x8D, 0x05, 0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x75,
-0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0E, 0x12, 0x49, 0x24, 0xE0, 0xFF, 0x75, 0xF0, 0x0A, 0xEC, 0x90,
-0x8D, 0x07, 0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81,
-0x0F, 0x12, 0x49, 0x24, 0xE0, 0xFF, 0x75, 0xF0, 0x0A, 0xEC, 0x90, 0x8D, 0x09, 0x12, 0x49, 0x24,
-0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x09, 0x12, 0x49, 0x24, 0xE0,
-0xFF, 0x74, 0x93, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x99, 0xF5, 0x83, 0xEF, 0xF0, 0xEC, 0x70, 0x4E,
-0xEB, 0x30, 0xE7, 0x05, 0x90, 0x9E, 0x8B, 0x80, 0x42, 0xEB, 0x30, 0xE6, 0x05, 0x90, 0x9E, 0x8A,
-0x80, 0x39, 0xEB, 0x30, 0xE5, 0x05, 0x90, 0x9E, 0x89, 0x80, 0x30, 0xEB, 0x30, 0xE4, 0x05, 0x90,
-0x9E, 0x88, 0x80, 0x27, 0xEB, 0x30, 0xE3, 0x05, 0x90, 0x9E, 0x87, 0x80, 0x1E, 0xEB, 0x30, 0xE2,
-0x05, 0x90, 0x9E, 0x86, 0x80, 0x15, 0xEB, 0x30, 0xE1, 0x05, 0x90, 0x9E, 0x85, 0x80, 0x0C, 0xEB,
-0x30, 0xE0, 0x05, 0x90, 0x9E, 0x84, 0x80, 0x03, 0x90, 0x9E, 0x83, 0xE0, 0x04, 0xF0, 0xAF, 0x04,
-0xAD, 0x52, 0x12, 0x76, 0x33, 0x0C, 0xEC, 0x64, 0x80, 0x60, 0x02, 0x81, 0x8F, 0x22, 0x90, 0x9D,
-0xBA, 0xE0, 0x60, 0x45, 0x90, 0x9D, 0xB8, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0,
-0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, 0xD1, 0x3D, 0x90, 0x9D, 0xBF, 0xE0, 0x14, 0x90,
-0x05, 0x73, 0xF0, 0x90, 0x9E, 0xAC, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x48, 0x9F, 0xC3, 0x90, 0x9E,
-0xAD, 0xE0, 0x94, 0x80, 0x90, 0x9E, 0xAC, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01,
-0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0x12, 0x63, 0x03, 0x12, 0x60, 0x85, 0xE4,
-0xFF, 0x91, 0x43, 0x12, 0x73, 0x7B, 0x90, 0x9E, 0x91, 0xE0, 0x04, 0xF0, 0x22, 0x7D, 0x02, 0x7F,
-0x02, 0xD1, 0x47, 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,
-0x9D, 0xBC, 0xE0, 0x64, 0x06, 0x60, 0x22, 0xD1, 0x8A, 0x90, 0x9D, 0xB8, 0xE0, 0x13, 0x13, 0x13,
-0x54, 0x1F, 0x30, 0xE0, 0x14, 0x90, 0x9D, 0xBF, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0xF1,
-0x6E, 0xD1, 0x3D, 0x90, 0x9D, 0xC0, 0xE0, 0x14, 0xF0, 0x22, 0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01,
-0x60, 0x02, 0xE1, 0x1E, 0x90, 0x9D, 0xBA, 0xE0, 0x70, 0x02, 0xE1, 0x1E, 0x90, 0x9D, 0xB9, 0xE0,
-0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x22, 0x90, 0x06, 0xAB, 0xE0, 0x90, 0x9D, 0xC0, 0xF0, 0x90,
-0x06, 0xAA, 0xE0, 0x90, 0x9D, 0xBF, 0xF0, 0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x9D, 0xBF, 0xE0,
-0xFE, 0xFF, 0x80, 0x00, 0x90, 0x9D, 0xC0, 0xEF, 0xF0, 0x90, 0x9D, 0xB8, 0xE0, 0x44, 0x04, 0xF0,
-0xE4, 0x90, 0x9D, 0xC2, 0xF0, 0x90, 0x9D, 0xC4, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01,
-0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x9D, 0xBD, 0xE0, 0x54, 0xFD, 0xF0,
-0x54, 0xEF, 0xF0, 0x90, 0x9D, 0xB9, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80,
-0x03, 0x12, 0x65, 0x6A, 0x90, 0x9D, 0xB8, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0E,
-0x90, 0x9D, 0xBF, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x04, 0xF1, 0x6E, 0xD1, 0x43, 0x22, 0x90,
-0x9D, 0x36, 0xE0, 0xB4, 0x01, 0x13, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x0D, 0x90, 0x9D, 0xBD, 0xE0,
-0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, 0xF1, 0xC4, 0x22, 0x90, 0x9D, 0x36, 0xE0, 0xB4, 0x01,
-0x15, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x0F, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60,
-0x02, 0x80, 0x04, 0x12, 0x64, 0x77, 0x22, 0x12, 0x62, 0xD5, 0xBF, 0x01, 0x10, 0x90, 0x9C, 0x96,
-0xE0, 0xFF, 0xE4, 0xFD, 0x12, 0x62, 0x0A, 0x90, 0x04, 0x1F, 0x74, 0x20, 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, 0x90, 0x9D, 0xBA, 0xE0, 0x64, 0x01, 0x70, 0x29, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F,
-0x60, 0x15, 0x90, 0x9D, 0xBC, 0xE0, 0x70, 0x04, 0xFF, 0x12, 0x6A, 0x9A, 0x90, 0x9D, 0xBC, 0xE0,
-0x64, 0x0C, 0x60, 0x0F, 0x02, 0x7B, 0x09, 0x90, 0x9D, 0xBC, 0xE0, 0xC3, 0x94, 0x04, 0x50, 0x03,
-0x12, 0x55, 0xF1, 0x22, 0x90, 0x9D, 0xBB, 0xE0, 0xFF, 0x7D, 0x01, 0x02, 0x55, 0xF5, 0x75, 0xF0,
-0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x49, 0x24, 0xE0, 0x44, 0x40, 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, 0x90, 0x01, 0xC4, 0x74, 0xDD, 0xF0,
-0x74, 0x5F, 0xA3, 0xF0, 0x53, 0x91, 0xDF, 0x51, 0xA8, 0xE5, 0x21, 0x30, 0xE1, 0x02, 0x11, 0x6A,
-0xE5, 0x21, 0x30, 0xE2, 0x02, 0x71, 0x37, 0xE5, 0x21, 0x30, 0xE3, 0x02, 0x71, 0x73, 0xE5, 0x22,
-0x30, 0xE0, 0x02, 0x31, 0x93, 0xE5, 0x24, 0x30, 0xE1, 0x05, 0x7F, 0x03, 0x12, 0x47, 0x27, 0xE5,
-0x24, 0x30, 0xE4, 0x02, 0x11, 0x73, 0xE5, 0x24, 0x30, 0xE5, 0x02, 0x31, 0x16, 0xE5, 0x24, 0x30,
-0xE6, 0x02, 0x31, 0xCC, 0x74, 0xDD, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5F, 0xA3, 0xF0, 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, 0x9D, 0xBA, 0xE0, 0x60, 0x02,
-0xB1, 0x0C, 0x22, 0x71, 0xAF, 0x90, 0x9D, 0xBF, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02,
-0x7F, 0x02, 0x12, 0x57, 0xA9, 0x90, 0x9D, 0xCB, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x9D, 0x36, 0xE0,
-0xB4, 0x01, 0x26, 0x90, 0x9E, 0xBA, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x9D, 0xCD,
-0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x9E, 0xBA, 0xF0, 0x90, 0x9D, 0xCD, 0xE0, 0xFF, 0x90, 0x9D, 0xCC,
-0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0x11, 0xBA, 0x22, 0xE4, 0xFF, 0x8F, 0x6F, 0x51, 0xD5,
-0xBF, 0x01, 0x1A, 0x90, 0x9C, 0x97, 0xE0, 0xFF, 0x7D, 0x01, 0x51, 0x0A, 0xAD, 0x07, 0xAC, 0x06,
-0xAF, 0x6F, 0x91, 0xC1, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22,
-0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x2D, 0x90, 0x9D, 0xB8, 0xE0, 0x54, 0xFD, 0xF0, 0x90,
-0x05, 0x22, 0x74, 0x6F, 0xF0, 0x7F, 0x01, 0x11, 0xBC, 0xBF, 0x01, 0x0E, 0x90, 0x9D, 0xB7, 0xE0,
-0x44, 0x80, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x0E, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0,
-0x90, 0x01, 0xB8, 0x04, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03,
-0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x9D, 0xB8, 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, 0x5F, 0xC4, 0xE4, 0xFF, 0x90, 0x9D, 0xCE, 0xE0,
-0x30, 0xE0, 0x3F, 0x90, 0x9D, 0xD2, 0xE0, 0xFD, 0x60, 0x38, 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, 0x9D, 0xD2, 0xF0, 0x22, 0x90, 0x9D, 0xD0, 0xE0, 0xB5, 0x05,
-0x09, 0x90, 0x01, 0xC7, 0xE0, 0x44, 0x10, 0xF0, 0x41, 0x73, 0x11, 0xBA, 0x90, 0x9D, 0xD2, 0xE0,
-0x04, 0xF0, 0x22, 0x91, 0x30, 0x90, 0x9E, 0x77, 0xEF, 0xF0, 0xE0, 0xFC, 0x54, 0x01, 0xFE, 0x90,
-0x9D, 0xB7, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEC, 0x30, 0xE6, 0x20, 0x90, 0x01, 0x00, 0xE0, 0xB4,
-0xEA, 0x09, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0x58, 0x80, 0xF0, 0x90, 0x01, 0x2F, 0xE0, 0x30,
-0xE7, 0x03, 0xE4, 0xF0, 0x22, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0,
-0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04,
-0xE0, 0xE0, 0x90, 0x9D, 0xB8, 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, 0x9D, 0xBA,
-0xE0, 0x60, 0x03, 0x12, 0x5F, 0xC4, 0x7F, 0x01, 0x21, 0x4C, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
-0xD0, 0x90, 0x9E, 0xAF, 0xED, 0xF0, 0x90, 0x9E, 0xAE, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x51, 0x8A,
-0x7C, 0x00, 0xAD, 0x07, 0x90, 0x9E, 0xAE, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x9E, 0xAF, 0xE0,
-0x60, 0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0,
-0xAF, 0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09,
-0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x29, 0x2D, 0xF5,
-0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0,
-0x92, 0xAF, 0x22, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x9C, 0x94, 0xE0, 0x64, 0x02,
-0x60, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0x25, 0xE0, 0xFD,
-0xEF, 0xC3, 0x94, 0x80, 0x90, 0xFD, 0x12, 0x50, 0x04, 0xE4, 0xF0, 0x80, 0x03, 0x74, 0x01, 0xF0,
-0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06, 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, 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, 0x9D, 0xCE, 0xE0, 0x30, 0xE0, 0x2C, 0x90, 0x9D, 0xD1, 0xE0, 0x04, 0xF0,
-0xE0, 0xFF, 0x90, 0x9D, 0xCF, 0xE0, 0xB5, 0x07, 0x1D, 0x90, 0x06, 0x92, 0xE0, 0x54, 0x1C, 0x70,
-0x0A, 0x11, 0xBA, 0x90, 0x9D, 0xD2, 0xE0, 0x04, 0xF0, 0x80, 0x06, 0x90, 0x06, 0x92, 0x74, 0x1C,
-0xF0, 0xE4, 0x90, 0x9D, 0xD1, 0xF0, 0x22, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x35, 0x90, 0x06, 0x92,
-0xE0, 0x30, 0xE0, 0x24, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC8, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5,
-0x3C, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x5B, 0x74, 0x05,
-0xF0, 0x90, 0x06, 0x92, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xF7, 0xF0, 0x12,
-0x5F, 0xC4, 0x22, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x35, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, 0x24,
-0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC8, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x3C, 0xE4, 0xFB, 0xFD,
-0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92,
-0x74, 0x02, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xEF, 0xF0, 0x12, 0x5F, 0xC4, 0x22, 0x90,
-0x9D, 0xBA, 0xE0, 0x60, 0x39, 0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x31, 0x90, 0x9D, 0xC0,
-0xF0, 0x04, 0x60, 0x2A, 0x90, 0x9D, 0xBD, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x3B, 0x90, 0x9D,
-0xC1, 0xE0, 0xF5, 0x3C, 0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01,
-0x57, 0x74, 0x05, 0xF0, 0x90, 0x9D, 0xBC, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x55, 0xF1, 0x22, 0xEF,
-0x60, 0x3D, 0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x35, 0x90, 0x9D, 0xB8, 0xE0, 0x54, 0xFE,
-0xF0, 0x90, 0x05, 0x22, 0x74, 0x0F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF,
-0x11, 0xBC, 0xBF, 0x01, 0x0E, 0x90, 0x9D, 0xB7, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x9D, 0xBC, 0x74,
-0x06, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22,
-0xE4, 0x90, 0x9E, 0x78, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x9E, 0x78,
-0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x9E, 0x78, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3,
-0x90, 0x9E, 0x7A, 0xE0, 0x94, 0x64, 0x90, 0x9E, 0x79, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01,
-0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x9E, 0x78, 0xE0, 0xFF, 0x22, 0x90, 0x9E, 0x79, 0xE4, 0x75,
-0xF0, 0x01, 0x12, 0x48, 0x9F, 0x80, 0xC2, 0x90, 0x01, 0x5F, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74,
-0x08, 0xF0, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC8, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x3C, 0xE4,
-0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90,
-0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x9D, 0xBC, 0xE0,
-0xC3, 0x94, 0x0C, 0x50, 0x0B, 0xE4, 0xFD, 0x7F, 0x0C, 0x12, 0x55, 0xF5, 0xE4, 0xFF, 0x11, 0xBC,
-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, 0x90, 0x9D, 0xB7, 0xE0,
-0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x9D, 0xBD, 0xE0,
-0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x9D, 0xC2, 0xE0, 0x04, 0xF0, 0x90,
-0x9D, 0xBD, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x9D, 0xC2, 0xE0, 0xFF, 0xB4, 0x01, 0x02, 0x80, 0x04,
-0xEF, 0xB4, 0x02, 0x06, 0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90, 0x9D, 0xC6, 0xE0, 0xFF, 0x90,
-0x9D, 0xC2, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x9D, 0x36, 0xE0, 0xB4, 0x01, 0x0B, 0x90, 0x9D,
-0xB8, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x5F, 0xC4, 0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x9D,
-0xF7, 0xF0, 0xE0, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x9D, 0xBD, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD,
-0xF0, 0x02, 0x5F, 0xC4, 0x90, 0x9D, 0xF7, 0xE0, 0x30, 0xE6, 0x22, 0x90, 0x9D, 0xBA, 0xE0, 0x64,
-0x01, 0x70, 0x21, 0x90, 0x9D, 0xBD, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F,
-0x64, 0x02, 0x60, 0x05, 0x12, 0x5F, 0x57, 0x80, 0x0B, 0x91, 0x77, 0x80, 0x07, 0x90, 0x9D, 0xBD,
-0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x9D, 0xF7, 0xE0, 0x90, 0x9D, 0xBD, 0x30, 0xE7, 0x25, 0xE0, 0x44,
-0x02, 0xF0, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC7, 0xE0, 0xF5, 0x3C, 0xE4, 0xFB, 0xFD, 0x7F, 0x54,
-0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x44,
-0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0x96,
-0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x9C, 0x95, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0xFF,
-0xED, 0x2F, 0x90, 0x9C, 0x96, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFF, 0xED, 0x2F, 0x90,
-0x9C, 0x97, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xAF, 0xFF, 0xED, 0x2F, 0x90, 0x9C, 0x98, 0xF0,
-0x90, 0x00, 0x04, 0x12, 0x1F, 0xAF, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x9C, 0x99, 0xF0, 0x22,
-0x90, 0x9D, 0xE7, 0x12, 0x49, 0x39, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0xFF, 0xFE, 0x12, 0x1F,
-0x96, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x9D, 0xE7, 0x12, 0x49, 0x30, 0x90, 0x00, 0x02,
-0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xEB, 0xF0, 0x80, 0x05, 0x90, 0x9D, 0xEB, 0xEF, 0xF0, 0x90, 0x9D,
-0xEA, 0xEE, 0xF0, 0x90, 0x9D, 0xEB, 0xE0, 0xFE, 0x90, 0x9D, 0xEA, 0xE0, 0xFF, 0xD3, 0x9E, 0x50,
-0x38, 0x90, 0x9D, 0xE7, 0x12, 0x49, 0x30, 0x12, 0x1F, 0x96, 0x54, 0x01, 0xFE, 0x74, 0x36, 0x2F,
-0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x36, 0x2F, 0xF5, 0x82, 0xE4, 0x34,
-0x9D, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xD1, 0xB9, 0x80, 0x07, 0x90, 0x9D, 0xEA, 0xE0, 0xFF, 0xD1,
-0xAA, 0x90, 0x9D, 0xEA, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x22, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81,
-0x05, 0x12, 0x49, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05,
-0x12, 0x49, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12,
-0x1F, 0x96, 0xFF, 0x90, 0x9D, 0xB6, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF,
-0x64, 0x01, 0x60, 0x17, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x80, 0x0F, 0x90, 0x00, 0x01, 0x12,
-0x1F, 0xAF, 0x64, 0x01, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22,
-0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFF, 0x30, 0xE0, 0x26, 0x12, 0x1F, 0x96, 0x90, 0x9D, 0xC6,
-0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xC7, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3,
-0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xC9, 0xF0, 0x22,
-0x90, 0x9D, 0xC6, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28,
-0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9D, 0xFA,
-0x12, 0x49, 0x39, 0x90, 0x9D, 0x30, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A,
-0xEF, 0x14, 0xFF, 0x90, 0x9D, 0x31, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00,
-0xEF, 0x60, 0x09, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x73, 0x90, 0x9D, 0x31, 0xE0,
-0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x9A, 0xF9, 0x74, 0x9C, 0x35, 0xF0, 0xA8, 0x01, 0xFC, 0x7D, 0x01,
-0x90, 0x9D, 0xFA, 0x12, 0x49, 0x30, 0x7E, 0x00, 0x7F, 0x02, 0x12, 0x48, 0x79, 0x90, 0x9D, 0x31,
-0xE0, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x9C, 0xF9, 0x74, 0x9C, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0xC0,
-0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x9D, 0xFD, 0x12, 0x49, 0x30, 0x8B, 0x40, 0x8A, 0x41, 0x89,
-0x42, 0x90, 0x9D, 0xFA, 0x12, 0x49, 0x30, 0x12, 0x1F, 0x96, 0xFF, 0xC4, 0x54, 0x0F, 0xF5, 0x43,
-0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0x33, 0x90, 0x9D, 0x31, 0xE0, 0x04, 0xF0, 0xE0,
-0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x9D, 0x31, 0xF0, 0xD0,
-0xD0, 0x92, 0xAF, 0x22, 0x7F, 0x02, 0x90, 0x9D, 0xCA, 0xE0, 0xFE, 0xEF, 0xC3, 0x9E, 0x50, 0x10,
-0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x03, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xE6,
-0x7F, 0x01, 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, 0x22,
-0x90, 0x9D, 0xB9, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x49, 0xEF, 0x54,
-0x0F, 0x60, 0x3C, 0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0x11, 0x98,
-0xEF, 0x64, 0x01, 0x70, 0x32, 0xF5, 0x3B, 0x90, 0x9D, 0xC8, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5,
-0x3C, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x5B, 0x74, 0x05,
-0xF0, 0x90, 0x06, 0x92, 0x74, 0x01, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x11,
-0x98, 0xBF, 0x01, 0x03, 0x12, 0x5F, 0xC4, 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, 0x11, 0x98, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x54,
-0x90, 0x9D, 0xBD, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80,
-0x43, 0x90, 0x9D, 0xBB, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04,
-0xF0, 0x80, 0x31, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x25, 0x90,
-0x9D, 0xBD, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, 0x16, 0x90, 0x9D,
-0xB8, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x20, 0xF0, 0x80,
-0x03, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x9D, 0x36,
-0xE0, 0x64, 0x01, 0x70, 0x2A, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x24, 0x90, 0x01, 0x57, 0xE4, 0xF0,
-0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC7, 0xE0, 0xF5, 0x3C, 0xE4,
-0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x22,
-0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x26, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x20, 0x90, 0x01,
-0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFB, 0xF0,
-0x90, 0x9D, 0xBD, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, 0x5F, 0xC4, 0x22, 0xE4,
-0x90, 0x9E, 0xB0, 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, 0x9E, 0xB1, 0xE0,
-0x94, 0xE8, 0x90, 0x9E, 0xB0, 0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20,
-0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x32, 0x58, 0x90, 0x9E, 0xB0, 0xE4, 0x75,
-0xF0, 0x01, 0x12, 0x48, 0x9F, 0x80, 0xBF, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x31, 0x7F, 0x90,
-0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x12, 0x57, 0xA9, 0x31, 0xE3, 0xE4, 0x90, 0x9D,
-0xBC, 0xF0, 0x22, 0x31, 0x7F, 0x90, 0x00, 0x02, 0xE0, 0x54, 0xFE, 0xFD, 0x7F, 0x02, 0x12, 0x31,
-0xE4, 0x90, 0x00, 0x02, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x02, 0x12, 0x31, 0xE4, 0x90, 0x00, 0x02,
-0xE0, 0x54, 0xFE, 0xF0, 0x7F, 0xB4, 0x7E, 0x08, 0x12, 0x2C, 0xFF, 0xEF, 0x44, 0x40, 0xFF, 0xEC,
-0x90, 0x9E, 0xA4, 0x12, 0x20, 0xC0, 0x90, 0x9E, 0xA4, 0x12, 0x49, 0x18, 0x90, 0xAD, 0xBC, 0x12,
-0x20, 0xC0, 0x7F, 0xB4, 0x7E, 0x08, 0x12, 0x2E, 0x45, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3,
-0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x00, 0x10, 0xE0,
-0x44, 0x0C, 0xFD, 0x7F, 0x10, 0x12, 0x31, 0xE4, 0x90, 0x00, 0x72, 0xE0, 0x54, 0xF3, 0xFD, 0x7F,
-0x72, 0x12, 0x31, 0xE4, 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, 0xB4, 0x7E,
-0x08, 0x12, 0x2C, 0xFF, 0xEF, 0x54, 0xBF, 0xFF, 0xEC, 0x90, 0x9E, 0xA0, 0x12, 0x20, 0xC0, 0x90,
-0x9E, 0xA0, 0x12, 0x49, 0x18, 0x90, 0xAD, 0xBC, 0x12, 0x20, 0xC0, 0x7F, 0xB4, 0x7E, 0x08, 0x12,
-0x2E, 0x45, 0x90, 0x00, 0x02, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x9E, 0xBB, 0xEF, 0xF0, 0x51,
-0x3C, 0x90, 0x9E, 0xBB, 0xE0, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x9D, 0xBC, 0x74,
-0x04, 0xF0, 0x22, 0x51, 0x3C, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x22, 0x8F, 0x25, 0xE4, 0x90,
-0x9E, 0xB2, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01,
-0xEF, 0x65, 0x25, 0x60, 0x3E, 0xC3, 0x90, 0x9E, 0xB3, 0xE0, 0x94, 0x88, 0x90, 0x9E, 0xB2, 0xE0,
-0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x9E, 0xB2, 0xE4,
-0x75, 0xF0, 0x01, 0x12, 0x48, 0x9F, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0x58, 0xD3, 0x90, 0x9E,
-0xB3, 0xE0, 0x94, 0x32, 0x90, 0x9E, 0xB2, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0,
-0x30, 0xE0, 0xB2, 0x22, 0x71, 0x7C, 0x90, 0x00, 0x08, 0xE0, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12,
-0x31, 0xE4, 0xE4, 0xFF, 0x80, 0x96, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x71, 0x4F, 0x71,
-0x14, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9D, 0xBC,
-0xE0, 0x70, 0x07, 0x71, 0x84, 0xBF, 0x01, 0x02, 0x71, 0x26, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90,
-0x9D, 0xC3, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x31, 0xE4, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD,
-0x7F, 0x08, 0x12, 0x31, 0xE4, 0x7F, 0x01, 0x51, 0xBC, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD,
-0x7F, 0x90, 0x12, 0x31, 0xE4, 0x7F, 0x14, 0x7E, 0x00, 0x02, 0x32, 0x58, 0x90, 0x00, 0x90, 0xE0,
-0x20, 0xE0, 0xF9, 0x22, 0x90, 0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0,
-0x80, 0x12, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80,
-0x03, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0xF5, 0x6D, 0x74,
-0x94, 0x25, 0x6B, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE5, 0x6D, 0xF0, 0x75, 0xF0, 0x09,
-0xE5, 0x6B, 0x90, 0x94, 0x96, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x6A, 0xE4, 0xFB, 0xAD, 0x6D, 0xAF,
-0x6B, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xEF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xF9, 0xEF,
-0x54, 0x07, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x01, 0x12, 0x49, 0x24, 0xE0, 0xFC, 0xEB,
-0x70, 0x1F, 0x74, 0x81, 0x29, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xFB, 0x74, 0x01,
-0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5B, 0xF0, 0x53, 0x04, 0x7F, 0x80,
-0x36, 0x74, 0x81, 0x29, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xFC, 0x74, 0x01, 0xA8,
-0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4C, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81,
-0x01, 0x12, 0x49, 0x24, 0xE0, 0x54, 0x07, 0xFC, 0xED, 0x90, 0x43, 0x71, 0x93, 0x33, 0x33, 0x33,
-0x54, 0xF8, 0x42, 0x04, 0x43, 0x04, 0x80, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x00, 0x12, 0x49,
-0x24, 0xED, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x01, 0x12, 0x49, 0x24, 0xEC, 0xF0, 0x75,
-0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x49, 0x24, 0xE0, 0x54, 0xFC, 0x45, 0x6A, 0xFE, 0x75,
-0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x49, 0x24, 0xEE, 0xF0, 0x7D, 0x01, 0x12, 0x76, 0x33,
-0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x6B, 0x90, 0x9E,
-0x92, 0xE0, 0x04, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x95, 0x12, 0x49, 0x24, 0xE0, 0x90,
-0x9E, 0x9D, 0xF0, 0x12, 0x49, 0x42, 0x6C, 0xD7, 0x00, 0x6C, 0xD7, 0x01, 0x6C, 0xD7, 0x02, 0x6C,
-0xD7, 0x03, 0x6C, 0xD7, 0x04, 0x6C, 0xD7, 0x05, 0x6C, 0xD7, 0x06, 0x6C, 0xD7, 0x07, 0x6C, 0xD7,
-0x08, 0x6D, 0x39, 0x09, 0x6D, 0x3F, 0x0A, 0x6D, 0x45, 0x0B, 0x6D, 0x4B, 0x0C, 0x6D, 0x51, 0x0D,
-0x6D, 0x57, 0x0E, 0x00, 0x00, 0x6D, 0x5F, 0xE4, 0xF5, 0x6C, 0x75, 0xF0, 0x08, 0xE5, 0x6B, 0x90,
-0x89, 0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x25, 0x6C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83,
-0xE0, 0xFF, 0x90, 0x9E, 0x9D, 0xE0, 0x75, 0xF0, 0x07, 0xA4, 0x24, 0x50, 0xF5, 0x82, 0xE4, 0x34,
-0x40, 0xF5, 0x83, 0xE5, 0x82, 0x25, 0x6C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE4, 0x93,
-0xFE, 0xEF, 0x5E, 0xFF, 0x90, 0x9E, 0x9F, 0xF0, 0x75, 0xF0, 0x08, 0xE5, 0x6B, 0x90, 0x89, 0x00,
-0x12, 0x49, 0x24, 0xE5, 0x82, 0x25, 0x6C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEF, 0xF0,
-0x05, 0x6C, 0xE5, 0x6C, 0xB4, 0x07, 0xA3, 0x80, 0x26, 0xAD, 0x6B, 0x7F, 0x44, 0x80, 0x1C, 0xAD,
-0x6B, 0x7F, 0x4C, 0x80, 0x16, 0xAD, 0x6B, 0x7F, 0x8C, 0x80, 0x10, 0xAD, 0x6B, 0x7F, 0x94, 0x80,
-0x0A, 0xAD, 0x6B, 0x7F, 0x9C, 0x80, 0x04, 0xAD, 0x6B, 0x7F, 0xA4, 0x7E, 0x04, 0xF1, 0xB4, 0x75,
-0xF0, 0x09, 0xE5, 0x6B, 0x90, 0x94, 0x99, 0x12, 0x49, 0x24, 0xE0, 0xFD, 0xE4, 0x90, 0x9E, 0x9B,
-0xF0, 0x7C, 0x06, 0x75, 0xF0, 0x08, 0xE5, 0x6B, 0x90, 0x89, 0x00, 0xBC, 0x06, 0x12, 0x12, 0x49,
-0x24, 0xE5, 0x82, 0x2C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x80, 0x0E,
-0x12, 0x49, 0x24, 0xE5, 0x82, 0x2C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x90, 0x9E,
-0x9E, 0xF0, 0x90, 0x9E, 0x9E, 0xE0, 0x60, 0x64, 0x75, 0x6C, 0x07, 0x74, 0x01, 0x7E, 0x00, 0xA8,
-0x6C, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x9E, 0x9E, 0xE0,
-0xFB, 0xEF, 0x5B, 0x60, 0x3E, 0xEC, 0x75, 0xF0, 0x08, 0xA4, 0x25, 0x6C, 0x90, 0x9E, 0x9B, 0xF0,
-0xBD, 0x01, 0x0C, 0xE0, 0xD3, 0x94, 0x0B, 0x40, 0x06, 0xE0, 0x24, 0x20, 0xF0, 0x80, 0x39, 0xBD,
-0x02, 0x0F, 0x90, 0x9E, 0x9B, 0xE0, 0xD3, 0x94, 0x1B, 0x40, 0x06, 0xE0, 0x24, 0x18, 0xF0, 0x80,
-0x27, 0xBD, 0x03, 0x24, 0x90, 0x9E, 0x9B, 0xE0, 0xD3, 0x94, 0x1B, 0x40, 0x1B, 0xE0, 0x24, 0x22,
-0xF0, 0x80, 0x15, 0x15, 0x6C, 0xE5, 0x6C, 0xC3, 0x94, 0x00, 0x50, 0x9F, 0xEC, 0x60, 0x09, 0x1C,
-0xEC, 0xC3, 0x94, 0x00, 0x40, 0x02, 0xA1, 0x73, 0xE4, 0x90, 0x9E, 0x9C, 0xF0, 0xFC, 0x75, 0xF0,
-0x08, 0xE5, 0x6B, 0x90, 0x89, 0x00, 0xBC, 0x06, 0x12, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2C, 0xF5,
-0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x80, 0x0E, 0x12, 0x49, 0x24, 0xE5, 0x82,
-0x2C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x90, 0x9E, 0x9E, 0xF0, 0x90, 0x9E, 0x9E,
-0xE0, 0x60, 0x63, 0xE4, 0xF5, 0x6C, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x6C, 0x08, 0x80, 0x05, 0xC3,
-0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x9E, 0x9E, 0xE0, 0xFB, 0xEF, 0x5B, 0x60, 0x3E,
-0xEC, 0x75, 0xF0, 0x08, 0xA4, 0x25, 0x6C, 0x90, 0x9E, 0x9C, 0xF0, 0xBD, 0x01, 0x0C, 0xE0, 0xD3,
-0x94, 0x0B, 0x40, 0x06, 0xE0, 0x24, 0x20, 0xF0, 0x80, 0x34, 0xBD, 0x02, 0x0F, 0x90, 0x9E, 0x9C,
-0xE0, 0xD3, 0x94, 0x1B, 0x40, 0x06, 0xE0, 0x24, 0x18, 0xF0, 0x80, 0x22, 0xBD, 0x03, 0x1F, 0x90,
-0x9E, 0x9C, 0xE0, 0xD3, 0x94, 0x1B, 0x40, 0x16, 0xE0, 0x24, 0x22, 0xF0, 0x80, 0x10, 0x05, 0x6C,
-0xE5, 0x6C, 0x64, 0x08, 0x70, 0xA0, 0x0C, 0xEC, 0x64, 0x07, 0x60, 0x02, 0xC1, 0x1E, 0x90, 0x9E,
-0x9B, 0xE0, 0xFF, 0x75, 0xF0, 0x09, 0xE5, 0x6B, 0x90, 0x94, 0x93, 0x12, 0x49, 0x24, 0xEF, 0xF0,
-0x90, 0x9E, 0x9C, 0xE0, 0xFE, 0x75, 0xF0, 0x09, 0xE5, 0x6B, 0x90, 0x94, 0x94, 0x12, 0x49, 0x24,
-0xEE, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x6B, 0x90, 0x81, 0x00, 0x12, 0x49, 0x24, 0xE0, 0xFE, 0x54,
-0x7F, 0xF5, 0x6D, 0xEE, 0x54, 0x80, 0xF5, 0x6E, 0xE5, 0x6D, 0xD3, 0x9F, 0x40, 0x08, 0x90, 0x9E,
-0x9B, 0xE0, 0x45, 0x6E, 0x71, 0xAD, 0x90, 0x9E, 0x9C, 0xE0, 0xFF, 0xE5, 0x6D, 0xC3, 0x9F, 0x50,
-0x05, 0xE5, 0x6E, 0x4F, 0x71, 0xAD, 0x75, 0xF0, 0x10, 0xE5, 0x6B, 0x90, 0x81, 0x03, 0x12, 0x49,
-0x24, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8F, 0x53, 0x90, 0x01, 0xC4, 0x74, 0x28, 0xF0,
-0x74, 0x6F, 0xA3, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x53, 0x90, 0x81, 0x05, 0x12, 0x49, 0x24, 0xE0,
-0x54, 0x03, 0xFD, 0x75, 0xF0, 0x09, 0xE5, 0x53, 0x90, 0x94, 0x93, 0x12, 0x49, 0x24, 0xE0, 0xFF,
-0x74, 0x14, 0x25, 0x53, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0x54, 0x7F, 0xF5, 0x54,
-0xD3, 0x9F, 0x40, 0x02, 0x8F, 0x54, 0xE5, 0x54, 0x25, 0xE0, 0x24, 0xBD, 0xF5, 0x82, 0xE4, 0x34,
-0x42, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01, 0x93, 0xFF, 0xE5, 0x54, 0x25, 0xE0, 0x24, 0x15,
-0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0x74, 0x01, 0x93, 0x2F, 0xFF, 0xE4, 0x93, 0x3E, 0xC3,
-0x13, 0xFE, 0xEF, 0x13, 0xFF, 0xE5, 0x53, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93,
-0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x8D, 0x6A, 0xE4, 0xFB, 0xAD, 0x54, 0xAF, 0x53, 0x71,
-0xD1, 0xAF, 0x54, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8E, 0x5D, 0x8F, 0x5E, 0x7F,
-0x08, 0x78, 0x5F, 0xE4, 0xF6, 0x08, 0xDF, 0xFC, 0x75, 0xF0, 0x09, 0xED, 0x90, 0x94, 0x99, 0x12,
-0x49, 0x24, 0xE0, 0x90, 0x9E, 0xB6, 0xF0, 0x64, 0x01, 0x70, 0x43, 0x75, 0xF0, 0x08, 0xED, 0x90,
-0x89, 0x00, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x5F, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x01, 0x12,
-0x49, 0x24, 0xE0, 0xFE, 0x54, 0x0F, 0xF5, 0x60, 0xE4, 0xF5, 0x61, 0xF5, 0x62, 0xF5, 0x63, 0xEE,
-0x54, 0xF0, 0xF5, 0x64, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x02, 0x12, 0x49, 0x24, 0xE0, 0xF5,
-0x65, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x03, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x66, 0x90, 0x9E,
-0xB6, 0xE0, 0xFE, 0xC3, 0x94, 0x02, 0x40, 0x4A, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x00, 0x12,
-0x49, 0x24, 0xE0, 0xF5, 0x5F, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x01, 0x12, 0x49, 0x24, 0xE0,
-0xF5, 0x60, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x02, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x61, 0x75,
-0xF0, 0x08, 0xED, 0x90, 0x89, 0x03, 0x12, 0x49, 0x24, 0xE0, 0xFC, 0x54, 0x0F, 0xF5, 0x62, 0xEC,
-0x54, 0xF0, 0xF9, 0xEE, 0xB4, 0x03, 0x09, 0xE9, 0x25, 0xE0, 0x25, 0xE0, 0xF5, 0x66, 0x80, 0x02,
-0x89, 0x65, 0xE4, 0xFF, 0x74, 0x5F, 0x2F, 0xF8, 0xE6, 0xFE, 0xEF, 0x7A, 0x00, 0x25, 0x5E, 0xFB,
-0xEA, 0x35, 0x5D, 0x8B, 0x82, 0xF5, 0x83, 0xE0, 0x5E, 0xF6, 0x0F, 0xBF, 0x08, 0xE6, 0xE5, 0x64,
-0xC4, 0x54, 0x0F, 0x70, 0x08, 0xE5, 0x65, 0x70, 0x04, 0xE5, 0x66, 0x60, 0x24, 0x90, 0x9E, 0xB6,
-0xE0, 0xB4, 0x01, 0x1D, 0xE5, 0x60, 0x54, 0x0F, 0xF9, 0xE5, 0x64, 0x54, 0xF0, 0x42, 0x01, 0x89,
-0x60, 0x85, 0x65, 0x61, 0x85, 0x66, 0x62, 0xE4, 0xF5, 0x63, 0xF5, 0x64, 0xF5, 0x65, 0x75, 0x66,
-0x80, 0x90, 0x9E, 0xB6, 0xE0, 0xFE, 0xC3, 0x94, 0x02, 0x40, 0x15, 0xEE, 0xB4, 0x02, 0x06, 0xE5,
-0x65, 0x42, 0x62, 0x80, 0x08, 0xE5, 0x66, 0x13, 0x13, 0x54, 0x3F, 0x42, 0x62, 0x75, 0x66, 0x80,
-0xE4, 0xFF, 0x74, 0x5F, 0x2F, 0xF8, 0xE6, 0xFE, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x00, 0x12,
-0x49, 0x24, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xBF,
-0x08, 0xE0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8F, 0x5B, 0x90, 0x01, 0xC4, 0x74, 0x07, 0xF0, 0x74,
-0x71, 0xA3, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x5B, 0x90, 0x81, 0x00, 0x12, 0x49, 0x24, 0xE0, 0xF5,
-0x5C, 0x54, 0x7F, 0xFD, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x93, 0x12, 0x49, 0x24, 0xE0,
-0xFF, 0x90, 0x9D, 0xFF, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x99, 0x12, 0x49, 0x24,
-0xE0, 0x90, 0x9E, 0x00, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5,
-0x83, 0xE4, 0x93, 0xFA, 0x74, 0x01, 0x93, 0xFB, 0xE5, 0x5B, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82,
-0xE4, 0x34, 0x93, 0xF5, 0x83, 0xEA, 0xF0, 0xA3, 0xEB, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90,
-0x94, 0x96, 0x12, 0x49, 0x24, 0xE0, 0xF9, 0xED, 0xC3, 0x9F, 0x40, 0x02, 0x41, 0x9C, 0x74, 0x14,
-0x25, 0x5B, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xED, 0xF0, 0x90, 0x9E, 0x00, 0xE0, 0xFF,
-0xB4, 0x01, 0x0C, 0xED, 0xC3, 0x94, 0x2C, 0x40, 0x06, 0x74, 0xE0, 0x2D, 0xFD, 0x80, 0x1E, 0xEF,
-0xB4, 0x02, 0x0C, 0xED, 0xC3, 0x94, 0x2C, 0x40, 0x06, 0x74, 0xE8, 0x2D, 0xFD, 0x80, 0x0E, 0xEF,
-0xB4, 0x03, 0x0A, 0xED, 0xC3, 0x94, 0x2C, 0x40, 0x04, 0x74, 0xDE, 0x2D, 0xFD, 0xEF, 0xB4, 0x01,
-0x0F, 0x90, 0x9D, 0xFF, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x06, 0xE0, 0x24, 0xE0, 0xF0, 0x80, 0x2A,
-0x90, 0x9E, 0x00, 0xE0, 0xB4, 0x02, 0x0F, 0x90, 0x9D, 0xFF, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x06,
-0xE0, 0x24, 0xE8, 0xF0, 0x80, 0x14, 0x90, 0x9E, 0x00, 0xE0, 0xB4, 0x03, 0x0D, 0x90, 0x9D, 0xFF,
-0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x04, 0xE0, 0x24, 0xDE, 0xF0, 0xED, 0x04, 0xFC, 0x90, 0x9D, 0xFF,
-0xE0, 0xFF, 0xEC, 0xD3, 0x9F, 0x50, 0x46, 0xEC, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0,
-0x08, 0xE5, 0x5B, 0x90, 0x89, 0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35,
-0x83, 0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xEC, 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, 0x06, 0xAD, 0x04, 0x8D, 0x5C, 0x80, 0x03, 0x0C, 0x80, 0xB0, 0x90, 0x9E, 0x00,
-0xE0, 0xFF, 0xB4, 0x01, 0x19, 0xE5, 0x5C, 0xD3, 0x94, 0x0B, 0x40, 0x12, 0xE5, 0x5C, 0x94, 0x34,
-0x50, 0x0C, 0x74, 0x20, 0x25, 0x5C, 0xF5, 0x5C, 0x74, 0x20, 0x2D, 0xFD, 0x80, 0x61, 0xEF, 0xB4,
-0x02, 0x13, 0xE5, 0x5C, 0xD3, 0x94, 0x1B, 0x40, 0x0C, 0x74, 0x18, 0x25, 0x5C, 0xF5, 0x5C, 0x74,
-0x18, 0x2D, 0xFD, 0x80, 0x4A, 0xEF, 0xB4, 0x03, 0x11, 0xE5, 0x5C, 0xD3, 0x94, 0x1B, 0x40, 0x3F,
-0x74, 0x22, 0x25, 0x5C, 0xF5, 0x5C, 0x74, 0x22, 0x2D, 0xFD, 0x80, 0x33, 0x90, 0x9D, 0xFF, 0xE0,
-0xFC, 0x6D, 0x70, 0x6C, 0x74, 0x14, 0x25, 0x5B, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xED,
-0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x97, 0x12, 0x49, 0x24, 0xE0, 0xB4, 0x01, 0x0C,
-0xE5, 0x5C, 0x20, 0xE7, 0x07, 0xED, 0x44, 0x80, 0xF5, 0x5C, 0x80, 0x03, 0xAF, 0x5C, 0x22, 0xED,
-0x25, 0xE0, 0x24, 0xBD, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01,
-0x93, 0xFF, 0xED, 0x25, 0xE0, 0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0x74, 0x01,
-0x93, 0x2F, 0xFF, 0xE4, 0x93, 0x3E, 0xC3, 0x13, 0xFE, 0xEF, 0x13, 0xFF, 0xE5, 0x5B, 0x25, 0xE0,
-0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x80, 0x5D,
-0xED, 0xD3, 0x9C, 0x40, 0x58, 0x90, 0x9D, 0xFF, 0xE0, 0xFF, 0x74, 0x14, 0x25, 0x5B, 0xF5, 0x82,
-0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xEF, 0xF0, 0xAD, 0x07, 0x8F, 0x5C, 0xED, 0x25, 0xE0, 0x24, 0xBD,
-0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01, 0x93, 0xFF, 0xED, 0x25,
-0xE0, 0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0x74, 0x01, 0x93, 0x2F, 0xFF, 0xE4,
-0x93, 0x3E, 0xC3, 0x13, 0xFE, 0xEF, 0x13, 0xFF, 0xE5, 0x5B, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82,
-0xE4, 0x34, 0x93, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xAF, 0x5C, 0x22, 0x89, 0x6A, 0x7B,
-0x01, 0xAD, 0x5C, 0xAF, 0x5B, 0x12, 0x6B, 0xD1, 0xAF, 0x5C, 0x22, 0x90, 0x01, 0xC4, 0x74, 0x7B,
-0xF0, 0x74, 0x73, 0xA3, 0xF0, 0xE4, 0xF5, 0x52, 0x90, 0x9D, 0x36, 0xE0, 0x70, 0x02, 0xC1, 0x27,
-0x75, 0xF0, 0x09, 0xE5, 0x52, 0x90, 0x94, 0x98, 0x12, 0x49, 0x24, 0xE0, 0x64, 0x01, 0x60, 0x02,
-0xC1, 0x27, 0xE5, 0x52, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE0,
-0xFE, 0xA3, 0xE0, 0xD3, 0x94, 0x00, 0xEE, 0x94, 0x00, 0x50, 0x02, 0xC1, 0x27, 0xE5, 0x52, 0x75,
-0xF0, 0x0A, 0xA4, 0x24, 0x01, 0xF9, 0x74, 0x8D, 0x35, 0xF0, 0x75, 0x56, 0x01, 0xF5, 0x57, 0x89,
-0x58, 0xE5, 0x52, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE0, 0xFF,
-0xA3, 0xE0, 0x90, 0x9D, 0xF9, 0xCF, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x93, 0x25, 0x52, 0xF5, 0x82,
-0xE4, 0x34, 0x99, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x9D, 0xFB, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x75,
-0xF0, 0x10, 0xE5, 0x52, 0x90, 0x81, 0x00, 0x12, 0x49, 0x24, 0xE0, 0x54, 0x7F, 0x90, 0x9D, 0xF7,
-0xF0, 0x54, 0x7F, 0xA3, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x52, 0x90, 0x94, 0x93, 0x12, 0x49, 0x24,
-0xE0, 0x90, 0x9D, 0xFE, 0xF0, 0x74, 0x14, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83,
-0xE0, 0xC3, 0x94, 0x05, 0x40, 0x02, 0xC1, 0x21, 0x90, 0x9D, 0xFE, 0xE0, 0xFF, 0x90, 0x9D, 0xF8,
-0xE0, 0x9F, 0x40, 0x13, 0x90, 0x9D, 0xFE, 0xE0, 0x90, 0x9D, 0xF8, 0xF0, 0x90, 0x9D, 0xF7, 0xE0,
-0x54, 0x80, 0xFE, 0xF0, 0xEF, 0x4E, 0xF0, 0x90, 0x9D, 0xF8, 0xE0, 0xFF, 0x90, 0x41, 0xC1, 0x93,
-0xFE, 0x74, 0x13, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xE0, 0xC3, 0x9E, 0x40,
-0x06, 0xEF, 0x90, 0x41, 0x19, 0x80, 0x07, 0x90, 0x9D, 0xF8, 0xE0, 0x90, 0x41, 0x6D, 0x93, 0x90,
-0x9D, 0xFD, 0xF0, 0x90, 0x9D, 0xFD, 0xE0, 0x75, 0xF0, 0x06, 0xA4, 0x24, 0x8F, 0xF9, 0x74, 0x40,
-0x35, 0xF0, 0x75, 0x53, 0xFF, 0xF5, 0x54, 0x89, 0x55, 0x90, 0x9D, 0xF7, 0xE0, 0x90, 0x43, 0xC5,
-0x93, 0xFF, 0xD3, 0x90, 0x9D, 0xFC, 0xE0, 0x9F, 0x90, 0x9D, 0xFB, 0xE0, 0x94, 0x00, 0x40, 0x02,
-0xC1, 0x1B, 0xE5, 0x52, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0,
-0xF5, 0x59, 0xA3, 0xE0, 0xF5, 0x5A, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x12, 0x1F, 0x96, 0xFF,
-0x7E, 0x00, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x12, 0x48, 0xB5, 0xFD, 0xAC, 0xF0, 0x12, 0x20,
-0x10, 0xEF, 0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xAB, 0x53, 0xAA, 0x54, 0xA9,
-0x55, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0xFF, 0x7E, 0x00, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58,
-0x90, 0x00, 0x02, 0x12, 0x48, 0xE0, 0xFD, 0xAC, 0xF0, 0x12, 0x20, 0x10, 0xEF, 0x25, 0x5A, 0xF5,
-0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x90, 0x00, 0x02, 0x12,
-0x1F, 0xAF, 0xFF, 0x7E, 0x00, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x90, 0x00, 0x04, 0x12, 0x48,
-0xE0, 0xFD, 0xAC, 0xF0, 0x12, 0x20, 0x10, 0xEF, 0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5,
-0x59, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xAF, 0xFF, 0x7E, 0x00,
-0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x90, 0x00, 0x06, 0x12, 0x48, 0xE0, 0xFD, 0xAC, 0xF0, 0x12,
-0x20, 0x10, 0xEF, 0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xAB, 0x53, 0xAA, 0x54,
-0xA9, 0x55, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xAF, 0xFF, 0x7E, 0x00, 0xAB, 0x56, 0xAA, 0x57, 0xA9,
-0x58, 0x90, 0x00, 0x08, 0x12, 0x48, 0xE0, 0xFD, 0xAC, 0xF0, 0x12, 0x20, 0x10, 0xEF, 0x25, 0x5A,
-0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x90, 0x00, 0x05,
-0x12, 0x1F, 0xAF, 0xFF, 0x7E, 0x00, 0x90, 0x9D, 0xF9, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0x12, 0x20,
-0x10, 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, 0x52, 0x25, 0xE0, 0x24,
-0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE5, 0x59, 0xF0, 0xA3, 0xE5, 0x5A, 0xF0, 0x90,
-0x9D, 0xF7, 0xE0, 0x25, 0xE0, 0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0xC3, 0x74,
-0x01, 0x93, 0x95, 0x5A, 0xE4, 0x93, 0x95, 0x59, 0x50, 0x06, 0xAF, 0x52, 0x31, 0x07, 0x80, 0x21,
-0x90, 0x9D, 0xF7, 0xE0, 0x25, 0xE0, 0x24, 0xBD, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0xD3,
-0x74, 0x01, 0x93, 0x95, 0x5A, 0xE4, 0x93, 0x95, 0x59, 0x40, 0x06, 0x7D, 0x01, 0xAF, 0x52, 0xD1,
-0xC5, 0xE4, 0xFD, 0xAF, 0x52, 0xD1, 0x33, 0x05, 0x52, 0xE5, 0x52, 0xC3, 0x94, 0x80, 0x50, 0x02,
-0x61, 0x88, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xED, 0x60, 0x62, 0x75, 0xF0, 0x0A,
-0xEF, 0x90, 0x8D, 0x01, 0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90,
-0x8D, 0x03, 0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x05,
-0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x07, 0x12, 0x49,
-0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x09, 0x12, 0x49, 0x24, 0xE4,
-0xF0, 0xA3, 0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE4,
-0xF0, 0xA3, 0xF0, 0x74, 0x93, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x99, 0xF5, 0x83, 0xE4, 0xF0, 0x75,
-0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x49, 0x24, 0xE0, 0x54, 0xBF, 0x90, 0x9E, 0xB7, 0xF0,
-0x44, 0x80, 0xFE, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x49, 0x24, 0xEE, 0xF0,
-0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8F, 0x5B, 0x90, 0x01, 0xC4, 0x74, 0xC5, 0xF0, 0x74, 0x76, 0xA3,
-0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x5B, 0x90, 0x81, 0x00, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x5C, 0x54,
-0x7F, 0xFF, 0x90, 0x9E, 0x01, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x94, 0x12, 0x49,
-0x24, 0xE0, 0x90, 0x9E, 0x03, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x93, 0x12, 0x49,
-0x24, 0xE0, 0xFE, 0x90, 0x9E, 0x04, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x5B, 0x90, 0x81, 0x05, 0x12,
-0x49, 0x24, 0xE0, 0x54, 0x03, 0xFC, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x99, 0x12, 0x49,
-0x24, 0xE0, 0xFB, 0xEF, 0xD3, 0x9E, 0x40, 0x0A, 0x90, 0x9E, 0x04, 0xE0, 0x90, 0x9E, 0x01, 0xF0,
-0xF5, 0x5C, 0xED, 0x70, 0x03, 0x02, 0x78, 0xC8, 0x90, 0x9E, 0x02, 0xED, 0xF0, 0xE5, 0x5C, 0x30,
-0xE7, 0x0A, 0x90, 0x9E, 0x01, 0xE0, 0xF5, 0x5C, 0xA3, 0xE0, 0x14, 0xF0, 0x90, 0x9E, 0x02, 0xE0,
-0x70, 0x03, 0x02, 0x78, 0xC8, 0x90, 0x9E, 0x01, 0xE0, 0xFF, 0xB4, 0x2C, 0x08, 0xEC, 0x60, 0x05,
-0x1C, 0xA3, 0xE0, 0x14, 0xF0, 0x90, 0x9E, 0x02, 0xE0, 0x70, 0x03, 0x02, 0x78, 0xC8, 0x90, 0x9E,
-0x03, 0xE0, 0xFE, 0xEF, 0xD3, 0x9E, 0x50, 0x03, 0x02, 0x78, 0xC2, 0xE4, 0x90, 0x9E, 0x00, 0xF0,
-0xBB, 0x01, 0x0F, 0xA3, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x08, 0xE0, 0x24, 0xE0, 0xF0, 0x74, 0xE0,
-0x80, 0x26, 0xBB, 0x02, 0x11, 0x90, 0x9E, 0x01, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x08, 0xE0, 0x24,
-0xE8, 0xF0, 0x74, 0xE8, 0x80, 0x12, 0xBB, 0x03, 0x13, 0x90, 0x9E, 0x01, 0xE0, 0xC3, 0x94, 0x2C,
-0x40, 0x0A, 0xE0, 0x24, 0xDE, 0xF0, 0x74, 0xDE, 0x25, 0x5C, 0xF5, 0x5C, 0xBB, 0x01, 0x0F, 0xEE,
-0xC3, 0x94, 0x2C, 0x40, 0x09, 0x90, 0x9E, 0x03, 0xE0, 0x24, 0xE0, 0xF0, 0x80, 0x22, 0xBB, 0x02,
-0x0F, 0x90, 0x9E, 0x03, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x06, 0xE0, 0x24, 0xE8, 0xF0, 0x80, 0x10,
-0xBB, 0x03, 0x0D, 0x90, 0x9E, 0x03, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x04, 0xE0, 0x24, 0xDE, 0xF0,
-0x90, 0x9E, 0x01, 0xE0, 0x14, 0x90, 0x9D, 0xFF, 0xF0, 0x90, 0x9E, 0x03, 0xE0, 0xFF, 0x90, 0x9D,
-0xFF, 0xE0, 0xF9, 0xC3, 0x9F, 0x40, 0x6A, 0xE9, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0,
-0x08, 0xE5, 0x5B, 0x90, 0x89, 0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35,
-0x83, 0xF5, 0x83, 0xE0, 0xF5, 0x82, 0x75, 0x83, 0x00, 0xE9, 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, 0x29, 0x90, 0x9D, 0xFF, 0xE0, 0xF5, 0x5C, 0xA3, 0xE0,
-0x04, 0xF0, 0x90, 0x9E, 0x02, 0xE0, 0xFF, 0x90, 0x9E, 0x00, 0xE0, 0x6F, 0x60, 0x13, 0x90, 0x9E,
-0x03, 0xE0, 0xFF, 0xE5, 0x5C, 0xD3, 0x9F, 0x40, 0x08, 0x90, 0x9D, 0xFF, 0xE0, 0x14, 0xF0, 0x80,
-0x88, 0xBB, 0x01, 0x1C, 0xE5, 0x5C, 0xD3, 0x94, 0x0B, 0x40, 0x15, 0xE5, 0x5C, 0x94, 0x34, 0x50,
-0x0F, 0x74, 0x20, 0x25, 0x5C, 0xF5, 0x5C, 0x90, 0x9E, 0x01, 0xE0, 0x24, 0x20, 0xF0, 0x80, 0x38,
-0xBB, 0x02, 0x16, 0xE5, 0x5C, 0xD3, 0x94, 0x1B, 0x40, 0x0F, 0x74, 0x18, 0x25, 0x5C, 0xF5, 0x5C,
-0x90, 0x9E, 0x01, 0xE0, 0x24, 0x18, 0xF0, 0x80, 0x1F, 0xBB, 0x03, 0x1C, 0xE5, 0x5C, 0xD3, 0x94,
-0x1B, 0x40, 0x15, 0x74, 0x22, 0x25, 0x5C, 0xF5, 0x5C, 0x90, 0x9E, 0x01, 0xE0, 0x24, 0x22, 0xF0,
-0x80, 0x06, 0x90, 0x9E, 0x03, 0xE0, 0xF5, 0x5C, 0xE5, 0x5C, 0x25, 0xE0, 0x24, 0xBD, 0xF5, 0x82,
-0xE4, 0x34, 0x42, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01, 0x93, 0xFF, 0xE5, 0x5C, 0x25, 0xE0,
-0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0x74, 0x01, 0x93, 0x2F, 0xFF, 0xE4, 0x93,
-0x3E, 0xC3, 0x13, 0xFE, 0xEF, 0x13, 0xFF, 0xE5, 0x5B, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4,
-0x34, 0x93, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x8C, 0x6A, 0xE4, 0xFB, 0xAD, 0x5C, 0xAF,
-0x5B, 0x12, 0x6B, 0xD1, 0xAF, 0x5C, 0x22, 0x12, 0x1F, 0x96, 0x54, 0x3F, 0xFF, 0x90, 0x00, 0x01,
-0x12, 0x1F, 0xAF, 0xFE, 0x54, 0x1F, 0xFD, 0xEE, 0x54, 0x80, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01,
-0x90, 0x9D, 0xE7, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFE, 0x54, 0x03, 0x90, 0x9D, 0xE8,
-0xF0, 0xEE, 0x54, 0x30, 0xC4, 0x54, 0x0F, 0x90, 0x9D, 0xEA, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F,
-0xAF, 0xFE, 0x54, 0x40, 0xFC, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x90, 0x9D, 0xE9, 0xF0, 0xEE, 0x54,
-0x80, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFE, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x95, 0x12,
-0x49, 0x24, 0xED, 0xF0, 0x90, 0x9D, 0xE8, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x96,
-0x12, 0x49, 0x24, 0xED, 0xF0, 0x90, 0x9D, 0xE7, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94,
-0x97, 0x12, 0x49, 0x24, 0xED, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x98, 0x12, 0x49, 0x24,
-0x74, 0x01, 0xF0, 0x90, 0x9D, 0xEA, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x99, 0x12,
-0x49, 0x24, 0xED, 0xF0, 0x90, 0x9D, 0xE9, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x9A,
-0x12, 0x49, 0x24, 0xED, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x9B, 0x12, 0x49, 0x24, 0xEE,
-0xF0, 0xE4, 0xFE, 0xEE, 0xF5, 0x82, 0x75, 0x83, 0x00, 0xA3, 0xA3, 0xA3, 0x12, 0x1F, 0xAF, 0xFD,
-0x75, 0xF0, 0x08, 0xEF, 0x90, 0x89, 0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4,
-0x35, 0x83, 0xF5, 0x83, 0xED, 0xF0, 0x0E, 0xEE, 0xB4, 0x04, 0xD8, 0x02, 0x6C, 0x85, 0x12, 0x1F,
-0x96, 0xF5, 0x51, 0xC3, 0x94, 0x80, 0x50, 0x15, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFF, 0x74,
-0x13, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xEF, 0xF0, 0x22, 0xE5, 0x51, 0xB4,
-0x80, 0x0A, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0x90, 0x94, 0x91, 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, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE5, 0x30, 0x90, 0x00, 0x8E, 0xE0,
-0x64, 0x05, 0x70, 0x28, 0xA3, 0xE0, 0x90, 0x9D, 0xD6, 0xF0, 0x90, 0x00, 0x8E, 0xE0, 0xFF, 0x90,
-0x9D, 0xD6, 0xE0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x00,
-0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8E, 0x12, 0x31, 0xE4, 0x22, 0x12, 0x1F, 0x96,
-0xFF, 0x54, 0x01, 0xFE, 0x90, 0x9D, 0xCB, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30,
-0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xCC, 0xF0, 0x22, 0x12, 0x1F, 0x96,
-0xFF, 0x54, 0x01, 0xFE, 0x90, 0x9D, 0xCE, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30,
-0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xCF, 0xF0, 0x90, 0x00, 0x02, 0x12,
-0x1F, 0xAF, 0x90, 0x9D, 0xD0, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90,
-0x9D, 0xC2, 0xF0, 0x90, 0x9D, 0xBD, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0C, 0x04, 0x70, 0x28,
-0x90, 0x9D, 0xBF, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, 0x90, 0x9D, 0xC9, 0xE0,
-0x90, 0x9D, 0xBF, 0xF0, 0x80, 0x05, 0x90, 0x9D, 0xBF, 0xED, 0xF0, 0x90, 0x9D, 0xBF, 0xE0, 0xA3,
-0xF0, 0x90, 0x9D, 0xB8, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0,
-0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x9D, 0xB8, 0xE0,
-0xC3, 0x13, 0x20, 0xE0, 0x08, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x80, 0x11, 0x90, 0x06, 0x04,
-0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x04, 0xF0, 0x90, 0x05,
-0x22, 0xE4, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF,
-0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x06, 0xF0, 0x22, 0x47, 0xF8,
-};
-u4Byte ArrayLength_MP_8188E_FW_AP = 15226;
-
-
-void
-ODM_ReadFirmware_MP_8188E_FW_AP(
- IN PDM_ODM_T pDM_Odm,
- OUT u1Byte *pFirmware,
- OUT u4Byte *pFirmwareSize
-)
-{
- ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_AP, ArrayLength_MP_8188E_FW_AP);
- *pFirmwareSize = ArrayLength_MP_8188E_FW_AP;
-}
-
-
-#else
-
-
-u1Byte Array_MP_8188E_FW_NIC_S[] = {
-0xE2, 0x88, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x10, 0x14, 0xF6, 0x3D, 0x02, 0x00,
-0xCD, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x02, 0x4B, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x4C, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x4B, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x50, 0x15, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x48, 0x04, 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, 0x89, 0xF8, 0xE6, 0xBC, 0x03, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00,
-0x40, 0xCE, 0x79, 0x04, 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, 0x04, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30,
-0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x88, 0x25, 0x0C, 0xF8,
-0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8,
-0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5,
-0x0C, 0x24, 0x89, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD,
-0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x88,
-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, 0x88, 0xA6,
-0x81, 0x74, 0x03, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x04, 0xE4, 0x78, 0x80,
-0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x4B, 0xDE, 0x74, 0x01, 0x93,
-0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2,
-0x8C, 0xD2, 0xAF, 0x22, 0x03, 0xEF, 0xD3, 0x94, 0x03, 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, 0x88, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18,
-0xBE, 0x03, 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, 0x88, 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, 0x88, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F,
-0x04, 0x90, 0x4B, 0xDE, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3,
-0x94, 0x03, 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, 0x88, 0x2F,
-0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x48, 0x4D, 0x50, 0x2E, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xBF, 0x03,
-0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x88, 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, 0x89, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01,
-0x0F, 0x74, 0x88, 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, 0x03, 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, 0x48, 0x4C, 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, 0x48, 0x4D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF,
-0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0,
-0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 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, 0xE2, 0xFC, 0x08, 0xE2, 0xFD, 0x08, 0xE2, 0xFE, 0x08, 0xE2, 0xFF,
-0x22, 0xE2, 0xFB, 0x08, 0xE2, 0xF9, 0x08, 0xE2, 0xFA, 0x08, 0xE2, 0xCB, 0xF8, 0x22, 0xEC, 0xF2,
-0x08, 0xED, 0xF2, 0x08, 0xEE, 0xF2, 0x08, 0xEF, 0xF2, 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, 0x4B,
-0x8C, 0x02, 0x48, 0xDD, 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, 0x4B, 0xD1, 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, 0x00, 0x41, 0x82, 0x12, 0x00, 0x41, 0x82, 0x13, 0x00, 0x41, 0x82, 0x1F, 0x00, 0x58, 0xF0,
-0x5F, 0xDD, 0x69, 0x7E, 0x6A, 0xC2, 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, 0x90, 0x01, 0xC4, 0x74, 0xE6, 0xF0, 0x74, 0x4B, 0xA3, 0xF0, 0x91, 0x35, 0x74,
-0xE6, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x4B, 0xA3, 0xF0, 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, 0x00, 0x54, 0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55,
-0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5, 0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD,
-0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F,
-0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57, 0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 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, 0x90, 0x01, 0xC4, 0x74,
-0x6F, 0xF0, 0x74, 0x4C, 0xA3, 0xF0, 0x12, 0x72, 0x41, 0xE5, 0x41, 0x30, 0xE4, 0x04, 0x7F, 0x02,
-0x51, 0x27, 0xE5, 0x41, 0x30, 0xE6, 0x02, 0xF1, 0xEF, 0xE5, 0x43, 0x30, 0xE0, 0x03, 0x12, 0x72,
-0x9E, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x54, 0x43, 0xE5, 0x43, 0x30, 0xE2, 0x03, 0x12, 0x53,
-0xF7, 0xE5, 0x43, 0x30, 0xE3, 0x03, 0x12, 0x6F, 0xB0, 0xE5, 0x43, 0x30, 0xE4, 0x03, 0x12, 0x74,
-0xA9, 0xE5, 0x43, 0x30, 0xE5, 0x03, 0x12, 0x6F, 0x58, 0xE5, 0x43, 0x30, 0xE6, 0x02, 0xB1, 0x0E,
-0xE5, 0x44, 0x30, 0xE1, 0x03, 0x12, 0x74, 0xD8, 0x74, 0x6F, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74,
-0x4C, 0xA3, 0xF0, 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, 0x80,
-0xDE, 0xE0, 0xB4, 0x01, 0x13, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0D, 0x90, 0x81, 0x2B, 0xE0, 0x54,
-0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, 0xB1, 0x29, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x90, 0x81, 0x29,
-0x30, 0xE0, 0x04, 0xE0, 0xFF, 0xE1, 0x6E, 0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x04, 0xE4, 0xFD, 0x7F,
-0x0C, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x1D, 0xED, 0xF0, 0x90, 0x81, 0x24,
-0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0xC1, 0x8E, 0xEE, 0xC4, 0x13, 0x13,
-0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0xC1, 0x8E, 0x90, 0x81, 0x2A, 0xE0, 0xFE, 0x6F, 0x70, 0x02,
-0xC1, 0x8E, 0xEF, 0x70, 0x02, 0xC1, 0x03, 0x24, 0xFE, 0x70, 0x02, 0xC1, 0x3D, 0x24, 0xFE, 0x60,
-0x4A, 0x24, 0xFC, 0x70, 0x02, 0xC1, 0x78, 0x24, 0xFC, 0x60, 0x02, 0xC1, 0x8E, 0xEE, 0xB4, 0x0E,
-0x02, 0xF1, 0x39, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0xF1, 0x1B, 0x90, 0x81, 0x2A,
-0xE0, 0xB4, 0x06, 0x02, 0xD1, 0xE8, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0x82, 0x1D,
-0xE0, 0xFF, 0x60, 0x05, 0x12, 0x7A, 0xBA, 0x80, 0x03, 0x12, 0x5F, 0xB4, 0x90, 0x81, 0x2A, 0xE0,
-0x64, 0x08, 0x60, 0x02, 0xC1, 0x8E, 0x12, 0x5B, 0xEB, 0xC1, 0x8E, 0x90, 0x81, 0x2A, 0xE0, 0x70,
-0x04, 0x7F, 0x01, 0xF1, 0x1B, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x06, 0x02, 0xD1, 0xE8, 0x90, 0x81,
-0x2A, 0xE0, 0xB4, 0x0E, 0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02, 0xF1, 0x39, 0x90, 0x81, 0x2A, 0xE0,
-0x64, 0x0C, 0x60, 0x02, 0xC1, 0x8E, 0xD1, 0x93, 0xEF, 0x64, 0x01, 0x60, 0x02, 0xC1, 0x8E, 0xF1,
-0x8D, 0xC1, 0x8E, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x0E, 0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02, 0xF1,
-0x39, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x06, 0x02, 0xD1, 0xE8, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x0C,
-0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02, 0xF1, 0x8D, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x04, 0x70, 0x5E,
-0x12, 0x7A, 0x0C, 0xEF, 0x64, 0x01, 0x70, 0x56, 0x12, 0x5D, 0x5A, 0x80, 0x51, 0x90, 0x81, 0x2A,
-0xE0, 0xB4, 0x0E, 0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02, 0xF1, 0x39, 0x90, 0x81, 0x2A, 0xE0, 0xB4,
-0x06, 0x02, 0xD1, 0xE8, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x0C, 0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02,
-0xF1, 0x8D, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0xF1, 0x1B, 0x90, 0x81, 0x2A, 0xE0,
-0xB4, 0x04, 0x1B, 0x12, 0x7B, 0x00, 0x80, 0x16, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x0C, 0x0F, 0x90,
-0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x03, 0x12, 0x5F, 0x55, 0xD0, 0xD0,
-0x92, 0xAF, 0x22, 0xF1, 0xFC, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0,
-0x80, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90,
-0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x28, 0xEF, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x08, 0x90, 0x01,
-0xB8, 0x74, 0x04, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x29, 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, 0x81, 0x25, 0xE0, 0x90, 0x06, 0x04, 0x20,
-0xE0, 0x0C, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x80, 0x17, 0xE0, 0x54,
-0x7F, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0x7F, 0xF0, 0x90,
-0x81, 0x23, 0x74, 0x0C, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x82, 0x1C, 0xEF, 0xF0,
-0x12, 0x5B, 0xFD, 0x90, 0x82, 0x1C, 0xE0, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81,
-0x2A, 0x74, 0x04, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x81, 0x25, 0xE0, 0xC3, 0x13, 0x20,
-0xE0, 0x08, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x80, 0x1E, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40,
-0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44,
-0x80, 0xF0, 0x90, 0x81, 0x23, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0xAE, 0x07,
-0xF1, 0xE3, 0xBF, 0x01, 0x15, 0x90, 0x81, 0x1F, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x20, 0xE0,
-0x09, 0xAF, 0x06, 0x7D, 0x01, 0xB1, 0x41, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x80, 0xDE,
-0xE0, 0x64, 0x01, 0x70, 0x32, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x22, 0x74,
-0x6F, 0xF0, 0x7F, 0x01, 0x12, 0x56, 0xA8, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x80,
-0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0E, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74,
-0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x64, 0x02, 0x60, 0x12,
-0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x0A, 0xF1, 0xFC, 0xEF, 0x70, 0x05, 0xFD, 0x7F, 0x0C,
-0xB1, 0x41, 0x22, 0x90, 0x05, 0x43, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90,
-0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xA3, 0xF0, 0xA3, 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, 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, 0x90, 0x01, 0xC4, 0x74, 0x15, 0xF0, 0x74, 0x50, 0xA3, 0xF0, 0x12, 0x72, 0x6E, 0xE5,
-0x49, 0x30, 0xE1, 0x02, 0x11, 0xC5, 0xE5, 0x49, 0x30, 0xE2, 0x03, 0x12, 0x75, 0x58, 0xE5, 0x49,
-0x30, 0xE3, 0x03, 0x12, 0x75, 0x94, 0xE5, 0x4A, 0x30, 0xE0, 0x03, 0x12, 0x75, 0xD0, 0xE5, 0x4A,
-0x30, 0xE4, 0x03, 0x12, 0x76, 0x6F, 0xE5, 0x4B, 0x30, 0xE1, 0x03, 0x12, 0x73, 0x3B, 0xE5, 0x4B,
-0x30, 0xE0, 0x03, 0x12, 0x72, 0xF5, 0xE5, 0x4B, 0x30, 0xE3, 0x03, 0x12, 0x76, 0x85, 0xE5, 0x4C,
-0x30, 0xE1, 0x05, 0x7F, 0x03, 0x12, 0x4A, 0x27, 0xE5, 0x4C, 0x30, 0xE4, 0x02, 0x11, 0xD9, 0xE5,
-0x4C, 0x30, 0xE5, 0x03, 0x12, 0x76, 0x86, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x77, 0x1C, 0x74,
-0x15, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x50, 0xA3, 0xF0, 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, 0x81, 0x27, 0xE0, 0x60, 0x03, 0x12, 0x7B, 0x98, 0x90, 0x81,
-0x40, 0xE0, 0x30, 0xE0, 0x03, 0x12, 0x5C, 0xEA, 0x22, 0x12, 0x7B, 0x33, 0x90, 0x81, 0x2D, 0xE0,
-0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02, 0x7F, 0x02, 0x31, 0x31, 0x91, 0xBC, 0x90, 0x81, 0x42,
-0xE0, 0x30, 0xE0, 0x33, 0x90, 0x81, 0x44, 0xE0, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x81, 0x45, 0xE0,
-0x60, 0x05, 0x14, 0xF0, 0x02, 0x5F, 0x55, 0x90, 0x81, 0x43, 0xE0, 0x14, 0x90, 0x81, 0x45, 0xF0,
-0x90, 0x05, 0x73, 0x74, 0x01, 0xF0, 0xE4, 0xFF, 0x12, 0x5B, 0xBB, 0x7D, 0x02, 0x7F, 0x02, 0x31,
-0x31, 0x7D, 0x01, 0x7F, 0x02, 0x31, 0x31, 0x22, 0x90, 0x01, 0x34, 0x74, 0x40, 0xF0, 0xFD, 0xE4,
-0xFF, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34,
-0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x05, 0x27,
-0xE0, 0x90, 0x81, 0xD0, 0xF0, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x1F, 0xE0,
-0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12,
-0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, 0x1F, 0xF0, 0xEE,
-0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD,
-0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x1F, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF,
-0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0x90, 0x81,
-0x1F, 0xF0, 0xEE, 0xC3, 0x13, 0x20, 0xE0, 0x02, 0x41, 0x77, 0xE0, 0xFF, 0x20, 0xE0, 0x02, 0x41,
-0x5E, 0x90, 0x81, 0xD0, 0x74, 0x21, 0xF0, 0xEF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x31,
-0x28, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x08, 0xF0, 0x80, 0x0C, 0xE4, 0x90, 0x81, 0x20, 0xF0, 0xA3,
-0xF0, 0x7D, 0x40, 0xFF, 0x71, 0x5C, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x13, 0x13, 0x13, 0x54, 0x1F,
-0x30, 0xE0, 0x07, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x12, 0xF0, 0xED, 0xC4, 0x54, 0x0F, 0x30, 0xE0,
-0x07, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x14, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xC4, 0x13, 0x54, 0x07,
-0x30, 0xE0, 0x07, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xC4, 0x13,
-0x13, 0x54, 0x03, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0xD0,
-0xE0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x22, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0xB1, 0xA3, 0x90,
-0x81, 0x1F, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x04, 0x7F, 0x04, 0x80, 0x23,
-0x12, 0x4F, 0xE3, 0xEF, 0x60, 0x04, 0x7F, 0x01, 0x80, 0x19, 0x7F, 0x02, 0x80, 0x15, 0x90, 0x81,
-0xD0, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x22, 0xE0, 0x64, 0x04, 0x60, 0x02,
-0x61, 0x4D, 0xFF, 0xB1, 0xA3, 0x61, 0x4D, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x20, 0xE0, 0x02, 0x61,
-0x18, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x31, 0xF0, 0xED, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0B,
-0x31, 0x28, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x08, 0xF0, 0x80, 0x06, 0x7D, 0x40, 0xE4, 0xFF, 0x71,
-0x5C, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81,
-0xD0, 0xE0, 0x44, 0x02, 0xF0, 0xED, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xD0, 0xE0,
-0x44, 0x04, 0xF0, 0x90, 0x81, 0xD0, 0xE0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xFF,
-0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x6D,
-0xE4, 0xFD, 0x7F, 0x02, 0x80, 0x23, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x23,
-0xE0, 0xB4, 0x02, 0x1A, 0x12, 0x7B, 0x1A, 0x12, 0x4F, 0xE3, 0xBF, 0x01, 0x09, 0x90, 0x81, 0x29,
-0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x03, 0xE4, 0xFD, 0xFF, 0x12, 0x4D, 0x41, 0x80, 0x3F, 0x90, 0x81,
-0x2A, 0xE0, 0x90, 0x81, 0x23, 0xF0, 0x80, 0x35, 0x90, 0x81, 0xD0, 0x74, 0x01, 0xF0, 0x90, 0x05,
-0x27, 0xF0, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x06, 0x7D, 0x01, 0x7F, 0x04, 0x80, 0x0B, 0x90,
-0x81, 0x23, 0xE0, 0xB4, 0x08, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x4D, 0x41, 0x12, 0x75, 0x4F,
-0x90, 0x81, 0x29, 0xE0, 0xFF, 0x7D, 0x01, 0x12, 0x4D, 0x41, 0x12, 0x5A, 0x64, 0xD0, 0xD0, 0x92,
-0xAF, 0x22, 0x7D, 0x02, 0x7F, 0x02, 0x71, 0x5C, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x3D, 0x2F, 0xF8,
-0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5,
-0x83, 0xEE, 0xF0, 0x22, 0xEF, 0x70, 0x37, 0x7D, 0x78, 0x7F, 0x02, 0x71, 0x5C, 0x7D, 0x02, 0x7F,
-0x03, 0x71, 0x5C, 0x7D, 0xC8, 0x7F, 0x02, 0x12, 0x77, 0xE2, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90,
-0x01, 0x3C, 0x74, 0x02, 0xF0, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x4D, 0x41, 0x90, 0x81, 0x24, 0xE0,
-0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01,
-0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x31, 0x31, 0x7D, 0x02, 0x7F,
-0x03, 0x31, 0x31, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90,
-0x05, 0x58, 0xF0, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB,
-0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, 0x4D, 0x41, 0x90,
-0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x08, 0x90,
-0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x3B, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x04, 0xEF, 0x30, 0xE0,
-0x0A, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x02, 0x60, 0x29, 0x91, 0xF1, 0x90, 0x81, 0x25, 0xE0, 0x13,
-0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70,
-0x0B, 0x12, 0x77, 0xBE, 0x71, 0x52, 0x90, 0x81, 0x2E, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0,
-0x04, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x06, 0x90, 0x81, 0x21, 0x74, 0x01, 0xF0,
-0x90, 0x81, 0x27, 0xE0, 0x60, 0x45, 0x90, 0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F,
-0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, 0x71, 0x52, 0x90, 0x81, 0x2D, 0xE0,
-0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x82, 0x14, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9, 0xC3,
-0x90, 0x82, 0x15, 0xE0, 0x94, 0x80, 0x90, 0x82, 0x14, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B,
-0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0x12, 0x7D, 0xBE, 0x91, 0xBC,
-0x12, 0x6F, 0x96, 0x90, 0x81, 0x42, 0xE0, 0x30, 0xE0, 0x11, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4,
-0x0A, 0x71, 0x52, 0x90, 0x81, 0x44, 0xE0, 0x90, 0x05, 0x73, 0xF0, 0x22, 0x90, 0x81, 0x47, 0xE0,
-0x30, 0xE0, 0x2D, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x26, 0x90, 0x82, 0x1F, 0xE0, 0x04, 0xF0,
-0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x82, 0x1F, 0xF0, 0x90,
-0x81, 0x49, 0xE0, 0xFF, 0x90, 0x81, 0x48, 0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0xD1, 0xA6,
-0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xA1, 0x92, 0x90, 0x81, 0x27, 0xE0, 0x70,
-0x02, 0xA1, 0x92, 0x90, 0x81, 0x26, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x22, 0x90, 0x06,
-0xAB, 0xE0, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x90, 0x81, 0x2D, 0xF0, 0xA3, 0xE0,
-0xFF, 0x70, 0x08, 0x90, 0x81, 0x2D, 0xE0, 0xFE, 0xFF, 0x80, 0x00, 0x90, 0x81, 0x2E, 0xEF, 0xF0,
-0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x32, 0xA3,
-0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0,
-0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0xFF, 0xC4,
-0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x05, 0x12,
-0x6E, 0xB1, 0x80, 0x03, 0x12, 0x6D, 0xFF, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F,
-0x30, 0xE0, 0x0F, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x05, 0x12, 0x77, 0xBE,
-0x71, 0x58, 0x90, 0x81, 0x1F, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x07, 0x90, 0x81, 0x25, 0xE0, 0x44,
-0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x22, 0xE0, 0x90, 0x82,
-0x1E, 0xF0, 0x6F, 0x70, 0x02, 0xC1, 0xA1, 0xEF, 0x14, 0x60, 0x40, 0x14, 0x60, 0x68, 0x14, 0x70,
-0x02, 0xC1, 0x53, 0x14, 0x70, 0x02, 0xC1, 0x7B, 0x24, 0x04, 0x60, 0x02, 0xC1, 0xA1, 0x90, 0x82,
-0x1E, 0xE0, 0xFF, 0xB4, 0x04, 0x05, 0x12, 0x7C, 0x16, 0xC1, 0xA1, 0xEF, 0xB4, 0x02, 0x04, 0xF1,
-0xE3, 0xC1, 0xA1, 0x90, 0x82, 0x1E, 0xE0, 0xFF, 0xB4, 0x03, 0x05, 0x12, 0x7C, 0x3A, 0xC1, 0xA1,
-0xEF, 0x64, 0x01, 0x60, 0x02, 0xC1, 0xA1, 0xF1, 0xE5, 0xC1, 0xA1, 0x90, 0x82, 0x1E, 0xE0, 0xFF,
-0xB4, 0x04, 0x05, 0x12, 0x7C, 0x03, 0xC1, 0xA1, 0xEF, 0xB4, 0x02, 0x04, 0xF1, 0xD5, 0xC1, 0xA1,
-0x90, 0x82, 0x1E, 0xE0, 0xFF, 0xB4, 0x03, 0x05, 0x12, 0x7C, 0x2F, 0xC1, 0xA1, 0xEF, 0x60, 0x02,
-0xC1, 0xA1, 0xF1, 0xA9, 0x80, 0x7B, 0x90, 0x82, 0x1E, 0xE0, 0xB4, 0x04, 0x05, 0x12, 0x5F, 0x92,
-0x80, 0x6F, 0x90, 0x82, 0x1E, 0xE0, 0xB4, 0x01, 0x04, 0xF1, 0x9B, 0x80, 0x64, 0x90, 0x82, 0x1E,
-0xE0, 0xB4, 0x03, 0x05, 0x12, 0x5F, 0x4C, 0x80, 0x58, 0x90, 0x82, 0x1E, 0xE0, 0x70, 0x52, 0xF1,
-0xA5, 0x80, 0x4E, 0x90, 0x82, 0x1E, 0xE0, 0xFF, 0xB4, 0x04, 0x05, 0x12, 0x7C, 0x1B, 0x80, 0x41,
-0xEF, 0xB4, 0x01, 0x04, 0xF1, 0xC8, 0x80, 0x39, 0xEF, 0xB4, 0x02, 0x05, 0x12, 0x5F, 0x43, 0x80,
-0x30, 0x90, 0x82, 0x1E, 0xE0, 0x70, 0x2A, 0xF1, 0xC6, 0x80, 0x26, 0x90, 0x82, 0x1E, 0xE0, 0xFF,
-0xB4, 0x03, 0x05, 0x12, 0x7C, 0x3F, 0x80, 0x19, 0xEF, 0xB4, 0x01, 0x04, 0xF1, 0xB2, 0x80, 0x11,
-0xEF, 0xB4, 0x02, 0x05, 0x12, 0x5F, 0xC7, 0x80, 0x08, 0x90, 0x82, 0x1E, 0xE0, 0x70, 0x02, 0xF1,
-0xB0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xFF, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F,
-0x53, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x1F, 0x90, 0x05, 0x22, 0xE0, 0xF5, 0x56, 0x74, 0xFF, 0xF0,
-0x12, 0x5D, 0x7A, 0xBF, 0x01, 0x08, 0xAF, 0x53, 0x12, 0x7C, 0xFF, 0x12, 0x7C, 0x60, 0x90, 0x05,
-0x22, 0xE5, 0x56, 0xF0, 0x80, 0x03, 0x12, 0x7C, 0x60, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F,
-0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
-0xE0, 0x54, 0x3F, 0xF0, 0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5,
-0x83, 0xE0, 0x44, 0x10, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0,
-0x44, 0x80, 0xF0, 0x22, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54,
-0xEF, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0,
-0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x17, 0xED, 0xF0, 0x90, 0x82, 0x16,
-0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x12, 0x7D, 0x4C, 0x7C, 0x00, 0xAD, 0x07, 0x90, 0x82, 0x16, 0xE0,
-0x90, 0x04, 0x25, 0xF0, 0x90, 0x82, 0x17, 0xE0, 0x60, 0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4,
-0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4,
-0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
-0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54,
-0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x5C, 0xEA, 0x90, 0x81,
-0x22, 0x74, 0x02, 0xF0, 0x22, 0xF1, 0xA9, 0x80, 0xF2, 0x90, 0x81, 0x22, 0x74, 0x01, 0xF0, 0x22,
-0xF1, 0xA9, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90,
-0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xF1, 0xA9, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x90, 0x81,
-0x22, 0x74, 0x03, 0xF0, 0x22, 0x12, 0x5B, 0xFD, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x22,
-0x04, 0xF0, 0x22, 0xF1, 0xD5, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0x90, 0x81, 0x22,
-0xF0, 0x22, 0x90, 0x01, 0xC8, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0x81, 0x79,
-0x56, 0x7F, 0xFF, 0xFE, 0x12, 0x2B, 0x27, 0xBF, 0x01, 0x09, 0x90, 0x81, 0x56, 0xE0, 0x64, 0x03,
-0x60, 0x03, 0x22, 0x01, 0xB4, 0xE4, 0x90, 0x81, 0x5B, 0xF0, 0x90, 0x81, 0x5B, 0xE0, 0xFF, 0xC3,
-0x94, 0x02, 0x40, 0x02, 0x01, 0xEF, 0xC3, 0x74, 0xFE, 0x9F, 0xFF, 0xE4, 0x94, 0x00, 0xFE, 0x7B,
-0x01, 0x7A, 0x81, 0x79, 0x57, 0x12, 0x2B, 0x27, 0xEF, 0x64, 0x01, 0x70, 0x77, 0x90, 0x81, 0x57,
-0xE0, 0xFF, 0x54, 0xC0, 0xFE, 0x60, 0x05, 0xEF, 0x54, 0x0C, 0x70, 0x16, 0x90, 0x81, 0x57, 0xE0,
-0xFF, 0x54, 0x30, 0x60, 0x67, 0xEF, 0x54, 0x03, 0x60, 0x62, 0x90, 0x81, 0x58, 0x74, 0x01, 0xF0,
-0x80, 0x05, 0xE4, 0x90, 0x81, 0x58, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x90, 0x81, 0x57, 0x70, 0x16,
-0xE0, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x81, 0x59, 0xF0, 0xEF, 0x54, 0x0C, 0x13, 0x13,
-0x54, 0x3F, 0xA3, 0xF0, 0x80, 0x0D, 0xE0, 0xFE, 0x54, 0x30, 0x90, 0x81, 0x59, 0xF0, 0xEE, 0x54,
-0x03, 0xA3, 0xF0, 0x90, 0x81, 0x59, 0xE0, 0x64, 0x30, 0x70, 0x54, 0xA3, 0xE0, 0x64, 0x02, 0x70,
-0x4E, 0x90, 0x00, 0xF5, 0xE0, 0x54, 0x40, 0x90, 0x81, 0x5C, 0xF0, 0xE0, 0x70, 0x41, 0xA3, 0x74,
-0x02, 0xF0, 0x80, 0x10, 0x90, 0x81, 0x5D, 0x74, 0x01, 0xF0, 0x80, 0x08, 0x90, 0x81, 0x5B, 0xE0,
-0x04, 0xF0, 0x01, 0x1A, 0x90, 0x01, 0xC4, 0x74, 0xF2, 0xF0, 0x74, 0x57, 0xA3, 0xF0, 0x90, 0x81,
-0x5D, 0xE0, 0x90, 0x01, 0xC8, 0xF0, 0x90, 0x81, 0x57, 0xE0, 0x90, 0x01, 0xC9, 0xF0, 0x90, 0x81,
-0x58, 0xE0, 0x90, 0x01, 0xCA, 0xF0, 0xE4, 0xFD, 0x7F, 0x1F, 0x12, 0x32, 0x1E, 0x80, 0xD5, 0x22,
-0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD, 0x00, 0xE0,
-0x54, 0xBF, 0xF0, 0x12, 0x57, 0xF2, 0x31, 0xCB, 0x12, 0x32, 0x77, 0x12, 0x71, 0x94, 0x31, 0xB2,
-0x7F, 0x01, 0x12, 0x49, 0x15, 0x90, 0x81, 0x46, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x49, 0x15, 0x90,
-0x81, 0x46, 0xE0, 0x04, 0xF0, 0x7F, 0x03, 0x12, 0x49, 0x15, 0x90, 0x81, 0x46, 0xE0, 0x04, 0xF0,
-0x31, 0x4F, 0x31, 0x90, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E,
-0x75, 0x20, 0xFF, 0x31, 0xBC, 0x12, 0x71, 0xC4, 0x31, 0xD3, 0xE4, 0xFF, 0x02, 0x49, 0x9E, 0x51,
-0x09, 0x90, 0x80, 0x3C, 0xEF, 0xF0, 0x31, 0x61, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x02, 0x2D,
-0xA7, 0x12, 0x71, 0x33, 0x12, 0x71, 0x63, 0x51, 0x23, 0x51, 0x42, 0xE4, 0xF5, 0x35, 0xF5, 0x36,
-0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F, 0x51, 0x12,
-0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02, 0x32, 0x1E,
-0x31, 0xB6, 0x31, 0xC3, 0x51, 0x64, 0x12, 0x79, 0x06, 0x31, 0xDD, 0x31, 0xE8, 0x31, 0xF7, 0x90,
-0x81, 0x4A, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3,
-0xF0, 0x22, 0xE4, 0xF5, 0x4D, 0x22, 0xE4, 0x90, 0x80, 0xDE, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75,
-0xA8, 0x84, 0x22, 0xE4, 0x90, 0x80, 0xD8, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44,
-0x01, 0xF0, 0x22, 0x90, 0x01, 0xE4, 0x74, 0x0C, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90, 0x81, 0x40,
-0xE0, 0x54, 0xFE, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0xE4,
-0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x47, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x7F,
-0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09,
-0xE0, 0x7F, 0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02,
-0x7F, 0x03, 0x22, 0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, 0x07, 0x75, 0x40, 0x02, 0x90,
-0x01, 0x30, 0xE5, 0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40,
-0xF0, 0x22, 0x75, 0x45, 0x0E, 0x75, 0x46, 0x01, 0x43, 0x46, 0x10, 0x75, 0x47, 0x03, 0x75, 0x48,
-0x62, 0x90, 0x01, 0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, 0xF0, 0xA3,
-0xE5, 0x48, 0xF0, 0x22, 0x90, 0x81, 0x1F, 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, 0x31, 0x9F, 0x12, 0x1F, 0xA4, 0xFF, 0x54,
-0x01, 0xFE, 0x90, 0x81, 0x4A, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14,
-0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x4B, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD,
-0x90, 0x81, 0x4C, 0xF0, 0x22, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x1F, 0xEF, 0x12, 0x4B, 0x28, 0x5A,
-0xEA, 0x00, 0x5A, 0xF3, 0x01, 0x5A, 0xFB, 0x02, 0x5B, 0x03, 0x03, 0x5B, 0x0C, 0x04, 0x5B, 0x14,
-0x20, 0x5B, 0x1C, 0x21, 0x5B, 0x25, 0x23, 0x5B, 0x2D, 0x24, 0x5B, 0x36, 0x25, 0x5B, 0x3E, 0x26,
-0x5B, 0x46, 0x27, 0x5B, 0x4E, 0xC0, 0x00, 0x00, 0x5B, 0x56, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16,
-0x02, 0x70, 0x9E, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0xC1, 0x95, 0x90, 0x81, 0xCD, 0x12, 0x4B,
-0x16, 0x81, 0x9A, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0x02, 0x7D, 0x9E, 0x90, 0x81, 0xCD, 0x12,
-0x4B, 0x16, 0x41, 0x89, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0xA1, 0xC2, 0x90, 0x81, 0xCD, 0x12,
-0x4B, 0x16, 0x02, 0x70, 0xE6, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0xE1, 0x3B, 0x90, 0x81, 0xCD,
-0x12, 0x4B, 0x16, 0x02, 0x51, 0x46, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0xE1, 0x62, 0x90, 0x81,
-0xCD, 0x12, 0x4B, 0x16, 0x80, 0x18, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0x80, 0x3C, 0x90, 0x81,
-0xCD, 0x12, 0x4B, 0x16, 0xE1, 0xA2, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x12, 0x1F,
-0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x40, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0x90, 0x00, 0x01,
-0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x05, 0x54, 0xE0, 0xC3, 0x9E, 0x90, 0x81, 0x41, 0xF0, 0xEF, 0x20,
-0xE0, 0x07, 0x71, 0xFD, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFF,
-0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81,
-0x43, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x44, 0xF0, 0x90, 0x81, 0x43, 0xE0,
-0x90, 0x81, 0x45, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0x01, 0xFF, 0xAC, 0x07, 0xEF, 0x54, 0x01,
-0xFE, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0x90, 0x01, 0x53, 0xB4, 0x01, 0x12,
-0xE4, 0xF0, 0x7D, 0x10, 0x7F, 0x03, 0x12, 0x77, 0xCD, 0x90, 0x81, 0x44, 0xE0, 0x90, 0x05, 0x73,
-0xF0, 0x22, 0x74, 0x03, 0xF0, 0x7D, 0x10, 0xFF, 0x12, 0x77, 0xE2, 0x71, 0xFD, 0x90, 0x05, 0x22,
-0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 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, 0x7C, 0x7E,
-0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x82, 0x0A, 0x12, 0x20, 0xCE, 0x90, 0x82,
-0x0A, 0x12, 0x4A, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E,
-0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12,
-0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E,
-0x12, 0x2E, 0xA2, 0x90, 0x82, 0x02, 0x12, 0x20, 0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF,
-0x91, 0x77, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xC0, 0x07,
-0xC0, 0x05, 0x90, 0x82, 0x02, 0x12, 0x4A, 0xD9, 0x90, 0x81, 0xEE, 0x12, 0x20, 0xCE, 0xD0, 0x05,
-0xD0, 0x07, 0x12, 0x6D, 0x26, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
-0xD0, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x1F, 0x12, 0x1F, 0xA4, 0xFF, 0x90, 0x81, 0x1E, 0xF0, 0xBF,
-0x01, 0x12, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01,
-0x60, 0x23, 0x80, 0x1E, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD,
-0x64, 0x01, 0x60, 0x11, 0x90, 0x81, 0x1F, 0xE0, 0x20, 0xE0, 0x07, 0xE4, 0xFF, 0x12, 0x55, 0xA3,
-0x80, 0x03, 0x12, 0x72, 0xCF, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0,
-0xB1, 0x7A, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08,
-0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, 0x7F, 0x70, 0x7E,
-0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x82, 0x02, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xFD,
-0xFF, 0x91, 0x77, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x82,
-0x0E, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x0E, 0x12, 0x4A, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE,
-0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54,
-0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0,
-0xB1, 0x7A, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x12, 0x51, 0x31, 0x91, 0xF0,
-0xE4, 0x90, 0x81, 0x2A, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0xE4, 0x90, 0x82, 0x18, 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, 0x82, 0x19, 0xE0, 0x94, 0xE8, 0x90, 0x82, 0x18,
-0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F,
-0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x18, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9,
-0x80, 0xBF, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x1F, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x90, 0x81,
-0xD3, 0x12, 0x4B, 0x1F, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD,
-0x90, 0x81, 0x3F, 0xF0, 0x90, 0x81, 0xD3, 0x12, 0x4B, 0x16, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x7F,
-0x90, 0x81, 0x27, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, 0x01,
-0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x81, 0x26, 0xE0, 0x54, 0xF0,
-0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81, 0x24,
-0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x81, 0x26, 0xE0,
-0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x29, 0xF0, 0xD1, 0x65,
-0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x90, 0x01,
-0xBA, 0xF0, 0x90, 0x81, 0x29, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F,
-0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x81, 0xD6, 0x12, 0x4B, 0x1F, 0xF1, 0x81, 0x90, 0x81, 0x27,
-0xE0, 0xFF, 0x12, 0x53, 0x74, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x19, 0x90, 0x81, 0xD6, 0x12, 0x4B,
-0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD,
-0xFD, 0x12, 0x79, 0xDB, 0x22, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x1F, 0x90, 0x00, 0x01, 0x12, 0x1F,
-0xBD, 0xFF, 0xFE, 0x12, 0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x81, 0xD0, 0x12,
-0x4B, 0x16, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0xD4, 0xF0, 0x80, 0x05, 0x90, 0x81,
-0xD4, 0xEF, 0xF0, 0x90, 0x81, 0xD3, 0xEE, 0xF0, 0x90, 0x81, 0xD4, 0xE0, 0xFE, 0x90, 0x81, 0xD3,
-0xE0, 0xFF, 0xD3, 0x9E, 0x50, 0x38, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x12, 0x1F, 0xA4, 0x54,
-0x01, 0xFE, 0x74, 0xDE, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xDE,
-0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xF1, 0x3A, 0x80, 0x07, 0x90,
-0x81, 0xD3, 0xE0, 0xFF, 0xF1, 0x39, 0x90, 0x81, 0xD3, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x90, 0x80,
-0xDE, 0xE0, 0x70, 0x24, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0xFF, 0x12, 0x4F, 0x1B, 0x90, 0x81,
-0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0xF1, 0xB4, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54,
-0xEF, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x22, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81,
-0x31, 0xF0, 0x22, 0x71, 0xFD, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, 0x91, 0xF0, 0x90, 0x81,
-0x22, 0x74, 0x02, 0xF0, 0x22, 0x91, 0xEA, 0x90, 0x81, 0x2A, 0x74, 0x08, 0xF0, 0x90, 0x81, 0x23,
-0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x3E, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x90, 0x01, 0xE7,
-0xF0, 0x22, 0x90, 0x81, 0x40, 0xE0, 0x30, 0xE0, 0x07, 0x71, 0xFD, 0x90, 0x05, 0x22, 0xE4, 0xF0,
-0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x2B,
-0xF0, 0x22, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x91, 0xEA, 0x90, 0x81, 0x22, 0x74, 0x02,
-0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x4F, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90,
-0x81, 0x50, 0xF0, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0,
-0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x22, 0x71, 0xFD, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90,
-0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81,
-0x5E, 0xF0, 0x90, 0x81, 0x5E, 0xE0, 0x64, 0x01, 0xF0, 0x24, 0xDD, 0x90, 0x01, 0xC4, 0xF0, 0x74,
-0x5F, 0xA3, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0F, 0x90, 0x81, 0x2A, 0xE0, 0xFF, 0x90, 0x81,
-0x29, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x4D, 0x29, 0xC2, 0xAF, 0x12, 0x72, 0x1A, 0xBF, 0x01, 0x02,
-0x11, 0x23, 0xD2, 0xAF, 0xF1, 0xD6, 0x12, 0x32, 0x9E, 0xBF, 0x01, 0x02, 0x31, 0x24, 0x12, 0x48,
-0x4D, 0x80, 0xBF, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x23, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30,
-0xE0, 0x19, 0xC3, 0x13, 0x30, 0xE0, 0x08, 0x12, 0x7C, 0x53, 0xBF, 0x01, 0x10, 0x80, 0x0A, 0x90,
-0x81, 0x23, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x04, 0x80, 0x03, 0x11, 0x5E, 0x22, 0xD3, 0x10,
-0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x11, 0xDF, 0x11, 0x77, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81,
-0x2A, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x0E, 0x12, 0x7A, 0x8C, 0xBF, 0x01, 0x08, 0x11, 0x4E,
-0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, 0x22, 0xF1, 0xD7, 0x90, 0x00, 0x08, 0xE0, 0x54, 0xEF, 0xFD,
-0x7F, 0x08, 0x12, 0x32, 0x1E, 0xE4, 0xFF, 0x8F, 0x50, 0xE4, 0x90, 0x81, 0x5F, 0xF0, 0xA3, 0xF0,
-0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0xEF, 0x65, 0x50, 0x60, 0x3E,
-0xC3, 0x90, 0x81, 0x60, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x5F, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90,
-0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x5F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A,
-0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x60, 0xE0, 0x94, 0x32, 0x90,
-0x81, 0x5F, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, 0xB2, 0x22, 0x90,
-0x81, 0x31, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x32, 0x1E, 0x90, 0x81, 0x28, 0xE0, 0x60, 0x12, 0x90,
-0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x90,
-0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0x7F, 0x01, 0x11,
-0x87, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E, 0x7F, 0x14, 0x7E,
-0x00, 0x02, 0x32, 0xAA, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x2D, 0xA7, 0xE4, 0xF5,
-0x52, 0x12, 0x32, 0x9E, 0xEF, 0x60, 0x71, 0x63, 0x52, 0x01, 0xE5, 0x52, 0x24, 0x24, 0x90, 0x01,
-0xC4, 0xF0, 0x74, 0x61, 0xA3, 0xF0, 0x90, 0x00, 0x88, 0xE0, 0xF5, 0x50, 0xF5, 0x51, 0x54, 0x0F,
-0x60, 0xDF, 0xE5, 0x50, 0x30, 0xE0, 0x0B, 0x20, 0xE4, 0x03, 0x12, 0x29, 0xC5, 0x53, 0x51, 0xEE,
-0x80, 0x3D, 0xE5, 0x50, 0x30, 0xE1, 0x16, 0x20, 0xE5, 0x0E, 0x12, 0x11, 0xBD, 0xEF, 0x70, 0x03,
-0x43, 0x51, 0x20, 0x90, 0x01, 0x06, 0xE4, 0xF0, 0x53, 0x51, 0xFD, 0x80, 0x22, 0xE5, 0x50, 0x30,
-0xE2, 0x0A, 0x20, 0xE6, 0x02, 0x91, 0x2F, 0x53, 0x51, 0xFB, 0x80, 0x13, 0xE5, 0x50, 0x30, 0xE3,
-0x0E, 0x20, 0xE7, 0x08, 0x31, 0xAD, 0xEF, 0x70, 0x03, 0x43, 0x51, 0x80, 0x53, 0x51, 0xF7, 0xAD,
-0x51, 0x7F, 0x88, 0x12, 0x32, 0x1E, 0x80, 0x89, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x78, 0x10, 0x74,
-0x01, 0xF2, 0x90, 0x02, 0x09, 0xE0, 0x78, 0x00, 0xF2, 0x08, 0x74, 0x20, 0xF2, 0x18, 0xE2, 0xFF,
-0x30, 0xE0, 0x05, 0x08, 0xE2, 0x24, 0x80, 0xF2, 0xEF, 0xC3, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0x78,
-0x01, 0xE2, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x78, 0x03, 0xF2, 0x64,
-0x04, 0x60, 0x0D, 0xE2, 0xFF, 0x64, 0x08, 0x60, 0x07, 0xEF, 0x64, 0x0C, 0x60, 0x02, 0x81, 0x1D,
-0xE4, 0x78, 0x02, 0xF2, 0x78, 0x03, 0xE2, 0xFF, 0x18, 0xE2, 0xC3, 0x9F, 0x50, 0x2D, 0xE2, 0xFD,
-0x18, 0xE2, 0x2D, 0x90, 0x81, 0x5F, 0xF0, 0xE0, 0xFF, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC,
-0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x04, 0x2D, 0xF8, 0xEE, 0xF2, 0xEF, 0xB4, 0xFF, 0x06, 0x90, 0xFD,
-0x10, 0xE0, 0x04, 0xF0, 0x78, 0x02, 0xE2, 0x04, 0xF2, 0x80, 0xC9, 0x78, 0x04, 0xE2, 0x78, 0x12,
-0xF2, 0xFF, 0x78, 0x05, 0xE2, 0x78, 0x11, 0xF2, 0x78, 0x06, 0xE2, 0x78, 0x13, 0xF2, 0x78, 0x07,
-0xE2, 0x78, 0x14, 0xF2, 0x78, 0x08, 0xE2, 0x78, 0x33, 0xF2, 0x78, 0x09, 0xE2, 0x78, 0x34, 0xF2,
-0x78, 0x0A, 0xE2, 0x78, 0x35, 0xF2, 0x78, 0x0B, 0xE2, 0x78, 0x36, 0xF2, 0x78, 0x0C, 0xE2, 0x78,
-0x37, 0xF2, 0x78, 0x0D, 0xE2, 0x78, 0x38, 0xF2, 0x78, 0x0E, 0xE2, 0x78, 0x39, 0xF2, 0x78, 0x0F,
-0xE2, 0x78, 0x3A, 0xF2, 0xE4, 0x78, 0x15, 0xF2, 0xEF, 0x24, 0xF8, 0x60, 0x75, 0x24, 0xFC, 0x60,
-0x6C, 0x24, 0x08, 0x60, 0x02, 0x61, 0xFF, 0x78, 0x11, 0xE2, 0xB4, 0x01, 0x05, 0x12, 0x29, 0xC5,
-0x81, 0x04, 0x78, 0x11, 0xE2, 0xB4, 0x02, 0x05, 0x12, 0x11, 0xBD, 0x81, 0x04, 0x78, 0x11, 0xE2,
-0xB4, 0x03, 0x04, 0x91, 0x2F, 0x81, 0x04, 0x78, 0x11, 0xE2, 0xB4, 0x10, 0x17, 0x78, 0x14, 0xE2,
-0xFE, 0x18, 0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, 0x12,
-0x32, 0xAA, 0x81, 0x04, 0x78, 0x11, 0xE2, 0xB4, 0x11, 0x17, 0x78, 0x14, 0xE2, 0xFE, 0x18, 0xE2,
-0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, 0x12, 0x32, 0x06, 0x81,
-0x04, 0x78, 0x11, 0xE2, 0xF4, 0x60, 0x02, 0x81, 0x04, 0x18, 0xF2, 0x81, 0x04, 0x78, 0x15, 0x74,
-0x01, 0xF2, 0x78, 0x11, 0xE2, 0x64, 0x07, 0x60, 0x02, 0x61, 0xE9, 0x78, 0x34, 0xE2, 0xFF, 0xE4,
-0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07,
-0x78, 0x33, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0xC0, 0x04, 0xC0,
-0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x35, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12,
-0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0x78, 0x18, 0x12,
-0x4A, 0xFE, 0x78, 0x15, 0xE2, 0x70, 0x02, 0x61, 0xD2, 0x18, 0xE2, 0xFF, 0x18, 0xE2, 0xFD, 0x91,
-0x20, 0x78, 0x1C, 0x12, 0x4A, 0xFE, 0x78, 0x38, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08,
-0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x78, 0x37, 0xE2, 0xFF, 0xE4,
-0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07,
-0x78, 0x39, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0,
-0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0x78, 0x20, 0x12, 0x4A, 0xFE, 0x78, 0x20, 0x12,
-0x4A, 0xE5, 0x12, 0x20, 0x9B, 0x78, 0x1C, 0x12, 0x4A, 0xF1, 0x12, 0x4A, 0xBF, 0xC0, 0x04, 0xC0,
-0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x18, 0x12, 0x4A, 0xE5, 0x78, 0x20, 0x12, 0x4A, 0xF1, 0x12,
-0x4A, 0xBF, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0x78, 0x18, 0x12,
-0x4A, 0xFE, 0x78, 0x18, 0x12, 0x4A, 0xE5, 0x90, 0x82, 0x02, 0x12, 0x20, 0xCE, 0x78, 0x13, 0xE2,
-0xFD, 0x08, 0xE2, 0xFF, 0x12, 0x5C, 0x77, 0x80, 0x1B, 0x78, 0x13, 0xE2, 0xFF, 0x08, 0xE2, 0xFD,
-0x78, 0x11, 0xE2, 0xFB, 0x78, 0x15, 0xE2, 0x90, 0x81, 0xC1, 0xF0, 0xF1, 0xDF, 0x80, 0x05, 0x78,
-0x10, 0x74, 0x02, 0xF2, 0x78, 0x10, 0xE2, 0xFF, 0xC3, 0x94, 0x02, 0x50, 0x10, 0xEF, 0x60, 0x0A,
-0x78, 0x02, 0xE2, 0xFF, 0x18, 0xE2, 0x2F, 0xF2, 0x21, 0xCF, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22,
-0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x6B, 0xE7, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4,
-0x90, 0x81, 0x6F, 0xF0, 0x90, 0x87, 0x5F, 0xE0, 0x90, 0x81, 0x6E, 0xF0, 0xE4, 0x90, 0x81, 0x7B,
-0xF0, 0x90, 0x81, 0x6B, 0xF0, 0x90, 0x81, 0x6B, 0xE0, 0xFF, 0xC3, 0x94, 0x40, 0x50, 0x15, 0x74,
-0x7E, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0x90, 0x81, 0x6B, 0xE0,
-0x04, 0xF0, 0x80, 0xE1, 0xE4, 0x90, 0x81, 0x6B, 0xF0, 0x90, 0x81, 0x6E, 0xE0, 0xFF, 0x90, 0x81,
-0x6B, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0xA1, 0x39, 0x74, 0xDF, 0x2E, 0xF9, 0xE4, 0x34, 0x86,
-0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x0A, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x60,
-0x12, 0x2B, 0xED, 0x90, 0x81, 0x61, 0xE0, 0xFF, 0x12, 0x2F, 0x27, 0xEF, 0x04, 0x90, 0x81, 0x7B,
-0xF0, 0x90, 0x81, 0x60, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0x12, 0x31, 0xEA, 0xEF, 0x24, 0xC8, 0x90,
-0x81, 0x7D, 0xF0, 0x75, 0xF0, 0x08, 0xA4, 0xF0, 0x90, 0x81, 0x61, 0xE0, 0x54, 0x0F, 0x90, 0x81,
-0x7C, 0xF0, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x81, 0x6C, 0xF0, 0x90, 0x81, 0x6C, 0xE0, 0xFF,
-0xC3, 0x94, 0x04, 0x50, 0x57, 0x90, 0x81, 0x7C, 0xE0, 0xFE, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3,
-0x13, 0xD8, 0xFC, 0x20, 0xE0, 0x3E, 0x90, 0x81, 0x6C, 0xE0, 0x25, 0xE0, 0xFF, 0x90, 0x81, 0x7D,
-0xE0, 0x2F, 0x24, 0x7E, 0xF9, 0xE4, 0x34, 0x81, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x01, 0x90,
-0x81, 0x6A, 0xE0, 0x75, 0xF0, 0x02, 0xA4, 0x24, 0x62, 0xF9, 0x74, 0x81, 0x35, 0xF0, 0x8B, 0x13,
-0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0xD0, 0x01, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x81,
-0x6A, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x6C, 0xE0, 0x04, 0xF0, 0x80, 0x9F, 0x90, 0x81, 0x7B, 0xE0,
-0xFF, 0x90, 0x81, 0x6B, 0xE0, 0x2F, 0xF0, 0x81, 0x69, 0xE4, 0x90, 0x81, 0x6F, 0xF0, 0x90, 0x81,
-0x6F, 0xE0, 0xC3, 0x94, 0x40, 0x40, 0x02, 0xE1, 0xD5, 0xE0, 0xFF, 0x24, 0x7E, 0xF5, 0x82, 0xE4,
-0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, 0x81, 0x71, 0xF0, 0xE0, 0xFE, 0x54, 0xF0, 0xC4, 0x54, 0x0F,
-0xFD, 0x90, 0x81, 0x70, 0xF0, 0xEE, 0x54, 0x0F, 0xFE, 0xA3, 0xF0, 0x74, 0x7F, 0x2F, 0xF5, 0x82,
-0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, 0x81, 0x72, 0xF0, 0xFC, 0xEE, 0xFE, 0xEC, 0xFB, 0xEB,
-0xFF, 0x90, 0x81, 0x77, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xED, 0x12, 0x4B, 0x28, 0x65, 0xB2, 0x00,
-0x65, 0xE9, 0x01, 0x66, 0x9A, 0x02, 0x67, 0xC6, 0x03, 0x66, 0xB5, 0x04, 0x66, 0xD6, 0x05, 0x66,
-0xD6, 0x06, 0x66, 0xD6, 0x07, 0x66, 0xD6, 0x08, 0x67, 0x5A, 0x09, 0x67, 0x90, 0x0A, 0x00, 0x00,
-0x67, 0xD5, 0x90, 0x81, 0x6F, 0xE0, 0xFD, 0x24, 0x81, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83,
-0xE0, 0xFE, 0x74, 0x80, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFD, 0xED, 0xFF,
-0x90, 0x81, 0x79, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, 0xF0, 0x90, 0x81, 0x72, 0xE0, 0xFF, 0x12, 0x2F,
-0x96, 0x90, 0x81, 0x6D, 0x74, 0x02, 0xF0, 0xE1, 0xC6, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x81, 0xF5,
-0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20,
-0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x80, 0xF5,
-0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x4A, 0xCC, 0xC0,
-0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x82, 0xF5, 0x82, 0xE4,
-0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0,
-0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06,
-0xC0, 0x07, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x83, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0,
-0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x18, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01,
-0xD0, 0x00, 0x12, 0x4A, 0xCC, 0x90, 0x81, 0x73, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x73, 0x12, 0x4A,
-0xD9, 0x90, 0x85, 0x96, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x77, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12,
-0x2E, 0xE4, 0x90, 0x81, 0x6D, 0x74, 0x04, 0xF0, 0xE1, 0xC6, 0x90, 0x81, 0x72, 0xE0, 0xFD, 0x90,
-0x81, 0x6F, 0xE0, 0x24, 0x80, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF,
-0x12, 0x30, 0xC7, 0x80, 0x19, 0x90, 0x81, 0x72, 0xE0, 0xFD, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x80,
-0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0x6A, 0x90, 0x81,
-0x6D, 0x74, 0x01, 0xF0, 0xE1, 0xC6, 0x90, 0x81, 0x6D, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x6F, 0xE0,
-0x24, 0x81, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78,
-0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0x6F, 0xE0,
-0x24, 0x80, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12,
-0x4A, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0x71, 0xE0, 0xFF, 0xE4,
-0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00,
-0x12, 0x4A, 0xCC, 0x90, 0x81, 0x73, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x70, 0xE0, 0x24, 0xFB, 0xFF,
-0xC0, 0x07, 0x90, 0x81, 0x73, 0x12, 0x4A, 0xD9, 0x90, 0x82, 0x02, 0x12, 0x20, 0xCE, 0x90, 0x81,
-0x72, 0xE0, 0xFD, 0xD0, 0x07, 0x12, 0x5C, 0x77, 0x80, 0x6C, 0x90, 0x81, 0x6D, 0x74, 0x01, 0xF0,
-0x90, 0x81, 0x6F, 0xE0, 0x24, 0x80, 0xF9, 0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89,
-0x15, 0x75, 0x16, 0x01, 0x7B, 0xFE, 0x7A, 0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x72,
-0xE0, 0xFF, 0x90, 0x81, 0x71, 0xE0, 0xFD, 0xE4, 0x90, 0x81, 0xC1, 0xF0, 0x7B, 0x04, 0x80, 0x34,
-0x90, 0x81, 0x6D, 0x74, 0x04, 0xF0, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x80, 0xF9, 0xE4, 0x34, 0x81,
-0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0x7B, 0xFE, 0x7A, 0x80, 0x79, 0x33,
-0x12, 0x2B, 0xED, 0x90, 0x81, 0x72, 0xE0, 0xFF, 0x90, 0x81, 0x71, 0xE0, 0xFD, 0xE4, 0x90, 0x81,
-0xC1, 0xF0, 0x7B, 0x06, 0xF1, 0xDF, 0x90, 0x81, 0x6D, 0xE0, 0x24, 0x02, 0xFF, 0x90, 0x81, 0x6F,
-0xE0, 0x2F, 0xF0, 0xA1, 0x3E, 0x22, 0x22, 0x90, 0x00, 0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x22, 0xAC,
-0x07, 0xED, 0xAD, 0x04, 0x78, 0x24, 0xF2, 0xED, 0x08, 0xF2, 0xEB, 0xB4, 0x04, 0x07, 0x78, 0x27,
-0x74, 0x01, 0xF2, 0x80, 0x0E, 0xEB, 0x78, 0x27, 0xB4, 0x05, 0x05, 0x74, 0x02, 0xF2, 0x80, 0x03,
-0x74, 0x04, 0xF2, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x00, 0x50, 0x63, 0xE4,
-0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0x21, 0x7D,
-0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xC1, 0xE0, 0x60, 0x2D, 0x74, 0x37,
-0x2E, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xEE, 0xFF, 0x78, 0x25, 0xE2, 0x2F, 0xFF, 0x18, 0xE2, 0x34,
-0x00, 0x8F, 0x82, 0xF5, 0x83, 0xE0, 0x78, 0x29, 0xF2, 0x78, 0x32, 0xE2, 0xFF, 0xF4, 0xFE, 0x78,
-0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x24, 0x08, 0xE2, 0xFF,
-0x08, 0xE2, 0x2F, 0xFF, 0x78, 0x28, 0xE2, 0xFD, 0x12, 0x32, 0x1E, 0x78, 0x26, 0xE2, 0x04, 0xF2,
-0x80, 0xA1, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x07, 0x50, 0x69, 0xE4, 0x78,
-0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0x21, 0x7D, 0x74,
-0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xC1, 0xE0, 0x60, 0x2D, 0x78, 0x26, 0xE2,
-0xFF, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83, 0xE0, 0x78,
-0x29, 0xF2, 0x74, 0x37, 0x2F, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFF, 0xF4, 0xFE, 0x78, 0x29,
-0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x28, 0xE2, 0xFF, 0x78, 0x26,
-0xE2, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83, 0xEF, 0xF0,
-0x78, 0x26, 0xE2, 0x04, 0xF2, 0x80, 0x9B, 0x90, 0x81, 0xC1, 0xE0, 0x60, 0x0F, 0x78, 0x24, 0xE2,
-0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2D, 0x5C, 0x78, 0x2E, 0x12, 0x4A, 0xFE, 0xE4, 0x78, 0x26, 0xF2,
-0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x50, 0x5D, 0x74, 0x33, 0x2E, 0xF8, 0xE2,
-0x78, 0x28, 0xF2, 0x90, 0x81, 0xC1, 0xE0, 0x60, 0x2B, 0x78, 0x2E, 0x12, 0x4A, 0xE5, 0x78, 0x26,
-0xE2, 0xFB, 0x75, 0xF0, 0x08, 0xA4, 0xF9, 0xF8, 0x12, 0x20, 0xA8, 0x78, 0x29, 0xEF, 0xF2, 0x74,
-0x37, 0x2B, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFE, 0xF4, 0x5F, 0xFF, 0x78, 0x28, 0xE2, 0xFD,
-0xEE, 0x5D, 0x4F, 0xF2, 0x78, 0x28, 0xE2, 0xFF, 0x78, 0x26, 0xE2, 0xFD, 0xC3, 0x74, 0x03, 0x9D,
-0xFD, 0xE4, 0x94, 0x00, 0xFC, 0x7B, 0xFE, 0x74, 0x2A, 0x2D, 0xF9, 0x74, 0x80, 0x3C, 0xFA, 0xEF,
-0x12, 0x1F, 0xEA, 0xE2, 0x04, 0xF2, 0x80, 0x98, 0x78, 0x2A, 0x12, 0x4A, 0xE5, 0x90, 0x85, 0xBB,
-0x12, 0x20, 0xCE, 0x78, 0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2E, 0xA2, 0x22, 0xE4, 0xFB,
-0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x4A, 0x4E, 0x90, 0x81, 0xC2, 0xEF, 0xF0, 0x60, 0xF0, 0x31, 0x92,
-0x80, 0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90,
-0x81, 0xC3, 0xF0, 0x90, 0x81, 0xC3, 0xE0, 0xFD, 0x70, 0x02, 0x41, 0xBD, 0x90, 0x82, 0x12, 0xE0,
-0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8,
-0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02, 0x41, 0xB6, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90,
-0x01, 0xD0, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xC4, 0xF0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x81,
-0x75, 0x15, 0xC4, 0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC5, 0x12, 0x2B, 0xED, 0x90,
-0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xC6,
-0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x4B, 0x0A, 0xE0, 0x90,
-0x81, 0xC7, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x4B, 0x0A,
-0xE0, 0x90, 0x81, 0xC8, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12,
-0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xC9, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01,
-0xF1, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xCA, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04,
-0x90, 0x01, 0xF2, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xCB, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75,
-0xF0, 0x04, 0x90, 0x01, 0xF3, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xCC, 0xF0, 0x90, 0x81, 0xC3,
-0xE0, 0xFF, 0x90, 0x82, 0x12, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33,
-0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0x81, 0xC3, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0xFF, 0x74, 0x01, 0xA8,
-0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x81, 0xC5, 0xE0,
-0xFF, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC6, 0x12, 0x5A, 0xB5, 0x90, 0x82, 0x12, 0xE0, 0x04, 0xF0,
-0xE0, 0x54, 0x03, 0xF0, 0x21, 0xA3, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92,
-0xAF, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x4A, 0x4E, 0x90, 0x81, 0xD9, 0xEF, 0xF0,
-0x60, 0xF0, 0x51, 0xD6, 0x80, 0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90,
-0x80, 0xD9, 0xE0, 0xFE, 0x90, 0x80, 0xD8, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, 0x02,
-0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13, 0xED, 0x75, 0xF0,
-0x0F, 0xA4, 0x24, 0x42, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x71, 0x2E, 0x7F, 0x01,
-0xEF, 0x60, 0x16, 0x90, 0x80, 0xD8, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F,
-0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0xD8, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10,
-0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xDA, 0x12, 0x4B, 0x1F, 0x90, 0x82, 0x13, 0xE0, 0xFF,
-0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x71, 0x91, 0xEF,
-0x60, 0x3A, 0x90, 0x81, 0xDA, 0x12, 0x4B, 0x16, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00,
-0x0E, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B,
-0xED, 0x90, 0x81, 0xDA, 0x12, 0x4B, 0x16, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE,
-0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB, 0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
-0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x06, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0,
-0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x82, 0x06, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83,
-0xE0, 0x60, 0x2D, 0xC3, 0x90, 0x82, 0x09, 0xE0, 0x94, 0xE8, 0x90, 0x82, 0x08, 0xE0, 0x94, 0x03,
-0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x82, 0x08,
-0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5,
-0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0xDD, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3,
-0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, 0x81, 0xEB, 0xF0, 0x7F, 0x24, 0x7E, 0x08,
-0x12, 0x2D, 0x5C, 0x90, 0x81, 0xE3, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xDD, 0xE0, 0xFB, 0x70, 0x08,
-0x90, 0x81, 0xE3, 0x12, 0x4A, 0xD9, 0x80, 0x16, 0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5,
-0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x81,
-0xE7, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xDE, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12,
-0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xE7, 0x12, 0x4A, 0xD9,
-0xED, 0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC, 0x12, 0x4A, 0xCC, 0xEC, 0x44, 0x80, 0xFC, 0x90,
-0x81, 0xE7, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xE3, 0x12, 0x4A, 0xD9, 0xEC, 0x54, 0x7F, 0xFC, 0x90,
-0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xDD, 0xE0,
-0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3,
-0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xE7, 0x12, 0x4A, 0xD9, 0x90, 0x85, 0xBB, 0x12,
-0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xE3, 0x12, 0x4A, 0xD9, 0xEC,
-0x44, 0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2,
-0x90, 0x81, 0xDD, 0xE0, 0x70, 0x04, 0x7F, 0x20, 0x80, 0x09, 0x90, 0x81, 0xDD, 0xE0, 0xB4, 0x01,
-0x16, 0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01,
-0xFF, 0xE4, 0x90, 0x81, 0xEB, 0xEF, 0xF0, 0x90, 0x81, 0xEB, 0xE0, 0x90, 0x81, 0xDD, 0x60, 0x0E,
-0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75,
-0xF0, 0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0,
-0xFF, 0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x90, 0x81, 0xDF, 0x12, 0x20, 0xCE,
-0x90, 0x81, 0xDF, 0x02, 0x4A, 0xD9, 0x90, 0x81, 0xEC, 0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x81, 0xF2,
-0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12,
-0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xEE, 0x12, 0x4A, 0xD9,
-0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x4A, 0xCC, 0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x81, 0xF2,
-0x12, 0x20, 0xCE, 0x90, 0x81, 0xEC, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4,
-0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xF2,
-0x12, 0x4A, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2,
-0xE0, 0x44, 0x02, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x39, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD,
-0x7F, 0x54, 0x7E, 0x01, 0x8E, 0x19, 0x8F, 0x1A, 0xE5, 0x1E, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0,
-0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, 0xE5, 0x1D, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF,
-0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33, 0x54,
-0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83,
-0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, 0x1A, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x03,
-0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x22, 0xE4,
-0x90, 0x81, 0x51, 0xF0, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x81, 0x51, 0xF0, 0xE0, 0x54, 0xC0, 0x70,
-0x0D, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x4D, 0x29, 0x90, 0x81,
-0x51, 0xE0, 0x30, 0xE6, 0x21, 0x90, 0x81, 0x27, 0xE0, 0x64, 0x01, 0x70, 0x20, 0x90, 0x81, 0x2B,
-0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xF1, 0x3D,
-0x80, 0x0B, 0xD1, 0x6C, 0x80, 0x07, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x51,
-0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, 0x10, 0xB1, 0x90, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90,
-0x81, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0x01, 0x5F, 0xE4,
-0xF0, 0x90, 0x01, 0x3C, 0x74, 0x08, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13,
-0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0xB1, 0xA4, 0x90, 0x01, 0x5F,
-0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x10, 0xF0,
-0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x08, 0x12, 0x4D, 0x3D, 0xE4, 0xFF, 0x12, 0x56, 0xA8,
-0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x81, 0x51, 0xF0, 0xE0, 0xFD, 0x54, 0xC0, 0x70, 0x09, 0x90,
-0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x80, 0x71, 0xED, 0x30, 0xE6, 0x4B, 0x90, 0x81, 0x27, 0xE0,
-0x64, 0x02, 0x70, 0x2A, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC3, 0x13, 0x20, 0xE0, 0x09, 0x90, 0x81,
-0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x28, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x01, 0x70,
-0x2D, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x04, 0xF0, 0x7F, 0x01, 0xF1, 0x74, 0x80, 0x20, 0x90, 0x81,
-0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xF1,
-0x3D, 0x80, 0x0B, 0xD1, 0x6C, 0x80, 0x07, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81,
-0x51, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, 0x10, 0xB1, 0x90, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0,
-0x90, 0x81, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0x04, 0x1D,
-0xE0, 0x70, 0x14, 0x90, 0x80, 0x3E, 0xE0, 0xFF, 0xE4, 0xFD, 0x12, 0x57, 0x31, 0x8E, 0x4E, 0x8F,
-0x4F, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x14, 0x90,
-0x81, 0x27, 0xE0, 0x60, 0x0E, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0x80,
-0xCC, 0xD1, 0x6C, 0x22, 0x8F, 0x4E, 0x12, 0x77, 0x5A, 0xBF, 0x01, 0x19, 0x90, 0x80, 0x40, 0xE0,
-0xFF, 0x7D, 0x01, 0x12, 0x57, 0x31, 0xAD, 0x07, 0xAC, 0x06, 0xAF, 0x4E, 0x12, 0x56, 0xE6, 0x90,
-0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0x90, 0x81, 0x40, 0xE0, 0x30, 0xE0, 0x0C, 0xE4, 0xF5, 0x1D,
-0xA3, 0xB1, 0x9A, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x01, 0xBE, 0xE0, 0x04, 0xF0, 0x22,
-0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x18, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x12, 0x90, 0x01,
-0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xB1, 0x93, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0,
-0x22, 0x90, 0x81, 0xF6, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xAD, 0x03, 0xAC, 0x02, 0xE4, 0x90, 0x81,
-0xFE, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0xC4, 0x74, 0xD1, 0xF0, 0x74, 0x6F, 0xA3, 0xF0, 0xEC, 0x54,
-0x3F, 0xFC, 0x90, 0x01, 0x40, 0xED, 0xF0, 0xAE, 0x04, 0xEE, 0xA3, 0xF0, 0x90, 0x81, 0xF6, 0xE0,
-0x24, 0x81, 0x60, 0x34, 0x24, 0xDA, 0x60, 0x1C, 0x24, 0x3C, 0x70, 0x41, 0x90, 0x81, 0xF7, 0xE0,
-0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0x90, 0x81, 0xFB, 0xF0, 0xA3, 0x74, 0x69, 0xF0, 0xA3, 0x74,
-0x80, 0xF0, 0x80, 0x2C, 0x90, 0x81, 0xF7, 0xE0, 0x54, 0x01, 0x90, 0x81, 0xFB, 0xF0, 0xA3, 0x74,
-0xA5, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x80, 0x18, 0x90, 0x81, 0xF7, 0xE0, 0xC4, 0x54, 0x10, 0x90,
-0x81, 0xFB, 0xF0, 0xA3, 0x74, 0x7F, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0x80, 0x03, 0x7F, 0x00, 0x22,
-0x90, 0x81, 0xFC, 0xE0, 0x90, 0x01, 0x06, 0xF0, 0x90, 0x81, 0xFB, 0xE0, 0x60, 0x0E, 0x90, 0x01,
-0x42, 0xF0, 0x90, 0x81, 0xFA, 0xE0, 0x90, 0x01, 0x43, 0xF0, 0x80, 0x0D, 0x90, 0x01, 0x43, 0xE4,
-0xF0, 0x90, 0x81, 0xFB, 0xE0, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x81, 0xFD, 0xE0, 0xFF, 0x90, 0x01,
-0x42, 0xE0, 0x5F, 0xFF, 0x90, 0x81, 0xFB, 0xE0, 0x6F, 0x60, 0xEE, 0x74, 0xD1, 0x04, 0x90, 0x01,
-0xC4, 0xF0, 0x74, 0x6F, 0xA3, 0xF0, 0x90, 0x01, 0x43, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x02,
-0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80, 0x3D, 0xF0, 0x90,
-0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3E, 0xF0, 0x90, 0x00, 0x02, 0x12,
-0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF,
-0xED, 0x2F, 0x90, 0x80, 0x40, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED,
-0x2F, 0x90, 0x80, 0x41, 0xF0, 0x22, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0x30, 0xE0, 0x26,
-0x12, 0x1F, 0xA4, 0x90, 0x81, 0x38, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x39,
-0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F,
-0xBD, 0x90, 0x81, 0x3B, 0xF0, 0x22, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0,
-0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x8F, 0x0D, 0x22, 0x8F,
-0x0E, 0x22, 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, 0x32, 0x1E, 0xE4, 0xFD,
-0x7F, 0x51, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x53,
-0x02, 0x32, 0x1E, 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, 0x32, 0x1E, 0x7D,
-0xFF, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F,
-0x57, 0x02, 0x32, 0x1E, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x01, 0x9C, 0x74, 0x7E,
-0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74, 0x24, 0xF0, 0x90, 0x01, 0x9B,
-0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01, 0x99, 0xE4, 0xF0, 0x90, 0x01,
-0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x56, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x98, 0xE0, 0x7F,
-0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3E, 0xC3, 0x90, 0x81, 0x57, 0xE0,
-0x94, 0x88, 0x90, 0x81, 0x56, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x10,
-0xF0, 0x22, 0x90, 0x81, 0x56, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9, 0x7F, 0x14, 0x7E, 0x00,
-0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x57, 0xE0, 0x94, 0x32, 0x90, 0x81, 0x56, 0xE0, 0x94, 0x00,
-0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB2, 0x22, 0x7F, 0x02, 0x90, 0x81, 0x46, 0xE0,
-0xFE, 0xEF, 0xC3, 0x9E, 0x50, 0x18, 0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B,
-0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xDE, 0x7F, 0x01,
-0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, 0xA3, 0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3,
-0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, 0xF5, 0x44, 0x90, 0x01, 0x34, 0xE5, 0x41,
-0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, 0xA3, 0xE5, 0x44, 0xF0, 0x22, 0x90, 0x01,
-0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, 0x46, 0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47,
-0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, 0x01, 0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5,
-0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, 0xF0, 0x53, 0x91, 0xDF, 0x22, 0x90, 0x81,
-0x50, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x05, 0xFC,
-0xE0, 0x04, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x10, 0xA3, 0x74, 0x01, 0xF0, 0x90, 0x81,
-0x1F, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x51, 0xCF, 0x71, 0xF9, 0x02, 0x5F, 0x72, 0xD3,
-0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x04, 0x7F, 0x04, 0x80,
-0x0C, 0x12, 0x4F, 0xE3, 0xBF, 0x01, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x02, 0x12, 0x55, 0xA3,
-0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3D, 0x90, 0x81, 0x23,
-0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, 0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D, 0x00, 0xB4, 0x04,
-0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, 0x23, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x80, 0xB0, 0x71,
-0x82, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x08, 0x06, 0xE4, 0xFD, 0x7F, 0x0C, 0x80, 0x09, 0x90, 0x81,
-0x23, 0xE0, 0x70, 0x06, 0xFD, 0x7F, 0x04, 0x12, 0x4D, 0x41, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF,
-0x30, 0xE0, 0x3E, 0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, 0x7E, 0x01, 0x90, 0x81,
-0x22, 0xE0, 0x7D, 0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, 0x24, 0xEF, 0xC3, 0x13,
-0x30, 0xE0, 0x02, 0x41, 0xCF, 0x71, 0xAA, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x0C, 0x06, 0xE4, 0xFD,
-0x7F, 0x08, 0x80, 0x0A, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x04, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x4D,
-0x41, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x0F, 0x90,
-0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x07, 0x7D, 0x01, 0x7F, 0x02, 0x12, 0x4D, 0x41, 0x90, 0x81,
-0x23, 0xE0, 0x64, 0x02, 0x60, 0x03, 0x12, 0x4F, 0xC8, 0x22, 0x90, 0x01, 0x57, 0xE0, 0x60, 0x48,
-0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x54,
-0x3F, 0x30, 0xE0, 0x0C, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x22,
-0x90, 0x81, 0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x38,
-0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0E, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01,
-0x07, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x51, 0xF0, 0x90, 0x81,
-0x27, 0xE0, 0x70, 0x02, 0x81, 0xA8, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x81, 0xA8,
-0x90, 0x81, 0x26, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70,
-0x21, 0x90, 0x81, 0x2E, 0xE0, 0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, 0x90, 0x81, 0x30, 0xE0, 0x60,
-0x11, 0xEF, 0x70, 0x08, 0x90, 0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x80, 0x00, 0x90, 0x81, 0x51, 0x74,
-0x01, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x16, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05,
-0xE4, 0x90, 0x81, 0x51, 0xF0, 0x12, 0x4F, 0xE3, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x51, 0xF0, 0x90,
-0x81, 0x51, 0xE0, 0x60, 0x43, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x30, 0xE0,
-0x60, 0x03, 0xB4, 0x01, 0x09, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x80, 0x0D, 0xE4, 0xF5,
-0x1D, 0x90, 0x81, 0x30, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x81, 0x2F, 0xE0,
-0x2F, 0x12, 0x6D, 0x9B, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2,
-0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, 0x4D, 0x41, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70,
-0x26, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74,
-0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0,
-0x54, 0x07, 0x70, 0x03, 0x12, 0x4D, 0x29, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x07, 0x90, 0x81,
-0x1F, 0xE0, 0x30, 0xE0, 0x12, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x09, 0x12, 0x4F, 0xE3, 0xBF,
-0x01, 0x05, 0x02, 0x4F, 0xC8, 0x91, 0xF8, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x64, 0x01, 0x70, 0x4E,
-0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x39, 0x12, 0x4D, 0x3D, 0x90, 0x01, 0x5B, 0xE4, 0xF0,
-0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54,
-0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x6D, 0xA4, 0x90, 0x01, 0x5B,
-0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x08, 0xF0,
-0x22, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, 0x4D, 0x41, 0x22, 0x12,
-0x4F, 0xFC, 0xEF, 0x70, 0x02, 0x91, 0xF8, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x35, 0x90, 0x06,
-0x92, 0xE0, 0x30, 0xE0, 0x24, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F,
-0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x6D, 0xA4, 0x90, 0x01, 0x5B, 0x74,
-0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0,
-0x12, 0x4D, 0x29, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x35, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1,
-0x24, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB,
-0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x6D, 0xA4, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06,
-0x92, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xEF, 0xF0, 0x12, 0x4D, 0x29, 0x22,
-0xD1, 0x28, 0x90, 0x81, 0x52, 0xEF, 0xF0, 0x90, 0x81, 0x24, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01,
-0xF0, 0x80, 0x04, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x52, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01,
-0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90,
-0x81, 0x24, 0xE0, 0x30, 0xE0, 0x1A, 0x90, 0x81, 0x32, 0xE4, 0xF0, 0xA3, 0x74, 0x07, 0xF0, 0x90,
-0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x22,
-0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x53, 0xF0, 0xA3, 0xF0, 0xA3,
-0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x81,
-0x53, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x81, 0x55, 0xE0, 0x94, 0x64, 0x90, 0x81,
-0x54, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x53,
-0xE0, 0xFF, 0x22, 0x90, 0x81, 0x54, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9, 0x80, 0xC2, 0x90,
-0x81, 0x4F, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x05,
-0xFD, 0xE0, 0x04, 0xF0, 0x22, 0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03,
-0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25, 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, 0x4D, 0x29, 0xE4, 0xFF, 0x90, 0x81, 0x4A, 0xE0,
-0x30, 0xE0, 0x48, 0x90, 0x81, 0x4E, 0xE0, 0xFD, 0x60, 0x41, 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, 0x81, 0x4E, 0xF0, 0x22, 0x90, 0x81, 0x4C, 0xE0, 0xD3, 0x9D,
-0x50, 0x10, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0xF1, 0x0C, 0x90, 0x81, 0x4A, 0xE0, 0x54, 0xFE,
-0xF0, 0x22, 0x12, 0x56, 0xA6, 0x90, 0x81, 0x4E, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80, 0x3C, 0xE0,
-0x64, 0x02, 0x60, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0,
-0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04,
-0xE0, 0xE0, 0x90, 0x81, 0x25, 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, 0x81, 0x27,
-0xE0, 0x60, 0x03, 0x12, 0x4D, 0x29, 0x7F, 0x01, 0xC1, 0xBC, 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, 0xC3, 0xEE, 0x94, 0x01, 0x40, 0x0A, 0x0D, 0xED,
-0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 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, 0xEF, 0x14,
-0x90, 0x05, 0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F,
-0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE,
-0xF0, 0x22, 0x74, 0x45, 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, 0x82, 0x1B, 0xED, 0xF0, 0x90, 0x82, 0x1A, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70,
-0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90,
-0x00, 0x47, 0xE0, 0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x1A, 0xE0, 0xFF, 0x74,
-0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F,
-0xFD, 0x7F, 0x46, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x1B, 0xE0, 0x60, 0x18, 0x90, 0x82, 0x1A, 0xE0,
-0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45,
-0xE0, 0x4F, 0x80, 0x17, 0x90, 0x82, 0x1A, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02,
-0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E,
-0x90, 0x82, 0x1A, 0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08,
-0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43,
-0x12, 0x32, 0x1E, 0x90, 0x82, 0x1A, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3,
-0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90,
-0x82, 0x1B, 0xE0, 0x60, 0x1D, 0x90, 0x82, 0x1A, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07,
-0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42,
-0x80, 0x1C, 0x90, 0x82, 0x1A, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02,
-0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32,
-0x1E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, 0x81, 0x27, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x26,
-0xE0, 0x54, 0x0F, 0xF0, 0x54, 0xF0, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xF7,
-0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x2D, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x24, 0xE0,
-0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x2F,
-0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x2B,
-0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x29, 0x74, 0x0C, 0xF0, 0x90, 0x81,
-0x24, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54,
-0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0,
-0x90, 0x81, 0x34, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0x90, 0x80, 0x3C, 0xE0, 0xB4, 0x01,
-0x08, 0x90, 0x81, 0x31, 0x74, 0x99, 0xF0, 0x80, 0x12, 0x90, 0x80, 0x3C, 0xE0, 0x90, 0x81, 0x31,
-0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80, 0x03, 0x74, 0x40, 0xF0, 0x90, 0x81, 0x38, 0x74, 0x01,
-0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0,
-0xE4, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF,
-0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0C,
-0x04, 0x70, 0x28, 0x90, 0x81, 0x2D, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, 0x90,
-0x81, 0x3B, 0xE0, 0x90, 0x81, 0x2D, 0xF0, 0x80, 0x05, 0x90, 0x81, 0x2D, 0xED, 0xF0, 0x90, 0x81,
-0x2D, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x12, 0x4F, 0xFC, 0xEF,
-0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x2B, 0xE0,
-0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x29,
-0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF,
-0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x38, 0x90, 0x81, 0x2B, 0xE0, 0x30,
-0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, 0x29, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13,
-0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x3E,
-0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x80, 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, 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, 0x42, 0x90, 0x80, 0xDE,
-0xE0, 0x64, 0x01, 0x70, 0x3A, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x05, 0x22, 0x74,
-0x0F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF, 0x12, 0x56, 0xA8, 0xBF, 0x01,
-0x12, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x06, 0xF0, 0x90, 0x81,
-0x23, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22,
-0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x02, 0xF0, 0x90, 0x05, 0x27, 0xE0,
-0x54, 0xBF, 0xF0, 0x90, 0x81, 0x23, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90,
-0x81, 0x2A, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x23, 0x74,
-0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x52, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x59, 0x90, 0x80,
-0xDE, 0xE0, 0x64, 0x01, 0x70, 0x51, 0x90, 0x81, 0x52, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x2E, 0xF0,
-0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x16, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90,
-0x81, 0x52, 0xF0, 0x12, 0x4F, 0xE3, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x52, 0xF0, 0x90, 0x81, 0x52,
-0xE0, 0x60, 0x24, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x2F,
-0x12, 0x6D, 0x9A, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07,
-0x7D, 0x01, 0x7F, 0x04, 0x12, 0x4D, 0x41, 0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x54,
-0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54,
-0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x81, 0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54,
-0xEF, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0xFF, 0xB4, 0x01, 0x02, 0x80, 0x04, 0xEF, 0xB4, 0x02, 0x06,
-0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3,
-0x9F, 0x40, 0x0F, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x0B, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB,
-0xF0, 0x22, 0x12, 0x4D, 0x29, 0x22, 0x22, 0x90, 0x05, 0x2B, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02,
-0x7F, 0x01, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90,
-0x81, 0x22, 0x74, 0x01, 0xF0, 0x22, 0x91, 0x03, 0x02, 0x57, 0xE5, 0x90, 0x05, 0x22, 0x74, 0xFF,
-0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, 0x90,
-0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x22, 0x04, 0xF0, 0x22, 0x91, 0x2F, 0x02, 0x57, 0xE5, 0x90,
-0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74,
-0x04, 0xF0, 0x22, 0x90, 0x81, 0x22, 0xE0, 0x64, 0x02, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22,
-0x90, 0x80, 0x3F, 0xE0, 0xFF, 0x7D, 0x01, 0x12, 0x57, 0x31, 0x8E, 0x54, 0x8F, 0x55, 0xAD, 0x55,
-0xAC, 0x54, 0xAF, 0x53, 0x12, 0x56, 0xE6, 0xAF, 0x55, 0xAE, 0x54, 0x90, 0x04, 0x80, 0xE0, 0x54,
-0x0F, 0xFD, 0xAC, 0x07, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44,
-0x01, 0xF0, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0,
-0xAC, 0x07, 0x74, 0x16, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0,
-0x74, 0x15, 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, 0x0F, 0xF0, 0x90, 0x04,
-0x53, 0xE4, 0xF0, 0x90, 0x04, 0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50,
-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,
-0x80, 0x3F, 0xE0, 0xFE, 0x90, 0x04, 0x1C, 0xE0, 0x6E, 0x70, 0x40, 0x90, 0x81, 0x2A, 0xE0, 0xFE,
-0x64, 0x0E, 0x70, 0x1C, 0xEF, 0x70, 0x34, 0x90, 0x81, 0x24, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06,
-0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x22,
-0xEE, 0xB4, 0x06, 0x17, 0xEF, 0x60, 0x14, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06,
-0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0xC3,
-0x13, 0xFD, 0xEF, 0x30, 0xE0, 0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06, 0x22,
-0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x80, 0xDB, 0xE0, 0x9B,
-0x90, 0x80, 0xDA, 0xE0, 0x9A, 0x50, 0x13, 0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0xDA, 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, 0x12, 0x1F,
-0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x47, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13,
-0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x48, 0xF0, 0x22, 0x90, 0x81,
-0x4A, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x81, 0x4D, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x81, 0x4B,
-0xE0, 0xB5, 0x07, 0x1E, 0x90, 0x06, 0x92, 0xE0, 0x54, 0x1C, 0x70, 0x0B, 0x12, 0x56, 0xA6, 0x90,
-0x81, 0x4E, 0xE0, 0x04, 0xF0, 0x80, 0x06, 0x90, 0x06, 0x92, 0x74, 0x1C, 0xF0, 0xE4, 0x90, 0x81,
-0x4D, 0xF0, 0x22, 0x00, 0x74, 0x53,
-};
-u4Byte ArrayLength_MP_8188E_FW_NIC_S = 15894;
-
-
-void
-ODM_ReadFirmware_MP_8188E_FW_NIC_S(
- 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_8188E_FW_NIC_S;
-#else
- ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_NIC_S, ArrayLength_MP_8188E_FW_NIC_S);
-#endif
- *pFirmwareSize = ArrayLength_MP_8188E_FW_NIC_S;
-}
-
-
-u1Byte Array_MP_8188E_FW_NIC_T[] = {
-0xE1, 0x88, 0x10, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x01, 0x21, 0x11, 0x27, 0x30, 0x36, 0x00, 0x00,
-0x2D, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x02, 0x45, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xC1, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xA1, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x56, 0xF7, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x42, 0x04, 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, 0x89, 0xF8, 0xE6, 0xBC, 0x03, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00,
-0x40, 0xCE, 0x79, 0x04, 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, 0x04, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30,
-0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x88, 0x25, 0x0C, 0xF8,
-0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8,
-0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5,
-0x0C, 0x24, 0x89, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD,
-0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x88,
-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, 0x88, 0xA6,
-0x81, 0x74, 0x03, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x04, 0xE4, 0x78, 0x80,
-0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x45, 0xDE, 0x74, 0x01, 0x93,
-0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2,
-0x8C, 0xD2, 0xAF, 0x22, 0x03, 0xEF, 0xD3, 0x94, 0x03, 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, 0x88, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18,
-0xBE, 0x03, 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, 0x88, 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, 0x88, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F,
-0x04, 0x90, 0x45, 0xDE, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3,
-0x94, 0x03, 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, 0x88, 0x2F,
-0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x42, 0x4D, 0x50, 0x2E, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xBF, 0x03,
-0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x88, 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, 0x89, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01,
-0x0F, 0x74, 0x88, 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, 0x03, 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, 0x42, 0x4C, 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, 0x42, 0x4D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF,
-0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0,
-0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 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, 0xE2, 0xFC, 0x08, 0xE2, 0xFD, 0x08, 0xE2, 0xFE, 0x08, 0xE2, 0xFF,
-0x22, 0xE2, 0xFB, 0x08, 0xE2, 0xF9, 0x08, 0xE2, 0xFA, 0x08, 0xE2, 0xCB, 0xF8, 0x22, 0xEC, 0xF2,
-0x08, 0xED, 0xF2, 0x08, 0xEE, 0xF2, 0x08, 0xEF, 0xF2, 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, 0x45,
-0x8C, 0x02, 0x42, 0xDD, 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, 0x45, 0xD1, 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, 0x00, 0x41, 0x82, 0x09, 0x00, 0x41, 0x82, 0x0A, 0x00, 0x41, 0x82, 0x17, 0x00, 0x59, 0xE2,
-0x5C, 0x24, 0x5E, 0x5D, 0x5F, 0xA1, 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, 0x90, 0x01, 0xC4, 0x74, 0xE6, 0xF0, 0x74, 0x45, 0xA3, 0xF0, 0xD1, 0x35, 0x74,
-0xE6, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x45, 0xA3, 0xF0, 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, 0x00, 0x54, 0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55,
-0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5, 0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD,
-0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F,
-0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57, 0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 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, 0x90, 0x01, 0xC4, 0x74,
-0x6F, 0xF0, 0x74, 0x46, 0xA3, 0xF0, 0x12, 0x6C, 0x78, 0xE5, 0x41, 0x30, 0xE4, 0x04, 0x7F, 0x02,
-0x91, 0x27, 0xE5, 0x41, 0x30, 0xE6, 0x03, 0x12, 0x6C, 0xD5, 0xE5, 0x43, 0x30, 0xE0, 0x03, 0x12,
-0x51, 0xC2, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x4D, 0x0C, 0xE5, 0x43, 0x30, 0xE2, 0x03, 0x12,
-0x4C, 0xC1, 0xE5, 0x43, 0x30, 0xE3, 0x03, 0x12, 0x6C, 0xE2, 0xE5, 0x43, 0x30, 0xE4, 0x03, 0x12,
-0x6D, 0x04, 0xE5, 0x43, 0x30, 0xE5, 0x03, 0x12, 0x6D, 0x33, 0xE5, 0x43, 0x30, 0xE6, 0x02, 0xF1,
-0x0F, 0xE5, 0x44, 0x30, 0xE1, 0x03, 0x12, 0x51, 0x7F, 0x74, 0x6F, 0x04, 0x90, 0x01, 0xC4, 0xF0,
-0x74, 0x46, 0xA3, 0xF0, 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,
-0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x13, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0D, 0x90, 0x81, 0x2B, 0xE0,
-0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, 0xF1, 0x2A, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x90, 0x81,
-0x29, 0x30, 0xE0, 0x05, 0xE0, 0xFF, 0x02, 0x74, 0x8F, 0xE0, 0xFF, 0x7D, 0x01, 0xD3, 0x10, 0xAF,
-0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x13, 0xED, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x90, 0x82, 0x14,
-0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x03, 0x02, 0x48,
-0xA0, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x03, 0x02, 0x48, 0xA0, 0x90, 0x82,
-0x14, 0xE0, 0xFE, 0x6F, 0x70, 0x03, 0x02, 0x48, 0xA0, 0xEF, 0x70, 0x03, 0x02, 0x48, 0x17, 0x24,
-0xFE, 0x70, 0x03, 0x02, 0x48, 0x50, 0x24, 0xFE, 0x60, 0x51, 0x24, 0xFC, 0x70, 0x03, 0x02, 0x48,
-0x8B, 0x24, 0xFC, 0x60, 0x03, 0x02, 0x48, 0xA0, 0xEE, 0xB4, 0x0E, 0x03, 0x12, 0x49, 0x5E, 0x90,
-0x82, 0x14, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12, 0x49, 0x93, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06,
-0x03, 0x12, 0x49, 0x34, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0x82, 0x13, 0xE0, 0xFF,
-0x60, 0x05, 0x12, 0x73, 0x75, 0x80, 0x03, 0x12, 0x66, 0x26, 0x90, 0x82, 0x14, 0xE0, 0x64, 0x08,
-0x60, 0x03, 0x02, 0x48, 0xA0, 0x12, 0x73, 0xD3, 0x02, 0x48, 0xA0, 0x90, 0x82, 0x14, 0xE0, 0x70,
-0x05, 0x7F, 0x01, 0x12, 0x49, 0x93, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, 0x03, 0x12, 0x49, 0x34,
-0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x09, 0x12, 0x48, 0xA5, 0xBF, 0x01, 0x03, 0x12, 0x49, 0x5E,
-0x90, 0x82, 0x14, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0x01, 0xA0, 0x11, 0xA5, 0xEF, 0x64, 0x01, 0x60,
-0x02, 0x01, 0xA0, 0x11, 0xFA, 0x01, 0xA0, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x07, 0x11, 0xA5,
-0xBF, 0x01, 0x02, 0x31, 0x5E, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, 0x02, 0x31, 0x34, 0x90, 0x82,
-0x14, 0xE0, 0xB4, 0x0C, 0x07, 0x11, 0xA5, 0xBF, 0x01, 0x02, 0x11, 0xFA, 0x90, 0x82, 0x14, 0xE0,
-0x64, 0x04, 0x70, 0x5C, 0x12, 0x72, 0xF5, 0xEF, 0x64, 0x01, 0x70, 0x54, 0x31, 0xBE, 0x80, 0x50,
-0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x07, 0x11, 0xA5, 0xBF, 0x01, 0x02, 0x31, 0x5E, 0x90, 0x82,
-0x14, 0xE0, 0xB4, 0x06, 0x02, 0x31, 0x34, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0C, 0x07, 0x11, 0xA5,
-0xBF, 0x01, 0x02, 0x11, 0xFA, 0x90, 0x82, 0x14, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x31, 0x93, 0x90,
-0x82, 0x14, 0xE0, 0xB4, 0x04, 0x1A, 0x12, 0x73, 0xBB, 0x80, 0x15, 0x90, 0x82, 0x14, 0xE0, 0xB4,
-0x0C, 0x0E, 0x90, 0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0x31, 0xB1,
-0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD1, 0xAB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74,
-0x01, 0xF0, 0x80, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0,
-0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x28, 0xEF, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x08,
-0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x29, 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, 0x80, 0xDE, 0xE0, 0x64, 0x01,
-0x70, 0x31, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x7F,
-0x01, 0xF1, 0x0D, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A,
-0x74, 0x0E, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01,
-0xB8, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x25, 0xE0, 0x90, 0x06, 0x04, 0x20, 0xE0, 0x0C, 0xE0, 0x44,
-0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x80, 0x0E, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81,
-0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x81,
-0x25, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x08, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x80, 0x1E, 0x90,
-0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0,
-0x90, 0x05, 0x27, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x23, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x22,
-0xE4, 0xF0, 0x22, 0x90, 0x82, 0x15, 0xEF, 0xF0, 0x12, 0x54, 0x65, 0x90, 0x82, 0x15, 0xE0, 0x60,
-0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x90, 0x81, 0x23, 0xF0,
-0x22, 0x31, 0xE3, 0x90, 0x81, 0x2A, 0x74, 0x08, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x05,
-0x22, 0x74, 0xFF, 0xF0, 0xF1, 0x3A, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x51,
-0x57, 0x31, 0xE3, 0xE4, 0x90, 0x81, 0x2A, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x05, 0x22,
-0x74, 0xFF, 0xF0, 0xF1, 0x3A, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F,
-0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14,
-0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00,
-0x00, 0xE4, 0xFD, 0xFF, 0x12, 0x55, 0x1C, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44,
-0x80, 0xFC, 0x90, 0x82, 0x05, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x05, 0x12, 0x44, 0xD9, 0x90, 0x85,
-0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F,
-0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x01,
-0x34, 0x74, 0x40, 0xF0, 0xFD, 0xE4, 0xFF, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74,
-0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01,
-0xC3, 0xC0, 0xD0, 0xE4, 0x90, 0x81, 0xCB, 0xF0, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90,
-0x81, 0x1F, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F,
-0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81,
-0x1F, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE,
-0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x1F, 0xF0, 0xEE, 0x54, 0x20, 0xFE,
-0xEF, 0x54, 0xDF, 0x4E, 0xF0, 0x12, 0x1F, 0xA4, 0xC3, 0x13, 0x20, 0xE0, 0x02, 0x61, 0x5E, 0x90,
-0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x6D, 0x90, 0x81, 0xCB, 0x74, 0x21, 0xF0, 0xEF, 0x13, 0x13,
-0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x51, 0x4E, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x08, 0xF0, 0x80, 0x0C,
-0xE4, 0x90, 0x81, 0x20, 0xF0, 0xA3, 0xF0, 0x7D, 0x40, 0xFF, 0x91, 0x26, 0x90, 0x81, 0x1F, 0xE0,
-0xFD, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x12, 0xF0,
-0xED, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x14, 0xF0, 0x90, 0x81,
-0x1F, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x80, 0xF0,
-0x90, 0x81, 0xCB, 0xE0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x22, 0xE0, 0x60, 0x02, 0x81, 0x17,
-0x7F, 0x01, 0x80, 0x15, 0x90, 0x81, 0xCB, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81,
-0x22, 0xE0, 0x64, 0x04, 0x60, 0x02, 0x81, 0x17, 0xFF, 0x12, 0x53, 0x0E, 0x81, 0x17, 0x90, 0x81,
-0x1F, 0xE0, 0xFF, 0x20, 0xE0, 0x02, 0x61, 0xE7, 0x90, 0x81, 0xCB, 0x74, 0x31, 0xF0, 0xEF, 0x13,
-0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x51, 0x4E, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x08, 0xF0, 0x80,
-0x06, 0x7D, 0x40, 0xE4, 0xFF, 0x91, 0x26, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x13, 0x13, 0x13, 0x54,
-0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x02, 0xF0, 0xED, 0xC4, 0x54, 0x0F, 0x30,
-0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x81, 0xCB, 0xE0, 0x90, 0x05, 0x27,
-0xF0, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x70, 0x1D, 0xFD, 0x7F, 0x04, 0x12, 0x47, 0x3D, 0x12,
-0x51, 0x73, 0xBF, 0x01, 0x09, 0x90, 0x81, 0x29, 0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x03, 0xE4, 0xFD,
-0xFF, 0x12, 0x47, 0x3D, 0x80, 0x41, 0x90, 0x81, 0x2A, 0xE0, 0x90, 0x81, 0x23, 0xF0, 0x90, 0x05,
-0x27, 0xE0, 0x44, 0x40, 0xF0, 0x80, 0x30, 0x90, 0x81, 0xCB, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27,
-0xF0, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x06, 0x7D, 0x01, 0x7F, 0x04, 0x80, 0x0B, 0x90, 0x81,
-0x23, 0xE0, 0xB4, 0x08, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0xD1, 0x34, 0x90, 0x81,
-0x29, 0x12, 0x47, 0x39, 0x12, 0x5A, 0xA7, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7D, 0x02, 0x7F, 0x02,
-0x91, 0x26, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE,
-0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xEF, 0x70,
-0x37, 0x7D, 0x78, 0x7F, 0x02, 0x91, 0x26, 0x7D, 0x02, 0x7F, 0x03, 0x91, 0x26, 0x7D, 0xC8, 0x7F,
-0x02, 0x12, 0x71, 0x8F, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x7D,
-0x01, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0,
-0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, 0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74,
-0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x51, 0x57, 0x7D, 0x02, 0x7F, 0x03, 0x51, 0x57, 0x90, 0x06, 0x0A,
-0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x80, 0xDE,
-0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20,
-0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, 0x47, 0x3D, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0,
-0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x08, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60,
-0x3A, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x04, 0xEF, 0x30, 0xE0, 0x0A, 0x90, 0x81, 0x2A, 0xE0, 0x64,
-0x02, 0x60, 0x28, 0xB1, 0x83, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0,
-0x14, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0xF1, 0xCD, 0x91, 0x1C, 0x90,
-0x81, 0x2E, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0,
-0x30, 0xE0, 0x06, 0x90, 0x81, 0x21, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x45, 0x90,
-0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0,
-0x30, 0xE4, 0x0B, 0x91, 0x1C, 0x90, 0x81, 0x2D, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x82,
-0x0B, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0xC3, 0x90, 0x82, 0x0C, 0xE0, 0x94, 0x80, 0x90,
-0x82, 0x0B, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0,
-0xE0, 0x44, 0x01, 0xF0, 0x12, 0x75, 0xF8, 0xD1, 0xD6, 0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x0C,
-0xE4, 0xF5, 0x1D, 0xA3, 0xF1, 0xFB, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x01, 0xBE, 0xE0,
-0x04, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xC1, 0x23, 0x90, 0x81, 0x27,
-0xE0, 0x70, 0x02, 0xC1, 0x23, 0x90, 0x81, 0x26, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x22,
-0x90, 0x06, 0xAB, 0xE0, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x90, 0x81, 0x2D, 0xF0,
-0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x81, 0x2D, 0xE0, 0xFE, 0xFF, 0x80, 0x00, 0x90, 0x81, 0x2E,
-0xEF, 0xF0, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81,
-0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74,
-0x02, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x26, 0xE0,
-0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0,
-0x05, 0x12, 0x6D, 0xF2, 0x80, 0x03, 0x12, 0x6E, 0xC9, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13,
-0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x04, 0xF1,
-0xCD, 0x91, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x07, 0x90, 0x81, 0x25, 0xE0,
-0x44, 0x04, 0xF0, 0x22, 0xD1, 0xAB, 0xEF, 0x70, 0x02, 0xD1, 0x3C, 0x22, 0x90, 0x81, 0x27, 0xE0,
-0x64, 0x01, 0x70, 0x66, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x51, 0x90, 0x81, 0x2A, 0xE0,
-0x70, 0x03, 0xFF, 0x31, 0x93, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x03, 0x12, 0x66, 0x26,
-0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xD1, 0xAB, 0xEF, 0x64, 0x01,
-0x60, 0x38, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4,
-0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x50, 0x05, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90,
-0x06, 0x92, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x81, 0x2A,
-0xE0, 0x70, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, 0x47, 0x3D, 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, 0x12, 0x50, 0x60, 0x90, 0x81, 0x2D, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0,
-0x7D, 0x02, 0x7F, 0x02, 0x51, 0x57, 0x90, 0x81, 0x42, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x80, 0xDE,
-0xE0, 0xB4, 0x01, 0x26, 0x90, 0x82, 0x17, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x81,
-0x44, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x82, 0x17, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0xFF, 0x90, 0x81,
-0x43, 0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0xF1, 0x0B, 0x22, 0xE4, 0xFF, 0x8F, 0x53, 0x90,
-0x04, 0x1D, 0xE0, 0x60, 0x19, 0x90, 0x05, 0x22, 0xE0, 0xF5, 0x56, 0x74, 0xFF, 0xF0, 0xF1, 0x3A,
-0xBF, 0x01, 0x03, 0x12, 0x74, 0xFB, 0x90, 0x05, 0x22, 0xE5, 0x56, 0xF0, 0x80, 0x03, 0x12, 0x74,
-0xFB, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x82, 0x0F, 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, 0x82, 0x10, 0xE0, 0x94, 0xE8, 0x90, 0x82, 0x0F,
-0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F,
-0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x0F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9,
-0x80, 0xBF, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, 0xF0,
-0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x10,
-0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x22,
-0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x1F,
-0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0xEF, 0x14, 0x90,
-0x05, 0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F, 0xF8,
-0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0,
-0x22, 0xE0, 0x44, 0x02, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x39, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB,
-0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x8E, 0x19, 0x8F, 0x1A, 0xE5, 0x1E, 0x54, 0x07, 0xC4, 0x33, 0x54,
-0xE0, 0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, 0xE5, 0x1D, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0,
-0xFF, 0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33,
-0x54, 0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0x85, 0x1A, 0x82, 0x85, 0x19,
-0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, 0x1A, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74,
-0x03, 0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x22,
-0xE4, 0x90, 0x81, 0x4D, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x58, 0x90, 0x80, 0xDE, 0xE0, 0x64,
-0x01, 0x70, 0x50, 0x90, 0x81, 0x4D, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x81, 0x1F,
-0xE0, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0x81, 0x4D, 0xF0,
-0x31, 0x73, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x4D, 0xF0, 0x90, 0x81, 0x4D, 0xE0, 0x60, 0x24, 0x90,
-0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x2F, 0x12, 0x4F, 0xFB, 0x90,
-0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07, 0x7D, 0x01, 0x7F, 0x04,
-0x12, 0x47, 0x3D, 0x22, 0xE4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x02, 0x21,
-0x72, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x21, 0x72, 0x90, 0x81, 0x26, 0xE0, 0xFF,
-0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x21, 0x90, 0x81, 0x2E, 0xE0,
-0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, 0x90, 0x81, 0x30, 0xE0, 0x60, 0x11, 0xEF, 0x70, 0x08, 0x90,
-0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x80, 0x00, 0x90, 0x81, 0x4C, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x1F,
-0xE0, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0x81, 0x4C, 0xF0,
-0x31, 0x73, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x81, 0x4C, 0xE0, 0x60, 0x43, 0x90,
-0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0x60, 0x03, 0xB4, 0x01, 0x09, 0xE4,
-0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x80, 0x0D, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x75,
-0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x81, 0x2F, 0xE0, 0x2F, 0x12, 0x4F, 0xFC, 0x90, 0x01,
-0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12,
-0x47, 0x3D, 0x22, 0x90, 0x05, 0x43, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90,
-0x81, 0x27, 0xE0, 0x70, 0x07, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x11, 0x90, 0x81, 0x1F, 0xE0,
-0x30, 0xE0, 0x07, 0x31, 0x73, 0xBF, 0x01, 0x05, 0x41, 0x5B, 0x12, 0x4E, 0x3C, 0x22, 0xD3, 0x10,
-0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x04, 0x7F, 0x04, 0x80, 0x0B,
-0x31, 0x73, 0xBF, 0x01, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x02, 0x71, 0x0E, 0xD0, 0xD0, 0x92,
-0xAF, 0x22, 0x90, 0x81, 0x4B, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x02,
-0xF0, 0x90, 0x05, 0xFC, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x10, 0xA3, 0x74,
-0x01, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x31, 0x9E, 0x11, 0xC4,
-0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x07, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90,
-0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3D, 0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02,
-0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D, 0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70,
-0x23, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x21, 0x9E, 0x51, 0x45, 0x90, 0x81, 0x23, 0xE0, 0xB4,
-0x08, 0x06, 0xE4, 0xFD, 0x7F, 0x0C, 0x80, 0x09, 0x90, 0x81, 0x23, 0xE0, 0x70, 0x06, 0xFD, 0x7F,
-0x04, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x0F, 0x90, 0x81, 0x23, 0xE0,
-0x64, 0x02, 0x60, 0x07, 0x7D, 0x01, 0x7F, 0x02, 0x12, 0x47, 0x3D, 0x90, 0x81, 0x27, 0xE0, 0x64,
-0x02, 0x60, 0x14, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x0C, 0x12, 0x4E, 0xAB, 0xEF, 0x70,
-0x06, 0xFD, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3F,
-0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, 0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D,
-0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, 0x25, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02,
-0x21, 0x9E, 0x12, 0x74, 0xAC, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x0C, 0x06, 0xE4, 0xFD, 0x7F, 0x08,
-0x80, 0x0A, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x04, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x47, 0x3D, 0x22,
-0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x12, 0x1F, 0xA4,
-0xFF, 0x90, 0x81, 0x1E, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x90, 0x00,
-0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x21, 0x80, 0x1D, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16,
-0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x20, 0xE0,
-0x06, 0xE4, 0xFF, 0x71, 0x0E, 0x80, 0x02, 0x31, 0x9E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10,
-0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x22, 0xE0, 0x90, 0x82, 0x16, 0xF0, 0x6F, 0x70, 0x02,
-0x81, 0x04, 0xEF, 0x14, 0x60, 0x3E, 0x14, 0x60, 0x62, 0x14, 0x70, 0x02, 0x61, 0xB8, 0x14, 0x70,
-0x02, 0x61, 0xDF, 0x24, 0x04, 0x60, 0x02, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04,
-0x04, 0x91, 0x41, 0x81, 0x04, 0xEF, 0xB4, 0x02, 0x04, 0x91, 0x50, 0x81, 0x04, 0x90, 0x82, 0x16,
-0xE0, 0xFF, 0xB4, 0x03, 0x04, 0x91, 0x54, 0x81, 0x04, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x81, 0x04,
-0x91, 0x43, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, 0x04, 0x91, 0xF3, 0x81, 0x04,
-0xEF, 0xB4, 0x02, 0x04, 0x91, 0x58, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x03, 0x04,
-0x91, 0xE8, 0x81, 0x04, 0xEF, 0x70, 0x7D, 0x91, 0x2B, 0x80, 0x79, 0x90, 0x82, 0x16, 0xE0, 0xB4,
-0x04, 0x05, 0x12, 0x74, 0x60, 0x80, 0x6D, 0x90, 0x82, 0x16, 0xE0, 0xB4, 0x01, 0x04, 0x91, 0x21,
-0x80, 0x62, 0x90, 0x82, 0x16, 0xE0, 0xB4, 0x03, 0x05, 0x12, 0x74, 0x71, 0x80, 0x56, 0x90, 0x82,
-0x16, 0xE0, 0x70, 0x50, 0x91, 0x1F, 0x80, 0x4C, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, 0x05,
-0x12, 0x74, 0x4C, 0x80, 0x3F, 0xEF, 0xB4, 0x01, 0x04, 0x91, 0x34, 0x80, 0x37, 0xEF, 0xB4, 0x02,
-0x04, 0x91, 0xDF, 0x80, 0x2F, 0x90, 0x82, 0x16, 0xE0, 0x70, 0x29, 0x91, 0x32, 0x80, 0x25, 0x90,
-0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x03, 0x05, 0x12, 0x74, 0x7B, 0x80, 0x18, 0xEF, 0xB4, 0x01, 0x04,
-0x91, 0x0B, 0x80, 0x10, 0xEF, 0xB4, 0x02, 0x04, 0xB1, 0x06, 0x80, 0x08, 0x90, 0x82, 0x16, 0xE0,
-0x70, 0x02, 0x91, 0x09, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x91, 0x2B, 0x90, 0x05, 0x22, 0x74, 0x6F,
-0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0x91,
-0x2B, 0x12, 0x49, 0xDD, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81, 0x22, 0x74, 0x01,
-0xF0, 0x22, 0x91, 0x2B, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0,
-0x22, 0x91, 0xF3, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0x90, 0x81, 0x22, 0xF0, 0x22,
-0x91, 0x58, 0x80, 0xEF, 0x91, 0xE8, 0x80, 0xEB, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90,
-0x81, 0x22, 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, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54, 0x7F, 0xFC,
-0x90, 0x82, 0x01, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x01, 0x12, 0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12,
-0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC,
-0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA,
-0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xF9, 0x12, 0x20,
-0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0xB1, 0x1C, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x91,
-0x65, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x22,
-0x04, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90,
-0x81, 0x22, 0x74, 0x01, 0xF0, 0x22, 0x91, 0x65, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05,
-0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01,
-0xC3, 0xC0, 0xD0, 0xC0, 0x07, 0xC0, 0x05, 0x90, 0x81, 0xF9, 0x12, 0x44, 0xD9, 0x90, 0x81, 0xE5,
-0x12, 0x20, 0xCE, 0xD0, 0x05, 0xD0, 0x07, 0x12, 0x60, 0xF5, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90,
-0x81, 0xC8, 0x12, 0x45, 0x1F, 0xEF, 0x12, 0x45, 0x28, 0x55, 0x71, 0x00, 0x55, 0x7A, 0x01, 0x55,
-0x83, 0x02, 0x55, 0x8B, 0x03, 0x55, 0x94, 0x04, 0x55, 0x9C, 0x20, 0x55, 0xA4, 0x21, 0x55, 0xAD,
-0x23, 0x55, 0xB5, 0x24, 0x55, 0xBE, 0x25, 0x55, 0xC7, 0x26, 0x55, 0xCF, 0xC0, 0x00, 0x00, 0x55,
-0xD8, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6A, 0xB0, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16,
-0x02, 0x65, 0x81, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x41, 0xC0, 0x90, 0x81, 0xC8, 0x12, 0x45,
-0x16, 0x02, 0x75, 0xD8, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x80, 0x44, 0x90, 0x81, 0xC8, 0x12,
-0x45, 0x16, 0xC1, 0x4B, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6A, 0xF8, 0x90, 0x81, 0xC8,
-0x12, 0x45, 0x16, 0xE1, 0xE1, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x4A, 0x6C, 0x90, 0x81,
-0xC8, 0x12, 0x45, 0x16, 0x02, 0x6B, 0x3E, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x80, 0x3E, 0x90,
-0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6B, 0x4E, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22,
-0x12, 0x5A, 0x4B, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x45, 0xE0, 0x54, 0xFE,
-0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81,
-0x46, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x47, 0xF0, 0x22, 0x12, 0x1F, 0xA4,
-0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12,
-0x1F, 0xBD, 0xFE, 0x90, 0x05, 0x54, 0xE0, 0xC3, 0x9E, 0x90, 0x81, 0x40, 0xF0, 0xEF, 0x20, 0xE0,
-0x07, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0x01, 0x90, 0x01,
-0xBC, 0xF0, 0x90, 0x81, 0x40, 0xE0, 0x90, 0x01, 0xBD, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54,
-0x7F, 0x90, 0x81, 0x27, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00,
-0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x81, 0x26, 0xE0, 0x54,
-0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81,
-0x24, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x81, 0x26,
-0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x29, 0xF0, 0xD1,
-0xC6, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x90,
-0x01, 0xBA, 0xF0, 0x90, 0x81, 0x29, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54,
-0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x12, 0x72, 0xB3, 0x90,
-0x81, 0x27, 0xE0, 0xFF, 0x12, 0x4C, 0x3E, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x19, 0x90, 0x81, 0xCB,
-0x12, 0x45, 0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12,
-0x1F, 0xBD, 0xFD, 0x12, 0x72, 0xC4, 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, 0x90, 0x01, 0xC4, 0x74, 0xF7, 0xF0, 0x74, 0x56, 0xA3, 0xF0, 0x12, 0x6C,
-0xA5, 0xE5, 0x49, 0x30, 0xE1, 0x03, 0x12, 0x6F, 0x79, 0xE5, 0x49, 0x30, 0xE2, 0x02, 0xF1, 0xA5,
-0xE5, 0x49, 0x30, 0xE3, 0x03, 0x12, 0x6F, 0x8D, 0xE5, 0x4A, 0x30, 0xE0, 0x03, 0x12, 0x6F, 0xC9,
-0xE5, 0x4A, 0x30, 0xE4, 0x03, 0x12, 0x70, 0x22, 0xE5, 0x4B, 0x30, 0xE1, 0x02, 0x51, 0x78, 0xE5,
-0x4B, 0x30, 0xE0, 0x02, 0x31, 0xFF, 0xE5, 0x4B, 0x30, 0xE3, 0x02, 0xF1, 0xE0, 0xE5, 0x4C, 0x30,
-0xE1, 0x05, 0x7F, 0x03, 0x12, 0x44, 0x27, 0xE5, 0x4C, 0x30, 0xE4, 0x03, 0x12, 0x4E, 0xC4, 0xE5,
-0x4C, 0x30, 0xE5, 0x03, 0x12, 0x70, 0x38, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x70, 0xCE, 0x74,
-0xF7, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x56, 0xA3, 0xF0, 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, 0x81, 0x27, 0xE0, 0x60, 0x34, 0x90, 0x06, 0x92, 0xE0, 0x30,
-0xE0, 0x23, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4,
-0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x11, 0x05, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90, 0x06,
-0x92, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x12, 0x47, 0x2A, 0x22,
-0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x31, 0xF0, 0x22, 0x90, 0x01, 0xC8, 0xE4, 0xF0, 0xA3, 0xF0,
-0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x51, 0x7F, 0xFF, 0xFE, 0x12, 0x2B, 0x27, 0xBF, 0x01,
-0x09, 0x90, 0x81, 0x51, 0xE0, 0x64, 0x03, 0x60, 0x03, 0x22, 0x01, 0xAB, 0xE4, 0x90, 0x81, 0x56,
-0xF0, 0x90, 0x81, 0x56, 0xE0, 0xFF, 0xC3, 0x94, 0x02, 0x40, 0x02, 0x01, 0xE6, 0xC3, 0x74, 0xFE,
-0x9F, 0xFF, 0xE4, 0x94, 0x00, 0xFE, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x52, 0x12, 0x2B, 0x27, 0xEF,
-0x64, 0x01, 0x70, 0x77, 0x90, 0x81, 0x52, 0xE0, 0xFF, 0x54, 0xC0, 0xFE, 0x60, 0x05, 0xEF, 0x54,
-0x0C, 0x70, 0x16, 0x90, 0x81, 0x52, 0xE0, 0xFF, 0x54, 0x30, 0x60, 0x67, 0xEF, 0x54, 0x03, 0x60,
-0x62, 0x90, 0x81, 0x53, 0x74, 0x01, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x81,
-0x53, 0xE0, 0x90, 0x81, 0x52, 0x70, 0x16, 0xE0, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x81,
-0x54, 0xF0, 0xEF, 0x54, 0x0C, 0x13, 0x13, 0x54, 0x3F, 0xA3, 0xF0, 0x80, 0x0D, 0xE0, 0xFE, 0x54,
-0x30, 0x90, 0x81, 0x54, 0xF0, 0xEE, 0x54, 0x03, 0xA3, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0x64, 0x30,
-0x70, 0x54, 0xA3, 0xE0, 0x64, 0x02, 0x70, 0x4E, 0x90, 0x00, 0xF5, 0xE0, 0x54, 0x40, 0x90, 0x81,
-0x57, 0xF0, 0xE0, 0x70, 0x41, 0xA3, 0x74, 0x02, 0xF0, 0x80, 0x10, 0x90, 0x81, 0x58, 0x74, 0x01,
-0xF0, 0x80, 0x08, 0x90, 0x81, 0x56, 0xE0, 0x04, 0xF0, 0x01, 0x11, 0x90, 0x01, 0xC4, 0x74, 0xE9,
-0xF0, 0x74, 0x57, 0xA3, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x90, 0x01, 0xC8, 0xF0, 0x90, 0x81, 0x52,
-0xE0, 0x90, 0x01, 0xC9, 0xF0, 0x90, 0x81, 0x53, 0xE0, 0x90, 0x01, 0xCA, 0xF0, 0xE4, 0xFD, 0x7F,
-0x1F, 0x12, 0x32, 0x1E, 0x80, 0xD5, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09, 0xE0, 0x7F,
-0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02, 0x7F, 0x03,
-0x22, 0x11, 0xE7, 0x90, 0x80, 0x3C, 0xEF, 0xF0, 0x31, 0x13, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0,
-0x02, 0x2D, 0xA7, 0x31, 0x81, 0x31, 0xB1, 0x31, 0x40, 0x31, 0x5F, 0xE4, 0xF5, 0x35, 0xF5, 0x36,
-0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F, 0x51, 0x12,
-0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02, 0x32, 0x1E,
-0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, 0x07, 0x75, 0x40, 0x02, 0x90, 0x01, 0x30, 0xE5,
-0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40, 0xF0, 0x22, 0x75,
-0x45, 0x0E, 0x75, 0x46, 0x01, 0x43, 0x46, 0x10, 0x75, 0x47, 0x03, 0x75, 0x48, 0x62, 0x90, 0x01,
-0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, 0xF0, 0xA3, 0xE5, 0x48, 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, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x51,
-0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x32,
-0x1E, 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, 0x32, 0x1E, 0x7D, 0xFF, 0x7F,
-0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x57, 0x02,
-0x32, 0x1E, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD,
-0x00, 0xE0, 0x54, 0xBF, 0xF0, 0x12, 0x57, 0xE9, 0x51, 0x77, 0x12, 0x32, 0x77, 0x51, 0xC9, 0x51,
-0x5E, 0x7F, 0x01, 0x12, 0x43, 0x15, 0x90, 0x81, 0x41, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x43, 0x15,
-0x90, 0x81, 0x41, 0xE0, 0x04, 0xF0, 0x7F, 0x03, 0x12, 0x43, 0x15, 0x90, 0x81, 0x41, 0xE0, 0x04,
-0xF0, 0x31, 0x01, 0x51, 0x3F, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x32,
-0x1E, 0x75, 0x20, 0xFF, 0x51, 0x68, 0x51, 0xF9, 0x51, 0x7F, 0xE4, 0xFF, 0x02, 0x43, 0x9E, 0x51,
-0x62, 0x51, 0x6F, 0x51, 0xA7, 0x71, 0x4F, 0x51, 0x8A, 0x51, 0x95, 0x90, 0x81, 0x45, 0xE0, 0x54,
-0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xE4, 0xF5,
-0x4D, 0x22, 0xE4, 0x90, 0x80, 0xDE, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0xE4,
-0x90, 0x80, 0xD8, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90,
-0x01, 0xE4, 0x74, 0x0B, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE,
-0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x7F, 0xF0, 0xA3,
-0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD,
-0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0xE4, 0xA3, 0xF0,
-0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0,
-0x90, 0x01, 0x9C, 0x74, 0x7E, 0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74,
-0x24, 0xF0, 0x90, 0x01, 0x9B, 0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01,
-0x99, 0xE4, 0xF0, 0x90, 0x01, 0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x51, 0xF0, 0xA3, 0xF0,
-0x90, 0x01, 0x98, 0xE0, 0x7F, 0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3E,
-0xC3, 0x90, 0x81, 0x52, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x51, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90,
-0x01, 0xC1, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x51, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44,
-0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x52, 0xE0, 0x94, 0x32, 0x90,
-0x81, 0x51, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB2, 0x22, 0xE4,
-0x90, 0x81, 0x27, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0xF0, 0x54, 0xF0, 0xF0,
-0x90, 0x81, 0x24, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x2D,
-0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB,
-0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x2F, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xE4,
-0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x2B, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFE,
-0xF0, 0x90, 0x81, 0x29, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x81,
-0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0,
-0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x34, 0x12, 0x20, 0xDA, 0x00,
-0x00, 0x00, 0x00, 0x90, 0x80, 0x3C, 0xE0, 0xB4, 0x01, 0x08, 0x90, 0x81, 0x31, 0x74, 0x99, 0xF0,
-0x80, 0x12, 0x90, 0x80, 0x3C, 0xE0, 0x90, 0x81, 0x31, 0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80,
-0x03, 0x74, 0x40, 0xF0, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0,
-0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFD,
-0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0,
-0xE4, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x59, 0xF0, 0x90, 0x81, 0x59, 0xE0, 0x64, 0x01, 0xF0,
-0x24, 0x24, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5C, 0xA3, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0xFF, 0x90,
-0x81, 0x29, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x47, 0x2A, 0xD1, 0x08, 0xBF, 0x01, 0x02, 0x91, 0x5F,
-0xB1, 0xF2, 0x12, 0x32, 0x9E, 0xBF, 0x01, 0x02, 0xB1, 0x67, 0x12, 0x42, 0x4D, 0x80, 0xCA, 0xD3,
-0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x24, 0x90, 0x81, 0x1F,
-0xE0, 0xFF, 0x30, 0xE0, 0x1A, 0xC3, 0x13, 0x30, 0xE0, 0x07, 0xB1, 0xFB, 0xBF, 0x01, 0x12, 0x80,
-0x0A, 0x90, 0x81, 0x23, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x06, 0x91, 0x96, 0x80, 0x02, 0x91,
-0xA6, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xB1, 0x22, 0x91,
-0xBA, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x0D, 0xD1, 0x2F, 0xBF, 0x01,
-0x08, 0x91, 0x96, 0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, 0x22, 0xB1, 0xF3, 0x90, 0x00, 0x08, 0xE0,
-0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0xE4, 0xFF, 0x8F, 0x50, 0xE4, 0x90, 0x81, 0x5A,
-0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0xEF, 0x65,
-0x50, 0x60, 0x3E, 0xC3, 0x90, 0x81, 0x5B, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x5A, 0xE0, 0x94, 0x13,
-0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x5A, 0xE4, 0x75, 0xF0,
-0x01, 0x12, 0x44, 0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x5B, 0xE0,
-0x94, 0x32, 0x90, 0x81, 0x5A, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0,
-0xB2, 0x22, 0x90, 0x81, 0x31, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x32, 0x1E, 0x90, 0x81, 0x28, 0xE0,
-0x60, 0x12, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01,
-0x2F, 0x74, 0x90, 0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E,
-0x7F, 0x01, 0x91, 0xCA, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E,
-0x7F, 0x14, 0x7E, 0x00, 0x02, 0x32, 0xAA, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x2D,
-0xA7, 0xE4, 0xF5, 0x52, 0x12, 0x32, 0x9E, 0xEF, 0x60, 0x73, 0x63, 0x52, 0x01, 0xE5, 0x52, 0x24,
-0x67, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5D, 0xA3, 0xF0, 0x90, 0x00, 0x88, 0xE0, 0xF5, 0x50, 0xF5,
-0x51, 0x54, 0x0F, 0x60, 0xDF, 0xE5, 0x50, 0x30, 0xE0, 0x0B, 0x20, 0xE4, 0x03, 0x12, 0x29, 0xC5,
-0x53, 0x51, 0xEE, 0x80, 0x3F, 0xE5, 0x50, 0x30, 0xE1, 0x16, 0x20, 0xE5, 0x0E, 0x12, 0x11, 0xBD,
-0xEF, 0x70, 0x03, 0x43, 0x51, 0x20, 0x90, 0x01, 0x06, 0xE4, 0xF0, 0x53, 0x51, 0xFD, 0x80, 0x24,
-0xE5, 0x50, 0x30, 0xE2, 0x0B, 0x20, 0xE6, 0x03, 0x12, 0x67, 0x06, 0x53, 0x51, 0xFB, 0x80, 0x14,
-0xE5, 0x50, 0x30, 0xE3, 0x0F, 0x20, 0xE7, 0x09, 0x12, 0x61, 0x6E, 0xEF, 0x70, 0x03, 0x43, 0x51,
-0x80, 0x53, 0x51, 0xF7, 0xAD, 0x51, 0x7F, 0x88, 0x12, 0x32, 0x1E, 0x80, 0x87, 0xD0, 0xD0, 0x92,
-0xAF, 0x22, 0x22, 0x90, 0x00, 0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x22, 0x90, 0x81, 0x22, 0xE0, 0x64,
-0x02, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x7F, 0x02, 0x90, 0x81, 0x41, 0xE0, 0xFE, 0xEF,
-0xC3, 0x9E, 0x50, 0x18, 0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B, 0x90, 0x01,
-0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xDE, 0x7F, 0x01, 0x22, 0x90,
-0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 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, 0xE4, 0xFB, 0xFA,
-0xFD, 0x7F, 0x01, 0x12, 0x44, 0x4E, 0x90, 0x81, 0xBD, 0xEF, 0xF0, 0x60, 0xF0, 0xD1, 0x71, 0x80,
-0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x81,
-0xBE, 0xF0, 0x90, 0x81, 0xBE, 0xE0, 0xFD, 0x70, 0x02, 0xE1, 0x9C, 0x90, 0x82, 0x09, 0xE0, 0xFF,
-0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9,
-0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xE1, 0x95, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01,
-0xD0, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xBF, 0xF0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x81, 0x75,
-0x15, 0xBF, 0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC0, 0x12, 0x2B, 0xED, 0x90, 0x82,
-0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC1, 0xF0,
-0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81,
-0xC2, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x45, 0x0A, 0xE0,
-0x90, 0x81, 0xC3, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12, 0x45,
-0x0A, 0xE0, 0x90, 0x81, 0xC4, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1,
-0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC5, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90,
-0x01, 0xF2, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC6, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0,
-0x04, 0x90, 0x01, 0xF3, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC7, 0xF0, 0x90, 0x81, 0xBE, 0xE0,
-0xFF, 0x90, 0x82, 0x09, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8,
-0xFC, 0xF4, 0x5F, 0x90, 0x81, 0xBE, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07,
-0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x81, 0xC0, 0xE0, 0xFF,
-0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC1, 0x12, 0x55, 0x3F, 0x90, 0x82, 0x09, 0xE0, 0x04, 0xF0, 0xE0,
-0x54, 0x03, 0xF0, 0xC1, 0x82, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
-0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x44, 0x4E, 0x90, 0x81, 0xD0, 0xEF, 0xF0, 0x60,
-0xF0, 0x12, 0x6C, 0x19, 0x80, 0xEB, 0x90, 0x81, 0xD4, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12,
-0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, 0x81, 0xE2, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12,
-0x2D, 0x5C, 0x90, 0x81, 0xDA, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xD4, 0xE0, 0xFB, 0x70, 0x08, 0x90,
-0x81, 0xDA, 0x12, 0x44, 0xD9, 0x80, 0x16, 0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82,
-0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x81, 0xDE,
-0x12, 0x20, 0xCE, 0x90, 0x81, 0xD5, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20,
-0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xDE, 0x12, 0x44, 0xD9, 0xED,
-0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC, 0x12, 0x44, 0xCC, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x81,
-0xDE, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xDA, 0x12, 0x44, 0xD9, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85,
-0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xD4, 0xE0, 0x75,
-0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0,
-0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xDE, 0x12, 0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20,
-0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xDA, 0x12, 0x44, 0xD9, 0xEC, 0x44,
-0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90,
-0x81, 0xD4, 0xE0, 0x70, 0x04, 0x7F, 0x20, 0x80, 0x09, 0x90, 0x81, 0xD4, 0xE0, 0xB4, 0x01, 0x16,
-0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF,
-0xE4, 0x90, 0x81, 0xE2, 0xEF, 0xF0, 0x90, 0x81, 0xE2, 0xE0, 0x90, 0x81, 0xD4, 0x60, 0x0E, 0xE0,
-0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0,
-0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF,
-0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x90, 0x81, 0xD6, 0x12, 0x20, 0xCE, 0x90,
-0x81, 0xD6, 0x02, 0x44, 0xD9, 0x90, 0x81, 0xE3, 0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x81, 0xE9, 0x12,
-0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20,
-0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xE5, 0x12, 0x44, 0xD9, 0xED,
-0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x44, 0xCC, 0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x81, 0xE9, 0x12,
-0x20, 0xCE, 0x90, 0x81, 0xE3, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34,
-0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xE9, 0x12,
-0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3,
-0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x5F, 0xB6, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x78, 0x10,
-0x74, 0x01, 0xF2, 0x90, 0x02, 0x09, 0xE0, 0x78, 0x00, 0xF2, 0x08, 0x74, 0x20, 0xF2, 0x18, 0xE2,
-0xFF, 0x30, 0xE0, 0x05, 0x08, 0xE2, 0x24, 0x80, 0xF2, 0xEF, 0xC3, 0x13, 0x90, 0xFD, 0x10, 0xF0,
-0x78, 0x01, 0xE2, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x78, 0x03, 0xF2,
-0x64, 0x04, 0x60, 0x0D, 0xE2, 0xFF, 0x64, 0x08, 0x60, 0x07, 0xEF, 0x64, 0x0C, 0x60, 0x02, 0x61,
-0xDE, 0xE4, 0x78, 0x02, 0xF2, 0x78, 0x03, 0xE2, 0xFF, 0x18, 0xE2, 0xC3, 0x9F, 0x50, 0x2D, 0xE2,
-0xFD, 0x18, 0xE2, 0x2D, 0x90, 0x81, 0x5A, 0xF0, 0xE0, 0xFF, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34,
-0xFC, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x04, 0x2D, 0xF8, 0xEE, 0xF2, 0xEF, 0xB4, 0xFF, 0x06, 0x90,
-0xFD, 0x10, 0xE0, 0x04, 0xF0, 0x78, 0x02, 0xE2, 0x04, 0xF2, 0x80, 0xC9, 0x78, 0x04, 0xE2, 0x78,
-0x12, 0xF2, 0xFF, 0x78, 0x05, 0xE2, 0x78, 0x11, 0xF2, 0x78, 0x06, 0xE2, 0x78, 0x13, 0xF2, 0x78,
-0x07, 0xE2, 0x78, 0x14, 0xF2, 0x78, 0x08, 0xE2, 0x78, 0x33, 0xF2, 0x78, 0x09, 0xE2, 0x78, 0x34,
-0xF2, 0x78, 0x0A, 0xE2, 0x78, 0x35, 0xF2, 0x78, 0x0B, 0xE2, 0x78, 0x36, 0xF2, 0x78, 0x0C, 0xE2,
-0x78, 0x37, 0xF2, 0x78, 0x0D, 0xE2, 0x78, 0x38, 0xF2, 0x78, 0x0E, 0xE2, 0x78, 0x39, 0xF2, 0x78,
-0x0F, 0xE2, 0x78, 0x3A, 0xF2, 0xE4, 0x78, 0x15, 0xF2, 0xEF, 0x24, 0xF8, 0x60, 0x75, 0x24, 0xFC,
-0x60, 0x6C, 0x24, 0x08, 0x60, 0x02, 0x61, 0xC0, 0x78, 0x11, 0xE2, 0xB4, 0x01, 0x05, 0x12, 0x29,
-0xC5, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x02, 0x05, 0x12, 0x11, 0xBD, 0x61, 0xC5, 0x78, 0x11,
-0xE2, 0xB4, 0x03, 0x04, 0xF1, 0x06, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x10, 0x17, 0x78, 0x14,
-0xE2, 0xFE, 0x18, 0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF,
-0x12, 0x32, 0xAA, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x11, 0x17, 0x78, 0x14, 0xE2, 0xFE, 0x18,
-0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, 0x12, 0x32, 0x06,
-0x61, 0xC5, 0x78, 0x11, 0xE2, 0xF4, 0x60, 0x02, 0x61, 0xC5, 0x18, 0xF2, 0x61, 0xC5, 0x78, 0x15,
-0x74, 0x01, 0xF2, 0x78, 0x11, 0xE2, 0x64, 0x07, 0x60, 0x02, 0x61, 0xAA, 0x78, 0x34, 0xE2, 0xFF,
-0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB,
-0x07, 0x78, 0x33, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0xC0, 0x04,
-0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x35, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10,
-0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x18,
-0x12, 0x44, 0xFE, 0x78, 0x15, 0xE2, 0x70, 0x02, 0x61, 0x93, 0x18, 0xE2, 0xFF, 0x18, 0xE2, 0xFD,
-0x31, 0x5F, 0x78, 0x1C, 0x12, 0x44, 0xFE, 0x78, 0x38, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78,
-0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x78, 0x37, 0xE2, 0xFF,
-0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0,
-0x07, 0x78, 0x39, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03,
-0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x20, 0x12, 0x44, 0xFE, 0x78, 0x20,
-0x12, 0x44, 0xE5, 0x12, 0x20, 0x9B, 0x78, 0x1C, 0x12, 0x44, 0xF1, 0x12, 0x44, 0xBF, 0xC0, 0x04,
-0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x18, 0x12, 0x44, 0xE5, 0x78, 0x20, 0x12, 0x44, 0xF1,
-0x12, 0x44, 0xBF, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x18,
-0x12, 0x44, 0xFE, 0x78, 0x18, 0x12, 0x44, 0xE5, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xCE, 0x78, 0x13,
-0xE2, 0xFD, 0x08, 0xE2, 0xFF, 0x12, 0x55, 0x1C, 0x80, 0x1B, 0x78, 0x13, 0xE2, 0xFF, 0x08, 0xE2,
-0xFD, 0x78, 0x11, 0xE2, 0xFB, 0x78, 0x15, 0xE2, 0x90, 0x81, 0xBC, 0xF0, 0x71, 0xE1, 0x80, 0x05,
-0x78, 0x10, 0x74, 0x02, 0xF2, 0x78, 0x10, 0xE2, 0xFF, 0xC3, 0x94, 0x02, 0x50, 0x10, 0xEF, 0x60,
-0x0A, 0x78, 0x02, 0xE2, 0xFF, 0x18, 0xE2, 0x2F, 0xF2, 0x21, 0x90, 0x7F, 0x01, 0x22, 0x7F, 0x00,
-0x22, 0xAC, 0x07, 0xED, 0xAD, 0x04, 0x78, 0x24, 0xF2, 0xED, 0x08, 0xF2, 0xEB, 0xB4, 0x04, 0x07,
-0x78, 0x27, 0x74, 0x01, 0xF2, 0x80, 0x0E, 0xEB, 0x78, 0x27, 0xB4, 0x05, 0x05, 0x74, 0x02, 0xF2,
-0x80, 0x03, 0x74, 0x04, 0xF2, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x00, 0x50,
-0x63, 0xE4, 0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02,
-0xA1, 0x7F, 0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2D,
-0x74, 0x37, 0x2E, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xEE, 0xFF, 0x78, 0x25, 0xE2, 0x2F, 0xFF, 0x18,
-0xE2, 0x34, 0x00, 0x8F, 0x82, 0xF5, 0x83, 0xE0, 0x78, 0x29, 0xF2, 0x78, 0x32, 0xE2, 0xFF, 0xF4,
-0xFE, 0x78, 0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x24, 0x08,
-0xE2, 0xFF, 0x08, 0xE2, 0x2F, 0xFF, 0x78, 0x28, 0xE2, 0xFD, 0x12, 0x32, 0x1E, 0x78, 0x26, 0xE2,
-0x04, 0xF2, 0x80, 0xA1, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x07, 0x50, 0x69,
-0xE4, 0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0xA1,
-0x7F, 0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2D, 0x78,
-0x26, 0xE2, 0xFF, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83,
-0xE0, 0x78, 0x29, 0xF2, 0x74, 0x37, 0x2F, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFF, 0xF4, 0xFE,
-0x78, 0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x28, 0xE2, 0xFF,
-0x78, 0x26, 0xE2, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83,
-0xEF, 0xF0, 0x78, 0x26, 0xE2, 0x04, 0xF2, 0x80, 0x9B, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x0F, 0x78,
-0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2D, 0x5C, 0x78, 0x2E, 0x12, 0x44, 0xFE, 0xE4, 0x78,
-0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x50, 0x5D, 0x74, 0x33, 0x2E,
-0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2B, 0x78, 0x2E, 0x12, 0x44, 0xE5,
-0x78, 0x26, 0xE2, 0xFB, 0x75, 0xF0, 0x08, 0xA4, 0xF9, 0xF8, 0x12, 0x20, 0xA8, 0x78, 0x29, 0xEF,
-0xF2, 0x74, 0x37, 0x2B, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFE, 0xF4, 0x5F, 0xFF, 0x78, 0x28,
-0xE2, 0xFD, 0xEE, 0x5D, 0x4F, 0xF2, 0x78, 0x28, 0xE2, 0xFF, 0x78, 0x26, 0xE2, 0xFD, 0xC3, 0x74,
-0x03, 0x9D, 0xFD, 0xE4, 0x94, 0x00, 0xFC, 0x7B, 0xFE, 0x74, 0x2A, 0x2D, 0xF9, 0x74, 0x80, 0x3C,
-0xFA, 0xEF, 0x12, 0x1F, 0xEA, 0xE2, 0x04, 0xF2, 0x80, 0x98, 0x78, 0x2A, 0x12, 0x44, 0xE5, 0x90,
-0x85, 0xBB, 0x12, 0x20, 0xCE, 0x78, 0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2E, 0xA2, 0x22,
-0x22, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xFE, 0x12,
-0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x90, 0x00,
-0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0xCF, 0xF0, 0x80, 0x05, 0x90, 0x81, 0xCF, 0xEF, 0xF0, 0x90,
-0x81, 0xCE, 0xEE, 0xF0, 0x90, 0x81, 0xCF, 0xE0, 0xFE, 0x90, 0x81, 0xCE, 0xE0, 0xFF, 0xD3, 0x9E,
-0x50, 0x38, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFE, 0x74, 0xDE,
-0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xDE, 0x2F, 0xF5, 0x82, 0xE4,
-0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xD1, 0x25, 0x80, 0x07, 0x90, 0x81, 0xCE, 0xE0, 0xFF,
-0xB1, 0x80, 0x90, 0x81, 0xCE, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x90, 0x80, 0xDE, 0xE0, 0x70, 0x24,
-0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0xFF, 0x12, 0x49, 0x93, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C,
-0x60, 0x02, 0xD1, 0x26, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xBF,
-0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x05, 0x22,
-0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x81, 0xED, 0xEF, 0xF0, 0xA3, 0xED,
-0xF0, 0xAD, 0x03, 0xAC, 0x02, 0xE4, 0x90, 0x81, 0xF5, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0xC4, 0x74,
-0x39, 0xF0, 0x74, 0x66, 0xA3, 0xF0, 0xEC, 0x54, 0x3F, 0xFC, 0x90, 0x01, 0x40, 0xED, 0xF0, 0xAE,
-0x04, 0xEE, 0xA3, 0xF0, 0x90, 0x81, 0xED, 0xE0, 0x24, 0x81, 0x60, 0x34, 0x24, 0xDA, 0x60, 0x1C,
-0x24, 0x3C, 0x70, 0x41, 0x90, 0x81, 0xEE, 0xE0, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0x90, 0x81,
-0xF2, 0xF0, 0xA3, 0x74, 0x69, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x80, 0x2C, 0x90, 0x81, 0xEE, 0xE0,
-0x54, 0x01, 0x90, 0x81, 0xF2, 0xF0, 0xA3, 0x74, 0xA5, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x80, 0x18,
-0x90, 0x81, 0xEE, 0xE0, 0xC4, 0x54, 0x10, 0x90, 0x81, 0xF2, 0xF0, 0xA3, 0x74, 0x7F, 0xF0, 0xA3,
-0x74, 0x10, 0xF0, 0x80, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x81, 0xF3, 0xE0, 0x90, 0x01, 0x06, 0xF0,
-0x90, 0x81, 0xF2, 0xE0, 0x60, 0x0E, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x81, 0xF1, 0xE0, 0x90, 0x01,
-0x43, 0xF0, 0x80, 0x0D, 0x90, 0x01, 0x43, 0xE4, 0xF0, 0x90, 0x81, 0xF2, 0xE0, 0x90, 0x01, 0x42,
-0xF0, 0x90, 0x81, 0xF4, 0xE0, 0xFF, 0x90, 0x01, 0x42, 0xE0, 0x5F, 0xFF, 0x90, 0x81, 0xF2, 0xE0,
-0x6F, 0x60, 0xEE, 0x74, 0x39, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x66, 0xA3, 0xF0, 0x90, 0x01,
-0x43, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x87, 0x5F, 0xE0, 0x90,
-0x81, 0x69, 0xF0, 0xE4, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x81, 0x66, 0xF0, 0x90, 0x81, 0x66, 0xE0,
-0xFF, 0xC3, 0x94, 0x40, 0x50, 0x15, 0x74, 0x79, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83,
-0x74, 0xFF, 0xF0, 0x90, 0x81, 0x66, 0xE0, 0x04, 0xF0, 0x80, 0xE1, 0xE4, 0x90, 0x81, 0x66, 0xF0,
-0x90, 0x81, 0x69, 0xE0, 0xFF, 0x90, 0x81, 0x66, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x03, 0x02, 0x68,
-0x12, 0x74, 0xDF, 0x2E, 0xF9, 0xE4, 0x34, 0x86, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75,
-0x16, 0x0A, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5B, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x5C, 0xE0, 0xFF,
-0x12, 0x2F, 0x27, 0xEF, 0x04, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x81, 0x5B, 0xE0, 0xFF, 0xA3, 0xE0,
-0xFD, 0x12, 0x31, 0xEA, 0xEF, 0x24, 0xC8, 0x90, 0x81, 0x78, 0xF0, 0x75, 0xF0, 0x08, 0xA4, 0xF0,
-0x90, 0x81, 0x5C, 0xE0, 0x54, 0x0F, 0x90, 0x81, 0x77, 0xF0, 0xE4, 0x90, 0x81, 0x65, 0xF0, 0x90,
-0x81, 0x67, 0xF0, 0x90, 0x81, 0x67, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x57, 0x90, 0x81, 0x77,
-0xE0, 0xFE, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x13, 0xD8, 0xFC, 0x20, 0xE0, 0x3E, 0x90, 0x81,
-0x67, 0xE0, 0x25, 0xE0, 0xFF, 0x90, 0x81, 0x78, 0xE0, 0x2F, 0x24, 0x79, 0xF9, 0xE4, 0x34, 0x81,
-0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x01, 0x90, 0x81, 0x65, 0xE0, 0x75, 0xF0, 0x02, 0xA4, 0x24,
-0x5D, 0xF9, 0x74, 0x81, 0x35, 0xF0, 0x8B, 0x13, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0xD0,
-0x01, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x65, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x67, 0xE0,
-0x04, 0xF0, 0x80, 0x9F, 0x90, 0x81, 0x76, 0xE0, 0xFF, 0x90, 0x81, 0x66, 0xE0, 0x2F, 0xF0, 0x02,
-0x67, 0x40, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0xC3, 0x94, 0x40, 0x40, 0x02,
-0x41, 0xAF, 0xE0, 0xFF, 0x24, 0x79, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, 0x81,
-0x6C, 0xF0, 0xE0, 0xFE, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFD, 0x90, 0x81, 0x6B, 0xF0, 0xEE, 0x54,
-0x0F, 0xFE, 0xA3, 0xF0, 0x74, 0x7A, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90,
-0x81, 0x6D, 0xF0, 0xFC, 0xEE, 0xFE, 0xEC, 0xFB, 0xEB, 0xFF, 0x90, 0x81, 0x72, 0xEE, 0xF0, 0xA3,
-0xEF, 0xF0, 0xED, 0x12, 0x45, 0x28, 0x68, 0x8B, 0x00, 0x68, 0xC2, 0x01, 0x69, 0x73, 0x02, 0x6A,
-0xA0, 0x03, 0x69, 0x8E, 0x04, 0x69, 0xAF, 0x05, 0x69, 0xAF, 0x06, 0x69, 0xAF, 0x07, 0x69, 0xAF,
-0x08, 0x6A, 0x33, 0x09, 0x6A, 0x69, 0x0A, 0x00, 0x00, 0x6A, 0xAF, 0x90, 0x81, 0x6A, 0xE0, 0xFD,
-0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x7B, 0x2D, 0xF5, 0x82,
-0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x81, 0x74, 0xEE, 0xF0, 0xFC, 0xA3,
-0xEF, 0xF0, 0x90, 0x81, 0x6D, 0xE0, 0xFF, 0x12, 0x2F, 0x96, 0x90, 0x81, 0x68, 0x74, 0x02, 0xF0,
-0x41, 0xA0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0,
-0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06,
-0xAB, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0,
-0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07,
-0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7D, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4,
-0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00,
-0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24,
-0x7E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x18,
-0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x90, 0x81,
-0x6E, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x6E, 0x12, 0x44, 0xD9, 0x90, 0x85, 0x96, 0x12, 0x20, 0xCE,
-0x90, 0x81, 0x72, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2E, 0xE4, 0x90, 0x81, 0x68, 0x74, 0x04,
-0xF0, 0x41, 0xA0, 0x90, 0x81, 0x6D, 0xE0, 0xFD, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82,
-0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0xC7, 0x80, 0x19, 0x90, 0x81,
-0x6D, 0xE0, 0xFD, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83,
-0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0x6A, 0x90, 0x81, 0x68, 0x74, 0x01, 0xF0, 0x41, 0xA0, 0x90,
-0x81, 0x68, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81,
-0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9,
-0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81,
-0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0,
-0x06, 0xC0, 0x07, 0x90, 0x81, 0x6C, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20,
-0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x90, 0x81, 0x6E, 0x12,
-0x20, 0xCE, 0x90, 0x81, 0x6B, 0xE0, 0x24, 0xFB, 0xFF, 0xC0, 0x07, 0x90, 0x81, 0x6E, 0x12, 0x44,
-0xD9, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x6D, 0xE0, 0xFD, 0xD0, 0x07, 0x12, 0x55,
-0x1C, 0x80, 0x6D, 0x90, 0x81, 0x68, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF9,
-0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x01, 0x7B, 0xFE, 0x7A,
-0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x6D, 0xE0, 0xFF, 0x90, 0x81, 0x6C, 0xE0, 0xFD,
-0xE4, 0x90, 0x81, 0xBC, 0xF0, 0x7B, 0x04, 0x80, 0x34, 0x90, 0x81, 0x68, 0x74, 0x04, 0xF0, 0x90,
-0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF9, 0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15,
-0x75, 0x16, 0x04, 0x7B, 0xFE, 0x7A, 0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x6D, 0xE0,
-0xFF, 0x90, 0x81, 0x6C, 0xE0, 0xFD, 0xE4, 0x90, 0x81, 0xBC, 0xF0, 0x7B, 0x06, 0x12, 0x63, 0xE1,
-0x90, 0x81, 0x68, 0xE0, 0x24, 0x02, 0xFF, 0x90, 0x81, 0x6A, 0xE0, 0x2F, 0xF0, 0x01, 0x17, 0x22,
-0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80, 0x3D,
-0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3E, 0xF0, 0x90, 0x00,
-0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F,
-0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x40, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xAE,
-0x05, 0xED, 0x2F, 0x90, 0x80, 0x41, 0xF0, 0x22, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0x30,
-0xE0, 0x26, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x38, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90,
-0x81, 0x39, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03,
-0x12, 0x1F, 0xBD, 0x90, 0x81, 0x3B, 0xF0, 0x22, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74,
-0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x12, 0x1F,
-0xA4, 0x90, 0x81, 0x3E, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x90, 0x01, 0xE7, 0xF0, 0x22, 0x12, 0x1F,
-0xA4, 0x90, 0x81, 0x4A, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x4B, 0xF0, 0x22,
-0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xFD, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4,
-0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0xFD, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0,
-0x60, 0x2D, 0xC3, 0x90, 0x82, 0x00, 0xE0, 0x94, 0xE8, 0x90, 0x81, 0xFF, 0xE0, 0x94, 0x03, 0x40,
-0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x81, 0xFF, 0xE4,
-0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F,
-0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xD1,
-0x12, 0x45, 0x1F, 0x90, 0x82, 0x0A, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F,
-0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x71, 0x60, 0xEF, 0x60, 0x3A, 0x90, 0x81, 0xD1, 0x12, 0x45, 0x16,
-0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xF5, 0x16,
-0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x81, 0xD1, 0x12, 0x45, 0x16, 0x90,
-0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB,
-0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
-0xE4, 0xFF, 0x90, 0x80, 0xD9, 0xE0, 0xFE, 0x90, 0x80, 0xD8, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E,
-0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13,
-0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x42, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x71,
-0xB6, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, 0x80, 0xD8, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4,
-0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0xD8, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
-0x22, 0x8F, 0x0D, 0x22, 0x8F, 0x0E, 0x22, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41,
-0xA3, 0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3, 0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40,
-0xF5, 0x44, 0x90, 0x01, 0x34, 0xE5, 0x41, 0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0,
-0xA3, 0xE5, 0x44, 0xF0, 0x22, 0x90, 0x01, 0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55,
-0x46, 0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47, 0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90,
-0x01, 0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5, 0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C,
-0xF0, 0x53, 0x91, 0xDF, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xA3, 0xF0, 0xA3,
-0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x19, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x13,
-0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0x12, 0x4F, 0xF4, 0x90, 0x01, 0x57,
-0x74, 0x05, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x26, 0x90, 0x81, 0x27, 0xE0,
-0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24,
-0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12,
-0x47, 0x2A, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0E,
-0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0x80, 0x03, 0xD1, 0x7F, 0x22, 0x90,
-0x04, 0x1D, 0xE0, 0x70, 0x13, 0x90, 0x80, 0x3E, 0xE0, 0xFF, 0xE4, 0xFD, 0xB1, 0x69, 0x8E, 0x4E,
-0x8F, 0x4F, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
-0x90, 0x82, 0x0E, 0xED, 0xF0, 0x90, 0x82, 0x0D, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0xF1, 0x37, 0x7C,
-0x00, 0xAD, 0x07, 0x90, 0x82, 0x0D, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x82, 0x0E, 0xE0, 0x60,
-0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF,
-0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F,
-0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82,
-0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92,
-0xAF, 0x22, 0x8F, 0x4E, 0xF1, 0x4B, 0xBF, 0x01, 0x18, 0x90, 0x80, 0x40, 0xE0, 0xFF, 0x7D, 0x01,
-0xB1, 0x69, 0xAD, 0x07, 0xAC, 0x06, 0xAF, 0x4E, 0x12, 0x4F, 0x82, 0x90, 0x04, 0x1F, 0x74, 0x20,
-0xF0, 0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x81, 0x4C, 0xF0, 0xE0, 0xFD, 0x54, 0xC0, 0x70, 0x09,
-0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x80, 0x72, 0xED, 0x30, 0xE6, 0x4B, 0x90, 0x81, 0x27,
-0xE0, 0x64, 0x02, 0x70, 0x2A, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC3, 0x13, 0x20, 0xE0, 0x09, 0x90,
-0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x28, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x01,
-0x70, 0x2D, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x04, 0xF0, 0x7F, 0x01, 0xB1, 0xD2, 0x80, 0x20, 0x90,
-0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04,
-0xB1, 0x4F, 0x80, 0x0B, 0xD1, 0x7F, 0x80, 0x07, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90,
-0x81, 0x4C, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, 0x11, 0x12, 0x4F, 0xF1, 0x90, 0x01, 0x57, 0x74,
-0x05, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90,
-0x01, 0x5F, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x08, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A,
-0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x50,
-0x05, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24,
-0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x0C, 0xE4, 0xFD, 0x7F, 0x0C,
-0x12, 0x47, 0x3D, 0xE4, 0xFF, 0x12, 0x4F, 0x0D, 0x22, 0xE4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x06,
-0xA9, 0xE0, 0x90, 0x81, 0x4C, 0xF0, 0xE0, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x81, 0x2B, 0xE0, 0x54,
-0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x47, 0x2A, 0x90, 0x81, 0x4C, 0xE0, 0x30, 0xE6, 0x21, 0x90,
-0x81, 0x27, 0xE0, 0x64, 0x01, 0x70, 0x20, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81,
-0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xB1, 0x4F, 0x80, 0x0B, 0xD1, 0x7F, 0x80, 0x07,
-0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x4C, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7,
-0x11, 0x12, 0x4F, 0xF1, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x04,
-0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0,
-0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06, 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, 0x81, 0x27, 0xE0, 0x60, 0x03, 0x12,
-0x73, 0xE1, 0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x03, 0x12, 0x49, 0xDD, 0x22, 0x90, 0x81, 0x27,
-0xE0, 0x60, 0x35, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, 0x24, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A,
-0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x50,
-0x05, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81,
-0x24, 0xE0, 0x54, 0xEF, 0xF0, 0x12, 0x47, 0x2A, 0x22, 0x12, 0x71, 0x48, 0x90, 0x81, 0x4D, 0xEF,
-0xF0, 0x90, 0x81, 0x24, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x04, 0xE0, 0x54, 0xFE,
-0xF0, 0x90, 0x81, 0x4D, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4,
-0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x1A,
-0x90, 0x81, 0x32, 0xE4, 0xF0, 0xA3, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05,
-0x58, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x22, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22,
-0xF0, 0x22, 0x90, 0x81, 0x4A, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x01,
-0xF0, 0x90, 0x05, 0xFD, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13,
-0x54, 0x03, 0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25,
-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, 0x47, 0x2A, 0xE4, 0xFF, 0x90, 0x81,
-0x45, 0xE0, 0x30, 0xE0, 0x48, 0x90, 0x81, 0x49, 0xE0, 0xFD, 0x60, 0x41, 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, 0x81, 0x49, 0xF0, 0x22, 0x90, 0x81, 0x47, 0xE0,
-0xD3, 0x9D, 0x50, 0x10, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x11, 0xBE, 0x90, 0x81, 0x45, 0xE0,
-0x54, 0xFE, 0xF0, 0x22, 0x12, 0x4F, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80,
-0x3C, 0xE0, 0x64, 0x02, 0x60, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x81,
-0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0,
-0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25, 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,
-0x81, 0x27, 0xE0, 0x60, 0x03, 0x12, 0x47, 0x2A, 0x7F, 0x01, 0x01, 0x6E, 0xC3, 0xEE, 0x94, 0x01,
-0x40, 0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xC3, 0xEE, 0x94,
-0x01, 0x40, 0x24, 0x90, 0xFD, 0x11, 0xE0, 0x6D, 0x70, 0x1A, 0x90, 0x01, 0x17, 0xE0, 0xB5, 0x05,
-0x0D, 0x90, 0x01, 0xE4, 0x74, 0x77, 0xF0, 0x90, 0xFD, 0x11, 0xE4, 0xF0, 0x80, 0x06, 0xED, 0x04,
-0x90, 0xFD, 0x11, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xE4, 0x90, 0x81, 0x4E, 0xF0, 0xA3, 0xF0, 0xA3,
-0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x81, 0x4E, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x81,
-0x4E, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x81, 0x50, 0xE0, 0x94, 0x64, 0x90, 0x81,
-0x4F, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x4E,
-0xE0, 0xFF, 0x22, 0x90, 0x81, 0x4F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0x80, 0xC2, 0x74,
-0x45, 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, 0x82,
-0x12, 0xED, 0xF0, 0x90, 0x82, 0x11, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74,
-0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0,
-0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07,
-0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46,
-0x12, 0x32, 0x1E, 0x90, 0x82, 0x12, 0xE0, 0x60, 0x18, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01,
-0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80,
-0x17, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8,
-0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E, 0x90, 0x82, 0x11,
-0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3,
-0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E,
-0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC,
-0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x12, 0xE0,
-0x60, 0x1D, 0x90, 0x82, 0x11, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02,
-0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90,
-0x82, 0x11, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8,
-0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0,
-0x92, 0xAF, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90,
-0x81, 0x2B, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0C, 0x04, 0x70, 0x28, 0x90, 0x81, 0x2D, 0x74,
-0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, 0x90, 0x81, 0x3B, 0xE0, 0x90, 0x81, 0x2D, 0xF0,
-0x80, 0x05, 0x90, 0x81, 0x2D, 0xED, 0xF0, 0x90, 0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x25,
-0xE0, 0x44, 0x08, 0xF0, 0x22, 0x12, 0x4E, 0xAB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8,
-0x74, 0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x2B, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01,
-0xB8, 0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x29, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08,
-0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74,
-0x08, 0xF0, 0x80, 0x38, 0x90, 0x81, 0x2B, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10,
-0xF0, 0x80, 0x29, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01,
-0xB8, 0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74,
-0x80, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74,
-0x04, 0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x60, 0x42, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x3A,
-0x90, 0x81, 0x25, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x05, 0x22, 0x74, 0x0F, 0xF0, 0x90, 0x06, 0x04,
-0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF, 0x12, 0x4F, 0x0D, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0,
-0x44, 0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x06, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01,
-0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F,
-0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x02, 0xF0, 0x90, 0x81,
-0x23, 0xF0, 0x22, 0x12, 0x54, 0x65, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 0xF0,
-0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB,
-0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x81,
-0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0xFF,
-0xB4, 0x01, 0x02, 0x80, 0x04, 0xEF, 0xB4, 0x02, 0x06, 0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90,
-0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x80, 0xDE, 0xE0,
-0xB4, 0x01, 0x0B, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x47, 0x2A, 0x22, 0x22,
-0x90, 0x05, 0x2B, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90, 0x05, 0x22, 0x74,
-0xFF, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22,
-0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x12, 0x49, 0xDD, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0,
-0x22, 0x12, 0x49, 0xE3, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F,
-0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xAE,
-0x07, 0x12, 0x51, 0x73, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x0A, 0xAF,
-0x06, 0x7D, 0x01, 0x12, 0x47, 0x3D, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x01, 0x57, 0xE0,
-0x60, 0x48, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13,
-0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0C, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD,
-0xF0, 0x22, 0x90, 0x81, 0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90,
-0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0E, 0x90, 0x80, 0xDE, 0xE0,
-0xB4, 0x01, 0x07, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x90, 0x80, 0x3F, 0xE0, 0xFF,
-0x7D, 0x01, 0x12, 0x6D, 0x69, 0x8E, 0x54, 0x8F, 0x55, 0xAD, 0x55, 0xAC, 0x54, 0xAF, 0x53, 0x12,
-0x4F, 0x82, 0xAF, 0x55, 0xAE, 0x54, 0x90, 0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74,
-0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x11, 0x2C,
-0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x16, 0x2C,
-0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15, 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, 0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4, 0xF0, 0x90, 0x04,
-0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50, 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, 0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B,
-0xFB, 0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x80, 0xDB, 0xE0, 0x9B, 0x90, 0x80, 0xDA, 0xE0, 0x9A, 0x50,
-0x13, 0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0xDA, 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, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90,
-0x81, 0x42, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01,
-0x12, 0x1F, 0xBD, 0x90, 0x81, 0x43, 0xF0, 0x22, 0x90, 0x81, 0x45, 0xE0, 0x30, 0xE0, 0x2D, 0x90,
-0x81, 0x48, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x81, 0x46, 0xE0, 0xB5, 0x07, 0x1E, 0x90, 0x06,
-0x92, 0xE0, 0x54, 0x1C, 0x70, 0x0B, 0x12, 0x4F, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0x80,
-0x06, 0x90, 0x06, 0x92, 0x74, 0x1C, 0xF0, 0xE4, 0x90, 0x81, 0x48, 0xF0, 0x22, 0x00, 0xBB, 0x8E,
-};
-u4Byte ArrayLength_MP_8188E_FW_NIC_T = 13904;
-
-
-void
-ODM_ReadFirmware_MP_8188E_FW_NIC_T(
- 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_8188E_FW_NIC_T;
-#else
- ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_NIC_T, ArrayLength_MP_8188E_FW_NIC_T);
-#endif
- *pFirmwareSize = ArrayLength_MP_8188E_FW_NIC_T;
-}
-
-
-u1Byte Array_MP_8188E_FW_WoWLAN_S[] = {
-0xE2, 0x88, 0x30, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x10, 0x14, 0x26, 0x43, 0x02, 0x00,
-0xCD, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x02, 0x4E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x4F, 0xFD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x4F, 0xAD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x57, 0xF3, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xE7, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x46, 0xE7, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x3E,
-0x88, 0x82, 0x8C, 0x83, 0xE7, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x32, 0xE3, 0x09, 0xF6, 0x08,
-0xDF, 0xFA, 0x80, 0x78, 0xE3, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x70, 0x88, 0x82, 0x8C, 0x83,
-0xE3, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x64, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF6, 0x08,
-0xDF, 0xFA, 0x80, 0x58, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x4C,
-0x80, 0xD2, 0x80, 0xFA, 0x80, 0xC6, 0x80, 0xD4, 0x80, 0x69, 0x80, 0xF2, 0x80, 0x33, 0x80, 0x10,
-0x80, 0xA6, 0x80, 0xEA, 0x80, 0x9A, 0x80, 0xA8, 0x80, 0xDA, 0x80, 0xE2, 0x80, 0xCA, 0x80, 0x33,
-0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83,
-0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xE9, 0xDE, 0xE7, 0x80,
-0x0D, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF6, 0x08, 0xDF, 0xF9, 0xEC, 0xFA, 0xA9, 0xF0,
-0xED, 0xFB, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC,
-0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xEA, 0xDE,
-0xE8, 0x80, 0xDB, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF2, 0x08, 0xDF, 0xF9, 0x80, 0xCC,
-0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, 0xC3, 0x88, 0xF0, 0xED, 0x24, 0x02, 0xB4, 0x04,
-0x00, 0x50, 0xB9, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0xAF, 0x23, 0x23, 0x45,
-0x82, 0x23, 0x90, 0x48, 0x50, 0x73, 0xBB, 0x01, 0x09, 0x89, 0x82, 0x8A, 0x83, 0xF8, 0xE0, 0x28,
-0xF0, 0x22, 0x50, 0x03, 0x27, 0xF7, 0x22, 0xBB, 0xFE, 0x05, 0xF8, 0xE3, 0x28, 0xF3, 0x22, 0x8A,
-0x83, 0x89, 0x82, 0xF8, 0xE4, 0x93, 0x28, 0x22, 0xBB, 0x01, 0x0F, 0xF8, 0xE5, 0x82, 0x29, 0xF5,
-0x82, 0xE5, 0x83, 0x3A, 0xF5, 0x83, 0xE0, 0x28, 0xF0, 0x22, 0x50, 0x09, 0xC5, 0x82, 0x29, 0xF8,
-0xE5, 0x82, 0x26, 0xF6, 0x22, 0xBB, 0xFE, 0x09, 0xC5, 0x82, 0x29, 0xF8, 0xE2, 0x25, 0x82, 0xF2,
-0x22, 0xF8, 0xEA, 0x25, 0x83, 0xF5, 0x83, 0xE9, 0x93, 0x28, 0x22, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0,
-0x28, 0xF0, 0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0,
-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, 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, 0xBB, 0x01, 0x1A, 0x89, 0x82, 0x8A, 0x83, 0xD0,
-0xF0, 0xD0, 0xE0, 0xF8, 0xD0, 0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xE8, 0xC0, 0xE0,
-0xC0, 0xF0, 0x02, 0x49, 0x8F, 0x50, 0x16, 0xE9, 0xF8, 0xD0, 0x83, 0xD0, 0x82, 0xD0, 0xE0, 0xF9,
-0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xC0, 0x82, 0xC0, 0x83, 0x02, 0x4C, 0x3C, 0xBB, 0xFE, 0x16,
-0xE9, 0xF8, 0xD0, 0x83, 0xD0, 0x82, 0xD0, 0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xC0,
-0x82, 0xC0, 0x83, 0x02, 0x4C, 0x45, 0x22, 0xBB, 0x01, 0x20, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE5,
-0x83, 0x3A, 0xF5, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0xF8, 0xD0, 0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0,
-0xE0, 0xFB, 0xE8, 0xC0, 0xE0, 0xC0, 0xF0, 0x02, 0x49, 0x8F, 0x50, 0x18, 0xE9, 0x25, 0x82, 0xF8,
-0xD0, 0x83, 0xD0, 0x82, 0xD0, 0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xC0, 0x82, 0xC0,
-0x83, 0x02, 0x4C, 0x3C, 0xBB, 0xFE, 0x18, 0xE9, 0x25, 0x82, 0xF8, 0xD0, 0x83, 0xD0, 0x82, 0xD0,
-0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xC0, 0x82, 0xC0, 0x83, 0x02, 0x4C, 0x45, 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, 0x4B, 0x95, 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, 0x4B, 0xA1, 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, 0x4A, 0xDD, 0x73,
-0xEF, 0x4E, 0x60, 0x12, 0xEF, 0x60, 0x01, 0x0E, 0xED, 0xBB, 0x01, 0x0B, 0x89, 0x82, 0x8A, 0x83,
-0xF0, 0xA3, 0xDF, 0xFC, 0xDE, 0xFA, 0x22, 0x89, 0xF0, 0x50, 0x07, 0xF7, 0x09, 0xDF, 0xFC, 0xA9,
-0xF0, 0x22, 0xBB, 0xFE, 0xFC, 0xF3, 0x09, 0xDF, 0xFC, 0xA9, 0xF0, 0x22, 0xEB, 0xF6, 0x08, 0xEA,
-0xF6, 0x08, 0xE9, 0xF6, 0x22, 0xEB, 0xF2, 0x08, 0xEA, 0xF2, 0x08, 0xE9, 0xF2, 0x22, 0xC2, 0xAF,
-0x80, 0xFE, 0x32, 0x12, 0x4C, 0x52, 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,
-0x8B, 0xF8, 0xE6, 0xBC, 0x04, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, 0x40, 0xCE,
-0x79, 0x05, 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, 0x05, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, 0xE4, 0xF2,
-0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x8A, 0x25, 0x0C, 0xF8, 0xE6, 0xFD,
-0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x04, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, 0x6D, 0x60,
-0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, 0x0C, 0x24,
-0x8B, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x04, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, 0xF8, 0xE5,
-0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x8A, 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, 0x8A, 0xA6, 0x81, 0x74,
-0x04, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x05, 0xE4, 0x78, 0x80, 0xF6, 0x08,
-0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x4F, 0xA3, 0x74, 0x01, 0x93, 0xC0, 0xE0,
-0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, 0x8C, 0xD2,
-0xAF, 0x22, 0x04, 0xEF, 0xD3, 0x94, 0x04, 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, 0x8A, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, 0xBE, 0x04,
-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, 0x8A, 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, 0x8A, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, 0x04, 0x90,
-0x4F, 0xA3, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x04,
-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, 0x8A, 0x2F, 0xF8, 0xE6,
-0xF5, 0x81, 0x02, 0x4C, 0x9B, 0x50, 0x2E, 0x74, 0x8B, 0x2F, 0xF8, 0xE6, 0xBF, 0x04, 0x02, 0x74,
-0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x8A, 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, 0x8B, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, 0x0F, 0x74,
-0x8A, 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, 0x04, 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, 0x4C, 0x9A, 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, 0x4C, 0x9B, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, 0x56, 0xC6,
-0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0x02, 0x4F, 0x35, 0x02, 0x4D, 0x2B, 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, 0x4F, 0x7A, 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, 0x00, 0x41, 0x83, 0xA7, 0x00, 0x41,
-0x83, 0xA8, 0x00, 0x41, 0x83, 0xB3, 0x00, 0x44, 0x83, 0x4F, 0x00, 0x50, 0xF2, 0x01, 0x44, 0x83,
-0x53, 0x00, 0x0F, 0xAC, 0x01, 0x44, 0x83, 0x57, 0x00, 0x0F, 0xAC, 0x03, 0x44, 0x83, 0x5B, 0x00,
-0x0F, 0xAC, 0x04, 0x59, 0x92, 0x60, 0xED, 0x61, 0x0B, 0x62, 0x4F, 0x63, 0x74, 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, 0x90, 0x01, 0xC4, 0x74, 0xAD, 0xF0,
-0x74, 0x4F, 0xA3, 0xF0, 0x12, 0x6C, 0x7D, 0x74, 0xAD, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x4F,
-0xA3, 0xF0, 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, 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, 0x90, 0x01, 0xC4, 0x74, 0xFD, 0xF0,
-0x74, 0x4F, 0xA3, 0xF0, 0x12, 0x6C, 0xB7, 0xE5, 0x41, 0x30, 0xE3, 0x02, 0xF1, 0xE6, 0xE5, 0x41,
-0x30, 0xE4, 0x05, 0x7F, 0x02, 0x12, 0x4E, 0x75, 0xE5, 0x43, 0x30, 0xE1, 0x02, 0x11, 0x65, 0x74,
-0xFD, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x4F, 0xA3, 0xF0, 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, 0x51, 0x2B, 0x90, 0x81, 0xFB, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x80,
-0xA3, 0xE0, 0xB4, 0x01, 0x26, 0x90, 0x83, 0xB3, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90,
-0x81, 0xFD, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x83, 0xB3, 0xF0, 0x90, 0x81, 0xFD, 0xE0, 0xFF, 0x90,
-0x81, 0xFC, 0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0x11, 0x9C, 0x22, 0xE4, 0xFF, 0xD3, 0x10,
-0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x4E, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x19, 0x90, 0x05, 0x22,
-0xE0, 0xF5, 0x51, 0x74, 0xFF, 0xF0, 0x12, 0x6F, 0x85, 0xBF, 0x01, 0x02, 0x31, 0x20, 0x90, 0x05,
-0x22, 0xE5, 0x51, 0xF0, 0x80, 0x02, 0x31, 0x20, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01,
-0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0,
-0x54, 0x3F, 0xF0, 0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
-0xE0, 0x44, 0x10, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44,
-0x80, 0xF0, 0x22, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF,
-0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22,
-0x90, 0x80, 0x04, 0xE0, 0xFF, 0x7D, 0x01, 0x31, 0xC1, 0x8E, 0x4F, 0x8F, 0x50, 0xAD, 0x50, 0xAC,
-0x4F, 0xAF, 0x4E, 0x11, 0xD5, 0xAF, 0x50, 0xAE, 0x4F, 0x90, 0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD,
-0xAC, 0x07, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0,
-0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07,
-0x74, 0x16, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15,
-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, 0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4,
-0xF0, 0x90, 0x04, 0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50, 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, 0xE0, 0xFF, 0x7D,
-0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0xAA, 0xED, 0xF0, 0x90, 0x83, 0xA9,
-0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x12, 0x5D, 0x8E, 0x7C, 0x00, 0xAD, 0x07, 0x90, 0x83, 0xA9, 0xE0,
-0x90, 0x04, 0x25, 0xF0, 0x90, 0x83, 0xAA, 0xE0, 0x60, 0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4,
-0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4,
-0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
-0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54,
-0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0xFE, 0xE0, 0x30,
-0xE0, 0x2C, 0x90, 0x82, 0x01, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x81, 0xFF, 0xE0, 0xB5, 0x07,
-0x1D, 0x90, 0x06, 0x92, 0xE0, 0x54, 0x1C, 0x70, 0x0A, 0x11, 0x9C, 0x90, 0x82, 0x02, 0xE0, 0x04,
-0xF0, 0x80, 0x06, 0x90, 0x06, 0x92, 0x74, 0x1C, 0xF0, 0xE4, 0x90, 0x82, 0x01, 0xF0, 0x22, 0x90,
-0x81, 0xFE, 0xE0, 0x30, 0xE0, 0x47, 0x90, 0x82, 0x02, 0xE0, 0xFD, 0x60, 0x40, 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, 0x82, 0x02, 0xF0, 0x22, 0x90, 0x82, 0x00,
-0xE0, 0xD3, 0x9D, 0x50, 0x10, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x51, 0xAE, 0x90, 0x81, 0xFE,
-0xE0, 0x54, 0xFE, 0xF0, 0x22, 0x11, 0x9C, 0x90, 0x82, 0x02, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80,
-0x01, 0xE0, 0x64, 0x02, 0x70, 0x4B, 0x90, 0x80, 0xE6, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54,
-0x01, 0x30, 0xE0, 0x08, 0x90, 0x01, 0x4D, 0xE0, 0x64, 0x80, 0xF0, 0x22, 0x90, 0x80, 0xE5, 0xE0,
-0xFE, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x13, 0xEF, 0x54, 0x7F, 0xFF, 0xE4, 0xFD, 0xD1, 0xD0,
-0x90, 0x80, 0xE6, 0xE0, 0x54, 0x7F, 0xFF, 0x7D, 0x01, 0x80, 0x14, 0x90, 0x80, 0xE6, 0xE0, 0x54,
-0x7F, 0xFF, 0x7D, 0x01, 0xD1, 0xD0, 0x90, 0x80, 0xE6, 0xE0, 0x54, 0x7F, 0xFF, 0xE4, 0xFD, 0xC1,
-0xD0, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
-0x90, 0x82, 0x37, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xE4, 0x90, 0x82, 0x42, 0xF0,
-0xA3, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x90, 0x06, 0x31, 0xE0, 0x54, 0xEF, 0x44, 0x08, 0xF0, 0x90,
-0x82, 0x37, 0xA3, 0xE0, 0x24, 0x00, 0xF9, 0xE4, 0x34, 0xFB, 0xFA, 0x7B, 0x01, 0x12, 0x5D, 0xF8,
-0x90, 0x82, 0x37, 0xA3, 0xE0, 0x2F, 0xFF, 0x90, 0x82, 0x44, 0xE0, 0x2F, 0x90, 0x82, 0x46, 0xF0,
-0x7E, 0x00, 0x7F, 0x83, 0x7D, 0x00, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x55, 0x12, 0x4C, 0x10, 0x90,
-0x82, 0x46, 0xE0, 0x24, 0x00, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15,
-0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x55, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x46, 0xE0,
-0x24, 0x01, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x01,
-0x7B, 0x01, 0x7A, 0x81, 0x79, 0x56, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x46, 0xE0, 0x24, 0x02, 0xF9,
-0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0x7B, 0x01, 0x7A,
-0x81, 0x79, 0x57, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x46, 0xE0, 0x24, 0x04, 0xF9, 0xE4, 0x34, 0xFB,
-0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x59,
-0x12, 0x2B, 0xED, 0x90, 0x82, 0x46, 0xE0, 0x24, 0x05, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01,
-0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5A, 0x12, 0x2B, 0xED,
-0x90, 0x82, 0x46, 0xE0, 0x24, 0x07, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89,
-0x15, 0x75, 0x16, 0x02, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5C, 0x12, 0x2B, 0xED, 0xE4, 0x90, 0x82,
-0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x08, 0x50, 0x32, 0xA3, 0xE0, 0x24, 0x09,
-0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24, 0x00, 0xF5, 0x82,
-0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24, 0x5E, 0xF5, 0x82, 0xE4,
-0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0, 0x80, 0xC4, 0xE4, 0x90,
-0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x20, 0x50, 0x32, 0xA3, 0xE0, 0x24,
-0x11, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24, 0x00, 0xF5,
-0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24, 0x66, 0xF5, 0x82,
-0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0, 0x80, 0xC4, 0xE4,
-0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x10, 0x50, 0x32, 0xA3, 0xE0,
-0x24, 0x31, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24, 0x00,
-0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24, 0x86, 0xF5,
-0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0, 0x80, 0xC4,
-0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x08, 0x50, 0x32, 0xA3,
-0xE0, 0x24, 0x41, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24,
-0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24, 0x96,
-0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0, 0x80,
-0xC4, 0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x08, 0x50, 0x32,
-0xA3, 0xE0, 0x24, 0x49, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0,
-0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24,
-0x9E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0,
-0x80, 0xC4, 0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x10, 0x50,
-0x32, 0xA3, 0xE0, 0x24, 0x51, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF,
-0xF0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0,
-0x24, 0xA6, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04,
-0xF0, 0x80, 0xC4, 0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x02,
-0x50, 0x32, 0xA3, 0xE0, 0x24, 0x61, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3,
-0xEF, 0xF0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45,
-0xE0, 0x24, 0xB6, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0,
-0x04, 0xF0, 0x80, 0xC4, 0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94,
-0x20, 0x50, 0x32, 0xA3, 0xE0, 0x24, 0x63, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0,
-0xA3, 0xEF, 0xF0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82,
-0x45, 0xE0, 0x24, 0xB8, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45,
-0xE0, 0x04, 0xF0, 0x80, 0xC4, 0x90, 0x81, 0x57, 0xE0, 0xFC, 0xA3, 0xE0, 0xFA, 0xEC, 0xFF, 0xEA,
-0xFE, 0x90, 0x82, 0x3C, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x81, 0xB6, 0xE0, 0xFE, 0xA3, 0xE0,
-0xFD, 0xED, 0xFF, 0x90, 0x82, 0x3E, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x81, 0x5A, 0xE0, 0xFE,
-0xA3, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x82, 0x3A, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x30, 0xE3, 0x04,
-0x51, 0xAE, 0x80, 0x3F, 0x90, 0x82, 0x3A, 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, 0x81, 0xEE,
-0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xE4, 0xFD, 0x12, 0x77, 0xFE, 0x90, 0x06, 0x31, 0xE0, 0x54, 0xF7,
-0x44, 0x10, 0xF0, 0x7F, 0x00, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xFD, 0xE4, 0x33, 0xFC, 0x7E, 0x00,
-0xED, 0x2F, 0xFF, 0xEE, 0x3C, 0xFE, 0x90, 0x82, 0x39, 0xE0, 0xFD, 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,
-0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0xAE, 0xED, 0xF0, 0x90, 0x83, 0xAD, 0xEF,
-0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3,
-0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0, 0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E,
-0x90, 0x83, 0xAD, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC,
-0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xAE, 0xE0,
-0x60, 0x18, 0x90, 0x83, 0xAD, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33,
-0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80, 0x17, 0x90, 0x83, 0xAD, 0xE0, 0xFF, 0x74,
-0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0,
-0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E, 0x90, 0x83, 0xAD, 0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04,
-0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00,
-0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xAD, 0xE0, 0xFF, 0x74, 0x01,
-0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD,
-0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xAE, 0xE0, 0x60, 0x1D, 0x90, 0x83, 0xAD, 0xE0, 0x24,
-0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00,
-0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90, 0x83, 0xAD, 0xE0, 0x24, 0x04, 0xFF, 0x74,
-0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0,
-0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x01, 0x67, 0xE4, 0xFF,
-0x41, 0x5F, 0x7F, 0x01, 0x41, 0x5F, 0x90, 0x80, 0xE4, 0xE0, 0x30, 0xE0, 0x05, 0x7F, 0x04, 0x12,
-0x4E, 0x75, 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,
-0x90, 0x01, 0xC4, 0x74, 0xF3, 0xF0, 0x74, 0x57, 0xA3, 0xF0, 0x11, 0x64, 0xE5, 0x4C, 0x30, 0xE1,
-0x05, 0x7F, 0x03, 0x12, 0x4E, 0x75, 0xE5, 0x4C, 0x30, 0xE4, 0x03, 0x12, 0x57, 0xDC, 0xE5, 0x4C,
-0x30, 0xE5, 0x03, 0x12, 0x57, 0xDE, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x57, 0xE2, 0x74, 0xF3,
-0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x57, 0xA3, 0xF0, 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, 0x01, 0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, 0x46,
-0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47, 0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, 0x01,
-0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5, 0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, 0xF0,
-0x53, 0x91, 0xDF, 0x22, 0x90, 0x01, 0xC8, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A,
-0x82, 0x79, 0x03, 0x7F, 0xFF, 0xFE, 0x12, 0x2B, 0x27, 0xBF, 0x01, 0x09, 0x90, 0x82, 0x03, 0xE0,
-0x64, 0x03, 0x60, 0x03, 0x22, 0x21, 0x56, 0xE4, 0x90, 0x82, 0x08, 0xF0, 0x90, 0x82, 0x08, 0xE0,
-0xFF, 0xC3, 0x94, 0x02, 0x40, 0x02, 0x21, 0x91, 0xC3, 0x74, 0xFE, 0x9F, 0xFF, 0xE4, 0x94, 0x00,
-0xFE, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x04, 0x12, 0x2B, 0x27, 0xEF, 0x64, 0x01, 0x70, 0x77, 0x90,
-0x82, 0x04, 0xE0, 0xFF, 0x54, 0xC0, 0xFE, 0x60, 0x05, 0xEF, 0x54, 0x0C, 0x70, 0x16, 0x90, 0x82,
-0x04, 0xE0, 0xFF, 0x54, 0x30, 0x60, 0x67, 0xEF, 0x54, 0x03, 0x60, 0x62, 0x90, 0x82, 0x05, 0x74,
-0x01, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x82, 0x05, 0xF0, 0x90, 0x82, 0x05, 0xE0, 0x90, 0x82, 0x04,
-0x70, 0x16, 0xE0, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x82, 0x06, 0xF0, 0xEF, 0x54, 0x0C,
-0x13, 0x13, 0x54, 0x3F, 0xA3, 0xF0, 0x80, 0x0D, 0xE0, 0xFE, 0x54, 0x30, 0x90, 0x82, 0x06, 0xF0,
-0xEE, 0x54, 0x03, 0xA3, 0xF0, 0x90, 0x82, 0x06, 0xE0, 0x64, 0x30, 0x70, 0x54, 0xA3, 0xE0, 0x64,
-0x02, 0x70, 0x4E, 0x90, 0x00, 0xF5, 0xE0, 0x54, 0x40, 0x90, 0x82, 0x09, 0xF0, 0xE0, 0x70, 0x41,
-0xA3, 0x74, 0x02, 0xF0, 0x80, 0x10, 0x90, 0x82, 0x0A, 0x74, 0x01, 0xF0, 0x80, 0x08, 0x90, 0x82,
-0x08, 0xE0, 0x04, 0xF0, 0x01, 0xBC, 0x90, 0x01, 0xC4, 0x74, 0x94, 0xF0, 0x74, 0x58, 0xA3, 0xF0,
-0x90, 0x82, 0x0A, 0xE0, 0x90, 0x01, 0xC8, 0xF0, 0x90, 0x82, 0x04, 0xE0, 0x90, 0x01, 0xC9, 0xF0,
-0x90, 0x82, 0x05, 0xE0, 0x90, 0x01, 0xCA, 0xF0, 0xE4, 0xFD, 0x7F, 0x1F, 0x12, 0x32, 0x1E, 0x80,
-0xD5, 0x22, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD,
-0x00, 0xE0, 0x54, 0xBF, 0xF0, 0x11, 0x94, 0xF1, 0x76, 0x12, 0x32, 0x77, 0x12, 0x6B, 0xF7, 0xF1,
-0x51, 0x7F, 0x01, 0x12, 0x4D, 0x63, 0x7F, 0x02, 0x12, 0x4D, 0x63, 0x7F, 0x03, 0x12, 0x4D, 0x63,
-0x7F, 0x04, 0x12, 0x4D, 0x63, 0x31, 0xFF, 0x31, 0xE4, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD,
-0x7F, 0x80, 0x12, 0x32, 0x1E, 0x75, 0x20, 0xFF, 0xF1, 0x67, 0x12, 0x6C, 0x27, 0xF1, 0x7E, 0xE4,
-0xFF, 0x02, 0x4D, 0xEC, 0xF1, 0x55, 0xF1, 0x6E, 0x51, 0x42, 0xF1, 0x88, 0x90, 0x81, 0xFE, 0xE0,
-0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xF1,
-0xC7, 0x90, 0x80, 0x01, 0xEF, 0xF0, 0x51, 0x11, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x02, 0x2D,
-0xA7, 0x12, 0x6B, 0x58, 0x12, 0x6B, 0x88, 0x12, 0x6B, 0xB9, 0x12, 0x6B, 0xD8, 0xE4, 0xF5, 0x35,
-0xF5, 0x36, 0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F,
-0x51, 0x12, 0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02,
-0x32, 0x1E, 0x90, 0x80, 0xE4, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x80, 0xE9, 0xE0, 0x54, 0xFE, 0xF0,
-0x90, 0x06, 0x90, 0xE0, 0x44, 0x20, 0xF0, 0x90, 0x80, 0xE5, 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, 0xA3, 0xE0, 0x54, 0xFE, 0xF0,
-0x90, 0x80, 0xE6, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x80, 0xE8, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0xEF,
-0x60, 0x58, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x90, 0x81, 0xF1, 0xE0, 0xFF, 0x60, 0x02,
-0x71, 0x3D, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16, 0xE0,
-0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0x9F, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x06,
-0x09, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x71, 0x9C, 0x90, 0x02, 0x86,
-0xE0, 0x44, 0x04, 0xF0, 0x71, 0x09, 0xF1, 0x4F, 0x91, 0x2A, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90,
-0x01, 0x34, 0x74, 0x08, 0xF0, 0xFD, 0xE4, 0xFF, 0xE1, 0x9A, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22,
-0xF0, 0x7D, 0x08, 0xE4, 0xFF, 0xF1, 0xAF, 0x90, 0x06, 0x90, 0xE4, 0xF0, 0x90, 0x02, 0x86, 0xE0,
-0x54, 0xFB, 0xF0, 0x71, 0x1A, 0xF1, 0x50, 0x41, 0x42, 0x12, 0x65, 0xC1, 0x90, 0x02, 0x87, 0xE0,
-0x70, 0xF7, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x02, 0xF0, 0x22, 0x51, 0x57, 0x90, 0x01, 0x3F, 0x74,
-0x04, 0xF0, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0xB4, 0x01, 0x07, 0x90, 0xFD, 0x00, 0xE0, 0x54, 0xEF,
-0xF0, 0xEF, 0xB4, 0x01, 0x07, 0x90, 0xFE, 0x10, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0xB1, 0x8E, 0x7E,
-0x00, 0x74, 0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75,
-0x16, 0x08, 0x7B, 0x01, 0x7A, 0x80, 0x79, 0xFB, 0x12, 0x2B, 0xED, 0x90, 0x80, 0xFB, 0xE0, 0x90,
-0x81, 0x03, 0xF0, 0x90, 0x80, 0xFC, 0xE0, 0x90, 0x81, 0x04, 0xF0, 0x90, 0x80, 0xFD, 0xE0, 0x90,
-0x81, 0x05, 0xF0, 0x90, 0x80, 0xFE, 0xE0, 0x90, 0x81, 0x06, 0xF0, 0x90, 0x80, 0xFF, 0xE0, 0x90,
-0x81, 0x07, 0xF0, 0x90, 0x81, 0x00, 0xE0, 0x90, 0x81, 0x08, 0xF0, 0x90, 0x81, 0x01, 0xE0, 0x90,
-0x81, 0x09, 0xF0, 0x90, 0x81, 0x02, 0xE0, 0x90, 0x81, 0x0A, 0xF0, 0x22, 0x12, 0x6F, 0x85, 0x90,
-0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2,
-0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E,
-0xA2, 0x90, 0x83, 0x97, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xFD, 0xFF, 0x91, 0x07,
-0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83, 0xA3, 0x12, 0x20,
-0xCE, 0x90, 0x83, 0xA3, 0x12, 0x49, 0x6E, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E,
-0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90,
-0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xC0, 0x07,
-0xC0, 0x05, 0x90, 0x83, 0x97, 0x12, 0x49, 0x6E, 0x90, 0x83, 0x70, 0x12, 0x20, 0xCE, 0xD0, 0x05,
-0xD0, 0x07, 0x12, 0x69, 0x30, 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, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D,
-0x5C, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x83, 0x9F, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x9F, 0x12, 0x49,
-0x6E, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85,
-0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90,
-0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2,
-0x90, 0x83, 0x97, 0x12, 0x20, 0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0x91, 0x07, 0xD0,
-0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F, 0xA4, 0xFF, 0x54,
-0x01, 0xFE, 0x90, 0x80, 0xE4, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE,
-0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D,
-0xFF, 0x90, 0x80, 0xE4, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12,
-0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x80, 0xE4, 0xF0, 0xEE,
-0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16,
-0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0x9F, 0xF0, 0xA3, 0xEF, 0xF0, 0x90,
-0x80, 0xE4, 0xE0, 0xC3, 0x13, 0x54, 0x01, 0xFF, 0xB1, 0x49, 0x90, 0x80, 0xE4, 0xE0, 0x13, 0x13,
-0x54, 0x01, 0xFF, 0xF1, 0x5B, 0x90, 0x80, 0xE4, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFF, 0xB1,
-0x54, 0x90, 0x80, 0xE4, 0xE0, 0xC4, 0x54, 0x01, 0xFF, 0xF1, 0x61, 0x90, 0x80, 0xE4, 0xE0, 0x54,
-0x01, 0xFF, 0x51, 0x8F, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xEF, 0x60, 0x07, 0x90, 0x81, 0xF2, 0xE0,
-0xFF, 0xB1, 0xA2, 0x22, 0xE4, 0xFD, 0xFC, 0xEF, 0x60, 0x33, 0x90, 0x81, 0xF5, 0xE0, 0xFF, 0xB1,
-0x8E, 0x7C, 0x00, 0xAD, 0x07, 0x74, 0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0x90,
-0x82, 0x1A, 0x12, 0x49, 0x8F, 0x90, 0x82, 0x1A, 0x12, 0x49, 0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89,
-0x15, 0x75, 0x16, 0x4A, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x0B, 0x12, 0x2B, 0xED, 0x22, 0xE4, 0xFE,
-0xEF, 0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0, 0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF,
-0x06, 0x22, 0xB1, 0x8E, 0x7E, 0x00, 0x90, 0x83, 0xB1, 0xB1, 0xEA, 0x90, 0x83, 0xB1, 0xA3, 0xE0,
-0x2F, 0x24, 0x36, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16,
-0x04, 0x7B, 0x01, 0x7A, 0x80, 0x79, 0xF6, 0x12, 0x2B, 0xED, 0xE4, 0xFF, 0x74, 0x18, 0x2F, 0xF5,
-0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0xEA, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80,
-0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x06, 0xE3, 0x22, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24,
-0x20, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xE4, 0x90, 0x83, 0xB4, 0xF0, 0xFF, 0x12, 0x1F,
-0xA4, 0x30, 0xE7, 0x08, 0x90, 0x83, 0xB4, 0x74, 0x02, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x83, 0xB4,
-0xF0, 0x12, 0x6E, 0xF9, 0x90, 0x83, 0xB4, 0xE0, 0x24, 0x18, 0x2F, 0xFF, 0x22, 0x90, 0x82, 0x17,
-0x12, 0x49, 0x8F, 0xEF, 0x12, 0x4A, 0x40, 0x5E, 0x49, 0x00, 0x5E, 0x52, 0x01, 0x5E, 0x5A, 0x02,
-0x5E, 0x63, 0x03, 0x5E, 0x6C, 0x04, 0x5E, 0x7C, 0x80, 0x5E, 0x74, 0x81, 0x5E, 0x84, 0x82, 0x5E,
-0x8D, 0x83, 0x5E, 0x96, 0x84, 0x00, 0x00, 0x5E, 0x9F, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x02,
-0x6A, 0xD1, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x80, 0x79, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86,
-0x02, 0x6B, 0x19, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x02, 0x70, 0x53, 0x90, 0x82, 0x17, 0x12,
-0x49, 0x86, 0x80, 0x33, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x81, 0xA4, 0x90, 0x82, 0x17, 0x12,
-0x49, 0x86, 0xE1, 0xE1, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x02, 0x71, 0xB9, 0x90, 0x82, 0x17,
-0x12, 0x49, 0x86, 0x02, 0x71, 0xD3, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x02, 0x72, 0x35, 0x90,
-0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x31, 0xEC, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE,
-0x90, 0x81, 0xFE, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00,
-0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0xFF, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82,
-0x00, 0xF0, 0x22, 0x90, 0x82, 0x1A, 0x12, 0x49, 0x8F, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF,
-0xFE, 0x12, 0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x82, 0x1A, 0x12, 0x49, 0x86,
-0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0x1E, 0xF0, 0x80, 0x05, 0x90, 0x82, 0x1E, 0xEF,
-0xF0, 0x90, 0x82, 0x1D, 0xEE, 0xF0, 0x90, 0x82, 0x1E, 0xE0, 0xFE, 0x90, 0x82, 0x1D, 0xE0, 0xFF,
-0xD3, 0x9E, 0x50, 0x38, 0x90, 0x82, 0x1A, 0x12, 0x49, 0x86, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFE,
-0x74, 0xA3, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xA3, 0x2F, 0xF5,
-0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xF1, 0x4E, 0x80, 0x07, 0x90, 0x82, 0x1D,
-0xE0, 0xFF, 0xF1, 0x4D, 0x90, 0x82, 0x1D, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x22, 0x22, 0x22, 0x22,
-0x22, 0xE4, 0xF5, 0x4D, 0x22, 0xE4, 0x90, 0x80, 0xA3, 0xF0, 0x22, 0x90, 0x82, 0x1A, 0xEF, 0xF0,
-0x22, 0x90, 0x82, 0x1A, 0xEF, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0xE4, 0x90,
-0x80, 0x9D, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x01,
-0xE4, 0x74, 0x0C, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90, 0x81, 0xFB, 0xE0, 0x54, 0xFE, 0xF0, 0x54,
-0x7F, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D,
-0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x74,
-0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4,
-0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09, 0xE0, 0x7F,
-0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02, 0x7F, 0x03,
-0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F, 0xA4, 0xFC, 0x20, 0xE0, 0x05, 0x71,
-0x1A, 0x02, 0x60, 0xE8, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x80, 0xE5, 0xE0, 0x54,
-0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F,
-0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x80, 0xE5, 0xF0, 0xEE, 0x54,
-0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF,
-0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x80, 0xE5, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E,
-0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x80,
-0xE5, 0xF0, 0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F,
-0xBD, 0xFD, 0x54, 0x80, 0xFF, 0x90, 0x80, 0xE6, 0xE0, 0x54, 0x7F, 0x4F, 0xF0, 0xEC, 0x13, 0x13,
-0x54, 0x3F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x04, 0xF0, 0x12, 0x1F, 0xA4, 0x13,
-0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x80,
-0x01, 0xE0, 0x64, 0x02, 0x70, 0x44, 0x90, 0x80, 0xE6, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54,
-0x01, 0x20, 0xE0, 0x36, 0xED, 0x54, 0x7F, 0xFE, 0xEF, 0x54, 0x80, 0x4E, 0x90, 0x80, 0xE6, 0xF0,
-0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x80, 0xE7, 0xF0, 0x90, 0x80, 0xE5, 0xE0, 0xC4, 0x13,
-0x54, 0x07, 0x30, 0xE0, 0x09, 0xA3, 0xE0, 0x54, 0x7F, 0xFF, 0xE4, 0xFD, 0x80, 0x09, 0x90, 0x80,
-0xE6, 0xE0, 0x54, 0x7F, 0xFF, 0x7D, 0x01, 0x12, 0x56, 0xD0, 0x90, 0x80, 0x01, 0xE0, 0xB4, 0x01,
-0x07, 0x90, 0xFE, 0x10, 0xE0, 0x44, 0x04, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, 0x82,
-0x0B, 0xF0, 0x90, 0x82, 0x0B, 0xE0, 0x64, 0x01, 0xF0, 0x24, 0xED, 0x90, 0x01, 0xC4, 0xF0, 0x74,
-0x60, 0xA3, 0xF0, 0x31, 0x0A, 0x12, 0x4C, 0x9B, 0x80, 0xE8, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F,
-0x01, 0x12, 0x4E, 0x9C, 0x90, 0x82, 0x0C, 0xEF, 0xF0, 0x60, 0xF0, 0x31, 0x1F, 0x80, 0xEC, 0xD3,
-0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x82, 0x0D, 0xF0,
-0x90, 0x82, 0x0D, 0xE0, 0xFD, 0x70, 0x02, 0x41, 0x4A, 0x90, 0x83, 0xA7, 0xE0, 0xFF, 0x74, 0x01,
-0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF,
-0x5D, 0x70, 0x02, 0x41, 0x43, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12,
-0x49, 0x7A, 0xE0, 0x90, 0x82, 0x0E, 0xF0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x82, 0x75, 0x15, 0x0E,
-0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x0F, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xA7, 0xE0,
-0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, 0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82, 0x10, 0xF0, 0x90, 0x83,
-0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82, 0x11, 0xF0,
-0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82,
-0x12, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12, 0x49, 0x7A, 0xE0,
-0x90, 0x82, 0x13, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1, 0x12, 0x49,
-0x7A, 0xE0, 0x90, 0x82, 0x14, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF2,
-0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82, 0x15, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90,
-0x01, 0xF3, 0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82, 0x16, 0xF0, 0x90, 0x82, 0x0D, 0xE0, 0xFF, 0x90,
-0x83, 0xA7, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4,
-0x5F, 0x90, 0x82, 0x0D, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80,
-0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x82, 0x0F, 0xE0, 0xFF, 0x7B, 0x01,
-0x7A, 0x82, 0x79, 0x10, 0x12, 0x5E, 0x1D, 0x90, 0x83, 0xA7, 0xE0, 0x04, 0xF0, 0xE0, 0x54, 0x03,
-0xF0, 0x21, 0x30, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4,
-0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x4E, 0x9C, 0x90, 0x82, 0x1F, 0xEF, 0xF0, 0x60, 0xF0, 0x51,
-0x63, 0x80, 0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0x80, 0x9E, 0xE0,
-0xFE, 0x90, 0x80, 0x9D, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE,
-0x64, 0x01, 0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13, 0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24,
-0x07, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x51, 0xBB, 0x7F, 0x01, 0xEF, 0x60, 0x16,
-0x90, 0x80, 0x9D, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60,
-0x05, 0xE4, 0x90, 0x80, 0x9D, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3,
-0xC0, 0xD0, 0x90, 0x82, 0x20, 0x12, 0x49, 0x8F, 0x90, 0x83, 0xA8, 0xE0, 0xFF, 0x04, 0xF0, 0x90,
-0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x71, 0x1E, 0xEF, 0x60, 0x3A, 0x90,
-0x82, 0x20, 0x12, 0x49, 0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F,
-0xBD, 0x24, 0x02, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x82,
-0x20, 0x12, 0x49, 0x86, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74,
-0xFF, 0xF0, 0x90, 0x01, 0xCB, 0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10,
-0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x9B, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0,
-0xA3, 0xF0, 0x90, 0x83, 0x9B, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D,
-0xC3, 0x90, 0x83, 0x9E, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0x9D, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90,
-0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x83, 0x9D, 0xE4, 0x75, 0xF0,
-0x01, 0x12, 0x49, 0x4B, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F, 0x01, 0xD0,
-0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x4E, 0x9C, 0x90, 0x82, 0x23,
-0xEF, 0xF0, 0x60, 0xF0, 0xD1, 0xEB, 0xBF, 0x01, 0xEB, 0x71, 0x8D, 0x80, 0xE7, 0xD3, 0x10, 0xAF,
-0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x2E, 0x74, 0x08, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3,
-0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, 0x7C, 0x00, 0x24, 0x00,
-0xFF, 0xEC, 0x3E, 0x90, 0x82, 0x24, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x82, 0xE0, 0x90, 0x82,
-0x2D, 0xF0, 0x90, 0x80, 0xE4, 0xE0, 0x20, 0xE0, 0x02, 0xA1, 0xA9, 0x90, 0x80, 0xE9, 0xE0, 0x20,
-0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x18, 0x90, 0x80, 0x01, 0xE0, 0xB4, 0x01, 0x0E,
-0x90, 0xFD, 0x01, 0xE0, 0x20, 0xE6, 0x07, 0x90, 0xFD, 0x00, 0xE0, 0x44, 0x10, 0xF0, 0x12, 0x52,
-0xAE, 0xE4, 0x90, 0x82, 0x2C, 0xF0, 0x90, 0x82, 0x2D, 0xE0, 0xFF, 0x90, 0x82, 0x2C, 0xE0, 0xC3,
-0x9F, 0x40, 0x02, 0xA1, 0xA9, 0x90, 0x82, 0x24, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xEC, 0xFF, 0x90,
-0xFD, 0x11, 0xF0, 0x90, 0x82, 0x26, 0xED, 0xF0, 0x90, 0x82, 0x30, 0xEF, 0xF0, 0x90, 0x82, 0x26,
-0xE0, 0xFF, 0x24, 0x02, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33,
-0x33, 0x54, 0xF8, 0x90, 0x82, 0x2A, 0xF0, 0xEF, 0x24, 0x18, 0xFF, 0xE0, 0xFE, 0x2F, 0x90, 0x82,
-0x27, 0xF0, 0x90, 0x82, 0x25, 0xE0, 0x24, 0x18, 0xFD, 0x90, 0x82, 0x24, 0xE0, 0x34, 0x00, 0xFC,
-0xEE, 0x7E, 0x00, 0x2D, 0xFF, 0xEE, 0x3C, 0x90, 0x82, 0x28, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x82,
-0x27, 0xE0, 0xFD, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0xFC, 0x90,
-0x82, 0x2B, 0xF0, 0x74, 0x00, 0x2D, 0xF9, 0xE4, 0x34, 0xFB, 0xFA, 0x7B, 0x01, 0x12, 0x5D, 0xF8,
-0x90, 0x82, 0x2F, 0xEF, 0xF0, 0x90, 0x82, 0x26, 0xE0, 0xFD, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34,
-0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0,
-0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x54, 0x3F, 0xFE, 0x90, 0x82, 0x31, 0xF0, 0xA3, 0xEF,
-0xF0, 0x90, 0x82, 0x2A, 0xE0, 0x24, 0x18, 0xFD, 0xEC, 0x33, 0xFC, 0xED, 0x2F, 0xFF, 0xEC, 0x3E,
-0xFE, 0xD1, 0x85, 0x90, 0x82, 0x26, 0xE0, 0x24, 0x0F, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83,
-0xE0, 0xFD, 0x90, 0x82, 0x24, 0xEE, 0x8F, 0xF0, 0x12, 0x49, 0x4B, 0x90, 0x80, 0x9F, 0xE0, 0xFE,
-0xA3, 0xE0, 0xFF, 0xD3, 0x90, 0x82, 0x25, 0xE0, 0x9F, 0x90, 0x82, 0x24, 0xE0, 0x9E, 0x40, 0x1B,
-0x90, 0x80, 0xA0, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0x9F, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0x90,
-0x82, 0x25, 0xE0, 0x9F, 0xF0, 0x90, 0x82, 0x24, 0xE0, 0x9E, 0xF0, 0xED, 0x30, 0xE7, 0x06, 0x90,
-0x01, 0xC7, 0x74, 0x21, 0xF0, 0xED, 0x30, 0xE6, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0, 0xED,
-0x30, 0xE5, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x23, 0xF0, 0x90, 0x82, 0x2B, 0xE0, 0x24, 0x40, 0x60,
-0x04, 0x24, 0x20, 0x70, 0x21, 0x90, 0x80, 0xE5, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01,
-0x30, 0xE0, 0x43, 0x90, 0x82, 0x27, 0xE0, 0xFF, 0xF1, 0x28, 0xEF, 0x60, 0x39, 0x90, 0x82, 0x2B,
-0xE0, 0xFF, 0xD1, 0xAE, 0x80, 0x30, 0x90, 0x82, 0x27, 0xE0, 0xFF, 0x90, 0x82, 0x2F, 0xE0, 0xFD,
-0x90, 0x82, 0x2E, 0xE0, 0xFB, 0x90, 0x82, 0x30, 0xE0, 0x90, 0x82, 0x36, 0xF0, 0xF1, 0x7B, 0x90,
-0x80, 0xE4, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x0D, 0x90, 0x82, 0x27, 0xE0, 0xFF, 0x90, 0x82,
-0x2F, 0xE0, 0xFD, 0x12, 0x70, 0x73, 0x90, 0x80, 0xE9, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F,
-0xE0, 0x30, 0xE2, 0x03, 0x12, 0x52, 0xAE, 0xD1, 0xC5, 0xBF, 0x01, 0x0D, 0x90, 0x82, 0x24, 0xB1,
-0xAE, 0x90, 0x82, 0x2C, 0xE0, 0x04, 0xF0, 0x61, 0xF6, 0xD0, 0xD0, 0x92, 0xAF, 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, 0x82, 0x1A, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x87, 0xE0, 0xF9, 0x90, 0x80, 0xE4,
-0xE0, 0x20, 0xE0, 0x02, 0xC1, 0x84, 0xEC, 0xC3, 0x99, 0x40, 0x02, 0xC1, 0x84, 0x90, 0x82, 0x1A,
-0xE0, 0xFA, 0xA3, 0xE0, 0xFB, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0xAD, 0x07, 0x74, 0x02,
-0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8,
-0xFB, 0x74, 0x01, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2D,
-0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x75, 0x83, 0x00, 0x24, 0x00, 0xFF, 0xE5, 0x83,
-0x3E, 0x54, 0x3F, 0xFE, 0xEB, 0x24, 0x18, 0xFB, 0xE4, 0x33, 0xFA, 0xEB, 0x2F, 0xFF, 0xEA, 0x3E,
-0xFE, 0xD1, 0x85, 0x90, 0x82, 0x1A, 0xEE, 0x8F, 0xF0, 0x12, 0x49, 0x4B, 0x90, 0x80, 0x9F, 0xE0,
-0xFE, 0xA3, 0xE0, 0xFF, 0xD3, 0x90, 0x82, 0x1B, 0xE0, 0x9F, 0x90, 0x82, 0x1A, 0xE0, 0x9E, 0x40,
-0x1B, 0x90, 0x80, 0xA0, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0x9F, 0xE0, 0x34, 0x00, 0xFE, 0xC3,
-0x90, 0x82, 0x1B, 0xE0, 0x9F, 0xF0, 0x90, 0x82, 0x1A, 0xE0, 0x9E, 0xF0, 0x90, 0x82, 0x1A, 0xB1,
-0xAE, 0x0C, 0xA1, 0xE6, 0x22, 0x7D, 0x7F, 0xEF, 0x5D, 0xC3, 0x60, 0x14, 0x74, 0xFF, 0x9D, 0xFD,
-0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0x24, 0x80, 0xFF, 0xE4, 0x3E, 0xFE, 0x80, 0x0D,
-0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0xFF, 0x22, 0xEF, 0x90,
-0x01, 0xC7, 0xB4, 0xA0, 0x05, 0x74, 0x04, 0xF0, 0x80, 0x03, 0x74, 0x08, 0xF0, 0x90, 0x80, 0xE9,
-0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x80, 0xE9, 0xE0, 0xFF, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F,
-0xE0, 0x30, 0xE2, 0x14, 0xEF, 0x44, 0x01, 0x90, 0x80, 0xE9, 0xF0, 0x90, 0x80, 0xE5, 0xE0, 0xC4,
-0x54, 0x0F, 0x20, 0xE0, 0x03, 0x7F, 0x00, 0x22, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x83, 0xAF, 0xF0,
-0xA3, 0xF0, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x2C, 0xC3, 0x90, 0x83, 0xB0, 0xE0, 0x94, 0xD0,
-0x90, 0x83, 0xAF, 0xE0, 0x94, 0x07, 0x40, 0x0A, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x04, 0xF0, 0x7F,
-0x00, 0x22, 0x90, 0x83, 0xAF, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x7F, 0x0A, 0x7E, 0x00,
-0x12, 0x32, 0xAA, 0x80, 0xCD, 0x7F, 0x01, 0x22, 0xE4, 0xFE, 0x74, 0x10, 0x2E, 0xF5, 0x82, 0xE4,
-0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFD, 0x74, 0x39, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83,
-0xED, 0xF0, 0xEF, 0x2E, 0x24, 0x04, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x74,
-0x33, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xED, 0xF0, 0x0E, 0xEE, 0xB4, 0x06, 0xCA,
-0x78, 0x39, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x33, 0x7E, 0x00, 0x7F, 0x06,
-0x12, 0x4B, 0xEC, 0xEF, 0x7F, 0x00, 0x70, 0x02, 0x7F, 0x01, 0x22, 0x74, 0x00, 0x2F, 0xF5, 0x82,
-0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0C, 0x64, 0x08, 0x70, 0x64, 0xEF, 0x2D, 0xFE, 0x24,
-0x06, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x88, 0x70, 0x53, 0x74, 0x07, 0x2E,
-0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x8E, 0x70, 0x44, 0xEF, 0x2D, 0x2B, 0xFE,
-0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x03, 0x70, 0x32, 0x74, 0x06,
-0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x30, 0xE3, 0x1A, 0x90, 0x80, 0xE5, 0xE0,
-0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x18, 0x90, 0x01, 0xC7, 0x74, 0x01, 0xF0, 0x90, 0x80,
-0xE9, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x7E, 0x00, 0x90, 0x82, 0x36, 0xE0, 0xFD, 0x12, 0x53, 0x09,
-0x22, 0x90, 0x83, 0x5F, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00,
-0x00, 0xE4, 0x90, 0x83, 0x6D, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x90, 0x83, 0x65,
-0x12, 0x20, 0xCE, 0x90, 0x83, 0x5F, 0xE0, 0xFB, 0x70, 0x08, 0x90, 0x83, 0x65, 0x12, 0x49, 0x6E,
-0x80, 0x16, 0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83,
-0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x83, 0x69, 0x12, 0x20, 0xCE, 0x90, 0x83,
-0x60, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05,
-0xAA, 0x06, 0xAB, 0x07, 0x90, 0x83, 0x69, 0x12, 0x49, 0x6E, 0xED, 0x54, 0x7F, 0xFD, 0xEC, 0x54,
-0x80, 0xFC, 0x12, 0x49, 0x61, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83, 0x69, 0x12, 0x20, 0xCE, 0x90,
-0x83, 0x65, 0x12, 0x49, 0x6E, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F,
-0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x5F, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62,
-0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07,
-0x90, 0x83, 0x69, 0x12, 0x49, 0x6E, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06,
-0x12, 0x2E, 0xA2, 0x90, 0x83, 0x65, 0x12, 0x49, 0x6E, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x85, 0xBB,
-0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x5F, 0xE0, 0x70, 0x04,
-0x7F, 0x20, 0x80, 0x09, 0x90, 0x83, 0x5F, 0xE0, 0xB4, 0x01, 0x16, 0x7F, 0x28, 0x7E, 0x08, 0x12,
-0x2D, 0x5C, 0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF, 0xE4, 0x90, 0x83, 0x6D, 0xEF,
-0xF0, 0x90, 0x83, 0x6D, 0xE0, 0x90, 0x83, 0x5F, 0x60, 0x0E, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24,
-0x66, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x64, 0xF5,
-0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0xED, 0x54,
-0x0F, 0xFD, 0xE4, 0xFC, 0x90, 0x83, 0x61, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x61, 0x02, 0x49, 0x6E,
-0x90, 0x83, 0x6E, 0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x83, 0x74, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00,
-0x00, 0xAF, 0x03, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05,
-0xAA, 0x06, 0xAB, 0x07, 0x90, 0x83, 0x70, 0x12, 0x49, 0x6E, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC,
-0x12, 0x49, 0x61, 0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x83, 0x74, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x6E,
-0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE,
-0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x83, 0x74, 0x12, 0x49, 0x6E, 0x90, 0x85, 0xBB,
-0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
-0xD0, 0x12, 0x67, 0xF1, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8E, 0x19, 0x8F, 0x1A, 0xE5, 0x1E, 0x54,
-0x07, 0xC4, 0x33, 0x54, 0xE0, 0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, 0xE5, 0x1D, 0x54, 0x07,
-0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0xA3, 0xF0, 0xEB,
-0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0x85,
-0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, 0x1A, 0x82, 0x8E, 0x83,
-0xA3, 0xA3, 0xA3, 0x74, 0x03, 0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xA3,
-0x74, 0x01, 0xF0, 0x22, 0x90, 0x83, 0x78, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xAD, 0x03, 0xAC, 0x02,
-0xE4, 0x90, 0x83, 0x80, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0xC4, 0x74, 0x04, 0xF0, 0x74, 0x6A, 0xA3,
-0xF0, 0xEC, 0x54, 0x3F, 0xFC, 0x90, 0x01, 0x40, 0xED, 0xF0, 0xAE, 0x04, 0xEE, 0xA3, 0xF0, 0x90,
-0x83, 0x78, 0xE0, 0x24, 0x81, 0x60, 0x34, 0x24, 0xDA, 0x60, 0x1C, 0x24, 0x3C, 0x70, 0x41, 0x90,
-0x83, 0x79, 0xE0, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0x90, 0x83, 0x7D, 0xF0, 0xA3, 0x74, 0x69,
-0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x80, 0x2C, 0x90, 0x83, 0x79, 0xE0, 0x54, 0x01, 0x90, 0x83, 0x7D,
-0xF0, 0xA3, 0x74, 0xA5, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x80, 0x18, 0x90, 0x83, 0x79, 0xE0, 0xC4,
-0x54, 0x10, 0x90, 0x83, 0x7D, 0xF0, 0xA3, 0x74, 0x7F, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0x80, 0x03,
-0x7F, 0x00, 0x22, 0x90, 0x83, 0x7E, 0xE0, 0x90, 0x01, 0x06, 0xF0, 0x90, 0x83, 0x7D, 0xE0, 0x60,
-0x0E, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x83, 0x7C, 0xE0, 0x90, 0x01, 0x43, 0xF0, 0x80, 0x0D, 0x90,
-0x01, 0x43, 0xE4, 0xF0, 0x90, 0x83, 0x7D, 0xE0, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x83, 0x7F, 0xE0,
-0xFF, 0x90, 0x01, 0x42, 0xE0, 0x5F, 0xFF, 0x90, 0x83, 0x7D, 0xE0, 0x6F, 0x60, 0xEE, 0x74, 0x04,
-0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x6A, 0xA3, 0xF0, 0x90, 0x01, 0x43, 0xE4, 0xF0, 0x7F, 0x01,
-0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80,
-0x02, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x03, 0xF0, 0x90,
-0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x04, 0xF0, 0x90, 0x00, 0x03, 0x12,
-0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x05, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF,
-0xAE, 0x05, 0xED, 0x2F, 0x90, 0x80, 0x06, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
-0x12, 0x1F, 0xA4, 0xFF, 0x90, 0x80, 0xE3, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x00, 0x01, 0x12, 0x1F,
-0xBD, 0x64, 0x01, 0x60, 0x17, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x80, 0x0F, 0x90, 0x00, 0x01,
-0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
-0x22, 0x8F, 0x0F, 0x22, 0x8F, 0x1F, 0x22, 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, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x51, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32,
-0x1E, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x32, 0x1E, 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, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12,
-0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x57, 0x02, 0x32, 0x1E, 0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75,
-0x3F, 0x07, 0x75, 0x40, 0x02, 0x90, 0x01, 0x30, 0xE5, 0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3,
-0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40, 0xF0, 0x22, 0x75, 0x45, 0x0E, 0x75, 0x46, 0x01, 0x75, 0x47,
-0x03, 0x75, 0x48, 0x62, 0x90, 0x01, 0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5,
-0x47, 0xF0, 0xA3, 0xE5, 0x48, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x01,
-0x9C, 0x74, 0x7E, 0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74, 0x24, 0xF0,
-0x90, 0x01, 0x9B, 0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01, 0x99, 0xE4,
-0xF0, 0x90, 0x01, 0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x82, 0x03, 0xF0, 0xA3, 0xF0, 0x90, 0x01,
-0x98, 0xE0, 0x7F, 0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3E, 0xC3, 0x90,
-0x82, 0x04, 0xE0, 0x94, 0x88, 0x90, 0x82, 0x03, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC1,
-0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x82, 0x03, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x7F,
-0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x82, 0x04, 0xE0, 0x94, 0x32, 0x90, 0x82, 0x03,
-0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB2, 0x22, 0x90, 0x00, 0x54,
-0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55, 0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5,
-0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD, 0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A,
-0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57,
-0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, 0xA3,
-0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3, 0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, 0xF5,
-0x44, 0x90, 0x01, 0x34, 0xE5, 0x41, 0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, 0xA3,
-0xE5, 0x44, 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, 0x82, 0x49, 0x12, 0x49, 0x8F, 0x91, 0xE4, 0xEF, 0x64, 0x01, 0x60, 0x02, 0xA1,
-0xE0, 0x90, 0x81, 0xF2, 0x12, 0x51, 0xBD, 0x90, 0x82, 0x50, 0x12, 0x5D, 0xEA, 0x90, 0x82, 0x52,
-0xEF, 0xF0, 0x90, 0x82, 0x50, 0xA3, 0xE0, 0x24, 0x20, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01,
-0x90, 0x82, 0x4F, 0xE0, 0xFD, 0xB1, 0xE1, 0x90, 0x82, 0x50, 0xA3, 0xE0, 0x24, 0x30, 0xF9, 0xE4,
-0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x82, 0x4C, 0x12, 0x49,
-0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03,
-0x12, 0x2B, 0xED, 0x90, 0x82, 0x50, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x3A, 0xF9, 0xE4,
-0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x82, 0x4C, 0x12, 0x49,
-0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03,
-0x12, 0x2B, 0xED, 0x90, 0x82, 0x50, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x40, 0xF9, 0xE4,
-0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x82, 0x49, 0x12, 0x49,
-0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03,
-0x12, 0x2B, 0xED, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0,
-0x22, 0x90, 0x82, 0xEE, 0xED, 0xF0, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x8F, 0xE4, 0x90, 0x82, 0xEF,
-0xF0, 0xA3, 0xF0, 0x12, 0x5D, 0xF8, 0x90, 0x82, 0xEF, 0xEF, 0xF0, 0x90, 0x82, 0xEB, 0x12, 0x49,
-0x86, 0xD1, 0xF9, 0x90, 0x82, 0xF0, 0xEF, 0xF0, 0x90, 0x80, 0xFA, 0xE0, 0x24, 0xFE, 0x60, 0x1D,
-0x24, 0xFE, 0x60, 0x19, 0x14, 0x60, 0x07, 0x14, 0x60, 0x04, 0x24, 0x05, 0x70, 0x60, 0x7B, 0x01,
-0x7A, 0x80, 0x79, 0xFB, 0x90, 0x82, 0xEE, 0xE0, 0xFD, 0xD1, 0x7F, 0x80, 0x23, 0x7B, 0x01, 0x7A,
-0x81, 0x79, 0x03, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x8F, 0x90, 0x82, 0xEE, 0xE0, 0x90, 0x82, 0xF7,
-0xF0, 0x90, 0x80, 0xFA, 0xE0, 0x90, 0x82, 0xF8, 0xF0, 0x7A, 0x80, 0x79, 0xFB, 0x12, 0x80, 0xDC,
-0x90, 0x82, 0xF0, 0xE0, 0xFF, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x86, 0x90, 0x82, 0xEF, 0xE0, 0x7C,
-0x00, 0x29, 0xF9, 0xEC, 0x3A, 0xFA, 0xC3, 0xE9, 0x9F, 0xF9, 0xEA, 0x94, 0x00, 0xFA, 0x75, 0x13,
-0x01, 0x75, 0x14, 0x80, 0x75, 0x15, 0xFB, 0xA3, 0xE0, 0xF5, 0x16, 0x12, 0x2B, 0xED, 0x22, 0x90,
-0x82, 0xF4, 0xED, 0xF0, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x8F, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD,
-0x90, 0x82, 0xF8, 0xF0, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15,
-0x75, 0x16, 0x03, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0xF5, 0x12, 0x2B, 0xED, 0x90, 0x82, 0xF4, 0xE0,
-0x70, 0x46, 0xFF, 0x74, 0xF5, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0xB4, 0xFF,
-0x0E, 0x74, 0xF5, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74,
-0xF5, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF,
-0xB4, 0x03, 0xD0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x82, 0x75, 0x15, 0xF5, 0x75, 0x16, 0x03, 0x90,
-0x82, 0xF1, 0x12, 0x49, 0x86, 0x12, 0x2B, 0xED, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
-0x90, 0x83, 0x82, 0x12, 0x49, 0x8F, 0xE4, 0x90, 0x83, 0x85, 0xF0, 0x90, 0x83, 0x82, 0x12, 0x49,
-0x86, 0xE9, 0x24, 0x04, 0xF9, 0xE4, 0x3A, 0x8B, 0x13, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06,
-0x7B, 0x01, 0x7A, 0x83, 0x79, 0x86, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x86, 0xE0, 0x20, 0xE0, 0x05,
-0x90, 0x81, 0xEF, 0x80, 0x03, 0x90, 0x81, 0xF0, 0xE0, 0x90, 0x80, 0xFA, 0xF0, 0x90, 0x80, 0xFA,
-0xE0, 0x14, 0x60, 0x11, 0x14, 0x60, 0x16, 0x24, 0xFE, 0x60, 0x12, 0x14, 0x60, 0x07, 0x14, 0x60,
-0x04, 0x24, 0x06, 0x80, 0x10, 0x90, 0x83, 0x85, 0x74, 0x04, 0xF0, 0x80, 0x0D, 0x90, 0x83, 0x85,
-0x74, 0x08, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x83, 0x85, 0xF0, 0x90, 0x83, 0x85, 0xE0, 0xFF, 0xD0,
-0xD0, 0x92, 0xAF, 0x22, 0xC3, 0xEE, 0x94, 0x01, 0x40, 0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10,
-0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xE4, 0x90, 0x83, 0xAB, 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, 0x83, 0xAC, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0xAB, 0xE0, 0x94, 0x03, 0x40, 0x0A,
-0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x32,
-0xAA, 0x90, 0x83, 0xAB, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x80, 0xBF, 0x74, 0x45, 0x2F,
-0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE,
-0xF0, 0x22, 0x74, 0x45, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38, 0x2F,
-0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x14,
-0x90, 0x80, 0x03, 0xE0, 0xFF, 0xE4, 0xFD, 0x12, 0x51, 0xC1, 0x8E, 0x0D, 0x8F, 0x0E, 0x90, 0x04,
-0x1F, 0x74, 0x20, 0xF0, 0x22, 0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3,
-0x90, 0x80, 0xA0, 0xE0, 0x9B, 0x90, 0x80, 0x9F, 0xE0, 0x9A, 0x50, 0x13, 0xA3, 0xE0, 0x24, 0x01,
-0xFF, 0x90, 0x80, 0x9F, 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, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0xFB, 0xE0, 0x54, 0xFE,
-0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81,
-0xFC, 0xF0, 0x22, 0x90, 0x82, 0x33, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x78, 0x3B, 0x7C, 0x82, 0x7D,
-0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC0, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x48, 0xD0, 0x78, 0x41,
-0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC6, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x48,
-0xD0, 0x78, 0x45, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xCA, 0x7E, 0x00, 0x7F,
-0x04, 0x12, 0x48, 0xD0, 0x90, 0x82, 0x34, 0xE0, 0xFF, 0x90, 0x82, 0x33, 0xE0, 0x2F, 0xFF, 0x24,
-0x06, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x08, 0x60, 0x02, 0x21, 0xB8, 0x74,
-0x07, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x06, 0x60, 0x02, 0x21, 0xB8,
-0x90, 0x06, 0x30, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x82, 0x33, 0xE0, 0x24, 0x0A, 0xF9, 0xE4, 0x34,
-0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0x7B, 0x01, 0x7A, 0x82, 0x79,
-0x35, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x34, 0xE0, 0xFF, 0x90, 0x82, 0x33, 0xE0, 0x2F, 0x24, 0x10,
-0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0x7B, 0x01,
-0x7A, 0x82, 0x79, 0x3B, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x34, 0xE0, 0xFF, 0x90, 0x82, 0x33, 0xE0,
-0x2F, 0x24, 0x16, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16,
-0x04, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x41, 0x12, 0x2B, 0xED, 0x78, 0x35, 0x7C, 0x82, 0x7D, 0x01,
-0x7B, 0x01, 0x7A, 0x80, 0x79, 0xEA, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x4B, 0xEC, 0xEF, 0x70, 0x58,
-0x90, 0x82, 0x34, 0xE0, 0xFF, 0x90, 0x82, 0x33, 0xE0, 0x2F, 0x24, 0x20, 0xF9, 0xE4, 0x34, 0xFB,
-0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x45,
-0x12, 0x2B, 0xED, 0x78, 0x45, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x80, 0x79, 0xF6, 0x7E,
-0x00, 0x7F, 0x04, 0x12, 0x4B, 0xEC, 0xEF, 0x70, 0x18, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x3B, 0x90,
-0x82, 0x4C, 0x12, 0x49, 0x8F, 0xE4, 0x90, 0x82, 0x4F, 0xF0, 0x7A, 0x82, 0x79, 0x41, 0x02, 0x6D,
-0x12, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0x90, 0x82, 0x1A,
-0xF0, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0xEF, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81,
-0xF0, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E,
-0x90, 0x81, 0xF1, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x81, 0xF2,
-0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x81, 0xF3, 0xF0, 0x90, 0x00,
-0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x81, 0xF4, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F,
-0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x81, 0xF5, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0xFF, 0xED,
-0x2F, 0x90, 0x81, 0xF6, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F,
-0x90, 0x81, 0xF7, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05,
-0xED, 0x2E, 0x90, 0x81, 0xF8, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90,
-0x81, 0xF9, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x81,
-0xFA, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x8F,
-0x90, 0x82, 0xEE, 0xED, 0xF0, 0xE4, 0x90, 0x83, 0x3A, 0xF0, 0x90, 0x83, 0x3A, 0xE0, 0xFF, 0xC3,
-0x94, 0x40, 0x50, 0x14, 0x74, 0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0,
-0x90, 0x83, 0x3A, 0xE0, 0x04, 0xF0, 0x80, 0xE2, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x86, 0x8B, 0x13,
-0x8A, 0x14, 0x89, 0x15, 0x90, 0x82, 0xEE, 0xE0, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0xF7,
-0x12, 0x2B, 0xED, 0xE4, 0x90, 0x82, 0xF6, 0xF0, 0x90, 0x82, 0xF6, 0xE0, 0xFF, 0xC3, 0x94, 0x40,
-0x50, 0x16, 0x74, 0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x64, 0x36, 0xF0,
-0x90, 0x82, 0xF6, 0xE0, 0x04, 0xF0, 0x80, 0xE0, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x82,
-0xF2, 0xE0, 0xFF, 0xF5, 0x82, 0x75, 0x83, 0x00, 0x74, 0x80, 0x12, 0x1F, 0xFC, 0xEF, 0x75, 0xF0,
-0x08, 0xA4, 0x24, 0x00, 0xFF, 0xE5, 0xF0, 0x34, 0x02, 0xFC, 0x90, 0x00, 0x7E, 0x12, 0x1F, 0xFC,
-0xEF, 0x90, 0x00, 0x7F, 0x12, 0x1F, 0xFC, 0xE4, 0x90, 0x83, 0x37, 0xF0, 0xA3, 0xF0, 0x90, 0x83,
-0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x94, 0xC0, 0xEE, 0x94, 0x00, 0x40, 0x02, 0x81, 0xBD,
-0xC3, 0xEF, 0x94, 0x40, 0xEE, 0x94, 0x00, 0x50, 0x52, 0xA3, 0x74, 0x40, 0xF0, 0x74, 0xF7, 0x2F,
-0xF9, 0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01, 0x74, 0x40, 0x44, 0x88, 0xFD, 0x12, 0x28, 0x08, 0x90,
-0x83, 0x37, 0xA3, 0xE0, 0x24, 0xFB, 0xF9, 0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01, 0xA3, 0xE0, 0x44,
-0x89, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x37, 0xA3, 0xE0, 0x24, 0xFF, 0xF9, 0xE4, 0x34, 0x82,
-0xFA, 0x7B, 0x01, 0xA3, 0xE0, 0x44, 0x8A, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x37, 0xA3, 0xE0,
-0x24, 0x03, 0xF9, 0xE4, 0x34, 0x83, 0xFA, 0x7B, 0x01, 0x61, 0xFE, 0xE4, 0x90, 0x83, 0x39, 0xF0,
-0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA,
-0x3E, 0xFA, 0xE9, 0x24, 0xC0, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0x74, 0x88, 0xFD, 0x12, 0x28, 0x08,
-0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA,
-0x3E, 0xFA, 0xE9, 0x24, 0xC4, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x89, 0xFD, 0x12,
-0x28, 0x08, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29,
-0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xC8, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x8A,
-0xFD, 0x12, 0x28, 0x08, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3,
-0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xCC, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0,
-0x44, 0x8B, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x39, 0xE0, 0x44, 0x90, 0x90, 0x01, 0x8C, 0xF0,
-0xE4, 0x90, 0x83, 0x3B, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x8C, 0xE0, 0x30, 0xE4, 0x22, 0xC3, 0x90,
-0x83, 0x3C, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0x3B, 0xE0, 0x94, 0x03, 0x50, 0x13, 0x7F, 0x01, 0x7E,
-0x00, 0x12, 0x32, 0xAA, 0x90, 0x83, 0x3B, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x80, 0xD7,
-0x90, 0x83, 0x3B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x94, 0xE8, 0xEE, 0x94, 0x03, 0x40, 0x0C,
-0x90, 0x06, 0x31, 0xE0, 0x44, 0x01, 0xF0, 0xEE, 0x90, 0x06, 0x36, 0xF0, 0x90, 0x83, 0x38, 0xE0,
-0x54, 0x3F, 0x64, 0x30, 0x70, 0x4B, 0x90, 0x83, 0x3B, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x8C, 0xE0,
-0x20, 0xE5, 0x22, 0xC3, 0x90, 0x83, 0x3C, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0x3B, 0xE0, 0x94, 0x03,
-0x50, 0x13, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x83, 0x3B, 0xE4, 0x75, 0xF0, 0x01,
-0x12, 0x49, 0x4B, 0x80, 0xD7, 0x90, 0x83, 0x3B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x94, 0xE8,
-0xEE, 0x94, 0x03, 0x40, 0x0C, 0x90, 0x06, 0x31, 0xE0, 0x44, 0x02, 0xF0, 0xEE, 0x90, 0x06, 0x36,
-0xF0, 0x90, 0x83, 0x37, 0xE4, 0x75, 0xF0, 0x10, 0x12, 0x49, 0x4B, 0x61, 0x0E, 0x90, 0x82, 0xF3,
-0x12, 0x49, 0x86, 0xE9, 0x24, 0x10, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x80, 0x12, 0x2A, 0x8F, 0x90,
-0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x0C, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x81, 0x12, 0x2A,
-0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x08, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x82,
-0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x04, 0xF9, 0xE4, 0x3A, 0xFA,
-0x7D, 0x83, 0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0x7D, 0x84, 0x12, 0x2A, 0x8F,
-0xE4, 0x90, 0x83, 0x3A, 0xF0, 0x90, 0x83, 0x3A, 0xE0, 0xFF, 0xC3, 0x94, 0x40, 0x50, 0x14, 0x74,
-0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0, 0x90, 0x83, 0x3A, 0xE0, 0x04,
-0xF0, 0x80, 0xE2, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90,
-0x82, 0xEE, 0xE0, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0xF7, 0x12, 0x2B, 0xED, 0xE4, 0x90,
-0x82, 0xF6, 0xF0, 0x90, 0x82, 0xF6, 0xE0, 0xFF, 0xC3, 0x94, 0x40, 0x50, 0x16, 0x74, 0xF7, 0x2F,
-0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x64, 0x5C, 0xF0, 0x90, 0x82, 0xF6, 0xE0, 0x04,
-0xF0, 0x80, 0xE0, 0xE4, 0x90, 0x82, 0xF6, 0xF0, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0x90, 0x82,
-0xF6, 0xE0, 0xFF, 0xF5, 0x82, 0x75, 0x83, 0x00, 0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xEF, 0x12,
-0x49, 0x86, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF6, 0xE0, 0x04,
-0xF0, 0xE0, 0xB4, 0x14, 0xD3, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x00, 0x14, 0x74, 0x80,
-0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF6, 0x74, 0x15, 0xF0, 0x90, 0x82, 0xF6, 0xE0, 0xFF, 0xC3, 0x94,
-0x3E, 0x50, 0x17, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xE4, 0x12,
-0x1F, 0xFC, 0x90, 0x82, 0xF6, 0xE0, 0x04, 0xF0, 0x80, 0xDF, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86,
-0x90, 0x00, 0x3E, 0x74, 0x02, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x3F, 0x74, 0xA0, 0x12, 0x1F, 0xFC,
-0xE4, 0x90, 0x83, 0x37, 0xF0, 0xA3, 0xF0, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3,
-0x94, 0x80, 0xEE, 0x94, 0x00, 0x40, 0x02, 0xE1, 0xA6, 0xC3, 0xEF, 0x94, 0x40, 0xEE, 0x94, 0x00,
-0x50, 0x52, 0xA3, 0x74, 0x40, 0xF0, 0x74, 0xF7, 0x2F, 0xF9, 0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01,
-0x74, 0x40, 0x44, 0x88, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x37, 0xA3, 0xE0, 0x24, 0xFB, 0xF9,
-0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01, 0xA3, 0xE0, 0x44, 0x89, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83,
-0x37, 0xA3, 0xE0, 0x24, 0xFF, 0xF9, 0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01, 0xA3, 0xE0, 0x44, 0x8A,
-0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x37, 0xA3, 0xE0, 0x24, 0x03, 0xF9, 0xE4, 0x34, 0x83, 0xFA,
-0x7B, 0x01, 0xC1, 0xE7, 0xE4, 0x90, 0x83, 0x39, 0xF0, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90,
-0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xC0, 0xF9, 0xEA,
-0x34, 0xFF, 0xFA, 0x74, 0x88, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90,
-0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xC4, 0xF9, 0xEA,
-0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x89, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x82, 0xEF, 0x12, 0x49,
-0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xC8,
-0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x8A, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x82, 0xEF,
-0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9,
-0x24, 0xCC, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x8B, 0xFD, 0x12, 0x28, 0x08, 0x90,
-0x83, 0x39, 0xE0, 0x44, 0x90, 0x90, 0x01, 0x8C, 0xF0, 0xE4, 0x90, 0x83, 0x3B, 0xF0, 0xA3, 0xF0,
-0x90, 0x01, 0x8C, 0xE0, 0x30, 0xE4, 0x22, 0xC3, 0x90, 0x83, 0x3C, 0xE0, 0x94, 0xE8, 0x90, 0x83,
-0x3B, 0xE0, 0x94, 0x03, 0x50, 0x13, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x83, 0x3B,
-0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x80, 0xD7, 0x90, 0x83, 0x3B, 0xE0, 0xFE, 0xA3, 0xE0,
-0xFF, 0xC3, 0x94, 0xE8, 0xEE, 0x94, 0x03, 0x40, 0x0C, 0x90, 0x06, 0x31, 0xE0, 0x44, 0x01, 0xF0,
-0xEE, 0x90, 0x06, 0x36, 0xF0, 0x90, 0x83, 0x38, 0xE0, 0x54, 0x3F, 0x64, 0x30, 0x70, 0x4B, 0x90,
-0x83, 0x3B, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x8C, 0xE0, 0x20, 0xE5, 0x22, 0xC3, 0x90, 0x83, 0x3C,
-0xE0, 0x94, 0xE8, 0x90, 0x83, 0x3B, 0xE0, 0x94, 0x03, 0x50, 0x13, 0x7F, 0x01, 0x7E, 0x00, 0x12,
-0x32, 0xAA, 0x90, 0x83, 0x3B, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x80, 0xD7, 0x90, 0x83,
-0x3B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x94, 0xE8, 0xEE, 0x94, 0x03, 0x40, 0x0C, 0x90, 0x06,
-0x31, 0xE0, 0x44, 0x02, 0xF0, 0xEE, 0x90, 0x06, 0x36, 0xF0, 0x90, 0x83, 0x37, 0xE4, 0x75, 0xF0,
-0x10, 0x12, 0x49, 0x4B, 0xA1, 0xF7, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x10, 0xF9,
-0xE4, 0x3A, 0xFA, 0x7D, 0x80, 0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24,
-0x0C, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x81, 0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86,
-0xE9, 0x24, 0x08, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x82, 0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12,
-0x49, 0x86, 0xE9, 0x24, 0x04, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x83, 0x12, 0x2A, 0x8F, 0x90, 0x82,
-0xF3, 0x12, 0x49, 0x86, 0x7D, 0x84, 0x12, 0x2A, 0x8F, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x82,
-0x49, 0xED, 0xF0, 0x90, 0x82, 0x47, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x51, 0xF1, 0x90, 0x82, 0x47,
-0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90,
-0x82, 0x4A, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x82, 0x62, 0x74, 0x18, 0xF0,
-0x7E, 0x00, 0x7F, 0x80, 0x7D, 0x00, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x6A, 0x12, 0x4C, 0x10, 0x90,
-0x81, 0xF4, 0xE0, 0xFF, 0x12, 0x5D, 0x8E, 0x90, 0x82, 0x61, 0xEF, 0xF0, 0xF9, 0xE0, 0xFE, 0x24,
-0x21, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0x74, 0x41, 0xF0, 0xEE, 0x24, 0x20, 0xFD, 0xE4,
-0x33, 0xFC, 0x90, 0x82, 0x62, 0xE0, 0x7A, 0x00, 0x2D, 0xFE, 0xEA, 0x3C, 0x90, 0x82, 0x66, 0xF0,
-0xA3, 0xCE, 0xF0, 0x74, 0x20, 0x29, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0x90, 0x82, 0x4C,
-0xE0, 0xFD, 0x12, 0x6D, 0xE1, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49, 0x4B, 0x90,
-0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49, 0x4B, 0x90, 0x82, 0x66, 0xE0, 0xFF, 0xA3, 0xE0,
-0x90, 0x82, 0x64, 0xCF, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x82, 0x6A, 0x74, 0x01, 0xF0, 0xA3, 0x74,
-0x03, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0x74, 0x5F, 0xF0, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x04,
-0x12, 0x49, 0x4B, 0x90, 0x81, 0x59, 0xE0, 0xFF, 0x7E, 0x02, 0xB4, 0xFE, 0x02, 0x7E, 0xFE, 0x90,
-0x82, 0x66, 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, 0x82, 0x6E, 0xF0, 0x90,
-0x82, 0x66, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x90, 0x81, 0xEE, 0xE0, 0x90, 0x82, 0x4A,
-0xB4, 0x01, 0x0B, 0xE0, 0x44, 0x03, 0xFC, 0xA3, 0xE0, 0x44, 0x10, 0xFD, 0x80, 0x09, 0xE0, 0x44,
-0x03, 0xFC, 0xA3, 0xE0, 0x44, 0x20, 0xFD, 0x90, 0x82, 0x68, 0xEC, 0xF0, 0xA3, 0xED, 0xF0, 0x90,
-0x82, 0x6F, 0x74, 0x03, 0xF0, 0xA3, 0x74, 0x12, 0xF0, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x02,
-0x12, 0x49, 0x4B, 0xEF, 0x64, 0xFE, 0x70, 0x37, 0x90, 0x82, 0x66, 0xA3, 0xE0, 0x24, 0x00, 0xF9,
-0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x13, 0x75, 0x14, 0x81, 0x75, 0x15, 0x5C,
-0x75, 0x16, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x75, 0x13, 0x01, 0x75, 0x14, 0x81, 0x75, 0x15,
-0x5C, 0x75, 0x16, 0x02, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x71, 0x12, 0x2B, 0xED, 0x80, 0x60, 0x90,
-0x81, 0x0B, 0xE0, 0xFF, 0xB4, 0x02, 0x2B, 0x90, 0x82, 0x66, 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, 0x82, 0x71, 0xF0, 0xA3, 0x74, 0x20, 0xF0,
-0x80, 0x2D, 0xEF, 0xB4, 0x04, 0x29, 0x90, 0x82, 0x66, 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, 0x82, 0x71, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0x90,
-0x82, 0x66, 0xE4, 0x75, 0xF0, 0x02, 0x12, 0x49, 0x4B, 0xE4, 0x90, 0x82, 0x63, 0xF0, 0x90, 0x82,
-0x63, 0xE0, 0xFF, 0x24, 0x5E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFE, 0x90, 0x82,
-0x66, 0xA3, 0xE0, 0xFD, 0xEF, 0x2D, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEE,
-0xF0, 0x90, 0x82, 0x63, 0xE0, 0xFF, 0x24, 0x5E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0,
-0xFE, 0x74, 0x73, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xEE, 0xF0, 0x90, 0x82, 0x63,
-0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x08, 0xB7, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49,
-0x4B, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x20, 0x12, 0x49, 0x4B, 0x90, 0x82, 0x66, 0xE4, 0x75,
-0xF0, 0x10, 0x12, 0x49, 0x4B, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49, 0x4B, 0x90,
-0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49, 0x4B, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x6A, 0x90,
-0x82, 0xEF, 0x12, 0x49, 0x8F, 0x90, 0x82, 0xF2, 0x74, 0x63, 0xF0, 0x7A, 0x82, 0x79, 0x4D, 0xA3,
-0x12, 0x49, 0x8F, 0x7A, 0x81, 0x79, 0x0D, 0x7D, 0x10, 0x12, 0x72, 0x63, 0xE4, 0x90, 0x82, 0x63,
-0xF0, 0x90, 0x82, 0x63, 0xE0, 0xFF, 0xC3, 0x94, 0x10, 0x50, 0x42, 0x90, 0x82, 0x66, 0xA3, 0xE0,
-0xFE, 0xEF, 0x2E, 0xFF, 0x90, 0x82, 0xEA, 0xF0, 0x7E, 0x00, 0x90, 0x81, 0xF4, 0xE0, 0xFD, 0x12,
-0x6F, 0x74, 0x90, 0x82, 0x61, 0xEF, 0xF0, 0x90, 0x82, 0x63, 0xE0, 0x24, 0x4D, 0xF5, 0x82, 0xE4,
-0x34, 0x82, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x61, 0xE0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34,
-0xFC, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x63, 0xE0, 0x04, 0xF0, 0x80, 0xB4, 0x12, 0x6C, 0xE4,
-0xBF, 0x01, 0x19, 0x90, 0x81, 0xF4, 0x12, 0x51, 0xBD, 0x90, 0x82, 0x61, 0xEF, 0xF0, 0x90, 0x81,
-0xF4, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
-0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xF0, 0xE0, 0xFD, 0xB4, 0x02, 0x0C,
-0x90, 0x82, 0x81, 0x74, 0x80, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0x80, 0x0E, 0xED, 0xB4, 0x04, 0x0A,
-0x90, 0x82, 0x81, 0x74, 0x80, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0xEF, 0x64, 0x02, 0x4E, 0x60, 0x02,
-0x61, 0xDC, 0x90, 0x81, 0x56, 0xE0, 0xFF, 0x64, 0xFE, 0x70, 0x02, 0x61, 0xDC, 0xEF, 0x64, 0x02,
-0x60, 0x07, 0xEF, 0x64, 0x03, 0x60, 0x02, 0x61, 0xDC, 0x90, 0x81, 0xB6, 0xE0, 0xFE, 0xA3, 0xE0,
-0xFD, 0xED, 0xFF, 0x90, 0x82, 0x85, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x7E, 0x00, 0x7F, 0x20, 0x7D,
-0x00, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x61, 0x12, 0x4C, 0x10, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xB8,
-0x90, 0x86, 0x67, 0x12, 0x49, 0x8F, 0x7A, 0x82, 0x79, 0x61, 0x90, 0x86, 0x6A, 0x12, 0x49, 0x8F,
-0x7A, 0x81, 0x79, 0x1D, 0x7D, 0x03, 0x12, 0x02, 0x00, 0x75, 0x13, 0x01, 0x75, 0x14, 0x82, 0x75,
-0x15, 0x69, 0x75, 0x16, 0x10, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x4A, 0x12, 0x2B, 0xED, 0x90, 0x82,
-0x67, 0xE0, 0xFF, 0x54, 0x03, 0x90, 0x82, 0x87, 0xF0, 0x70, 0x02, 0x04, 0xF0, 0xEF, 0x54, 0x04,
-0x90, 0x82, 0x88, 0xF0, 0x90, 0x82, 0x87, 0xE0, 0xFF, 0x90, 0x82, 0x5A, 0xF0, 0x90, 0x82, 0x82,
-0xE0, 0x2F, 0xFE, 0x90, 0x82, 0x81, 0xE0, 0x34, 0x00, 0x90, 0x82, 0x83, 0xF0, 0xA3, 0xCE, 0xF0,
-0x7E, 0x00, 0x7F, 0x06, 0x7D, 0x00, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x5B, 0x12, 0x4C, 0x10, 0x90,
-0x82, 0x5A, 0xE0, 0xFF, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x4A, 0x71, 0xE1, 0xD0, 0xD0, 0x92, 0xAF,
-0x22, 0x90, 0x82, 0x89, 0xEF, 0xF0, 0xA3, 0x12, 0x49, 0x8F, 0x90, 0x82, 0x8A, 0x12, 0x49, 0x86,
-0x12, 0x1F, 0xA4, 0x90, 0x06, 0x74, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x75,
-0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x76, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F,
-0xBD, 0x90, 0x06, 0x77, 0xF0, 0x90, 0x82, 0x89, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x02, 0x90,
-0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E,
-0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x8A, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD,
-0x90, 0x06, 0x74, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x75, 0xF0, 0x90, 0x00,
-0x06, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x76, 0xF0, 0x90, 0x00, 0x07, 0x12, 0x1F, 0xBD, 0x90, 0x06,
-0x77, 0xF0, 0x90, 0x82, 0x89, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x03, 0x90, 0x06, 0x70, 0xF0,
-0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32,
-0xAA, 0x90, 0x82, 0x8A, 0x12, 0x49, 0x86, 0x90, 0x00, 0x08, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x74,
-0xF0, 0x90, 0x00, 0x09, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x75, 0xF0, 0x90, 0x00, 0x0A, 0x12, 0x1F,
-0xBD, 0x90, 0x06, 0x76, 0xF0, 0x90, 0x00, 0x0B, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x77, 0xF0, 0x90,
-0x82, 0x89, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x04, 0x90, 0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0,
-0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82,
-0x8A, 0x12, 0x49, 0x86, 0x90, 0x00, 0x0C, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x74, 0xF0, 0x90, 0x00,
-0x0D, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x75, 0xF0, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x06,
-0x76, 0xF0, 0x90, 0x00, 0x0F, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x77, 0xF0, 0x90, 0x82, 0x89, 0xE0,
-0x75, 0xF0, 0x08, 0xA4, 0x24, 0x05, 0x90, 0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0,
-0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x89, 0xE0, 0xFF,
-0x44, 0x10, 0x90, 0x06, 0x74, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0xA3, 0xF0,
-0xEF, 0x75, 0xF0, 0x08, 0xA4, 0x90, 0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3,
-0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x06, 0x74, 0x74, 0xFF, 0xF0,
-0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x82, 0x89, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x04, 0x90,
-0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E,
-0x00, 0x12, 0x32, 0xAA, 0x90, 0x06, 0x72, 0xE4, 0xF0, 0x22, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x8F,
-0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFD, 0x70, 0x04, 0xFE, 0x7F, 0x01, 0x22, 0xED, 0xC3, 0x94,
-0x06, 0x40, 0x68, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x02, 0xF9, 0xE4, 0x3A, 0xA8,
-0x01, 0xFC, 0xAD, 0x03, 0x7B, 0x01, 0x7A, 0x83, 0x79, 0x4F, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x4B,
-0xEC, 0xEF, 0x70, 0x47, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD,
-0x64, 0x01, 0x70, 0x37, 0x90, 0x00, 0x07, 0x12, 0x1F, 0xBD, 0x70, 0x2F, 0x90, 0x83, 0x8C, 0x12,
-0x49, 0x86, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x12, 0x49,
-0x98, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xFF,
-0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0xC1, 0xDF, 0x90, 0x83, 0x8F, 0x12, 0x49,
-0x86, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x05,
-0xF9, 0xE4, 0x3A, 0xFA, 0xC3, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xE0, 0xE9, 0x95, 0x82, 0xEA, 0x95,
-0x83, 0x50, 0x53, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xC3,
-0x94, 0x14, 0x40, 0x42, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x02, 0xF9, 0xE4, 0x3A,
-0xA8, 0x01, 0xFC, 0xAD, 0x03, 0x7B, 0x01, 0x7A, 0x83, 0x79, 0x5B, 0x7E, 0x00, 0x7F, 0x04, 0x12,
-0x4B, 0xEC, 0xEF, 0x70, 0x21, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x06, 0xF9, 0xE4,
-0x3A, 0xFA, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x90, 0x00,
-0x08, 0x12, 0x49, 0xE7, 0xE1, 0x54, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12,
-0x1F, 0xBD, 0xD3, 0x94, 0x06, 0x40, 0x5E, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x02,
-0xF9, 0xE4, 0x3A, 0xA8, 0x01, 0xFC, 0xAD, 0x03, 0x7B, 0x01, 0x7A, 0x83, 0x79, 0x53, 0x7E, 0x00,
-0x7F, 0x04, 0x12, 0x4B, 0xEC, 0xEF, 0x70, 0x3D, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24,
-0x06, 0xF9, 0xE4, 0x3A, 0xFA, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x92, 0x12, 0x49,
-0x86, 0x90, 0x00, 0x0B, 0x12, 0x49, 0xE7, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01,
-0x12, 0x1F, 0xBD, 0x24, 0xFC, 0xFF, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x90, 0x00, 0x0E, 0xEF,
-0x12, 0x1F, 0xFC, 0x80, 0x6F, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F,
-0xBD, 0xD3, 0x94, 0x06, 0x40, 0x5E, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x02, 0xF9,
-0xE4, 0x3A, 0xA8, 0x01, 0xFC, 0xAD, 0x03, 0x7B, 0x01, 0x7A, 0x83, 0x79, 0x57, 0x7E, 0x00, 0x7F,
-0x04, 0x12, 0x4B, 0xEC, 0xEF, 0x70, 0x3D, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x06,
-0xF9, 0xE4, 0x3A, 0xFA, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86,
-0x90, 0x00, 0x0F, 0x12, 0x49, 0xE7, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12,
-0x1F, 0xBD, 0x24, 0xFC, 0xFF, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x90, 0x00, 0x12, 0xEF, 0x12,
-0x1F, 0xFC, 0x80, 0x00, 0xE4, 0xFE, 0xFF, 0x22, 0x90, 0x83, 0x40, 0x12, 0x20, 0xCE, 0x90, 0x83,
-0x3D, 0x12, 0x49, 0x8F, 0xE4, 0x90, 0x83, 0x4D, 0xF0, 0xA3, 0xF0, 0x90, 0x83, 0x47, 0x12, 0x49,
-0x8F, 0x90, 0x83, 0x40, 0x12, 0x49, 0x6E, 0xE9, 0x2F, 0xF9, 0xEA, 0x3E, 0xFA, 0xEB, 0x3D, 0xFB,
-0x90, 0x83, 0x4A, 0x12, 0x49, 0x8F, 0x90, 0x83, 0x4A, 0x12, 0x49, 0x86, 0xC0, 0x03, 0xC0, 0x02,
-0xC0, 0x01, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x01, 0xF9, 0xE4, 0x3A, 0xFA, 0xC3,
-0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xE0, 0xE9, 0x95, 0x82, 0xEA, 0x95, 0x83, 0x40, 0x03, 0x02, 0x80,
-0xD3, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x12, 0x1F, 0xA4, 0xB4, 0xDD, 0x4F, 0x90, 0x83, 0x40,
-0x12, 0x49, 0x6E, 0x90, 0x83, 0x3D, 0x12, 0x49, 0x86, 0xE9, 0x2F, 0xF9, 0xEA, 0x3E, 0xFA, 0xEB,
-0x3D, 0xFB, 0xE9, 0x24, 0xFF, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01,
-0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xE0, 0x6B, 0x70, 0x08, 0xE9,
-0x65, 0x82, 0x70, 0x03, 0xEA, 0x65, 0x83, 0x70, 0x03, 0x02, 0x80, 0xD3, 0x90, 0x83, 0x47, 0x12,
-0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x70, 0x02, 0x01, 0xD3, 0x90, 0x83, 0x4A, 0x12,
-0x49, 0x86, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x90, 0x00,
-0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x7E, 0x00, 0xE9, 0x24, 0x02, 0xF9, 0xE4, 0x3A, 0xFA, 0xE9, 0x2F,
-0xF9, 0xEE, 0x3A, 0xFA, 0xD3, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xE0, 0xE9, 0x95, 0x82, 0xEA, 0x95,
-0x83, 0x40, 0x02, 0x01, 0xD3, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x12, 0x1F, 0xA4, 0xFF, 0xB4,
-0x30, 0x36, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83,
-0x44, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0x12, 0x49, 0xE7, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86,
-0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xFE, 0x90, 0x83, 0x44, 0x12, 0x49, 0x86, 0x90,
-0x00, 0x07, 0xEE, 0x12, 0x1F, 0xFC, 0x80, 0x2F, 0xEF, 0xB4, 0xDD, 0x2B, 0x90, 0x83, 0x4A, 0x12,
-0x49, 0x86, 0x90, 0x83, 0x8F, 0x12, 0x49, 0x8F, 0x90, 0x83, 0x44, 0x12, 0x49, 0x86, 0x90, 0x83,
-0x92, 0x12, 0x49, 0x8F, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x12, 0x7D, 0x7A, 0x90, 0x83, 0x4D,
-0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x80, 0x1C, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01,
-0x12, 0x1F, 0xBD, 0x24, 0x02, 0xFF, 0xE4, 0x33, 0x90, 0x83, 0x48, 0x8F, 0xF0, 0x12, 0x49, 0x4B,
-0x02, 0x7F, 0x86, 0x90, 0x83, 0x4D, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x22, 0x90, 0x82, 0xF1, 0x12,
-0x49, 0x8F, 0x90, 0x82, 0xF7, 0xE0, 0x60, 0x02, 0x21, 0xB0, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86,
-0x12, 0x1F, 0xA4, 0xF4, 0x60, 0x02, 0x21, 0xA5, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xF4, 0x12, 0x49,
-0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xF4, 0x60, 0x02, 0x21, 0x95, 0x90, 0x00, 0x01, 0x12,
-0x1F, 0xFC, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xF4, 0x70, 0x6F, 0x90, 0x82, 0xF4, 0x12, 0x49,
-0x86, 0x90, 0x00, 0x02, 0xE4, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xF4, 0x70,
-0x4E, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0xE4, 0x12, 0x1F, 0xFC, 0x90, 0x00,
-0x04, 0x12, 0x1F, 0xBD, 0xF4, 0x70, 0x2D, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04,
-0xE4, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xF4, 0xB4, 0xFF, 0x0C,
-0x12, 0x49, 0x86, 0x90, 0x00, 0x05, 0xE4, 0x12, 0x1F, 0xFC, 0x80, 0x44, 0x12, 0x49, 0x86, 0x90,
-0x00, 0x05, 0x80, 0x2A, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0x80, 0x1F, 0x90,
-0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0x80, 0x14, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86,
-0x90, 0x00, 0x02, 0x80, 0x09, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x74, 0x01,
-0x12, 0x49, 0x18, 0x80, 0x0B, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x74, 0x01, 0x12, 0x48, 0xF6,
-0x90, 0x82, 0xF8, 0xE0, 0xFF, 0x64, 0x04, 0x60, 0x02, 0x41, 0x5F, 0x90, 0x82, 0xF4, 0x12, 0x49,
-0x86, 0x12, 0x1F, 0xA4, 0xFE, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0xEE, 0x12, 0x1F, 0xEA, 0x90,
-0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xF1, 0x12,
-0x49, 0x86, 0x90, 0x00, 0x01, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x02, 0xE4, 0x12, 0x1F, 0xFC,
-0x90, 0x00, 0x03, 0x74, 0x20, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00,
-0x02, 0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0xEE, 0x12,
-0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFE, 0x90,
-0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x05, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12,
-0x49, 0x86, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90,
-0x00, 0x06, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x05, 0x12,
-0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x07, 0xEE, 0x61, 0x1F, 0xEF,
-0x64, 0x02, 0x60, 0x02, 0x61, 0x22, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x12, 0x1F, 0xA4, 0xFF,
-0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0xEF, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86,
-0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x44, 0x20, 0x54, 0x7F, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49,
-0x86, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00,
-0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x02, 0xEF, 0x12,
-0x1F, 0xFC, 0x90, 0x00, 0x03, 0x74, 0x20, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86,
-0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04,
-0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD,
-0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x05, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82,
-0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49,
-0x86, 0x90, 0x00, 0x06, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00,
-0x05, 0x12, 0x1F, 0xBD, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x07, 0xEF, 0x12,
-0x1F, 0xFC, 0x22, 0x00, 0xAF, 0x8C,
-};
-u4Byte ArrayLength_MP_8188E_FW_WoWLAN_S = 17222;
-
-
-void
-ODM_ReadFirmware_MP_8188E_FW_WoWLAN_S(
- 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_8188E_FW_WoWLAN_S;
-#else
- ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_WoWLAN_S, ArrayLength_MP_8188E_FW_WoWLAN_S);
-#endif
- *pFirmwareSize = ArrayLength_MP_8188E_FW_WoWLAN_S;
-}
-
-
-u1Byte Array_MP_8188E_FW_WoWLAN_T[] = {
-0xE1, 0x88, 0x30, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x15, 0x22, 0x26, 0x28, 0x3D, 0x00, 0x00,
-0x8F, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x02, 0x46, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xE1, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xE1, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x50, 0x17, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-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,
-0xE7, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x46, 0xE7, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x3E,
-0x88, 0x82, 0x8C, 0x83, 0xE7, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x32, 0xE3, 0x09, 0xF6, 0x08,
-0xDF, 0xFA, 0x80, 0x78, 0xE3, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x70, 0x88, 0x82, 0x8C, 0x83,
-0xE3, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x64, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF6, 0x08,
-0xDF, 0xFA, 0x80, 0x58, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x4C,
-0x80, 0xD2, 0x80, 0xFA, 0x80, 0xC6, 0x80, 0xD4, 0x80, 0x69, 0x80, 0xF2, 0x80, 0x33, 0x80, 0x10,
-0x80, 0xA6, 0x80, 0xEA, 0x80, 0x9A, 0x80, 0xA8, 0x80, 0xDA, 0x80, 0xE2, 0x80, 0xCA, 0x80, 0x33,
-0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83,
-0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xE9, 0xDE, 0xE7, 0x80,
-0x0D, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF6, 0x08, 0xDF, 0xF9, 0xEC, 0xFA, 0xA9, 0xF0,
-0xED, 0xFB, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC,
-0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xEA, 0xDE,
-0xE8, 0x80, 0xDB, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF2, 0x08, 0xDF, 0xF9, 0x80, 0xCC,
-0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, 0xC3, 0x88, 0xF0, 0xED, 0x24, 0x02, 0xB4, 0x04,
-0x00, 0x50, 0xB9, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0xAF, 0x23, 0x23, 0x45,
-0x82, 0x23, 0x90, 0x41, 0x50, 0x73, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0, 0xC5, 0xF0, 0xF8,
-0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 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, 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, 0x43, 0x98,
-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, 0x43,
-0xA4, 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,
-0x42, 0xE0, 0x73, 0xC2, 0xAF, 0x80, 0xFE, 0x32, 0x12, 0x44, 0x17, 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, 0x47, 0x50,
-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, 0x47, 0x50, 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, 0x44, 0x60, 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, 0x44,
-0x5F, 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, 0x44, 0x60, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83,
-0xF4, 0xC2, 0xAF, 0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0x02, 0x46, 0xFA, 0x02,
-0x44, 0xF0, 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, 0x47, 0x3F, 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, 0x00,
-0x41, 0x83, 0xF1, 0x00, 0x41, 0x83, 0xF2, 0x00, 0x41, 0x84, 0x04, 0x00, 0x41, 0x84, 0x05, 0x00,
-0x59, 0x9D, 0x5F, 0xD5, 0x61, 0xA3, 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, 0x90, 0x01, 0xC4, 0x74, 0x56, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 0x12, 0x67, 0xDB,
-0xE5, 0x3C, 0x30, 0xE7, 0x02, 0xF1, 0xAD, 0x74, 0x56, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x47,
-0xA3, 0xF0, 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, 0x32, 0x06, 0x90, 0x00, 0xF2, 0xE0, 0x20, 0xE6, 0x0C, 0x90, 0x00, 0x05, 0xE0, 0x44,
-0x80, 0xFD, 0x7F, 0x05, 0x12, 0x32, 0x1E, 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, 0x90, 0x01, 0xC4, 0x74, 0xC8, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 0x12,
-0x68, 0x15, 0xE5, 0x41, 0x30, 0xE3, 0x03, 0x12, 0x57, 0xC6, 0xE5, 0x41, 0x30, 0xE4, 0x03, 0x12,
-0x57, 0xBF, 0xE5, 0x43, 0x30, 0xE0, 0x02, 0x11, 0x66, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x68,
-0x72, 0xE5, 0x43, 0x30, 0xE2, 0x03, 0x12, 0x68, 0xE9, 0xE5, 0x43, 0x30, 0xE3, 0x03, 0x12, 0x6F,
-0xCE, 0xE5, 0x43, 0x30, 0xE4, 0x03, 0x12, 0x6F, 0xEA, 0xE5, 0x43, 0x30, 0xE5, 0x03, 0x12, 0x6E,
-0x7E, 0xE5, 0x43, 0x30, 0xE6, 0x03, 0x12, 0x70, 0x19, 0xE5, 0x44, 0x30, 0xE1, 0x02, 0xF1, 0xDE,
-0x74, 0xC8, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 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, 0x19, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x72, 0x90,
-0x80, 0xF9, 0xE0, 0x64, 0x01, 0x70, 0x6A, 0x90, 0x81, 0x3C, 0xE0, 0xC4, 0x54, 0x0F, 0x60, 0x22,
-0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x1E, 0x90, 0x81, 0x45, 0xE0, 0x14, 0xF0, 0xE0, 0xFF, 0x60,
-0x06, 0x90, 0x81, 0x47, 0xE0, 0x60, 0x0E, 0xEF, 0x70, 0x08, 0x90, 0x81, 0x44, 0xE0, 0xA3, 0xF0,
-0x80, 0x00, 0x75, 0x19, 0x01, 0xE5, 0x19, 0x60, 0x38, 0x90, 0x81, 0x42, 0xE0, 0x44, 0x10, 0xF0,
-0x90, 0x81, 0x47, 0xE0, 0x60, 0x03, 0xB4, 0x01, 0x09, 0xE4, 0xF5, 0x52, 0x90, 0x81, 0x47, 0xE0,
-0x80, 0x0D, 0xE4, 0xF5, 0x52, 0x90, 0x81, 0x47, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF,
-0x90, 0x81, 0x46, 0xE0, 0x2F, 0x12, 0x57, 0xED, 0x90, 0x81, 0x41, 0xE0, 0x20, 0xE2, 0x02, 0x11,
-0xE2, 0x22, 0x7D, 0x01, 0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x84, 0x01,
-0xED, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0x41,
-0x3D, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0x41, 0x3D, 0x90, 0x81, 0x41,
-0xE0, 0xFE, 0x6F, 0x70, 0x02, 0x41, 0x3D, 0xEF, 0x70, 0x02, 0x21, 0xA5, 0x24, 0xFE, 0x70, 0x02,
-0x21, 0xDE, 0x24, 0xFE, 0x60, 0x47, 0x24, 0xFC, 0x70, 0x02, 0x41, 0x18, 0x24, 0xFC, 0x60, 0x02,
-0x41, 0x2D, 0xEE, 0xB4, 0x0E, 0x02, 0x51, 0xA9, 0x90, 0x81, 0x41, 0xE0, 0x70, 0x04, 0x7F, 0x01,
-0x51, 0xCC, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x88, 0x90, 0x81, 0x41, 0xE0, 0xB4,
-0x04, 0x0D, 0x90, 0x84, 0x01, 0xE0, 0xFF, 0x60, 0x04, 0x71, 0xE7, 0x80, 0x02, 0xF1, 0x1E, 0x90,
-0x81, 0x41, 0xE0, 0x64, 0x08, 0x60, 0x02, 0x41, 0x2D, 0x71, 0xA5, 0x41, 0x2D, 0x90, 0x81, 0x41,
-0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xCC, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x88,
-0x90, 0x81, 0x41, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x42, 0xBF, 0x01, 0x02, 0x51, 0xA9, 0x90, 0x81,
-0x41, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0x41, 0x2D, 0x51, 0x42, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x41,
-0x2D, 0x51, 0xF8, 0x41, 0x2D, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x42, 0xBF, 0x01,
-0x02, 0x51, 0xA9, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x88, 0x90, 0x81, 0x41, 0xE0,
-0xB4, 0x0C, 0x07, 0x51, 0x42, 0xBF, 0x01, 0x02, 0x51, 0xF8, 0x90, 0x81, 0x41, 0xE0, 0x64, 0x04,
-0x70, 0x5B, 0x12, 0x72, 0x95, 0xEF, 0x64, 0x01, 0x70, 0x53, 0x71, 0xB2, 0x80, 0x4F, 0x90, 0x81,
-0x41, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x42, 0xBF, 0x01, 0x02, 0x51, 0xA9, 0x90, 0x81, 0x41, 0xE0,
-0xB4, 0x06, 0x02, 0x51, 0x88, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x0C, 0x07, 0x51, 0x42, 0xBF, 0x01,
-0x02, 0x51, 0xF8, 0x90, 0x81, 0x41, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xCC, 0x90, 0x81, 0x41,
-0xE0, 0xB4, 0x04, 0x19, 0xF1, 0x12, 0x80, 0x15, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x0C, 0x0E, 0x90,
-0x81, 0x3B, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0x71, 0x9B, 0x90, 0x81, 0x41,
-0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x81, 0x40, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0xD0, 0xD0, 0x92,
-0xAF, 0x22, 0x12, 0x72, 0x7C, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0,
-0x80, 0x2D, 0x90, 0x81, 0x3A, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, 0x01,
-0xB8, 0x74, 0x02, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x40, 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, 0x81, 0x3B, 0xE0, 0x90, 0x06, 0x04, 0x20,
-0xE0, 0x08, 0xE0, 0x44, 0x40, 0xF0, 0x7D, 0x04, 0x80, 0x06, 0xE0, 0x54, 0x7F, 0xF0, 0x7D, 0x0C,
-0x7F, 0x01, 0x71, 0x33, 0xE4, 0xFD, 0xFF, 0x80, 0x44, 0x90, 0x81, 0x3B, 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, 0x33, 0xE4, 0xFD, 0xFF, 0x80, 0x21, 0x90, 0x84, 0x00, 0xEF,
-0xF0, 0xD1, 0x97, 0x90, 0x84, 0x00, 0xE0, 0x60, 0x05, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x7D, 0x04,
-0x7F, 0x01, 0x80, 0x4F, 0xE4, 0xFD, 0x7F, 0x0C, 0x11, 0xE6, 0xE4, 0xFD, 0xFF, 0x90, 0x05, 0x22,
-0xEF, 0xF0, 0x90, 0x80, 0x05, 0xED, 0xF0, 0x22, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01, 0x70, 0x2E,
-0x90, 0x81, 0x3B, 0xE0, 0x54, 0xFD, 0xF0, 0x7D, 0x2C, 0x7F, 0x6F, 0x51, 0xED, 0x7D, 0x08, 0x7F,
-0x01, 0x91, 0x29, 0xBF, 0x01, 0x0D, 0x90, 0x81, 0x3A, 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, 0xAC, 0x07, 0xEF, 0x14, 0x60, 0x15,
-0x14, 0x60, 0x19, 0x24, 0x02, 0x70, 0x1A, 0xED, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x3A, 0xE0, 0x54,
-0xFE, 0x4E, 0xF0, 0x80, 0x0C, 0x90, 0x81, 0x41, 0xED, 0xF0, 0x80, 0x05, 0x90, 0x81, 0x40, 0xED,
-0xF0, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE4, 0x2E, 0xEC, 0x14, 0x60, 0x07, 0x14, 0x60, 0x1D, 0x24,
-0x02, 0x70, 0x23, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x01, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0xFF,
-0x90, 0x81, 0x41, 0xE0, 0x54, 0x7F, 0x4F, 0xFD, 0x7F, 0x88, 0x80, 0x07, 0x90, 0x81, 0x40, 0xE0,
-0xFD, 0x7F, 0x89, 0x12, 0x32, 0x1E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7D, 0x2F, 0x91, 0xF4, 0x7D,
-0x08, 0x7F, 0x01, 0x80, 0x8E, 0xD1, 0x97, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x7D, 0x0C, 0x7F, 0x01,
-0x80, 0x81, 0x7D, 0x2D, 0xB1, 0x6E, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0xF1,
-0xC9, 0x91, 0xF8, 0xE4, 0xFD, 0x7F, 0x01, 0x61, 0x33, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x01, 0x70,
-0x15, 0x90, 0x81, 0x3C, 0xE0, 0x54, 0x0F, 0x60, 0x05, 0x51, 0xE4, 0x02, 0x56, 0xA5, 0x90, 0x81,
-0x41, 0xE0, 0x70, 0x02, 0x11, 0xE2, 0x22, 0xEF, 0x60, 0x3A, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01,
-0x70, 0x32, 0x90, 0x81, 0x3B, 0xE0, 0x54, 0xFE, 0xF0, 0x7D, 0x2B, 0x7F, 0x0F, 0x51, 0xED, 0x90,
-0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0x91, 0x25, 0xBF, 0x01, 0x0D, 0x90, 0x81, 0x3A, 0xE0, 0x44,
-0x40, 0xF0, 0x7D, 0x06, 0x7F, 0x01, 0x61, 0x33, 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, 0x83, 0xD5, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x80, 0x03, 0xE0, 0x04, 0xF0, 0x90, 0x04,
-0x1D, 0xE0, 0x60, 0x21, 0x90, 0x05, 0x22, 0xE0, 0x90, 0x83, 0xD9, 0xF0, 0x7D, 0x26, 0xB1, 0x6E,
-0xEF, 0x64, 0x01, 0x70, 0x03, 0x12, 0x6D, 0x88, 0x90, 0x83, 0xD9, 0xE0, 0xFF, 0x7D, 0x27, 0x51,
-0xED, 0x91, 0x77, 0x80, 0x05, 0x91, 0x77, 0x12, 0x6D, 0x88, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0,
-0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x83, 0xD5, 0xE0, 0xFF, 0xD3, 0x10, 0xAF, 0x01,
-0xC3, 0xC0, 0xD0, 0x90, 0x84, 0x02, 0xEF, 0xF0, 0x90, 0x80, 0x09, 0xE0, 0xFF, 0x90, 0x04, 0x1C,
-0xE0, 0x6F, 0x70, 0x4B, 0x90, 0x81, 0x41, 0xE0, 0x64, 0x0E, 0x70, 0x18, 0x90, 0x84, 0x02, 0xE0,
-0x70, 0x3D, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0,
-0x71, 0x2F, 0x80, 0x26, 0x90, 0x81, 0x41, 0xE0, 0x64, 0x06, 0x70, 0x23, 0x90, 0x84, 0x02, 0xE0,
-0x60, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0,
-0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x41, 0x74, 0x04, 0xF0, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0xD0,
-0xD0, 0x92, 0xAF, 0x22, 0x12, 0x56, 0xA5, 0x90, 0x81, 0x41, 0xE0, 0x64, 0x0C, 0x60, 0x04, 0x51,
-0xE4, 0x91, 0x25, 0x22, 0x7F, 0xFF, 0x51, 0xED, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xB1,
-0x72, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12,
-0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E,
-0x12, 0x2E, 0xA2, 0x90, 0x83, 0xCB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xFD, 0xFF,
-0x12, 0x64, 0xF6, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83,
-0xE6, 0x12, 0x20, 0xCE, 0x90, 0x83, 0xE6, 0x12, 0x42, 0x19, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE,
-0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54,
-0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0xFF,
-0x51, 0xED, 0xE4, 0x90, 0x83, 0xF7, 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,
-0x83, 0xF8, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0xF7, 0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0,
-0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x83,
-0xF7, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x80, 0xBF, 0xEF, 0x60, 0x59, 0x90, 0x04, 0xEC,
-0xE0, 0x54, 0xDD, 0xF0, 0x90, 0x83, 0x30, 0xE0, 0xFF, 0x60, 0x03, 0x12, 0x5F, 0x8B, 0x90, 0x01,
-0xC7, 0xE4, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00,
-0xFF, 0xEC, 0x3E, 0x90, 0x80, 0xF7, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x06, 0x09, 0xE0, 0x54, 0xFE,
-0xF0, 0x7D, 0x35, 0x91, 0xF4, 0x90, 0x02, 0x86, 0xE0, 0x44, 0x04, 0xF0, 0x12, 0x78, 0xFF, 0xF1,
-0xF2, 0xD1, 0x97, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x12, 0x7B, 0xCB, 0x90, 0x01, 0x34, 0x74, 0x08,
-0xF0, 0xFD, 0xE4, 0xFF, 0xE1, 0xC9, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22, 0xF0, 0x7D, 0x08, 0xE4,
-0xFF, 0x12, 0x68, 0xD1, 0x90, 0x06, 0x90, 0xE0, 0x54, 0xF0, 0xF0, 0x90, 0x02, 0x86, 0xE0, 0x54,
-0xFB, 0xF0, 0xF1, 0xF4, 0xF1, 0xF3, 0x90, 0x81, 0x7D, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x85,
-0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x20, 0xF0, 0xD3, 0x10, 0xAF, 0x01, 0xC3,
-0xC0, 0xD0, 0x90, 0x81, 0x80, 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, 0x81, 0x84, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x81,
-0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, 0x84, 0xE0, 0x54, 0xFD, 0xF0, 0xE4, 0xFD, 0x7F, 0x8F, 0x12,
-0x32, 0x1E, 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, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54,
-0x7F, 0xFC, 0x90, 0x83, 0xE2, 0x12, 0x20, 0xCE, 0x90, 0x83, 0xE2, 0x12, 0x42, 0x19, 0x90, 0x85,
-0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20,
-0xDA, 0xCC, 0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12,
-0x20, 0xDA, 0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0xCB,
-0x12, 0x20, 0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0x12, 0x64, 0xF6, 0xD0, 0xD0, 0x92,
-0xAF, 0x22, 0x7D, 0x2E, 0x7F, 0x6F, 0x51, 0xED, 0x7D, 0x02, 0x7F, 0x01, 0x61, 0x33, 0x90, 0x06,
-0x04, 0xE0, 0x54, 0x7F, 0xF0, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x7D, 0x0C, 0x7F, 0x01, 0x61, 0x33,
-0xEF, 0x70, 0x4E, 0x7D, 0x78, 0x7F, 0x02, 0x12, 0x68, 0xD1, 0x7D, 0x02, 0x7F, 0x03, 0x12, 0x68,
-0xD1, 0x7D, 0xC8, 0x7F, 0x02, 0x12, 0x71, 0x53, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C,
-0x74, 0x02, 0xF0, 0x90, 0x80, 0xF9, 0xE0, 0x70, 0x13, 0xD1, 0x97, 0xF1, 0x1E, 0x90, 0x81, 0x3A,
-0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x80, 0x06, 0x7D, 0x01, 0x7F, 0x0C,
-0x11, 0xE6, 0x90, 0x81, 0x3A, 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, 0xF1, 0xC9,
-0x7D, 0x02, 0x7F, 0x03, 0xF1, 0xC9, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x49,
-0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x80, 0xF9, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x81, 0x3B,
-0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x41, 0xE0, 0x20, 0xE2, 0x0D, 0x7D, 0x01, 0x7F, 0x04, 0x01,
-0xE6, 0x90, 0x81, 0x3B, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE,
-0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x81,
-0x3E, 0xE0, 0x60, 0x02, 0x71, 0xC9, 0x22, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x7D, 0x04, 0x7F, 0x01,
-0x61, 0x33, 0x22, 0x22, 0xD1, 0x4B, 0x90, 0x01, 0x3F, 0x74, 0x04, 0xF0, 0x90, 0x80, 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, 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, 0x90, 0x01, 0xC4, 0x74, 0x17, 0xF0, 0x74, 0x50, 0xA3, 0xF0, 0x12, 0x68,
-0x42, 0xE5, 0x49, 0x30, 0xE1, 0x02, 0x11, 0x9B, 0xE5, 0x49, 0x30, 0xE2, 0x02, 0x11, 0xB6, 0xE5,
-0x4A, 0x30, 0xE0, 0x03, 0x12, 0x70, 0x35, 0xE5, 0x4C, 0x30, 0xE1, 0x04, 0x7F, 0x04, 0xF1, 0xB0,
-0xE5, 0x4C, 0x30, 0xE4, 0x02, 0x11, 0xA4, 0xE5, 0x4C, 0x30, 0xE5, 0x02, 0x11, 0xFE, 0xE5, 0x4C,
-0x30, 0xE6, 0x02, 0x31, 0x82, 0x74, 0x17, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x50, 0xA3, 0xF0,
-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, 0x81, 0x3E, 0xE0, 0x60,
-0x02, 0xF1, 0x67, 0x22, 0x11, 0xCF, 0x90, 0x81, 0x44, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D,
-0x02, 0x7F, 0x02, 0x02, 0x4F, 0xC9, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x12, 0x90, 0x06, 0x92, 0xE0,
-0x30, 0xE1, 0x02, 0xC1, 0xA5, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xF7, 0xF0, 0x31, 0xBF, 0x22, 0x90,
-0x81, 0x3E, 0xE0, 0x60, 0x28, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01, 0x70, 0x20, 0x90, 0x81, 0x45,
-0xF0, 0x04, 0x60, 0x19, 0x90, 0x81, 0x42, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x52, 0x90, 0x81,
-0x46, 0xF1, 0xEC, 0x90, 0x81, 0x41, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x48, 0xE2, 0x22, 0x90, 0x81,
-0x3A, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x26, 0xEF, 0x54, 0xBF, 0xF0, 0x90,
-0x04, 0xE0, 0xE0, 0x90, 0x81, 0x3B, 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, 0x31,
-0xBF, 0xE4, 0xFF, 0x90, 0x83, 0x44, 0xE0, 0x30, 0xE0, 0x47, 0x90, 0x83, 0x49, 0xE0, 0xFD, 0x60,
-0x40, 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, 0x0B, 0xE4, 0x90, 0x83, 0x49, 0xF0,
-0x90, 0x83, 0x4B, 0x04, 0xF0, 0x22, 0x90, 0x83, 0x46, 0xE0, 0xD3, 0x9D, 0x50, 0x0A, 0x31, 0xC9,
-0x90, 0x83, 0x44, 0xE0, 0x54, 0xFE, 0xF0, 0x22, 0x12, 0x4C, 0x25, 0x90, 0x83, 0x49, 0xE0, 0x04,
-0xF0, 0x22, 0x90, 0x81, 0x3A, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2B,
-0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x3B, 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, 0x81, 0x3E, 0xE0, 0x60, 0x02, 0x31, 0xBF, 0x7F, 0x01, 0x21, 0x33, 0x90,
-0x81, 0x40, 0xE0, 0xFF, 0x7D, 0x01, 0x02, 0x48, 0xE6, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x7F,
-0x01, 0x90, 0x84, 0x03, 0xEF, 0xF0, 0x90, 0x80, 0x06, 0xE0, 0x64, 0x02, 0x70, 0x1F, 0x90, 0x84,
-0x03, 0xE0, 0xFF, 0x64, 0x01, 0x70, 0x24, 0x90, 0x81, 0x81, 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, 0x84, 0x03, 0xE0, 0xFF, 0x51, 0x0C, 0x22, 0xAD, 0x07, 0x90, 0x81,
-0x82, 0xE0, 0x75, 0xF0, 0x40, 0xA4, 0xFF, 0x90, 0x83, 0xEA, 0xE5, 0xF0, 0xF0, 0xA3, 0xEF, 0xF0,
-0xE4, 0xA3, 0xF0, 0x90, 0x81, 0x83, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0x90, 0x83, 0xED, 0xF0, 0xED,
-0x64, 0x01, 0x60, 0x02, 0x41, 0xDC, 0x90, 0x83, 0xEA, 0xE0, 0x70, 0x02, 0xA3, 0xE0, 0x60, 0x0B,
-0x90, 0x83, 0xEA, 0x74, 0xFF, 0x75, 0xF0, 0xD0, 0x12, 0x41, 0xF6, 0x90, 0x81, 0x81, 0xE0, 0x54,
-0x7F, 0xFF, 0x90, 0x81, 0x80, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02,
-0x7D, 0x01, 0x51, 0xEE, 0x51, 0xDD, 0x90, 0x81, 0x83, 0xE0, 0x30, 0xE0, 0x6F, 0x90, 0x83, 0xEA,
-0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x32, 0xAA, 0x90, 0x81, 0x81, 0xE0, 0x54, 0x7F, 0xFF, 0x90,
-0x81, 0x80, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x51,
-0xEE, 0xE4, 0x90, 0x83, 0xEC, 0xF0, 0x90, 0x83, 0xED, 0xE0, 0xFF, 0x90, 0x83, 0xEC, 0xE0, 0xC3,
-0x9F, 0x50, 0x39, 0x90, 0x83, 0xEA, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x32, 0xAA, 0x51, 0xDD,
-0x90, 0x83, 0xEA, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x32, 0xAA, 0x90, 0x81, 0x81, 0xE0, 0x54,
-0x7F, 0xFF, 0x90, 0x81, 0x80, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02,
-0x7D, 0x01, 0x51, 0xEE, 0x90, 0x83, 0xEC, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x22, 0x90, 0x81, 0x81,
-0xE0, 0x54, 0x7F, 0xFF, 0x90, 0x81, 0x80, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x01, 0xFD, 0xD3, 0x10,
-0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0xFA, 0xED, 0xF0, 0x90, 0x83, 0xF9, 0xEF, 0xF0, 0xD3,
-0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8,
-0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0, 0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x83,
-0xF9, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90,
-0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xFA, 0xE0, 0x60, 0x18,
-0x90, 0x83, 0xF9, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC,
-0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80, 0x17, 0x90, 0x83, 0xF9, 0xE0, 0xFF, 0x74, 0x01, 0xA8,
-0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD,
-0x7F, 0x45, 0x80, 0x7E, 0x90, 0x83, 0xF9, 0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74,
-0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0,
-0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xF9, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07,
-0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43,
-0x12, 0x32, 0x1E, 0x90, 0x83, 0xFA, 0xE0, 0x60, 0x1D, 0x90, 0x83, 0xF9, 0xE0, 0x24, 0x04, 0xFF,
-0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0,
-0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90, 0x83, 0xF9, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8,
-0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD,
-0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
-0xD0, 0x90, 0x83, 0x65, 0x74, 0x08, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0,
-0x90, 0x83, 0x6C, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E,
-0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x83, 0x5D, 0xF0, 0xA3, 0xEF, 0xF0, 0x90,
-0x02, 0x82, 0xE0, 0x90, 0x83, 0x64, 0xF0, 0x90, 0x81, 0x7D, 0xE0, 0x20, 0xE0, 0x02, 0xC1, 0xA0,
-0x90, 0x81, 0x85, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x19, 0x90, 0x80,
-0x06, 0xE0, 0xB4, 0x01, 0x0E, 0x90, 0xFD, 0x01, 0xE0, 0x20, 0xE6, 0x07, 0x90, 0xFD, 0x00, 0xE0,
-0x44, 0x10, 0xF0, 0x7F, 0x01, 0x31, 0xD1, 0xE4, 0x90, 0x83, 0x63, 0xF0, 0x90, 0x83, 0x64, 0xE0,
-0xFF, 0x90, 0x83, 0x63, 0xE0, 0xC3, 0x9F, 0x40, 0x02, 0xC1, 0xA0, 0x90, 0x83, 0x5D, 0xE0, 0xFC,
-0xA3, 0xE0, 0xFD, 0xEC, 0xFF, 0x90, 0xFD, 0x11, 0xF0, 0xAE, 0x05, 0xAA, 0x06, 0x90, 0x83, 0x67,
-0xEF, 0xF0, 0x74, 0x02, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33,
-0x33, 0x33, 0x54, 0xF8, 0xFF, 0x74, 0x03, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0,
-0x54, 0x03, 0xFE, 0xEF, 0x24, 0x18, 0x2E, 0x90, 0x83, 0x6C, 0xF0, 0xE0, 0xFF, 0x2A, 0x90, 0x83,
-0x5F, 0xF0, 0x7E, 0x00, 0x90, 0x83, 0x5D, 0xE0, 0xFC, 0xA3, 0xE0, 0x2F, 0xFF, 0xEE, 0x3C, 0x90,
-0x83, 0x60, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0x5F, 0xE0, 0xFD, 0x24, 0x00, 0xF5, 0x82, 0xE4,
-0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x54, 0xFC, 0x90, 0x83, 0x62, 0xF0, 0xAF, 0x06, 0x74, 0x01,
-0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x90, 0x83, 0x5F, 0xE0, 0x24, 0x04,
-0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF1, 0x42, 0x90, 0x83, 0x66, 0xEF, 0xF0, 0x74, 0x01, 0x2A, 0xF5,
-0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB,
-0xF5, 0x83, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x54, 0x3F, 0xFE, 0x90, 0x83, 0x68,
-0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0x6C, 0xE0, 0x2F, 0xFF, 0xEC, 0x3E, 0xFE, 0x12, 0x77, 0xDC,
-0x74, 0x0F, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x90, 0x83, 0x5D, 0xEE,
-0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x80, 0xF7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x83, 0x5D,
-0xE0, 0xFA, 0xA3, 0xE0, 0xD3, 0x9F, 0xEA, 0x9E, 0x40, 0x22, 0x90, 0x83, 0x5D, 0xE0, 0xFE, 0xA3,
-0xE0, 0xFF, 0x90, 0x80, 0xF7, 0xE0, 0xFA, 0xA3, 0xE0, 0x24, 0x01, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3,
-0xEF, 0x9B, 0xFF, 0xEE, 0x9A, 0x90, 0x83, 0x5D, 0xF0, 0xA3, 0xEF, 0xF0, 0xED, 0x30, 0xE7, 0x06,
-0x90, 0x01, 0xC7, 0x74, 0x21, 0xF0, 0xED, 0x30, 0xE6, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0,
-0xED, 0x30, 0xE5, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x23, 0xF0, 0x90, 0x83, 0x62, 0xE0, 0x24, 0x40,
-0x60, 0x04, 0x24, 0x20, 0x70, 0x1F, 0x90, 0x81, 0x80, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54,
-0x01, 0x20, 0xE0, 0x02, 0xC1, 0x46, 0xD1, 0xE0, 0xEF, 0x60, 0x7B, 0x90, 0x83, 0x62, 0xE0, 0xFF,
-0x12, 0x7A, 0xC8, 0x80, 0x71, 0xD1, 0xE0, 0xEF, 0x60, 0x26, 0x90, 0x83, 0x60, 0xE0, 0xFE, 0xA3,
-0xE0, 0xFF, 0x90, 0x83, 0x66, 0xE0, 0xFD, 0x90, 0x83, 0x65, 0xE0, 0xFB, 0x90, 0x83, 0x67, 0xE0,
-0x90, 0x83, 0x73, 0xF0, 0x12, 0x75, 0xD9, 0xEF, 0x60, 0x06, 0x90, 0x83, 0x6E, 0x74, 0x01, 0xF0,
-0x90, 0x81, 0x7D, 0xE0, 0xC3, 0x13, 0x30, 0xE0, 0x19, 0x90, 0x83, 0x60, 0xE0, 0xFE, 0xA3, 0xE0,
-0xFF, 0x90, 0x83, 0x66, 0xE0, 0xFD, 0x12, 0x73, 0xE7, 0xEF, 0x60, 0x06, 0x90, 0x83, 0x6E, 0x74,
-0x01, 0xF0, 0x90, 0x81, 0x7D, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x16,
-0x90, 0x83, 0x6E, 0xE0, 0x70, 0x10, 0x90, 0x83, 0x60, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x83,
-0x66, 0xE0, 0xFD, 0x12, 0x76, 0xBC, 0x90, 0x81, 0x85, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F,
-0xE0, 0x30, 0xE2, 0x04, 0x7F, 0x01, 0x31, 0xD1, 0x12, 0x7A, 0xA2, 0xEF, 0x64, 0x01, 0x70, 0x40,
-0x12, 0x79, 0x4F, 0x90, 0x83, 0x6D, 0xEF, 0xF0, 0x64, 0x01, 0x60, 0x27, 0x90, 0x81, 0x85, 0xE0,
-0x44, 0x01, 0xF0, 0x90, 0x83, 0x6D, 0xE0, 0xFF, 0xB4, 0x02, 0x08, 0x90, 0x01, 0xC7, 0x74, 0x42,
-0xF0, 0x80, 0x0A, 0xEF, 0xB4, 0x04, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x43, 0xF0, 0x7F, 0x01, 0x31,
-0xD1, 0x80, 0x0D, 0x90, 0x83, 0x5D, 0xF1, 0xD2, 0x90, 0x83, 0x63, 0xE0, 0x04, 0xF0, 0x81, 0x6C,
-0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x3A, 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, 0xF5, 0x52, 0x90, 0x81, 0x78, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x53, 0xE4,
-0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0xF1, 0xF6, 0x90, 0x81, 0x3A, 0xE0, 0x44, 0x08, 0xF0, 0x22,
-0x90, 0x83, 0x5F, 0xE0, 0xFF, 0xE4, 0xFE, 0xEF, 0x2E, 0x24, 0x04, 0xF5, 0x82, 0xE4, 0x34, 0xFB,
-0xF5, 0x83, 0xE0, 0xFD, 0x74, 0x6F, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xED, 0xF0,
-0x0E, 0xEE, 0xB4, 0x06, 0xE2, 0x78, 0x86, 0x7C, 0x81, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x83, 0x79,
-0x6F, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x43, 0xEF, 0xEF, 0x7F, 0x00, 0x70, 0x02, 0x7F, 0x01, 0x22,
-0xA3, 0xE0, 0xFE, 0x24, 0x20, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFF, 0x74, 0x21,
-0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFD, 0x74, 0x24, 0x2E, 0xF5, 0x82, 0xE4,
-0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFE, 0xEF, 0x30, 0xE7, 0x04, 0x7C, 0x02, 0x80, 0x02,
-0xE4, 0xFC, 0xED, 0x30, 0xE6, 0x09, 0xAF, 0x03, 0x12, 0x6E, 0x9B, 0xAE, 0x07, 0x80, 0x02, 0xE4,
-0xFE, 0xEC, 0x24, 0x18, 0x2E, 0xFF, 0x22, 0x90, 0x81, 0x3A, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F,
-0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07,
-0x70, 0x2D, 0x80, 0x29, 0x90, 0x81, 0x47, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xEF,
-0xF0, 0x90, 0x81, 0x76, 0xE0, 0xFF, 0x90, 0x81, 0x47, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x80,
-0xF9, 0xE0, 0xB4, 0x01, 0x0A, 0x90, 0x81, 0x3B, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x31, 0xBF, 0x22,
-0x8F, 0x0D, 0x7F, 0x02, 0x12, 0x46, 0x3A, 0x90, 0x80, 0x01, 0xE0, 0x45, 0x0D, 0xF0, 0x22, 0x12,
-0x66, 0x21, 0x7F, 0x02, 0x80, 0xEA, 0x90, 0x81, 0x7D, 0xE0, 0x30, 0xE0, 0x04, 0x7F, 0x10, 0xF1,
-0xB0, 0x22, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x02, 0x84, 0xEF, 0xF0, 0xEE, 0xA3, 0xF0, 0xA3,
-0xE0, 0x44, 0x01, 0xF0, 0x22, 0xF0, 0xE4, 0xF5, 0x52, 0x90, 0x81, 0x77, 0xE0, 0xF5, 0x53, 0xE4,
-0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8E, 0x4E, 0x8F,
-0x4F, 0xE5, 0x53, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0x85, 0x4E, 0x83, 0x85, 0x4F, 0x82, 0xF0,
-0xE5, 0x52, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x53, 0x13, 0x13, 0x13, 0x54, 0x1F,
-0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x52, 0x13, 0x13, 0x13,
-0x54, 0x1F, 0x4F, 0x85, 0x4F, 0x82, 0x85, 0x4E, 0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0D, 0x85,
-0x4F, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x03, 0xF0, 0x80, 0x0C, 0x85, 0x4F, 0x82, 0x85,
-0x4E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x85, 0x4F, 0x82, 0x85, 0x4E, 0x83, 0xA3, 0xA3,
-0xA3, 0x74, 0x05, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09,
-0xE0, 0x7F, 0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02,
-0x7F, 0x03, 0x22, 0x11, 0x69, 0x90, 0x80, 0x06, 0xEF, 0xF0, 0x11, 0x95, 0x90, 0x01, 0x64, 0x74,
-0x01, 0xF0, 0x02, 0x2D, 0xA7, 0x31, 0x01, 0x31, 0x31, 0x11, 0xC3, 0x11, 0xE2, 0xE4, 0xF5, 0x35,
-0xF5, 0x36, 0xF5, 0x37, 0x75, 0x38, 0x80, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36,
-0x7F, 0x51, 0x12, 0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53,
-0x02, 0x32, 0x1E, 0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, 0x07, 0x75, 0x40, 0x02, 0x90,
-0x01, 0x30, 0xE5, 0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40,
-0xF0, 0x22, 0x75, 0x45, 0x06, 0x75, 0x46, 0x01, 0x75, 0x47, 0x03, 0x75, 0x48, 0x62, 0x90, 0x01,
-0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, 0xF0, 0xA3, 0xE5, 0x48, 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, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x51,
-0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x32,
-0x1E, 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, 0x32, 0x1E, 0x7D, 0xFF, 0x7F,
-0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x57, 0x02,
-0x32, 0x1E, 0x90, 0x01, 0xCF, 0xE0, 0x90, 0x83, 0xFF, 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, 0x31, 0x01, 0x90, 0x00,
-0x03, 0xE0, 0x54, 0xFB, 0xFD, 0x7F, 0x03, 0x12, 0x32, 0x1E, 0x80, 0xFE, 0x22, 0x90, 0x00, 0x80,
-0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD, 0x00, 0xE0, 0x54, 0xBF, 0xF0,
-0x51, 0x2F, 0x12, 0x32, 0x77, 0x51, 0x10, 0x51, 0x4A, 0x7F, 0x01, 0x12, 0x45, 0x28, 0x90, 0x83,
-0x3F, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x45, 0x28, 0x90, 0x83, 0x3F, 0xE0, 0x04, 0xF0, 0x11, 0x83,
-0x31, 0xEC, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x75, 0x20,
-0xFF, 0x51, 0x17, 0x51, 0x1E, 0x51, 0x25, 0xE4, 0xFF, 0x02, 0x45, 0xB1, 0x51, 0x11, 0x51, 0x3C,
-0x12, 0x71, 0x6B, 0x12, 0x4E, 0x36, 0x51, 0x58, 0x51, 0x6F, 0x90, 0x83, 0x4C, 0xE0, 0x54, 0x7F,
-0xF0, 0x54, 0xBF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xF0, 0xF0, 0xE4, 0x90, 0x83, 0x4E, 0xF0, 0x22,
-0x22, 0xE4, 0x90, 0x80, 0xF9, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0x90, 0x01,
-0xC7, 0x74, 0xFE, 0xF0, 0x22, 0x90, 0x01, 0xE4, 0x74, 0x10, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90,
-0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x22, 0xE4, 0x90, 0x80, 0xF5,
-0xF0, 0xA3, 0xF0, 0x90, 0x80, 0x5D, 0xF0, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0x80, 0x01, 0xF0, 0xA3,
-0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x83, 0x40, 0xE0, 0x54, 0xFE, 0xF0, 0x54,
-0x7F, 0xF0, 0x54, 0xFB, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90,
-0x83, 0x44, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xE4, 0x90,
-0x83, 0x48, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x83, 0x44, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90,
-0x83, 0x47, 0xF0, 0x90, 0x83, 0x4B, 0xF0, 0x22, 0x51, 0x6F, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01,
-0xFE, 0x90, 0x83, 0x44, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x2C, 0x90,
-0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0x45, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90,
-0x83, 0x46, 0xF0, 0x12, 0x1F, 0xA4, 0x54, 0x04, 0xFF, 0x90, 0x83, 0x44, 0xE0, 0x54, 0xFB, 0x4F,
-0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0x47, 0xF0, 0x22, 0x90, 0x83, 0x5E, 0x12,
-0x42, 0x3A, 0x90, 0x83, 0x5D, 0xEF, 0xF0, 0x12, 0x42, 0x43, 0x5B, 0x1E, 0x00, 0x5B, 0x27, 0x01,
-0x5B, 0x2F, 0x02, 0x5B, 0x38, 0x03, 0x5B, 0x40, 0x04, 0x5B, 0x48, 0x14, 0x5B, 0x50, 0x20, 0x5B,
-0x58, 0x21, 0x5B, 0x61, 0x23, 0x5B, 0x69, 0x25, 0x5B, 0x79, 0x80, 0x5B, 0x71, 0x81, 0x5B, 0x82,
-0x82, 0x5B, 0x8A, 0x83, 0x5B, 0x93, 0x84, 0x5B, 0x9C, 0x88, 0x00, 0x00, 0x5B, 0xA4, 0x90, 0x83,
-0x5E, 0x12, 0x42, 0x31, 0x02, 0x65, 0x4E, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x81, 0x18, 0x90,
-0x83, 0x5E, 0x12, 0x42, 0x31, 0x02, 0x65, 0x9A, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1, 0xA9,
-0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x41, 0x98, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1, 0x2D,
-0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xA1, 0xEB, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x02, 0x65,
-0xDD, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1, 0x1D, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1,
-0x25, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x81, 0x97, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x02,
-0x79, 0x65, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1, 0x71, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31,
-0x02, 0x7B, 0x07, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x02, 0x7B, 0x69, 0x90, 0x83, 0x5E, 0x12,
-0x42, 0x31, 0xE1, 0x3C, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x83, 0x5D, 0xE0, 0x90,
-0x01, 0xC2, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x80, 0x5E, 0xE0, 0xFF,
-0x90, 0x80, 0x5D, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x70, 0x43,
-0x90, 0x80, 0x5D, 0xE0, 0xFE, 0x75, 0xF0, 0x08, 0x90, 0x80, 0x0D, 0x12, 0x42, 0x25, 0xE0, 0xFD,
-0xEE, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x0E, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0xAF,
-0x05, 0x51, 0xDC, 0x90, 0x80, 0x5D, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F,
-0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0x5D, 0xF0, 0x12, 0x66, 0x21, 0x90, 0x80, 0x01, 0xE0,
-0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8B, 0x1A, 0x8A, 0x1B, 0x89, 0x1C, 0x90, 0x00,
-0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xF5, 0x1E, 0x12, 0x1F, 0xA4, 0xFE, 0xC3, 0x13, 0x30, 0xE0, 0x0A,
-0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xF5, 0x1F, 0x80, 0x02, 0x8F, 0x1F, 0x85, 0x1E, 0x1D, 0xE5,
-0x1D, 0xD3, 0x95, 0x1F, 0x50, 0x33, 0xAB, 0x1A, 0xAA, 0x1B, 0xA9, 0x1C, 0x12, 0x1F, 0xA4, 0x54,
-0x01, 0xFF, 0x74, 0xF9, 0x25, 0x1D, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEF, 0xF0, 0x74,
-0xF9, 0x25, 0x1D, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE0, 0xAF, 0x1D, 0x70, 0x04, 0xF1,
-0x1C, 0x80, 0x02, 0xF1, 0x1B, 0x05, 0x1D, 0x80, 0xC6, 0xE5, 0x1E, 0x70, 0x19, 0x90, 0x80, 0xF9,
-0xE0, 0x70, 0x13, 0x12, 0x4E, 0x97, 0x12, 0x4F, 0x1E, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xF7, 0xF0,
-0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F,
-0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x7D, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54,
-0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF,
-0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, 0x7D, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E,
-0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81,
-0x7D, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE,
-0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x81, 0x7D, 0xF0, 0xEE, 0x54, 0x80, 0xFE,
-0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x54, 0x01, 0xFF, 0x90, 0x81,
-0x7F, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16, 0xE0, 0x7C,
-0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0xF7, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x81, 0x7D,
-0xE0, 0xC3, 0x13, 0x54, 0x01, 0xFF, 0xB1, 0x47, 0x90, 0x81, 0x7D, 0xE0, 0x54, 0x01, 0xFF, 0x12,
-0x4D, 0xBA, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xEF, 0x60, 0x07, 0x90, 0x83, 0x31, 0xE0, 0xFF, 0xB1,
-0x52, 0x22, 0xF1, 0x5D, 0x90, 0x83, 0xEE, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0xEE, 0x12,
-0x57, 0x20, 0x90, 0x83, 0xF0, 0xEF, 0xF0, 0x90, 0x83, 0xEE, 0xA3, 0xE0, 0x24, 0x30, 0xF9, 0xE4,
-0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0x7B, 0x01, 0x7A, 0x81,
-0x79, 0x9C, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xEE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x36,
-0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0x7B, 0x01,
-0x7A, 0x81, 0x79, 0xA2, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xEE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F,
-0x24, 0x3A, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06,
-0x7B, 0x01, 0x7A, 0x81, 0x79, 0xA6, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xEE, 0xA3, 0xE0, 0xFF, 0xA3,
-0xE0, 0x2F, 0x24, 0x40, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75,
-0x16, 0x04, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xAC, 0x02, 0x2B, 0xED, 0x90, 0x83, 0x61, 0x12, 0x42,
-0x3A, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x7F, 0x90, 0x81, 0x3E, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13,
-0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F,
-0xFE, 0x90, 0x81, 0x3C, 0xE0, 0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x54,
-0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4,
-0x54, 0xF0, 0xFF, 0x90, 0x81, 0x3C, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F,
-0xBD, 0x90, 0x81, 0x3D, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0x30, 0xE0, 0x5E, 0xC3, 0x13,
-0x54, 0x07, 0xFF, 0xC3, 0x94, 0x04, 0x90, 0x81, 0x50, 0x50, 0x04, 0xEF, 0xF0, 0x80, 0x2E, 0x74,
-0x03, 0xF0, 0x90, 0x83, 0x61, 0x12, 0x42, 0x31, 0xE9, 0x24, 0x06, 0xF9, 0xE4, 0x3A, 0xFA, 0x12,
-0x1F, 0xA4, 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, 0x1F, 0xEA, 0x90, 0x83, 0x61,
-0x12, 0x42, 0x31, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0xC4, 0x54, 0x0F, 0xFF, 0xC3, 0x94, 0x04,
-0x90, 0x81, 0x46, 0x50, 0x05, 0x74, 0x04, 0xF0, 0x80, 0x02, 0xEF, 0xF0, 0x90, 0x83, 0x61, 0x12,
-0x42, 0x31, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFD, 0x7F, 0x02, 0x12, 0x4B, 0x33, 0x90, 0x83,
-0x61, 0x12, 0x42, 0x31, 0xD1, 0xEB, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0,
-0x90, 0x81, 0x3E, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x81, 0x40, 0xE0, 0x90, 0x01, 0xBB, 0xF0,
-0x90, 0x81, 0x3C, 0xE0, 0x54, 0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x83, 0x64, 0x12, 0x42,
-0x3A, 0xF1, 0x4C, 0x90, 0x81, 0x3E, 0xE0, 0xFF, 0x12, 0x4F, 0x30, 0x90, 0x81, 0x3E, 0xE0, 0x60,
-0x19, 0x90, 0x83, 0x64, 0x12, 0x42, 0x31, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF,
-0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFD, 0x12, 0x73, 0x14, 0x22, 0x22, 0x22, 0x12, 0x1F, 0xA4,
-0x90, 0x81, 0x48, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x7C, 0xF0, 0x22, 0x12, 0x1F, 0xA4,
-0x54, 0x01, 0xFF, 0x90, 0x83, 0x51, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0,
-0xFF, 0x12, 0x1F, 0xA4, 0xFE, 0xEF, 0x2E, 0x90, 0x83, 0x3E, 0xF0, 0x22, 0x90, 0x81, 0x3A, 0xE0,
-0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x47, 0xF0, 0x90, 0x81, 0x42, 0xF0, 0x22, 0xE4, 0xFE, 0xEF,
-0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0, 0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06,
-0x22, 0x90, 0x02, 0x09, 0xE0, 0x90, 0x83, 0x61, 0xF0, 0x12, 0x1F, 0xA4, 0x90, 0x83, 0x2E, 0xF0,
-0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0x2F, 0xF0, 0x22, 0xF1, 0x5D, 0x7E, 0x00, 0x74,
-0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x08,
-0x7B, 0x01, 0x7A, 0x82, 0x79, 0x48, 0x02, 0x2B, 0xED, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE,
-0x90, 0x83, 0x40, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x04, 0xFF, 0xEE, 0x54, 0xFB,
-0x4F, 0xF0, 0x12, 0x1F, 0xA4, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD,
-0x90, 0x83, 0x41, 0xF0, 0x22, 0xE4, 0x90, 0x83, 0x58, 0xF0, 0x90, 0x83, 0x58, 0xE0, 0x64, 0x01,
-0xF0, 0x24, 0xD5, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5F, 0xA3, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x60,
-0x0F, 0x90, 0x81, 0x41, 0xE0, 0xFF, 0x90, 0x81, 0x40, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x51, 0xBF,
-0xC2, 0xAF, 0x31, 0x12, 0xBF, 0x01, 0x02, 0x11, 0x12, 0xD2, 0xAF, 0x11, 0xF4, 0x12, 0x44, 0x60,
-0x80, 0xC8, 0x90, 0x81, 0x3A, 0xE0, 0x30, 0xE0, 0x02, 0x11, 0x1C, 0x22, 0x90, 0x81, 0x41, 0xE0,
-0xFF, 0x60, 0x03, 0xB4, 0x08, 0x0D, 0x31, 0x43, 0xBF, 0x01, 0x08, 0x11, 0x34, 0x90, 0x01, 0xE5,
-0xE0, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x11, 0xAF, 0x11, 0x44, 0xD0,
-0xD0, 0x92, 0xAF, 0x22, 0x11, 0xF5, 0x90, 0x00, 0x08, 0xE0, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12,
-0x32, 0x1E, 0xE4, 0xFF, 0x90, 0x83, 0x59, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01,
-0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x90, 0x83, 0x59, 0xE0, 0x6F, 0x60, 0x3E,
-0xC3, 0x90, 0x83, 0x5B, 0xE0, 0x94, 0x88, 0x90, 0x83, 0x5A, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90,
-0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x83, 0x5A, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41,
-0xF6, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x83, 0x5B, 0xE0, 0x94, 0x32, 0x90,
-0x83, 0x5A, 0xE0, 0x94, 0x00, 0x40, 0xB7, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, 0xB0, 0x22, 0x90,
-0x81, 0x48, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x32, 0x1E, 0x90, 0x81, 0x3F, 0xE0, 0x60, 0x12, 0x90,
-0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x90,
-0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0x7F, 0x01, 0x11,
-0x54, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E, 0x7F, 0x14, 0x7E,
-0x00, 0x02, 0x32, 0xAA, 0x22, 0x90, 0x01, 0xC4, 0x74, 0xF5, 0xF0, 0x74, 0x60, 0xA3, 0xF0, 0x90,
-0x00, 0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x74, 0xF5, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x60, 0xA3,
-0xF0, 0x22, 0x7D, 0x02, 0x90, 0x01, 0xC4, 0x74, 0x12, 0xF0, 0x74, 0x61, 0xA3, 0xF0, 0x90, 0x83,
-0x3F, 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, 0x90, 0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80,
-0x49, 0x90, 0x81, 0x7D, 0xE0, 0x30, 0xE0, 0x0E, 0x90, 0x02, 0x82, 0xE0, 0x60, 0x08, 0x90, 0x01,
-0xB8, 0x74, 0x02, 0xF0, 0x80, 0x34, 0x90, 0x81, 0x85, 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, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x46, 0x61, 0x90, 0x83, 0x5C, 0xEF,
-0xF0, 0x60, 0xF0, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x60, 0xE9, 0xC2, 0xAF, 0x30, 0xE1, 0x06, 0x54,
-0xFD, 0xF0, 0x12, 0x5B, 0xB4, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x30, 0xE2,
-0x05, 0x54, 0xFB, 0xF0, 0x31, 0xF1, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x30,
-0xE4, 0x0B, 0x54, 0xEF, 0xF0, 0x51, 0xAC, 0xBF, 0x01, 0x03, 0x12, 0x53, 0xFA, 0xD2, 0xAF, 0x80,
-0xC2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0x80, 0xF6, 0xE0, 0xFE, 0x90,
-0x80, 0xF5, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01,
-0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13, 0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x5F, 0xF9,
-0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x51, 0x49, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, 0x80,
-0xF5, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4,
-0x90, 0x80, 0xF5, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
-0x90, 0x83, 0x5D, 0x12, 0x42, 0x3A, 0x90, 0x83, 0xF2, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01,
-0xEF, 0x12, 0x1F, 0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x51, 0xE9, 0xEF, 0x60, 0x3A, 0x90, 0x83, 0x5D,
-0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x24,
-0x02, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x5D, 0x12,
-0x42, 0x31, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74, 0xFF, 0xF0,
-0x90, 0x01, 0xCB, 0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, 0x83, 0xFB,
-0xF0, 0xA3, 0xF0, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x2C, 0xC3, 0x90, 0x83, 0xFC, 0xE0, 0x94,
-0xD0, 0x90, 0x83, 0xFB, 0xE0, 0x94, 0x07, 0x40, 0x0A, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x04, 0xF0,
-0x7F, 0x00, 0x22, 0x90, 0x83, 0xFB, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x7F, 0x0A, 0x7E,
-0x00, 0x12, 0x32, 0xAA, 0x80, 0xCD, 0x7F, 0x01, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
-0x90, 0x83, 0xDA, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x83, 0xDA,
-0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D, 0xC3, 0x90, 0x83, 0xDD, 0xE0,
-0x94, 0xE8, 0x90, 0x83, 0xDC, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80,
-0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x83, 0xDC, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x7F,
-0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90,
-0x83, 0x9A, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4,
-0x90, 0x83, 0xA8, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x90, 0x83, 0xA0, 0x12, 0x20,
-0xCE, 0x90, 0x83, 0x9A, 0xE0, 0xFB, 0x70, 0x08, 0x90, 0x83, 0xA0, 0x12, 0x42, 0x19, 0x80, 0x16,
-0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE,
-0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x83, 0xA4, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x9B, 0xE0,
-0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06,
-0xAB, 0x07, 0x90, 0x83, 0xA4, 0x12, 0x42, 0x19, 0xED, 0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC,
-0x12, 0x42, 0x0C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83, 0xA4, 0x12, 0x20, 0xCE, 0x90, 0x83, 0xA0,
-0x12, 0x42, 0x19, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E,
-0x08, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x9A, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82,
-0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x83,
-0xA4, 0x12, 0x42, 0x19, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E,
-0xA2, 0x90, 0x83, 0xA0, 0x12, 0x42, 0x19, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20,
-0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x9A, 0xE0, 0x70, 0x04, 0x7F, 0x20,
-0x80, 0x09, 0x90, 0x83, 0x9A, 0xE0, 0xB4, 0x01, 0x16, 0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C,
-0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF, 0xE4, 0x90, 0x83, 0xA8, 0xEF, 0xF0, 0x90,
-0x83, 0xA8, 0xE0, 0x90, 0x83, 0x9A, 0x60, 0x0E, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5,
-0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4,
-0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD,
-0xE4, 0xFC, 0x90, 0x83, 0x9C, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x9C, 0x02, 0x42, 0x19, 0xD3, 0x10,
-0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x71, 0x3F, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x83, 0xB7, 0xEF,
-0xF0, 0xAB, 0x05, 0x90, 0x83, 0xBD, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, 0xE4,
-0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07,
-0x90, 0x83, 0xB9, 0x12, 0x42, 0x19, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x42, 0x0C, 0xEC,
-0x54, 0x0F, 0xFC, 0x90, 0x83, 0xBD, 0x12, 0x20, 0xCE, 0x90, 0x83, 0xB7, 0xE0, 0x75, 0xF0, 0x08,
-0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0,
-0x06, 0xC0, 0x07, 0x90, 0x83, 0xBD, 0x12, 0x42, 0x19, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0,
-0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xC0, 0x07, 0xC0,
-0x05, 0x90, 0x83, 0xCB, 0x12, 0x42, 0x19, 0x90, 0x83, 0xB9, 0x12, 0x20, 0xCE, 0xD0, 0x05, 0xD0,
-0x07, 0x91, 0x8C, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x83, 0xFD, 0xEF, 0xF0, 0x7F, 0x02, 0x12,
-0x46, 0x3A, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x90, 0x83, 0xFD, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0x80,
-0x01, 0xF0, 0x22, 0x90, 0x83, 0xFE, 0xEF, 0xF0, 0x7F, 0x02, 0x12, 0x46, 0x3A, 0x90, 0x80, 0x02,
-0xE0, 0xFF, 0x90, 0x83, 0xFE, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0x80, 0x02, 0xF0, 0x22, 0x90, 0x02,
-0x09, 0xE0, 0xF5, 0x1A, 0x12, 0x1F, 0xA4, 0x25, 0x1A, 0x90, 0x80, 0x07, 0xF0, 0x90, 0x00, 0x01,
-0x12, 0x1F, 0xBD, 0x25, 0x1A, 0x90, 0x80, 0x08, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x25,
-0x1A, 0x90, 0x80, 0x09, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x25, 0x1A, 0x90, 0x80, 0x0A,
-0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x25, 0x1A, 0x90, 0x80, 0x0B, 0xF0, 0x90, 0x00, 0x05,
-0x12, 0x1F, 0xBD, 0x25, 0x1A, 0x90, 0x80, 0x0C, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
-0xD0, 0x8B, 0x1A, 0x8A, 0x1B, 0x89, 0x1C, 0x12, 0x1F, 0xA4, 0xFF, 0x90, 0x81, 0x39, 0xF0, 0xBF,
-0x01, 0x10, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x1C, 0x7D, 0x13, 0x7F, 0x6F,
-0x80, 0x13, 0xAB, 0x1A, 0xAA, 0x1B, 0xA9, 0x1C, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01,
-0x60, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x4A, 0xED, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x00, 0x02,
-0x12, 0x1F, 0xBD, 0xFF, 0x30, 0xE0, 0x26, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x00,
-0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x77, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01,
-0x4F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x79, 0xF0, 0x22, 0x90, 0x81, 0x76,
-0x74, 0x05, 0xF0, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0,
-0x22, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x83, 0xF3, 0xF0, 0x90, 0x83, 0xF3, 0xE0, 0xFD,
-0x70, 0x02, 0xE1, 0x70, 0x90, 0x80, 0x5D, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60,
-0x0A, 0xEF, 0x14, 0xFF, 0x90, 0x80, 0x5E, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F,
-0x00, 0xEF, 0x60, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x83, 0xF1, 0xE0,
-0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8,
-0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xE1, 0x4D, 0xE4, 0x90, 0x83, 0xF4, 0xF0, 0x90, 0x83, 0xF4,
-0xE0, 0xF9, 0xC3, 0x94, 0x04, 0x50, 0x73, 0x90, 0x83, 0xF1, 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, 0x80, 0x5E, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x80, 0x0D,
-0x12, 0x42, 0x25, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90,
-0x83, 0xF1, 0xE0, 0x75, 0xF0, 0x04, 0xA4, 0x2D, 0xFF, 0xEC, 0x35, 0xF0, 0xFE, 0x74, 0xF0, 0x2F,
-0xF5, 0x82, 0x74, 0x01, 0x3E, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x80, 0x5E, 0xE0, 0x75, 0xF0, 0x08,
-0x90, 0x80, 0x11, 0x12, 0x42, 0x25, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83,
-0xEF, 0xF0, 0x90, 0x83, 0xF4, 0xE0, 0x04, 0xF0, 0x80, 0x83, 0x90, 0x83, 0xF3, 0xE0, 0xFF, 0x90,
-0x83, 0xF1, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4,
-0x5F, 0x90, 0x83, 0xF3, 0xF0, 0x90, 0x83, 0xF1, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80,
-0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x83, 0xF1, 0xE0, 0x04, 0xF0, 0xE0,
-0x54, 0x03, 0xF0, 0x90, 0x80, 0x5E, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F,
-0x01, 0xEF, 0x70, 0x02, 0xC1, 0x2B, 0xE4, 0x90, 0x80, 0x5E, 0xF0, 0xC1, 0x2B, 0x90, 0x01, 0xC0,
-0xE0, 0x44, 0x02, 0xF0, 0x90, 0x83, 0xF1, 0xE0, 0x44, 0x80, 0x90, 0x00, 0x8A, 0xF0, 0x90, 0x83,
-0xF1, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12, 0x42, 0x25, 0xE0, 0x90, 0x01, 0xC3, 0xF0,
-0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x80, 0xF5, 0xE0, 0xFF, 0x70, 0x06, 0xA3,
-0xE0, 0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, 0xFF, 0x90, 0x80, 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, 0x80, 0xF6, 0xE0, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x5F, 0xF9, 0x74, 0x80,
-0x35, 0xF0, 0xA8, 0x01, 0xFC, 0x7D, 0x01, 0xD0, 0x01, 0x7E, 0x00, 0x7F, 0x0F, 0x12, 0x41, 0xD0,
-0x90, 0x80, 0xF6, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60,
-0x05, 0xE4, 0x90, 0x80, 0xF6, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x00, 0x54, 0xE0, 0x55,
-0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55, 0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5, 0x3B, 0xA3,
-0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD, 0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A, 0x7F, 0x55,
-0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57, 0x12, 0x32,
-0x1E, 0x53, 0x91, 0xEF, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, 0xA3, 0xE0, 0x55,
-0x3E, 0xF5, 0x42, 0xA3, 0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, 0xF5, 0x44, 0x90,
-0x01, 0x34, 0xE5, 0x41, 0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, 0xA3, 0xE5, 0x44,
-0xF0, 0x22, 0x90, 0x01, 0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, 0x46, 0xF5, 0x4A,
-0xA3, 0xE0, 0x55, 0x47, 0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, 0x01, 0x3C, 0xE5,
-0x49, 0xF0, 0xA3, 0xE5, 0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, 0xF0, 0x53, 0x91,
-0xDF, 0x22, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x45, 0x90, 0x81, 0x3B, 0xE0, 0xFF, 0x13, 0x13, 0x13,
-0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, 0x11, 0xC7, 0x90, 0x81,
-0x44, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x83, 0xF5, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41,
-0xF6, 0xC3, 0x90, 0x83, 0xF6, 0xE0, 0x94, 0x80, 0x90, 0x83, 0xF5, 0xE0, 0x64, 0x80, 0x94, 0x80,
-0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0xF1, 0x54, 0x31,
-0xDC, 0xE4, 0x90, 0x83, 0x43, 0xF0, 0x22, 0x7D, 0x02, 0x7F, 0x02, 0x11, 0xD1, 0x7D, 0x01, 0x7F,
-0x02, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5,
-0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x83, 0x4A, 0xE0, 0x04, 0xF0, 0x90,
-0x81, 0x41, 0xE0, 0x64, 0x02, 0x60, 0x28, 0x31, 0x20, 0x90, 0x81, 0x3B, 0xE0, 0x13, 0x13, 0x13,
-0x54, 0x1F, 0x30, 0xE0, 0x14, 0x90, 0x81, 0x44, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0x31,
-0xB8, 0x11, 0xC7, 0x90, 0x81, 0x45, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22,
-0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x21, 0xB7, 0x90, 0x81, 0x3E, 0xE0, 0x70, 0x02,
-0x21, 0xB7, 0x90, 0x81, 0x3C, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x26, 0x90, 0x06, 0xAB,
-0xE0, 0x90, 0x81, 0x45, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x04, 0x90, 0x81, 0x44, 0xF0, 0xA3, 0xE0,
-0xFF, 0x70, 0x08, 0x90, 0x81, 0x44, 0xE0, 0xFE, 0xFF, 0x80, 0x03, 0xEF, 0x04, 0xFF, 0x90, 0x81,
-0x45, 0xEF, 0xF0, 0x90, 0x81, 0x3B, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x47, 0xF0, 0x90,
-0x81, 0x49, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C,
-0x74, 0x02, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x3C,
-0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x02, 0x51, 0x40, 0x90, 0x81, 0x3B,
-0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x44, 0xE0, 0xFF, 0xA3, 0xE0,
-0xB5, 0x07, 0x04, 0x31, 0xB8, 0x11, 0xCD, 0x22, 0xEF, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x01,
-0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74,
-0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x83, 0x40, 0xE0,
-0x30, 0xE0, 0x37, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01, 0x70, 0x2F, 0x90, 0x84, 0x04, 0xE0, 0x04,
-0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x83, 0x42, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x84, 0x04, 0xF0,
-0x90, 0x83, 0x42, 0xE0, 0xFF, 0x90, 0x83, 0x41, 0xE0, 0xD3, 0x9F, 0x50, 0x0D, 0x90, 0x83, 0x43,
-0xE0, 0x70, 0x07, 0xE4, 0x90, 0x83, 0x42, 0xF0, 0x51, 0x1B, 0x22, 0x90, 0x83, 0x40, 0xE0, 0xFF,
-0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x16, 0x7B, 0x00, 0x7A, 0x00, 0x79, 0x00, 0x90, 0x83, 0x8B,
-0x12, 0x42, 0x3A, 0xE4, 0x90, 0x83, 0x8E, 0xF0, 0xA3, 0x04, 0xF0, 0x61, 0x5A, 0x02, 0x4C, 0x25,
-0xE4, 0xF5, 0x19, 0x90, 0x06, 0xA9, 0xE0, 0xF5, 0x19, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x81, 0x42,
-0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x51, 0xBF, 0xE5, 0x19, 0x30, 0xE6, 0x22, 0x90,
-0x81, 0x3E, 0xE0, 0x64, 0x01, 0x70, 0x21, 0x90, 0x81, 0x42, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81,
-0x3C, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0x51, 0xA3, 0x80, 0x0C, 0x12, 0x4C, 0xE4, 0x80,
-0x07, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0xE5, 0x19, 0x90, 0x81, 0x42, 0x30, 0xE7, 0x0E,
-0xE0, 0x44, 0x02, 0x12, 0x57, 0xE5, 0x90, 0x81, 0x3A, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54,
-0xFD, 0xF0, 0x22, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x19, 0x90, 0x80, 0x08, 0xE0, 0xFF, 0x7B, 0x18,
-0xE4, 0xFD, 0x51, 0xC3, 0x90, 0x83, 0x52, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x04, 0x1F, 0x74,
-0x20, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0xDF, 0xED, 0xF0, 0xA3,
-0xEB, 0xF0, 0x90, 0x83, 0xDE, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x12, 0x5F, 0x5D, 0x7C, 0x00, 0xAD,
-0x07, 0x90, 0x83, 0xDE, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x83, 0xDF, 0xE0, 0x60, 0x0E, 0x74,
-0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74,
-0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, 0xF5, 0x82,
-0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0xAF, 0x05, 0x74, 0x16, 0x2F, 0xF5, 0x82,
-0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x01, 0xFE, 0x90, 0x83, 0xE0, 0xE0, 0x25, 0xE0, 0x25,
-0xE0, 0xFB, 0xEE, 0x44, 0x02, 0x4B, 0xFE, 0x74, 0x16, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5,
-0x83, 0xEE, 0xF0, 0x74, 0x21, 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, 0x83, 0x88, 0x12, 0x42, 0x3A, 0x78, 0x94, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF, 0x7A,
-0x40, 0x79, 0xCE, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x41, 0xD0, 0x90, 0x05, 0x22, 0xE0, 0x90, 0x83,
-0x93, 0xF0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x0A, 0x7D, 0x33, 0x12, 0x4D, 0x6E, 0xBF, 0x01, 0x15,
-0x80, 0x00, 0x90, 0x83, 0x31, 0xE0, 0xFF, 0x7B, 0x18, 0x7D, 0x01, 0x51, 0xC3, 0x90, 0x83, 0x90,
-0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0x90, 0x12, 0x57, 0x20, 0x90, 0x83, 0x92, 0xEF, 0xF0,
-0x90, 0x83, 0x90, 0xA3, 0xE0, 0x24, 0x20, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0x90, 0x83,
-0x8E, 0xE0, 0xFD, 0x91, 0xDE, 0x90, 0x83, 0x8F, 0xE0, 0x60, 0x02, 0x81, 0x54, 0xA3, 0xA3, 0xE0,
-0x24, 0x30, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90,
-0x83, 0x8B, 0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01,
-0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x90, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F,
-0x24, 0x3A, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90,
-0x83, 0x8B, 0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01,
-0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x90, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F,
-0x24, 0x40, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90,
-0x83, 0x88, 0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0xD0, 0x01,
-0xD0, 0x02, 0x80, 0x69, 0x90, 0x83, 0x8F, 0xE0, 0x64, 0x01, 0x70, 0x66, 0xA3, 0xA3, 0xE0, 0x24,
-0x30, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x13, 0x75, 0x14, 0x81, 0x75,
-0x15, 0x9C, 0x75, 0x16, 0x06, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x90, 0xA3, 0xE0, 0xFF,
-0xA3, 0xE0, 0x2F, 0x24, 0x3A, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x13,
-0x75, 0x14, 0x81, 0x75, 0x15, 0xA6, 0x75, 0x16, 0x06, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x83,
-0x90, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x40, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01,
-0xC0, 0x03, 0x8B, 0x13, 0x75, 0x14, 0x81, 0x75, 0x15, 0xAC, 0x75, 0x16, 0x04, 0xD0, 0x03, 0x12,
-0x2B, 0xED, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x83, 0x93, 0xE0, 0xFF, 0x7D, 0x34,
-0x12, 0x4A, 0xED, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x83,
-0xD2, 0xED, 0xF0, 0x90, 0x83, 0xCF, 0x12, 0x42, 0x3A, 0xE4, 0x90, 0x83, 0xD3, 0xF0, 0xA3, 0xF0,
-0x12, 0x1F, 0xA4, 0xFF, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFD, 0x90, 0x00, 0x04, 0x12, 0x1F,
-0xBD, 0xFB, 0x12, 0x57, 0x46, 0x90, 0x83, 0xD3, 0xEF, 0xF0, 0x90, 0x83, 0xCF, 0x12, 0x42, 0x31,
-0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xD1, 0x9B, 0x90, 0x83, 0xD4, 0xEF, 0xF0, 0x90, 0x82,
-0x51, 0xE0, 0x24, 0xFE, 0x60, 0x1D, 0x24, 0xFE, 0x60, 0x19, 0x14, 0x60, 0x07, 0x14, 0x60, 0x04,
-0x24, 0x05, 0x70, 0x53, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x48, 0x90, 0x83, 0xD2, 0xE0, 0xFD, 0xD1,
-0xDA, 0x80, 0x16, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x48, 0x90, 0x83, 0xD2, 0xE0, 0xFD, 0x90, 0x82,
-0x51, 0xE0, 0x90, 0x83, 0xAD, 0xF0, 0x12, 0x7C, 0x03, 0x90, 0x83, 0xD4, 0xE0, 0xFF, 0x90, 0x83,
-0xCF, 0x12, 0x42, 0x31, 0x90, 0x83, 0xD3, 0xE0, 0x7C, 0x00, 0x29, 0xF9, 0xEC, 0x3A, 0xFA, 0xC3,
-0xE9, 0x9F, 0xF9, 0xEA, 0x94, 0x00, 0xFA, 0x75, 0x13, 0x01, 0x75, 0x14, 0x82, 0x75, 0x15, 0x48,
-0xA3, 0xE0, 0xF5, 0x16, 0x12, 0x2B, 0xED, 0x22, 0x90, 0x80, 0x09, 0xE0, 0xFF, 0x90, 0x83, 0xD6,
-0xE0, 0xFB, 0x7D, 0x01, 0x51, 0xC3, 0x90, 0x83, 0xD7, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, 0xF0, 0xFD,
-0x90, 0x83, 0xD5, 0xE0, 0xFF, 0xD1, 0x33, 0x90, 0x83, 0xD7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90,
-0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC,
-0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
-0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x16, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
-0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15, 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,
-0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4, 0xF0, 0x90, 0x04, 0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF,
-0xF0, 0x90, 0x04, 0x50, 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, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F,
-0xF0, 0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44,
-0x10, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0,
-0x22, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74,
-0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0x90, 0x80,
-0xF9, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x0F, 0x90, 0x81, 0x3C, 0xE0, 0x54,
-0x0F, 0x64, 0x02, 0x60, 0x02, 0x41, 0xA3, 0x12, 0x4C, 0xE4, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3,
-0xC0, 0xD0, 0xEF, 0x20, 0xE0, 0x05, 0x90, 0x83, 0x2E, 0x80, 0x03, 0x90, 0x83, 0x2F, 0xE0, 0x90,
-0x82, 0x51, 0xF0, 0x90, 0x82, 0x51, 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, 0x83, 0xC4, 0xED, 0xF0, 0x90,
-0x83, 0xC1, 0x12, 0x42, 0x3A, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xC8, 0xF0, 0x90,
-0x83, 0xC1, 0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x03, 0x7B, 0x01,
-0x7A, 0x83, 0x79, 0xC5, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xC4, 0xE0, 0x70, 0x46, 0xFF, 0x74, 0xC5,
-0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0xC5, 0x2F, 0xF5,
-0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74, 0xC5, 0x2F, 0xF5, 0x82, 0xE4,
-0x34, 0x83, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF, 0xB4, 0x03, 0xD0, 0x75, 0x13,
-0x01, 0x75, 0x14, 0x83, 0x75, 0x15, 0xC5, 0x75, 0x16, 0x03, 0x90, 0x83, 0xC1, 0x12, 0x42, 0x31,
-0x12, 0x2B, 0xED, 0x22, 0x90, 0x83, 0x44, 0xE0, 0x30, 0xE0, 0x72, 0x90, 0x83, 0x48, 0xE0, 0x04,
-0xF0, 0x90, 0x83, 0x4B, 0xE0, 0x64, 0x01, 0x70, 0x27, 0x90, 0x83, 0x44, 0xE0, 0x13, 0x13, 0x54,
-0x3F, 0x30, 0xE0, 0x1C, 0x90, 0x83, 0x4A, 0xE0, 0x70, 0x16, 0x90, 0x83, 0x47, 0xE0, 0xFF, 0xA3,
-0xE0, 0xC3, 0x9F, 0x40, 0x0B, 0x12, 0x51, 0xC9, 0x90, 0x83, 0x44, 0xE0, 0x54, 0xFE, 0xF0, 0x22,
-0x90, 0x83, 0x48, 0xE0, 0xFF, 0x90, 0x83, 0x45, 0xE0, 0xD3, 0x9F, 0x50, 0x30, 0x90, 0x06, 0x92,
-0xE0, 0x20, 0xE2, 0x1A, 0x90, 0x83, 0x4A, 0xE0, 0x70, 0x14, 0x7D, 0x08, 0xFF, 0x12, 0x4C, 0x29,
-0x90, 0x83, 0x49, 0xE0, 0x04, 0xF0, 0x90, 0x83, 0x43, 0xE0, 0x04, 0xF0, 0x80, 0x06, 0x90, 0x06,
-0x92, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0x83, 0x48, 0xF0, 0x90, 0x83, 0x4A, 0xF0, 0x22, 0x90, 0x80,
-0xF9, 0xE0, 0x64, 0x01, 0x70, 0x13, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x0D, 0x90, 0x01, 0x57, 0xE4,
-0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0x12, 0x57, 0xE5, 0x22, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01,
-0x70, 0x26, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C,
-0x74, 0x02, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFD,
-0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, 0x51, 0xBF, 0x22, 0x90, 0x80, 0xF9, 0xE0, 0xB4, 0x01, 0x14,
-0x90, 0x81, 0x3E, 0xE0, 0x60, 0x0E, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70,
-0x03, 0x12, 0x51, 0xBF, 0x22, 0x11, 0xA8, 0x90, 0x83, 0x54, 0xEF, 0xF0, 0x30, 0xE0, 0x05, 0x7D,
-0x01, 0xE4, 0x80, 0x02, 0xE4, 0xFD, 0xFF, 0x12, 0x4B, 0x33, 0x90, 0x83, 0x54, 0xE0, 0x30, 0xE6,
-0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74,
-0x80, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x30, 0xE0, 0x25, 0x90, 0x81, 0x75, 0xE0, 0x24, 0x07, 0xFF,
-0x90, 0x81, 0x50, 0xE0, 0xFE, 0xC3, 0xEF, 0x9E, 0xFF, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x81, 0x49,
-0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x80, 0x10, 0x90, 0x81,
-0x49, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22, 0xF0, 0x90, 0x81,
-0x49, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x22, 0xE4, 0x90, 0x83, 0x55, 0xF0, 0xA3, 0xF0, 0xA3,
-0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x83, 0x55, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x83,
-0x55, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x83, 0x57, 0xE0, 0x94, 0x64, 0x90, 0x83,
-0x56, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x83, 0x55,
-0xE0, 0xFF, 0x22, 0x90, 0x83, 0x56, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x80, 0xC2, 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, 0xC3, 0xEE, 0x94,
-0x01, 0x40, 0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 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, 0x74, 0x45, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38,
-0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x3E, 0xF0,
-0xA3, 0xF0, 0x90, 0x81, 0x3C, 0xE0, 0x54, 0x0F, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x3C,
-0xE0, 0x54, 0xF0, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xF7,
-0xF0, 0x90, 0x81, 0x44, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xFB, 0xF0,
-0xA3, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x47, 0xF0, 0x90, 0x81, 0x46, 0x74, 0x08, 0xF0,
-0x90, 0x81, 0x49, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x42, 0xF0, 0x90, 0x81,
-0x3A, 0xE0, 0x54, 0xDF, 0xF0, 0xE4, 0xFD, 0xFF, 0x12, 0x4B, 0x33, 0x7D, 0x0C, 0x7F, 0x02, 0x12,
-0x4B, 0x33, 0x12, 0x4B, 0x2F, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3,
-0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x4B, 0x12, 0x20, 0xDA,
-0x54, 0x33, 0x77, 0x70, 0xE4, 0x90, 0x81, 0x75, 0xF0, 0x90, 0x81, 0x4F, 0xF0, 0x90, 0x80, 0x06,
-0xE0, 0xB4, 0x01, 0x08, 0x90, 0x81, 0x48, 0x74, 0x99, 0xF0, 0x80, 0x12, 0x90, 0x80, 0x06, 0xE0,
-0x90, 0x81, 0x48, 0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80, 0x03, 0x74, 0x40, 0xF0, 0x90, 0x81,
-0x76, 0x74, 0x05, 0xF0, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05,
-0xF0, 0xE4, 0x90, 0x81, 0x50, 0xF0, 0x90, 0x81, 0x75, 0xE0, 0x24, 0x07, 0x90, 0x81, 0x53, 0xF0,
-0xA3, 0x74, 0x08, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0x81, 0x7A, 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, 0x4A, 0xED, 0xE4, 0x90, 0x81, 0x7C, 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, 0x51, 0x7C, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74,
-0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x42, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8,
-0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x40, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90,
-0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08,
-0xF0, 0x80, 0x38, 0x90, 0x81, 0x42, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0,
-0x80, 0x29, 0x90, 0x81, 0x3B, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8,
-0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x7C, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x80,
-0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x04,
-0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0B, 0x04, 0x70, 0x27, 0x90, 0x81, 0x44, 0x74,
-0x02, 0xF0, 0x80, 0x16, 0xED, 0x70, 0x0A, 0x90, 0x81, 0x79, 0xE0, 0x90, 0x81, 0x44, 0xF0, 0x80,
-0x05, 0x90, 0x81, 0x44, 0xED, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x3B, 0xE0,
-0x44, 0x08, 0xF0, 0x22, 0xAC, 0x07, 0x90, 0x81, 0x3A, 0xE0, 0x30, 0xE0, 0x32, 0x90, 0x81, 0x50,
-0xE0, 0xD3, 0x94, 0x03, 0x50, 0x07, 0x90, 0x81, 0x46, 0xEB, 0xF0, 0x80, 0x0A, 0xED, 0x24, 0xFD,
-0x2B, 0x90, 0x81, 0x46, 0xF0, 0x7D, 0x03, 0x90, 0x81, 0x75, 0xE0, 0x24, 0x07, 0xC3, 0x9D, 0x2C,
-0xFF, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x81, 0x49, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x80, 0x0E, 0x90,
-0x81, 0x49, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x46, 0xEB, 0xF0, 0x90, 0x81, 0x49,
-0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x22, 0xFD, 0x90, 0x83, 0x6F, 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, 0x80, 0xF8, 0xE0, 0x9B, 0x90, 0x80, 0xF7, 0xE0, 0x9A, 0x50, 0x13,
-0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 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, 0x83, 0x6F, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3,
-0xED, 0xF0, 0x78, 0x78, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC0, 0x7E, 0x00,
-0x7F, 0x06, 0x12, 0x41, 0xD0, 0x78, 0x7E, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79,
-0xC6, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0x78, 0x82, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF,
-0x7A, 0x40, 0x79, 0xCA, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0xE4, 0x90, 0x83, 0x87, 0xF0,
-0x90, 0x83, 0x71, 0xE0, 0xFF, 0x90, 0x83, 0x70, 0xE0, 0x2F, 0xFF, 0x90, 0x83, 0x6F, 0xE0, 0x34,
-0x00, 0xCF, 0x24, 0x06, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x08, 0x60,
-0x02, 0xA1, 0xD3, 0x90, 0x83, 0x71, 0xE0, 0xFF, 0x90, 0x83, 0x70, 0xE0, 0x2F, 0xFF, 0x90, 0x83,
-0x6F, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x07, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x71, 0xA9, 0xEF,
-0x64, 0x06, 0x60, 0x02, 0xA1, 0xD3, 0x90, 0x83, 0x87, 0x04, 0xF0, 0xE4, 0x90, 0x83, 0x86, 0xF0,
-0x90, 0x83, 0x86, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x1F, 0x90, 0x83, 0x70, 0xE0, 0x24, 0x0A,
-0x71, 0x97, 0x90, 0x83, 0x86, 0xE0, 0x24, 0x72, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xEF,
-0xF0, 0x90, 0x83, 0x86, 0xE0, 0x04, 0xF0, 0x80, 0xD7, 0x78, 0x72, 0x7C, 0x83, 0x7D, 0x01, 0x7B,
-0x01, 0x7A, 0x81, 0x79, 0x8C, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x43, 0xEF, 0xEF, 0x60, 0x02, 0xA1,
-0xD3, 0x90, 0x83, 0x86, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2E, 0x90,
-0x83, 0x71, 0xE0, 0xFD, 0x90, 0x83, 0x70, 0xE0, 0x2D, 0xFD, 0x90, 0x83, 0x6F, 0xE0, 0x34, 0x00,
-0xCD, 0x24, 0x20, 0xCD, 0x71, 0x9C, 0x90, 0x83, 0x86, 0xE0, 0x24, 0x82, 0xF5, 0x82, 0xE4, 0x34,
-0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0x04, 0xF0, 0x80, 0xC8, 0x78, 0x82, 0x7C,
-0x83, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xA2, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x43, 0xEF,
-0xEF, 0x60, 0x02, 0xA1, 0xCA, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x01, 0x54, 0xDF, 0xF0, 0x90, 0x81,
-0x7F, 0xE0, 0x30, 0xE0, 0x0F, 0x90, 0x01, 0xC7, 0x74, 0x09, 0xF0, 0x90, 0x81, 0x85, 0xE0, 0x44,
-0x01, 0xF0, 0xA1, 0xD3, 0xE4, 0x90, 0x83, 0x86, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0xFF, 0xC3, 0x94,
-0x06, 0x50, 0x2E, 0x90, 0x83, 0x71, 0xE0, 0xFD, 0x90, 0x83, 0x70, 0xE0, 0x2D, 0xFD, 0x90, 0x83,
-0x6F, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x10, 0xCD, 0x71, 0x9C, 0x90, 0x83, 0x86, 0xE0, 0x24, 0x78,
-0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0x04, 0xF0, 0x80,
-0xC8, 0xE4, 0x90, 0x83, 0x86, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2E,
-0x90, 0x83, 0x71, 0xE0, 0xFD, 0x90, 0x83, 0x70, 0xE0, 0x2D, 0xFD, 0x90, 0x83, 0x6F, 0xE0, 0x34,
-0x00, 0xCD, 0x24, 0x16, 0xCD, 0x71, 0x9C, 0x90, 0x83, 0x86, 0xE0, 0x24, 0x7E, 0xF5, 0x82, 0xE4,
-0x34, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0x04, 0xF0, 0x80, 0xC8, 0x7B, 0x01,
-0x7A, 0x83, 0x79, 0x78, 0x90, 0x83, 0x8B, 0x12, 0x42, 0x3A, 0xE4, 0x90, 0x83, 0x8E, 0xF0, 0xA3,
-0xF0, 0x7A, 0x83, 0x79, 0x7E, 0x12, 0x6B, 0x5A, 0x80, 0x09, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x21,
-0x54, 0xEF, 0xF0, 0x90, 0x83, 0x87, 0xE0, 0xFF, 0x22, 0x90, 0x83, 0x71, 0xED, 0xF0, 0xA3, 0xEB,
-0xF0, 0x90, 0x83, 0x6F, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0x90, 0x83, 0x74, 0xF0, 0xFD, 0x71,
-0xA9, 0xEF, 0x54, 0x0C, 0x64, 0x08, 0x70, 0x74, 0x90, 0x83, 0x6F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF,
-0xA3, 0xE0, 0x24, 0x06, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x88, 0x70, 0x60, 0x90, 0x83, 0x6F, 0xE0,
-0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x24, 0x07, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x8E, 0x70, 0x4C,
-0x90, 0x83, 0x74, 0x04, 0xF0, 0x90, 0x83, 0x6F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x83, 0x72,
-0xE0, 0xFD, 0x90, 0x83, 0x71, 0xE0, 0x2D, 0x04, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x03, 0x70, 0x2C,
-0x90, 0x83, 0x6F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x83, 0x72, 0xE0, 0xFD, 0x90, 0x83, 0x71,
-0xE0, 0x2D, 0x24, 0x06, 0xFD, 0x71, 0xA9, 0xEF, 0x90, 0x01, 0xC7, 0x30, 0xE3, 0x04, 0x74, 0x01,
-0x80, 0x02, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x85, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x83, 0x74, 0xE0,
-0xFF, 0x22, 0x90, 0x83, 0x7F, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x7D, 0x09, 0x71, 0xA9, 0xEF, 0x64,
-0x06, 0x70, 0x36, 0x90, 0x83, 0x7F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x7D, 0x14, 0x71, 0xA9, 0xEF,
-0x70, 0x27, 0x90, 0x83, 0x7F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x7D, 0x15, 0x71, 0xA9, 0xEF, 0x64,
-0x50, 0x70, 0x16, 0x90, 0x83, 0x7F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x7D, 0x21, 0x71, 0xA9, 0xEF,
-0x20, 0xE0, 0x03, 0x30, 0xE2, 0x03, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x83, 0x6F, 0xEE,
-0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x78, 0x72, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF, 0x7A,
-0x40, 0x79, 0xD4, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x41, 0xD0, 0x78, 0x79, 0x7C, 0x83, 0x7D, 0x01,
-0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xDA, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0xE4, 0x90, 0x83,
-0x78, 0xF0, 0x90, 0x83, 0x78, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x1F, 0x90, 0x83, 0x70, 0xE0,
-0x24, 0x04, 0x71, 0x97, 0x90, 0x83, 0x78, 0xE0, 0x24, 0x72, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5,
-0x83, 0xEF, 0xF0, 0x90, 0x83, 0x78, 0xE0, 0x04, 0xF0, 0x80, 0xD7, 0x78, 0x72, 0x7C, 0x83, 0x7D,
-0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x86, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x43, 0xEF, 0xEF, 0x60,
-0x02, 0xE1, 0xDB, 0x90, 0x83, 0x71, 0xE0, 0xFF, 0x90, 0x83, 0x70, 0xE0, 0x2F, 0xFF, 0x90, 0x83,
-0x6F, 0xE0, 0x34, 0x00, 0xFE, 0x90, 0x83, 0x7D, 0xF0, 0xA3, 0xEF, 0xF0, 0x24, 0x06, 0xFF, 0xE4,
-0x3E, 0xFE, 0xE4, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x08, 0x60, 0x02, 0xE1, 0xDB, 0x90, 0x83, 0x7E,
-0xE0, 0x24, 0x07, 0xFF, 0x90, 0x83, 0x7D, 0xE0, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x71, 0xA9, 0xEF,
-0x70, 0x69, 0x90, 0x83, 0x78, 0xF0, 0x90, 0x83, 0x78, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x23,
-0x90, 0x83, 0x7E, 0xE0, 0x24, 0x18, 0xFD, 0x90, 0x83, 0x7D, 0x71, 0x9B, 0x90, 0x83, 0x78, 0xE0,
-0x24, 0x79, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x83, 0x78, 0xE0, 0x04,
-0xF0, 0x80, 0xD3, 0x78, 0x79, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xA2, 0x7E,
-0x00, 0x7F, 0x04, 0x12, 0x43, 0xEF, 0xEF, 0x70, 0x22, 0x90, 0x83, 0x7E, 0xE0, 0x24, 0x08, 0xFF,
-0x90, 0x83, 0x7D, 0xE0, 0x34, 0x00, 0xFE, 0xD1, 0x72, 0xEF, 0x64, 0x01, 0x60, 0x0D, 0x90, 0x01,
-0xC7, 0x74, 0x22, 0xF0, 0x90, 0x81, 0x85, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x7D, 0x7F, 0xEF, 0x5D,
-0xC3, 0x60, 0x14, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0x24,
-0x80, 0xFF, 0xE4, 0x3E, 0xFE, 0x80, 0x0D, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E,
-0xFE, 0xED, 0x5F, 0xFF, 0x22, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, 0x7C, 0x00,
-0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x83, 0x61, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x87, 0xE0,
-0x90, 0x83, 0x65, 0xF0, 0x90, 0x81, 0x7D, 0xE0, 0x20, 0xE0, 0x02, 0x01, 0xFE, 0x90, 0x83, 0x65,
-0xE0, 0xFF, 0xEC, 0xC3, 0x9F, 0x40, 0x02, 0x01, 0xFE, 0x90, 0x83, 0x61, 0xE0, 0xFA, 0xA3, 0xE0,
-0xFB, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0xAD, 0x07, 0x74, 0x02, 0x2D, 0xF5, 0x82, 0xE4,
-0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8, 0xF9, 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, 0x83, 0x63,
-0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x03, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54,
-0x03, 0xFF, 0x7E, 0x00, 0xAD, 0x01, 0xED, 0x24, 0x18, 0xFB, 0xEA, 0x33, 0xCB, 0x2F, 0xFF, 0xEE,
-0x3B, 0x90, 0x83, 0x63, 0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x83, 0x63, 0xE0, 0xFE, 0xA3, 0xE0,
-0xFF, 0x12, 0x77, 0xDC, 0x90, 0x83, 0x63, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0x61, 0xEE,
-0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x80, 0xF7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xD3, 0x90, 0x83,
-0x62, 0xE0, 0x9F, 0x90, 0x83, 0x61, 0xE0, 0x9E, 0x40, 0x1B, 0x90, 0x80, 0xF8, 0xE0, 0x24, 0x01,
-0xFF, 0x90, 0x80, 0xF7, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0x90, 0x83, 0x62, 0xE0, 0x9F, 0xF0, 0x90,
-0x83, 0x61, 0xE0, 0x9E, 0xF0, 0x90, 0x83, 0x61, 0x12, 0x57, 0xD2, 0x0C, 0x01, 0x2D, 0x22, 0x31,
-0x4F, 0xAD, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xFF, 0xF0, 0x74, 0x78, 0xA3, 0xF0, 0xED, 0x64, 0x01,
-0x60, 0x22, 0x90, 0x81, 0x85, 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, 0x51, 0xD1, 0x11, 0x05, 0x90, 0x02, 0x87, 0xE0, 0x70, 0xF8, 0x90, 0x06, 0x90, 0xE0,
-0x44, 0x02, 0xF0, 0x74, 0xFF, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x78, 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, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x61, 0x12,
-0x42, 0x3A, 0x12, 0x1F, 0xA4, 0x20, 0xE0, 0x05, 0x12, 0x4F, 0xF4, 0x41, 0x9D, 0x90, 0x82, 0x50,
-0x74, 0x05, 0xF0, 0x90, 0x83, 0x61, 0x12, 0x42, 0x31, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE,
-0x90, 0x81, 0x80, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD,
-0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90,
-0x81, 0x80, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4,
-0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x80, 0xF0, 0xEE, 0x54, 0x20,
-0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54,
-0xBF, 0x4D, 0xFF, 0x90, 0x81, 0x80, 0xF0, 0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0,
-0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x80, 0xFF, 0x90, 0x81, 0x81, 0xE0, 0x54, 0x7F, 0x4F,
-0xF0, 0x12, 0x1F, 0xA4, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44,
-0x04, 0xF0, 0x90, 0x83, 0x61, 0x12, 0x42, 0x31, 0x12, 0x1F, 0xA4, 0x13, 0x13, 0x13, 0x54, 0x1F,
-0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x80, 0x06, 0xE0, 0xB4, 0x02,
-0x0D, 0x90, 0x81, 0x81, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x20, 0xE0, 0x51, 0x90, 0x00,
-0x01, 0x12, 0x1F, 0xBD, 0x54, 0x7F, 0xFF, 0x90, 0x81, 0x81, 0xE0, 0x54, 0x80, 0x4F, 0xF0, 0x90,
-0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x82, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF,
-0x54, 0x01, 0xFE, 0x90, 0x81, 0x83, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0xFE, 0xFF,
-0xEE, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x81, 0x81, 0xE0, 0x54, 0x7F, 0xFF, 0x90, 0x81, 0x80, 0xE0,
-0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x12, 0x52, 0xEE, 0x90,
-0x80, 0x06, 0xE0, 0xB4, 0x01, 0x07, 0x90, 0xFE, 0x10, 0xE0, 0x44, 0x04, 0xF0, 0xD0, 0xD0, 0x92,
-0xAF, 0x22, 0x90, 0x81, 0x85, 0xE0, 0xFF, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2,
-0x14, 0xEF, 0x44, 0x01, 0x90, 0x81, 0x85, 0xF0, 0x90, 0x81, 0x80, 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, 0x81, 0x85, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xE4,
-0xFF, 0x74, 0x48, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0xA4, 0x2F,
-0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x08, 0xE3, 0x90, 0x82,
-0x50, 0xE0, 0x90, 0x04, 0x4C, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE,
-0xAF, 0x05, 0xED, 0x2E, 0x90, 0x83, 0x30, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED,
-0x2F, 0x90, 0x83, 0x31, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83,
-0x32, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x33, 0xF0, 0x90,
-0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x34, 0xF0, 0x90, 0x00, 0x05, 0x12,
-0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x35, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0xFF,
-0xAE, 0x05, 0xED, 0x2F, 0x90, 0x83, 0x36, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F,
-0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x83, 0x37, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD,
-0xFF, 0xED, 0x2F, 0x90, 0x83, 0x38, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F,
-0x90, 0x83, 0x39, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x3A,
-0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x3B, 0xF0, 0x90, 0x00,
-0x05, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x3C, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F,
-0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x83, 0x3D, 0xF0, 0x22, 0xE4, 0xFF, 0x74, 0x18, 0x2F,
-0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x8C, 0x2F, 0xF5, 0x82, 0xE4, 0x34,
-0x81, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x10, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0,
-0xFE, 0x74, 0x86, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4,
-0x06, 0xCB, 0x22, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x3A, 0x12, 0x1F, 0xA4, 0x90, 0x83, 0xAE, 0xF0,
-0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xAF, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD,
-0x90, 0x83, 0xB0, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xB1, 0xF0, 0x90, 0x00,
-0x06, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xB2, 0xF0, 0x90, 0x00, 0x07, 0x12, 0x1F, 0xBD, 0x90, 0x83,
-0xB3, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xB6, 0xF0, 0xED, 0x70, 0x31, 0xFF,
-0x74, 0xAE, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0xAE,
-0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74, 0xAE, 0x2F, 0xF5,
-0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF, 0xB4, 0x06, 0xD0,
-0x90, 0x83, 0xAD, 0xE0, 0xFF, 0xB4, 0x04, 0x25, 0xA3, 0xE0, 0xFE, 0x90, 0x83, 0xA9, 0x12, 0x42,
-0x31, 0xEE, 0x12, 0x1F, 0xEA, 0x90, 0x83, 0xAF, 0xE0, 0xFE, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x31,
-0x90, 0x00, 0x01, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x02, 0xE4, 0x80, 0x30, 0xEF, 0xB4, 0x02,
-0x2F, 0x90, 0x83, 0xAF, 0xE0, 0xFF, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x31, 0xEF, 0x12, 0x1F, 0xEA,
-0x90, 0x83, 0xAF, 0xE0, 0x44, 0x20, 0x54, 0x7F, 0xFF, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x31, 0x90,
-0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x83, 0xAE, 0xE0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xFC,
-0x90, 0x83, 0xA9, 0x12, 0x42, 0x31, 0xE9, 0x24, 0x03, 0xF9, 0xE4, 0x3A, 0xFA, 0x12, 0x1F, 0xA4,
-0x44, 0x20, 0x12, 0x1F, 0xEA, 0x90, 0x83, 0xB0, 0xE0, 0xFF, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x31,
-0x90, 0x00, 0x04, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x83, 0xB1, 0xE0, 0x90, 0x00, 0x05, 0x12, 0x1F,
-0xFC, 0x90, 0x83, 0xB2, 0xE0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xFC, 0x90, 0x83, 0xB3, 0xE0, 0x90,
-0x00, 0x07, 0x02, 0x1F, 0xFC, 0x00, 0xD1, 0x45,
-};
-u4Byte ArrayLength_MP_8188E_FW_WoWLAN_T = 15688;
-
-
-void
-ODM_ReadFirmware_MP_8188E_FW_WoWLAN_T(
- 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_8188E_FW_WoWLAN_T;
-#else
- ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_WoWLAN_T, ArrayLength_MP_8188E_FW_WoWLAN_T);
-#endif
- *pFirmwareSize = ArrayLength_MP_8188E_FW_WoWLAN_T;
-}
-
-
-
-#endif // end of DM_ODM_SUPPORT_TYPE & (ODM_AP)
-
-
-#endif // end of HWIMG_SUPPORT
-
+/******************************************************************************
+*
+* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+* more details.
+*
+* You should have received a copy of the GNU General Public License along with
+* this program; if not, write to the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+*
+*
+******************************************************************************/
+
+
+#include "../odm_precomp.h"
+
+#if (RTL8188E_SUPPORT == 1)
+#if(DM_ODM_SUPPORT_TYPE & (ODM_AP))
+
+
+u1Byte Array_MP_8188E_FW_AP[] = {
+0x00, 0x95, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x18, 0x19, 0x12, 0x5A, 0x3B, 0x00, 0x00,
+0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x02, 0x49, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x02, 0x59, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x59, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x5F, 0xDD, 0x00, 0x00,
+0x0F, 0xF0, 0x8F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x05, 0xF0,
+0x8F, 0x0F, 0x00, 0x00, 0x00, 0x05, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xF0, 0x8F, 0x0F,
+0x00, 0x00, 0x00, 0x0A, 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, 0x05,
+0x04, 0x03, 0x02, 0x00, 0x03, 0x06, 0x05, 0x04, 0x03, 0x00, 0x04, 0x06, 0x05, 0x04, 0x02, 0x00,
+0x04, 0x08, 0x07, 0x06, 0x04, 0x00, 0x06, 0x0A, 0x09, 0x08, 0x06, 0x00, 0x08, 0x0A, 0x09, 0x08,
+0x04, 0x00, 0x08, 0x0A, 0x09, 0x08, 0x02, 0x00, 0x08, 0x0A, 0x09, 0x08, 0x00, 0x00, 0x08, 0x12,
+0x11, 0x10, 0x08, 0x00, 0x10, 0x1A, 0x19, 0x18, 0x10, 0x00, 0x18, 0x22, 0x21, 0x20, 0x18, 0x00,
+0x20, 0x22, 0x21, 0x20, 0x10, 0x00, 0x20, 0x22, 0x21, 0x20, 0x08, 0x00, 0x20, 0x22, 0x21, 0x1C,
+0x08, 0x00, 0x20, 0x22, 0x21, 0x14, 0x08, 0x00, 0x20, 0x22, 0x20, 0x18, 0x08, 0x00, 0x20, 0x31,
+0x30, 0x20, 0x10, 0x00, 0x30, 0x31, 0x30, 0x18, 0x00, 0x00, 0x30, 0x31, 0x2F, 0x10, 0x10, 0x00,
+0x30, 0x31, 0x2C, 0x10, 0x10, 0x00, 0x30, 0x31, 0x28, 0x10, 0x00, 0x00, 0x30, 0x31, 0x20, 0x10,
+0x00, 0x00, 0x30, 0x31, 0x10, 0x10, 0x00, 0x00, 0x30, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x05,
+0x07, 0x07, 0x07, 0x08, 0x0A, 0x04, 0x04, 0x04, 0x04, 0x06, 0x0A, 0x0B, 0x0D, 0x05, 0x05, 0x07,
+0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x05, 0x05, 0x07,
+0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x0F, 0x0F, 0x05,
+0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x0F, 0x0F, 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, 0x04, 0x05, 0x05, 0x06, 0x0A, 0x11,
+0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, 0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11,
+0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, 0x13, 0x13, 0x13, 0x09, 0x09, 0x09, 0x09, 0x0C,
+0x0E, 0x11, 0x13, 0x13, 0x13, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x26, 0x2A, 0x18, 0x1A, 0x1D,
+0x1F, 0x21, 0x27, 0x29, 0x2A, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x00, 0x00, 0x00,
+0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x00, 0x00, 0x00,
+0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x2C, 0x2C, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x2C,
+0x2C, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x28, 0x2A, 0x2C, 0x2C, 0x2C, 0x00, 0x00, 0x00, 0x1F, 0x23,
+0x28, 0x2A, 0x2C, 0x2C, 0x2C, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x18, 0x00,
+0x24, 0x00, 0x30, 0x00, 0x48, 0x00, 0x60, 0x00, 0x90, 0x00, 0xC0, 0x00, 0xD8, 0x00, 0x50, 0x00,
+0x78, 0x00, 0xA0, 0x00, 0xC8, 0x01, 0x40, 0x01, 0x90, 0x01, 0xE0, 0x02, 0x30, 0x01, 0x2C, 0x01,
+0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x01, 0x2C, 0x01,
+0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x01, 0x2C, 0x01,
+0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x01, 0x2C, 0x01,
+0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x07, 0xD0, 0x07,
+0xD0, 0x01, 0x2C, 0x01, 0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07,
+0xD0, 0x07, 0xD0, 0x07, 0xD0, 0x01, 0x2C, 0x01, 0x40, 0x01, 0xE0, 0x02, 0xD0, 0x03, 0xE8, 0x04,
+0xB0, 0x06, 0x40, 0x07, 0xD0, 0x07, 0xD0, 0x07, 0xD0, 0x01, 0x2C, 0x01, 0x40, 0x01, 0xE0, 0x02,
+0xD0, 0x03, 0xE8, 0x04, 0xB0, 0x06, 0x40, 0x07, 0xD0, 0x07, 0xD0, 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, 0x28, 0x00, 0x3C, 0x00, 0x50, 0x00, 0x64, 0x00, 0xA0, 0x00,
+0xC8, 0x00, 0xF0, 0x01, 0x18, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02,
+0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02,
+0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02,
+0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02,
+0x58, 0x03, 0x20, 0x03, 0xE8, 0x03, 0xE8, 0x03, 0xE8, 0x00, 0x64, 0x00, 0xA0, 0x00, 0xF0, 0x01,
+0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, 0xE8, 0x03, 0xE8, 0x03, 0xE8, 0x00, 0x64, 0x00,
+0xA0, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, 0xE8, 0x03, 0xE8, 0x03,
+0xE8, 0x00, 0x64, 0x00, 0xA0, 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, 0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x06, 0x07, 0x05, 0x05, 0x05,
+0x06, 0x06, 0x07, 0x07, 0x08, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x05, 0x06, 0x06,
+0x07, 0x07, 0x08, 0x09, 0x0A, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x05, 0x06, 0x06,
+0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A,
+0x0B, 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, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09,
+0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x05,
+0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x20, 0x1E, 0x1C, 0x18, 0x10, 0x18, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 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, 0x89, 0xF8, 0xE6, 0xBC, 0x03, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00,
+0x40, 0xCE, 0x79, 0x04, 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, 0x04, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30,
+0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x88, 0x25, 0x0C, 0xF8,
+0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8,
+0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5,
+0x0C, 0x24, 0x89, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD,
+0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x88,
+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, 0x88, 0xA6,
+0x81, 0x74, 0x03, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x04, 0xE4, 0x78, 0x80,
+0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x49, 0xF8, 0x74, 0x01, 0x93,
+0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2,
+0x8C, 0xD2, 0xAF, 0x22, 0x03, 0xEF, 0xD3, 0x94, 0x03, 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, 0x88, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18,
+0xBE, 0x03, 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, 0x88, 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, 0x88, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F,
+0x04, 0x90, 0x49, 0xF8, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3,
+0x94, 0x03, 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, 0x88, 0x2F,
+0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x45, 0x4D, 0x50, 0x2E, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xBF, 0x03,
+0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x88, 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, 0x89, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01,
+0x0F, 0x74, 0x88, 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, 0x03, 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, 0x4C, 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, 0x4D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF,
+0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xE7, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80,
+0x46, 0xE7, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x3E, 0x88, 0x82, 0x8C, 0x83, 0xE7, 0x09, 0xF0,
+0xA3, 0xDF, 0xFA, 0x80, 0x32, 0xE3, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x78, 0xE3, 0x09, 0xF2,
+0x08, 0xDF, 0xFA, 0x80, 0x70, 0x88, 0x82, 0x8C, 0x83, 0xE3, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80,
+0x64, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x58, 0x89, 0x82, 0x8A,
+0x83, 0xE0, 0xA3, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x4C, 0x80, 0xD2, 0x80, 0xFA, 0x80, 0xC6, 0x80,
+0xD4, 0x80, 0x69, 0x80, 0xF2, 0x80, 0x33, 0x80, 0x10, 0x80, 0xA6, 0x80, 0xEA, 0x80, 0x9A, 0x80,
+0xA8, 0x80, 0xDA, 0x80, 0xE2, 0x80, 0xCA, 0x80, 0x33, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4,
+0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8,
+0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, 0x0D, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93,
+0xA3, 0xF6, 0x08, 0xDF, 0xF9, 0xEC, 0xFA, 0xA9, 0xF0, 0xED, 0xFB, 0x22, 0x89, 0x82, 0x8A, 0x83,
+0xEC, 0xFA, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5,
+0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xEA, 0xDE, 0xE8, 0x80, 0xDB, 0x89, 0x82, 0x8A, 0x83,
+0xE4, 0x93, 0xA3, 0xF2, 0x08, 0xDF, 0xF9, 0x80, 0xCC, 0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E,
+0x60, 0xC3, 0x88, 0xF0, 0xED, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0xB9, 0xF5, 0x82, 0xEB, 0x24,
+0x02, 0xB4, 0x04, 0x00, 0x50, 0xAF, 0x23, 0x23, 0x45, 0x82, 0x23, 0x90, 0x47, 0xF9, 0x73, 0xC5,
+0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0, 0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15,
+0x83, 0xE0, 0x38, 0xF0, 0x22, 0xBB, 0x01, 0x0A, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xF5, 0xF0, 0xA3,
+0xE0, 0x22, 0x50, 0x06, 0x87, 0xF0, 0x09, 0xE7, 0x19, 0x22, 0xBB, 0xFE, 0x07, 0xE3, 0xF5, 0xF0,
+0x09, 0xE3, 0x19, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xF5, 0xF0, 0x74, 0x01, 0x93, 0x22,
+0xBB, 0x01, 0x10, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE5, 0x83, 0x3A, 0xF5, 0x83, 0xE0, 0xF5, 0xF0,
+0xA3, 0xE0, 0x22, 0x50, 0x09, 0xE9, 0x25, 0x82, 0xF8, 0x86, 0xF0, 0x08, 0xE6, 0x22, 0xBB, 0xFE,
+0x0A, 0xE9, 0x25, 0x82, 0xF8, 0xE2, 0xF5, 0xF0, 0x08, 0xE2, 0x22, 0xE5, 0x83, 0x2A, 0xF5, 0x83,
+0xE9, 0x93, 0xF5, 0xF0, 0xA3, 0xE9, 0x93, 0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFE,
+0xA3, 0xE0, 0xFF, 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, 0x49, 0xA6, 0x02, 0x45, 0xDD, 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, 0xEB, 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, 0x00, 0x41, 0x9E, 0xA8, 0x00,
+0x41, 0x9E, 0xA9, 0x00, 0x41, 0x9E, 0xBA, 0x00, 0x4A, 0xEA, 0x4D, 0xD3, 0x52, 0xD2, 0x57, 0xF6,
+0x90, 0x00, 0xF0, 0xE0, 0x7F, 0x01, 0x20, 0xE2, 0x02, 0x7F, 0x03, 0x22, 0x51, 0x00, 0x90, 0x9C,
+0x94, 0xEF, 0xF0, 0x51, 0x1E, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x02, 0x2D, 0x4A, 0x51, 0x89,
+0x51, 0xB9, 0x51, 0x4B, 0x51, 0x6A, 0xE4, 0xF5, 0x0D, 0xF5, 0x0E, 0xF5, 0x0F, 0xF5, 0x10, 0xAD,
+0x0D, 0x7F, 0x50, 0x12, 0x31, 0xE4, 0xAD, 0x0E, 0x7F, 0x51, 0x12, 0x31, 0xE4, 0xAD, 0x0F, 0x7F,
+0x52, 0x12, 0x31, 0xE4, 0xAD, 0x10, 0x7F, 0x53, 0x02, 0x31, 0xE4, 0x75, 0x15, 0x12, 0xE4, 0xF5,
+0x16, 0x75, 0x17, 0x07, 0x75, 0x18, 0x32, 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,
+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, 0x31, 0xE4, 0xE4, 0xFD, 0x7F, 0x51, 0x12, 0x31, 0xE4, 0xE4, 0xFD, 0x7F, 0x52, 0x12,
+0x31, 0xE4, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x31, 0xE4, 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, 0x31, 0xE4, 0x7D, 0xFF, 0x7F, 0x55, 0x12, 0x31, 0xE4, 0x7D, 0xFF, 0x7F, 0x56,
+0x12, 0x31, 0xE4, 0x7D, 0xFF, 0x7F, 0x57, 0x02, 0x31, 0xE4, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80,
+0xFD, 0x7F, 0x80, 0x12, 0x31, 0xE4, 0x71, 0x6B, 0x12, 0x32, 0x25, 0x71, 0x85, 0x7F, 0x01, 0x12,
+0x46, 0x15, 0x90, 0x9D, 0xCA, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x46, 0x15, 0x90, 0x9D, 0xCA, 0xE0,
+0x04, 0xF0, 0x7F, 0x03, 0x12, 0x46, 0x15, 0x90, 0x9D, 0xCA, 0xE0, 0x04, 0xF0, 0x51, 0x0C, 0x71,
+0x39, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x31, 0xE4, 0x75, 0x28, 0xFF,
+0x71, 0x5C, 0x71, 0xB5, 0xE4, 0xFF, 0x02, 0x46, 0x9E, 0x71, 0x56, 0x71, 0x63, 0x91, 0xB7, 0x91,
+0x0A, 0x71, 0x73, 0x90, 0x9D, 0xCE, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0,
+0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0x9D, 0x36, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75,
+0xA8, 0x85, 0x22, 0xE4, 0x90, 0x9D, 0x30, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44,
+0x01, 0xF0, 0x22, 0x90, 0x9D, 0xCB, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0x74, 0x0A,
+0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x01, 0x9C, 0x74,
+0x7E, 0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74, 0x24, 0xF0, 0x90, 0x01,
+0x9B, 0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01, 0x99, 0xE4, 0xF0, 0x90,
+0x01, 0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x9D, 0xD3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x98, 0xE0,
+0x7F, 0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3D, 0xC3, 0x90, 0x9D, 0xD4,
+0xE0, 0x94, 0x88, 0x90, 0x9D, 0xD3, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44,
+0x10, 0xF0, 0x22, 0x90, 0x9D, 0xD3, 0xE4, 0x75, 0xF0, 0x01, 0x11, 0x9F, 0x7F, 0x14, 0x7E, 0x00,
+0x12, 0x32, 0x58, 0xD3, 0x90, 0x9D, 0xD4, 0xE0, 0x94, 0x32, 0x90, 0x9D, 0xD3, 0xE0, 0x94, 0x00,
+0x40, 0xBA, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB3, 0x22, 0xE4, 0x90, 0x9D, 0xBA, 0xF0, 0x90,
+0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0xF0, 0x54, 0xF0, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFD, 0xF0,
+0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x9D, 0xBF, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x9D,
+0xB7, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x9D, 0xC2, 0xF0, 0x90,
+0x9D, 0xC1, 0x74, 0x07, 0xF0, 0x90, 0x9D, 0xC4, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90,
+0x9D, 0xBD, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x9D, 0xBB, 0x74, 0x0C, 0xF0,
+0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x90, 0x9D, 0xB7,
+0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54,
+0xF7, 0xF0, 0x90, 0x9C, 0x94, 0xE0, 0xFF, 0xB4, 0x01, 0x08, 0x90, 0x9D, 0xC3, 0x74, 0x93, 0xF0,
+0x80, 0x0F, 0xEF, 0x90, 0x9D, 0xC3, 0xB4, 0x03, 0x05, 0x74, 0xDC, 0xF0, 0x80, 0x03, 0x74, 0x40,
+0xF0, 0x90, 0x9D, 0xC6, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44,
+0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0xE4, 0xFF, 0xE4, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90,
+0x81, 0x00, 0xBE, 0x03, 0x11, 0x31, 0x24, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5,
+0x83, 0x74, 0x80, 0xF0, 0x80, 0x0E, 0x31, 0x24, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83,
+0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x08, 0xEF, 0x90, 0x89, 0x00, 0x31, 0x24, 0xE5, 0x82, 0x2E,
+0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE4, 0xF0, 0x0E, 0xBE, 0x10, 0xBE, 0x0F, 0xBF, 0x80,
+0xB8, 0xE4, 0x90, 0xAF, 0x71, 0xF0, 0xFF, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x01, 0x31, 0x24,
+0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x03, 0x31, 0x24, 0xE4, 0xF0, 0xA3,
+0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x05, 0x31, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0,
+0x0A, 0xEF, 0x90, 0x8D, 0x07, 0x31, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90,
+0x8D, 0x09, 0x31, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4,
+0x34, 0x92, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0x74, 0x93, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x99,
+0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x98, 0x31, 0x24, 0x74, 0x01, 0xF0,
+0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x99, 0x31, 0x24, 0xE4, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90,
+0x94, 0x97, 0x31, 0x24, 0x74, 0x01, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x95, 0x31, 0x24,
+0x74, 0x09, 0xF0, 0xF5, 0xF0, 0xEF, 0x90, 0x94, 0x96, 0x31, 0x24, 0xE4, 0xF0, 0x75, 0xF0, 0x09,
+0xEF, 0x90, 0x94, 0x93, 0x31, 0x24, 0x74, 0x13, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x94,
+0x31, 0x24, 0xE4, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x00, 0x31, 0x24, 0x74, 0x13, 0xF0,
+0x0F, 0xEF, 0x64, 0x80, 0x60, 0x02, 0xA1, 0x07, 0x7F, 0x20, 0x90, 0x9E, 0x7B, 0xE4, 0xF0, 0xA3,
+0xDF, 0xFC, 0x22, 0xE4, 0x90, 0x9D, 0xD5, 0xF0, 0x90, 0x9D, 0xD5, 0xE0, 0x64, 0x01, 0xF0, 0x24,
+0xD3, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x4D, 0xA3, 0xF0, 0x90, 0x9D, 0xBC, 0xE0, 0xFF, 0x90, 0x9D,
+0xBB, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x5F, 0xC4, 0x90, 0x9D, 0xB7, 0xE0, 0x30, 0xE0, 0x09, 0x12,
+0x67, 0xF4, 0xBF, 0x01, 0x03, 0x12, 0x6B, 0x36, 0x90, 0x9D, 0xBC, 0xE0, 0x90, 0x01, 0xBC, 0xF0,
+0x90, 0x9D, 0x36, 0xE0, 0x90, 0x01, 0xBD, 0xF0, 0xD1, 0x3B, 0x90, 0x00, 0x02, 0xE0, 0x54, 0xFE,
+0xF0, 0x7F, 0xF4, 0x7E, 0x01, 0x12, 0x32, 0x58, 0x90, 0x00, 0x02, 0xE0, 0x44, 0x01, 0xF0, 0x7F,
+0xF4, 0x7E, 0x01, 0x12, 0x32, 0x58, 0x12, 0x45, 0x4D, 0x80, 0x9D, 0x12, 0x7A, 0x45, 0x12, 0x52,
+0x73, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0x90, 0x9E, 0xAB, 0xF0, 0x90, 0x00, 0x8F,
+0xE0, 0x20, 0xE6, 0x03, 0x02, 0x51, 0x91, 0x90, 0x00, 0x8D, 0xE0, 0x90, 0x9E, 0xAA, 0xF0, 0x90,
+0x00, 0x8C, 0xE0, 0x90, 0x9E, 0xAB, 0xF0, 0x90, 0x9E, 0xAA, 0xE0, 0x31, 0x42, 0x4E, 0x86, 0x01,
+0x4E, 0x91, 0x02, 0x4E, 0x9C, 0x04, 0x4F, 0x8A, 0x05, 0x50, 0x82, 0x06, 0x51, 0x07, 0x07, 0x51,
+0x4B, 0x08, 0x00, 0x00, 0x51, 0x83, 0x90, 0x9E, 0xAB, 0xE0, 0xFF, 0x12, 0x52, 0x18, 0x02, 0x51,
+0x83, 0x90, 0x9E, 0xAB, 0xE0, 0xFF, 0x12, 0x51, 0xC4, 0x02, 0x51, 0x83, 0x90, 0x9E, 0xAB, 0xE0,
+0x75, 0xF0, 0x09, 0x90, 0x94, 0x98, 0x31, 0x24, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x12, 0x51, 0x9C,
+0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x09, 0x90, 0x94, 0x96, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB,
+0xE0, 0x75, 0xF0, 0x09, 0x90, 0x94, 0x9B, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0,
+0x09, 0x90, 0x94, 0x99, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x09, 0x90, 0x94,
+0x93, 0x31, 0x24, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75,
+0xF0, 0x09, 0x90, 0x94, 0x94, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x09, 0x90,
+0x94, 0x97, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x09, 0x90, 0x94, 0x95, 0x12,
+0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x31, 0x24, 0xE0, 0xFB,
+0xE4, 0xFD, 0x0F, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x01,
+0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x02, 0x12, 0x51, 0x96,
+0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x03, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB,
+0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x04, 0x31, 0x24, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x12, 0x51,
+0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x05, 0x12, 0x51, 0x96, 0x90, 0x9E,
+0xAB, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x06, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75,
+0xF0, 0x08, 0x90, 0x89, 0x07, 0x31, 0x24, 0x02, 0x51, 0x46, 0x90, 0x9E, 0xAB, 0xE0, 0x25, 0xE0,
+0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xA3, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x12,
+0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5,
+0x83, 0xE0, 0xFB, 0x0D, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D,
+0x01, 0x31, 0x24, 0xA3, 0xE0, 0xFB, 0x0D, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0,
+0x0A, 0x90, 0x8D, 0x01, 0x12, 0x51, 0x96, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D,
+0x03, 0x31, 0x24, 0xA3, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x12, 0x51, 0x9C, 0x90, 0x9E, 0xAB, 0xE0,
+0x75, 0xF0, 0x0A, 0x90, 0x8D, 0x05, 0x31, 0x24, 0xA3, 0xE0, 0xFB, 0x0D, 0x12, 0x51, 0x9C, 0x90,
+0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D, 0x07, 0x12, 0x49, 0x24, 0xA3, 0xE0, 0xFB, 0x0D,
+0x31, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D, 0x09, 0x12, 0x49, 0x24, 0xA3,
+0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x24, 0x93, 0xF5, 0x82, 0xE4, 0x34, 0x99,
+0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0x9C, 0x90, 0x9E, 0xAB, 0xE0, 0x25, 0xE0, 0x24,
+0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xA3, 0xE0, 0xFB, 0x7D, 0x02, 0x31, 0x9C, 0x90,
+0x9E, 0xAB, 0xE0, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xFB,
+0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x7B, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0x9C, 0x90, 0x9E, 0x7C,
+0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x7D, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x7E,
+0x21, 0x46, 0x90, 0x9E, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x31, 0x9C, 0x90, 0x9E, 0x84, 0xE0,
+0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x85, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x86, 0xE0,
+0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x87, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0x9C, 0x90, 0x9E,
+0x88, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x89, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E,
+0x8A, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x8B, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0x9C,
+0x90, 0x9E, 0x8C, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x8D, 0xE0, 0xFB, 0x0D, 0x31, 0x9C,
+0x90, 0x9E, 0x8E, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x8F, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F,
+0x31, 0x9C, 0x90, 0x9E, 0x90, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x91, 0xE0, 0xFB, 0x0D,
+0x31, 0x9C, 0x90, 0x9E, 0x92, 0x80, 0x3F, 0x90, 0x9E, 0x93, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x31,
+0x9C, 0x90, 0x9E, 0x94, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x95, 0xE0, 0xFB, 0x0D, 0x31,
+0x9C, 0x90, 0x9E, 0x96, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x97, 0xE0, 0xFB, 0xE4, 0xFD,
+0x0F, 0x31, 0x9C, 0x90, 0x9E, 0x98, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x99, 0xE0, 0xFB,
+0x0D, 0x31, 0x9C, 0x90, 0x9E, 0x9A, 0xE0, 0xFB, 0x0D, 0x80, 0x36, 0x90, 0x9D, 0xBA, 0xE0, 0xFB,
+0xE4, 0xFD, 0xFF, 0x31, 0x9C, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0xFB, 0x0D, 0x31, 0x9C, 0x90,
+0x9D, 0xBB, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90, 0x9D, 0xBC, 0xE0, 0xFB, 0x0D, 0x31, 0x9C, 0x90,
+0x9E, 0xAB, 0xE0, 0x24, 0x36, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD,
+0x0F, 0x31, 0x9C, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x31,
+0xE4, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x49, 0x24, 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, 0x8F, 0x27, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE6, 0x4A, 0x90, 0x00, 0x8D,
+0xE0, 0x64, 0x02, 0x70, 0x42, 0x90, 0x9E, 0xB9, 0xF0, 0x90, 0x9E, 0xB9, 0xE0, 0xFD, 0xE5, 0x27,
+0x75, 0xF0, 0x08, 0xA4, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE5, 0x82, 0x2D,
+0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x31, 0x9C, 0x90, 0x9E, 0xB9,
+0xE0, 0x04, 0xF0, 0xE0, 0xC3, 0x94, 0x08, 0x40, 0xD0, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07,
+0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x31, 0xE4, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F,
+0x26, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE6, 0x46, 0x90, 0x00, 0x8D, 0xE0, 0x64, 0x01, 0x70, 0x3E,
+0x90, 0x9E, 0xB8, 0xF0, 0x90, 0x9E, 0xB8, 0xE0, 0xFD, 0x75, 0xF0, 0x10, 0xE5, 0x26, 0x90, 0x81,
+0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2D, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB,
+0xE4, 0xFF, 0x31, 0x9C, 0x90, 0x9E, 0xB8, 0xE0, 0x04, 0xF0, 0xE0, 0xC3, 0x94, 0x10, 0x40, 0xD4,
+0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x31, 0xE4, 0xD0, 0xD0,
+0x92, 0xAF, 0x22, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE6, 0x57, 0x90, 0x00, 0x8D, 0xE0, 0x64, 0x03,
+0x70, 0x4F, 0x90, 0x00, 0x8F, 0xE0, 0xFE, 0x90, 0x00, 0x8E, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x9D,
+0xD7, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0x90, 0x9D, 0xD6, 0xF0, 0x90, 0x9D, 0xD6, 0xE0, 0xFD,
+0xFF, 0x90, 0x9D, 0xD8, 0xE0, 0x2F, 0xFF, 0x90, 0x9D, 0xD7, 0xE0, 0x34, 0x00, 0x8F, 0x82, 0xF5,
+0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x31, 0x9C, 0x90, 0x9D, 0xD6, 0xE0, 0x04, 0xF0, 0xE0, 0xC3, 0x94,
+0x10, 0x40, 0xD8, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x31,
+0xE4, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x47, 0x4E, 0x90, 0x9D, 0xD9, 0xEF, 0xF0,
+0x60, 0xF0, 0x90, 0x9E, 0x93, 0xE0, 0x04, 0xF0, 0x51, 0xEC, 0x80, 0xE6, 0xD3, 0x10, 0xAF, 0x01,
+0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x9D, 0xDA, 0xF0, 0x90, 0x9D, 0xDA,
+0xE0, 0xFD, 0x70, 0x02, 0x81, 0x25, 0x90, 0x9E, 0xA8, 0xE0, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8,
+0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02,
+0x81, 0x0F, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12, 0x49, 0x24, 0xE0,
+0x90, 0x9D, 0xDB, 0xF0, 0x75, 0x40, 0x01, 0x75, 0x41, 0x9D, 0x75, 0x42, 0xDB, 0x75, 0x43, 0x01,
+0x7B, 0x01, 0x7A, 0x9D, 0x79, 0xDC, 0x12, 0x2B, 0x33, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04,
+0x90, 0x01, 0xD1, 0x12, 0x49, 0x24, 0xE0, 0x90, 0x9D, 0xDD, 0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0x75,
+0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x49, 0x24, 0xE0, 0x90, 0x9D, 0xDE, 0xF0, 0x90, 0x9E, 0xA8,
+0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x49, 0x24, 0xE0, 0x90, 0x9D, 0xDF, 0xF0, 0x90,
+0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12, 0x49, 0x24, 0xE0, 0x90, 0x9D, 0xE0,
+0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1, 0x12, 0x49, 0x24, 0xE0, 0x90,
+0x9D, 0xE1, 0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF2, 0x12, 0x49, 0x24,
+0xE0, 0x90, 0x9D, 0xE2, 0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF3, 0x12,
+0x49, 0x24, 0xE0, 0x90, 0x9D, 0xE3, 0xF0, 0x90, 0x9D, 0xDA, 0xE0, 0xFF, 0x90, 0x9E, 0xA8, 0xE0,
+0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0x9D,
+0xDA, 0xF0, 0x90, 0x9E, 0xA8, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33,
+0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x9D, 0xDC, 0xE0, 0xFF, 0x7B, 0x01, 0x7A, 0x9D, 0x79,
+0xDD, 0x91, 0x2A, 0x90, 0x9E, 0xA8, 0xE0, 0x04, 0xF0, 0xE0, 0x54, 0x03, 0xF0, 0x41, 0xFD, 0x90,
+0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x01, 0x4D, 0xE0, 0x64, 0x80, 0xF0, 0x90, 0x9E, 0xA8,
+0xE0, 0x90, 0x00, 0x89, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x39,
+0xEF, 0x12, 0x49, 0x42, 0x54, 0x56, 0x00, 0x54, 0x5F, 0x01, 0x54, 0x68, 0x02, 0x54, 0x71, 0x03,
+0x54, 0x7A, 0x04, 0x54, 0x83, 0x20, 0x54, 0x8B, 0x21, 0x54, 0x94, 0x23, 0x54, 0x9C, 0x40, 0x54,
+0xAB, 0x42, 0x00, 0x00, 0x54, 0xB4, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x65, 0xE8, 0x90,
+0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x66, 0x30, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x66,
+0xC8, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x7A, 0x7D, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30,
+0x02, 0x7A, 0x9D, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x80, 0x31, 0x90, 0x9D, 0xE4, 0x12, 0x49,
+0x30, 0x02, 0x67, 0x00, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0xE1, 0xE4, 0x90, 0x9E, 0x94, 0xE0,
+0x04, 0xF0, 0x90, 0x9D, 0xE4, 0x12, 0x49, 0x30, 0x02, 0x79, 0x17, 0x90, 0x9D, 0xE4, 0x12, 0x49,
+0x30, 0x02, 0x79, 0xFE, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x12, 0x1F, 0x96, 0x90,
+0x9D, 0xBA, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE,
+0x90, 0x9D, 0xB9, 0xE0, 0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xAF, 0x54, 0x01,
+0x25, 0xE0, 0xFE, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54,
+0xF0, 0xFF, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xAF,
+0x90, 0x9D, 0xBB, 0xF0, 0xB1, 0x2B, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0,
+0x90, 0x9D, 0xBA, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x9D, 0xBB, 0xE0, 0x90, 0x01, 0xBB, 0xF0,
+0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x9D, 0xE7, 0x12, 0x49,
+0x39, 0x12, 0x7A, 0xC7, 0x90, 0x9D, 0xBA, 0xE0, 0xFF, 0xB1, 0x5B, 0x90, 0x9D, 0xBA, 0xE0, 0x60,
+0x19, 0x90, 0x9D, 0xE7, 0x12, 0x49, 0x30, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0x54, 0x0F, 0xFF,
+0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFD, 0x12, 0x7A, 0xD8, 0x22, 0xEF, 0x70, 0x3E, 0x7D, 0x01,
+0xFF, 0x12, 0x5E, 0x47, 0x7D, 0x78, 0x7F, 0x02, 0x12, 0x5E, 0x47, 0x7D, 0x02, 0x7F, 0x03, 0x12,
+0x5E, 0x47, 0x7D, 0xC8, 0x7F, 0x02, 0x12, 0x7A, 0x2D, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01,
+0x3C, 0x74, 0x02, 0xF0, 0x7D, 0x01, 0x7F, 0x0C, 0xB1, 0xF5, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xF7,
+0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, 0x30, 0x74,
+0x01, 0xF0, 0x90, 0x01, 0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x01, 0xE4, 0xFF,
+0xF1, 0xA9, 0x7D, 0x78, 0x7F, 0x02, 0xF1, 0xA9, 0x7D, 0x02, 0x7F, 0x03, 0xF1, 0xA9, 0x90, 0x06,
+0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x9D, 0xC4, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x9D,
+0x36, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x9D, 0xB8, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x9D, 0xBC, 0xE0,
+0x20, 0xE2, 0x0D, 0x7D, 0x01, 0x7F, 0x04, 0x80, 0x0C, 0x90, 0x9D, 0xB8, 0xE0, 0x44, 0x04, 0xF0,
+0x22, 0x7D, 0x01, 0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9E, 0xB4, 0xED,
+0xF0, 0x90, 0x9D, 0xBC, 0xE0, 0x90, 0x9E, 0xB5, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0xFE, 0xC4, 0x13,
+0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0xE1, 0x53, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30,
+0xE0, 0x02, 0xE1, 0x53, 0x90, 0x9E, 0xB5, 0xE0, 0xFE, 0x6F, 0x70, 0x02, 0xE1, 0x53, 0xEF, 0x70,
+0x02, 0xC1, 0xC4, 0x24, 0xFC, 0x60, 0x52, 0x24, 0xFE, 0x70, 0x02, 0xE1, 0x00, 0x24, 0xFE, 0x70,
+0x02, 0xE1, 0x3E, 0x24, 0xFC, 0x60, 0x02, 0xE1, 0x53, 0xEE, 0xB4, 0x0E, 0x03, 0x12, 0x7B, 0x1C,
+0x90, 0x9E, 0xB5, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12, 0x6A, 0x9A, 0x90, 0x9E, 0xB5, 0xE0, 0xB4,
+0x06, 0x02, 0xF1, 0xBE, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0x9E, 0xB4, 0xE0, 0xFF,
+0x60, 0x05, 0x12, 0x63, 0xEF, 0x80, 0x03, 0x12, 0x7B, 0x09, 0x90, 0x9E, 0xB5, 0xE0, 0x64, 0x08,
+0x60, 0x02, 0xE1, 0x53, 0x12, 0x6A, 0xB3, 0xE1, 0x53, 0x90, 0x9E, 0xB5, 0xE0, 0x70, 0x05, 0x7F,
+0x01, 0x12, 0x6A, 0x9A, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x06, 0x02, 0xF1, 0xBE, 0x90, 0x9E, 0xB5,
+0xE0, 0xB4, 0x0E, 0x08, 0xF1, 0x58, 0xBF, 0x01, 0x03, 0x12, 0x7B, 0x1C, 0x90, 0x9E, 0xB5, 0xE0,
+0x64, 0x0C, 0x60, 0x02, 0xE1, 0x53, 0xF1, 0x58, 0xEF, 0x64, 0x01, 0x60, 0x02, 0xE1, 0x53, 0x12,
+0x60, 0xE0, 0xE1, 0x53, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x0E, 0x08, 0xF1, 0x58, 0xBF, 0x01, 0x03,
+0x12, 0x7B, 0x1C, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x06, 0x02, 0xF1, 0xBE, 0x90, 0x9E, 0xB5, 0xE0,
+0xB4, 0x0C, 0x08, 0xF1, 0x58, 0xBF, 0x01, 0x03, 0x12, 0x60, 0xE0, 0x90, 0x9E, 0xB5, 0xE0, 0x64,
+0x04, 0x70, 0x60, 0x12, 0x68, 0xB1, 0xEF, 0x64, 0x01, 0x70, 0x58, 0x12, 0x69, 0xC7, 0x80, 0x53,
+0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x0E, 0x08, 0xF1, 0x58, 0xBF, 0x01, 0x03, 0x12, 0x7B, 0x1C, 0x90,
+0x9E, 0xB5, 0xE0, 0xB4, 0x06, 0x02, 0xF1, 0xBE, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x0C, 0x08, 0xF1,
+0x58, 0xBF, 0x01, 0x03, 0x12, 0x60, 0xE0, 0x90, 0x9E, 0xB5, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12,
+0x6A, 0x9A, 0x90, 0x9E, 0xB5, 0xE0, 0xB4, 0x04, 0x1A, 0x12, 0x7B, 0x44, 0x80, 0x15, 0x90, 0x9E,
+0xB5, 0xE0, 0xB4, 0x0C, 0x0E, 0x90, 0x9D, 0xB8, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0,
+0x02, 0xF1, 0xEC, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x68, 0x98, 0xEF, 0x64, 0x01, 0x60, 0x08,
+0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x38, 0x90, 0x9D, 0xB7, 0xE0, 0xFF, 0x13, 0x13, 0x13,
+0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x23, 0xEF, 0xC4, 0x54,
+0x0F, 0x30, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x14, 0x90, 0x9D, 0xBB, 0xE0,
+0xD3, 0x94, 0x04, 0x40, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x03, 0x7F, 0x01, 0x22,
+0x90, 0x01, 0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x74, 0x15, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE,
+0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x9D,
+0xB8, 0xE0, 0x90, 0x06, 0x04, 0x20, 0xE0, 0x0C, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x9D, 0xBC, 0x74,
+0x04, 0xF0, 0x80, 0x0A, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x90, 0x05,
+0x22, 0xE4, 0xF0, 0x22, 0x12, 0x1F, 0x96, 0x90, 0x9D, 0xC3, 0xF0, 0x22, 0x12, 0x69, 0xE3, 0x90,
+0x9D, 0xBC, 0x74, 0x08, 0xF0, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x47, 0x4E, 0x90,
+0x9D, 0xEC, 0xEF, 0xF0, 0x60, 0xF0, 0x11, 0x0A, 0x80, 0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
+0xD0, 0x90, 0x9D, 0x31, 0xE0, 0xFF, 0x90, 0x9D, 0x30, 0xE0, 0xFE, 0xB5, 0x07, 0x04, 0x7F, 0x01,
+0x80, 0x02, 0x7F, 0x00, 0xEF, 0x64, 0x01, 0x60, 0x45, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x3F, 0xEE,
+0x75, 0xF0, 0x0F, 0xA4, 0xFF, 0xAE, 0xF0, 0x24, 0x9A, 0xF9, 0x74, 0x9C, 0x3E, 0xFA, 0x7B, 0x01,
+0xC0, 0x02, 0xC0, 0x01, 0x74, 0x9C, 0x2F, 0xF9, 0x74, 0x9C, 0x3E, 0xFA, 0x90, 0x9D, 0xF0, 0x12,
+0x49, 0x39, 0xD0, 0x01, 0xD0, 0x02, 0x11, 0x73, 0x90, 0x9D, 0x30, 0xE0, 0x04, 0xF0, 0xE0, 0x7F,
+0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x9D, 0x30, 0xF0, 0xD0, 0xD0,
+0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9D, 0xED, 0x12, 0x49, 0x39,
+0x90, 0x9E, 0xA9, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xEE, 0x7F, 0xAF,
+0x7E, 0x01, 0x11, 0xE5, 0xEF, 0x60, 0x49, 0x90, 0x9D, 0xED, 0x12, 0x49, 0x30, 0x8B, 0x40, 0x8A,
+0x41, 0x89, 0x42, 0x75, 0x43, 0x02, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0x33, 0x90,
+0x9D, 0xF0, 0x12, 0x49, 0x30, 0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, 0x90, 0x9D, 0xED, 0x12, 0x49,
+0x30, 0x12, 0x1F, 0x96, 0xFF, 0xC4, 0x54, 0x0F, 0xF5, 0x43, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA2,
+0x12, 0x2B, 0x33, 0x90, 0x01, 0xAF, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB, 0xE0, 0x64, 0x80, 0xF0,
+0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9D, 0xF3, 0xEE,
+0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x9D, 0xF3, 0xE0, 0xFE, 0xA3, 0xE0,
+0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D, 0xC3, 0x90, 0x9D, 0xF6, 0xE0, 0x94, 0xE8, 0x90, 0x9D,
+0xF5, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80,
+0x15, 0x90, 0x9D, 0xF5, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x48, 0x9F, 0x7F, 0x0A, 0x7E, 0x00, 0x12,
+0x32, 0x58, 0x80, 0xC5, 0x7F, 0x01, 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, 0x90, 0x01, 0xC4, 0x74, 0x3B, 0xF0, 0x74, 0x59,
+0xA3, 0xF0, 0x53, 0x91, 0xEF, 0x31, 0x8D, 0x74, 0x3B, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x59,
+0xA3, 0xF0, 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, 0x00, 0x54,
+0xE0, 0x55, 0x0D, 0xF5, 0x11, 0xA3, 0xE0, 0x55, 0x0E, 0xF5, 0x12, 0xA3, 0xE0, 0x55, 0x0F, 0xF5,
+0x13, 0xA3, 0xE0, 0x55, 0x10, 0xF5, 0x14, 0xAD, 0x11, 0x7F, 0x54, 0x12, 0x31, 0xE4, 0xAD, 0x12,
+0x7F, 0x55, 0x12, 0x31, 0xE4, 0xAD, 0x13, 0x7F, 0x56, 0x12, 0x31, 0xE4, 0xAD, 0x14, 0x7F, 0x57,
+0x02, 0x31, 0xE4, 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,
+0x90, 0x01, 0xC4, 0x74, 0xC3, 0xF0, 0x74, 0x59, 0xA3, 0xF0, 0x12, 0x68, 0x13, 0xE5, 0x19, 0x30,
+0xE0, 0x03, 0x12, 0x68, 0x40, 0xE5, 0x19, 0x30, 0xE1, 0x02, 0x51, 0x7B, 0xE5, 0x19, 0x30, 0xE4,
+0x05, 0x7F, 0x02, 0x12, 0x47, 0x27, 0xE5, 0x1B, 0x30, 0xE0, 0x02, 0x51, 0xBE, 0xE5, 0x1B, 0x30,
+0xE1, 0x02, 0xB1, 0xDE, 0xE5, 0x1B, 0x30, 0xE2, 0x02, 0xD1, 0x5F, 0xE5, 0x1B, 0x30, 0xE3, 0x03,
+0x12, 0x69, 0x1D, 0xE5, 0x1B, 0x30, 0xE4, 0x03, 0x12, 0x69, 0x50, 0xE5, 0x1B, 0x30, 0xE5, 0x02,
+0xF1, 0x3A, 0xE5, 0x1B, 0x30, 0xE6, 0x02, 0xF1, 0x1F, 0xE5, 0x1C, 0x30, 0xE1, 0x02, 0x91, 0x32,
+0xE5, 0x1C, 0x30, 0xE4, 0x02, 0x91, 0x3B, 0xE5, 0x1C, 0x30, 0xE5, 0x02, 0x71, 0x82, 0xE5, 0x1C,
+0x30, 0xE6, 0x02, 0x71, 0x4B, 0x74, 0xC3, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x59, 0xA3, 0xF0,
+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, 0x04, 0x7E, 0xE0, 0xFF,
+0xA3, 0xE0, 0x04, 0xFE, 0xEE, 0xD3, 0x9F, 0x50, 0x2F, 0xE4, 0xFD, 0xEE, 0x75, 0xF0, 0x08, 0xA4,
+0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE5, 0x82, 0x2D, 0xF5, 0x82, 0xE4, 0x35,
+0x83, 0xF5, 0x83, 0xE0, 0xFC, 0x74, 0x72, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xAF, 0xF5, 0x83, 0xEC,
+0xF0, 0x0D, 0xBD, 0x08, 0xD6, 0x0E, 0x80, 0xCC, 0x90, 0x04, 0x7F, 0xEF, 0xF0, 0x22, 0xE4, 0xFF,
+0x90, 0x9D, 0xBA, 0xE0, 0x70, 0x02, 0x61, 0x4A, 0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x7A,
+0x90, 0x9D, 0xB9, 0xE0, 0xC4, 0x54, 0x0F, 0x60, 0x24, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x1F,
+0x90, 0x9D, 0xC0, 0xE0, 0x14, 0xF0, 0xE0, 0xFE, 0x60, 0x06, 0x90, 0x9D, 0xC2, 0xE0, 0x60, 0x0F,
+0xEE, 0x70, 0x06, 0x90, 0x9D, 0xBF, 0xE0, 0xA3, 0xF0, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x01, 0xEF,
+0x60, 0x48, 0x90, 0x9D, 0xBD, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x9D, 0xC2, 0xE0, 0x60, 0x03, 0xB4,
+0x01, 0x09, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC2, 0xE0, 0x80, 0x0D, 0xE4, 0xF5, 0x3B, 0x90, 0x9D,
+0xC2, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x9D, 0xC1, 0xE0, 0x2F, 0xF5, 0x3C,
+0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0,
+0x90, 0x9D, 0xBC, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x55, 0xF1, 0x22, 0x90, 0x07, 0x1F, 0xE0, 0x54,
+0x7F, 0xF0, 0x90, 0x07, 0x1C, 0xE0, 0x54, 0x01, 0x90, 0x9D, 0xF9, 0xF0, 0x90, 0x9D, 0xF7, 0xE0,
+0x54, 0xF0, 0x44, 0x02, 0xF0, 0x54, 0x0F, 0x44, 0x10, 0xF0, 0x7B, 0x01, 0x7A, 0x9D, 0x79, 0xF9,
+0x90, 0x9D, 0xFD, 0x12, 0x49, 0x39, 0x7A, 0x9D, 0x79, 0xF7, 0x12, 0x67, 0x46, 0x7F, 0x03, 0x02,
+0x47, 0x27, 0x90, 0x9E, 0x90, 0xE0, 0x04, 0xF0, 0xE4, 0xF5, 0x52, 0x90, 0x9D, 0x36, 0xE0, 0x70,
+0x02, 0x81, 0x26, 0xE5, 0x52, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0xE5, 0x52, 0x54, 0x07, 0xFE,
+0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xFD, 0xAF, 0x06, 0x74, 0x01,
+0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF,
+0x5D, 0x60, 0x63, 0x75, 0xF0, 0x10, 0xE5, 0x52, 0x90, 0x81, 0x01, 0x12, 0x49, 0x24, 0xE0, 0x20,
+0xE7, 0x02, 0x80, 0x10, 0x75, 0xF0, 0x10, 0xE5, 0x52, 0x90, 0x81, 0x02, 0x12, 0x49, 0x24, 0xE0,
+0xFF, 0x20, 0xE7, 0x09, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x20, 0xF0, 0x80, 0x39, 0xEF, 0x30, 0xE6,
+0x2A, 0x90, 0x9E, 0x8D, 0xE0, 0x04, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x52, 0x90, 0x81, 0x00, 0x12,
+0x49, 0x24, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xE5, 0x52, 0x90, 0x94, 0x96, 0x12, 0x49, 0x24, 0xE0,
+0xF5, 0x6A, 0xE4, 0xFB, 0xAF, 0x52, 0x12, 0x6B, 0xD1, 0x80, 0x0B, 0x90, 0x9E, 0x8E, 0xE0, 0x04,
+0xF0, 0xAF, 0x52, 0x12, 0x6F, 0x28, 0x05, 0x52, 0xE5, 0x52, 0xC3, 0x94, 0x80, 0x50, 0x02, 0x61,
+0x8B, 0x22, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x02, 0xF1, 0x92, 0x22, 0x90, 0x9E, 0x8F, 0xE0, 0x04,
+0xF0, 0xE4, 0xFF, 0x8F, 0x52, 0xE4, 0xFC, 0x74, 0xF7, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5,
+0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x03, 0x12, 0x49, 0x24, 0xE0, 0xFF, 0x30,
+0xE7, 0x0F, 0xEC, 0x70, 0x1D, 0xEF, 0x30, 0xE6, 0x19, 0x90, 0x9E, 0x8C, 0xE0, 0x04, 0xF0, 0x80,
+0x11, 0xAF, 0x04, 0xF1, 0xCE, 0x74, 0xF7, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0x74,
+0x01, 0xF0, 0x0C, 0xBC, 0x80, 0xC1, 0x7F, 0x0C, 0x7E, 0x00, 0x12, 0x32, 0x58, 0xE4, 0xFC, 0x74,
+0xF7, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0x70, 0x02, 0xA1, 0xD5, 0x75, 0xF0,
+0x10, 0xEC, 0x90, 0x81, 0x06, 0x12, 0x49, 0x24, 0xE0, 0xFD, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81,
+0x07, 0x12, 0x49, 0x24, 0xE0, 0xFE, 0xED, 0xFB, 0xEB, 0xFF, 0xEC, 0x25, 0xE0, 0x24, 0x01, 0xF5,
+0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90,
+0x81, 0x0A, 0x12, 0x49, 0x24, 0xE0, 0xFD, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0B, 0x12, 0x49,
+0x24, 0xE0, 0xFB, 0xFE, 0xED, 0xF5, 0x82, 0xE5, 0x82, 0xFF, 0x75, 0xF0, 0x0A, 0xEC, 0x90, 0x8D,
+0x01, 0x12, 0x49, 0x24, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0C,
+0x12, 0x49, 0x24, 0xE0, 0xFF, 0x75, 0xF0, 0x0A, 0xEC, 0x90, 0x8D, 0x03, 0x12, 0x49, 0x24, 0xE4,
+0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0D, 0x12, 0x49, 0x24, 0xE0, 0xFF,
+0x75, 0xF0, 0x0A, 0xEC, 0x90, 0x8D, 0x05, 0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x75,
+0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0E, 0x12, 0x49, 0x24, 0xE0, 0xFF, 0x75, 0xF0, 0x0A, 0xEC, 0x90,
+0x8D, 0x07, 0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81,
+0x0F, 0x12, 0x49, 0x24, 0xE0, 0xFF, 0x75, 0xF0, 0x0A, 0xEC, 0x90, 0x8D, 0x09, 0x12, 0x49, 0x24,
+0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x09, 0x12, 0x49, 0x24, 0xE0,
+0xFF, 0x74, 0x93, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x99, 0xF5, 0x83, 0xEF, 0xF0, 0xEC, 0x70, 0x4E,
+0xEB, 0x30, 0xE7, 0x05, 0x90, 0x9E, 0x8B, 0x80, 0x42, 0xEB, 0x30, 0xE6, 0x05, 0x90, 0x9E, 0x8A,
+0x80, 0x39, 0xEB, 0x30, 0xE5, 0x05, 0x90, 0x9E, 0x89, 0x80, 0x30, 0xEB, 0x30, 0xE4, 0x05, 0x90,
+0x9E, 0x88, 0x80, 0x27, 0xEB, 0x30, 0xE3, 0x05, 0x90, 0x9E, 0x87, 0x80, 0x1E, 0xEB, 0x30, 0xE2,
+0x05, 0x90, 0x9E, 0x86, 0x80, 0x15, 0xEB, 0x30, 0xE1, 0x05, 0x90, 0x9E, 0x85, 0x80, 0x0C, 0xEB,
+0x30, 0xE0, 0x05, 0x90, 0x9E, 0x84, 0x80, 0x03, 0x90, 0x9E, 0x83, 0xE0, 0x04, 0xF0, 0xAF, 0x04,
+0xAD, 0x52, 0x12, 0x76, 0x33, 0x0C, 0xEC, 0x64, 0x80, 0x60, 0x02, 0x81, 0x8F, 0x22, 0x90, 0x9D,
+0xBA, 0xE0, 0x60, 0x45, 0x90, 0x9D, 0xB8, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0,
+0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, 0xD1, 0x3D, 0x90, 0x9D, 0xBF, 0xE0, 0x14, 0x90,
+0x05, 0x73, 0xF0, 0x90, 0x9E, 0xAC, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x48, 0x9F, 0xC3, 0x90, 0x9E,
+0xAD, 0xE0, 0x94, 0x80, 0x90, 0x9E, 0xAC, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01,
+0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0x12, 0x63, 0x03, 0x12, 0x60, 0x85, 0xE4,
+0xFF, 0x91, 0x43, 0x12, 0x73, 0x7B, 0x90, 0x9E, 0x91, 0xE0, 0x04, 0xF0, 0x22, 0x7D, 0x02, 0x7F,
+0x02, 0xD1, 0x47, 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,
+0x9D, 0xBC, 0xE0, 0x64, 0x06, 0x60, 0x22, 0xD1, 0x8A, 0x90, 0x9D, 0xB8, 0xE0, 0x13, 0x13, 0x13,
+0x54, 0x1F, 0x30, 0xE0, 0x14, 0x90, 0x9D, 0xBF, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0xF1,
+0x6E, 0xD1, 0x3D, 0x90, 0x9D, 0xC0, 0xE0, 0x14, 0xF0, 0x22, 0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01,
+0x60, 0x02, 0xE1, 0x1E, 0x90, 0x9D, 0xBA, 0xE0, 0x70, 0x02, 0xE1, 0x1E, 0x90, 0x9D, 0xB9, 0xE0,
+0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x22, 0x90, 0x06, 0xAB, 0xE0, 0x90, 0x9D, 0xC0, 0xF0, 0x90,
+0x06, 0xAA, 0xE0, 0x90, 0x9D, 0xBF, 0xF0, 0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x9D, 0xBF, 0xE0,
+0xFE, 0xFF, 0x80, 0x00, 0x90, 0x9D, 0xC0, 0xEF, 0xF0, 0x90, 0x9D, 0xB8, 0xE0, 0x44, 0x04, 0xF0,
+0xE4, 0x90, 0x9D, 0xC2, 0xF0, 0x90, 0x9D, 0xC4, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01,
+0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x9D, 0xBD, 0xE0, 0x54, 0xFD, 0xF0,
+0x54, 0xEF, 0xF0, 0x90, 0x9D, 0xB9, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80,
+0x03, 0x12, 0x65, 0x6A, 0x90, 0x9D, 0xB8, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0E,
+0x90, 0x9D, 0xBF, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x04, 0xF1, 0x6E, 0xD1, 0x43, 0x22, 0x90,
+0x9D, 0x36, 0xE0, 0xB4, 0x01, 0x13, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x0D, 0x90, 0x9D, 0xBD, 0xE0,
+0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, 0xF1, 0xC4, 0x22, 0x90, 0x9D, 0x36, 0xE0, 0xB4, 0x01,
+0x15, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x0F, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60,
+0x02, 0x80, 0x04, 0x12, 0x64, 0x77, 0x22, 0x12, 0x62, 0xD5, 0xBF, 0x01, 0x10, 0x90, 0x9C, 0x96,
+0xE0, 0xFF, 0xE4, 0xFD, 0x12, 0x62, 0x0A, 0x90, 0x04, 0x1F, 0x74, 0x20, 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, 0x90, 0x9D, 0xBA, 0xE0, 0x64, 0x01, 0x70, 0x29, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F,
+0x60, 0x15, 0x90, 0x9D, 0xBC, 0xE0, 0x70, 0x04, 0xFF, 0x12, 0x6A, 0x9A, 0x90, 0x9D, 0xBC, 0xE0,
+0x64, 0x0C, 0x60, 0x0F, 0x02, 0x7B, 0x09, 0x90, 0x9D, 0xBC, 0xE0, 0xC3, 0x94, 0x04, 0x50, 0x03,
+0x12, 0x55, 0xF1, 0x22, 0x90, 0x9D, 0xBB, 0xE0, 0xFF, 0x7D, 0x01, 0x02, 0x55, 0xF5, 0x75, 0xF0,
+0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x49, 0x24, 0xE0, 0x44, 0x40, 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, 0x90, 0x01, 0xC4, 0x74, 0xDD, 0xF0,
+0x74, 0x5F, 0xA3, 0xF0, 0x53, 0x91, 0xDF, 0x51, 0xA8, 0xE5, 0x21, 0x30, 0xE1, 0x02, 0x11, 0x6A,
+0xE5, 0x21, 0x30, 0xE2, 0x02, 0x71, 0x37, 0xE5, 0x21, 0x30, 0xE3, 0x02, 0x71, 0x73, 0xE5, 0x22,
+0x30, 0xE0, 0x02, 0x31, 0x93, 0xE5, 0x24, 0x30, 0xE1, 0x05, 0x7F, 0x03, 0x12, 0x47, 0x27, 0xE5,
+0x24, 0x30, 0xE4, 0x02, 0x11, 0x73, 0xE5, 0x24, 0x30, 0xE5, 0x02, 0x31, 0x16, 0xE5, 0x24, 0x30,
+0xE6, 0x02, 0x31, 0xCC, 0x74, 0xDD, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5F, 0xA3, 0xF0, 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, 0x9D, 0xBA, 0xE0, 0x60, 0x02,
+0xB1, 0x0C, 0x22, 0x71, 0xAF, 0x90, 0x9D, 0xBF, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02,
+0x7F, 0x02, 0x12, 0x57, 0xA9, 0x90, 0x9D, 0xCB, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x9D, 0x36, 0xE0,
+0xB4, 0x01, 0x26, 0x90, 0x9E, 0xBA, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x9D, 0xCD,
+0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x9E, 0xBA, 0xF0, 0x90, 0x9D, 0xCD, 0xE0, 0xFF, 0x90, 0x9D, 0xCC,
+0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0x11, 0xBA, 0x22, 0xE4, 0xFF, 0x8F, 0x6F, 0x51, 0xD5,
+0xBF, 0x01, 0x1A, 0x90, 0x9C, 0x97, 0xE0, 0xFF, 0x7D, 0x01, 0x51, 0x0A, 0xAD, 0x07, 0xAC, 0x06,
+0xAF, 0x6F, 0x91, 0xC1, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22,
+0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x2D, 0x90, 0x9D, 0xB8, 0xE0, 0x54, 0xFD, 0xF0, 0x90,
+0x05, 0x22, 0x74, 0x6F, 0xF0, 0x7F, 0x01, 0x11, 0xBC, 0xBF, 0x01, 0x0E, 0x90, 0x9D, 0xB7, 0xE0,
+0x44, 0x80, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x0E, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0,
+0x90, 0x01, 0xB8, 0x04, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03,
+0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x9D, 0xB8, 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, 0x5F, 0xC4, 0xE4, 0xFF, 0x90, 0x9D, 0xCE, 0xE0,
+0x30, 0xE0, 0x3F, 0x90, 0x9D, 0xD2, 0xE0, 0xFD, 0x60, 0x38, 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, 0x9D, 0xD2, 0xF0, 0x22, 0x90, 0x9D, 0xD0, 0xE0, 0xB5, 0x05,
+0x09, 0x90, 0x01, 0xC7, 0xE0, 0x44, 0x10, 0xF0, 0x41, 0x73, 0x11, 0xBA, 0x90, 0x9D, 0xD2, 0xE0,
+0x04, 0xF0, 0x22, 0x91, 0x30, 0x90, 0x9E, 0x77, 0xEF, 0xF0, 0xE0, 0xFC, 0x54, 0x01, 0xFE, 0x90,
+0x9D, 0xB7, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEC, 0x30, 0xE6, 0x20, 0x90, 0x01, 0x00, 0xE0, 0xB4,
+0xEA, 0x09, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0x58, 0x80, 0xF0, 0x90, 0x01, 0x2F, 0xE0, 0x30,
+0xE7, 0x03, 0xE4, 0xF0, 0x22, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0,
+0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04,
+0xE0, 0xE0, 0x90, 0x9D, 0xB8, 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, 0x9D, 0xBA,
+0xE0, 0x60, 0x03, 0x12, 0x5F, 0xC4, 0x7F, 0x01, 0x21, 0x4C, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
+0xD0, 0x90, 0x9E, 0xAF, 0xED, 0xF0, 0x90, 0x9E, 0xAE, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x51, 0x8A,
+0x7C, 0x00, 0xAD, 0x07, 0x90, 0x9E, 0xAE, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x9E, 0xAF, 0xE0,
+0x60, 0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0,
+0xAF, 0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09,
+0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x29, 0x2D, 0xF5,
+0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0,
+0x92, 0xAF, 0x22, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x9C, 0x94, 0xE0, 0x64, 0x02,
+0x60, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0x25, 0xE0, 0xFD,
+0xEF, 0xC3, 0x94, 0x80, 0x90, 0xFD, 0x12, 0x50, 0x04, 0xE4, 0xF0, 0x80, 0x03, 0x74, 0x01, 0xF0,
+0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06, 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, 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, 0x9D, 0xCE, 0xE0, 0x30, 0xE0, 0x2C, 0x90, 0x9D, 0xD1, 0xE0, 0x04, 0xF0,
+0xE0, 0xFF, 0x90, 0x9D, 0xCF, 0xE0, 0xB5, 0x07, 0x1D, 0x90, 0x06, 0x92, 0xE0, 0x54, 0x1C, 0x70,
+0x0A, 0x11, 0xBA, 0x90, 0x9D, 0xD2, 0xE0, 0x04, 0xF0, 0x80, 0x06, 0x90, 0x06, 0x92, 0x74, 0x1C,
+0xF0, 0xE4, 0x90, 0x9D, 0xD1, 0xF0, 0x22, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x35, 0x90, 0x06, 0x92,
+0xE0, 0x30, 0xE0, 0x24, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC8, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5,
+0x3C, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x5B, 0x74, 0x05,
+0xF0, 0x90, 0x06, 0x92, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xF7, 0xF0, 0x12,
+0x5F, 0xC4, 0x22, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x35, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, 0x24,
+0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC8, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x3C, 0xE4, 0xFB, 0xFD,
+0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92,
+0x74, 0x02, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xEF, 0xF0, 0x12, 0x5F, 0xC4, 0x22, 0x90,
+0x9D, 0xBA, 0xE0, 0x60, 0x39, 0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x31, 0x90, 0x9D, 0xC0,
+0xF0, 0x04, 0x60, 0x2A, 0x90, 0x9D, 0xBD, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x3B, 0x90, 0x9D,
+0xC1, 0xE0, 0xF5, 0x3C, 0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01,
+0x57, 0x74, 0x05, 0xF0, 0x90, 0x9D, 0xBC, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x55, 0xF1, 0x22, 0xEF,
+0x60, 0x3D, 0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x35, 0x90, 0x9D, 0xB8, 0xE0, 0x54, 0xFE,
+0xF0, 0x90, 0x05, 0x22, 0x74, 0x0F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF,
+0x11, 0xBC, 0xBF, 0x01, 0x0E, 0x90, 0x9D, 0xB7, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x9D, 0xBC, 0x74,
+0x06, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22,
+0xE4, 0x90, 0x9E, 0x78, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x9E, 0x78,
+0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x9E, 0x78, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3,
+0x90, 0x9E, 0x7A, 0xE0, 0x94, 0x64, 0x90, 0x9E, 0x79, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01,
+0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x9E, 0x78, 0xE0, 0xFF, 0x22, 0x90, 0x9E, 0x79, 0xE4, 0x75,
+0xF0, 0x01, 0x12, 0x48, 0x9F, 0x80, 0xC2, 0x90, 0x01, 0x5F, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74,
+0x08, 0xF0, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC8, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x3C, 0xE4,
+0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90,
+0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x9D, 0xBC, 0xE0,
+0xC3, 0x94, 0x0C, 0x50, 0x0B, 0xE4, 0xFD, 0x7F, 0x0C, 0x12, 0x55, 0xF5, 0xE4, 0xFF, 0x11, 0xBC,
+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, 0x90, 0x9D, 0xB7, 0xE0,
+0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x9D, 0xBD, 0xE0,
+0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x9D, 0xC2, 0xE0, 0x04, 0xF0, 0x90,
+0x9D, 0xBD, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x9D, 0xC2, 0xE0, 0xFF, 0xB4, 0x01, 0x02, 0x80, 0x04,
+0xEF, 0xB4, 0x02, 0x06, 0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90, 0x9D, 0xC6, 0xE0, 0xFF, 0x90,
+0x9D, 0xC2, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x9D, 0x36, 0xE0, 0xB4, 0x01, 0x0B, 0x90, 0x9D,
+0xB8, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x5F, 0xC4, 0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x9D,
+0xF7, 0xF0, 0xE0, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x9D, 0xBD, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD,
+0xF0, 0x02, 0x5F, 0xC4, 0x90, 0x9D, 0xF7, 0xE0, 0x30, 0xE6, 0x22, 0x90, 0x9D, 0xBA, 0xE0, 0x64,
+0x01, 0x70, 0x21, 0x90, 0x9D, 0xBD, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x9D, 0xB9, 0xE0, 0x54, 0x0F,
+0x64, 0x02, 0x60, 0x05, 0x12, 0x5F, 0x57, 0x80, 0x0B, 0x91, 0x77, 0x80, 0x07, 0x90, 0x9D, 0xBD,
+0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x9D, 0xF7, 0xE0, 0x90, 0x9D, 0xBD, 0x30, 0xE7, 0x25, 0xE0, 0x44,
+0x02, 0xF0, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC7, 0xE0, 0xF5, 0x3C, 0xE4, 0xFB, 0xFD, 0x7F, 0x54,
+0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x44,
+0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0x96,
+0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x9C, 0x95, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0xFF,
+0xED, 0x2F, 0x90, 0x9C, 0x96, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFF, 0xED, 0x2F, 0x90,
+0x9C, 0x97, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xAF, 0xFF, 0xED, 0x2F, 0x90, 0x9C, 0x98, 0xF0,
+0x90, 0x00, 0x04, 0x12, 0x1F, 0xAF, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x9C, 0x99, 0xF0, 0x22,
+0x90, 0x9D, 0xE7, 0x12, 0x49, 0x39, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0xFF, 0xFE, 0x12, 0x1F,
+0x96, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x9D, 0xE7, 0x12, 0x49, 0x30, 0x90, 0x00, 0x02,
+0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xEB, 0xF0, 0x80, 0x05, 0x90, 0x9D, 0xEB, 0xEF, 0xF0, 0x90, 0x9D,
+0xEA, 0xEE, 0xF0, 0x90, 0x9D, 0xEB, 0xE0, 0xFE, 0x90, 0x9D, 0xEA, 0xE0, 0xFF, 0xD3, 0x9E, 0x50,
+0x38, 0x90, 0x9D, 0xE7, 0x12, 0x49, 0x30, 0x12, 0x1F, 0x96, 0x54, 0x01, 0xFE, 0x74, 0x36, 0x2F,
+0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x36, 0x2F, 0xF5, 0x82, 0xE4, 0x34,
+0x9D, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xD1, 0xB9, 0x80, 0x07, 0x90, 0x9D, 0xEA, 0xE0, 0xFF, 0xD1,
+0xAA, 0x90, 0x9D, 0xEA, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x22, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81,
+0x05, 0x12, 0x49, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05,
+0x12, 0x49, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12,
+0x1F, 0x96, 0xFF, 0x90, 0x9D, 0xB6, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF,
+0x64, 0x01, 0x60, 0x17, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x80, 0x0F, 0x90, 0x00, 0x01, 0x12,
+0x1F, 0xAF, 0x64, 0x01, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22,
+0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFF, 0x30, 0xE0, 0x26, 0x12, 0x1F, 0x96, 0x90, 0x9D, 0xC6,
+0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xC7, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3,
+0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xC9, 0xF0, 0x22,
+0x90, 0x9D, 0xC6, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28,
+0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9D, 0xFA,
+0x12, 0x49, 0x39, 0x90, 0x9D, 0x30, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A,
+0xEF, 0x14, 0xFF, 0x90, 0x9D, 0x31, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00,
+0xEF, 0x60, 0x09, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x73, 0x90, 0x9D, 0x31, 0xE0,
+0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x9A, 0xF9, 0x74, 0x9C, 0x35, 0xF0, 0xA8, 0x01, 0xFC, 0x7D, 0x01,
+0x90, 0x9D, 0xFA, 0x12, 0x49, 0x30, 0x7E, 0x00, 0x7F, 0x02, 0x12, 0x48, 0x79, 0x90, 0x9D, 0x31,
+0xE0, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x9C, 0xF9, 0x74, 0x9C, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0xC0,
+0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x9D, 0xFD, 0x12, 0x49, 0x30, 0x8B, 0x40, 0x8A, 0x41, 0x89,
+0x42, 0x90, 0x9D, 0xFA, 0x12, 0x49, 0x30, 0x12, 0x1F, 0x96, 0xFF, 0xC4, 0x54, 0x0F, 0xF5, 0x43,
+0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0x33, 0x90, 0x9D, 0x31, 0xE0, 0x04, 0xF0, 0xE0,
+0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x9D, 0x31, 0xF0, 0xD0,
+0xD0, 0x92, 0xAF, 0x22, 0x7F, 0x02, 0x90, 0x9D, 0xCA, 0xE0, 0xFE, 0xEF, 0xC3, 0x9E, 0x50, 0x10,
+0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x03, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xE6,
+0x7F, 0x01, 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, 0x22,
+0x90, 0x9D, 0xB9, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x49, 0xEF, 0x54,
+0x0F, 0x60, 0x3C, 0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0x11, 0x98,
+0xEF, 0x64, 0x01, 0x70, 0x32, 0xF5, 0x3B, 0x90, 0x9D, 0xC8, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5,
+0x3C, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x5B, 0x74, 0x05,
+0xF0, 0x90, 0x06, 0x92, 0x74, 0x01, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x11,
+0x98, 0xBF, 0x01, 0x03, 0x12, 0x5F, 0xC4, 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, 0x11, 0x98, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x54,
+0x90, 0x9D, 0xBD, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80,
+0x43, 0x90, 0x9D, 0xBB, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04,
+0xF0, 0x80, 0x31, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x25, 0x90,
+0x9D, 0xBD, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, 0x16, 0x90, 0x9D,
+0xB8, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x20, 0xF0, 0x80,
+0x03, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x9D, 0x36,
+0xE0, 0x64, 0x01, 0x70, 0x2A, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x24, 0x90, 0x01, 0x57, 0xE4, 0xF0,
+0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0xE4, 0xF5, 0x3B, 0x90, 0x9D, 0xC7, 0xE0, 0xF5, 0x3C, 0xE4,
+0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x12, 0x2B, 0xF0, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x22,
+0x90, 0x9D, 0x36, 0xE0, 0x64, 0x01, 0x70, 0x26, 0x90, 0x9D, 0xBA, 0xE0, 0x60, 0x20, 0x90, 0x01,
+0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFB, 0xF0,
+0x90, 0x9D, 0xBD, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, 0x5F, 0xC4, 0x22, 0xE4,
+0x90, 0x9E, 0xB0, 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, 0x9E, 0xB1, 0xE0,
+0x94, 0xE8, 0x90, 0x9E, 0xB0, 0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20,
+0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x32, 0x58, 0x90, 0x9E, 0xB0, 0xE4, 0x75,
+0xF0, 0x01, 0x12, 0x48, 0x9F, 0x80, 0xBF, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x31, 0x7F, 0x90,
+0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x12, 0x57, 0xA9, 0x31, 0xE3, 0xE4, 0x90, 0x9D,
+0xBC, 0xF0, 0x22, 0x31, 0x7F, 0x90, 0x00, 0x02, 0xE0, 0x54, 0xFE, 0xFD, 0x7F, 0x02, 0x12, 0x31,
+0xE4, 0x90, 0x00, 0x02, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x02, 0x12, 0x31, 0xE4, 0x90, 0x00, 0x02,
+0xE0, 0x54, 0xFE, 0xF0, 0x7F, 0xB4, 0x7E, 0x08, 0x12, 0x2C, 0xFF, 0xEF, 0x44, 0x40, 0xFF, 0xEC,
+0x90, 0x9E, 0xA4, 0x12, 0x20, 0xC0, 0x90, 0x9E, 0xA4, 0x12, 0x49, 0x18, 0x90, 0xAD, 0xBC, 0x12,
+0x20, 0xC0, 0x7F, 0xB4, 0x7E, 0x08, 0x12, 0x2E, 0x45, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3,
+0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x00, 0x10, 0xE0,
+0x44, 0x0C, 0xFD, 0x7F, 0x10, 0x12, 0x31, 0xE4, 0x90, 0x00, 0x72, 0xE0, 0x54, 0xF3, 0xFD, 0x7F,
+0x72, 0x12, 0x31, 0xE4, 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, 0xB4, 0x7E,
+0x08, 0x12, 0x2C, 0xFF, 0xEF, 0x54, 0xBF, 0xFF, 0xEC, 0x90, 0x9E, 0xA0, 0x12, 0x20, 0xC0, 0x90,
+0x9E, 0xA0, 0x12, 0x49, 0x18, 0x90, 0xAD, 0xBC, 0x12, 0x20, 0xC0, 0x7F, 0xB4, 0x7E, 0x08, 0x12,
+0x2E, 0x45, 0x90, 0x00, 0x02, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x9E, 0xBB, 0xEF, 0xF0, 0x51,
+0x3C, 0x90, 0x9E, 0xBB, 0xE0, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x9D, 0xBC, 0x74,
+0x04, 0xF0, 0x22, 0x51, 0x3C, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x22, 0x8F, 0x25, 0xE4, 0x90,
+0x9E, 0xB2, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01,
+0xEF, 0x65, 0x25, 0x60, 0x3E, 0xC3, 0x90, 0x9E, 0xB3, 0xE0, 0x94, 0x88, 0x90, 0x9E, 0xB2, 0xE0,
+0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x9E, 0xB2, 0xE4,
+0x75, 0xF0, 0x01, 0x12, 0x48, 0x9F, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0x58, 0xD3, 0x90, 0x9E,
+0xB3, 0xE0, 0x94, 0x32, 0x90, 0x9E, 0xB2, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0,
+0x30, 0xE0, 0xB2, 0x22, 0x71, 0x7C, 0x90, 0x00, 0x08, 0xE0, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12,
+0x31, 0xE4, 0xE4, 0xFF, 0x80, 0x96, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x71, 0x4F, 0x71,
+0x14, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x9D, 0xBC,
+0xE0, 0x70, 0x07, 0x71, 0x84, 0xBF, 0x01, 0x02, 0x71, 0x26, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90,
+0x9D, 0xC3, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x31, 0xE4, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD,
+0x7F, 0x08, 0x12, 0x31, 0xE4, 0x7F, 0x01, 0x51, 0xBC, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD,
+0x7F, 0x90, 0x12, 0x31, 0xE4, 0x7F, 0x14, 0x7E, 0x00, 0x02, 0x32, 0x58, 0x90, 0x00, 0x90, 0xE0,
+0x20, 0xE0, 0xF9, 0x22, 0x90, 0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0,
+0x80, 0x12, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80,
+0x03, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0xF5, 0x6D, 0x74,
+0x94, 0x25, 0x6B, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE5, 0x6D, 0xF0, 0x75, 0xF0, 0x09,
+0xE5, 0x6B, 0x90, 0x94, 0x96, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x6A, 0xE4, 0xFB, 0xAD, 0x6D, 0xAF,
+0x6B, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xEF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xF9, 0xEF,
+0x54, 0x07, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x01, 0x12, 0x49, 0x24, 0xE0, 0xFC, 0xEB,
+0x70, 0x1F, 0x74, 0x81, 0x29, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xFB, 0x74, 0x01,
+0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5B, 0xF0, 0x53, 0x04, 0x7F, 0x80,
+0x36, 0x74, 0x81, 0x29, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xFC, 0x74, 0x01, 0xA8,
+0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4C, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81,
+0x01, 0x12, 0x49, 0x24, 0xE0, 0x54, 0x07, 0xFC, 0xED, 0x90, 0x43, 0x71, 0x93, 0x33, 0x33, 0x33,
+0x54, 0xF8, 0x42, 0x04, 0x43, 0x04, 0x80, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x00, 0x12, 0x49,
+0x24, 0xED, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x01, 0x12, 0x49, 0x24, 0xEC, 0xF0, 0x75,
+0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x49, 0x24, 0xE0, 0x54, 0xFC, 0x45, 0x6A, 0xFE, 0x75,
+0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x49, 0x24, 0xEE, 0xF0, 0x7D, 0x01, 0x12, 0x76, 0x33,
+0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x6B, 0x90, 0x9E,
+0x92, 0xE0, 0x04, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x95, 0x12, 0x49, 0x24, 0xE0, 0x90,
+0x9E, 0x9D, 0xF0, 0x12, 0x49, 0x42, 0x6C, 0xD7, 0x00, 0x6C, 0xD7, 0x01, 0x6C, 0xD7, 0x02, 0x6C,
+0xD7, 0x03, 0x6C, 0xD7, 0x04, 0x6C, 0xD7, 0x05, 0x6C, 0xD7, 0x06, 0x6C, 0xD7, 0x07, 0x6C, 0xD7,
+0x08, 0x6D, 0x39, 0x09, 0x6D, 0x3F, 0x0A, 0x6D, 0x45, 0x0B, 0x6D, 0x4B, 0x0C, 0x6D, 0x51, 0x0D,
+0x6D, 0x57, 0x0E, 0x00, 0x00, 0x6D, 0x5F, 0xE4, 0xF5, 0x6C, 0x75, 0xF0, 0x08, 0xE5, 0x6B, 0x90,
+0x89, 0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x25, 0x6C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83,
+0xE0, 0xFF, 0x90, 0x9E, 0x9D, 0xE0, 0x75, 0xF0, 0x07, 0xA4, 0x24, 0x50, 0xF5, 0x82, 0xE4, 0x34,
+0x40, 0xF5, 0x83, 0xE5, 0x82, 0x25, 0x6C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE4, 0x93,
+0xFE, 0xEF, 0x5E, 0xFF, 0x90, 0x9E, 0x9F, 0xF0, 0x75, 0xF0, 0x08, 0xE5, 0x6B, 0x90, 0x89, 0x00,
+0x12, 0x49, 0x24, 0xE5, 0x82, 0x25, 0x6C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEF, 0xF0,
+0x05, 0x6C, 0xE5, 0x6C, 0xB4, 0x07, 0xA3, 0x80, 0x26, 0xAD, 0x6B, 0x7F, 0x44, 0x80, 0x1C, 0xAD,
+0x6B, 0x7F, 0x4C, 0x80, 0x16, 0xAD, 0x6B, 0x7F, 0x8C, 0x80, 0x10, 0xAD, 0x6B, 0x7F, 0x94, 0x80,
+0x0A, 0xAD, 0x6B, 0x7F, 0x9C, 0x80, 0x04, 0xAD, 0x6B, 0x7F, 0xA4, 0x7E, 0x04, 0xF1, 0xB4, 0x75,
+0xF0, 0x09, 0xE5, 0x6B, 0x90, 0x94, 0x99, 0x12, 0x49, 0x24, 0xE0, 0xFD, 0xE4, 0x90, 0x9E, 0x9B,
+0xF0, 0x7C, 0x06, 0x75, 0xF0, 0x08, 0xE5, 0x6B, 0x90, 0x89, 0x00, 0xBC, 0x06, 0x12, 0x12, 0x49,
+0x24, 0xE5, 0x82, 0x2C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x80, 0x0E,
+0x12, 0x49, 0x24, 0xE5, 0x82, 0x2C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x90, 0x9E,
+0x9E, 0xF0, 0x90, 0x9E, 0x9E, 0xE0, 0x60, 0x64, 0x75, 0x6C, 0x07, 0x74, 0x01, 0x7E, 0x00, 0xA8,
+0x6C, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x9E, 0x9E, 0xE0,
+0xFB, 0xEF, 0x5B, 0x60, 0x3E, 0xEC, 0x75, 0xF0, 0x08, 0xA4, 0x25, 0x6C, 0x90, 0x9E, 0x9B, 0xF0,
+0xBD, 0x01, 0x0C, 0xE0, 0xD3, 0x94, 0x0B, 0x40, 0x06, 0xE0, 0x24, 0x20, 0xF0, 0x80, 0x39, 0xBD,
+0x02, 0x0F, 0x90, 0x9E, 0x9B, 0xE0, 0xD3, 0x94, 0x1B, 0x40, 0x06, 0xE0, 0x24, 0x18, 0xF0, 0x80,
+0x27, 0xBD, 0x03, 0x24, 0x90, 0x9E, 0x9B, 0xE0, 0xD3, 0x94, 0x1B, 0x40, 0x1B, 0xE0, 0x24, 0x22,
+0xF0, 0x80, 0x15, 0x15, 0x6C, 0xE5, 0x6C, 0xC3, 0x94, 0x00, 0x50, 0x9F, 0xEC, 0x60, 0x09, 0x1C,
+0xEC, 0xC3, 0x94, 0x00, 0x40, 0x02, 0xA1, 0x73, 0xE4, 0x90, 0x9E, 0x9C, 0xF0, 0xFC, 0x75, 0xF0,
+0x08, 0xE5, 0x6B, 0x90, 0x89, 0x00, 0xBC, 0x06, 0x12, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2C, 0xF5,
+0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x80, 0x0E, 0x12, 0x49, 0x24, 0xE5, 0x82,
+0x2C, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x90, 0x9E, 0x9E, 0xF0, 0x90, 0x9E, 0x9E,
+0xE0, 0x60, 0x63, 0xE4, 0xF5, 0x6C, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x6C, 0x08, 0x80, 0x05, 0xC3,
+0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x9E, 0x9E, 0xE0, 0xFB, 0xEF, 0x5B, 0x60, 0x3E,
+0xEC, 0x75, 0xF0, 0x08, 0xA4, 0x25, 0x6C, 0x90, 0x9E, 0x9C, 0xF0, 0xBD, 0x01, 0x0C, 0xE0, 0xD3,
+0x94, 0x0B, 0x40, 0x06, 0xE0, 0x24, 0x20, 0xF0, 0x80, 0x34, 0xBD, 0x02, 0x0F, 0x90, 0x9E, 0x9C,
+0xE0, 0xD3, 0x94, 0x1B, 0x40, 0x06, 0xE0, 0x24, 0x18, 0xF0, 0x80, 0x22, 0xBD, 0x03, 0x1F, 0x90,
+0x9E, 0x9C, 0xE0, 0xD3, 0x94, 0x1B, 0x40, 0x16, 0xE0, 0x24, 0x22, 0xF0, 0x80, 0x10, 0x05, 0x6C,
+0xE5, 0x6C, 0x64, 0x08, 0x70, 0xA0, 0x0C, 0xEC, 0x64, 0x07, 0x60, 0x02, 0xC1, 0x1E, 0x90, 0x9E,
+0x9B, 0xE0, 0xFF, 0x75, 0xF0, 0x09, 0xE5, 0x6B, 0x90, 0x94, 0x93, 0x12, 0x49, 0x24, 0xEF, 0xF0,
+0x90, 0x9E, 0x9C, 0xE0, 0xFE, 0x75, 0xF0, 0x09, 0xE5, 0x6B, 0x90, 0x94, 0x94, 0x12, 0x49, 0x24,
+0xEE, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x6B, 0x90, 0x81, 0x00, 0x12, 0x49, 0x24, 0xE0, 0xFE, 0x54,
+0x7F, 0xF5, 0x6D, 0xEE, 0x54, 0x80, 0xF5, 0x6E, 0xE5, 0x6D, 0xD3, 0x9F, 0x40, 0x08, 0x90, 0x9E,
+0x9B, 0xE0, 0x45, 0x6E, 0x71, 0xAD, 0x90, 0x9E, 0x9C, 0xE0, 0xFF, 0xE5, 0x6D, 0xC3, 0x9F, 0x50,
+0x05, 0xE5, 0x6E, 0x4F, 0x71, 0xAD, 0x75, 0xF0, 0x10, 0xE5, 0x6B, 0x90, 0x81, 0x03, 0x12, 0x49,
+0x24, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8F, 0x53, 0x90, 0x01, 0xC4, 0x74, 0x28, 0xF0,
+0x74, 0x6F, 0xA3, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x53, 0x90, 0x81, 0x05, 0x12, 0x49, 0x24, 0xE0,
+0x54, 0x03, 0xFD, 0x75, 0xF0, 0x09, 0xE5, 0x53, 0x90, 0x94, 0x93, 0x12, 0x49, 0x24, 0xE0, 0xFF,
+0x74, 0x14, 0x25, 0x53, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0x54, 0x7F, 0xF5, 0x54,
+0xD3, 0x9F, 0x40, 0x02, 0x8F, 0x54, 0xE5, 0x54, 0x25, 0xE0, 0x24, 0xBD, 0xF5, 0x82, 0xE4, 0x34,
+0x42, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01, 0x93, 0xFF, 0xE5, 0x54, 0x25, 0xE0, 0x24, 0x15,
+0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0x74, 0x01, 0x93, 0x2F, 0xFF, 0xE4, 0x93, 0x3E, 0xC3,
+0x13, 0xFE, 0xEF, 0x13, 0xFF, 0xE5, 0x53, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93,
+0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x8D, 0x6A, 0xE4, 0xFB, 0xAD, 0x54, 0xAF, 0x53, 0x71,
+0xD1, 0xAF, 0x54, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8E, 0x5D, 0x8F, 0x5E, 0x7F,
+0x08, 0x78, 0x5F, 0xE4, 0xF6, 0x08, 0xDF, 0xFC, 0x75, 0xF0, 0x09, 0xED, 0x90, 0x94, 0x99, 0x12,
+0x49, 0x24, 0xE0, 0x90, 0x9E, 0xB6, 0xF0, 0x64, 0x01, 0x70, 0x43, 0x75, 0xF0, 0x08, 0xED, 0x90,
+0x89, 0x00, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x5F, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x01, 0x12,
+0x49, 0x24, 0xE0, 0xFE, 0x54, 0x0F, 0xF5, 0x60, 0xE4, 0xF5, 0x61, 0xF5, 0x62, 0xF5, 0x63, 0xEE,
+0x54, 0xF0, 0xF5, 0x64, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x02, 0x12, 0x49, 0x24, 0xE0, 0xF5,
+0x65, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x03, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x66, 0x90, 0x9E,
+0xB6, 0xE0, 0xFE, 0xC3, 0x94, 0x02, 0x40, 0x4A, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x00, 0x12,
+0x49, 0x24, 0xE0, 0xF5, 0x5F, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x01, 0x12, 0x49, 0x24, 0xE0,
+0xF5, 0x60, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x02, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x61, 0x75,
+0xF0, 0x08, 0xED, 0x90, 0x89, 0x03, 0x12, 0x49, 0x24, 0xE0, 0xFC, 0x54, 0x0F, 0xF5, 0x62, 0xEC,
+0x54, 0xF0, 0xF9, 0xEE, 0xB4, 0x03, 0x09, 0xE9, 0x25, 0xE0, 0x25, 0xE0, 0xF5, 0x66, 0x80, 0x02,
+0x89, 0x65, 0xE4, 0xFF, 0x74, 0x5F, 0x2F, 0xF8, 0xE6, 0xFE, 0xEF, 0x7A, 0x00, 0x25, 0x5E, 0xFB,
+0xEA, 0x35, 0x5D, 0x8B, 0x82, 0xF5, 0x83, 0xE0, 0x5E, 0xF6, 0x0F, 0xBF, 0x08, 0xE6, 0xE5, 0x64,
+0xC4, 0x54, 0x0F, 0x70, 0x08, 0xE5, 0x65, 0x70, 0x04, 0xE5, 0x66, 0x60, 0x24, 0x90, 0x9E, 0xB6,
+0xE0, 0xB4, 0x01, 0x1D, 0xE5, 0x60, 0x54, 0x0F, 0xF9, 0xE5, 0x64, 0x54, 0xF0, 0x42, 0x01, 0x89,
+0x60, 0x85, 0x65, 0x61, 0x85, 0x66, 0x62, 0xE4, 0xF5, 0x63, 0xF5, 0x64, 0xF5, 0x65, 0x75, 0x66,
+0x80, 0x90, 0x9E, 0xB6, 0xE0, 0xFE, 0xC3, 0x94, 0x02, 0x40, 0x15, 0xEE, 0xB4, 0x02, 0x06, 0xE5,
+0x65, 0x42, 0x62, 0x80, 0x08, 0xE5, 0x66, 0x13, 0x13, 0x54, 0x3F, 0x42, 0x62, 0x75, 0x66, 0x80,
+0xE4, 0xFF, 0x74, 0x5F, 0x2F, 0xF8, 0xE6, 0xFE, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x00, 0x12,
+0x49, 0x24, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xBF,
+0x08, 0xE0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8F, 0x5B, 0x90, 0x01, 0xC4, 0x74, 0x07, 0xF0, 0x74,
+0x71, 0xA3, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x5B, 0x90, 0x81, 0x00, 0x12, 0x49, 0x24, 0xE0, 0xF5,
+0x5C, 0x54, 0x7F, 0xFD, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x93, 0x12, 0x49, 0x24, 0xE0,
+0xFF, 0x90, 0x9D, 0xFF, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x99, 0x12, 0x49, 0x24,
+0xE0, 0x90, 0x9E, 0x00, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5,
+0x83, 0xE4, 0x93, 0xFA, 0x74, 0x01, 0x93, 0xFB, 0xE5, 0x5B, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82,
+0xE4, 0x34, 0x93, 0xF5, 0x83, 0xEA, 0xF0, 0xA3, 0xEB, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90,
+0x94, 0x96, 0x12, 0x49, 0x24, 0xE0, 0xF9, 0xED, 0xC3, 0x9F, 0x40, 0x02, 0x41, 0x9C, 0x74, 0x14,
+0x25, 0x5B, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xED, 0xF0, 0x90, 0x9E, 0x00, 0xE0, 0xFF,
+0xB4, 0x01, 0x0C, 0xED, 0xC3, 0x94, 0x2C, 0x40, 0x06, 0x74, 0xE0, 0x2D, 0xFD, 0x80, 0x1E, 0xEF,
+0xB4, 0x02, 0x0C, 0xED, 0xC3, 0x94, 0x2C, 0x40, 0x06, 0x74, 0xE8, 0x2D, 0xFD, 0x80, 0x0E, 0xEF,
+0xB4, 0x03, 0x0A, 0xED, 0xC3, 0x94, 0x2C, 0x40, 0x04, 0x74, 0xDE, 0x2D, 0xFD, 0xEF, 0xB4, 0x01,
+0x0F, 0x90, 0x9D, 0xFF, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x06, 0xE0, 0x24, 0xE0, 0xF0, 0x80, 0x2A,
+0x90, 0x9E, 0x00, 0xE0, 0xB4, 0x02, 0x0F, 0x90, 0x9D, 0xFF, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x06,
+0xE0, 0x24, 0xE8, 0xF0, 0x80, 0x14, 0x90, 0x9E, 0x00, 0xE0, 0xB4, 0x03, 0x0D, 0x90, 0x9D, 0xFF,
+0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x04, 0xE0, 0x24, 0xDE, 0xF0, 0xED, 0x04, 0xFC, 0x90, 0x9D, 0xFF,
+0xE0, 0xFF, 0xEC, 0xD3, 0x9F, 0x50, 0x46, 0xEC, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0,
+0x08, 0xE5, 0x5B, 0x90, 0x89, 0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35,
+0x83, 0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xEC, 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, 0x06, 0xAD, 0x04, 0x8D, 0x5C, 0x80, 0x03, 0x0C, 0x80, 0xB0, 0x90, 0x9E, 0x00,
+0xE0, 0xFF, 0xB4, 0x01, 0x19, 0xE5, 0x5C, 0xD3, 0x94, 0x0B, 0x40, 0x12, 0xE5, 0x5C, 0x94, 0x34,
+0x50, 0x0C, 0x74, 0x20, 0x25, 0x5C, 0xF5, 0x5C, 0x74, 0x20, 0x2D, 0xFD, 0x80, 0x61, 0xEF, 0xB4,
+0x02, 0x13, 0xE5, 0x5C, 0xD3, 0x94, 0x1B, 0x40, 0x0C, 0x74, 0x18, 0x25, 0x5C, 0xF5, 0x5C, 0x74,
+0x18, 0x2D, 0xFD, 0x80, 0x4A, 0xEF, 0xB4, 0x03, 0x11, 0xE5, 0x5C, 0xD3, 0x94, 0x1B, 0x40, 0x3F,
+0x74, 0x22, 0x25, 0x5C, 0xF5, 0x5C, 0x74, 0x22, 0x2D, 0xFD, 0x80, 0x33, 0x90, 0x9D, 0xFF, 0xE0,
+0xFC, 0x6D, 0x70, 0x6C, 0x74, 0x14, 0x25, 0x5B, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xED,
+0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x97, 0x12, 0x49, 0x24, 0xE0, 0xB4, 0x01, 0x0C,
+0xE5, 0x5C, 0x20, 0xE7, 0x07, 0xED, 0x44, 0x80, 0xF5, 0x5C, 0x80, 0x03, 0xAF, 0x5C, 0x22, 0xED,
+0x25, 0xE0, 0x24, 0xBD, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01,
+0x93, 0xFF, 0xED, 0x25, 0xE0, 0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0x74, 0x01,
+0x93, 0x2F, 0xFF, 0xE4, 0x93, 0x3E, 0xC3, 0x13, 0xFE, 0xEF, 0x13, 0xFF, 0xE5, 0x5B, 0x25, 0xE0,
+0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x80, 0x5D,
+0xED, 0xD3, 0x9C, 0x40, 0x58, 0x90, 0x9D, 0xFF, 0xE0, 0xFF, 0x74, 0x14, 0x25, 0x5B, 0xF5, 0x82,
+0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xEF, 0xF0, 0xAD, 0x07, 0x8F, 0x5C, 0xED, 0x25, 0xE0, 0x24, 0xBD,
+0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01, 0x93, 0xFF, 0xED, 0x25,
+0xE0, 0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0x74, 0x01, 0x93, 0x2F, 0xFF, 0xE4,
+0x93, 0x3E, 0xC3, 0x13, 0xFE, 0xEF, 0x13, 0xFF, 0xE5, 0x5B, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82,
+0xE4, 0x34, 0x93, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xAF, 0x5C, 0x22, 0x89, 0x6A, 0x7B,
+0x01, 0xAD, 0x5C, 0xAF, 0x5B, 0x12, 0x6B, 0xD1, 0xAF, 0x5C, 0x22, 0x90, 0x01, 0xC4, 0x74, 0x7B,
+0xF0, 0x74, 0x73, 0xA3, 0xF0, 0xE4, 0xF5, 0x52, 0x90, 0x9D, 0x36, 0xE0, 0x70, 0x02, 0xC1, 0x27,
+0x75, 0xF0, 0x09, 0xE5, 0x52, 0x90, 0x94, 0x98, 0x12, 0x49, 0x24, 0xE0, 0x64, 0x01, 0x60, 0x02,
+0xC1, 0x27, 0xE5, 0x52, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE0,
+0xFE, 0xA3, 0xE0, 0xD3, 0x94, 0x00, 0xEE, 0x94, 0x00, 0x50, 0x02, 0xC1, 0x27, 0xE5, 0x52, 0x75,
+0xF0, 0x0A, 0xA4, 0x24, 0x01, 0xF9, 0x74, 0x8D, 0x35, 0xF0, 0x75, 0x56, 0x01, 0xF5, 0x57, 0x89,
+0x58, 0xE5, 0x52, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE0, 0xFF,
+0xA3, 0xE0, 0x90, 0x9D, 0xF9, 0xCF, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x93, 0x25, 0x52, 0xF5, 0x82,
+0xE4, 0x34, 0x99, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x9D, 0xFB, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x75,
+0xF0, 0x10, 0xE5, 0x52, 0x90, 0x81, 0x00, 0x12, 0x49, 0x24, 0xE0, 0x54, 0x7F, 0x90, 0x9D, 0xF7,
+0xF0, 0x54, 0x7F, 0xA3, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x52, 0x90, 0x94, 0x93, 0x12, 0x49, 0x24,
+0xE0, 0x90, 0x9D, 0xFE, 0xF0, 0x74, 0x14, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83,
+0xE0, 0xC3, 0x94, 0x05, 0x40, 0x02, 0xC1, 0x21, 0x90, 0x9D, 0xFE, 0xE0, 0xFF, 0x90, 0x9D, 0xF8,
+0xE0, 0x9F, 0x40, 0x13, 0x90, 0x9D, 0xFE, 0xE0, 0x90, 0x9D, 0xF8, 0xF0, 0x90, 0x9D, 0xF7, 0xE0,
+0x54, 0x80, 0xFE, 0xF0, 0xEF, 0x4E, 0xF0, 0x90, 0x9D, 0xF8, 0xE0, 0xFF, 0x90, 0x41, 0xC1, 0x93,
+0xFE, 0x74, 0x13, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xE0, 0xC3, 0x9E, 0x40,
+0x06, 0xEF, 0x90, 0x41, 0x19, 0x80, 0x07, 0x90, 0x9D, 0xF8, 0xE0, 0x90, 0x41, 0x6D, 0x93, 0x90,
+0x9D, 0xFD, 0xF0, 0x90, 0x9D, 0xFD, 0xE0, 0x75, 0xF0, 0x06, 0xA4, 0x24, 0x8F, 0xF9, 0x74, 0x40,
+0x35, 0xF0, 0x75, 0x53, 0xFF, 0xF5, 0x54, 0x89, 0x55, 0x90, 0x9D, 0xF7, 0xE0, 0x90, 0x43, 0xC5,
+0x93, 0xFF, 0xD3, 0x90, 0x9D, 0xFC, 0xE0, 0x9F, 0x90, 0x9D, 0xFB, 0xE0, 0x94, 0x00, 0x40, 0x02,
+0xC1, 0x1B, 0xE5, 0x52, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0,
+0xF5, 0x59, 0xA3, 0xE0, 0xF5, 0x5A, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x12, 0x1F, 0x96, 0xFF,
+0x7E, 0x00, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x12, 0x48, 0xB5, 0xFD, 0xAC, 0xF0, 0x12, 0x20,
+0x10, 0xEF, 0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xAB, 0x53, 0xAA, 0x54, 0xA9,
+0x55, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0xFF, 0x7E, 0x00, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58,
+0x90, 0x00, 0x02, 0x12, 0x48, 0xE0, 0xFD, 0xAC, 0xF0, 0x12, 0x20, 0x10, 0xEF, 0x25, 0x5A, 0xF5,
+0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x90, 0x00, 0x02, 0x12,
+0x1F, 0xAF, 0xFF, 0x7E, 0x00, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x90, 0x00, 0x04, 0x12, 0x48,
+0xE0, 0xFD, 0xAC, 0xF0, 0x12, 0x20, 0x10, 0xEF, 0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5,
+0x59, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xAF, 0xFF, 0x7E, 0x00,
+0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x90, 0x00, 0x06, 0x12, 0x48, 0xE0, 0xFD, 0xAC, 0xF0, 0x12,
+0x20, 0x10, 0xEF, 0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xAB, 0x53, 0xAA, 0x54,
+0xA9, 0x55, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xAF, 0xFF, 0x7E, 0x00, 0xAB, 0x56, 0xAA, 0x57, 0xA9,
+0x58, 0x90, 0x00, 0x08, 0x12, 0x48, 0xE0, 0xFD, 0xAC, 0xF0, 0x12, 0x20, 0x10, 0xEF, 0x25, 0x5A,
+0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x90, 0x00, 0x05,
+0x12, 0x1F, 0xAF, 0xFF, 0x7E, 0x00, 0x90, 0x9D, 0xF9, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0x12, 0x20,
+0x10, 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, 0x52, 0x25, 0xE0, 0x24,
+0x91, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE5, 0x59, 0xF0, 0xA3, 0xE5, 0x5A, 0xF0, 0x90,
+0x9D, 0xF7, 0xE0, 0x25, 0xE0, 0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0xC3, 0x74,
+0x01, 0x93, 0x95, 0x5A, 0xE4, 0x93, 0x95, 0x59, 0x50, 0x06, 0xAF, 0x52, 0x31, 0x07, 0x80, 0x21,
+0x90, 0x9D, 0xF7, 0xE0, 0x25, 0xE0, 0x24, 0xBD, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0xD3,
+0x74, 0x01, 0x93, 0x95, 0x5A, 0xE4, 0x93, 0x95, 0x59, 0x40, 0x06, 0x7D, 0x01, 0xAF, 0x52, 0xD1,
+0xC5, 0xE4, 0xFD, 0xAF, 0x52, 0xD1, 0x33, 0x05, 0x52, 0xE5, 0x52, 0xC3, 0x94, 0x80, 0x50, 0x02,
+0x61, 0x88, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xED, 0x60, 0x62, 0x75, 0xF0, 0x0A,
+0xEF, 0x90, 0x8D, 0x01, 0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90,
+0x8D, 0x03, 0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x05,
+0x12, 0x49, 0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x07, 0x12, 0x49,
+0x24, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x09, 0x12, 0x49, 0x24, 0xE4,
+0xF0, 0xA3, 0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE4,
+0xF0, 0xA3, 0xF0, 0x74, 0x93, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x99, 0xF5, 0x83, 0xE4, 0xF0, 0x75,
+0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x49, 0x24, 0xE0, 0x54, 0xBF, 0x90, 0x9E, 0xB7, 0xF0,
+0x44, 0x80, 0xFE, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x49, 0x24, 0xEE, 0xF0,
+0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8F, 0x5B, 0x90, 0x01, 0xC4, 0x74, 0xC5, 0xF0, 0x74, 0x76, 0xA3,
+0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x5B, 0x90, 0x81, 0x00, 0x12, 0x49, 0x24, 0xE0, 0xF5, 0x5C, 0x54,
+0x7F, 0xFF, 0x90, 0x9E, 0x01, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x94, 0x12, 0x49,
+0x24, 0xE0, 0x90, 0x9E, 0x03, 0xF0, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x93, 0x12, 0x49,
+0x24, 0xE0, 0xFE, 0x90, 0x9E, 0x04, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x5B, 0x90, 0x81, 0x05, 0x12,
+0x49, 0x24, 0xE0, 0x54, 0x03, 0xFC, 0x75, 0xF0, 0x09, 0xE5, 0x5B, 0x90, 0x94, 0x99, 0x12, 0x49,
+0x24, 0xE0, 0xFB, 0xEF, 0xD3, 0x9E, 0x40, 0x0A, 0x90, 0x9E, 0x04, 0xE0, 0x90, 0x9E, 0x01, 0xF0,
+0xF5, 0x5C, 0xED, 0x70, 0x03, 0x02, 0x78, 0xC8, 0x90, 0x9E, 0x02, 0xED, 0xF0, 0xE5, 0x5C, 0x30,
+0xE7, 0x0A, 0x90, 0x9E, 0x01, 0xE0, 0xF5, 0x5C, 0xA3, 0xE0, 0x14, 0xF0, 0x90, 0x9E, 0x02, 0xE0,
+0x70, 0x03, 0x02, 0x78, 0xC8, 0x90, 0x9E, 0x01, 0xE0, 0xFF, 0xB4, 0x2C, 0x08, 0xEC, 0x60, 0x05,
+0x1C, 0xA3, 0xE0, 0x14, 0xF0, 0x90, 0x9E, 0x02, 0xE0, 0x70, 0x03, 0x02, 0x78, 0xC8, 0x90, 0x9E,
+0x03, 0xE0, 0xFE, 0xEF, 0xD3, 0x9E, 0x50, 0x03, 0x02, 0x78, 0xC2, 0xE4, 0x90, 0x9E, 0x00, 0xF0,
+0xBB, 0x01, 0x0F, 0xA3, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x08, 0xE0, 0x24, 0xE0, 0xF0, 0x74, 0xE0,
+0x80, 0x26, 0xBB, 0x02, 0x11, 0x90, 0x9E, 0x01, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x08, 0xE0, 0x24,
+0xE8, 0xF0, 0x74, 0xE8, 0x80, 0x12, 0xBB, 0x03, 0x13, 0x90, 0x9E, 0x01, 0xE0, 0xC3, 0x94, 0x2C,
+0x40, 0x0A, 0xE0, 0x24, 0xDE, 0xF0, 0x74, 0xDE, 0x25, 0x5C, 0xF5, 0x5C, 0xBB, 0x01, 0x0F, 0xEE,
+0xC3, 0x94, 0x2C, 0x40, 0x09, 0x90, 0x9E, 0x03, 0xE0, 0x24, 0xE0, 0xF0, 0x80, 0x22, 0xBB, 0x02,
+0x0F, 0x90, 0x9E, 0x03, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x06, 0xE0, 0x24, 0xE8, 0xF0, 0x80, 0x10,
+0xBB, 0x03, 0x0D, 0x90, 0x9E, 0x03, 0xE0, 0xC3, 0x94, 0x2C, 0x40, 0x04, 0xE0, 0x24, 0xDE, 0xF0,
+0x90, 0x9E, 0x01, 0xE0, 0x14, 0x90, 0x9D, 0xFF, 0xF0, 0x90, 0x9E, 0x03, 0xE0, 0xFF, 0x90, 0x9D,
+0xFF, 0xE0, 0xF9, 0xC3, 0x9F, 0x40, 0x6A, 0xE9, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0,
+0x08, 0xE5, 0x5B, 0x90, 0x89, 0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35,
+0x83, 0xF5, 0x83, 0xE0, 0xF5, 0x82, 0x75, 0x83, 0x00, 0xE9, 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, 0x29, 0x90, 0x9D, 0xFF, 0xE0, 0xF5, 0x5C, 0xA3, 0xE0,
+0x04, 0xF0, 0x90, 0x9E, 0x02, 0xE0, 0xFF, 0x90, 0x9E, 0x00, 0xE0, 0x6F, 0x60, 0x13, 0x90, 0x9E,
+0x03, 0xE0, 0xFF, 0xE5, 0x5C, 0xD3, 0x9F, 0x40, 0x08, 0x90, 0x9D, 0xFF, 0xE0, 0x14, 0xF0, 0x80,
+0x88, 0xBB, 0x01, 0x1C, 0xE5, 0x5C, 0xD3, 0x94, 0x0B, 0x40, 0x15, 0xE5, 0x5C, 0x94, 0x34, 0x50,
+0x0F, 0x74, 0x20, 0x25, 0x5C, 0xF5, 0x5C, 0x90, 0x9E, 0x01, 0xE0, 0x24, 0x20, 0xF0, 0x80, 0x38,
+0xBB, 0x02, 0x16, 0xE5, 0x5C, 0xD3, 0x94, 0x1B, 0x40, 0x0F, 0x74, 0x18, 0x25, 0x5C, 0xF5, 0x5C,
+0x90, 0x9E, 0x01, 0xE0, 0x24, 0x18, 0xF0, 0x80, 0x1F, 0xBB, 0x03, 0x1C, 0xE5, 0x5C, 0xD3, 0x94,
+0x1B, 0x40, 0x15, 0x74, 0x22, 0x25, 0x5C, 0xF5, 0x5C, 0x90, 0x9E, 0x01, 0xE0, 0x24, 0x22, 0xF0,
+0x80, 0x06, 0x90, 0x9E, 0x03, 0xE0, 0xF5, 0x5C, 0xE5, 0x5C, 0x25, 0xE0, 0x24, 0xBD, 0xF5, 0x82,
+0xE4, 0x34, 0x42, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01, 0x93, 0xFF, 0xE5, 0x5C, 0x25, 0xE0,
+0x24, 0x15, 0xF5, 0x82, 0xE4, 0x34, 0x42, 0xF5, 0x83, 0x74, 0x01, 0x93, 0x2F, 0xFF, 0xE4, 0x93,
+0x3E, 0xC3, 0x13, 0xFE, 0xEF, 0x13, 0xFF, 0xE5, 0x5B, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4,
+0x34, 0x93, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x8C, 0x6A, 0xE4, 0xFB, 0xAD, 0x5C, 0xAF,
+0x5B, 0x12, 0x6B, 0xD1, 0xAF, 0x5C, 0x22, 0x12, 0x1F, 0x96, 0x54, 0x3F, 0xFF, 0x90, 0x00, 0x01,
+0x12, 0x1F, 0xAF, 0xFE, 0x54, 0x1F, 0xFD, 0xEE, 0x54, 0x80, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01,
+0x90, 0x9D, 0xE7, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFE, 0x54, 0x03, 0x90, 0x9D, 0xE8,
+0xF0, 0xEE, 0x54, 0x30, 0xC4, 0x54, 0x0F, 0x90, 0x9D, 0xEA, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F,
+0xAF, 0xFE, 0x54, 0x40, 0xFC, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x90, 0x9D, 0xE9, 0xF0, 0xEE, 0x54,
+0x80, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFE, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x95, 0x12,
+0x49, 0x24, 0xED, 0xF0, 0x90, 0x9D, 0xE8, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x96,
+0x12, 0x49, 0x24, 0xED, 0xF0, 0x90, 0x9D, 0xE7, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94,
+0x97, 0x12, 0x49, 0x24, 0xED, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x98, 0x12, 0x49, 0x24,
+0x74, 0x01, 0xF0, 0x90, 0x9D, 0xEA, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x99, 0x12,
+0x49, 0x24, 0xED, 0xF0, 0x90, 0x9D, 0xE9, 0xE0, 0xFD, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x9A,
+0x12, 0x49, 0x24, 0xED, 0xF0, 0x75, 0xF0, 0x09, 0xEF, 0x90, 0x94, 0x9B, 0x12, 0x49, 0x24, 0xEE,
+0xF0, 0xE4, 0xFE, 0xEE, 0xF5, 0x82, 0x75, 0x83, 0x00, 0xA3, 0xA3, 0xA3, 0x12, 0x1F, 0xAF, 0xFD,
+0x75, 0xF0, 0x08, 0xEF, 0x90, 0x89, 0x00, 0x12, 0x49, 0x24, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4,
+0x35, 0x83, 0xF5, 0x83, 0xED, 0xF0, 0x0E, 0xEE, 0xB4, 0x04, 0xD8, 0x02, 0x6C, 0x85, 0x12, 0x1F,
+0x96, 0xF5, 0x51, 0xC3, 0x94, 0x80, 0x50, 0x15, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0xFF, 0x74,
+0x13, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xEF, 0xF0, 0x22, 0xE5, 0x51, 0xB4,
+0x80, 0x0A, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xAF, 0x90, 0x94, 0x91, 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, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE5, 0x30, 0x90, 0x00, 0x8E, 0xE0,
+0x64, 0x05, 0x70, 0x28, 0xA3, 0xE0, 0x90, 0x9D, 0xD6, 0xF0, 0x90, 0x00, 0x8E, 0xE0, 0xFF, 0x90,
+0x9D, 0xD6, 0xE0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x00,
+0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8E, 0x12, 0x31, 0xE4, 0x22, 0x12, 0x1F, 0x96,
+0xFF, 0x54, 0x01, 0xFE, 0x90, 0x9D, 0xCB, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30,
+0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xCC, 0xF0, 0x22, 0x12, 0x1F, 0x96,
+0xFF, 0x54, 0x01, 0xFE, 0x90, 0x9D, 0xCE, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30,
+0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xAF, 0x90, 0x9D, 0xCF, 0xF0, 0x90, 0x00, 0x02, 0x12,
+0x1F, 0xAF, 0x90, 0x9D, 0xD0, 0xF0, 0x22, 0x90, 0x9D, 0xB7, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90,
+0x9D, 0xC2, 0xF0, 0x90, 0x9D, 0xBD, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0C, 0x04, 0x70, 0x28,
+0x90, 0x9D, 0xBF, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, 0x90, 0x9D, 0xC9, 0xE0,
+0x90, 0x9D, 0xBF, 0xF0, 0x80, 0x05, 0x90, 0x9D, 0xBF, 0xED, 0xF0, 0x90, 0x9D, 0xBF, 0xE0, 0xA3,
+0xF0, 0x90, 0x9D, 0xB8, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0,
+0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x9D, 0xB8, 0xE0,
+0xC3, 0x13, 0x20, 0xE0, 0x08, 0x90, 0x9D, 0xBC, 0x74, 0x0C, 0xF0, 0x80, 0x11, 0x90, 0x06, 0x04,
+0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x04, 0xF0, 0x90, 0x05,
+0x22, 0xE4, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF,
+0xF0, 0x90, 0x9D, 0xBC, 0x74, 0x06, 0xF0, 0x22, 0x47, 0xF8,
+};
+u4Byte ArrayLength_MP_8188E_FW_AP = 15226;
+
+
+void
+ODM_ReadFirmware_MP_8188E_FW_AP(
+ IN PDM_ODM_T pDM_Odm,
+ OUT u1Byte *pFirmware,
+ OUT u4Byte *pFirmwareSize
+)
+{
+ ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_AP, ArrayLength_MP_8188E_FW_AP);
+ *pFirmwareSize = ArrayLength_MP_8188E_FW_AP;
+}
+
+
+#else
+
+
+u1Byte Array_MP_8188E_FW_NIC_S[] = {
+0xE2, 0x88, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x10, 0x14, 0xF6, 0x3D, 0x02, 0x00,
+0xCD, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x02, 0x4B, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x02, 0x4C, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x4B, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x50, 0x15, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x48, 0x04, 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, 0x89, 0xF8, 0xE6, 0xBC, 0x03, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00,
+0x40, 0xCE, 0x79, 0x04, 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, 0x04, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30,
+0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x88, 0x25, 0x0C, 0xF8,
+0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8,
+0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5,
+0x0C, 0x24, 0x89, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD,
+0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x88,
+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, 0x88, 0xA6,
+0x81, 0x74, 0x03, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x04, 0xE4, 0x78, 0x80,
+0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x4B, 0xDE, 0x74, 0x01, 0x93,
+0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2,
+0x8C, 0xD2, 0xAF, 0x22, 0x03, 0xEF, 0xD3, 0x94, 0x03, 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, 0x88, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18,
+0xBE, 0x03, 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, 0x88, 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, 0x88, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F,
+0x04, 0x90, 0x4B, 0xDE, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3,
+0x94, 0x03, 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, 0x88, 0x2F,
+0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x48, 0x4D, 0x50, 0x2E, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xBF, 0x03,
+0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x88, 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, 0x89, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01,
+0x0F, 0x74, 0x88, 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, 0x03, 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, 0x48, 0x4C, 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, 0x48, 0x4D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF,
+0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0,
+0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 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, 0xE2, 0xFC, 0x08, 0xE2, 0xFD, 0x08, 0xE2, 0xFE, 0x08, 0xE2, 0xFF,
+0x22, 0xE2, 0xFB, 0x08, 0xE2, 0xF9, 0x08, 0xE2, 0xFA, 0x08, 0xE2, 0xCB, 0xF8, 0x22, 0xEC, 0xF2,
+0x08, 0xED, 0xF2, 0x08, 0xEE, 0xF2, 0x08, 0xEF, 0xF2, 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, 0x4B,
+0x8C, 0x02, 0x48, 0xDD, 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, 0x4B, 0xD1, 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, 0x00, 0x41, 0x82, 0x12, 0x00, 0x41, 0x82, 0x13, 0x00, 0x41, 0x82, 0x1F, 0x00, 0x58, 0xF0,
+0x5F, 0xDD, 0x69, 0x7E, 0x6A, 0xC2, 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, 0x90, 0x01, 0xC4, 0x74, 0xE6, 0xF0, 0x74, 0x4B, 0xA3, 0xF0, 0x91, 0x35, 0x74,
+0xE6, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x4B, 0xA3, 0xF0, 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, 0x00, 0x54, 0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55,
+0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5, 0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD,
+0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F,
+0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57, 0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 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, 0x90, 0x01, 0xC4, 0x74,
+0x6F, 0xF0, 0x74, 0x4C, 0xA3, 0xF0, 0x12, 0x72, 0x41, 0xE5, 0x41, 0x30, 0xE4, 0x04, 0x7F, 0x02,
+0x51, 0x27, 0xE5, 0x41, 0x30, 0xE6, 0x02, 0xF1, 0xEF, 0xE5, 0x43, 0x30, 0xE0, 0x03, 0x12, 0x72,
+0x9E, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x54, 0x43, 0xE5, 0x43, 0x30, 0xE2, 0x03, 0x12, 0x53,
+0xF7, 0xE5, 0x43, 0x30, 0xE3, 0x03, 0x12, 0x6F, 0xB0, 0xE5, 0x43, 0x30, 0xE4, 0x03, 0x12, 0x74,
+0xA9, 0xE5, 0x43, 0x30, 0xE5, 0x03, 0x12, 0x6F, 0x58, 0xE5, 0x43, 0x30, 0xE6, 0x02, 0xB1, 0x0E,
+0xE5, 0x44, 0x30, 0xE1, 0x03, 0x12, 0x74, 0xD8, 0x74, 0x6F, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74,
+0x4C, 0xA3, 0xF0, 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, 0x80,
+0xDE, 0xE0, 0xB4, 0x01, 0x13, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0D, 0x90, 0x81, 0x2B, 0xE0, 0x54,
+0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, 0xB1, 0x29, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x90, 0x81, 0x29,
+0x30, 0xE0, 0x04, 0xE0, 0xFF, 0xE1, 0x6E, 0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x04, 0xE4, 0xFD, 0x7F,
+0x0C, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x1D, 0xED, 0xF0, 0x90, 0x81, 0x24,
+0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0xC1, 0x8E, 0xEE, 0xC4, 0x13, 0x13,
+0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0xC1, 0x8E, 0x90, 0x81, 0x2A, 0xE0, 0xFE, 0x6F, 0x70, 0x02,
+0xC1, 0x8E, 0xEF, 0x70, 0x02, 0xC1, 0x03, 0x24, 0xFE, 0x70, 0x02, 0xC1, 0x3D, 0x24, 0xFE, 0x60,
+0x4A, 0x24, 0xFC, 0x70, 0x02, 0xC1, 0x78, 0x24, 0xFC, 0x60, 0x02, 0xC1, 0x8E, 0xEE, 0xB4, 0x0E,
+0x02, 0xF1, 0x39, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0xF1, 0x1B, 0x90, 0x81, 0x2A,
+0xE0, 0xB4, 0x06, 0x02, 0xD1, 0xE8, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0x82, 0x1D,
+0xE0, 0xFF, 0x60, 0x05, 0x12, 0x7A, 0xBA, 0x80, 0x03, 0x12, 0x5F, 0xB4, 0x90, 0x81, 0x2A, 0xE0,
+0x64, 0x08, 0x60, 0x02, 0xC1, 0x8E, 0x12, 0x5B, 0xEB, 0xC1, 0x8E, 0x90, 0x81, 0x2A, 0xE0, 0x70,
+0x04, 0x7F, 0x01, 0xF1, 0x1B, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x06, 0x02, 0xD1, 0xE8, 0x90, 0x81,
+0x2A, 0xE0, 0xB4, 0x0E, 0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02, 0xF1, 0x39, 0x90, 0x81, 0x2A, 0xE0,
+0x64, 0x0C, 0x60, 0x02, 0xC1, 0x8E, 0xD1, 0x93, 0xEF, 0x64, 0x01, 0x60, 0x02, 0xC1, 0x8E, 0xF1,
+0x8D, 0xC1, 0x8E, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x0E, 0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02, 0xF1,
+0x39, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x06, 0x02, 0xD1, 0xE8, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x0C,
+0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02, 0xF1, 0x8D, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x04, 0x70, 0x5E,
+0x12, 0x7A, 0x0C, 0xEF, 0x64, 0x01, 0x70, 0x56, 0x12, 0x5D, 0x5A, 0x80, 0x51, 0x90, 0x81, 0x2A,
+0xE0, 0xB4, 0x0E, 0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02, 0xF1, 0x39, 0x90, 0x81, 0x2A, 0xE0, 0xB4,
+0x06, 0x02, 0xD1, 0xE8, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x0C, 0x07, 0xD1, 0x93, 0xBF, 0x01, 0x02,
+0xF1, 0x8D, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0xF1, 0x1B, 0x90, 0x81, 0x2A, 0xE0,
+0xB4, 0x04, 0x1B, 0x12, 0x7B, 0x00, 0x80, 0x16, 0x90, 0x81, 0x2A, 0xE0, 0xB4, 0x0C, 0x0F, 0x90,
+0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x03, 0x12, 0x5F, 0x55, 0xD0, 0xD0,
+0x92, 0xAF, 0x22, 0xF1, 0xFC, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0,
+0x80, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90,
+0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x28, 0xEF, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x08, 0x90, 0x01,
+0xB8, 0x74, 0x04, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x29, 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, 0x81, 0x25, 0xE0, 0x90, 0x06, 0x04, 0x20,
+0xE0, 0x0C, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x80, 0x17, 0xE0, 0x54,
+0x7F, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0x7F, 0xF0, 0x90,
+0x81, 0x23, 0x74, 0x0C, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x82, 0x1C, 0xEF, 0xF0,
+0x12, 0x5B, 0xFD, 0x90, 0x82, 0x1C, 0xE0, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81,
+0x2A, 0x74, 0x04, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x81, 0x25, 0xE0, 0xC3, 0x13, 0x20,
+0xE0, 0x08, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x80, 0x1E, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40,
+0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44,
+0x80, 0xF0, 0x90, 0x81, 0x23, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0xAE, 0x07,
+0xF1, 0xE3, 0xBF, 0x01, 0x15, 0x90, 0x81, 0x1F, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x20, 0xE0,
+0x09, 0xAF, 0x06, 0x7D, 0x01, 0xB1, 0x41, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x80, 0xDE,
+0xE0, 0x64, 0x01, 0x70, 0x32, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x22, 0x74,
+0x6F, 0xF0, 0x7F, 0x01, 0x12, 0x56, 0xA8, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x80,
+0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0E, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74,
+0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x64, 0x02, 0x60, 0x12,
+0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x0A, 0xF1, 0xFC, 0xEF, 0x70, 0x05, 0xFD, 0x7F, 0x0C,
+0xB1, 0x41, 0x22, 0x90, 0x05, 0x43, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90,
+0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xA3, 0xF0, 0xA3, 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, 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, 0x90, 0x01, 0xC4, 0x74, 0x15, 0xF0, 0x74, 0x50, 0xA3, 0xF0, 0x12, 0x72, 0x6E, 0xE5,
+0x49, 0x30, 0xE1, 0x02, 0x11, 0xC5, 0xE5, 0x49, 0x30, 0xE2, 0x03, 0x12, 0x75, 0x58, 0xE5, 0x49,
+0x30, 0xE3, 0x03, 0x12, 0x75, 0x94, 0xE5, 0x4A, 0x30, 0xE0, 0x03, 0x12, 0x75, 0xD0, 0xE5, 0x4A,
+0x30, 0xE4, 0x03, 0x12, 0x76, 0x6F, 0xE5, 0x4B, 0x30, 0xE1, 0x03, 0x12, 0x73, 0x3B, 0xE5, 0x4B,
+0x30, 0xE0, 0x03, 0x12, 0x72, 0xF5, 0xE5, 0x4B, 0x30, 0xE3, 0x03, 0x12, 0x76, 0x85, 0xE5, 0x4C,
+0x30, 0xE1, 0x05, 0x7F, 0x03, 0x12, 0x4A, 0x27, 0xE5, 0x4C, 0x30, 0xE4, 0x02, 0x11, 0xD9, 0xE5,
+0x4C, 0x30, 0xE5, 0x03, 0x12, 0x76, 0x86, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x77, 0x1C, 0x74,
+0x15, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x50, 0xA3, 0xF0, 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, 0x81, 0x27, 0xE0, 0x60, 0x03, 0x12, 0x7B, 0x98, 0x90, 0x81,
+0x40, 0xE0, 0x30, 0xE0, 0x03, 0x12, 0x5C, 0xEA, 0x22, 0x12, 0x7B, 0x33, 0x90, 0x81, 0x2D, 0xE0,
+0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02, 0x7F, 0x02, 0x31, 0x31, 0x91, 0xBC, 0x90, 0x81, 0x42,
+0xE0, 0x30, 0xE0, 0x33, 0x90, 0x81, 0x44, 0xE0, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x81, 0x45, 0xE0,
+0x60, 0x05, 0x14, 0xF0, 0x02, 0x5F, 0x55, 0x90, 0x81, 0x43, 0xE0, 0x14, 0x90, 0x81, 0x45, 0xF0,
+0x90, 0x05, 0x73, 0x74, 0x01, 0xF0, 0xE4, 0xFF, 0x12, 0x5B, 0xBB, 0x7D, 0x02, 0x7F, 0x02, 0x31,
+0x31, 0x7D, 0x01, 0x7F, 0x02, 0x31, 0x31, 0x22, 0x90, 0x01, 0x34, 0x74, 0x40, 0xF0, 0xFD, 0xE4,
+0xFF, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34,
+0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x05, 0x27,
+0xE0, 0x90, 0x81, 0xD0, 0xF0, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x1F, 0xE0,
+0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12,
+0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, 0x1F, 0xF0, 0xEE,
+0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD,
+0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x1F, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF,
+0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0x90, 0x81,
+0x1F, 0xF0, 0xEE, 0xC3, 0x13, 0x20, 0xE0, 0x02, 0x41, 0x77, 0xE0, 0xFF, 0x20, 0xE0, 0x02, 0x41,
+0x5E, 0x90, 0x81, 0xD0, 0x74, 0x21, 0xF0, 0xEF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x31,
+0x28, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x08, 0xF0, 0x80, 0x0C, 0xE4, 0x90, 0x81, 0x20, 0xF0, 0xA3,
+0xF0, 0x7D, 0x40, 0xFF, 0x71, 0x5C, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x13, 0x13, 0x13, 0x54, 0x1F,
+0x30, 0xE0, 0x07, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x12, 0xF0, 0xED, 0xC4, 0x54, 0x0F, 0x30, 0xE0,
+0x07, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x14, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xC4, 0x13, 0x54, 0x07,
+0x30, 0xE0, 0x07, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xC4, 0x13,
+0x13, 0x54, 0x03, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0xD0,
+0xE0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x22, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0xB1, 0xA3, 0x90,
+0x81, 0x1F, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x04, 0x7F, 0x04, 0x80, 0x23,
+0x12, 0x4F, 0xE3, 0xEF, 0x60, 0x04, 0x7F, 0x01, 0x80, 0x19, 0x7F, 0x02, 0x80, 0x15, 0x90, 0x81,
+0xD0, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x22, 0xE0, 0x64, 0x04, 0x60, 0x02,
+0x61, 0x4D, 0xFF, 0xB1, 0xA3, 0x61, 0x4D, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x20, 0xE0, 0x02, 0x61,
+0x18, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x31, 0xF0, 0xED, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0B,
+0x31, 0x28, 0x90, 0x81, 0xD0, 0xE0, 0x44, 0x08, 0xF0, 0x80, 0x06, 0x7D, 0x40, 0xE4, 0xFF, 0x71,
+0x5C, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81,
+0xD0, 0xE0, 0x44, 0x02, 0xF0, 0xED, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xD0, 0xE0,
+0x44, 0x04, 0xF0, 0x90, 0x81, 0xD0, 0xE0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xFF,
+0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x6D,
+0xE4, 0xFD, 0x7F, 0x02, 0x80, 0x23, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x23,
+0xE0, 0xB4, 0x02, 0x1A, 0x12, 0x7B, 0x1A, 0x12, 0x4F, 0xE3, 0xBF, 0x01, 0x09, 0x90, 0x81, 0x29,
+0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x03, 0xE4, 0xFD, 0xFF, 0x12, 0x4D, 0x41, 0x80, 0x3F, 0x90, 0x81,
+0x2A, 0xE0, 0x90, 0x81, 0x23, 0xF0, 0x80, 0x35, 0x90, 0x81, 0xD0, 0x74, 0x01, 0xF0, 0x90, 0x05,
+0x27, 0xF0, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x06, 0x7D, 0x01, 0x7F, 0x04, 0x80, 0x0B, 0x90,
+0x81, 0x23, 0xE0, 0xB4, 0x08, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x4D, 0x41, 0x12, 0x75, 0x4F,
+0x90, 0x81, 0x29, 0xE0, 0xFF, 0x7D, 0x01, 0x12, 0x4D, 0x41, 0x12, 0x5A, 0x64, 0xD0, 0xD0, 0x92,
+0xAF, 0x22, 0x7D, 0x02, 0x7F, 0x02, 0x71, 0x5C, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x3D, 0x2F, 0xF8,
+0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5,
+0x83, 0xEE, 0xF0, 0x22, 0xEF, 0x70, 0x37, 0x7D, 0x78, 0x7F, 0x02, 0x71, 0x5C, 0x7D, 0x02, 0x7F,
+0x03, 0x71, 0x5C, 0x7D, 0xC8, 0x7F, 0x02, 0x12, 0x77, 0xE2, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90,
+0x01, 0x3C, 0x74, 0x02, 0xF0, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x4D, 0x41, 0x90, 0x81, 0x24, 0xE0,
+0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01,
+0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x31, 0x31, 0x7D, 0x02, 0x7F,
+0x03, 0x31, 0x31, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90,
+0x05, 0x58, 0xF0, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB,
+0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, 0x4D, 0x41, 0x90,
+0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x08, 0x90,
+0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x3B, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x04, 0xEF, 0x30, 0xE0,
+0x0A, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x02, 0x60, 0x29, 0x91, 0xF1, 0x90, 0x81, 0x25, 0xE0, 0x13,
+0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70,
+0x0B, 0x12, 0x77, 0xBE, 0x71, 0x52, 0x90, 0x81, 0x2E, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0,
+0x04, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x06, 0x90, 0x81, 0x21, 0x74, 0x01, 0xF0,
+0x90, 0x81, 0x27, 0xE0, 0x60, 0x45, 0x90, 0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F,
+0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, 0x71, 0x52, 0x90, 0x81, 0x2D, 0xE0,
+0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x82, 0x14, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9, 0xC3,
+0x90, 0x82, 0x15, 0xE0, 0x94, 0x80, 0x90, 0x82, 0x14, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B,
+0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0x12, 0x7D, 0xBE, 0x91, 0xBC,
+0x12, 0x6F, 0x96, 0x90, 0x81, 0x42, 0xE0, 0x30, 0xE0, 0x11, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4,
+0x0A, 0x71, 0x52, 0x90, 0x81, 0x44, 0xE0, 0x90, 0x05, 0x73, 0xF0, 0x22, 0x90, 0x81, 0x47, 0xE0,
+0x30, 0xE0, 0x2D, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x26, 0x90, 0x82, 0x1F, 0xE0, 0x04, 0xF0,
+0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x82, 0x1F, 0xF0, 0x90,
+0x81, 0x49, 0xE0, 0xFF, 0x90, 0x81, 0x48, 0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0xD1, 0xA6,
+0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xA1, 0x92, 0x90, 0x81, 0x27, 0xE0, 0x70,
+0x02, 0xA1, 0x92, 0x90, 0x81, 0x26, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x22, 0x90, 0x06,
+0xAB, 0xE0, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x90, 0x81, 0x2D, 0xF0, 0xA3, 0xE0,
+0xFF, 0x70, 0x08, 0x90, 0x81, 0x2D, 0xE0, 0xFE, 0xFF, 0x80, 0x00, 0x90, 0x81, 0x2E, 0xEF, 0xF0,
+0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x32, 0xA3,
+0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0,
+0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0xFF, 0xC4,
+0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x05, 0x12,
+0x6E, 0xB1, 0x80, 0x03, 0x12, 0x6D, 0xFF, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F,
+0x30, 0xE0, 0x0F, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x05, 0x12, 0x77, 0xBE,
+0x71, 0x58, 0x90, 0x81, 0x1F, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x07, 0x90, 0x81, 0x25, 0xE0, 0x44,
+0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x22, 0xE0, 0x90, 0x82,
+0x1E, 0xF0, 0x6F, 0x70, 0x02, 0xC1, 0xA1, 0xEF, 0x14, 0x60, 0x40, 0x14, 0x60, 0x68, 0x14, 0x70,
+0x02, 0xC1, 0x53, 0x14, 0x70, 0x02, 0xC1, 0x7B, 0x24, 0x04, 0x60, 0x02, 0xC1, 0xA1, 0x90, 0x82,
+0x1E, 0xE0, 0xFF, 0xB4, 0x04, 0x05, 0x12, 0x7C, 0x16, 0xC1, 0xA1, 0xEF, 0xB4, 0x02, 0x04, 0xF1,
+0xE3, 0xC1, 0xA1, 0x90, 0x82, 0x1E, 0xE0, 0xFF, 0xB4, 0x03, 0x05, 0x12, 0x7C, 0x3A, 0xC1, 0xA1,
+0xEF, 0x64, 0x01, 0x60, 0x02, 0xC1, 0xA1, 0xF1, 0xE5, 0xC1, 0xA1, 0x90, 0x82, 0x1E, 0xE0, 0xFF,
+0xB4, 0x04, 0x05, 0x12, 0x7C, 0x03, 0xC1, 0xA1, 0xEF, 0xB4, 0x02, 0x04, 0xF1, 0xD5, 0xC1, 0xA1,
+0x90, 0x82, 0x1E, 0xE0, 0xFF, 0xB4, 0x03, 0x05, 0x12, 0x7C, 0x2F, 0xC1, 0xA1, 0xEF, 0x60, 0x02,
+0xC1, 0xA1, 0xF1, 0xA9, 0x80, 0x7B, 0x90, 0x82, 0x1E, 0xE0, 0xB4, 0x04, 0x05, 0x12, 0x5F, 0x92,
+0x80, 0x6F, 0x90, 0x82, 0x1E, 0xE0, 0xB4, 0x01, 0x04, 0xF1, 0x9B, 0x80, 0x64, 0x90, 0x82, 0x1E,
+0xE0, 0xB4, 0x03, 0x05, 0x12, 0x5F, 0x4C, 0x80, 0x58, 0x90, 0x82, 0x1E, 0xE0, 0x70, 0x52, 0xF1,
+0xA5, 0x80, 0x4E, 0x90, 0x82, 0x1E, 0xE0, 0xFF, 0xB4, 0x04, 0x05, 0x12, 0x7C, 0x1B, 0x80, 0x41,
+0xEF, 0xB4, 0x01, 0x04, 0xF1, 0xC8, 0x80, 0x39, 0xEF, 0xB4, 0x02, 0x05, 0x12, 0x5F, 0x43, 0x80,
+0x30, 0x90, 0x82, 0x1E, 0xE0, 0x70, 0x2A, 0xF1, 0xC6, 0x80, 0x26, 0x90, 0x82, 0x1E, 0xE0, 0xFF,
+0xB4, 0x03, 0x05, 0x12, 0x7C, 0x3F, 0x80, 0x19, 0xEF, 0xB4, 0x01, 0x04, 0xF1, 0xB2, 0x80, 0x11,
+0xEF, 0xB4, 0x02, 0x05, 0x12, 0x5F, 0xC7, 0x80, 0x08, 0x90, 0x82, 0x1E, 0xE0, 0x70, 0x02, 0xF1,
+0xB0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xFF, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F,
+0x53, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x1F, 0x90, 0x05, 0x22, 0xE0, 0xF5, 0x56, 0x74, 0xFF, 0xF0,
+0x12, 0x5D, 0x7A, 0xBF, 0x01, 0x08, 0xAF, 0x53, 0x12, 0x7C, 0xFF, 0x12, 0x7C, 0x60, 0x90, 0x05,
+0x22, 0xE5, 0x56, 0xF0, 0x80, 0x03, 0x12, 0x7C, 0x60, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F,
+0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
+0xE0, 0x54, 0x3F, 0xF0, 0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5,
+0x83, 0xE0, 0x44, 0x10, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0,
+0x44, 0x80, 0xF0, 0x22, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54,
+0xEF, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0,
+0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x17, 0xED, 0xF0, 0x90, 0x82, 0x16,
+0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x12, 0x7D, 0x4C, 0x7C, 0x00, 0xAD, 0x07, 0x90, 0x82, 0x16, 0xE0,
+0x90, 0x04, 0x25, 0xF0, 0x90, 0x82, 0x17, 0xE0, 0x60, 0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4,
+0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4,
+0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
+0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54,
+0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x5C, 0xEA, 0x90, 0x81,
+0x22, 0x74, 0x02, 0xF0, 0x22, 0xF1, 0xA9, 0x80, 0xF2, 0x90, 0x81, 0x22, 0x74, 0x01, 0xF0, 0x22,
+0xF1, 0xA9, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90,
+0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xF1, 0xA9, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x90, 0x81,
+0x22, 0x74, 0x03, 0xF0, 0x22, 0x12, 0x5B, 0xFD, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x22,
+0x04, 0xF0, 0x22, 0xF1, 0xD5, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0x90, 0x81, 0x22,
+0xF0, 0x22, 0x90, 0x01, 0xC8, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0x81, 0x79,
+0x56, 0x7F, 0xFF, 0xFE, 0x12, 0x2B, 0x27, 0xBF, 0x01, 0x09, 0x90, 0x81, 0x56, 0xE0, 0x64, 0x03,
+0x60, 0x03, 0x22, 0x01, 0xB4, 0xE4, 0x90, 0x81, 0x5B, 0xF0, 0x90, 0x81, 0x5B, 0xE0, 0xFF, 0xC3,
+0x94, 0x02, 0x40, 0x02, 0x01, 0xEF, 0xC3, 0x74, 0xFE, 0x9F, 0xFF, 0xE4, 0x94, 0x00, 0xFE, 0x7B,
+0x01, 0x7A, 0x81, 0x79, 0x57, 0x12, 0x2B, 0x27, 0xEF, 0x64, 0x01, 0x70, 0x77, 0x90, 0x81, 0x57,
+0xE0, 0xFF, 0x54, 0xC0, 0xFE, 0x60, 0x05, 0xEF, 0x54, 0x0C, 0x70, 0x16, 0x90, 0x81, 0x57, 0xE0,
+0xFF, 0x54, 0x30, 0x60, 0x67, 0xEF, 0x54, 0x03, 0x60, 0x62, 0x90, 0x81, 0x58, 0x74, 0x01, 0xF0,
+0x80, 0x05, 0xE4, 0x90, 0x81, 0x58, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x90, 0x81, 0x57, 0x70, 0x16,
+0xE0, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x81, 0x59, 0xF0, 0xEF, 0x54, 0x0C, 0x13, 0x13,
+0x54, 0x3F, 0xA3, 0xF0, 0x80, 0x0D, 0xE0, 0xFE, 0x54, 0x30, 0x90, 0x81, 0x59, 0xF0, 0xEE, 0x54,
+0x03, 0xA3, 0xF0, 0x90, 0x81, 0x59, 0xE0, 0x64, 0x30, 0x70, 0x54, 0xA3, 0xE0, 0x64, 0x02, 0x70,
+0x4E, 0x90, 0x00, 0xF5, 0xE0, 0x54, 0x40, 0x90, 0x81, 0x5C, 0xF0, 0xE0, 0x70, 0x41, 0xA3, 0x74,
+0x02, 0xF0, 0x80, 0x10, 0x90, 0x81, 0x5D, 0x74, 0x01, 0xF0, 0x80, 0x08, 0x90, 0x81, 0x5B, 0xE0,
+0x04, 0xF0, 0x01, 0x1A, 0x90, 0x01, 0xC4, 0x74, 0xF2, 0xF0, 0x74, 0x57, 0xA3, 0xF0, 0x90, 0x81,
+0x5D, 0xE0, 0x90, 0x01, 0xC8, 0xF0, 0x90, 0x81, 0x57, 0xE0, 0x90, 0x01, 0xC9, 0xF0, 0x90, 0x81,
+0x58, 0xE0, 0x90, 0x01, 0xCA, 0xF0, 0xE4, 0xFD, 0x7F, 0x1F, 0x12, 0x32, 0x1E, 0x80, 0xD5, 0x22,
+0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD, 0x00, 0xE0,
+0x54, 0xBF, 0xF0, 0x12, 0x57, 0xF2, 0x31, 0xCB, 0x12, 0x32, 0x77, 0x12, 0x71, 0x94, 0x31, 0xB2,
+0x7F, 0x01, 0x12, 0x49, 0x15, 0x90, 0x81, 0x46, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x49, 0x15, 0x90,
+0x81, 0x46, 0xE0, 0x04, 0xF0, 0x7F, 0x03, 0x12, 0x49, 0x15, 0x90, 0x81, 0x46, 0xE0, 0x04, 0xF0,
+0x31, 0x4F, 0x31, 0x90, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E,
+0x75, 0x20, 0xFF, 0x31, 0xBC, 0x12, 0x71, 0xC4, 0x31, 0xD3, 0xE4, 0xFF, 0x02, 0x49, 0x9E, 0x51,
+0x09, 0x90, 0x80, 0x3C, 0xEF, 0xF0, 0x31, 0x61, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x02, 0x2D,
+0xA7, 0x12, 0x71, 0x33, 0x12, 0x71, 0x63, 0x51, 0x23, 0x51, 0x42, 0xE4, 0xF5, 0x35, 0xF5, 0x36,
+0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F, 0x51, 0x12,
+0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02, 0x32, 0x1E,
+0x31, 0xB6, 0x31, 0xC3, 0x51, 0x64, 0x12, 0x79, 0x06, 0x31, 0xDD, 0x31, 0xE8, 0x31, 0xF7, 0x90,
+0x81, 0x4A, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3,
+0xF0, 0x22, 0xE4, 0xF5, 0x4D, 0x22, 0xE4, 0x90, 0x80, 0xDE, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75,
+0xA8, 0x84, 0x22, 0xE4, 0x90, 0x80, 0xD8, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44,
+0x01, 0xF0, 0x22, 0x90, 0x01, 0xE4, 0x74, 0x0C, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90, 0x81, 0x40,
+0xE0, 0x54, 0xFE, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0xE4,
+0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x47, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x7F,
+0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09,
+0xE0, 0x7F, 0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02,
+0x7F, 0x03, 0x22, 0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, 0x07, 0x75, 0x40, 0x02, 0x90,
+0x01, 0x30, 0xE5, 0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40,
+0xF0, 0x22, 0x75, 0x45, 0x0E, 0x75, 0x46, 0x01, 0x43, 0x46, 0x10, 0x75, 0x47, 0x03, 0x75, 0x48,
+0x62, 0x90, 0x01, 0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, 0xF0, 0xA3,
+0xE5, 0x48, 0xF0, 0x22, 0x90, 0x81, 0x1F, 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, 0x31, 0x9F, 0x12, 0x1F, 0xA4, 0xFF, 0x54,
+0x01, 0xFE, 0x90, 0x81, 0x4A, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14,
+0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x4B, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD,
+0x90, 0x81, 0x4C, 0xF0, 0x22, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x1F, 0xEF, 0x12, 0x4B, 0x28, 0x5A,
+0xEA, 0x00, 0x5A, 0xF3, 0x01, 0x5A, 0xFB, 0x02, 0x5B, 0x03, 0x03, 0x5B, 0x0C, 0x04, 0x5B, 0x14,
+0x20, 0x5B, 0x1C, 0x21, 0x5B, 0x25, 0x23, 0x5B, 0x2D, 0x24, 0x5B, 0x36, 0x25, 0x5B, 0x3E, 0x26,
+0x5B, 0x46, 0x27, 0x5B, 0x4E, 0xC0, 0x00, 0x00, 0x5B, 0x56, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16,
+0x02, 0x70, 0x9E, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0xC1, 0x95, 0x90, 0x81, 0xCD, 0x12, 0x4B,
+0x16, 0x81, 0x9A, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0x02, 0x7D, 0x9E, 0x90, 0x81, 0xCD, 0x12,
+0x4B, 0x16, 0x41, 0x89, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0xA1, 0xC2, 0x90, 0x81, 0xCD, 0x12,
+0x4B, 0x16, 0x02, 0x70, 0xE6, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0xE1, 0x3B, 0x90, 0x81, 0xCD,
+0x12, 0x4B, 0x16, 0x02, 0x51, 0x46, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0xE1, 0x62, 0x90, 0x81,
+0xCD, 0x12, 0x4B, 0x16, 0x80, 0x18, 0x90, 0x81, 0xCD, 0x12, 0x4B, 0x16, 0x80, 0x3C, 0x90, 0x81,
+0xCD, 0x12, 0x4B, 0x16, 0xE1, 0xA2, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x12, 0x1F,
+0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x40, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0x90, 0x00, 0x01,
+0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x05, 0x54, 0xE0, 0xC3, 0x9E, 0x90, 0x81, 0x41, 0xF0, 0xEF, 0x20,
+0xE0, 0x07, 0x71, 0xFD, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFF,
+0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81,
+0x43, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x44, 0xF0, 0x90, 0x81, 0x43, 0xE0,
+0x90, 0x81, 0x45, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0x01, 0xFF, 0xAC, 0x07, 0xEF, 0x54, 0x01,
+0xFE, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0x90, 0x01, 0x53, 0xB4, 0x01, 0x12,
+0xE4, 0xF0, 0x7D, 0x10, 0x7F, 0x03, 0x12, 0x77, 0xCD, 0x90, 0x81, 0x44, 0xE0, 0x90, 0x05, 0x73,
+0xF0, 0x22, 0x74, 0x03, 0xF0, 0x7D, 0x10, 0xFF, 0x12, 0x77, 0xE2, 0x71, 0xFD, 0x90, 0x05, 0x22,
+0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 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, 0x7C, 0x7E,
+0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x82, 0x0A, 0x12, 0x20, 0xCE, 0x90, 0x82,
+0x0A, 0x12, 0x4A, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E,
+0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12,
+0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E,
+0x12, 0x2E, 0xA2, 0x90, 0x82, 0x02, 0x12, 0x20, 0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF,
+0x91, 0x77, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xC0, 0x07,
+0xC0, 0x05, 0x90, 0x82, 0x02, 0x12, 0x4A, 0xD9, 0x90, 0x81, 0xEE, 0x12, 0x20, 0xCE, 0xD0, 0x05,
+0xD0, 0x07, 0x12, 0x6D, 0x26, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
+0xD0, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x1F, 0x12, 0x1F, 0xA4, 0xFF, 0x90, 0x81, 0x1E, 0xF0, 0xBF,
+0x01, 0x12, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01,
+0x60, 0x23, 0x80, 0x1E, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD,
+0x64, 0x01, 0x60, 0x11, 0x90, 0x81, 0x1F, 0xE0, 0x20, 0xE0, 0x07, 0xE4, 0xFF, 0x12, 0x55, 0xA3,
+0x80, 0x03, 0x12, 0x72, 0xCF, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0,
+0xB1, 0x7A, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08,
+0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, 0x7F, 0x70, 0x7E,
+0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x82, 0x02, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xFD,
+0xFF, 0x91, 0x77, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x82,
+0x0E, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x0E, 0x12, 0x4A, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE,
+0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54,
+0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0,
+0xB1, 0x7A, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x12, 0x51, 0x31, 0x91, 0xF0,
+0xE4, 0x90, 0x81, 0x2A, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0xE4, 0x90, 0x82, 0x18, 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, 0x82, 0x19, 0xE0, 0x94, 0xE8, 0x90, 0x82, 0x18,
+0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F,
+0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x18, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9,
+0x80, 0xBF, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x1F, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x90, 0x81,
+0xD3, 0x12, 0x4B, 0x1F, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD,
+0x90, 0x81, 0x3F, 0xF0, 0x90, 0x81, 0xD3, 0x12, 0x4B, 0x16, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x7F,
+0x90, 0x81, 0x27, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, 0x01,
+0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x81, 0x26, 0xE0, 0x54, 0xF0,
+0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81, 0x24,
+0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x81, 0x26, 0xE0,
+0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x29, 0xF0, 0xD1, 0x65,
+0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x90, 0x01,
+0xBA, 0xF0, 0x90, 0x81, 0x29, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F,
+0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x81, 0xD6, 0x12, 0x4B, 0x1F, 0xF1, 0x81, 0x90, 0x81, 0x27,
+0xE0, 0xFF, 0x12, 0x53, 0x74, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x19, 0x90, 0x81, 0xD6, 0x12, 0x4B,
+0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD,
+0xFD, 0x12, 0x79, 0xDB, 0x22, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x1F, 0x90, 0x00, 0x01, 0x12, 0x1F,
+0xBD, 0xFF, 0xFE, 0x12, 0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x81, 0xD0, 0x12,
+0x4B, 0x16, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0xD4, 0xF0, 0x80, 0x05, 0x90, 0x81,
+0xD4, 0xEF, 0xF0, 0x90, 0x81, 0xD3, 0xEE, 0xF0, 0x90, 0x81, 0xD4, 0xE0, 0xFE, 0x90, 0x81, 0xD3,
+0xE0, 0xFF, 0xD3, 0x9E, 0x50, 0x38, 0x90, 0x81, 0xD0, 0x12, 0x4B, 0x16, 0x12, 0x1F, 0xA4, 0x54,
+0x01, 0xFE, 0x74, 0xDE, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xDE,
+0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xF1, 0x3A, 0x80, 0x07, 0x90,
+0x81, 0xD3, 0xE0, 0xFF, 0xF1, 0x39, 0x90, 0x81, 0xD3, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x90, 0x80,
+0xDE, 0xE0, 0x70, 0x24, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0xFF, 0x12, 0x4F, 0x1B, 0x90, 0x81,
+0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0xF1, 0xB4, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54,
+0xEF, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x22, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81,
+0x31, 0xF0, 0x22, 0x71, 0xFD, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, 0x91, 0xF0, 0x90, 0x81,
+0x22, 0x74, 0x02, 0xF0, 0x22, 0x91, 0xEA, 0x90, 0x81, 0x2A, 0x74, 0x08, 0xF0, 0x90, 0x81, 0x23,
+0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x3E, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x90, 0x01, 0xE7,
+0xF0, 0x22, 0x90, 0x81, 0x40, 0xE0, 0x30, 0xE0, 0x07, 0x71, 0xFD, 0x90, 0x05, 0x22, 0xE4, 0xF0,
+0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x2B,
+0xF0, 0x22, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x91, 0xEA, 0x90, 0x81, 0x22, 0x74, 0x02,
+0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x4F, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90,
+0x81, 0x50, 0xF0, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0,
+0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x22, 0x71, 0xFD, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90,
+0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81,
+0x5E, 0xF0, 0x90, 0x81, 0x5E, 0xE0, 0x64, 0x01, 0xF0, 0x24, 0xDD, 0x90, 0x01, 0xC4, 0xF0, 0x74,
+0x5F, 0xA3, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0F, 0x90, 0x81, 0x2A, 0xE0, 0xFF, 0x90, 0x81,
+0x29, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x4D, 0x29, 0xC2, 0xAF, 0x12, 0x72, 0x1A, 0xBF, 0x01, 0x02,
+0x11, 0x23, 0xD2, 0xAF, 0xF1, 0xD6, 0x12, 0x32, 0x9E, 0xBF, 0x01, 0x02, 0x31, 0x24, 0x12, 0x48,
+0x4D, 0x80, 0xBF, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x23, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30,
+0xE0, 0x19, 0xC3, 0x13, 0x30, 0xE0, 0x08, 0x12, 0x7C, 0x53, 0xBF, 0x01, 0x10, 0x80, 0x0A, 0x90,
+0x81, 0x23, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x04, 0x80, 0x03, 0x11, 0x5E, 0x22, 0xD3, 0x10,
+0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x11, 0xDF, 0x11, 0x77, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81,
+0x2A, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x0E, 0x12, 0x7A, 0x8C, 0xBF, 0x01, 0x08, 0x11, 0x4E,
+0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, 0x22, 0xF1, 0xD7, 0x90, 0x00, 0x08, 0xE0, 0x54, 0xEF, 0xFD,
+0x7F, 0x08, 0x12, 0x32, 0x1E, 0xE4, 0xFF, 0x8F, 0x50, 0xE4, 0x90, 0x81, 0x5F, 0xF0, 0xA3, 0xF0,
+0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0xEF, 0x65, 0x50, 0x60, 0x3E,
+0xC3, 0x90, 0x81, 0x60, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x5F, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90,
+0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x5F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A,
+0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x60, 0xE0, 0x94, 0x32, 0x90,
+0x81, 0x5F, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, 0xB2, 0x22, 0x90,
+0x81, 0x31, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x32, 0x1E, 0x90, 0x81, 0x28, 0xE0, 0x60, 0x12, 0x90,
+0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x90,
+0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0x7F, 0x01, 0x11,
+0x87, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E, 0x7F, 0x14, 0x7E,
+0x00, 0x02, 0x32, 0xAA, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x2D, 0xA7, 0xE4, 0xF5,
+0x52, 0x12, 0x32, 0x9E, 0xEF, 0x60, 0x71, 0x63, 0x52, 0x01, 0xE5, 0x52, 0x24, 0x24, 0x90, 0x01,
+0xC4, 0xF0, 0x74, 0x61, 0xA3, 0xF0, 0x90, 0x00, 0x88, 0xE0, 0xF5, 0x50, 0xF5, 0x51, 0x54, 0x0F,
+0x60, 0xDF, 0xE5, 0x50, 0x30, 0xE0, 0x0B, 0x20, 0xE4, 0x03, 0x12, 0x29, 0xC5, 0x53, 0x51, 0xEE,
+0x80, 0x3D, 0xE5, 0x50, 0x30, 0xE1, 0x16, 0x20, 0xE5, 0x0E, 0x12, 0x11, 0xBD, 0xEF, 0x70, 0x03,
+0x43, 0x51, 0x20, 0x90, 0x01, 0x06, 0xE4, 0xF0, 0x53, 0x51, 0xFD, 0x80, 0x22, 0xE5, 0x50, 0x30,
+0xE2, 0x0A, 0x20, 0xE6, 0x02, 0x91, 0x2F, 0x53, 0x51, 0xFB, 0x80, 0x13, 0xE5, 0x50, 0x30, 0xE3,
+0x0E, 0x20, 0xE7, 0x08, 0x31, 0xAD, 0xEF, 0x70, 0x03, 0x43, 0x51, 0x80, 0x53, 0x51, 0xF7, 0xAD,
+0x51, 0x7F, 0x88, 0x12, 0x32, 0x1E, 0x80, 0x89, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x78, 0x10, 0x74,
+0x01, 0xF2, 0x90, 0x02, 0x09, 0xE0, 0x78, 0x00, 0xF2, 0x08, 0x74, 0x20, 0xF2, 0x18, 0xE2, 0xFF,
+0x30, 0xE0, 0x05, 0x08, 0xE2, 0x24, 0x80, 0xF2, 0xEF, 0xC3, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0x78,
+0x01, 0xE2, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x78, 0x03, 0xF2, 0x64,
+0x04, 0x60, 0x0D, 0xE2, 0xFF, 0x64, 0x08, 0x60, 0x07, 0xEF, 0x64, 0x0C, 0x60, 0x02, 0x81, 0x1D,
+0xE4, 0x78, 0x02, 0xF2, 0x78, 0x03, 0xE2, 0xFF, 0x18, 0xE2, 0xC3, 0x9F, 0x50, 0x2D, 0xE2, 0xFD,
+0x18, 0xE2, 0x2D, 0x90, 0x81, 0x5F, 0xF0, 0xE0, 0xFF, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC,
+0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x04, 0x2D, 0xF8, 0xEE, 0xF2, 0xEF, 0xB4, 0xFF, 0x06, 0x90, 0xFD,
+0x10, 0xE0, 0x04, 0xF0, 0x78, 0x02, 0xE2, 0x04, 0xF2, 0x80, 0xC9, 0x78, 0x04, 0xE2, 0x78, 0x12,
+0xF2, 0xFF, 0x78, 0x05, 0xE2, 0x78, 0x11, 0xF2, 0x78, 0x06, 0xE2, 0x78, 0x13, 0xF2, 0x78, 0x07,
+0xE2, 0x78, 0x14, 0xF2, 0x78, 0x08, 0xE2, 0x78, 0x33, 0xF2, 0x78, 0x09, 0xE2, 0x78, 0x34, 0xF2,
+0x78, 0x0A, 0xE2, 0x78, 0x35, 0xF2, 0x78, 0x0B, 0xE2, 0x78, 0x36, 0xF2, 0x78, 0x0C, 0xE2, 0x78,
+0x37, 0xF2, 0x78, 0x0D, 0xE2, 0x78, 0x38, 0xF2, 0x78, 0x0E, 0xE2, 0x78, 0x39, 0xF2, 0x78, 0x0F,
+0xE2, 0x78, 0x3A, 0xF2, 0xE4, 0x78, 0x15, 0xF2, 0xEF, 0x24, 0xF8, 0x60, 0x75, 0x24, 0xFC, 0x60,
+0x6C, 0x24, 0x08, 0x60, 0x02, 0x61, 0xFF, 0x78, 0x11, 0xE2, 0xB4, 0x01, 0x05, 0x12, 0x29, 0xC5,
+0x81, 0x04, 0x78, 0x11, 0xE2, 0xB4, 0x02, 0x05, 0x12, 0x11, 0xBD, 0x81, 0x04, 0x78, 0x11, 0xE2,
+0xB4, 0x03, 0x04, 0x91, 0x2F, 0x81, 0x04, 0x78, 0x11, 0xE2, 0xB4, 0x10, 0x17, 0x78, 0x14, 0xE2,
+0xFE, 0x18, 0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, 0x12,
+0x32, 0xAA, 0x81, 0x04, 0x78, 0x11, 0xE2, 0xB4, 0x11, 0x17, 0x78, 0x14, 0xE2, 0xFE, 0x18, 0xE2,
+0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, 0x12, 0x32, 0x06, 0x81,
+0x04, 0x78, 0x11, 0xE2, 0xF4, 0x60, 0x02, 0x81, 0x04, 0x18, 0xF2, 0x81, 0x04, 0x78, 0x15, 0x74,
+0x01, 0xF2, 0x78, 0x11, 0xE2, 0x64, 0x07, 0x60, 0x02, 0x61, 0xE9, 0x78, 0x34, 0xE2, 0xFF, 0xE4,
+0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07,
+0x78, 0x33, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0xC0, 0x04, 0xC0,
+0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x35, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12,
+0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0x78, 0x18, 0x12,
+0x4A, 0xFE, 0x78, 0x15, 0xE2, 0x70, 0x02, 0x61, 0xD2, 0x18, 0xE2, 0xFF, 0x18, 0xE2, 0xFD, 0x91,
+0x20, 0x78, 0x1C, 0x12, 0x4A, 0xFE, 0x78, 0x38, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08,
+0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x78, 0x37, 0xE2, 0xFF, 0xE4,
+0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07,
+0x78, 0x39, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0,
+0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0x78, 0x20, 0x12, 0x4A, 0xFE, 0x78, 0x20, 0x12,
+0x4A, 0xE5, 0x12, 0x20, 0x9B, 0x78, 0x1C, 0x12, 0x4A, 0xF1, 0x12, 0x4A, 0xBF, 0xC0, 0x04, 0xC0,
+0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x18, 0x12, 0x4A, 0xE5, 0x78, 0x20, 0x12, 0x4A, 0xF1, 0x12,
+0x4A, 0xBF, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0x78, 0x18, 0x12,
+0x4A, 0xFE, 0x78, 0x18, 0x12, 0x4A, 0xE5, 0x90, 0x82, 0x02, 0x12, 0x20, 0xCE, 0x78, 0x13, 0xE2,
+0xFD, 0x08, 0xE2, 0xFF, 0x12, 0x5C, 0x77, 0x80, 0x1B, 0x78, 0x13, 0xE2, 0xFF, 0x08, 0xE2, 0xFD,
+0x78, 0x11, 0xE2, 0xFB, 0x78, 0x15, 0xE2, 0x90, 0x81, 0xC1, 0xF0, 0xF1, 0xDF, 0x80, 0x05, 0x78,
+0x10, 0x74, 0x02, 0xF2, 0x78, 0x10, 0xE2, 0xFF, 0xC3, 0x94, 0x02, 0x50, 0x10, 0xEF, 0x60, 0x0A,
+0x78, 0x02, 0xE2, 0xFF, 0x18, 0xE2, 0x2F, 0xF2, 0x21, 0xCF, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22,
+0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x6B, 0xE7, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4,
+0x90, 0x81, 0x6F, 0xF0, 0x90, 0x87, 0x5F, 0xE0, 0x90, 0x81, 0x6E, 0xF0, 0xE4, 0x90, 0x81, 0x7B,
+0xF0, 0x90, 0x81, 0x6B, 0xF0, 0x90, 0x81, 0x6B, 0xE0, 0xFF, 0xC3, 0x94, 0x40, 0x50, 0x15, 0x74,
+0x7E, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0x90, 0x81, 0x6B, 0xE0,
+0x04, 0xF0, 0x80, 0xE1, 0xE4, 0x90, 0x81, 0x6B, 0xF0, 0x90, 0x81, 0x6E, 0xE0, 0xFF, 0x90, 0x81,
+0x6B, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0xA1, 0x39, 0x74, 0xDF, 0x2E, 0xF9, 0xE4, 0x34, 0x86,
+0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x0A, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x60,
+0x12, 0x2B, 0xED, 0x90, 0x81, 0x61, 0xE0, 0xFF, 0x12, 0x2F, 0x27, 0xEF, 0x04, 0x90, 0x81, 0x7B,
+0xF0, 0x90, 0x81, 0x60, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0x12, 0x31, 0xEA, 0xEF, 0x24, 0xC8, 0x90,
+0x81, 0x7D, 0xF0, 0x75, 0xF0, 0x08, 0xA4, 0xF0, 0x90, 0x81, 0x61, 0xE0, 0x54, 0x0F, 0x90, 0x81,
+0x7C, 0xF0, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x81, 0x6C, 0xF0, 0x90, 0x81, 0x6C, 0xE0, 0xFF,
+0xC3, 0x94, 0x04, 0x50, 0x57, 0x90, 0x81, 0x7C, 0xE0, 0xFE, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3,
+0x13, 0xD8, 0xFC, 0x20, 0xE0, 0x3E, 0x90, 0x81, 0x6C, 0xE0, 0x25, 0xE0, 0xFF, 0x90, 0x81, 0x7D,
+0xE0, 0x2F, 0x24, 0x7E, 0xF9, 0xE4, 0x34, 0x81, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x01, 0x90,
+0x81, 0x6A, 0xE0, 0x75, 0xF0, 0x02, 0xA4, 0x24, 0x62, 0xF9, 0x74, 0x81, 0x35, 0xF0, 0x8B, 0x13,
+0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0xD0, 0x01, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x81,
+0x6A, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x6C, 0xE0, 0x04, 0xF0, 0x80, 0x9F, 0x90, 0x81, 0x7B, 0xE0,
+0xFF, 0x90, 0x81, 0x6B, 0xE0, 0x2F, 0xF0, 0x81, 0x69, 0xE4, 0x90, 0x81, 0x6F, 0xF0, 0x90, 0x81,
+0x6F, 0xE0, 0xC3, 0x94, 0x40, 0x40, 0x02, 0xE1, 0xD5, 0xE0, 0xFF, 0x24, 0x7E, 0xF5, 0x82, 0xE4,
+0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, 0x81, 0x71, 0xF0, 0xE0, 0xFE, 0x54, 0xF0, 0xC4, 0x54, 0x0F,
+0xFD, 0x90, 0x81, 0x70, 0xF0, 0xEE, 0x54, 0x0F, 0xFE, 0xA3, 0xF0, 0x74, 0x7F, 0x2F, 0xF5, 0x82,
+0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, 0x81, 0x72, 0xF0, 0xFC, 0xEE, 0xFE, 0xEC, 0xFB, 0xEB,
+0xFF, 0x90, 0x81, 0x77, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xED, 0x12, 0x4B, 0x28, 0x65, 0xB2, 0x00,
+0x65, 0xE9, 0x01, 0x66, 0x9A, 0x02, 0x67, 0xC6, 0x03, 0x66, 0xB5, 0x04, 0x66, 0xD6, 0x05, 0x66,
+0xD6, 0x06, 0x66, 0xD6, 0x07, 0x66, 0xD6, 0x08, 0x67, 0x5A, 0x09, 0x67, 0x90, 0x0A, 0x00, 0x00,
+0x67, 0xD5, 0x90, 0x81, 0x6F, 0xE0, 0xFD, 0x24, 0x81, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83,
+0xE0, 0xFE, 0x74, 0x80, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFD, 0xED, 0xFF,
+0x90, 0x81, 0x79, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, 0xF0, 0x90, 0x81, 0x72, 0xE0, 0xFF, 0x12, 0x2F,
+0x96, 0x90, 0x81, 0x6D, 0x74, 0x02, 0xF0, 0xE1, 0xC6, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x81, 0xF5,
+0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20,
+0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x80, 0xF5,
+0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x4A, 0xCC, 0xC0,
+0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x82, 0xF5, 0x82, 0xE4,
+0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0,
+0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x4A, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06,
+0xC0, 0x07, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x83, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0,
+0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x18, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01,
+0xD0, 0x00, 0x12, 0x4A, 0xCC, 0x90, 0x81, 0x73, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x73, 0x12, 0x4A,
+0xD9, 0x90, 0x85, 0x96, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x77, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12,
+0x2E, 0xE4, 0x90, 0x81, 0x6D, 0x74, 0x04, 0xF0, 0xE1, 0xC6, 0x90, 0x81, 0x72, 0xE0, 0xFD, 0x90,
+0x81, 0x6F, 0xE0, 0x24, 0x80, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF,
+0x12, 0x30, 0xC7, 0x80, 0x19, 0x90, 0x81, 0x72, 0xE0, 0xFD, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x80,
+0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0x6A, 0x90, 0x81,
+0x6D, 0x74, 0x01, 0xF0, 0xE1, 0xC6, 0x90, 0x81, 0x6D, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x6F, 0xE0,
+0x24, 0x81, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78,
+0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0x6F, 0xE0,
+0x24, 0x80, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12,
+0x4A, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0x71, 0xE0, 0xFF, 0xE4,
+0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00,
+0x12, 0x4A, 0xCC, 0x90, 0x81, 0x73, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x70, 0xE0, 0x24, 0xFB, 0xFF,
+0xC0, 0x07, 0x90, 0x81, 0x73, 0x12, 0x4A, 0xD9, 0x90, 0x82, 0x02, 0x12, 0x20, 0xCE, 0x90, 0x81,
+0x72, 0xE0, 0xFD, 0xD0, 0x07, 0x12, 0x5C, 0x77, 0x80, 0x6C, 0x90, 0x81, 0x6D, 0x74, 0x01, 0xF0,
+0x90, 0x81, 0x6F, 0xE0, 0x24, 0x80, 0xF9, 0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89,
+0x15, 0x75, 0x16, 0x01, 0x7B, 0xFE, 0x7A, 0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x72,
+0xE0, 0xFF, 0x90, 0x81, 0x71, 0xE0, 0xFD, 0xE4, 0x90, 0x81, 0xC1, 0xF0, 0x7B, 0x04, 0x80, 0x34,
+0x90, 0x81, 0x6D, 0x74, 0x04, 0xF0, 0x90, 0x81, 0x6F, 0xE0, 0x24, 0x80, 0xF9, 0xE4, 0x34, 0x81,
+0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0x7B, 0xFE, 0x7A, 0x80, 0x79, 0x33,
+0x12, 0x2B, 0xED, 0x90, 0x81, 0x72, 0xE0, 0xFF, 0x90, 0x81, 0x71, 0xE0, 0xFD, 0xE4, 0x90, 0x81,
+0xC1, 0xF0, 0x7B, 0x06, 0xF1, 0xDF, 0x90, 0x81, 0x6D, 0xE0, 0x24, 0x02, 0xFF, 0x90, 0x81, 0x6F,
+0xE0, 0x2F, 0xF0, 0xA1, 0x3E, 0x22, 0x22, 0x90, 0x00, 0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x22, 0xAC,
+0x07, 0xED, 0xAD, 0x04, 0x78, 0x24, 0xF2, 0xED, 0x08, 0xF2, 0xEB, 0xB4, 0x04, 0x07, 0x78, 0x27,
+0x74, 0x01, 0xF2, 0x80, 0x0E, 0xEB, 0x78, 0x27, 0xB4, 0x05, 0x05, 0x74, 0x02, 0xF2, 0x80, 0x03,
+0x74, 0x04, 0xF2, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x00, 0x50, 0x63, 0xE4,
+0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0x21, 0x7D,
+0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xC1, 0xE0, 0x60, 0x2D, 0x74, 0x37,
+0x2E, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xEE, 0xFF, 0x78, 0x25, 0xE2, 0x2F, 0xFF, 0x18, 0xE2, 0x34,
+0x00, 0x8F, 0x82, 0xF5, 0x83, 0xE0, 0x78, 0x29, 0xF2, 0x78, 0x32, 0xE2, 0xFF, 0xF4, 0xFE, 0x78,
+0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x24, 0x08, 0xE2, 0xFF,
+0x08, 0xE2, 0x2F, 0xFF, 0x78, 0x28, 0xE2, 0xFD, 0x12, 0x32, 0x1E, 0x78, 0x26, 0xE2, 0x04, 0xF2,
+0x80, 0xA1, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x07, 0x50, 0x69, 0xE4, 0x78,
+0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0x21, 0x7D, 0x74,
+0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xC1, 0xE0, 0x60, 0x2D, 0x78, 0x26, 0xE2,
+0xFF, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83, 0xE0, 0x78,
+0x29, 0xF2, 0x74, 0x37, 0x2F, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFF, 0xF4, 0xFE, 0x78, 0x29,
+0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x28, 0xE2, 0xFF, 0x78, 0x26,
+0xE2, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83, 0xEF, 0xF0,
+0x78, 0x26, 0xE2, 0x04, 0xF2, 0x80, 0x9B, 0x90, 0x81, 0xC1, 0xE0, 0x60, 0x0F, 0x78, 0x24, 0xE2,
+0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2D, 0x5C, 0x78, 0x2E, 0x12, 0x4A, 0xFE, 0xE4, 0x78, 0x26, 0xF2,
+0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x50, 0x5D, 0x74, 0x33, 0x2E, 0xF8, 0xE2,
+0x78, 0x28, 0xF2, 0x90, 0x81, 0xC1, 0xE0, 0x60, 0x2B, 0x78, 0x2E, 0x12, 0x4A, 0xE5, 0x78, 0x26,
+0xE2, 0xFB, 0x75, 0xF0, 0x08, 0xA4, 0xF9, 0xF8, 0x12, 0x20, 0xA8, 0x78, 0x29, 0xEF, 0xF2, 0x74,
+0x37, 0x2B, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFE, 0xF4, 0x5F, 0xFF, 0x78, 0x28, 0xE2, 0xFD,
+0xEE, 0x5D, 0x4F, 0xF2, 0x78, 0x28, 0xE2, 0xFF, 0x78, 0x26, 0xE2, 0xFD, 0xC3, 0x74, 0x03, 0x9D,
+0xFD, 0xE4, 0x94, 0x00, 0xFC, 0x7B, 0xFE, 0x74, 0x2A, 0x2D, 0xF9, 0x74, 0x80, 0x3C, 0xFA, 0xEF,
+0x12, 0x1F, 0xEA, 0xE2, 0x04, 0xF2, 0x80, 0x98, 0x78, 0x2A, 0x12, 0x4A, 0xE5, 0x90, 0x85, 0xBB,
+0x12, 0x20, 0xCE, 0x78, 0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2E, 0xA2, 0x22, 0xE4, 0xFB,
+0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x4A, 0x4E, 0x90, 0x81, 0xC2, 0xEF, 0xF0, 0x60, 0xF0, 0x31, 0x92,
+0x80, 0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90,
+0x81, 0xC3, 0xF0, 0x90, 0x81, 0xC3, 0xE0, 0xFD, 0x70, 0x02, 0x41, 0xBD, 0x90, 0x82, 0x12, 0xE0,
+0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8,
+0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02, 0x41, 0xB6, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90,
+0x01, 0xD0, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xC4, 0xF0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x81,
+0x75, 0x15, 0xC4, 0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC5, 0x12, 0x2B, 0xED, 0x90,
+0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xC6,
+0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x4B, 0x0A, 0xE0, 0x90,
+0x81, 0xC7, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x4B, 0x0A,
+0xE0, 0x90, 0x81, 0xC8, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12,
+0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xC9, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01,
+0xF1, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xCA, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75, 0xF0, 0x04,
+0x90, 0x01, 0xF2, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xCB, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0x75,
+0xF0, 0x04, 0x90, 0x01, 0xF3, 0x12, 0x4B, 0x0A, 0xE0, 0x90, 0x81, 0xCC, 0xF0, 0x90, 0x81, 0xC3,
+0xE0, 0xFF, 0x90, 0x82, 0x12, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33,
+0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0x81, 0xC3, 0xF0, 0x90, 0x82, 0x12, 0xE0, 0xFF, 0x74, 0x01, 0xA8,
+0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x81, 0xC5, 0xE0,
+0xFF, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC6, 0x12, 0x5A, 0xB5, 0x90, 0x82, 0x12, 0xE0, 0x04, 0xF0,
+0xE0, 0x54, 0x03, 0xF0, 0x21, 0xA3, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92,
+0xAF, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x4A, 0x4E, 0x90, 0x81, 0xD9, 0xEF, 0xF0,
+0x60, 0xF0, 0x51, 0xD6, 0x80, 0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90,
+0x80, 0xD9, 0xE0, 0xFE, 0x90, 0x80, 0xD8, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, 0x02,
+0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13, 0xED, 0x75, 0xF0,
+0x0F, 0xA4, 0x24, 0x42, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x71, 0x2E, 0x7F, 0x01,
+0xEF, 0x60, 0x16, 0x90, 0x80, 0xD8, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F,
+0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0xD8, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10,
+0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xDA, 0x12, 0x4B, 0x1F, 0x90, 0x82, 0x13, 0xE0, 0xFF,
+0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x71, 0x91, 0xEF,
+0x60, 0x3A, 0x90, 0x81, 0xDA, 0x12, 0x4B, 0x16, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00,
+0x0E, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B,
+0xED, 0x90, 0x81, 0xDA, 0x12, 0x4B, 0x16, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE,
+0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB, 0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
+0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x06, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0,
+0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x82, 0x06, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83,
+0xE0, 0x60, 0x2D, 0xC3, 0x90, 0x82, 0x09, 0xE0, 0x94, 0xE8, 0x90, 0x82, 0x08, 0xE0, 0x94, 0x03,
+0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x82, 0x08,
+0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5,
+0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0xDD, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3,
+0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, 0x81, 0xEB, 0xF0, 0x7F, 0x24, 0x7E, 0x08,
+0x12, 0x2D, 0x5C, 0x90, 0x81, 0xE3, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xDD, 0xE0, 0xFB, 0x70, 0x08,
+0x90, 0x81, 0xE3, 0x12, 0x4A, 0xD9, 0x80, 0x16, 0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5,
+0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x81,
+0xE7, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xDE, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12,
+0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xE7, 0x12, 0x4A, 0xD9,
+0xED, 0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC, 0x12, 0x4A, 0xCC, 0xEC, 0x44, 0x80, 0xFC, 0x90,
+0x81, 0xE7, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xE3, 0x12, 0x4A, 0xD9, 0xEC, 0x54, 0x7F, 0xFC, 0x90,
+0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xDD, 0xE0,
+0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3,
+0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xE7, 0x12, 0x4A, 0xD9, 0x90, 0x85, 0xBB, 0x12,
+0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xE3, 0x12, 0x4A, 0xD9, 0xEC,
+0x44, 0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2,
+0x90, 0x81, 0xDD, 0xE0, 0x70, 0x04, 0x7F, 0x20, 0x80, 0x09, 0x90, 0x81, 0xDD, 0xE0, 0xB4, 0x01,
+0x16, 0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01,
+0xFF, 0xE4, 0x90, 0x81, 0xEB, 0xEF, 0xF0, 0x90, 0x81, 0xEB, 0xE0, 0x90, 0x81, 0xDD, 0x60, 0x0E,
+0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75,
+0xF0, 0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0,
+0xFF, 0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x90, 0x81, 0xDF, 0x12, 0x20, 0xCE,
+0x90, 0x81, 0xDF, 0x02, 0x4A, 0xD9, 0x90, 0x81, 0xEC, 0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x81, 0xF2,
+0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12,
+0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xEE, 0x12, 0x4A, 0xD9,
+0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x4A, 0xCC, 0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x81, 0xF2,
+0x12, 0x20, 0xCE, 0x90, 0x81, 0xEC, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4,
+0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xF2,
+0x12, 0x4A, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2,
+0xE0, 0x44, 0x02, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x39, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD,
+0x7F, 0x54, 0x7E, 0x01, 0x8E, 0x19, 0x8F, 0x1A, 0xE5, 0x1E, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0,
+0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, 0xE5, 0x1D, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF,
+0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33, 0x54,
+0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83,
+0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, 0x1A, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x03,
+0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x22, 0xE4,
+0x90, 0x81, 0x51, 0xF0, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x81, 0x51, 0xF0, 0xE0, 0x54, 0xC0, 0x70,
+0x0D, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x4D, 0x29, 0x90, 0x81,
+0x51, 0xE0, 0x30, 0xE6, 0x21, 0x90, 0x81, 0x27, 0xE0, 0x64, 0x01, 0x70, 0x20, 0x90, 0x81, 0x2B,
+0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xF1, 0x3D,
+0x80, 0x0B, 0xD1, 0x6C, 0x80, 0x07, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x51,
+0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, 0x10, 0xB1, 0x90, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90,
+0x81, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0x01, 0x5F, 0xE4,
+0xF0, 0x90, 0x01, 0x3C, 0x74, 0x08, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13,
+0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0xB1, 0xA4, 0x90, 0x01, 0x5F,
+0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x10, 0xF0,
+0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x08, 0x12, 0x4D, 0x3D, 0xE4, 0xFF, 0x12, 0x56, 0xA8,
+0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x81, 0x51, 0xF0, 0xE0, 0xFD, 0x54, 0xC0, 0x70, 0x09, 0x90,
+0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x80, 0x71, 0xED, 0x30, 0xE6, 0x4B, 0x90, 0x81, 0x27, 0xE0,
+0x64, 0x02, 0x70, 0x2A, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC3, 0x13, 0x20, 0xE0, 0x09, 0x90, 0x81,
+0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x28, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x01, 0x70,
+0x2D, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x04, 0xF0, 0x7F, 0x01, 0xF1, 0x74, 0x80, 0x20, 0x90, 0x81,
+0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xF1,
+0x3D, 0x80, 0x0B, 0xD1, 0x6C, 0x80, 0x07, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81,
+0x51, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, 0x10, 0xB1, 0x90, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0,
+0x90, 0x81, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0x04, 0x1D,
+0xE0, 0x70, 0x14, 0x90, 0x80, 0x3E, 0xE0, 0xFF, 0xE4, 0xFD, 0x12, 0x57, 0x31, 0x8E, 0x4E, 0x8F,
+0x4F, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x14, 0x90,
+0x81, 0x27, 0xE0, 0x60, 0x0E, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0x80,
+0xCC, 0xD1, 0x6C, 0x22, 0x8F, 0x4E, 0x12, 0x77, 0x5A, 0xBF, 0x01, 0x19, 0x90, 0x80, 0x40, 0xE0,
+0xFF, 0x7D, 0x01, 0x12, 0x57, 0x31, 0xAD, 0x07, 0xAC, 0x06, 0xAF, 0x4E, 0x12, 0x56, 0xE6, 0x90,
+0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0x90, 0x81, 0x40, 0xE0, 0x30, 0xE0, 0x0C, 0xE4, 0xF5, 0x1D,
+0xA3, 0xB1, 0x9A, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x01, 0xBE, 0xE0, 0x04, 0xF0, 0x22,
+0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x18, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x12, 0x90, 0x01,
+0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xB1, 0x93, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0,
+0x22, 0x90, 0x81, 0xF6, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xAD, 0x03, 0xAC, 0x02, 0xE4, 0x90, 0x81,
+0xFE, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0xC4, 0x74, 0xD1, 0xF0, 0x74, 0x6F, 0xA3, 0xF0, 0xEC, 0x54,
+0x3F, 0xFC, 0x90, 0x01, 0x40, 0xED, 0xF0, 0xAE, 0x04, 0xEE, 0xA3, 0xF0, 0x90, 0x81, 0xF6, 0xE0,
+0x24, 0x81, 0x60, 0x34, 0x24, 0xDA, 0x60, 0x1C, 0x24, 0x3C, 0x70, 0x41, 0x90, 0x81, 0xF7, 0xE0,
+0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0x90, 0x81, 0xFB, 0xF0, 0xA3, 0x74, 0x69, 0xF0, 0xA3, 0x74,
+0x80, 0xF0, 0x80, 0x2C, 0x90, 0x81, 0xF7, 0xE0, 0x54, 0x01, 0x90, 0x81, 0xFB, 0xF0, 0xA3, 0x74,
+0xA5, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x80, 0x18, 0x90, 0x81, 0xF7, 0xE0, 0xC4, 0x54, 0x10, 0x90,
+0x81, 0xFB, 0xF0, 0xA3, 0x74, 0x7F, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0x80, 0x03, 0x7F, 0x00, 0x22,
+0x90, 0x81, 0xFC, 0xE0, 0x90, 0x01, 0x06, 0xF0, 0x90, 0x81, 0xFB, 0xE0, 0x60, 0x0E, 0x90, 0x01,
+0x42, 0xF0, 0x90, 0x81, 0xFA, 0xE0, 0x90, 0x01, 0x43, 0xF0, 0x80, 0x0D, 0x90, 0x01, 0x43, 0xE4,
+0xF0, 0x90, 0x81, 0xFB, 0xE0, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x81, 0xFD, 0xE0, 0xFF, 0x90, 0x01,
+0x42, 0xE0, 0x5F, 0xFF, 0x90, 0x81, 0xFB, 0xE0, 0x6F, 0x60, 0xEE, 0x74, 0xD1, 0x04, 0x90, 0x01,
+0xC4, 0xF0, 0x74, 0x6F, 0xA3, 0xF0, 0x90, 0x01, 0x43, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x02,
+0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80, 0x3D, 0xF0, 0x90,
+0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3E, 0xF0, 0x90, 0x00, 0x02, 0x12,
+0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF,
+0xED, 0x2F, 0x90, 0x80, 0x40, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED,
+0x2F, 0x90, 0x80, 0x41, 0xF0, 0x22, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0x30, 0xE0, 0x26,
+0x12, 0x1F, 0xA4, 0x90, 0x81, 0x38, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x39,
+0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F,
+0xBD, 0x90, 0x81, 0x3B, 0xF0, 0x22, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0,
+0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x8F, 0x0D, 0x22, 0x8F,
+0x0E, 0x22, 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, 0x32, 0x1E, 0xE4, 0xFD,
+0x7F, 0x51, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x53,
+0x02, 0x32, 0x1E, 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, 0x32, 0x1E, 0x7D,
+0xFF, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F,
+0x57, 0x02, 0x32, 0x1E, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x01, 0x9C, 0x74, 0x7E,
+0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74, 0x24, 0xF0, 0x90, 0x01, 0x9B,
+0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01, 0x99, 0xE4, 0xF0, 0x90, 0x01,
+0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x56, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x98, 0xE0, 0x7F,
+0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3E, 0xC3, 0x90, 0x81, 0x57, 0xE0,
+0x94, 0x88, 0x90, 0x81, 0x56, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x10,
+0xF0, 0x22, 0x90, 0x81, 0x56, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9, 0x7F, 0x14, 0x7E, 0x00,
+0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x57, 0xE0, 0x94, 0x32, 0x90, 0x81, 0x56, 0xE0, 0x94, 0x00,
+0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB2, 0x22, 0x7F, 0x02, 0x90, 0x81, 0x46, 0xE0,
+0xFE, 0xEF, 0xC3, 0x9E, 0x50, 0x18, 0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B,
+0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xDE, 0x7F, 0x01,
+0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, 0xA3, 0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3,
+0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, 0xF5, 0x44, 0x90, 0x01, 0x34, 0xE5, 0x41,
+0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, 0xA3, 0xE5, 0x44, 0xF0, 0x22, 0x90, 0x01,
+0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, 0x46, 0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47,
+0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, 0x01, 0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5,
+0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, 0xF0, 0x53, 0x91, 0xDF, 0x22, 0x90, 0x81,
+0x50, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x05, 0xFC,
+0xE0, 0x04, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x10, 0xA3, 0x74, 0x01, 0xF0, 0x90, 0x81,
+0x1F, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x51, 0xCF, 0x71, 0xF9, 0x02, 0x5F, 0x72, 0xD3,
+0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x04, 0x7F, 0x04, 0x80,
+0x0C, 0x12, 0x4F, 0xE3, 0xBF, 0x01, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x02, 0x12, 0x55, 0xA3,
+0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3D, 0x90, 0x81, 0x23,
+0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, 0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D, 0x00, 0xB4, 0x04,
+0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, 0x23, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x80, 0xB0, 0x71,
+0x82, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x08, 0x06, 0xE4, 0xFD, 0x7F, 0x0C, 0x80, 0x09, 0x90, 0x81,
+0x23, 0xE0, 0x70, 0x06, 0xFD, 0x7F, 0x04, 0x12, 0x4D, 0x41, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF,
+0x30, 0xE0, 0x3E, 0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, 0x7E, 0x01, 0x90, 0x81,
+0x22, 0xE0, 0x7D, 0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, 0x24, 0xEF, 0xC3, 0x13,
+0x30, 0xE0, 0x02, 0x41, 0xCF, 0x71, 0xAA, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x0C, 0x06, 0xE4, 0xFD,
+0x7F, 0x08, 0x80, 0x0A, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x04, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x4D,
+0x41, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x0F, 0x90,
+0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x07, 0x7D, 0x01, 0x7F, 0x02, 0x12, 0x4D, 0x41, 0x90, 0x81,
+0x23, 0xE0, 0x64, 0x02, 0x60, 0x03, 0x12, 0x4F, 0xC8, 0x22, 0x90, 0x01, 0x57, 0xE0, 0x60, 0x48,
+0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x54,
+0x3F, 0x30, 0xE0, 0x0C, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x22,
+0x90, 0x81, 0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x38,
+0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0E, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01,
+0x07, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x51, 0xF0, 0x90, 0x81,
+0x27, 0xE0, 0x70, 0x02, 0x81, 0xA8, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x81, 0xA8,
+0x90, 0x81, 0x26, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70,
+0x21, 0x90, 0x81, 0x2E, 0xE0, 0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, 0x90, 0x81, 0x30, 0xE0, 0x60,
+0x11, 0xEF, 0x70, 0x08, 0x90, 0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x80, 0x00, 0x90, 0x81, 0x51, 0x74,
+0x01, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x16, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05,
+0xE4, 0x90, 0x81, 0x51, 0xF0, 0x12, 0x4F, 0xE3, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x51, 0xF0, 0x90,
+0x81, 0x51, 0xE0, 0x60, 0x43, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x30, 0xE0,
+0x60, 0x03, 0xB4, 0x01, 0x09, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x80, 0x0D, 0xE4, 0xF5,
+0x1D, 0x90, 0x81, 0x30, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x81, 0x2F, 0xE0,
+0x2F, 0x12, 0x6D, 0x9B, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2,
+0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, 0x4D, 0x41, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70,
+0x26, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74,
+0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0,
+0x54, 0x07, 0x70, 0x03, 0x12, 0x4D, 0x29, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x07, 0x90, 0x81,
+0x1F, 0xE0, 0x30, 0xE0, 0x12, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x09, 0x12, 0x4F, 0xE3, 0xBF,
+0x01, 0x05, 0x02, 0x4F, 0xC8, 0x91, 0xF8, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x64, 0x01, 0x70, 0x4E,
+0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x39, 0x12, 0x4D, 0x3D, 0x90, 0x01, 0x5B, 0xE4, 0xF0,
+0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54,
+0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x6D, 0xA4, 0x90, 0x01, 0x5B,
+0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x08, 0xF0,
+0x22, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, 0x4D, 0x41, 0x22, 0x12,
+0x4F, 0xFC, 0xEF, 0x70, 0x02, 0x91, 0xF8, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x35, 0x90, 0x06,
+0x92, 0xE0, 0x30, 0xE0, 0x24, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F,
+0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x6D, 0xA4, 0x90, 0x01, 0x5B, 0x74,
+0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0,
+0x12, 0x4D, 0x29, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x35, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1,
+0x24, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB,
+0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x6D, 0xA4, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06,
+0x92, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xEF, 0xF0, 0x12, 0x4D, 0x29, 0x22,
+0xD1, 0x28, 0x90, 0x81, 0x52, 0xEF, 0xF0, 0x90, 0x81, 0x24, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01,
+0xF0, 0x80, 0x04, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x52, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01,
+0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90,
+0x81, 0x24, 0xE0, 0x30, 0xE0, 0x1A, 0x90, 0x81, 0x32, 0xE4, 0xF0, 0xA3, 0x74, 0x07, 0xF0, 0x90,
+0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x22,
+0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x53, 0xF0, 0xA3, 0xF0, 0xA3,
+0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x81,
+0x53, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x81, 0x55, 0xE0, 0x94, 0x64, 0x90, 0x81,
+0x54, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x53,
+0xE0, 0xFF, 0x22, 0x90, 0x81, 0x54, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x4A, 0xA9, 0x80, 0xC2, 0x90,
+0x81, 0x4F, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x05,
+0xFD, 0xE0, 0x04, 0xF0, 0x22, 0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03,
+0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25, 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, 0x4D, 0x29, 0xE4, 0xFF, 0x90, 0x81, 0x4A, 0xE0,
+0x30, 0xE0, 0x48, 0x90, 0x81, 0x4E, 0xE0, 0xFD, 0x60, 0x41, 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, 0x81, 0x4E, 0xF0, 0x22, 0x90, 0x81, 0x4C, 0xE0, 0xD3, 0x9D,
+0x50, 0x10, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0xF1, 0x0C, 0x90, 0x81, 0x4A, 0xE0, 0x54, 0xFE,
+0xF0, 0x22, 0x12, 0x56, 0xA6, 0x90, 0x81, 0x4E, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80, 0x3C, 0xE0,
+0x64, 0x02, 0x60, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0,
+0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04,
+0xE0, 0xE0, 0x90, 0x81, 0x25, 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, 0x81, 0x27,
+0xE0, 0x60, 0x03, 0x12, 0x4D, 0x29, 0x7F, 0x01, 0xC1, 0xBC, 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, 0xC3, 0xEE, 0x94, 0x01, 0x40, 0x0A, 0x0D, 0xED,
+0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 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, 0xEF, 0x14,
+0x90, 0x05, 0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F,
+0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE,
+0xF0, 0x22, 0x74, 0x45, 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, 0x82, 0x1B, 0xED, 0xF0, 0x90, 0x82, 0x1A, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70,
+0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90,
+0x00, 0x47, 0xE0, 0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x1A, 0xE0, 0xFF, 0x74,
+0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F,
+0xFD, 0x7F, 0x46, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x1B, 0xE0, 0x60, 0x18, 0x90, 0x82, 0x1A, 0xE0,
+0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45,
+0xE0, 0x4F, 0x80, 0x17, 0x90, 0x82, 0x1A, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02,
+0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E,
+0x90, 0x82, 0x1A, 0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08,
+0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43,
+0x12, 0x32, 0x1E, 0x90, 0x82, 0x1A, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3,
+0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90,
+0x82, 0x1B, 0xE0, 0x60, 0x1D, 0x90, 0x82, 0x1A, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07,
+0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42,
+0x80, 0x1C, 0x90, 0x82, 0x1A, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02,
+0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32,
+0x1E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, 0x81, 0x27, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x26,
+0xE0, 0x54, 0x0F, 0xF0, 0x54, 0xF0, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xF7,
+0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x2D, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x24, 0xE0,
+0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x2F,
+0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x2B,
+0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x29, 0x74, 0x0C, 0xF0, 0x90, 0x81,
+0x24, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54,
+0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0,
+0x90, 0x81, 0x34, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0x90, 0x80, 0x3C, 0xE0, 0xB4, 0x01,
+0x08, 0x90, 0x81, 0x31, 0x74, 0x99, 0xF0, 0x80, 0x12, 0x90, 0x80, 0x3C, 0xE0, 0x90, 0x81, 0x31,
+0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80, 0x03, 0x74, 0x40, 0xF0, 0x90, 0x81, 0x38, 0x74, 0x01,
+0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0,
+0xE4, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF,
+0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0C,
+0x04, 0x70, 0x28, 0x90, 0x81, 0x2D, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, 0x90,
+0x81, 0x3B, 0xE0, 0x90, 0x81, 0x2D, 0xF0, 0x80, 0x05, 0x90, 0x81, 0x2D, 0xED, 0xF0, 0x90, 0x81,
+0x2D, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x12, 0x4F, 0xFC, 0xEF,
+0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x2B, 0xE0,
+0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x29,
+0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF,
+0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x38, 0x90, 0x81, 0x2B, 0xE0, 0x30,
+0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, 0x29, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13,
+0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x3E,
+0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x80, 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, 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, 0x42, 0x90, 0x80, 0xDE,
+0xE0, 0x64, 0x01, 0x70, 0x3A, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x05, 0x22, 0x74,
+0x0F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF, 0x12, 0x56, 0xA8, 0xBF, 0x01,
+0x12, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x06, 0xF0, 0x90, 0x81,
+0x23, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22,
+0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x02, 0xF0, 0x90, 0x05, 0x27, 0xE0,
+0x54, 0xBF, 0xF0, 0x90, 0x81, 0x23, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90,
+0x81, 0x2A, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x23, 0x74,
+0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x52, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x59, 0x90, 0x80,
+0xDE, 0xE0, 0x64, 0x01, 0x70, 0x51, 0x90, 0x81, 0x52, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x2E, 0xF0,
+0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x16, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90,
+0x81, 0x52, 0xF0, 0x12, 0x4F, 0xE3, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x52, 0xF0, 0x90, 0x81, 0x52,
+0xE0, 0x60, 0x24, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x2F,
+0x12, 0x6D, 0x9A, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07,
+0x7D, 0x01, 0x7F, 0x04, 0x12, 0x4D, 0x41, 0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x54,
+0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54,
+0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x81, 0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54,
+0xEF, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0xFF, 0xB4, 0x01, 0x02, 0x80, 0x04, 0xEF, 0xB4, 0x02, 0x06,
+0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3,
+0x9F, 0x40, 0x0F, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x0B, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB,
+0xF0, 0x22, 0x12, 0x4D, 0x29, 0x22, 0x22, 0x90, 0x05, 0x2B, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02,
+0x7F, 0x01, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90,
+0x81, 0x22, 0x74, 0x01, 0xF0, 0x22, 0x91, 0x03, 0x02, 0x57, 0xE5, 0x90, 0x05, 0x22, 0x74, 0xFF,
+0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, 0x90,
+0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x22, 0x04, 0xF0, 0x22, 0x91, 0x2F, 0x02, 0x57, 0xE5, 0x90,
+0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74,
+0x04, 0xF0, 0x22, 0x90, 0x81, 0x22, 0xE0, 0x64, 0x02, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22,
+0x90, 0x80, 0x3F, 0xE0, 0xFF, 0x7D, 0x01, 0x12, 0x57, 0x31, 0x8E, 0x54, 0x8F, 0x55, 0xAD, 0x55,
+0xAC, 0x54, 0xAF, 0x53, 0x12, 0x56, 0xE6, 0xAF, 0x55, 0xAE, 0x54, 0x90, 0x04, 0x80, 0xE0, 0x54,
+0x0F, 0xFD, 0xAC, 0x07, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44,
+0x01, 0xF0, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0,
+0xAC, 0x07, 0x74, 0x16, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0,
+0x74, 0x15, 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, 0x0F, 0xF0, 0x90, 0x04,
+0x53, 0xE4, 0xF0, 0x90, 0x04, 0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50,
+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,
+0x80, 0x3F, 0xE0, 0xFE, 0x90, 0x04, 0x1C, 0xE0, 0x6E, 0x70, 0x40, 0x90, 0x81, 0x2A, 0xE0, 0xFE,
+0x64, 0x0E, 0x70, 0x1C, 0xEF, 0x70, 0x34, 0x90, 0x81, 0x24, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06,
+0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x22,
+0xEE, 0xB4, 0x06, 0x17, 0xEF, 0x60, 0x14, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06,
+0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0xC3,
+0x13, 0xFD, 0xEF, 0x30, 0xE0, 0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06, 0x22,
+0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x80, 0xDB, 0xE0, 0x9B,
+0x90, 0x80, 0xDA, 0xE0, 0x9A, 0x50, 0x13, 0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0xDA, 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, 0x12, 0x1F,
+0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x47, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13,
+0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x48, 0xF0, 0x22, 0x90, 0x81,
+0x4A, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x81, 0x4D, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x81, 0x4B,
+0xE0, 0xB5, 0x07, 0x1E, 0x90, 0x06, 0x92, 0xE0, 0x54, 0x1C, 0x70, 0x0B, 0x12, 0x56, 0xA6, 0x90,
+0x81, 0x4E, 0xE0, 0x04, 0xF0, 0x80, 0x06, 0x90, 0x06, 0x92, 0x74, 0x1C, 0xF0, 0xE4, 0x90, 0x81,
+0x4D, 0xF0, 0x22, 0x00, 0x74, 0x53,
+};
+u4Byte ArrayLength_MP_8188E_FW_NIC_S = 15894;
+
+
+void
+ODM_ReadFirmware_MP_8188E_FW_NIC_S(
+ 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_8188E_FW_NIC_S;
+#else
+ ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_NIC_S, ArrayLength_MP_8188E_FW_NIC_S);
+#endif
+ *pFirmwareSize = ArrayLength_MP_8188E_FW_NIC_S;
+}
+
+
+u1Byte Array_MP_8188E_FW_NIC_T[] = {
+0xE1, 0x88, 0x10, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x01, 0x21, 0x11, 0x27, 0x30, 0x36, 0x00, 0x00,
+0x2D, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x02, 0x45, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xC1, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xA1, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x56, 0xF7, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x42, 0x04, 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, 0x89, 0xF8, 0xE6, 0xBC, 0x03, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00,
+0x40, 0xCE, 0x79, 0x04, 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, 0x04, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30,
+0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x88, 0x25, 0x0C, 0xF8,
+0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8,
+0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5,
+0x0C, 0x24, 0x89, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD,
+0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x88,
+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, 0x88, 0xA6,
+0x81, 0x74, 0x03, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x04, 0xE4, 0x78, 0x80,
+0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x45, 0xDE, 0x74, 0x01, 0x93,
+0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2,
+0x8C, 0xD2, 0xAF, 0x22, 0x03, 0xEF, 0xD3, 0x94, 0x03, 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, 0x88, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18,
+0xBE, 0x03, 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, 0x88, 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, 0x88, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F,
+0x04, 0x90, 0x45, 0xDE, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3,
+0x94, 0x03, 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, 0x88, 0x2F,
+0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x42, 0x4D, 0x50, 0x2E, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xBF, 0x03,
+0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x88, 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, 0x89, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01,
+0x0F, 0x74, 0x88, 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, 0x03, 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, 0x42, 0x4C, 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, 0x42, 0x4D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF,
+0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0,
+0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 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, 0xE2, 0xFC, 0x08, 0xE2, 0xFD, 0x08, 0xE2, 0xFE, 0x08, 0xE2, 0xFF,
+0x22, 0xE2, 0xFB, 0x08, 0xE2, 0xF9, 0x08, 0xE2, 0xFA, 0x08, 0xE2, 0xCB, 0xF8, 0x22, 0xEC, 0xF2,
+0x08, 0xED, 0xF2, 0x08, 0xEE, 0xF2, 0x08, 0xEF, 0xF2, 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, 0x45,
+0x8C, 0x02, 0x42, 0xDD, 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, 0x45, 0xD1, 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, 0x00, 0x41, 0x82, 0x09, 0x00, 0x41, 0x82, 0x0A, 0x00, 0x41, 0x82, 0x17, 0x00, 0x59, 0xE2,
+0x5C, 0x24, 0x5E, 0x5D, 0x5F, 0xA1, 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, 0x90, 0x01, 0xC4, 0x74, 0xE6, 0xF0, 0x74, 0x45, 0xA3, 0xF0, 0xD1, 0x35, 0x74,
+0xE6, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x45, 0xA3, 0xF0, 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, 0x00, 0x54, 0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55,
+0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5, 0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD,
+0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F,
+0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57, 0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 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, 0x90, 0x01, 0xC4, 0x74,
+0x6F, 0xF0, 0x74, 0x46, 0xA3, 0xF0, 0x12, 0x6C, 0x78, 0xE5, 0x41, 0x30, 0xE4, 0x04, 0x7F, 0x02,
+0x91, 0x27, 0xE5, 0x41, 0x30, 0xE6, 0x03, 0x12, 0x6C, 0xD5, 0xE5, 0x43, 0x30, 0xE0, 0x03, 0x12,
+0x51, 0xC2, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x4D, 0x0C, 0xE5, 0x43, 0x30, 0xE2, 0x03, 0x12,
+0x4C, 0xC1, 0xE5, 0x43, 0x30, 0xE3, 0x03, 0x12, 0x6C, 0xE2, 0xE5, 0x43, 0x30, 0xE4, 0x03, 0x12,
+0x6D, 0x04, 0xE5, 0x43, 0x30, 0xE5, 0x03, 0x12, 0x6D, 0x33, 0xE5, 0x43, 0x30, 0xE6, 0x02, 0xF1,
+0x0F, 0xE5, 0x44, 0x30, 0xE1, 0x03, 0x12, 0x51, 0x7F, 0x74, 0x6F, 0x04, 0x90, 0x01, 0xC4, 0xF0,
+0x74, 0x46, 0xA3, 0xF0, 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,
+0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x13, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0D, 0x90, 0x81, 0x2B, 0xE0,
+0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, 0xF1, 0x2A, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x90, 0x81,
+0x29, 0x30, 0xE0, 0x05, 0xE0, 0xFF, 0x02, 0x74, 0x8F, 0xE0, 0xFF, 0x7D, 0x01, 0xD3, 0x10, 0xAF,
+0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x13, 0xED, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x90, 0x82, 0x14,
+0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x03, 0x02, 0x48,
+0xA0, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x03, 0x02, 0x48, 0xA0, 0x90, 0x82,
+0x14, 0xE0, 0xFE, 0x6F, 0x70, 0x03, 0x02, 0x48, 0xA0, 0xEF, 0x70, 0x03, 0x02, 0x48, 0x17, 0x24,
+0xFE, 0x70, 0x03, 0x02, 0x48, 0x50, 0x24, 0xFE, 0x60, 0x51, 0x24, 0xFC, 0x70, 0x03, 0x02, 0x48,
+0x8B, 0x24, 0xFC, 0x60, 0x03, 0x02, 0x48, 0xA0, 0xEE, 0xB4, 0x0E, 0x03, 0x12, 0x49, 0x5E, 0x90,
+0x82, 0x14, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12, 0x49, 0x93, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06,
+0x03, 0x12, 0x49, 0x34, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0x82, 0x13, 0xE0, 0xFF,
+0x60, 0x05, 0x12, 0x73, 0x75, 0x80, 0x03, 0x12, 0x66, 0x26, 0x90, 0x82, 0x14, 0xE0, 0x64, 0x08,
+0x60, 0x03, 0x02, 0x48, 0xA0, 0x12, 0x73, 0xD3, 0x02, 0x48, 0xA0, 0x90, 0x82, 0x14, 0xE0, 0x70,
+0x05, 0x7F, 0x01, 0x12, 0x49, 0x93, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, 0x03, 0x12, 0x49, 0x34,
+0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x09, 0x12, 0x48, 0xA5, 0xBF, 0x01, 0x03, 0x12, 0x49, 0x5E,
+0x90, 0x82, 0x14, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0x01, 0xA0, 0x11, 0xA5, 0xEF, 0x64, 0x01, 0x60,
+0x02, 0x01, 0xA0, 0x11, 0xFA, 0x01, 0xA0, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x07, 0x11, 0xA5,
+0xBF, 0x01, 0x02, 0x31, 0x5E, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, 0x02, 0x31, 0x34, 0x90, 0x82,
+0x14, 0xE0, 0xB4, 0x0C, 0x07, 0x11, 0xA5, 0xBF, 0x01, 0x02, 0x11, 0xFA, 0x90, 0x82, 0x14, 0xE0,
+0x64, 0x04, 0x70, 0x5C, 0x12, 0x72, 0xF5, 0xEF, 0x64, 0x01, 0x70, 0x54, 0x31, 0xBE, 0x80, 0x50,
+0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x07, 0x11, 0xA5, 0xBF, 0x01, 0x02, 0x31, 0x5E, 0x90, 0x82,
+0x14, 0xE0, 0xB4, 0x06, 0x02, 0x31, 0x34, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0C, 0x07, 0x11, 0xA5,
+0xBF, 0x01, 0x02, 0x11, 0xFA, 0x90, 0x82, 0x14, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x31, 0x93, 0x90,
+0x82, 0x14, 0xE0, 0xB4, 0x04, 0x1A, 0x12, 0x73, 0xBB, 0x80, 0x15, 0x90, 0x82, 0x14, 0xE0, 0xB4,
+0x0C, 0x0E, 0x90, 0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0x31, 0xB1,
+0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD1, 0xAB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74,
+0x01, 0xF0, 0x80, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0,
+0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x28, 0xEF, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x08,
+0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x29, 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, 0x80, 0xDE, 0xE0, 0x64, 0x01,
+0x70, 0x31, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x7F,
+0x01, 0xF1, 0x0D, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A,
+0x74, 0x0E, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01,
+0xB8, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x25, 0xE0, 0x90, 0x06, 0x04, 0x20, 0xE0, 0x0C, 0xE0, 0x44,
+0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x80, 0x0E, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81,
+0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x81,
+0x25, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x08, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x80, 0x1E, 0x90,
+0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0,
+0x90, 0x05, 0x27, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x23, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x22,
+0xE4, 0xF0, 0x22, 0x90, 0x82, 0x15, 0xEF, 0xF0, 0x12, 0x54, 0x65, 0x90, 0x82, 0x15, 0xE0, 0x60,
+0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x90, 0x81, 0x23, 0xF0,
+0x22, 0x31, 0xE3, 0x90, 0x81, 0x2A, 0x74, 0x08, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x05,
+0x22, 0x74, 0xFF, 0xF0, 0xF1, 0x3A, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x51,
+0x57, 0x31, 0xE3, 0xE4, 0x90, 0x81, 0x2A, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x05, 0x22,
+0x74, 0xFF, 0xF0, 0xF1, 0x3A, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F,
+0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14,
+0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00,
+0x00, 0xE4, 0xFD, 0xFF, 0x12, 0x55, 0x1C, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44,
+0x80, 0xFC, 0x90, 0x82, 0x05, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x05, 0x12, 0x44, 0xD9, 0x90, 0x85,
+0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F,
+0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x01,
+0x34, 0x74, 0x40, 0xF0, 0xFD, 0xE4, 0xFF, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74,
+0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01,
+0xC3, 0xC0, 0xD0, 0xE4, 0x90, 0x81, 0xCB, 0xF0, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90,
+0x81, 0x1F, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F,
+0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81,
+0x1F, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE,
+0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x1F, 0xF0, 0xEE, 0x54, 0x20, 0xFE,
+0xEF, 0x54, 0xDF, 0x4E, 0xF0, 0x12, 0x1F, 0xA4, 0xC3, 0x13, 0x20, 0xE0, 0x02, 0x61, 0x5E, 0x90,
+0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x6D, 0x90, 0x81, 0xCB, 0x74, 0x21, 0xF0, 0xEF, 0x13, 0x13,
+0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x51, 0x4E, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x08, 0xF0, 0x80, 0x0C,
+0xE4, 0x90, 0x81, 0x20, 0xF0, 0xA3, 0xF0, 0x7D, 0x40, 0xFF, 0x91, 0x26, 0x90, 0x81, 0x1F, 0xE0,
+0xFD, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x12, 0xF0,
+0xED, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x14, 0xF0, 0x90, 0x81,
+0x1F, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x80, 0xF0,
+0x90, 0x81, 0xCB, 0xE0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x22, 0xE0, 0x60, 0x02, 0x81, 0x17,
+0x7F, 0x01, 0x80, 0x15, 0x90, 0x81, 0xCB, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81,
+0x22, 0xE0, 0x64, 0x04, 0x60, 0x02, 0x81, 0x17, 0xFF, 0x12, 0x53, 0x0E, 0x81, 0x17, 0x90, 0x81,
+0x1F, 0xE0, 0xFF, 0x20, 0xE0, 0x02, 0x61, 0xE7, 0x90, 0x81, 0xCB, 0x74, 0x31, 0xF0, 0xEF, 0x13,
+0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x51, 0x4E, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x08, 0xF0, 0x80,
+0x06, 0x7D, 0x40, 0xE4, 0xFF, 0x91, 0x26, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x13, 0x13, 0x13, 0x54,
+0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x02, 0xF0, 0xED, 0xC4, 0x54, 0x0F, 0x30,
+0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x81, 0xCB, 0xE0, 0x90, 0x05, 0x27,
+0xF0, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x70, 0x1D, 0xFD, 0x7F, 0x04, 0x12, 0x47, 0x3D, 0x12,
+0x51, 0x73, 0xBF, 0x01, 0x09, 0x90, 0x81, 0x29, 0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x03, 0xE4, 0xFD,
+0xFF, 0x12, 0x47, 0x3D, 0x80, 0x41, 0x90, 0x81, 0x2A, 0xE0, 0x90, 0x81, 0x23, 0xF0, 0x90, 0x05,
+0x27, 0xE0, 0x44, 0x40, 0xF0, 0x80, 0x30, 0x90, 0x81, 0xCB, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27,
+0xF0, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x06, 0x7D, 0x01, 0x7F, 0x04, 0x80, 0x0B, 0x90, 0x81,
+0x23, 0xE0, 0xB4, 0x08, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0xD1, 0x34, 0x90, 0x81,
+0x29, 0x12, 0x47, 0x39, 0x12, 0x5A, 0xA7, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7D, 0x02, 0x7F, 0x02,
+0x91, 0x26, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE,
+0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xEF, 0x70,
+0x37, 0x7D, 0x78, 0x7F, 0x02, 0x91, 0x26, 0x7D, 0x02, 0x7F, 0x03, 0x91, 0x26, 0x7D, 0xC8, 0x7F,
+0x02, 0x12, 0x71, 0x8F, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x7D,
+0x01, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0,
+0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, 0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74,
+0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x51, 0x57, 0x7D, 0x02, 0x7F, 0x03, 0x51, 0x57, 0x90, 0x06, 0x0A,
+0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x80, 0xDE,
+0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20,
+0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, 0x47, 0x3D, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0,
+0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x08, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60,
+0x3A, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x04, 0xEF, 0x30, 0xE0, 0x0A, 0x90, 0x81, 0x2A, 0xE0, 0x64,
+0x02, 0x60, 0x28, 0xB1, 0x83, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0,
+0x14, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0xF1, 0xCD, 0x91, 0x1C, 0x90,
+0x81, 0x2E, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0,
+0x30, 0xE0, 0x06, 0x90, 0x81, 0x21, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x45, 0x90,
+0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0,
+0x30, 0xE4, 0x0B, 0x91, 0x1C, 0x90, 0x81, 0x2D, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x82,
+0x0B, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0xC3, 0x90, 0x82, 0x0C, 0xE0, 0x94, 0x80, 0x90,
+0x82, 0x0B, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0,
+0xE0, 0x44, 0x01, 0xF0, 0x12, 0x75, 0xF8, 0xD1, 0xD6, 0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x0C,
+0xE4, 0xF5, 0x1D, 0xA3, 0xF1, 0xFB, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x01, 0xBE, 0xE0,
+0x04, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xC1, 0x23, 0x90, 0x81, 0x27,
+0xE0, 0x70, 0x02, 0xC1, 0x23, 0x90, 0x81, 0x26, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x22,
+0x90, 0x06, 0xAB, 0xE0, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x90, 0x81, 0x2D, 0xF0,
+0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x81, 0x2D, 0xE0, 0xFE, 0xFF, 0x80, 0x00, 0x90, 0x81, 0x2E,
+0xEF, 0xF0, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81,
+0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74,
+0x02, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x26, 0xE0,
+0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0,
+0x05, 0x12, 0x6D, 0xF2, 0x80, 0x03, 0x12, 0x6E, 0xC9, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13,
+0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x04, 0xF1,
+0xCD, 0x91, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x07, 0x90, 0x81, 0x25, 0xE0,
+0x44, 0x04, 0xF0, 0x22, 0xD1, 0xAB, 0xEF, 0x70, 0x02, 0xD1, 0x3C, 0x22, 0x90, 0x81, 0x27, 0xE0,
+0x64, 0x01, 0x70, 0x66, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x51, 0x90, 0x81, 0x2A, 0xE0,
+0x70, 0x03, 0xFF, 0x31, 0x93, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x03, 0x12, 0x66, 0x26,
+0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xD1, 0xAB, 0xEF, 0x64, 0x01,
+0x60, 0x38, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4,
+0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x50, 0x05, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90,
+0x06, 0x92, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x81, 0x2A,
+0xE0, 0x70, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, 0x47, 0x3D, 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, 0x12, 0x50, 0x60, 0x90, 0x81, 0x2D, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0,
+0x7D, 0x02, 0x7F, 0x02, 0x51, 0x57, 0x90, 0x81, 0x42, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x80, 0xDE,
+0xE0, 0xB4, 0x01, 0x26, 0x90, 0x82, 0x17, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x81,
+0x44, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x82, 0x17, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0xFF, 0x90, 0x81,
+0x43, 0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0xF1, 0x0B, 0x22, 0xE4, 0xFF, 0x8F, 0x53, 0x90,
+0x04, 0x1D, 0xE0, 0x60, 0x19, 0x90, 0x05, 0x22, 0xE0, 0xF5, 0x56, 0x74, 0xFF, 0xF0, 0xF1, 0x3A,
+0xBF, 0x01, 0x03, 0x12, 0x74, 0xFB, 0x90, 0x05, 0x22, 0xE5, 0x56, 0xF0, 0x80, 0x03, 0x12, 0x74,
+0xFB, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x82, 0x0F, 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, 0x82, 0x10, 0xE0, 0x94, 0xE8, 0x90, 0x82, 0x0F,
+0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F,
+0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x0F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9,
+0x80, 0xBF, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, 0xF0,
+0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x10,
+0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x22,
+0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x1F,
+0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0xEF, 0x14, 0x90,
+0x05, 0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F, 0xF8,
+0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0,
+0x22, 0xE0, 0x44, 0x02, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x39, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB,
+0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x8E, 0x19, 0x8F, 0x1A, 0xE5, 0x1E, 0x54, 0x07, 0xC4, 0x33, 0x54,
+0xE0, 0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, 0xE5, 0x1D, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0,
+0xFF, 0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33,
+0x54, 0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0x85, 0x1A, 0x82, 0x85, 0x19,
+0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, 0x1A, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74,
+0x03, 0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x22,
+0xE4, 0x90, 0x81, 0x4D, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x58, 0x90, 0x80, 0xDE, 0xE0, 0x64,
+0x01, 0x70, 0x50, 0x90, 0x81, 0x4D, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x81, 0x1F,
+0xE0, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0x81, 0x4D, 0xF0,
+0x31, 0x73, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x4D, 0xF0, 0x90, 0x81, 0x4D, 0xE0, 0x60, 0x24, 0x90,
+0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x2F, 0x12, 0x4F, 0xFB, 0x90,
+0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07, 0x7D, 0x01, 0x7F, 0x04,
+0x12, 0x47, 0x3D, 0x22, 0xE4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x02, 0x21,
+0x72, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x21, 0x72, 0x90, 0x81, 0x26, 0xE0, 0xFF,
+0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x21, 0x90, 0x81, 0x2E, 0xE0,
+0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, 0x90, 0x81, 0x30, 0xE0, 0x60, 0x11, 0xEF, 0x70, 0x08, 0x90,
+0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x80, 0x00, 0x90, 0x81, 0x4C, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x1F,
+0xE0, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0x81, 0x4C, 0xF0,
+0x31, 0x73, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x81, 0x4C, 0xE0, 0x60, 0x43, 0x90,
+0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0x60, 0x03, 0xB4, 0x01, 0x09, 0xE4,
+0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x80, 0x0D, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x75,
+0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x81, 0x2F, 0xE0, 0x2F, 0x12, 0x4F, 0xFC, 0x90, 0x01,
+0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12,
+0x47, 0x3D, 0x22, 0x90, 0x05, 0x43, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90,
+0x81, 0x27, 0xE0, 0x70, 0x07, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x11, 0x90, 0x81, 0x1F, 0xE0,
+0x30, 0xE0, 0x07, 0x31, 0x73, 0xBF, 0x01, 0x05, 0x41, 0x5B, 0x12, 0x4E, 0x3C, 0x22, 0xD3, 0x10,
+0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x04, 0x7F, 0x04, 0x80, 0x0B,
+0x31, 0x73, 0xBF, 0x01, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x02, 0x71, 0x0E, 0xD0, 0xD0, 0x92,
+0xAF, 0x22, 0x90, 0x81, 0x4B, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x02,
+0xF0, 0x90, 0x05, 0xFC, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x10, 0xA3, 0x74,
+0x01, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x31, 0x9E, 0x11, 0xC4,
+0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x07, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90,
+0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3D, 0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02,
+0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D, 0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70,
+0x23, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x21, 0x9E, 0x51, 0x45, 0x90, 0x81, 0x23, 0xE0, 0xB4,
+0x08, 0x06, 0xE4, 0xFD, 0x7F, 0x0C, 0x80, 0x09, 0x90, 0x81, 0x23, 0xE0, 0x70, 0x06, 0xFD, 0x7F,
+0x04, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x0F, 0x90, 0x81, 0x23, 0xE0,
+0x64, 0x02, 0x60, 0x07, 0x7D, 0x01, 0x7F, 0x02, 0x12, 0x47, 0x3D, 0x90, 0x81, 0x27, 0xE0, 0x64,
+0x02, 0x60, 0x14, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x0C, 0x12, 0x4E, 0xAB, 0xEF, 0x70,
+0x06, 0xFD, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3F,
+0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, 0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D,
+0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, 0x25, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02,
+0x21, 0x9E, 0x12, 0x74, 0xAC, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x0C, 0x06, 0xE4, 0xFD, 0x7F, 0x08,
+0x80, 0x0A, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x04, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x47, 0x3D, 0x22,
+0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x12, 0x1F, 0xA4,
+0xFF, 0x90, 0x81, 0x1E, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x90, 0x00,
+0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x21, 0x80, 0x1D, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16,
+0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x20, 0xE0,
+0x06, 0xE4, 0xFF, 0x71, 0x0E, 0x80, 0x02, 0x31, 0x9E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10,
+0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x22, 0xE0, 0x90, 0x82, 0x16, 0xF0, 0x6F, 0x70, 0x02,
+0x81, 0x04, 0xEF, 0x14, 0x60, 0x3E, 0x14, 0x60, 0x62, 0x14, 0x70, 0x02, 0x61, 0xB8, 0x14, 0x70,
+0x02, 0x61, 0xDF, 0x24, 0x04, 0x60, 0x02, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04,
+0x04, 0x91, 0x41, 0x81, 0x04, 0xEF, 0xB4, 0x02, 0x04, 0x91, 0x50, 0x81, 0x04, 0x90, 0x82, 0x16,
+0xE0, 0xFF, 0xB4, 0x03, 0x04, 0x91, 0x54, 0x81, 0x04, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x81, 0x04,
+0x91, 0x43, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, 0x04, 0x91, 0xF3, 0x81, 0x04,
+0xEF, 0xB4, 0x02, 0x04, 0x91, 0x58, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x03, 0x04,
+0x91, 0xE8, 0x81, 0x04, 0xEF, 0x70, 0x7D, 0x91, 0x2B, 0x80, 0x79, 0x90, 0x82, 0x16, 0xE0, 0xB4,
+0x04, 0x05, 0x12, 0x74, 0x60, 0x80, 0x6D, 0x90, 0x82, 0x16, 0xE0, 0xB4, 0x01, 0x04, 0x91, 0x21,
+0x80, 0x62, 0x90, 0x82, 0x16, 0xE0, 0xB4, 0x03, 0x05, 0x12, 0x74, 0x71, 0x80, 0x56, 0x90, 0x82,
+0x16, 0xE0, 0x70, 0x50, 0x91, 0x1F, 0x80, 0x4C, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, 0x05,
+0x12, 0x74, 0x4C, 0x80, 0x3F, 0xEF, 0xB4, 0x01, 0x04, 0x91, 0x34, 0x80, 0x37, 0xEF, 0xB4, 0x02,
+0x04, 0x91, 0xDF, 0x80, 0x2F, 0x90, 0x82, 0x16, 0xE0, 0x70, 0x29, 0x91, 0x32, 0x80, 0x25, 0x90,
+0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x03, 0x05, 0x12, 0x74, 0x7B, 0x80, 0x18, 0xEF, 0xB4, 0x01, 0x04,
+0x91, 0x0B, 0x80, 0x10, 0xEF, 0xB4, 0x02, 0x04, 0xB1, 0x06, 0x80, 0x08, 0x90, 0x82, 0x16, 0xE0,
+0x70, 0x02, 0x91, 0x09, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x91, 0x2B, 0x90, 0x05, 0x22, 0x74, 0x6F,
+0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0x91,
+0x2B, 0x12, 0x49, 0xDD, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81, 0x22, 0x74, 0x01,
+0xF0, 0x22, 0x91, 0x2B, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0,
+0x22, 0x91, 0xF3, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0x90, 0x81, 0x22, 0xF0, 0x22,
+0x91, 0x58, 0x80, 0xEF, 0x91, 0xE8, 0x80, 0xEB, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90,
+0x81, 0x22, 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, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54, 0x7F, 0xFC,
+0x90, 0x82, 0x01, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x01, 0x12, 0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12,
+0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC,
+0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA,
+0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xF9, 0x12, 0x20,
+0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0xB1, 0x1C, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x91,
+0x65, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x22,
+0x04, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90,
+0x81, 0x22, 0x74, 0x01, 0xF0, 0x22, 0x91, 0x65, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05,
+0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01,
+0xC3, 0xC0, 0xD0, 0xC0, 0x07, 0xC0, 0x05, 0x90, 0x81, 0xF9, 0x12, 0x44, 0xD9, 0x90, 0x81, 0xE5,
+0x12, 0x20, 0xCE, 0xD0, 0x05, 0xD0, 0x07, 0x12, 0x60, 0xF5, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90,
+0x81, 0xC8, 0x12, 0x45, 0x1F, 0xEF, 0x12, 0x45, 0x28, 0x55, 0x71, 0x00, 0x55, 0x7A, 0x01, 0x55,
+0x83, 0x02, 0x55, 0x8B, 0x03, 0x55, 0x94, 0x04, 0x55, 0x9C, 0x20, 0x55, 0xA4, 0x21, 0x55, 0xAD,
+0x23, 0x55, 0xB5, 0x24, 0x55, 0xBE, 0x25, 0x55, 0xC7, 0x26, 0x55, 0xCF, 0xC0, 0x00, 0x00, 0x55,
+0xD8, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6A, 0xB0, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16,
+0x02, 0x65, 0x81, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x41, 0xC0, 0x90, 0x81, 0xC8, 0x12, 0x45,
+0x16, 0x02, 0x75, 0xD8, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x80, 0x44, 0x90, 0x81, 0xC8, 0x12,
+0x45, 0x16, 0xC1, 0x4B, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6A, 0xF8, 0x90, 0x81, 0xC8,
+0x12, 0x45, 0x16, 0xE1, 0xE1, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x4A, 0x6C, 0x90, 0x81,
+0xC8, 0x12, 0x45, 0x16, 0x02, 0x6B, 0x3E, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x80, 0x3E, 0x90,
+0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6B, 0x4E, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22,
+0x12, 0x5A, 0x4B, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x45, 0xE0, 0x54, 0xFE,
+0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81,
+0x46, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x47, 0xF0, 0x22, 0x12, 0x1F, 0xA4,
+0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12,
+0x1F, 0xBD, 0xFE, 0x90, 0x05, 0x54, 0xE0, 0xC3, 0x9E, 0x90, 0x81, 0x40, 0xF0, 0xEF, 0x20, 0xE0,
+0x07, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0x01, 0x90, 0x01,
+0xBC, 0xF0, 0x90, 0x81, 0x40, 0xE0, 0x90, 0x01, 0xBD, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54,
+0x7F, 0x90, 0x81, 0x27, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00,
+0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x81, 0x26, 0xE0, 0x54,
+0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81,
+0x24, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x81, 0x26,
+0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x29, 0xF0, 0xD1,
+0xC6, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x90,
+0x01, 0xBA, 0xF0, 0x90, 0x81, 0x29, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54,
+0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x12, 0x72, 0xB3, 0x90,
+0x81, 0x27, 0xE0, 0xFF, 0x12, 0x4C, 0x3E, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x19, 0x90, 0x81, 0xCB,
+0x12, 0x45, 0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12,
+0x1F, 0xBD, 0xFD, 0x12, 0x72, 0xC4, 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, 0x90, 0x01, 0xC4, 0x74, 0xF7, 0xF0, 0x74, 0x56, 0xA3, 0xF0, 0x12, 0x6C,
+0xA5, 0xE5, 0x49, 0x30, 0xE1, 0x03, 0x12, 0x6F, 0x79, 0xE5, 0x49, 0x30, 0xE2, 0x02, 0xF1, 0xA5,
+0xE5, 0x49, 0x30, 0xE3, 0x03, 0x12, 0x6F, 0x8D, 0xE5, 0x4A, 0x30, 0xE0, 0x03, 0x12, 0x6F, 0xC9,
+0xE5, 0x4A, 0x30, 0xE4, 0x03, 0x12, 0x70, 0x22, 0xE5, 0x4B, 0x30, 0xE1, 0x02, 0x51, 0x78, 0xE5,
+0x4B, 0x30, 0xE0, 0x02, 0x31, 0xFF, 0xE5, 0x4B, 0x30, 0xE3, 0x02, 0xF1, 0xE0, 0xE5, 0x4C, 0x30,
+0xE1, 0x05, 0x7F, 0x03, 0x12, 0x44, 0x27, 0xE5, 0x4C, 0x30, 0xE4, 0x03, 0x12, 0x4E, 0xC4, 0xE5,
+0x4C, 0x30, 0xE5, 0x03, 0x12, 0x70, 0x38, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x70, 0xCE, 0x74,
+0xF7, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x56, 0xA3, 0xF0, 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, 0x81, 0x27, 0xE0, 0x60, 0x34, 0x90, 0x06, 0x92, 0xE0, 0x30,
+0xE0, 0x23, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4,
+0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x11, 0x05, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90, 0x06,
+0x92, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x12, 0x47, 0x2A, 0x22,
+0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x31, 0xF0, 0x22, 0x90, 0x01, 0xC8, 0xE4, 0xF0, 0xA3, 0xF0,
+0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x51, 0x7F, 0xFF, 0xFE, 0x12, 0x2B, 0x27, 0xBF, 0x01,
+0x09, 0x90, 0x81, 0x51, 0xE0, 0x64, 0x03, 0x60, 0x03, 0x22, 0x01, 0xAB, 0xE4, 0x90, 0x81, 0x56,
+0xF0, 0x90, 0x81, 0x56, 0xE0, 0xFF, 0xC3, 0x94, 0x02, 0x40, 0x02, 0x01, 0xE6, 0xC3, 0x74, 0xFE,
+0x9F, 0xFF, 0xE4, 0x94, 0x00, 0xFE, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x52, 0x12, 0x2B, 0x27, 0xEF,
+0x64, 0x01, 0x70, 0x77, 0x90, 0x81, 0x52, 0xE0, 0xFF, 0x54, 0xC0, 0xFE, 0x60, 0x05, 0xEF, 0x54,
+0x0C, 0x70, 0x16, 0x90, 0x81, 0x52, 0xE0, 0xFF, 0x54, 0x30, 0x60, 0x67, 0xEF, 0x54, 0x03, 0x60,
+0x62, 0x90, 0x81, 0x53, 0x74, 0x01, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x81,
+0x53, 0xE0, 0x90, 0x81, 0x52, 0x70, 0x16, 0xE0, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x81,
+0x54, 0xF0, 0xEF, 0x54, 0x0C, 0x13, 0x13, 0x54, 0x3F, 0xA3, 0xF0, 0x80, 0x0D, 0xE0, 0xFE, 0x54,
+0x30, 0x90, 0x81, 0x54, 0xF0, 0xEE, 0x54, 0x03, 0xA3, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0x64, 0x30,
+0x70, 0x54, 0xA3, 0xE0, 0x64, 0x02, 0x70, 0x4E, 0x90, 0x00, 0xF5, 0xE0, 0x54, 0x40, 0x90, 0x81,
+0x57, 0xF0, 0xE0, 0x70, 0x41, 0xA3, 0x74, 0x02, 0xF0, 0x80, 0x10, 0x90, 0x81, 0x58, 0x74, 0x01,
+0xF0, 0x80, 0x08, 0x90, 0x81, 0x56, 0xE0, 0x04, 0xF0, 0x01, 0x11, 0x90, 0x01, 0xC4, 0x74, 0xE9,
+0xF0, 0x74, 0x57, 0xA3, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x90, 0x01, 0xC8, 0xF0, 0x90, 0x81, 0x52,
+0xE0, 0x90, 0x01, 0xC9, 0xF0, 0x90, 0x81, 0x53, 0xE0, 0x90, 0x01, 0xCA, 0xF0, 0xE4, 0xFD, 0x7F,
+0x1F, 0x12, 0x32, 0x1E, 0x80, 0xD5, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09, 0xE0, 0x7F,
+0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02, 0x7F, 0x03,
+0x22, 0x11, 0xE7, 0x90, 0x80, 0x3C, 0xEF, 0xF0, 0x31, 0x13, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0,
+0x02, 0x2D, 0xA7, 0x31, 0x81, 0x31, 0xB1, 0x31, 0x40, 0x31, 0x5F, 0xE4, 0xF5, 0x35, 0xF5, 0x36,
+0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F, 0x51, 0x12,
+0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02, 0x32, 0x1E,
+0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, 0x07, 0x75, 0x40, 0x02, 0x90, 0x01, 0x30, 0xE5,
+0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40, 0xF0, 0x22, 0x75,
+0x45, 0x0E, 0x75, 0x46, 0x01, 0x43, 0x46, 0x10, 0x75, 0x47, 0x03, 0x75, 0x48, 0x62, 0x90, 0x01,
+0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, 0xF0, 0xA3, 0xE5, 0x48, 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, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x51,
+0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x32,
+0x1E, 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, 0x32, 0x1E, 0x7D, 0xFF, 0x7F,
+0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x57, 0x02,
+0x32, 0x1E, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD,
+0x00, 0xE0, 0x54, 0xBF, 0xF0, 0x12, 0x57, 0xE9, 0x51, 0x77, 0x12, 0x32, 0x77, 0x51, 0xC9, 0x51,
+0x5E, 0x7F, 0x01, 0x12, 0x43, 0x15, 0x90, 0x81, 0x41, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x43, 0x15,
+0x90, 0x81, 0x41, 0xE0, 0x04, 0xF0, 0x7F, 0x03, 0x12, 0x43, 0x15, 0x90, 0x81, 0x41, 0xE0, 0x04,
+0xF0, 0x31, 0x01, 0x51, 0x3F, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x32,
+0x1E, 0x75, 0x20, 0xFF, 0x51, 0x68, 0x51, 0xF9, 0x51, 0x7F, 0xE4, 0xFF, 0x02, 0x43, 0x9E, 0x51,
+0x62, 0x51, 0x6F, 0x51, 0xA7, 0x71, 0x4F, 0x51, 0x8A, 0x51, 0x95, 0x90, 0x81, 0x45, 0xE0, 0x54,
+0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xE4, 0xF5,
+0x4D, 0x22, 0xE4, 0x90, 0x80, 0xDE, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0xE4,
+0x90, 0x80, 0xD8, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90,
+0x01, 0xE4, 0x74, 0x0B, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE,
+0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x7F, 0xF0, 0xA3,
+0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD,
+0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0xE4, 0xA3, 0xF0,
+0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0,
+0x90, 0x01, 0x9C, 0x74, 0x7E, 0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74,
+0x24, 0xF0, 0x90, 0x01, 0x9B, 0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01,
+0x99, 0xE4, 0xF0, 0x90, 0x01, 0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x51, 0xF0, 0xA3, 0xF0,
+0x90, 0x01, 0x98, 0xE0, 0x7F, 0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3E,
+0xC3, 0x90, 0x81, 0x52, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x51, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90,
+0x01, 0xC1, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x51, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44,
+0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x52, 0xE0, 0x94, 0x32, 0x90,
+0x81, 0x51, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB2, 0x22, 0xE4,
+0x90, 0x81, 0x27, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0xF0, 0x54, 0xF0, 0xF0,
+0x90, 0x81, 0x24, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x2D,
+0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB,
+0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x2F, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xE4,
+0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x2B, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFE,
+0xF0, 0x90, 0x81, 0x29, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x81,
+0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0,
+0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x34, 0x12, 0x20, 0xDA, 0x00,
+0x00, 0x00, 0x00, 0x90, 0x80, 0x3C, 0xE0, 0xB4, 0x01, 0x08, 0x90, 0x81, 0x31, 0x74, 0x99, 0xF0,
+0x80, 0x12, 0x90, 0x80, 0x3C, 0xE0, 0x90, 0x81, 0x31, 0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80,
+0x03, 0x74, 0x40, 0xF0, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0,
+0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFD,
+0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0,
+0xE4, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x59, 0xF0, 0x90, 0x81, 0x59, 0xE0, 0x64, 0x01, 0xF0,
+0x24, 0x24, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5C, 0xA3, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0xFF, 0x90,
+0x81, 0x29, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x47, 0x2A, 0xD1, 0x08, 0xBF, 0x01, 0x02, 0x91, 0x5F,
+0xB1, 0xF2, 0x12, 0x32, 0x9E, 0xBF, 0x01, 0x02, 0xB1, 0x67, 0x12, 0x42, 0x4D, 0x80, 0xCA, 0xD3,
+0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x24, 0x90, 0x81, 0x1F,
+0xE0, 0xFF, 0x30, 0xE0, 0x1A, 0xC3, 0x13, 0x30, 0xE0, 0x07, 0xB1, 0xFB, 0xBF, 0x01, 0x12, 0x80,
+0x0A, 0x90, 0x81, 0x23, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x06, 0x91, 0x96, 0x80, 0x02, 0x91,
+0xA6, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xB1, 0x22, 0x91,
+0xBA, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x0D, 0xD1, 0x2F, 0xBF, 0x01,
+0x08, 0x91, 0x96, 0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, 0x22, 0xB1, 0xF3, 0x90, 0x00, 0x08, 0xE0,
+0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0xE4, 0xFF, 0x8F, 0x50, 0xE4, 0x90, 0x81, 0x5A,
+0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0xEF, 0x65,
+0x50, 0x60, 0x3E, 0xC3, 0x90, 0x81, 0x5B, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x5A, 0xE0, 0x94, 0x13,
+0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x5A, 0xE4, 0x75, 0xF0,
+0x01, 0x12, 0x44, 0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x5B, 0xE0,
+0x94, 0x32, 0x90, 0x81, 0x5A, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0,
+0xB2, 0x22, 0x90, 0x81, 0x31, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x32, 0x1E, 0x90, 0x81, 0x28, 0xE0,
+0x60, 0x12, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01,
+0x2F, 0x74, 0x90, 0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E,
+0x7F, 0x01, 0x91, 0xCA, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E,
+0x7F, 0x14, 0x7E, 0x00, 0x02, 0x32, 0xAA, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x2D,
+0xA7, 0xE4, 0xF5, 0x52, 0x12, 0x32, 0x9E, 0xEF, 0x60, 0x73, 0x63, 0x52, 0x01, 0xE5, 0x52, 0x24,
+0x67, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5D, 0xA3, 0xF0, 0x90, 0x00, 0x88, 0xE0, 0xF5, 0x50, 0xF5,
+0x51, 0x54, 0x0F, 0x60, 0xDF, 0xE5, 0x50, 0x30, 0xE0, 0x0B, 0x20, 0xE4, 0x03, 0x12, 0x29, 0xC5,
+0x53, 0x51, 0xEE, 0x80, 0x3F, 0xE5, 0x50, 0x30, 0xE1, 0x16, 0x20, 0xE5, 0x0E, 0x12, 0x11, 0xBD,
+0xEF, 0x70, 0x03, 0x43, 0x51, 0x20, 0x90, 0x01, 0x06, 0xE4, 0xF0, 0x53, 0x51, 0xFD, 0x80, 0x24,
+0xE5, 0x50, 0x30, 0xE2, 0x0B, 0x20, 0xE6, 0x03, 0x12, 0x67, 0x06, 0x53, 0x51, 0xFB, 0x80, 0x14,
+0xE5, 0x50, 0x30, 0xE3, 0x0F, 0x20, 0xE7, 0x09, 0x12, 0x61, 0x6E, 0xEF, 0x70, 0x03, 0x43, 0x51,
+0x80, 0x53, 0x51, 0xF7, 0xAD, 0x51, 0x7F, 0x88, 0x12, 0x32, 0x1E, 0x80, 0x87, 0xD0, 0xD0, 0x92,
+0xAF, 0x22, 0x22, 0x90, 0x00, 0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x22, 0x90, 0x81, 0x22, 0xE0, 0x64,
+0x02, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x7F, 0x02, 0x90, 0x81, 0x41, 0xE0, 0xFE, 0xEF,
+0xC3, 0x9E, 0x50, 0x18, 0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B, 0x90, 0x01,
+0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xDE, 0x7F, 0x01, 0x22, 0x90,
+0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 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, 0xE4, 0xFB, 0xFA,
+0xFD, 0x7F, 0x01, 0x12, 0x44, 0x4E, 0x90, 0x81, 0xBD, 0xEF, 0xF0, 0x60, 0xF0, 0xD1, 0x71, 0x80,
+0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x81,
+0xBE, 0xF0, 0x90, 0x81, 0xBE, 0xE0, 0xFD, 0x70, 0x02, 0xE1, 0x9C, 0x90, 0x82, 0x09, 0xE0, 0xFF,
+0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9,
+0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xE1, 0x95, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01,
+0xD0, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xBF, 0xF0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x81, 0x75,
+0x15, 0xBF, 0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC0, 0x12, 0x2B, 0xED, 0x90, 0x82,
+0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC1, 0xF0,
+0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81,
+0xC2, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x45, 0x0A, 0xE0,
+0x90, 0x81, 0xC3, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12, 0x45,
+0x0A, 0xE0, 0x90, 0x81, 0xC4, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1,
+0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC5, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90,
+0x01, 0xF2, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC6, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0,
+0x04, 0x90, 0x01, 0xF3, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC7, 0xF0, 0x90, 0x81, 0xBE, 0xE0,
+0xFF, 0x90, 0x82, 0x09, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8,
+0xFC, 0xF4, 0x5F, 0x90, 0x81, 0xBE, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07,
+0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x81, 0xC0, 0xE0, 0xFF,
+0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC1, 0x12, 0x55, 0x3F, 0x90, 0x82, 0x09, 0xE0, 0x04, 0xF0, 0xE0,
+0x54, 0x03, 0xF0, 0xC1, 0x82, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
+0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x44, 0x4E, 0x90, 0x81, 0xD0, 0xEF, 0xF0, 0x60,
+0xF0, 0x12, 0x6C, 0x19, 0x80, 0xEB, 0x90, 0x81, 0xD4, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12,
+0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, 0x81, 0xE2, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12,
+0x2D, 0x5C, 0x90, 0x81, 0xDA, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xD4, 0xE0, 0xFB, 0x70, 0x08, 0x90,
+0x81, 0xDA, 0x12, 0x44, 0xD9, 0x80, 0x16, 0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82,
+0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x81, 0xDE,
+0x12, 0x20, 0xCE, 0x90, 0x81, 0xD5, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20,
+0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xDE, 0x12, 0x44, 0xD9, 0xED,
+0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC, 0x12, 0x44, 0xCC, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x81,
+0xDE, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xDA, 0x12, 0x44, 0xD9, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85,
+0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xD4, 0xE0, 0x75,
+0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0,
+0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xDE, 0x12, 0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20,
+0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xDA, 0x12, 0x44, 0xD9, 0xEC, 0x44,
+0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90,
+0x81, 0xD4, 0xE0, 0x70, 0x04, 0x7F, 0x20, 0x80, 0x09, 0x90, 0x81, 0xD4, 0xE0, 0xB4, 0x01, 0x16,
+0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF,
+0xE4, 0x90, 0x81, 0xE2, 0xEF, 0xF0, 0x90, 0x81, 0xE2, 0xE0, 0x90, 0x81, 0xD4, 0x60, 0x0E, 0xE0,
+0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0,
+0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF,
+0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x90, 0x81, 0xD6, 0x12, 0x20, 0xCE, 0x90,
+0x81, 0xD6, 0x02, 0x44, 0xD9, 0x90, 0x81, 0xE3, 0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x81, 0xE9, 0x12,
+0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20,
+0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xE5, 0x12, 0x44, 0xD9, 0xED,
+0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x44, 0xCC, 0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x81, 0xE9, 0x12,
+0x20, 0xCE, 0x90, 0x81, 0xE3, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34,
+0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xE9, 0x12,
+0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3,
+0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x5F, 0xB6, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x78, 0x10,
+0x74, 0x01, 0xF2, 0x90, 0x02, 0x09, 0xE0, 0x78, 0x00, 0xF2, 0x08, 0x74, 0x20, 0xF2, 0x18, 0xE2,
+0xFF, 0x30, 0xE0, 0x05, 0x08, 0xE2, 0x24, 0x80, 0xF2, 0xEF, 0xC3, 0x13, 0x90, 0xFD, 0x10, 0xF0,
+0x78, 0x01, 0xE2, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x78, 0x03, 0xF2,
+0x64, 0x04, 0x60, 0x0D, 0xE2, 0xFF, 0x64, 0x08, 0x60, 0x07, 0xEF, 0x64, 0x0C, 0x60, 0x02, 0x61,
+0xDE, 0xE4, 0x78, 0x02, 0xF2, 0x78, 0x03, 0xE2, 0xFF, 0x18, 0xE2, 0xC3, 0x9F, 0x50, 0x2D, 0xE2,
+0xFD, 0x18, 0xE2, 0x2D, 0x90, 0x81, 0x5A, 0xF0, 0xE0, 0xFF, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34,
+0xFC, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x04, 0x2D, 0xF8, 0xEE, 0xF2, 0xEF, 0xB4, 0xFF, 0x06, 0x90,
+0xFD, 0x10, 0xE0, 0x04, 0xF0, 0x78, 0x02, 0xE2, 0x04, 0xF2, 0x80, 0xC9, 0x78, 0x04, 0xE2, 0x78,
+0x12, 0xF2, 0xFF, 0x78, 0x05, 0xE2, 0x78, 0x11, 0xF2, 0x78, 0x06, 0xE2, 0x78, 0x13, 0xF2, 0x78,
+0x07, 0xE2, 0x78, 0x14, 0xF2, 0x78, 0x08, 0xE2, 0x78, 0x33, 0xF2, 0x78, 0x09, 0xE2, 0x78, 0x34,
+0xF2, 0x78, 0x0A, 0xE2, 0x78, 0x35, 0xF2, 0x78, 0x0B, 0xE2, 0x78, 0x36, 0xF2, 0x78, 0x0C, 0xE2,
+0x78, 0x37, 0xF2, 0x78, 0x0D, 0xE2, 0x78, 0x38, 0xF2, 0x78, 0x0E, 0xE2, 0x78, 0x39, 0xF2, 0x78,
+0x0F, 0xE2, 0x78, 0x3A, 0xF2, 0xE4, 0x78, 0x15, 0xF2, 0xEF, 0x24, 0xF8, 0x60, 0x75, 0x24, 0xFC,
+0x60, 0x6C, 0x24, 0x08, 0x60, 0x02, 0x61, 0xC0, 0x78, 0x11, 0xE2, 0xB4, 0x01, 0x05, 0x12, 0x29,
+0xC5, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x02, 0x05, 0x12, 0x11, 0xBD, 0x61, 0xC5, 0x78, 0x11,
+0xE2, 0xB4, 0x03, 0x04, 0xF1, 0x06, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x10, 0x17, 0x78, 0x14,
+0xE2, 0xFE, 0x18, 0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF,
+0x12, 0x32, 0xAA, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x11, 0x17, 0x78, 0x14, 0xE2, 0xFE, 0x18,
+0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, 0x12, 0x32, 0x06,
+0x61, 0xC5, 0x78, 0x11, 0xE2, 0xF4, 0x60, 0x02, 0x61, 0xC5, 0x18, 0xF2, 0x61, 0xC5, 0x78, 0x15,
+0x74, 0x01, 0xF2, 0x78, 0x11, 0xE2, 0x64, 0x07, 0x60, 0x02, 0x61, 0xAA, 0x78, 0x34, 0xE2, 0xFF,
+0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB,
+0x07, 0x78, 0x33, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0xC0, 0x04,
+0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x35, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10,
+0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x18,
+0x12, 0x44, 0xFE, 0x78, 0x15, 0xE2, 0x70, 0x02, 0x61, 0x93, 0x18, 0xE2, 0xFF, 0x18, 0xE2, 0xFD,
+0x31, 0x5F, 0x78, 0x1C, 0x12, 0x44, 0xFE, 0x78, 0x38, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78,
+0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x78, 0x37, 0xE2, 0xFF,
+0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0,
+0x07, 0x78, 0x39, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03,
+0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x20, 0x12, 0x44, 0xFE, 0x78, 0x20,
+0x12, 0x44, 0xE5, 0x12, 0x20, 0x9B, 0x78, 0x1C, 0x12, 0x44, 0xF1, 0x12, 0x44, 0xBF, 0xC0, 0x04,
+0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x18, 0x12, 0x44, 0xE5, 0x78, 0x20, 0x12, 0x44, 0xF1,
+0x12, 0x44, 0xBF, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x18,
+0x12, 0x44, 0xFE, 0x78, 0x18, 0x12, 0x44, 0xE5, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xCE, 0x78, 0x13,
+0xE2, 0xFD, 0x08, 0xE2, 0xFF, 0x12, 0x55, 0x1C, 0x80, 0x1B, 0x78, 0x13, 0xE2, 0xFF, 0x08, 0xE2,
+0xFD, 0x78, 0x11, 0xE2, 0xFB, 0x78, 0x15, 0xE2, 0x90, 0x81, 0xBC, 0xF0, 0x71, 0xE1, 0x80, 0x05,
+0x78, 0x10, 0x74, 0x02, 0xF2, 0x78, 0x10, 0xE2, 0xFF, 0xC3, 0x94, 0x02, 0x50, 0x10, 0xEF, 0x60,
+0x0A, 0x78, 0x02, 0xE2, 0xFF, 0x18, 0xE2, 0x2F, 0xF2, 0x21, 0x90, 0x7F, 0x01, 0x22, 0x7F, 0x00,
+0x22, 0xAC, 0x07, 0xED, 0xAD, 0x04, 0x78, 0x24, 0xF2, 0xED, 0x08, 0xF2, 0xEB, 0xB4, 0x04, 0x07,
+0x78, 0x27, 0x74, 0x01, 0xF2, 0x80, 0x0E, 0xEB, 0x78, 0x27, 0xB4, 0x05, 0x05, 0x74, 0x02, 0xF2,
+0x80, 0x03, 0x74, 0x04, 0xF2, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x00, 0x50,
+0x63, 0xE4, 0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02,
+0xA1, 0x7F, 0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2D,
+0x74, 0x37, 0x2E, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xEE, 0xFF, 0x78, 0x25, 0xE2, 0x2F, 0xFF, 0x18,
+0xE2, 0x34, 0x00, 0x8F, 0x82, 0xF5, 0x83, 0xE0, 0x78, 0x29, 0xF2, 0x78, 0x32, 0xE2, 0xFF, 0xF4,
+0xFE, 0x78, 0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x24, 0x08,
+0xE2, 0xFF, 0x08, 0xE2, 0x2F, 0xFF, 0x78, 0x28, 0xE2, 0xFD, 0x12, 0x32, 0x1E, 0x78, 0x26, 0xE2,
+0x04, 0xF2, 0x80, 0xA1, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x07, 0x50, 0x69,
+0xE4, 0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0xA1,
+0x7F, 0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2D, 0x78,
+0x26, 0xE2, 0xFF, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83,
+0xE0, 0x78, 0x29, 0xF2, 0x74, 0x37, 0x2F, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFF, 0xF4, 0xFE,
+0x78, 0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x28, 0xE2, 0xFF,
+0x78, 0x26, 0xE2, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83,
+0xEF, 0xF0, 0x78, 0x26, 0xE2, 0x04, 0xF2, 0x80, 0x9B, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x0F, 0x78,
+0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2D, 0x5C, 0x78, 0x2E, 0x12, 0x44, 0xFE, 0xE4, 0x78,
+0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x50, 0x5D, 0x74, 0x33, 0x2E,
+0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2B, 0x78, 0x2E, 0x12, 0x44, 0xE5,
+0x78, 0x26, 0xE2, 0xFB, 0x75, 0xF0, 0x08, 0xA4, 0xF9, 0xF8, 0x12, 0x20, 0xA8, 0x78, 0x29, 0xEF,
+0xF2, 0x74, 0x37, 0x2B, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFE, 0xF4, 0x5F, 0xFF, 0x78, 0x28,
+0xE2, 0xFD, 0xEE, 0x5D, 0x4F, 0xF2, 0x78, 0x28, 0xE2, 0xFF, 0x78, 0x26, 0xE2, 0xFD, 0xC3, 0x74,
+0x03, 0x9D, 0xFD, 0xE4, 0x94, 0x00, 0xFC, 0x7B, 0xFE, 0x74, 0x2A, 0x2D, 0xF9, 0x74, 0x80, 0x3C,
+0xFA, 0xEF, 0x12, 0x1F, 0xEA, 0xE2, 0x04, 0xF2, 0x80, 0x98, 0x78, 0x2A, 0x12, 0x44, 0xE5, 0x90,
+0x85, 0xBB, 0x12, 0x20, 0xCE, 0x78, 0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2E, 0xA2, 0x22,
+0x22, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xFE, 0x12,
+0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x90, 0x00,
+0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0xCF, 0xF0, 0x80, 0x05, 0x90, 0x81, 0xCF, 0xEF, 0xF0, 0x90,
+0x81, 0xCE, 0xEE, 0xF0, 0x90, 0x81, 0xCF, 0xE0, 0xFE, 0x90, 0x81, 0xCE, 0xE0, 0xFF, 0xD3, 0x9E,
+0x50, 0x38, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFE, 0x74, 0xDE,
+0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xDE, 0x2F, 0xF5, 0x82, 0xE4,
+0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xD1, 0x25, 0x80, 0x07, 0x90, 0x81, 0xCE, 0xE0, 0xFF,
+0xB1, 0x80, 0x90, 0x81, 0xCE, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x90, 0x80, 0xDE, 0xE0, 0x70, 0x24,
+0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0xFF, 0x12, 0x49, 0x93, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C,
+0x60, 0x02, 0xD1, 0x26, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xBF,
+0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x05, 0x22,
+0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x81, 0xED, 0xEF, 0xF0, 0xA3, 0xED,
+0xF0, 0xAD, 0x03, 0xAC, 0x02, 0xE4, 0x90, 0x81, 0xF5, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0xC4, 0x74,
+0x39, 0xF0, 0x74, 0x66, 0xA3, 0xF0, 0xEC, 0x54, 0x3F, 0xFC, 0x90, 0x01, 0x40, 0xED, 0xF0, 0xAE,
+0x04, 0xEE, 0xA3, 0xF0, 0x90, 0x81, 0xED, 0xE0, 0x24, 0x81, 0x60, 0x34, 0x24, 0xDA, 0x60, 0x1C,
+0x24, 0x3C, 0x70, 0x41, 0x90, 0x81, 0xEE, 0xE0, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0x90, 0x81,
+0xF2, 0xF0, 0xA3, 0x74, 0x69, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x80, 0x2C, 0x90, 0x81, 0xEE, 0xE0,
+0x54, 0x01, 0x90, 0x81, 0xF2, 0xF0, 0xA3, 0x74, 0xA5, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x80, 0x18,
+0x90, 0x81, 0xEE, 0xE0, 0xC4, 0x54, 0x10, 0x90, 0x81, 0xF2, 0xF0, 0xA3, 0x74, 0x7F, 0xF0, 0xA3,
+0x74, 0x10, 0xF0, 0x80, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x81, 0xF3, 0xE0, 0x90, 0x01, 0x06, 0xF0,
+0x90, 0x81, 0xF2, 0xE0, 0x60, 0x0E, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x81, 0xF1, 0xE0, 0x90, 0x01,
+0x43, 0xF0, 0x80, 0x0D, 0x90, 0x01, 0x43, 0xE4, 0xF0, 0x90, 0x81, 0xF2, 0xE0, 0x90, 0x01, 0x42,
+0xF0, 0x90, 0x81, 0xF4, 0xE0, 0xFF, 0x90, 0x01, 0x42, 0xE0, 0x5F, 0xFF, 0x90, 0x81, 0xF2, 0xE0,
+0x6F, 0x60, 0xEE, 0x74, 0x39, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x66, 0xA3, 0xF0, 0x90, 0x01,
+0x43, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x87, 0x5F, 0xE0, 0x90,
+0x81, 0x69, 0xF0, 0xE4, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x81, 0x66, 0xF0, 0x90, 0x81, 0x66, 0xE0,
+0xFF, 0xC3, 0x94, 0x40, 0x50, 0x15, 0x74, 0x79, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83,
+0x74, 0xFF, 0xF0, 0x90, 0x81, 0x66, 0xE0, 0x04, 0xF0, 0x80, 0xE1, 0xE4, 0x90, 0x81, 0x66, 0xF0,
+0x90, 0x81, 0x69, 0xE0, 0xFF, 0x90, 0x81, 0x66, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x03, 0x02, 0x68,
+0x12, 0x74, 0xDF, 0x2E, 0xF9, 0xE4, 0x34, 0x86, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75,
+0x16, 0x0A, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5B, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x5C, 0xE0, 0xFF,
+0x12, 0x2F, 0x27, 0xEF, 0x04, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x81, 0x5B, 0xE0, 0xFF, 0xA3, 0xE0,
+0xFD, 0x12, 0x31, 0xEA, 0xEF, 0x24, 0xC8, 0x90, 0x81, 0x78, 0xF0, 0x75, 0xF0, 0x08, 0xA4, 0xF0,
+0x90, 0x81, 0x5C, 0xE0, 0x54, 0x0F, 0x90, 0x81, 0x77, 0xF0, 0xE4, 0x90, 0x81, 0x65, 0xF0, 0x90,
+0x81, 0x67, 0xF0, 0x90, 0x81, 0x67, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x57, 0x90, 0x81, 0x77,
+0xE0, 0xFE, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x13, 0xD8, 0xFC, 0x20, 0xE0, 0x3E, 0x90, 0x81,
+0x67, 0xE0, 0x25, 0xE0, 0xFF, 0x90, 0x81, 0x78, 0xE0, 0x2F, 0x24, 0x79, 0xF9, 0xE4, 0x34, 0x81,
+0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x01, 0x90, 0x81, 0x65, 0xE0, 0x75, 0xF0, 0x02, 0xA4, 0x24,
+0x5D, 0xF9, 0x74, 0x81, 0x35, 0xF0, 0x8B, 0x13, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0xD0,
+0x01, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x65, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x67, 0xE0,
+0x04, 0xF0, 0x80, 0x9F, 0x90, 0x81, 0x76, 0xE0, 0xFF, 0x90, 0x81, 0x66, 0xE0, 0x2F, 0xF0, 0x02,
+0x67, 0x40, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0xC3, 0x94, 0x40, 0x40, 0x02,
+0x41, 0xAF, 0xE0, 0xFF, 0x24, 0x79, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, 0x81,
+0x6C, 0xF0, 0xE0, 0xFE, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFD, 0x90, 0x81, 0x6B, 0xF0, 0xEE, 0x54,
+0x0F, 0xFE, 0xA3, 0xF0, 0x74, 0x7A, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90,
+0x81, 0x6D, 0xF0, 0xFC, 0xEE, 0xFE, 0xEC, 0xFB, 0xEB, 0xFF, 0x90, 0x81, 0x72, 0xEE, 0xF0, 0xA3,
+0xEF, 0xF0, 0xED, 0x12, 0x45, 0x28, 0x68, 0x8B, 0x00, 0x68, 0xC2, 0x01, 0x69, 0x73, 0x02, 0x6A,
+0xA0, 0x03, 0x69, 0x8E, 0x04, 0x69, 0xAF, 0x05, 0x69, 0xAF, 0x06, 0x69, 0xAF, 0x07, 0x69, 0xAF,
+0x08, 0x6A, 0x33, 0x09, 0x6A, 0x69, 0x0A, 0x00, 0x00, 0x6A, 0xAF, 0x90, 0x81, 0x6A, 0xE0, 0xFD,
+0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x7B, 0x2D, 0xF5, 0x82,
+0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x81, 0x74, 0xEE, 0xF0, 0xFC, 0xA3,
+0xEF, 0xF0, 0x90, 0x81, 0x6D, 0xE0, 0xFF, 0x12, 0x2F, 0x96, 0x90, 0x81, 0x68, 0x74, 0x02, 0xF0,
+0x41, 0xA0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0,
+0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06,
+0xAB, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0,
+0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07,
+0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7D, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4,
+0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00,
+0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24,
+0x7E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x18,
+0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x90, 0x81,
+0x6E, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x6E, 0x12, 0x44, 0xD9, 0x90, 0x85, 0x96, 0x12, 0x20, 0xCE,
+0x90, 0x81, 0x72, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2E, 0xE4, 0x90, 0x81, 0x68, 0x74, 0x04,
+0xF0, 0x41, 0xA0, 0x90, 0x81, 0x6D, 0xE0, 0xFD, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82,
+0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0xC7, 0x80, 0x19, 0x90, 0x81,
+0x6D, 0xE0, 0xFD, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83,
+0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0x6A, 0x90, 0x81, 0x68, 0x74, 0x01, 0xF0, 0x41, 0xA0, 0x90,
+0x81, 0x68, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81,
+0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9,
+0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81,
+0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0,
+0x06, 0xC0, 0x07, 0x90, 0x81, 0x6C, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20,
+0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x90, 0x81, 0x6E, 0x12,
+0x20, 0xCE, 0x90, 0x81, 0x6B, 0xE0, 0x24, 0xFB, 0xFF, 0xC0, 0x07, 0x90, 0x81, 0x6E, 0x12, 0x44,
+0xD9, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x6D, 0xE0, 0xFD, 0xD0, 0x07, 0x12, 0x55,
+0x1C, 0x80, 0x6D, 0x90, 0x81, 0x68, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF9,
+0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x01, 0x7B, 0xFE, 0x7A,
+0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x6D, 0xE0, 0xFF, 0x90, 0x81, 0x6C, 0xE0, 0xFD,
+0xE4, 0x90, 0x81, 0xBC, 0xF0, 0x7B, 0x04, 0x80, 0x34, 0x90, 0x81, 0x68, 0x74, 0x04, 0xF0, 0x90,
+0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF9, 0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15,
+0x75, 0x16, 0x04, 0x7B, 0xFE, 0x7A, 0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x6D, 0xE0,
+0xFF, 0x90, 0x81, 0x6C, 0xE0, 0xFD, 0xE4, 0x90, 0x81, 0xBC, 0xF0, 0x7B, 0x06, 0x12, 0x63, 0xE1,
+0x90, 0x81, 0x68, 0xE0, 0x24, 0x02, 0xFF, 0x90, 0x81, 0x6A, 0xE0, 0x2F, 0xF0, 0x01, 0x17, 0x22,
+0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80, 0x3D,
+0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3E, 0xF0, 0x90, 0x00,
+0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F,
+0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x40, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xAE,
+0x05, 0xED, 0x2F, 0x90, 0x80, 0x41, 0xF0, 0x22, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0x30,
+0xE0, 0x26, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x38, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90,
+0x81, 0x39, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03,
+0x12, 0x1F, 0xBD, 0x90, 0x81, 0x3B, 0xF0, 0x22, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74,
+0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x12, 0x1F,
+0xA4, 0x90, 0x81, 0x3E, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x90, 0x01, 0xE7, 0xF0, 0x22, 0x12, 0x1F,
+0xA4, 0x90, 0x81, 0x4A, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x4B, 0xF0, 0x22,
+0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xFD, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4,
+0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0xFD, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0,
+0x60, 0x2D, 0xC3, 0x90, 0x82, 0x00, 0xE0, 0x94, 0xE8, 0x90, 0x81, 0xFF, 0xE0, 0x94, 0x03, 0x40,
+0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x81, 0xFF, 0xE4,
+0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F,
+0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xD1,
+0x12, 0x45, 0x1F, 0x90, 0x82, 0x0A, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F,
+0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x71, 0x60, 0xEF, 0x60, 0x3A, 0x90, 0x81, 0xD1, 0x12, 0x45, 0x16,
+0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xF5, 0x16,
+0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x81, 0xD1, 0x12, 0x45, 0x16, 0x90,
+0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB,
+0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
+0xE4, 0xFF, 0x90, 0x80, 0xD9, 0xE0, 0xFE, 0x90, 0x80, 0xD8, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E,
+0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13,
+0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x42, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x71,
+0xB6, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, 0x80, 0xD8, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4,
+0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0xD8, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
+0x22, 0x8F, 0x0D, 0x22, 0x8F, 0x0E, 0x22, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41,
+0xA3, 0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3, 0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40,
+0xF5, 0x44, 0x90, 0x01, 0x34, 0xE5, 0x41, 0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0,
+0xA3, 0xE5, 0x44, 0xF0, 0x22, 0x90, 0x01, 0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55,
+0x46, 0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47, 0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90,
+0x01, 0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5, 0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C,
+0xF0, 0x53, 0x91, 0xDF, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xA3, 0xF0, 0xA3,
+0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x19, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x13,
+0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0x12, 0x4F, 0xF4, 0x90, 0x01, 0x57,
+0x74, 0x05, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x26, 0x90, 0x81, 0x27, 0xE0,
+0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24,
+0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12,
+0x47, 0x2A, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0E,
+0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0x80, 0x03, 0xD1, 0x7F, 0x22, 0x90,
+0x04, 0x1D, 0xE0, 0x70, 0x13, 0x90, 0x80, 0x3E, 0xE0, 0xFF, 0xE4, 0xFD, 0xB1, 0x69, 0x8E, 0x4E,
+0x8F, 0x4F, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
+0x90, 0x82, 0x0E, 0xED, 0xF0, 0x90, 0x82, 0x0D, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0xF1, 0x37, 0x7C,
+0x00, 0xAD, 0x07, 0x90, 0x82, 0x0D, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x82, 0x0E, 0xE0, 0x60,
+0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF,
+0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F,
+0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82,
+0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92,
+0xAF, 0x22, 0x8F, 0x4E, 0xF1, 0x4B, 0xBF, 0x01, 0x18, 0x90, 0x80, 0x40, 0xE0, 0xFF, 0x7D, 0x01,
+0xB1, 0x69, 0xAD, 0x07, 0xAC, 0x06, 0xAF, 0x4E, 0x12, 0x4F, 0x82, 0x90, 0x04, 0x1F, 0x74, 0x20,
+0xF0, 0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x81, 0x4C, 0xF0, 0xE0, 0xFD, 0x54, 0xC0, 0x70, 0x09,
+0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x80, 0x72, 0xED, 0x30, 0xE6, 0x4B, 0x90, 0x81, 0x27,
+0xE0, 0x64, 0x02, 0x70, 0x2A, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC3, 0x13, 0x20, 0xE0, 0x09, 0x90,
+0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x28, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x01,
+0x70, 0x2D, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x04, 0xF0, 0x7F, 0x01, 0xB1, 0xD2, 0x80, 0x20, 0x90,
+0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04,
+0xB1, 0x4F, 0x80, 0x0B, 0xD1, 0x7F, 0x80, 0x07, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90,
+0x81, 0x4C, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, 0x11, 0x12, 0x4F, 0xF1, 0x90, 0x01, 0x57, 0x74,
+0x05, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90,
+0x01, 0x5F, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x08, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A,
+0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x50,
+0x05, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24,
+0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x0C, 0xE4, 0xFD, 0x7F, 0x0C,
+0x12, 0x47, 0x3D, 0xE4, 0xFF, 0x12, 0x4F, 0x0D, 0x22, 0xE4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x06,
+0xA9, 0xE0, 0x90, 0x81, 0x4C, 0xF0, 0xE0, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x81, 0x2B, 0xE0, 0x54,
+0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x47, 0x2A, 0x90, 0x81, 0x4C, 0xE0, 0x30, 0xE6, 0x21, 0x90,
+0x81, 0x27, 0xE0, 0x64, 0x01, 0x70, 0x20, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81,
+0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xB1, 0x4F, 0x80, 0x0B, 0xD1, 0x7F, 0x80, 0x07,
+0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x4C, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7,
+0x11, 0x12, 0x4F, 0xF1, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x04,
+0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0,
+0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06, 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, 0x81, 0x27, 0xE0, 0x60, 0x03, 0x12,
+0x73, 0xE1, 0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x03, 0x12, 0x49, 0xDD, 0x22, 0x90, 0x81, 0x27,
+0xE0, 0x60, 0x35, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, 0x24, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A,
+0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x50,
+0x05, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81,
+0x24, 0xE0, 0x54, 0xEF, 0xF0, 0x12, 0x47, 0x2A, 0x22, 0x12, 0x71, 0x48, 0x90, 0x81, 0x4D, 0xEF,
+0xF0, 0x90, 0x81, 0x24, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x04, 0xE0, 0x54, 0xFE,
+0xF0, 0x90, 0x81, 0x4D, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4,
+0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x1A,
+0x90, 0x81, 0x32, 0xE4, 0xF0, 0xA3, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05,
+0x58, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x22, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22,
+0xF0, 0x22, 0x90, 0x81, 0x4A, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x01,
+0xF0, 0x90, 0x05, 0xFD, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13,
+0x54, 0x03, 0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25,
+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, 0x47, 0x2A, 0xE4, 0xFF, 0x90, 0x81,
+0x45, 0xE0, 0x30, 0xE0, 0x48, 0x90, 0x81, 0x49, 0xE0, 0xFD, 0x60, 0x41, 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, 0x81, 0x49, 0xF0, 0x22, 0x90, 0x81, 0x47, 0xE0,
+0xD3, 0x9D, 0x50, 0x10, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x11, 0xBE, 0x90, 0x81, 0x45, 0xE0,
+0x54, 0xFE, 0xF0, 0x22, 0x12, 0x4F, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80,
+0x3C, 0xE0, 0x64, 0x02, 0x60, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x81,
+0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0,
+0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25, 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,
+0x81, 0x27, 0xE0, 0x60, 0x03, 0x12, 0x47, 0x2A, 0x7F, 0x01, 0x01, 0x6E, 0xC3, 0xEE, 0x94, 0x01,
+0x40, 0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xC3, 0xEE, 0x94,
+0x01, 0x40, 0x24, 0x90, 0xFD, 0x11, 0xE0, 0x6D, 0x70, 0x1A, 0x90, 0x01, 0x17, 0xE0, 0xB5, 0x05,
+0x0D, 0x90, 0x01, 0xE4, 0x74, 0x77, 0xF0, 0x90, 0xFD, 0x11, 0xE4, 0xF0, 0x80, 0x06, 0xED, 0x04,
+0x90, 0xFD, 0x11, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xE4, 0x90, 0x81, 0x4E, 0xF0, 0xA3, 0xF0, 0xA3,
+0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x81, 0x4E, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x81,
+0x4E, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x81, 0x50, 0xE0, 0x94, 0x64, 0x90, 0x81,
+0x4F, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x4E,
+0xE0, 0xFF, 0x22, 0x90, 0x81, 0x4F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0x80, 0xC2, 0x74,
+0x45, 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, 0x82,
+0x12, 0xED, 0xF0, 0x90, 0x82, 0x11, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74,
+0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0,
+0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07,
+0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46,
+0x12, 0x32, 0x1E, 0x90, 0x82, 0x12, 0xE0, 0x60, 0x18, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01,
+0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80,
+0x17, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8,
+0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E, 0x90, 0x82, 0x11,
+0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3,
+0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E,
+0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC,
+0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x12, 0xE0,
+0x60, 0x1D, 0x90, 0x82, 0x11, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02,
+0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90,
+0x82, 0x11, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8,
+0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0,
+0x92, 0xAF, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90,
+0x81, 0x2B, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0C, 0x04, 0x70, 0x28, 0x90, 0x81, 0x2D, 0x74,
+0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, 0x90, 0x81, 0x3B, 0xE0, 0x90, 0x81, 0x2D, 0xF0,
+0x80, 0x05, 0x90, 0x81, 0x2D, 0xED, 0xF0, 0x90, 0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x25,
+0xE0, 0x44, 0x08, 0xF0, 0x22, 0x12, 0x4E, 0xAB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8,
+0x74, 0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x2B, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01,
+0xB8, 0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x29, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08,
+0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74,
+0x08, 0xF0, 0x80, 0x38, 0x90, 0x81, 0x2B, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10,
+0xF0, 0x80, 0x29, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01,
+0xB8, 0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74,
+0x80, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74,
+0x04, 0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x60, 0x42, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x3A,
+0x90, 0x81, 0x25, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x05, 0x22, 0x74, 0x0F, 0xF0, 0x90, 0x06, 0x04,
+0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF, 0x12, 0x4F, 0x0D, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0,
+0x44, 0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x06, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01,
+0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F,
+0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x02, 0xF0, 0x90, 0x81,
+0x23, 0xF0, 0x22, 0x12, 0x54, 0x65, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 0xF0,
+0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB,
+0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x81,
+0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0xFF,
+0xB4, 0x01, 0x02, 0x80, 0x04, 0xEF, 0xB4, 0x02, 0x06, 0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90,
+0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x80, 0xDE, 0xE0,
+0xB4, 0x01, 0x0B, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x47, 0x2A, 0x22, 0x22,
+0x90, 0x05, 0x2B, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90, 0x05, 0x22, 0x74,
+0xFF, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22,
+0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x12, 0x49, 0xDD, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0,
+0x22, 0x12, 0x49, 0xE3, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F,
+0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xAE,
+0x07, 0x12, 0x51, 0x73, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x0A, 0xAF,
+0x06, 0x7D, 0x01, 0x12, 0x47, 0x3D, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x01, 0x57, 0xE0,
+0x60, 0x48, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13,
+0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0C, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD,
+0xF0, 0x22, 0x90, 0x81, 0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90,
+0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0E, 0x90, 0x80, 0xDE, 0xE0,
+0xB4, 0x01, 0x07, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x90, 0x80, 0x3F, 0xE0, 0xFF,
+0x7D, 0x01, 0x12, 0x6D, 0x69, 0x8E, 0x54, 0x8F, 0x55, 0xAD, 0x55, 0xAC, 0x54, 0xAF, 0x53, 0x12,
+0x4F, 0x82, 0xAF, 0x55, 0xAE, 0x54, 0x90, 0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74,
+0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x11, 0x2C,
+0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x16, 0x2C,
+0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15, 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, 0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4, 0xF0, 0x90, 0x04,
+0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50, 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, 0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B,
+0xFB, 0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x80, 0xDB, 0xE0, 0x9B, 0x90, 0x80, 0xDA, 0xE0, 0x9A, 0x50,
+0x13, 0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0xDA, 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, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90,
+0x81, 0x42, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01,
+0x12, 0x1F, 0xBD, 0x90, 0x81, 0x43, 0xF0, 0x22, 0x90, 0x81, 0x45, 0xE0, 0x30, 0xE0, 0x2D, 0x90,
+0x81, 0x48, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x81, 0x46, 0xE0, 0xB5, 0x07, 0x1E, 0x90, 0x06,
+0x92, 0xE0, 0x54, 0x1C, 0x70, 0x0B, 0x12, 0x4F, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0x80,
+0x06, 0x90, 0x06, 0x92, 0x74, 0x1C, 0xF0, 0xE4, 0x90, 0x81, 0x48, 0xF0, 0x22, 0x00, 0xBB, 0x8E,
+};
+u4Byte ArrayLength_MP_8188E_FW_NIC_T = 13904;
+
+
+void
+ODM_ReadFirmware_MP_8188E_FW_NIC_T(
+ 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_8188E_FW_NIC_T;
+#else
+ ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_NIC_T, ArrayLength_MP_8188E_FW_NIC_T);
+#endif
+ *pFirmwareSize = ArrayLength_MP_8188E_FW_NIC_T;
+}
+
+
+u1Byte Array_MP_8188E_FW_WoWLAN_S[] = {
+0xE2, 0x88, 0x30, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x10, 0x14, 0x26, 0x43, 0x02, 0x00,
+0xCD, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x02, 0x4E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x02, 0x4F, 0xFD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x4F, 0xAD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x57, 0xF3, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0xE7, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x46, 0xE7, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x3E,
+0x88, 0x82, 0x8C, 0x83, 0xE7, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x32, 0xE3, 0x09, 0xF6, 0x08,
+0xDF, 0xFA, 0x80, 0x78, 0xE3, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x70, 0x88, 0x82, 0x8C, 0x83,
+0xE3, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x64, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF6, 0x08,
+0xDF, 0xFA, 0x80, 0x58, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x4C,
+0x80, 0xD2, 0x80, 0xFA, 0x80, 0xC6, 0x80, 0xD4, 0x80, 0x69, 0x80, 0xF2, 0x80, 0x33, 0x80, 0x10,
+0x80, 0xA6, 0x80, 0xEA, 0x80, 0x9A, 0x80, 0xA8, 0x80, 0xDA, 0x80, 0xE2, 0x80, 0xCA, 0x80, 0x33,
+0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83,
+0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xE9, 0xDE, 0xE7, 0x80,
+0x0D, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF6, 0x08, 0xDF, 0xF9, 0xEC, 0xFA, 0xA9, 0xF0,
+0xED, 0xFB, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC,
+0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xEA, 0xDE,
+0xE8, 0x80, 0xDB, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF2, 0x08, 0xDF, 0xF9, 0x80, 0xCC,
+0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, 0xC3, 0x88, 0xF0, 0xED, 0x24, 0x02, 0xB4, 0x04,
+0x00, 0x50, 0xB9, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0xAF, 0x23, 0x23, 0x45,
+0x82, 0x23, 0x90, 0x48, 0x50, 0x73, 0xBB, 0x01, 0x09, 0x89, 0x82, 0x8A, 0x83, 0xF8, 0xE0, 0x28,
+0xF0, 0x22, 0x50, 0x03, 0x27, 0xF7, 0x22, 0xBB, 0xFE, 0x05, 0xF8, 0xE3, 0x28, 0xF3, 0x22, 0x8A,
+0x83, 0x89, 0x82, 0xF8, 0xE4, 0x93, 0x28, 0x22, 0xBB, 0x01, 0x0F, 0xF8, 0xE5, 0x82, 0x29, 0xF5,
+0x82, 0xE5, 0x83, 0x3A, 0xF5, 0x83, 0xE0, 0x28, 0xF0, 0x22, 0x50, 0x09, 0xC5, 0x82, 0x29, 0xF8,
+0xE5, 0x82, 0x26, 0xF6, 0x22, 0xBB, 0xFE, 0x09, 0xC5, 0x82, 0x29, 0xF8, 0xE2, 0x25, 0x82, 0xF2,
+0x22, 0xF8, 0xEA, 0x25, 0x83, 0xF5, 0x83, 0xE9, 0x93, 0x28, 0x22, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0,
+0x28, 0xF0, 0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0,
+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, 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, 0xBB, 0x01, 0x1A, 0x89, 0x82, 0x8A, 0x83, 0xD0,
+0xF0, 0xD0, 0xE0, 0xF8, 0xD0, 0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xE8, 0xC0, 0xE0,
+0xC0, 0xF0, 0x02, 0x49, 0x8F, 0x50, 0x16, 0xE9, 0xF8, 0xD0, 0x83, 0xD0, 0x82, 0xD0, 0xE0, 0xF9,
+0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xC0, 0x82, 0xC0, 0x83, 0x02, 0x4C, 0x3C, 0xBB, 0xFE, 0x16,
+0xE9, 0xF8, 0xD0, 0x83, 0xD0, 0x82, 0xD0, 0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xC0,
+0x82, 0xC0, 0x83, 0x02, 0x4C, 0x45, 0x22, 0xBB, 0x01, 0x20, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE5,
+0x83, 0x3A, 0xF5, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0xF8, 0xD0, 0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0,
+0xE0, 0xFB, 0xE8, 0xC0, 0xE0, 0xC0, 0xF0, 0x02, 0x49, 0x8F, 0x50, 0x18, 0xE9, 0x25, 0x82, 0xF8,
+0xD0, 0x83, 0xD0, 0x82, 0xD0, 0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xC0, 0x82, 0xC0,
+0x83, 0x02, 0x4C, 0x3C, 0xBB, 0xFE, 0x18, 0xE9, 0x25, 0x82, 0xF8, 0xD0, 0x83, 0xD0, 0x82, 0xD0,
+0xE0, 0xF9, 0xD0, 0xE0, 0xFA, 0xD0, 0xE0, 0xFB, 0xC0, 0x82, 0xC0, 0x83, 0x02, 0x4C, 0x45, 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, 0x4B, 0x95, 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, 0x4B, 0xA1, 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, 0x4A, 0xDD, 0x73,
+0xEF, 0x4E, 0x60, 0x12, 0xEF, 0x60, 0x01, 0x0E, 0xED, 0xBB, 0x01, 0x0B, 0x89, 0x82, 0x8A, 0x83,
+0xF0, 0xA3, 0xDF, 0xFC, 0xDE, 0xFA, 0x22, 0x89, 0xF0, 0x50, 0x07, 0xF7, 0x09, 0xDF, 0xFC, 0xA9,
+0xF0, 0x22, 0xBB, 0xFE, 0xFC, 0xF3, 0x09, 0xDF, 0xFC, 0xA9, 0xF0, 0x22, 0xEB, 0xF6, 0x08, 0xEA,
+0xF6, 0x08, 0xE9, 0xF6, 0x22, 0xEB, 0xF2, 0x08, 0xEA, 0xF2, 0x08, 0xE9, 0xF2, 0x22, 0xC2, 0xAF,
+0x80, 0xFE, 0x32, 0x12, 0x4C, 0x52, 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,
+0x8B, 0xF8, 0xE6, 0xBC, 0x04, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, 0x40, 0xCE,
+0x79, 0x05, 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, 0x05, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, 0xE4, 0xF2,
+0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x8A, 0x25, 0x0C, 0xF8, 0xE6, 0xFD,
+0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x04, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, 0x6D, 0x60,
+0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, 0x0C, 0x24,
+0x8B, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x04, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, 0xF8, 0xE5,
+0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x8A, 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, 0x8A, 0xA6, 0x81, 0x74,
+0x04, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x05, 0xE4, 0x78, 0x80, 0xF6, 0x08,
+0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x4F, 0xA3, 0x74, 0x01, 0x93, 0xC0, 0xE0,
+0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, 0x8C, 0xD2,
+0xAF, 0x22, 0x04, 0xEF, 0xD3, 0x94, 0x04, 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, 0x8A, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, 0xBE, 0x04,
+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, 0x8A, 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, 0x8A, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, 0x04, 0x90,
+0x4F, 0xA3, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x04,
+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, 0x8A, 0x2F, 0xF8, 0xE6,
+0xF5, 0x81, 0x02, 0x4C, 0x9B, 0x50, 0x2E, 0x74, 0x8B, 0x2F, 0xF8, 0xE6, 0xBF, 0x04, 0x02, 0x74,
+0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x8A, 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, 0x8B, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, 0x0F, 0x74,
+0x8A, 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, 0x04, 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, 0x4C, 0x9A, 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, 0x4C, 0x9B, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, 0x56, 0xC6,
+0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0x02, 0x4F, 0x35, 0x02, 0x4D, 0x2B, 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, 0x4F, 0x7A, 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, 0x00, 0x41, 0x83, 0xA7, 0x00, 0x41,
+0x83, 0xA8, 0x00, 0x41, 0x83, 0xB3, 0x00, 0x44, 0x83, 0x4F, 0x00, 0x50, 0xF2, 0x01, 0x44, 0x83,
+0x53, 0x00, 0x0F, 0xAC, 0x01, 0x44, 0x83, 0x57, 0x00, 0x0F, 0xAC, 0x03, 0x44, 0x83, 0x5B, 0x00,
+0x0F, 0xAC, 0x04, 0x59, 0x92, 0x60, 0xED, 0x61, 0x0B, 0x62, 0x4F, 0x63, 0x74, 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, 0x90, 0x01, 0xC4, 0x74, 0xAD, 0xF0,
+0x74, 0x4F, 0xA3, 0xF0, 0x12, 0x6C, 0x7D, 0x74, 0xAD, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x4F,
+0xA3, 0xF0, 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, 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, 0x90, 0x01, 0xC4, 0x74, 0xFD, 0xF0,
+0x74, 0x4F, 0xA3, 0xF0, 0x12, 0x6C, 0xB7, 0xE5, 0x41, 0x30, 0xE3, 0x02, 0xF1, 0xE6, 0xE5, 0x41,
+0x30, 0xE4, 0x05, 0x7F, 0x02, 0x12, 0x4E, 0x75, 0xE5, 0x43, 0x30, 0xE1, 0x02, 0x11, 0x65, 0x74,
+0xFD, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x4F, 0xA3, 0xF0, 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, 0x51, 0x2B, 0x90, 0x81, 0xFB, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x80,
+0xA3, 0xE0, 0xB4, 0x01, 0x26, 0x90, 0x83, 0xB3, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90,
+0x81, 0xFD, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x83, 0xB3, 0xF0, 0x90, 0x81, 0xFD, 0xE0, 0xFF, 0x90,
+0x81, 0xFC, 0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0x11, 0x9C, 0x22, 0xE4, 0xFF, 0xD3, 0x10,
+0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x4E, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x19, 0x90, 0x05, 0x22,
+0xE0, 0xF5, 0x51, 0x74, 0xFF, 0xF0, 0x12, 0x6F, 0x85, 0xBF, 0x01, 0x02, 0x31, 0x20, 0x90, 0x05,
+0x22, 0xE5, 0x51, 0xF0, 0x80, 0x02, 0x31, 0x20, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01,
+0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0,
+0x54, 0x3F, 0xF0, 0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
+0xE0, 0x44, 0x10, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44,
+0x80, 0xF0, 0x22, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF,
+0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22,
+0x90, 0x80, 0x04, 0xE0, 0xFF, 0x7D, 0x01, 0x31, 0xC1, 0x8E, 0x4F, 0x8F, 0x50, 0xAD, 0x50, 0xAC,
+0x4F, 0xAF, 0x4E, 0x11, 0xD5, 0xAF, 0x50, 0xAE, 0x4F, 0x90, 0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD,
+0xAC, 0x07, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0,
+0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07,
+0x74, 0x16, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15,
+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, 0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4,
+0xF0, 0x90, 0x04, 0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50, 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, 0xE0, 0xFF, 0x7D,
+0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0xAA, 0xED, 0xF0, 0x90, 0x83, 0xA9,
+0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x12, 0x5D, 0x8E, 0x7C, 0x00, 0xAD, 0x07, 0x90, 0x83, 0xA9, 0xE0,
+0x90, 0x04, 0x25, 0xF0, 0x90, 0x83, 0xAA, 0xE0, 0x60, 0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4,
+0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4,
+0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
+0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54,
+0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0xFE, 0xE0, 0x30,
+0xE0, 0x2C, 0x90, 0x82, 0x01, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x81, 0xFF, 0xE0, 0xB5, 0x07,
+0x1D, 0x90, 0x06, 0x92, 0xE0, 0x54, 0x1C, 0x70, 0x0A, 0x11, 0x9C, 0x90, 0x82, 0x02, 0xE0, 0x04,
+0xF0, 0x80, 0x06, 0x90, 0x06, 0x92, 0x74, 0x1C, 0xF0, 0xE4, 0x90, 0x82, 0x01, 0xF0, 0x22, 0x90,
+0x81, 0xFE, 0xE0, 0x30, 0xE0, 0x47, 0x90, 0x82, 0x02, 0xE0, 0xFD, 0x60, 0x40, 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, 0x82, 0x02, 0xF0, 0x22, 0x90, 0x82, 0x00,
+0xE0, 0xD3, 0x9D, 0x50, 0x10, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x51, 0xAE, 0x90, 0x81, 0xFE,
+0xE0, 0x54, 0xFE, 0xF0, 0x22, 0x11, 0x9C, 0x90, 0x82, 0x02, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80,
+0x01, 0xE0, 0x64, 0x02, 0x70, 0x4B, 0x90, 0x80, 0xE6, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54,
+0x01, 0x30, 0xE0, 0x08, 0x90, 0x01, 0x4D, 0xE0, 0x64, 0x80, 0xF0, 0x22, 0x90, 0x80, 0xE5, 0xE0,
+0xFE, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x13, 0xEF, 0x54, 0x7F, 0xFF, 0xE4, 0xFD, 0xD1, 0xD0,
+0x90, 0x80, 0xE6, 0xE0, 0x54, 0x7F, 0xFF, 0x7D, 0x01, 0x80, 0x14, 0x90, 0x80, 0xE6, 0xE0, 0x54,
+0x7F, 0xFF, 0x7D, 0x01, 0xD1, 0xD0, 0x90, 0x80, 0xE6, 0xE0, 0x54, 0x7F, 0xFF, 0xE4, 0xFD, 0xC1,
+0xD0, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
+0x90, 0x82, 0x37, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xE4, 0x90, 0x82, 0x42, 0xF0,
+0xA3, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x90, 0x06, 0x31, 0xE0, 0x54, 0xEF, 0x44, 0x08, 0xF0, 0x90,
+0x82, 0x37, 0xA3, 0xE0, 0x24, 0x00, 0xF9, 0xE4, 0x34, 0xFB, 0xFA, 0x7B, 0x01, 0x12, 0x5D, 0xF8,
+0x90, 0x82, 0x37, 0xA3, 0xE0, 0x2F, 0xFF, 0x90, 0x82, 0x44, 0xE0, 0x2F, 0x90, 0x82, 0x46, 0xF0,
+0x7E, 0x00, 0x7F, 0x83, 0x7D, 0x00, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x55, 0x12, 0x4C, 0x10, 0x90,
+0x82, 0x46, 0xE0, 0x24, 0x00, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15,
+0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x55, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x46, 0xE0,
+0x24, 0x01, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x01,
+0x7B, 0x01, 0x7A, 0x81, 0x79, 0x56, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x46, 0xE0, 0x24, 0x02, 0xF9,
+0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0x7B, 0x01, 0x7A,
+0x81, 0x79, 0x57, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x46, 0xE0, 0x24, 0x04, 0xF9, 0xE4, 0x34, 0xFB,
+0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x59,
+0x12, 0x2B, 0xED, 0x90, 0x82, 0x46, 0xE0, 0x24, 0x05, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01,
+0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5A, 0x12, 0x2B, 0xED,
+0x90, 0x82, 0x46, 0xE0, 0x24, 0x07, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89,
+0x15, 0x75, 0x16, 0x02, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5C, 0x12, 0x2B, 0xED, 0xE4, 0x90, 0x82,
+0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x08, 0x50, 0x32, 0xA3, 0xE0, 0x24, 0x09,
+0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24, 0x00, 0xF5, 0x82,
+0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24, 0x5E, 0xF5, 0x82, 0xE4,
+0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0, 0x80, 0xC4, 0xE4, 0x90,
+0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x20, 0x50, 0x32, 0xA3, 0xE0, 0x24,
+0x11, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24, 0x00, 0xF5,
+0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24, 0x66, 0xF5, 0x82,
+0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0, 0x80, 0xC4, 0xE4,
+0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x10, 0x50, 0x32, 0xA3, 0xE0,
+0x24, 0x31, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24, 0x00,
+0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24, 0x86, 0xF5,
+0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0, 0x80, 0xC4,
+0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x08, 0x50, 0x32, 0xA3,
+0xE0, 0x24, 0x41, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24,
+0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24, 0x96,
+0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0, 0x80,
+0xC4, 0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x08, 0x50, 0x32,
+0xA3, 0xE0, 0x24, 0x49, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0,
+0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0, 0x24,
+0x9E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04, 0xF0,
+0x80, 0xC4, 0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x10, 0x50,
+0x32, 0xA3, 0xE0, 0x24, 0x51, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3, 0xEF,
+0xF0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45, 0xE0,
+0x24, 0xA6, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0x04,
+0xF0, 0x80, 0xC4, 0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94, 0x02,
+0x50, 0x32, 0xA3, 0xE0, 0x24, 0x61, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0, 0xA3,
+0xEF, 0xF0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x45,
+0xE0, 0x24, 0xB6, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45, 0xE0,
+0x04, 0xF0, 0x80, 0xC4, 0xE4, 0x90, 0x82, 0x45, 0xF0, 0x90, 0x82, 0x45, 0xE0, 0xFF, 0xC3, 0x94,
+0x20, 0x50, 0x32, 0xA3, 0xE0, 0x24, 0x63, 0xD1, 0x9A, 0x7E, 0x00, 0x90, 0x82, 0x40, 0xEE, 0xF0,
+0xA3, 0xEF, 0xF0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82,
+0x45, 0xE0, 0x24, 0xB8, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x45,
+0xE0, 0x04, 0xF0, 0x80, 0xC4, 0x90, 0x81, 0x57, 0xE0, 0xFC, 0xA3, 0xE0, 0xFA, 0xEC, 0xFF, 0xEA,
+0xFE, 0x90, 0x82, 0x3C, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x81, 0xB6, 0xE0, 0xFE, 0xA3, 0xE0,
+0xFD, 0xED, 0xFF, 0x90, 0x82, 0x3E, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x81, 0x5A, 0xE0, 0xFE,
+0xA3, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x82, 0x3A, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x30, 0xE3, 0x04,
+0x51, 0xAE, 0x80, 0x3F, 0x90, 0x82, 0x3A, 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, 0x81, 0xEE,
+0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xE4, 0xFD, 0x12, 0x77, 0xFE, 0x90, 0x06, 0x31, 0xE0, 0x54, 0xF7,
+0x44, 0x10, 0xF0, 0x7F, 0x00, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xFD, 0xE4, 0x33, 0xFC, 0x7E, 0x00,
+0xED, 0x2F, 0xFF, 0xEE, 0x3C, 0xFE, 0x90, 0x82, 0x39, 0xE0, 0xFD, 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,
+0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0xAE, 0xED, 0xF0, 0x90, 0x83, 0xAD, 0xEF,
+0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3,
+0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0, 0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E,
+0x90, 0x83, 0xAD, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC,
+0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xAE, 0xE0,
+0x60, 0x18, 0x90, 0x83, 0xAD, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33,
+0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80, 0x17, 0x90, 0x83, 0xAD, 0xE0, 0xFF, 0x74,
+0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0,
+0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E, 0x90, 0x83, 0xAD, 0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04,
+0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00,
+0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xAD, 0xE0, 0xFF, 0x74, 0x01,
+0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD,
+0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xAE, 0xE0, 0x60, 0x1D, 0x90, 0x83, 0xAD, 0xE0, 0x24,
+0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00,
+0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90, 0x83, 0xAD, 0xE0, 0x24, 0x04, 0xFF, 0x74,
+0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0,
+0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x01, 0x67, 0xE4, 0xFF,
+0x41, 0x5F, 0x7F, 0x01, 0x41, 0x5F, 0x90, 0x80, 0xE4, 0xE0, 0x30, 0xE0, 0x05, 0x7F, 0x04, 0x12,
+0x4E, 0x75, 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,
+0x90, 0x01, 0xC4, 0x74, 0xF3, 0xF0, 0x74, 0x57, 0xA3, 0xF0, 0x11, 0x64, 0xE5, 0x4C, 0x30, 0xE1,
+0x05, 0x7F, 0x03, 0x12, 0x4E, 0x75, 0xE5, 0x4C, 0x30, 0xE4, 0x03, 0x12, 0x57, 0xDC, 0xE5, 0x4C,
+0x30, 0xE5, 0x03, 0x12, 0x57, 0xDE, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x57, 0xE2, 0x74, 0xF3,
+0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x57, 0xA3, 0xF0, 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, 0x01, 0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, 0x46,
+0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47, 0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, 0x01,
+0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5, 0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, 0xF0,
+0x53, 0x91, 0xDF, 0x22, 0x90, 0x01, 0xC8, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A,
+0x82, 0x79, 0x03, 0x7F, 0xFF, 0xFE, 0x12, 0x2B, 0x27, 0xBF, 0x01, 0x09, 0x90, 0x82, 0x03, 0xE0,
+0x64, 0x03, 0x60, 0x03, 0x22, 0x21, 0x56, 0xE4, 0x90, 0x82, 0x08, 0xF0, 0x90, 0x82, 0x08, 0xE0,
+0xFF, 0xC3, 0x94, 0x02, 0x40, 0x02, 0x21, 0x91, 0xC3, 0x74, 0xFE, 0x9F, 0xFF, 0xE4, 0x94, 0x00,
+0xFE, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x04, 0x12, 0x2B, 0x27, 0xEF, 0x64, 0x01, 0x70, 0x77, 0x90,
+0x82, 0x04, 0xE0, 0xFF, 0x54, 0xC0, 0xFE, 0x60, 0x05, 0xEF, 0x54, 0x0C, 0x70, 0x16, 0x90, 0x82,
+0x04, 0xE0, 0xFF, 0x54, 0x30, 0x60, 0x67, 0xEF, 0x54, 0x03, 0x60, 0x62, 0x90, 0x82, 0x05, 0x74,
+0x01, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x82, 0x05, 0xF0, 0x90, 0x82, 0x05, 0xE0, 0x90, 0x82, 0x04,
+0x70, 0x16, 0xE0, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x82, 0x06, 0xF0, 0xEF, 0x54, 0x0C,
+0x13, 0x13, 0x54, 0x3F, 0xA3, 0xF0, 0x80, 0x0D, 0xE0, 0xFE, 0x54, 0x30, 0x90, 0x82, 0x06, 0xF0,
+0xEE, 0x54, 0x03, 0xA3, 0xF0, 0x90, 0x82, 0x06, 0xE0, 0x64, 0x30, 0x70, 0x54, 0xA3, 0xE0, 0x64,
+0x02, 0x70, 0x4E, 0x90, 0x00, 0xF5, 0xE0, 0x54, 0x40, 0x90, 0x82, 0x09, 0xF0, 0xE0, 0x70, 0x41,
+0xA3, 0x74, 0x02, 0xF0, 0x80, 0x10, 0x90, 0x82, 0x0A, 0x74, 0x01, 0xF0, 0x80, 0x08, 0x90, 0x82,
+0x08, 0xE0, 0x04, 0xF0, 0x01, 0xBC, 0x90, 0x01, 0xC4, 0x74, 0x94, 0xF0, 0x74, 0x58, 0xA3, 0xF0,
+0x90, 0x82, 0x0A, 0xE0, 0x90, 0x01, 0xC8, 0xF0, 0x90, 0x82, 0x04, 0xE0, 0x90, 0x01, 0xC9, 0xF0,
+0x90, 0x82, 0x05, 0xE0, 0x90, 0x01, 0xCA, 0xF0, 0xE4, 0xFD, 0x7F, 0x1F, 0x12, 0x32, 0x1E, 0x80,
+0xD5, 0x22, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD,
+0x00, 0xE0, 0x54, 0xBF, 0xF0, 0x11, 0x94, 0xF1, 0x76, 0x12, 0x32, 0x77, 0x12, 0x6B, 0xF7, 0xF1,
+0x51, 0x7F, 0x01, 0x12, 0x4D, 0x63, 0x7F, 0x02, 0x12, 0x4D, 0x63, 0x7F, 0x03, 0x12, 0x4D, 0x63,
+0x7F, 0x04, 0x12, 0x4D, 0x63, 0x31, 0xFF, 0x31, 0xE4, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD,
+0x7F, 0x80, 0x12, 0x32, 0x1E, 0x75, 0x20, 0xFF, 0xF1, 0x67, 0x12, 0x6C, 0x27, 0xF1, 0x7E, 0xE4,
+0xFF, 0x02, 0x4D, 0xEC, 0xF1, 0x55, 0xF1, 0x6E, 0x51, 0x42, 0xF1, 0x88, 0x90, 0x81, 0xFE, 0xE0,
+0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xF1,
+0xC7, 0x90, 0x80, 0x01, 0xEF, 0xF0, 0x51, 0x11, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x02, 0x2D,
+0xA7, 0x12, 0x6B, 0x58, 0x12, 0x6B, 0x88, 0x12, 0x6B, 0xB9, 0x12, 0x6B, 0xD8, 0xE4, 0xF5, 0x35,
+0xF5, 0x36, 0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F,
+0x51, 0x12, 0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02,
+0x32, 0x1E, 0x90, 0x80, 0xE4, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x80, 0xE9, 0xE0, 0x54, 0xFE, 0xF0,
+0x90, 0x06, 0x90, 0xE0, 0x44, 0x20, 0xF0, 0x90, 0x80, 0xE5, 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, 0xA3, 0xE0, 0x54, 0xFE, 0xF0,
+0x90, 0x80, 0xE6, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x80, 0xE8, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0xEF,
+0x60, 0x58, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x90, 0x81, 0xF1, 0xE0, 0xFF, 0x60, 0x02,
+0x71, 0x3D, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16, 0xE0,
+0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0x9F, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x06,
+0x09, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x71, 0x9C, 0x90, 0x02, 0x86,
+0xE0, 0x44, 0x04, 0xF0, 0x71, 0x09, 0xF1, 0x4F, 0x91, 0x2A, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90,
+0x01, 0x34, 0x74, 0x08, 0xF0, 0xFD, 0xE4, 0xFF, 0xE1, 0x9A, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22,
+0xF0, 0x7D, 0x08, 0xE4, 0xFF, 0xF1, 0xAF, 0x90, 0x06, 0x90, 0xE4, 0xF0, 0x90, 0x02, 0x86, 0xE0,
+0x54, 0xFB, 0xF0, 0x71, 0x1A, 0xF1, 0x50, 0x41, 0x42, 0x12, 0x65, 0xC1, 0x90, 0x02, 0x87, 0xE0,
+0x70, 0xF7, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x02, 0xF0, 0x22, 0x51, 0x57, 0x90, 0x01, 0x3F, 0x74,
+0x04, 0xF0, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0xB4, 0x01, 0x07, 0x90, 0xFD, 0x00, 0xE0, 0x54, 0xEF,
+0xF0, 0xEF, 0xB4, 0x01, 0x07, 0x90, 0xFE, 0x10, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0xB1, 0x8E, 0x7E,
+0x00, 0x74, 0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75,
+0x16, 0x08, 0x7B, 0x01, 0x7A, 0x80, 0x79, 0xFB, 0x12, 0x2B, 0xED, 0x90, 0x80, 0xFB, 0xE0, 0x90,
+0x81, 0x03, 0xF0, 0x90, 0x80, 0xFC, 0xE0, 0x90, 0x81, 0x04, 0xF0, 0x90, 0x80, 0xFD, 0xE0, 0x90,
+0x81, 0x05, 0xF0, 0x90, 0x80, 0xFE, 0xE0, 0x90, 0x81, 0x06, 0xF0, 0x90, 0x80, 0xFF, 0xE0, 0x90,
+0x81, 0x07, 0xF0, 0x90, 0x81, 0x00, 0xE0, 0x90, 0x81, 0x08, 0xF0, 0x90, 0x81, 0x01, 0xE0, 0x90,
+0x81, 0x09, 0xF0, 0x90, 0x81, 0x02, 0xE0, 0x90, 0x81, 0x0A, 0xF0, 0x22, 0x12, 0x6F, 0x85, 0x90,
+0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2,
+0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E,
+0xA2, 0x90, 0x83, 0x97, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xFD, 0xFF, 0x91, 0x07,
+0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83, 0xA3, 0x12, 0x20,
+0xCE, 0x90, 0x83, 0xA3, 0x12, 0x49, 0x6E, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E,
+0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90,
+0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xC0, 0x07,
+0xC0, 0x05, 0x90, 0x83, 0x97, 0x12, 0x49, 0x6E, 0x90, 0x83, 0x70, 0x12, 0x20, 0xCE, 0xD0, 0x05,
+0xD0, 0x07, 0x12, 0x69, 0x30, 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, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D,
+0x5C, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x83, 0x9F, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x9F, 0x12, 0x49,
+0x6E, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85,
+0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90,
+0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2,
+0x90, 0x83, 0x97, 0x12, 0x20, 0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0x91, 0x07, 0xD0,
+0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F, 0xA4, 0xFF, 0x54,
+0x01, 0xFE, 0x90, 0x80, 0xE4, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE,
+0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D,
+0xFF, 0x90, 0x80, 0xE4, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12,
+0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x80, 0xE4, 0xF0, 0xEE,
+0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16,
+0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0x9F, 0xF0, 0xA3, 0xEF, 0xF0, 0x90,
+0x80, 0xE4, 0xE0, 0xC3, 0x13, 0x54, 0x01, 0xFF, 0xB1, 0x49, 0x90, 0x80, 0xE4, 0xE0, 0x13, 0x13,
+0x54, 0x01, 0xFF, 0xF1, 0x5B, 0x90, 0x80, 0xE4, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFF, 0xB1,
+0x54, 0x90, 0x80, 0xE4, 0xE0, 0xC4, 0x54, 0x01, 0xFF, 0xF1, 0x61, 0x90, 0x80, 0xE4, 0xE0, 0x54,
+0x01, 0xFF, 0x51, 0x8F, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xEF, 0x60, 0x07, 0x90, 0x81, 0xF2, 0xE0,
+0xFF, 0xB1, 0xA2, 0x22, 0xE4, 0xFD, 0xFC, 0xEF, 0x60, 0x33, 0x90, 0x81, 0xF5, 0xE0, 0xFF, 0xB1,
+0x8E, 0x7C, 0x00, 0xAD, 0x07, 0x74, 0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0x90,
+0x82, 0x1A, 0x12, 0x49, 0x8F, 0x90, 0x82, 0x1A, 0x12, 0x49, 0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89,
+0x15, 0x75, 0x16, 0x4A, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x0B, 0x12, 0x2B, 0xED, 0x22, 0xE4, 0xFE,
+0xEF, 0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0, 0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF,
+0x06, 0x22, 0xB1, 0x8E, 0x7E, 0x00, 0x90, 0x83, 0xB1, 0xB1, 0xEA, 0x90, 0x83, 0xB1, 0xA3, 0xE0,
+0x2F, 0x24, 0x36, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16,
+0x04, 0x7B, 0x01, 0x7A, 0x80, 0x79, 0xF6, 0x12, 0x2B, 0xED, 0xE4, 0xFF, 0x74, 0x18, 0x2F, 0xF5,
+0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0xEA, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80,
+0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x06, 0xE3, 0x22, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x24,
+0x20, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xE4, 0x90, 0x83, 0xB4, 0xF0, 0xFF, 0x12, 0x1F,
+0xA4, 0x30, 0xE7, 0x08, 0x90, 0x83, 0xB4, 0x74, 0x02, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x83, 0xB4,
+0xF0, 0x12, 0x6E, 0xF9, 0x90, 0x83, 0xB4, 0xE0, 0x24, 0x18, 0x2F, 0xFF, 0x22, 0x90, 0x82, 0x17,
+0x12, 0x49, 0x8F, 0xEF, 0x12, 0x4A, 0x40, 0x5E, 0x49, 0x00, 0x5E, 0x52, 0x01, 0x5E, 0x5A, 0x02,
+0x5E, 0x63, 0x03, 0x5E, 0x6C, 0x04, 0x5E, 0x7C, 0x80, 0x5E, 0x74, 0x81, 0x5E, 0x84, 0x82, 0x5E,
+0x8D, 0x83, 0x5E, 0x96, 0x84, 0x00, 0x00, 0x5E, 0x9F, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x02,
+0x6A, 0xD1, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x80, 0x79, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86,
+0x02, 0x6B, 0x19, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x02, 0x70, 0x53, 0x90, 0x82, 0x17, 0x12,
+0x49, 0x86, 0x80, 0x33, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x81, 0xA4, 0x90, 0x82, 0x17, 0x12,
+0x49, 0x86, 0xE1, 0xE1, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x02, 0x71, 0xB9, 0x90, 0x82, 0x17,
+0x12, 0x49, 0x86, 0x02, 0x71, 0xD3, 0x90, 0x82, 0x17, 0x12, 0x49, 0x86, 0x02, 0x72, 0x35, 0x90,
+0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x31, 0xEC, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE,
+0x90, 0x81, 0xFE, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00,
+0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0xFF, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82,
+0x00, 0xF0, 0x22, 0x90, 0x82, 0x1A, 0x12, 0x49, 0x8F, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF,
+0xFE, 0x12, 0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x82, 0x1A, 0x12, 0x49, 0x86,
+0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0x1E, 0xF0, 0x80, 0x05, 0x90, 0x82, 0x1E, 0xEF,
+0xF0, 0x90, 0x82, 0x1D, 0xEE, 0xF0, 0x90, 0x82, 0x1E, 0xE0, 0xFE, 0x90, 0x82, 0x1D, 0xE0, 0xFF,
+0xD3, 0x9E, 0x50, 0x38, 0x90, 0x82, 0x1A, 0x12, 0x49, 0x86, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFE,
+0x74, 0xA3, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xA3, 0x2F, 0xF5,
+0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xF1, 0x4E, 0x80, 0x07, 0x90, 0x82, 0x1D,
+0xE0, 0xFF, 0xF1, 0x4D, 0x90, 0x82, 0x1D, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x22, 0x22, 0x22, 0x22,
+0x22, 0xE4, 0xF5, 0x4D, 0x22, 0xE4, 0x90, 0x80, 0xA3, 0xF0, 0x22, 0x90, 0x82, 0x1A, 0xEF, 0xF0,
+0x22, 0x90, 0x82, 0x1A, 0xEF, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0xE4, 0x90,
+0x80, 0x9D, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x01,
+0xE4, 0x74, 0x0C, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90, 0x81, 0xFB, 0xE0, 0x54, 0xFE, 0xF0, 0x54,
+0x7F, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D,
+0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x74,
+0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4,
+0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09, 0xE0, 0x7F,
+0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02, 0x7F, 0x03,
+0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F, 0xA4, 0xFC, 0x20, 0xE0, 0x05, 0x71,
+0x1A, 0x02, 0x60, 0xE8, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x80, 0xE5, 0xE0, 0x54,
+0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F,
+0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x80, 0xE5, 0xF0, 0xEE, 0x54,
+0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF,
+0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x80, 0xE5, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E,
+0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x80,
+0xE5, 0xF0, 0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F,
+0xBD, 0xFD, 0x54, 0x80, 0xFF, 0x90, 0x80, 0xE6, 0xE0, 0x54, 0x7F, 0x4F, 0xF0, 0xEC, 0x13, 0x13,
+0x54, 0x3F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x04, 0xF0, 0x12, 0x1F, 0xA4, 0x13,
+0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x80,
+0x01, 0xE0, 0x64, 0x02, 0x70, 0x44, 0x90, 0x80, 0xE6, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54,
+0x01, 0x20, 0xE0, 0x36, 0xED, 0x54, 0x7F, 0xFE, 0xEF, 0x54, 0x80, 0x4E, 0x90, 0x80, 0xE6, 0xF0,
+0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x80, 0xE7, 0xF0, 0x90, 0x80, 0xE5, 0xE0, 0xC4, 0x13,
+0x54, 0x07, 0x30, 0xE0, 0x09, 0xA3, 0xE0, 0x54, 0x7F, 0xFF, 0xE4, 0xFD, 0x80, 0x09, 0x90, 0x80,
+0xE6, 0xE0, 0x54, 0x7F, 0xFF, 0x7D, 0x01, 0x12, 0x56, 0xD0, 0x90, 0x80, 0x01, 0xE0, 0xB4, 0x01,
+0x07, 0x90, 0xFE, 0x10, 0xE0, 0x44, 0x04, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, 0x82,
+0x0B, 0xF0, 0x90, 0x82, 0x0B, 0xE0, 0x64, 0x01, 0xF0, 0x24, 0xED, 0x90, 0x01, 0xC4, 0xF0, 0x74,
+0x60, 0xA3, 0xF0, 0x31, 0x0A, 0x12, 0x4C, 0x9B, 0x80, 0xE8, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F,
+0x01, 0x12, 0x4E, 0x9C, 0x90, 0x82, 0x0C, 0xEF, 0xF0, 0x60, 0xF0, 0x31, 0x1F, 0x80, 0xEC, 0xD3,
+0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x82, 0x0D, 0xF0,
+0x90, 0x82, 0x0D, 0xE0, 0xFD, 0x70, 0x02, 0x41, 0x4A, 0x90, 0x83, 0xA7, 0xE0, 0xFF, 0x74, 0x01,
+0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF,
+0x5D, 0x70, 0x02, 0x41, 0x43, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12,
+0x49, 0x7A, 0xE0, 0x90, 0x82, 0x0E, 0xF0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x82, 0x75, 0x15, 0x0E,
+0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x0F, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xA7, 0xE0,
+0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, 0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82, 0x10, 0xF0, 0x90, 0x83,
+0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82, 0x11, 0xF0,
+0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82,
+0x12, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12, 0x49, 0x7A, 0xE0,
+0x90, 0x82, 0x13, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1, 0x12, 0x49,
+0x7A, 0xE0, 0x90, 0x82, 0x14, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF2,
+0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82, 0x15, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0x75, 0xF0, 0x04, 0x90,
+0x01, 0xF3, 0x12, 0x49, 0x7A, 0xE0, 0x90, 0x82, 0x16, 0xF0, 0x90, 0x82, 0x0D, 0xE0, 0xFF, 0x90,
+0x83, 0xA7, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4,
+0x5F, 0x90, 0x82, 0x0D, 0xF0, 0x90, 0x83, 0xA7, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80,
+0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x82, 0x0F, 0xE0, 0xFF, 0x7B, 0x01,
+0x7A, 0x82, 0x79, 0x10, 0x12, 0x5E, 0x1D, 0x90, 0x83, 0xA7, 0xE0, 0x04, 0xF0, 0xE0, 0x54, 0x03,
+0xF0, 0x21, 0x30, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4,
+0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x4E, 0x9C, 0x90, 0x82, 0x1F, 0xEF, 0xF0, 0x60, 0xF0, 0x51,
+0x63, 0x80, 0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0x80, 0x9E, 0xE0,
+0xFE, 0x90, 0x80, 0x9D, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE,
+0x64, 0x01, 0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13, 0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24,
+0x07, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x51, 0xBB, 0x7F, 0x01, 0xEF, 0x60, 0x16,
+0x90, 0x80, 0x9D, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60,
+0x05, 0xE4, 0x90, 0x80, 0x9D, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3,
+0xC0, 0xD0, 0x90, 0x82, 0x20, 0x12, 0x49, 0x8F, 0x90, 0x83, 0xA8, 0xE0, 0xFF, 0x04, 0xF0, 0x90,
+0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x71, 0x1E, 0xEF, 0x60, 0x3A, 0x90,
+0x82, 0x20, 0x12, 0x49, 0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F,
+0xBD, 0x24, 0x02, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x82,
+0x20, 0x12, 0x49, 0x86, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74,
+0xFF, 0xF0, 0x90, 0x01, 0xCB, 0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10,
+0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x9B, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0,
+0xA3, 0xF0, 0x90, 0x83, 0x9B, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D,
+0xC3, 0x90, 0x83, 0x9E, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0x9D, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90,
+0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x83, 0x9D, 0xE4, 0x75, 0xF0,
+0x01, 0x12, 0x49, 0x4B, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F, 0x01, 0xD0,
+0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x4E, 0x9C, 0x90, 0x82, 0x23,
+0xEF, 0xF0, 0x60, 0xF0, 0xD1, 0xEB, 0xBF, 0x01, 0xEB, 0x71, 0x8D, 0x80, 0xE7, 0xD3, 0x10, 0xAF,
+0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x2E, 0x74, 0x08, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3,
+0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, 0x7C, 0x00, 0x24, 0x00,
+0xFF, 0xEC, 0x3E, 0x90, 0x82, 0x24, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x82, 0xE0, 0x90, 0x82,
+0x2D, 0xF0, 0x90, 0x80, 0xE4, 0xE0, 0x20, 0xE0, 0x02, 0xA1, 0xA9, 0x90, 0x80, 0xE9, 0xE0, 0x20,
+0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x18, 0x90, 0x80, 0x01, 0xE0, 0xB4, 0x01, 0x0E,
+0x90, 0xFD, 0x01, 0xE0, 0x20, 0xE6, 0x07, 0x90, 0xFD, 0x00, 0xE0, 0x44, 0x10, 0xF0, 0x12, 0x52,
+0xAE, 0xE4, 0x90, 0x82, 0x2C, 0xF0, 0x90, 0x82, 0x2D, 0xE0, 0xFF, 0x90, 0x82, 0x2C, 0xE0, 0xC3,
+0x9F, 0x40, 0x02, 0xA1, 0xA9, 0x90, 0x82, 0x24, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xEC, 0xFF, 0x90,
+0xFD, 0x11, 0xF0, 0x90, 0x82, 0x26, 0xED, 0xF0, 0x90, 0x82, 0x30, 0xEF, 0xF0, 0x90, 0x82, 0x26,
+0xE0, 0xFF, 0x24, 0x02, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33,
+0x33, 0x54, 0xF8, 0x90, 0x82, 0x2A, 0xF0, 0xEF, 0x24, 0x18, 0xFF, 0xE0, 0xFE, 0x2F, 0x90, 0x82,
+0x27, 0xF0, 0x90, 0x82, 0x25, 0xE0, 0x24, 0x18, 0xFD, 0x90, 0x82, 0x24, 0xE0, 0x34, 0x00, 0xFC,
+0xEE, 0x7E, 0x00, 0x2D, 0xFF, 0xEE, 0x3C, 0x90, 0x82, 0x28, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x82,
+0x27, 0xE0, 0xFD, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0xFC, 0x90,
+0x82, 0x2B, 0xF0, 0x74, 0x00, 0x2D, 0xF9, 0xE4, 0x34, 0xFB, 0xFA, 0x7B, 0x01, 0x12, 0x5D, 0xF8,
+0x90, 0x82, 0x2F, 0xEF, 0xF0, 0x90, 0x82, 0x26, 0xE0, 0xFD, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34,
+0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0,
+0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x54, 0x3F, 0xFE, 0x90, 0x82, 0x31, 0xF0, 0xA3, 0xEF,
+0xF0, 0x90, 0x82, 0x2A, 0xE0, 0x24, 0x18, 0xFD, 0xEC, 0x33, 0xFC, 0xED, 0x2F, 0xFF, 0xEC, 0x3E,
+0xFE, 0xD1, 0x85, 0x90, 0x82, 0x26, 0xE0, 0x24, 0x0F, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83,
+0xE0, 0xFD, 0x90, 0x82, 0x24, 0xEE, 0x8F, 0xF0, 0x12, 0x49, 0x4B, 0x90, 0x80, 0x9F, 0xE0, 0xFE,
+0xA3, 0xE0, 0xFF, 0xD3, 0x90, 0x82, 0x25, 0xE0, 0x9F, 0x90, 0x82, 0x24, 0xE0, 0x9E, 0x40, 0x1B,
+0x90, 0x80, 0xA0, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0x9F, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0x90,
+0x82, 0x25, 0xE0, 0x9F, 0xF0, 0x90, 0x82, 0x24, 0xE0, 0x9E, 0xF0, 0xED, 0x30, 0xE7, 0x06, 0x90,
+0x01, 0xC7, 0x74, 0x21, 0xF0, 0xED, 0x30, 0xE6, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0, 0xED,
+0x30, 0xE5, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x23, 0xF0, 0x90, 0x82, 0x2B, 0xE0, 0x24, 0x40, 0x60,
+0x04, 0x24, 0x20, 0x70, 0x21, 0x90, 0x80, 0xE5, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01,
+0x30, 0xE0, 0x43, 0x90, 0x82, 0x27, 0xE0, 0xFF, 0xF1, 0x28, 0xEF, 0x60, 0x39, 0x90, 0x82, 0x2B,
+0xE0, 0xFF, 0xD1, 0xAE, 0x80, 0x30, 0x90, 0x82, 0x27, 0xE0, 0xFF, 0x90, 0x82, 0x2F, 0xE0, 0xFD,
+0x90, 0x82, 0x2E, 0xE0, 0xFB, 0x90, 0x82, 0x30, 0xE0, 0x90, 0x82, 0x36, 0xF0, 0xF1, 0x7B, 0x90,
+0x80, 0xE4, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x0D, 0x90, 0x82, 0x27, 0xE0, 0xFF, 0x90, 0x82,
+0x2F, 0xE0, 0xFD, 0x12, 0x70, 0x73, 0x90, 0x80, 0xE9, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F,
+0xE0, 0x30, 0xE2, 0x03, 0x12, 0x52, 0xAE, 0xD1, 0xC5, 0xBF, 0x01, 0x0D, 0x90, 0x82, 0x24, 0xB1,
+0xAE, 0x90, 0x82, 0x2C, 0xE0, 0x04, 0xF0, 0x61, 0xF6, 0xD0, 0xD0, 0x92, 0xAF, 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, 0x82, 0x1A, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x87, 0xE0, 0xF9, 0x90, 0x80, 0xE4,
+0xE0, 0x20, 0xE0, 0x02, 0xC1, 0x84, 0xEC, 0xC3, 0x99, 0x40, 0x02, 0xC1, 0x84, 0x90, 0x82, 0x1A,
+0xE0, 0xFA, 0xA3, 0xE0, 0xFB, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0xAD, 0x07, 0x74, 0x02,
+0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8,
+0xFB, 0x74, 0x01, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2D,
+0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x75, 0x83, 0x00, 0x24, 0x00, 0xFF, 0xE5, 0x83,
+0x3E, 0x54, 0x3F, 0xFE, 0xEB, 0x24, 0x18, 0xFB, 0xE4, 0x33, 0xFA, 0xEB, 0x2F, 0xFF, 0xEA, 0x3E,
+0xFE, 0xD1, 0x85, 0x90, 0x82, 0x1A, 0xEE, 0x8F, 0xF0, 0x12, 0x49, 0x4B, 0x90, 0x80, 0x9F, 0xE0,
+0xFE, 0xA3, 0xE0, 0xFF, 0xD3, 0x90, 0x82, 0x1B, 0xE0, 0x9F, 0x90, 0x82, 0x1A, 0xE0, 0x9E, 0x40,
+0x1B, 0x90, 0x80, 0xA0, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0x9F, 0xE0, 0x34, 0x00, 0xFE, 0xC3,
+0x90, 0x82, 0x1B, 0xE0, 0x9F, 0xF0, 0x90, 0x82, 0x1A, 0xE0, 0x9E, 0xF0, 0x90, 0x82, 0x1A, 0xB1,
+0xAE, 0x0C, 0xA1, 0xE6, 0x22, 0x7D, 0x7F, 0xEF, 0x5D, 0xC3, 0x60, 0x14, 0x74, 0xFF, 0x9D, 0xFD,
+0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0x24, 0x80, 0xFF, 0xE4, 0x3E, 0xFE, 0x80, 0x0D,
+0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0xFF, 0x22, 0xEF, 0x90,
+0x01, 0xC7, 0xB4, 0xA0, 0x05, 0x74, 0x04, 0xF0, 0x80, 0x03, 0x74, 0x08, 0xF0, 0x90, 0x80, 0xE9,
+0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x80, 0xE9, 0xE0, 0xFF, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F,
+0xE0, 0x30, 0xE2, 0x14, 0xEF, 0x44, 0x01, 0x90, 0x80, 0xE9, 0xF0, 0x90, 0x80, 0xE5, 0xE0, 0xC4,
+0x54, 0x0F, 0x20, 0xE0, 0x03, 0x7F, 0x00, 0x22, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x83, 0xAF, 0xF0,
+0xA3, 0xF0, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x2C, 0xC3, 0x90, 0x83, 0xB0, 0xE0, 0x94, 0xD0,
+0x90, 0x83, 0xAF, 0xE0, 0x94, 0x07, 0x40, 0x0A, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x04, 0xF0, 0x7F,
+0x00, 0x22, 0x90, 0x83, 0xAF, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x7F, 0x0A, 0x7E, 0x00,
+0x12, 0x32, 0xAA, 0x80, 0xCD, 0x7F, 0x01, 0x22, 0xE4, 0xFE, 0x74, 0x10, 0x2E, 0xF5, 0x82, 0xE4,
+0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFD, 0x74, 0x39, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83,
+0xED, 0xF0, 0xEF, 0x2E, 0x24, 0x04, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x74,
+0x33, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xED, 0xF0, 0x0E, 0xEE, 0xB4, 0x06, 0xCA,
+0x78, 0x39, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x33, 0x7E, 0x00, 0x7F, 0x06,
+0x12, 0x4B, 0xEC, 0xEF, 0x7F, 0x00, 0x70, 0x02, 0x7F, 0x01, 0x22, 0x74, 0x00, 0x2F, 0xF5, 0x82,
+0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0C, 0x64, 0x08, 0x70, 0x64, 0xEF, 0x2D, 0xFE, 0x24,
+0x06, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x88, 0x70, 0x53, 0x74, 0x07, 0x2E,
+0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x8E, 0x70, 0x44, 0xEF, 0x2D, 0x2B, 0xFE,
+0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x03, 0x70, 0x32, 0x74, 0x06,
+0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x30, 0xE3, 0x1A, 0x90, 0x80, 0xE5, 0xE0,
+0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x18, 0x90, 0x01, 0xC7, 0x74, 0x01, 0xF0, 0x90, 0x80,
+0xE9, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x7E, 0x00, 0x90, 0x82, 0x36, 0xE0, 0xFD, 0x12, 0x53, 0x09,
+0x22, 0x90, 0x83, 0x5F, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00,
+0x00, 0xE4, 0x90, 0x83, 0x6D, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x90, 0x83, 0x65,
+0x12, 0x20, 0xCE, 0x90, 0x83, 0x5F, 0xE0, 0xFB, 0x70, 0x08, 0x90, 0x83, 0x65, 0x12, 0x49, 0x6E,
+0x80, 0x16, 0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83,
+0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x83, 0x69, 0x12, 0x20, 0xCE, 0x90, 0x83,
+0x60, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05,
+0xAA, 0x06, 0xAB, 0x07, 0x90, 0x83, 0x69, 0x12, 0x49, 0x6E, 0xED, 0x54, 0x7F, 0xFD, 0xEC, 0x54,
+0x80, 0xFC, 0x12, 0x49, 0x61, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83, 0x69, 0x12, 0x20, 0xCE, 0x90,
+0x83, 0x65, 0x12, 0x49, 0x6E, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F,
+0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x5F, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62,
+0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07,
+0x90, 0x83, 0x69, 0x12, 0x49, 0x6E, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06,
+0x12, 0x2E, 0xA2, 0x90, 0x83, 0x65, 0x12, 0x49, 0x6E, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x85, 0xBB,
+0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x5F, 0xE0, 0x70, 0x04,
+0x7F, 0x20, 0x80, 0x09, 0x90, 0x83, 0x5F, 0xE0, 0xB4, 0x01, 0x16, 0x7F, 0x28, 0x7E, 0x08, 0x12,
+0x2D, 0x5C, 0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF, 0xE4, 0x90, 0x83, 0x6D, 0xEF,
+0xF0, 0x90, 0x83, 0x6D, 0xE0, 0x90, 0x83, 0x5F, 0x60, 0x0E, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24,
+0x66, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x64, 0xF5,
+0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0xED, 0x54,
+0x0F, 0xFD, 0xE4, 0xFC, 0x90, 0x83, 0x61, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x61, 0x02, 0x49, 0x6E,
+0x90, 0x83, 0x6E, 0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x83, 0x74, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00,
+0x00, 0xAF, 0x03, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05,
+0xAA, 0x06, 0xAB, 0x07, 0x90, 0x83, 0x70, 0x12, 0x49, 0x6E, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC,
+0x12, 0x49, 0x61, 0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x83, 0x74, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x6E,
+0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE,
+0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x83, 0x74, 0x12, 0x49, 0x6E, 0x90, 0x85, 0xBB,
+0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
+0xD0, 0x12, 0x67, 0xF1, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8E, 0x19, 0x8F, 0x1A, 0xE5, 0x1E, 0x54,
+0x07, 0xC4, 0x33, 0x54, 0xE0, 0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, 0xE5, 0x1D, 0x54, 0x07,
+0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0xA3, 0xF0, 0xEB,
+0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0x85,
+0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, 0x1A, 0x82, 0x8E, 0x83,
+0xA3, 0xA3, 0xA3, 0x74, 0x03, 0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xA3,
+0x74, 0x01, 0xF0, 0x22, 0x90, 0x83, 0x78, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xAD, 0x03, 0xAC, 0x02,
+0xE4, 0x90, 0x83, 0x80, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0xC4, 0x74, 0x04, 0xF0, 0x74, 0x6A, 0xA3,
+0xF0, 0xEC, 0x54, 0x3F, 0xFC, 0x90, 0x01, 0x40, 0xED, 0xF0, 0xAE, 0x04, 0xEE, 0xA3, 0xF0, 0x90,
+0x83, 0x78, 0xE0, 0x24, 0x81, 0x60, 0x34, 0x24, 0xDA, 0x60, 0x1C, 0x24, 0x3C, 0x70, 0x41, 0x90,
+0x83, 0x79, 0xE0, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0x90, 0x83, 0x7D, 0xF0, 0xA3, 0x74, 0x69,
+0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x80, 0x2C, 0x90, 0x83, 0x79, 0xE0, 0x54, 0x01, 0x90, 0x83, 0x7D,
+0xF0, 0xA3, 0x74, 0xA5, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x80, 0x18, 0x90, 0x83, 0x79, 0xE0, 0xC4,
+0x54, 0x10, 0x90, 0x83, 0x7D, 0xF0, 0xA3, 0x74, 0x7F, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0x80, 0x03,
+0x7F, 0x00, 0x22, 0x90, 0x83, 0x7E, 0xE0, 0x90, 0x01, 0x06, 0xF0, 0x90, 0x83, 0x7D, 0xE0, 0x60,
+0x0E, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x83, 0x7C, 0xE0, 0x90, 0x01, 0x43, 0xF0, 0x80, 0x0D, 0x90,
+0x01, 0x43, 0xE4, 0xF0, 0x90, 0x83, 0x7D, 0xE0, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x83, 0x7F, 0xE0,
+0xFF, 0x90, 0x01, 0x42, 0xE0, 0x5F, 0xFF, 0x90, 0x83, 0x7D, 0xE0, 0x6F, 0x60, 0xEE, 0x74, 0x04,
+0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x6A, 0xA3, 0xF0, 0x90, 0x01, 0x43, 0xE4, 0xF0, 0x7F, 0x01,
+0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80,
+0x02, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x03, 0xF0, 0x90,
+0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x04, 0xF0, 0x90, 0x00, 0x03, 0x12,
+0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x05, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF,
+0xAE, 0x05, 0xED, 0x2F, 0x90, 0x80, 0x06, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
+0x12, 0x1F, 0xA4, 0xFF, 0x90, 0x80, 0xE3, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x00, 0x01, 0x12, 0x1F,
+0xBD, 0x64, 0x01, 0x60, 0x17, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x80, 0x0F, 0x90, 0x00, 0x01,
+0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
+0x22, 0x8F, 0x0F, 0x22, 0x8F, 0x1F, 0x22, 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, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x51, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32,
+0x1E, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x32, 0x1E, 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, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12,
+0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x57, 0x02, 0x32, 0x1E, 0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75,
+0x3F, 0x07, 0x75, 0x40, 0x02, 0x90, 0x01, 0x30, 0xE5, 0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3,
+0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40, 0xF0, 0x22, 0x75, 0x45, 0x0E, 0x75, 0x46, 0x01, 0x75, 0x47,
+0x03, 0x75, 0x48, 0x62, 0x90, 0x01, 0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5,
+0x47, 0xF0, 0xA3, 0xE5, 0x48, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x01,
+0x9C, 0x74, 0x7E, 0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74, 0x24, 0xF0,
+0x90, 0x01, 0x9B, 0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01, 0x99, 0xE4,
+0xF0, 0x90, 0x01, 0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x82, 0x03, 0xF0, 0xA3, 0xF0, 0x90, 0x01,
+0x98, 0xE0, 0x7F, 0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3E, 0xC3, 0x90,
+0x82, 0x04, 0xE0, 0x94, 0x88, 0x90, 0x82, 0x03, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC1,
+0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x82, 0x03, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x7F,
+0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x82, 0x04, 0xE0, 0x94, 0x32, 0x90, 0x82, 0x03,
+0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB2, 0x22, 0x90, 0x00, 0x54,
+0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55, 0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5,
+0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD, 0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A,
+0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57,
+0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, 0xA3,
+0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3, 0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, 0xF5,
+0x44, 0x90, 0x01, 0x34, 0xE5, 0x41, 0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, 0xA3,
+0xE5, 0x44, 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, 0x82, 0x49, 0x12, 0x49, 0x8F, 0x91, 0xE4, 0xEF, 0x64, 0x01, 0x60, 0x02, 0xA1,
+0xE0, 0x90, 0x81, 0xF2, 0x12, 0x51, 0xBD, 0x90, 0x82, 0x50, 0x12, 0x5D, 0xEA, 0x90, 0x82, 0x52,
+0xEF, 0xF0, 0x90, 0x82, 0x50, 0xA3, 0xE0, 0x24, 0x20, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01,
+0x90, 0x82, 0x4F, 0xE0, 0xFD, 0xB1, 0xE1, 0x90, 0x82, 0x50, 0xA3, 0xE0, 0x24, 0x30, 0xF9, 0xE4,
+0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x82, 0x4C, 0x12, 0x49,
+0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03,
+0x12, 0x2B, 0xED, 0x90, 0x82, 0x50, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x3A, 0xF9, 0xE4,
+0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x82, 0x4C, 0x12, 0x49,
+0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03,
+0x12, 0x2B, 0xED, 0x90, 0x82, 0x50, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x40, 0xF9, 0xE4,
+0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x82, 0x49, 0x12, 0x49,
+0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03,
+0x12, 0x2B, 0xED, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0,
+0x22, 0x90, 0x82, 0xEE, 0xED, 0xF0, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x8F, 0xE4, 0x90, 0x82, 0xEF,
+0xF0, 0xA3, 0xF0, 0x12, 0x5D, 0xF8, 0x90, 0x82, 0xEF, 0xEF, 0xF0, 0x90, 0x82, 0xEB, 0x12, 0x49,
+0x86, 0xD1, 0xF9, 0x90, 0x82, 0xF0, 0xEF, 0xF0, 0x90, 0x80, 0xFA, 0xE0, 0x24, 0xFE, 0x60, 0x1D,
+0x24, 0xFE, 0x60, 0x19, 0x14, 0x60, 0x07, 0x14, 0x60, 0x04, 0x24, 0x05, 0x70, 0x60, 0x7B, 0x01,
+0x7A, 0x80, 0x79, 0xFB, 0x90, 0x82, 0xEE, 0xE0, 0xFD, 0xD1, 0x7F, 0x80, 0x23, 0x7B, 0x01, 0x7A,
+0x81, 0x79, 0x03, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x8F, 0x90, 0x82, 0xEE, 0xE0, 0x90, 0x82, 0xF7,
+0xF0, 0x90, 0x80, 0xFA, 0xE0, 0x90, 0x82, 0xF8, 0xF0, 0x7A, 0x80, 0x79, 0xFB, 0x12, 0x80, 0xDC,
+0x90, 0x82, 0xF0, 0xE0, 0xFF, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x86, 0x90, 0x82, 0xEF, 0xE0, 0x7C,
+0x00, 0x29, 0xF9, 0xEC, 0x3A, 0xFA, 0xC3, 0xE9, 0x9F, 0xF9, 0xEA, 0x94, 0x00, 0xFA, 0x75, 0x13,
+0x01, 0x75, 0x14, 0x80, 0x75, 0x15, 0xFB, 0xA3, 0xE0, 0xF5, 0x16, 0x12, 0x2B, 0xED, 0x22, 0x90,
+0x82, 0xF4, 0xED, 0xF0, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x8F, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD,
+0x90, 0x82, 0xF8, 0xF0, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15,
+0x75, 0x16, 0x03, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0xF5, 0x12, 0x2B, 0xED, 0x90, 0x82, 0xF4, 0xE0,
+0x70, 0x46, 0xFF, 0x74, 0xF5, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0xB4, 0xFF,
+0x0E, 0x74, 0xF5, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74,
+0xF5, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF,
+0xB4, 0x03, 0xD0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x82, 0x75, 0x15, 0xF5, 0x75, 0x16, 0x03, 0x90,
+0x82, 0xF1, 0x12, 0x49, 0x86, 0x12, 0x2B, 0xED, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
+0x90, 0x83, 0x82, 0x12, 0x49, 0x8F, 0xE4, 0x90, 0x83, 0x85, 0xF0, 0x90, 0x83, 0x82, 0x12, 0x49,
+0x86, 0xE9, 0x24, 0x04, 0xF9, 0xE4, 0x3A, 0x8B, 0x13, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06,
+0x7B, 0x01, 0x7A, 0x83, 0x79, 0x86, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x86, 0xE0, 0x20, 0xE0, 0x05,
+0x90, 0x81, 0xEF, 0x80, 0x03, 0x90, 0x81, 0xF0, 0xE0, 0x90, 0x80, 0xFA, 0xF0, 0x90, 0x80, 0xFA,
+0xE0, 0x14, 0x60, 0x11, 0x14, 0x60, 0x16, 0x24, 0xFE, 0x60, 0x12, 0x14, 0x60, 0x07, 0x14, 0x60,
+0x04, 0x24, 0x06, 0x80, 0x10, 0x90, 0x83, 0x85, 0x74, 0x04, 0xF0, 0x80, 0x0D, 0x90, 0x83, 0x85,
+0x74, 0x08, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x83, 0x85, 0xF0, 0x90, 0x83, 0x85, 0xE0, 0xFF, 0xD0,
+0xD0, 0x92, 0xAF, 0x22, 0xC3, 0xEE, 0x94, 0x01, 0x40, 0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10,
+0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xE4, 0x90, 0x83, 0xAB, 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, 0x83, 0xAC, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0xAB, 0xE0, 0x94, 0x03, 0x40, 0x0A,
+0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x32,
+0xAA, 0x90, 0x83, 0xAB, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x80, 0xBF, 0x74, 0x45, 0x2F,
+0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE,
+0xF0, 0x22, 0x74, 0x45, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38, 0x2F,
+0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x14,
+0x90, 0x80, 0x03, 0xE0, 0xFF, 0xE4, 0xFD, 0x12, 0x51, 0xC1, 0x8E, 0x0D, 0x8F, 0x0E, 0x90, 0x04,
+0x1F, 0x74, 0x20, 0xF0, 0x22, 0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3,
+0x90, 0x80, 0xA0, 0xE0, 0x9B, 0x90, 0x80, 0x9F, 0xE0, 0x9A, 0x50, 0x13, 0xA3, 0xE0, 0x24, 0x01,
+0xFF, 0x90, 0x80, 0x9F, 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, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0xFB, 0xE0, 0x54, 0xFE,
+0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81,
+0xFC, 0xF0, 0x22, 0x90, 0x82, 0x33, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x78, 0x3B, 0x7C, 0x82, 0x7D,
+0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC0, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x48, 0xD0, 0x78, 0x41,
+0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC6, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x48,
+0xD0, 0x78, 0x45, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xCA, 0x7E, 0x00, 0x7F,
+0x04, 0x12, 0x48, 0xD0, 0x90, 0x82, 0x34, 0xE0, 0xFF, 0x90, 0x82, 0x33, 0xE0, 0x2F, 0xFF, 0x24,
+0x06, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x08, 0x60, 0x02, 0x21, 0xB8, 0x74,
+0x07, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x64, 0x06, 0x60, 0x02, 0x21, 0xB8,
+0x90, 0x06, 0x30, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x82, 0x33, 0xE0, 0x24, 0x0A, 0xF9, 0xE4, 0x34,
+0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0x7B, 0x01, 0x7A, 0x82, 0x79,
+0x35, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x34, 0xE0, 0xFF, 0x90, 0x82, 0x33, 0xE0, 0x2F, 0x24, 0x10,
+0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0x7B, 0x01,
+0x7A, 0x82, 0x79, 0x3B, 0x12, 0x2B, 0xED, 0x90, 0x82, 0x34, 0xE0, 0xFF, 0x90, 0x82, 0x33, 0xE0,
+0x2F, 0x24, 0x16, 0xF9, 0xE4, 0x34, 0xFB, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16,
+0x04, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x41, 0x12, 0x2B, 0xED, 0x78, 0x35, 0x7C, 0x82, 0x7D, 0x01,
+0x7B, 0x01, 0x7A, 0x80, 0x79, 0xEA, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x4B, 0xEC, 0xEF, 0x70, 0x58,
+0x90, 0x82, 0x34, 0xE0, 0xFF, 0x90, 0x82, 0x33, 0xE0, 0x2F, 0x24, 0x20, 0xF9, 0xE4, 0x34, 0xFB,
+0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x45,
+0x12, 0x2B, 0xED, 0x78, 0x45, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x80, 0x79, 0xF6, 0x7E,
+0x00, 0x7F, 0x04, 0x12, 0x4B, 0xEC, 0xEF, 0x70, 0x18, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x3B, 0x90,
+0x82, 0x4C, 0x12, 0x49, 0x8F, 0xE4, 0x90, 0x82, 0x4F, 0xF0, 0x7A, 0x82, 0x79, 0x41, 0x02, 0x6D,
+0x12, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0x90, 0x82, 0x1A,
+0xF0, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0xEF, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81,
+0xF0, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E,
+0x90, 0x81, 0xF1, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x81, 0xF2,
+0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x81, 0xF3, 0xF0, 0x90, 0x00,
+0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x81, 0xF4, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F,
+0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x81, 0xF5, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0xFF, 0xED,
+0x2F, 0x90, 0x81, 0xF6, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F,
+0x90, 0x81, 0xF7, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05,
+0xED, 0x2E, 0x90, 0x81, 0xF8, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90,
+0x81, 0xF9, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x81,
+0xFA, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x8F,
+0x90, 0x82, 0xEE, 0xED, 0xF0, 0xE4, 0x90, 0x83, 0x3A, 0xF0, 0x90, 0x83, 0x3A, 0xE0, 0xFF, 0xC3,
+0x94, 0x40, 0x50, 0x14, 0x74, 0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0,
+0x90, 0x83, 0x3A, 0xE0, 0x04, 0xF0, 0x80, 0xE2, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x86, 0x8B, 0x13,
+0x8A, 0x14, 0x89, 0x15, 0x90, 0x82, 0xEE, 0xE0, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0xF7,
+0x12, 0x2B, 0xED, 0xE4, 0x90, 0x82, 0xF6, 0xF0, 0x90, 0x82, 0xF6, 0xE0, 0xFF, 0xC3, 0x94, 0x40,
+0x50, 0x16, 0x74, 0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x64, 0x36, 0xF0,
+0x90, 0x82, 0xF6, 0xE0, 0x04, 0xF0, 0x80, 0xE0, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x82,
+0xF2, 0xE0, 0xFF, 0xF5, 0x82, 0x75, 0x83, 0x00, 0x74, 0x80, 0x12, 0x1F, 0xFC, 0xEF, 0x75, 0xF0,
+0x08, 0xA4, 0x24, 0x00, 0xFF, 0xE5, 0xF0, 0x34, 0x02, 0xFC, 0x90, 0x00, 0x7E, 0x12, 0x1F, 0xFC,
+0xEF, 0x90, 0x00, 0x7F, 0x12, 0x1F, 0xFC, 0xE4, 0x90, 0x83, 0x37, 0xF0, 0xA3, 0xF0, 0x90, 0x83,
+0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x94, 0xC0, 0xEE, 0x94, 0x00, 0x40, 0x02, 0x81, 0xBD,
+0xC3, 0xEF, 0x94, 0x40, 0xEE, 0x94, 0x00, 0x50, 0x52, 0xA3, 0x74, 0x40, 0xF0, 0x74, 0xF7, 0x2F,
+0xF9, 0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01, 0x74, 0x40, 0x44, 0x88, 0xFD, 0x12, 0x28, 0x08, 0x90,
+0x83, 0x37, 0xA3, 0xE0, 0x24, 0xFB, 0xF9, 0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01, 0xA3, 0xE0, 0x44,
+0x89, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x37, 0xA3, 0xE0, 0x24, 0xFF, 0xF9, 0xE4, 0x34, 0x82,
+0xFA, 0x7B, 0x01, 0xA3, 0xE0, 0x44, 0x8A, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x37, 0xA3, 0xE0,
+0x24, 0x03, 0xF9, 0xE4, 0x34, 0x83, 0xFA, 0x7B, 0x01, 0x61, 0xFE, 0xE4, 0x90, 0x83, 0x39, 0xF0,
+0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA,
+0x3E, 0xFA, 0xE9, 0x24, 0xC0, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0x74, 0x88, 0xFD, 0x12, 0x28, 0x08,
+0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA,
+0x3E, 0xFA, 0xE9, 0x24, 0xC4, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x89, 0xFD, 0x12,
+0x28, 0x08, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29,
+0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xC8, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x8A,
+0xFD, 0x12, 0x28, 0x08, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3,
+0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xCC, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0,
+0x44, 0x8B, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x39, 0xE0, 0x44, 0x90, 0x90, 0x01, 0x8C, 0xF0,
+0xE4, 0x90, 0x83, 0x3B, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x8C, 0xE0, 0x30, 0xE4, 0x22, 0xC3, 0x90,
+0x83, 0x3C, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0x3B, 0xE0, 0x94, 0x03, 0x50, 0x13, 0x7F, 0x01, 0x7E,
+0x00, 0x12, 0x32, 0xAA, 0x90, 0x83, 0x3B, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x80, 0xD7,
+0x90, 0x83, 0x3B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x94, 0xE8, 0xEE, 0x94, 0x03, 0x40, 0x0C,
+0x90, 0x06, 0x31, 0xE0, 0x44, 0x01, 0xF0, 0xEE, 0x90, 0x06, 0x36, 0xF0, 0x90, 0x83, 0x38, 0xE0,
+0x54, 0x3F, 0x64, 0x30, 0x70, 0x4B, 0x90, 0x83, 0x3B, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x8C, 0xE0,
+0x20, 0xE5, 0x22, 0xC3, 0x90, 0x83, 0x3C, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0x3B, 0xE0, 0x94, 0x03,
+0x50, 0x13, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x83, 0x3B, 0xE4, 0x75, 0xF0, 0x01,
+0x12, 0x49, 0x4B, 0x80, 0xD7, 0x90, 0x83, 0x3B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x94, 0xE8,
+0xEE, 0x94, 0x03, 0x40, 0x0C, 0x90, 0x06, 0x31, 0xE0, 0x44, 0x02, 0xF0, 0xEE, 0x90, 0x06, 0x36,
+0xF0, 0x90, 0x83, 0x37, 0xE4, 0x75, 0xF0, 0x10, 0x12, 0x49, 0x4B, 0x61, 0x0E, 0x90, 0x82, 0xF3,
+0x12, 0x49, 0x86, 0xE9, 0x24, 0x10, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x80, 0x12, 0x2A, 0x8F, 0x90,
+0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x0C, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x81, 0x12, 0x2A,
+0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x08, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x82,
+0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x04, 0xF9, 0xE4, 0x3A, 0xFA,
+0x7D, 0x83, 0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0x7D, 0x84, 0x12, 0x2A, 0x8F,
+0xE4, 0x90, 0x83, 0x3A, 0xF0, 0x90, 0x83, 0x3A, 0xE0, 0xFF, 0xC3, 0x94, 0x40, 0x50, 0x14, 0x74,
+0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0, 0x90, 0x83, 0x3A, 0xE0, 0x04,
+0xF0, 0x80, 0xE2, 0x90, 0x82, 0xEB, 0x12, 0x49, 0x86, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90,
+0x82, 0xEE, 0xE0, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0xF7, 0x12, 0x2B, 0xED, 0xE4, 0x90,
+0x82, 0xF6, 0xF0, 0x90, 0x82, 0xF6, 0xE0, 0xFF, 0xC3, 0x94, 0x40, 0x50, 0x16, 0x74, 0xF7, 0x2F,
+0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x64, 0x5C, 0xF0, 0x90, 0x82, 0xF6, 0xE0, 0x04,
+0xF0, 0x80, 0xE0, 0xE4, 0x90, 0x82, 0xF6, 0xF0, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0x90, 0x82,
+0xF6, 0xE0, 0xFF, 0xF5, 0x82, 0x75, 0x83, 0x00, 0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xEF, 0x12,
+0x49, 0x86, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF6, 0xE0, 0x04,
+0xF0, 0xE0, 0xB4, 0x14, 0xD3, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90, 0x00, 0x14, 0x74, 0x80,
+0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF6, 0x74, 0x15, 0xF0, 0x90, 0x82, 0xF6, 0xE0, 0xFF, 0xC3, 0x94,
+0x3E, 0x50, 0x17, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xE4, 0x12,
+0x1F, 0xFC, 0x90, 0x82, 0xF6, 0xE0, 0x04, 0xF0, 0x80, 0xDF, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86,
+0x90, 0x00, 0x3E, 0x74, 0x02, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x3F, 0x74, 0xA0, 0x12, 0x1F, 0xFC,
+0xE4, 0x90, 0x83, 0x37, 0xF0, 0xA3, 0xF0, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3,
+0x94, 0x80, 0xEE, 0x94, 0x00, 0x40, 0x02, 0xE1, 0xA6, 0xC3, 0xEF, 0x94, 0x40, 0xEE, 0x94, 0x00,
+0x50, 0x52, 0xA3, 0x74, 0x40, 0xF0, 0x74, 0xF7, 0x2F, 0xF9, 0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01,
+0x74, 0x40, 0x44, 0x88, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x37, 0xA3, 0xE0, 0x24, 0xFB, 0xF9,
+0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01, 0xA3, 0xE0, 0x44, 0x89, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x83,
+0x37, 0xA3, 0xE0, 0x24, 0xFF, 0xF9, 0xE4, 0x34, 0x82, 0xFA, 0x7B, 0x01, 0xA3, 0xE0, 0x44, 0x8A,
+0xFD, 0x12, 0x28, 0x08, 0x90, 0x83, 0x37, 0xA3, 0xE0, 0x24, 0x03, 0xF9, 0xE4, 0x34, 0x83, 0xFA,
+0x7B, 0x01, 0xC1, 0xE7, 0xE4, 0x90, 0x83, 0x39, 0xF0, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90,
+0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xC0, 0xF9, 0xEA,
+0x34, 0xFF, 0xFA, 0x74, 0x88, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x82, 0xEF, 0x12, 0x49, 0x86, 0x90,
+0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xC4, 0xF9, 0xEA,
+0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x89, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x82, 0xEF, 0x12, 0x49,
+0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9, 0x24, 0xC8,
+0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x8A, 0xFD, 0x12, 0x28, 0x08, 0x90, 0x82, 0xEF,
+0x12, 0x49, 0x86, 0x90, 0x83, 0x37, 0xE0, 0xFE, 0xA3, 0xE0, 0x29, 0xF9, 0xEA, 0x3E, 0xFA, 0xE9,
+0x24, 0xCC, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xA3, 0xE0, 0x44, 0x8B, 0xFD, 0x12, 0x28, 0x08, 0x90,
+0x83, 0x39, 0xE0, 0x44, 0x90, 0x90, 0x01, 0x8C, 0xF0, 0xE4, 0x90, 0x83, 0x3B, 0xF0, 0xA3, 0xF0,
+0x90, 0x01, 0x8C, 0xE0, 0x30, 0xE4, 0x22, 0xC3, 0x90, 0x83, 0x3C, 0xE0, 0x94, 0xE8, 0x90, 0x83,
+0x3B, 0xE0, 0x94, 0x03, 0x50, 0x13, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x83, 0x3B,
+0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x80, 0xD7, 0x90, 0x83, 0x3B, 0xE0, 0xFE, 0xA3, 0xE0,
+0xFF, 0xC3, 0x94, 0xE8, 0xEE, 0x94, 0x03, 0x40, 0x0C, 0x90, 0x06, 0x31, 0xE0, 0x44, 0x01, 0xF0,
+0xEE, 0x90, 0x06, 0x36, 0xF0, 0x90, 0x83, 0x38, 0xE0, 0x54, 0x3F, 0x64, 0x30, 0x70, 0x4B, 0x90,
+0x83, 0x3B, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x8C, 0xE0, 0x20, 0xE5, 0x22, 0xC3, 0x90, 0x83, 0x3C,
+0xE0, 0x94, 0xE8, 0x90, 0x83, 0x3B, 0xE0, 0x94, 0x03, 0x50, 0x13, 0x7F, 0x01, 0x7E, 0x00, 0x12,
+0x32, 0xAA, 0x90, 0x83, 0x3B, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x80, 0xD7, 0x90, 0x83,
+0x3B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x94, 0xE8, 0xEE, 0x94, 0x03, 0x40, 0x0C, 0x90, 0x06,
+0x31, 0xE0, 0x44, 0x02, 0xF0, 0xEE, 0x90, 0x06, 0x36, 0xF0, 0x90, 0x83, 0x37, 0xE4, 0x75, 0xF0,
+0x10, 0x12, 0x49, 0x4B, 0xA1, 0xF7, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x10, 0xF9,
+0xE4, 0x3A, 0xFA, 0x7D, 0x80, 0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86, 0xE9, 0x24,
+0x0C, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x81, 0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12, 0x49, 0x86,
+0xE9, 0x24, 0x08, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x82, 0x12, 0x2A, 0x8F, 0x90, 0x82, 0xF3, 0x12,
+0x49, 0x86, 0xE9, 0x24, 0x04, 0xF9, 0xE4, 0x3A, 0xFA, 0x7D, 0x83, 0x12, 0x2A, 0x8F, 0x90, 0x82,
+0xF3, 0x12, 0x49, 0x86, 0x7D, 0x84, 0x12, 0x2A, 0x8F, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x82,
+0x49, 0xED, 0xF0, 0x90, 0x82, 0x47, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x51, 0xF1, 0x90, 0x82, 0x47,
+0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90,
+0x82, 0x4A, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x82, 0x62, 0x74, 0x18, 0xF0,
+0x7E, 0x00, 0x7F, 0x80, 0x7D, 0x00, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x6A, 0x12, 0x4C, 0x10, 0x90,
+0x81, 0xF4, 0xE0, 0xFF, 0x12, 0x5D, 0x8E, 0x90, 0x82, 0x61, 0xEF, 0xF0, 0xF9, 0xE0, 0xFE, 0x24,
+0x21, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0x74, 0x41, 0xF0, 0xEE, 0x24, 0x20, 0xFD, 0xE4,
+0x33, 0xFC, 0x90, 0x82, 0x62, 0xE0, 0x7A, 0x00, 0x2D, 0xFE, 0xEA, 0x3C, 0x90, 0x82, 0x66, 0xF0,
+0xA3, 0xCE, 0xF0, 0x74, 0x20, 0x29, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0x90, 0x82, 0x4C,
+0xE0, 0xFD, 0x12, 0x6D, 0xE1, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49, 0x4B, 0x90,
+0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49, 0x4B, 0x90, 0x82, 0x66, 0xE0, 0xFF, 0xA3, 0xE0,
+0x90, 0x82, 0x64, 0xCF, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x82, 0x6A, 0x74, 0x01, 0xF0, 0xA3, 0x74,
+0x03, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0x74, 0x5F, 0xF0, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x04,
+0x12, 0x49, 0x4B, 0x90, 0x81, 0x59, 0xE0, 0xFF, 0x7E, 0x02, 0xB4, 0xFE, 0x02, 0x7E, 0xFE, 0x90,
+0x82, 0x66, 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, 0x82, 0x6E, 0xF0, 0x90,
+0x82, 0x66, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x49, 0x4B, 0x90, 0x81, 0xEE, 0xE0, 0x90, 0x82, 0x4A,
+0xB4, 0x01, 0x0B, 0xE0, 0x44, 0x03, 0xFC, 0xA3, 0xE0, 0x44, 0x10, 0xFD, 0x80, 0x09, 0xE0, 0x44,
+0x03, 0xFC, 0xA3, 0xE0, 0x44, 0x20, 0xFD, 0x90, 0x82, 0x68, 0xEC, 0xF0, 0xA3, 0xED, 0xF0, 0x90,
+0x82, 0x6F, 0x74, 0x03, 0xF0, 0xA3, 0x74, 0x12, 0xF0, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x02,
+0x12, 0x49, 0x4B, 0xEF, 0x64, 0xFE, 0x70, 0x37, 0x90, 0x82, 0x66, 0xA3, 0xE0, 0x24, 0x00, 0xF9,
+0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x13, 0x75, 0x14, 0x81, 0x75, 0x15, 0x5C,
+0x75, 0x16, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x75, 0x13, 0x01, 0x75, 0x14, 0x81, 0x75, 0x15,
+0x5C, 0x75, 0x16, 0x02, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x71, 0x12, 0x2B, 0xED, 0x80, 0x60, 0x90,
+0x81, 0x0B, 0xE0, 0xFF, 0xB4, 0x02, 0x2B, 0x90, 0x82, 0x66, 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, 0x82, 0x71, 0xF0, 0xA3, 0x74, 0x20, 0xF0,
+0x80, 0x2D, 0xEF, 0xB4, 0x04, 0x29, 0x90, 0x82, 0x66, 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, 0x82, 0x71, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0x90,
+0x82, 0x66, 0xE4, 0x75, 0xF0, 0x02, 0x12, 0x49, 0x4B, 0xE4, 0x90, 0x82, 0x63, 0xF0, 0x90, 0x82,
+0x63, 0xE0, 0xFF, 0x24, 0x5E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFE, 0x90, 0x82,
+0x66, 0xA3, 0xE0, 0xFD, 0xEF, 0x2D, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEE,
+0xF0, 0x90, 0x82, 0x63, 0xE0, 0xFF, 0x24, 0x5E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0,
+0xFE, 0x74, 0x73, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xEE, 0xF0, 0x90, 0x82, 0x63,
+0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x08, 0xB7, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49,
+0x4B, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x20, 0x12, 0x49, 0x4B, 0x90, 0x82, 0x66, 0xE4, 0x75,
+0xF0, 0x10, 0x12, 0x49, 0x4B, 0x90, 0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49, 0x4B, 0x90,
+0x82, 0x66, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x49, 0x4B, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x6A, 0x90,
+0x82, 0xEF, 0x12, 0x49, 0x8F, 0x90, 0x82, 0xF2, 0x74, 0x63, 0xF0, 0x7A, 0x82, 0x79, 0x4D, 0xA3,
+0x12, 0x49, 0x8F, 0x7A, 0x81, 0x79, 0x0D, 0x7D, 0x10, 0x12, 0x72, 0x63, 0xE4, 0x90, 0x82, 0x63,
+0xF0, 0x90, 0x82, 0x63, 0xE0, 0xFF, 0xC3, 0x94, 0x10, 0x50, 0x42, 0x90, 0x82, 0x66, 0xA3, 0xE0,
+0xFE, 0xEF, 0x2E, 0xFF, 0x90, 0x82, 0xEA, 0xF0, 0x7E, 0x00, 0x90, 0x81, 0xF4, 0xE0, 0xFD, 0x12,
+0x6F, 0x74, 0x90, 0x82, 0x61, 0xEF, 0xF0, 0x90, 0x82, 0x63, 0xE0, 0x24, 0x4D, 0xF5, 0x82, 0xE4,
+0x34, 0x82, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x82, 0x61, 0xE0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34,
+0xFC, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x63, 0xE0, 0x04, 0xF0, 0x80, 0xB4, 0x12, 0x6C, 0xE4,
+0xBF, 0x01, 0x19, 0x90, 0x81, 0xF4, 0x12, 0x51, 0xBD, 0x90, 0x82, 0x61, 0xEF, 0xF0, 0x90, 0x81,
+0xF4, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF,
+0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xF0, 0xE0, 0xFD, 0xB4, 0x02, 0x0C,
+0x90, 0x82, 0x81, 0x74, 0x80, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0x80, 0x0E, 0xED, 0xB4, 0x04, 0x0A,
+0x90, 0x82, 0x81, 0x74, 0x80, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0xEF, 0x64, 0x02, 0x4E, 0x60, 0x02,
+0x61, 0xDC, 0x90, 0x81, 0x56, 0xE0, 0xFF, 0x64, 0xFE, 0x70, 0x02, 0x61, 0xDC, 0xEF, 0x64, 0x02,
+0x60, 0x07, 0xEF, 0x64, 0x03, 0x60, 0x02, 0x61, 0xDC, 0x90, 0x81, 0xB6, 0xE0, 0xFE, 0xA3, 0xE0,
+0xFD, 0xED, 0xFF, 0x90, 0x82, 0x85, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x7E, 0x00, 0x7F, 0x20, 0x7D,
+0x00, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x61, 0x12, 0x4C, 0x10, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xB8,
+0x90, 0x86, 0x67, 0x12, 0x49, 0x8F, 0x7A, 0x82, 0x79, 0x61, 0x90, 0x86, 0x6A, 0x12, 0x49, 0x8F,
+0x7A, 0x81, 0x79, 0x1D, 0x7D, 0x03, 0x12, 0x02, 0x00, 0x75, 0x13, 0x01, 0x75, 0x14, 0x82, 0x75,
+0x15, 0x69, 0x75, 0x16, 0x10, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x4A, 0x12, 0x2B, 0xED, 0x90, 0x82,
+0x67, 0xE0, 0xFF, 0x54, 0x03, 0x90, 0x82, 0x87, 0xF0, 0x70, 0x02, 0x04, 0xF0, 0xEF, 0x54, 0x04,
+0x90, 0x82, 0x88, 0xF0, 0x90, 0x82, 0x87, 0xE0, 0xFF, 0x90, 0x82, 0x5A, 0xF0, 0x90, 0x82, 0x82,
+0xE0, 0x2F, 0xFE, 0x90, 0x82, 0x81, 0xE0, 0x34, 0x00, 0x90, 0x82, 0x83, 0xF0, 0xA3, 0xCE, 0xF0,
+0x7E, 0x00, 0x7F, 0x06, 0x7D, 0x00, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x5B, 0x12, 0x4C, 0x10, 0x90,
+0x82, 0x5A, 0xE0, 0xFF, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x4A, 0x71, 0xE1, 0xD0, 0xD0, 0x92, 0xAF,
+0x22, 0x90, 0x82, 0x89, 0xEF, 0xF0, 0xA3, 0x12, 0x49, 0x8F, 0x90, 0x82, 0x8A, 0x12, 0x49, 0x86,
+0x12, 0x1F, 0xA4, 0x90, 0x06, 0x74, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x75,
+0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x76, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F,
+0xBD, 0x90, 0x06, 0x77, 0xF0, 0x90, 0x82, 0x89, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x02, 0x90,
+0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E,
+0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x8A, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD,
+0x90, 0x06, 0x74, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x75, 0xF0, 0x90, 0x00,
+0x06, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x76, 0xF0, 0x90, 0x00, 0x07, 0x12, 0x1F, 0xBD, 0x90, 0x06,
+0x77, 0xF0, 0x90, 0x82, 0x89, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x03, 0x90, 0x06, 0x70, 0xF0,
+0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32,
+0xAA, 0x90, 0x82, 0x8A, 0x12, 0x49, 0x86, 0x90, 0x00, 0x08, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x74,
+0xF0, 0x90, 0x00, 0x09, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x75, 0xF0, 0x90, 0x00, 0x0A, 0x12, 0x1F,
+0xBD, 0x90, 0x06, 0x76, 0xF0, 0x90, 0x00, 0x0B, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x77, 0xF0, 0x90,
+0x82, 0x89, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x04, 0x90, 0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0,
+0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82,
+0x8A, 0x12, 0x49, 0x86, 0x90, 0x00, 0x0C, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x74, 0xF0, 0x90, 0x00,
+0x0D, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x75, 0xF0, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x06,
+0x76, 0xF0, 0x90, 0x00, 0x0F, 0x12, 0x1F, 0xBD, 0x90, 0x06, 0x77, 0xF0, 0x90, 0x82, 0x89, 0xE0,
+0x75, 0xF0, 0x08, 0xA4, 0x24, 0x05, 0x90, 0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0,
+0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x89, 0xE0, 0xFF,
+0x44, 0x10, 0x90, 0x06, 0x74, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0xA3, 0xF0,
+0xEF, 0x75, 0xF0, 0x08, 0xA4, 0x90, 0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3,
+0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x06, 0x74, 0x74, 0xFF, 0xF0,
+0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x82, 0x89, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x04, 0x90,
+0x06, 0x70, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x7F, 0x01, 0x7E,
+0x00, 0x12, 0x32, 0xAA, 0x90, 0x06, 0x72, 0xE4, 0xF0, 0x22, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x8F,
+0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFD, 0x70, 0x04, 0xFE, 0x7F, 0x01, 0x22, 0xED, 0xC3, 0x94,
+0x06, 0x40, 0x68, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x02, 0xF9, 0xE4, 0x3A, 0xA8,
+0x01, 0xFC, 0xAD, 0x03, 0x7B, 0x01, 0x7A, 0x83, 0x79, 0x4F, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x4B,
+0xEC, 0xEF, 0x70, 0x47, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD,
+0x64, 0x01, 0x70, 0x37, 0x90, 0x00, 0x07, 0x12, 0x1F, 0xBD, 0x70, 0x2F, 0x90, 0x83, 0x8C, 0x12,
+0x49, 0x86, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x12, 0x49,
+0x98, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xFF,
+0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0xC1, 0xDF, 0x90, 0x83, 0x8F, 0x12, 0x49,
+0x86, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x05,
+0xF9, 0xE4, 0x3A, 0xFA, 0xC3, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xE0, 0xE9, 0x95, 0x82, 0xEA, 0x95,
+0x83, 0x50, 0x53, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xC3,
+0x94, 0x14, 0x40, 0x42, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x02, 0xF9, 0xE4, 0x3A,
+0xA8, 0x01, 0xFC, 0xAD, 0x03, 0x7B, 0x01, 0x7A, 0x83, 0x79, 0x5B, 0x7E, 0x00, 0x7F, 0x04, 0x12,
+0x4B, 0xEC, 0xEF, 0x70, 0x21, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x06, 0xF9, 0xE4,
+0x3A, 0xFA, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x90, 0x00,
+0x08, 0x12, 0x49, 0xE7, 0xE1, 0x54, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12,
+0x1F, 0xBD, 0xD3, 0x94, 0x06, 0x40, 0x5E, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x02,
+0xF9, 0xE4, 0x3A, 0xA8, 0x01, 0xFC, 0xAD, 0x03, 0x7B, 0x01, 0x7A, 0x83, 0x79, 0x53, 0x7E, 0x00,
+0x7F, 0x04, 0x12, 0x4B, 0xEC, 0xEF, 0x70, 0x3D, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24,
+0x06, 0xF9, 0xE4, 0x3A, 0xFA, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x92, 0x12, 0x49,
+0x86, 0x90, 0x00, 0x0B, 0x12, 0x49, 0xE7, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01,
+0x12, 0x1F, 0xBD, 0x24, 0xFC, 0xFF, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x90, 0x00, 0x0E, 0xEF,
+0x12, 0x1F, 0xFC, 0x80, 0x6F, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F,
+0xBD, 0xD3, 0x94, 0x06, 0x40, 0x5E, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x02, 0xF9,
+0xE4, 0x3A, 0xA8, 0x01, 0xFC, 0xAD, 0x03, 0x7B, 0x01, 0x7A, 0x83, 0x79, 0x57, 0x7E, 0x00, 0x7F,
+0x04, 0x12, 0x4B, 0xEC, 0xEF, 0x70, 0x3D, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x06,
+0xF9, 0xE4, 0x3A, 0xFA, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86,
+0x90, 0x00, 0x0F, 0x12, 0x49, 0xE7, 0x90, 0x83, 0x8C, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12,
+0x1F, 0xBD, 0x24, 0xFC, 0xFF, 0x90, 0x83, 0x92, 0x12, 0x49, 0x86, 0x90, 0x00, 0x12, 0xEF, 0x12,
+0x1F, 0xFC, 0x80, 0x00, 0xE4, 0xFE, 0xFF, 0x22, 0x90, 0x83, 0x40, 0x12, 0x20, 0xCE, 0x90, 0x83,
+0x3D, 0x12, 0x49, 0x8F, 0xE4, 0x90, 0x83, 0x4D, 0xF0, 0xA3, 0xF0, 0x90, 0x83, 0x47, 0x12, 0x49,
+0x8F, 0x90, 0x83, 0x40, 0x12, 0x49, 0x6E, 0xE9, 0x2F, 0xF9, 0xEA, 0x3E, 0xFA, 0xEB, 0x3D, 0xFB,
+0x90, 0x83, 0x4A, 0x12, 0x49, 0x8F, 0x90, 0x83, 0x4A, 0x12, 0x49, 0x86, 0xC0, 0x03, 0xC0, 0x02,
+0xC0, 0x01, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0xE9, 0x24, 0x01, 0xF9, 0xE4, 0x3A, 0xFA, 0xC3,
+0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xE0, 0xE9, 0x95, 0x82, 0xEA, 0x95, 0x83, 0x40, 0x03, 0x02, 0x80,
+0xD3, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x12, 0x1F, 0xA4, 0xB4, 0xDD, 0x4F, 0x90, 0x83, 0x40,
+0x12, 0x49, 0x6E, 0x90, 0x83, 0x3D, 0x12, 0x49, 0x86, 0xE9, 0x2F, 0xF9, 0xEA, 0x3E, 0xFA, 0xEB,
+0x3D, 0xFB, 0xE9, 0x24, 0xFF, 0xF9, 0xEA, 0x34, 0xFF, 0xFA, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01,
+0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xE0, 0x6B, 0x70, 0x08, 0xE9,
+0x65, 0x82, 0x70, 0x03, 0xEA, 0x65, 0x83, 0x70, 0x03, 0x02, 0x80, 0xD3, 0x90, 0x83, 0x47, 0x12,
+0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x70, 0x02, 0x01, 0xD3, 0x90, 0x83, 0x4A, 0x12,
+0x49, 0x86, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x90, 0x00,
+0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x7E, 0x00, 0xE9, 0x24, 0x02, 0xF9, 0xE4, 0x3A, 0xFA, 0xE9, 0x2F,
+0xF9, 0xEE, 0x3A, 0xFA, 0xD3, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xE0, 0xE9, 0x95, 0x82, 0xEA, 0x95,
+0x83, 0x40, 0x02, 0x01, 0xD3, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x12, 0x1F, 0xA4, 0xFF, 0xB4,
+0x30, 0x36, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x83,
+0x44, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0x12, 0x49, 0xE7, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86,
+0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xFE, 0x90, 0x83, 0x44, 0x12, 0x49, 0x86, 0x90,
+0x00, 0x07, 0xEE, 0x12, 0x1F, 0xFC, 0x80, 0x2F, 0xEF, 0xB4, 0xDD, 0x2B, 0x90, 0x83, 0x4A, 0x12,
+0x49, 0x86, 0x90, 0x83, 0x8F, 0x12, 0x49, 0x8F, 0x90, 0x83, 0x44, 0x12, 0x49, 0x86, 0x90, 0x83,
+0x92, 0x12, 0x49, 0x8F, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x12, 0x7D, 0x7A, 0x90, 0x83, 0x4D,
+0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x80, 0x1C, 0x90, 0x83, 0x47, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01,
+0x12, 0x1F, 0xBD, 0x24, 0x02, 0xFF, 0xE4, 0x33, 0x90, 0x83, 0x48, 0x8F, 0xF0, 0x12, 0x49, 0x4B,
+0x02, 0x7F, 0x86, 0x90, 0x83, 0x4D, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x22, 0x90, 0x82, 0xF1, 0x12,
+0x49, 0x8F, 0x90, 0x82, 0xF7, 0xE0, 0x60, 0x02, 0x21, 0xB0, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86,
+0x12, 0x1F, 0xA4, 0xF4, 0x60, 0x02, 0x21, 0xA5, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xF4, 0x12, 0x49,
+0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xF4, 0x60, 0x02, 0x21, 0x95, 0x90, 0x00, 0x01, 0x12,
+0x1F, 0xFC, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xF4, 0x70, 0x6F, 0x90, 0x82, 0xF4, 0x12, 0x49,
+0x86, 0x90, 0x00, 0x02, 0xE4, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xF4, 0x70,
+0x4E, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0xE4, 0x12, 0x1F, 0xFC, 0x90, 0x00,
+0x04, 0x12, 0x1F, 0xBD, 0xF4, 0x70, 0x2D, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04,
+0xE4, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xF4, 0xB4, 0xFF, 0x0C,
+0x12, 0x49, 0x86, 0x90, 0x00, 0x05, 0xE4, 0x12, 0x1F, 0xFC, 0x80, 0x44, 0x12, 0x49, 0x86, 0x90,
+0x00, 0x05, 0x80, 0x2A, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0x80, 0x1F, 0x90,
+0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0x80, 0x14, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86,
+0x90, 0x00, 0x02, 0x80, 0x09, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x74, 0x01,
+0x12, 0x49, 0x18, 0x80, 0x0B, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x74, 0x01, 0x12, 0x48, 0xF6,
+0x90, 0x82, 0xF8, 0xE0, 0xFF, 0x64, 0x04, 0x60, 0x02, 0x41, 0x5F, 0x90, 0x82, 0xF4, 0x12, 0x49,
+0x86, 0x12, 0x1F, 0xA4, 0xFE, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0xEE, 0x12, 0x1F, 0xEA, 0x90,
+0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xF1, 0x12,
+0x49, 0x86, 0x90, 0x00, 0x01, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x02, 0xE4, 0x12, 0x1F, 0xFC,
+0x90, 0x00, 0x03, 0x74, 0x20, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00,
+0x02, 0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0xEE, 0x12,
+0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFE, 0x90,
+0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x05, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12,
+0x49, 0x86, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90,
+0x00, 0x06, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x05, 0x12,
+0x1F, 0xBD, 0xFE, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x07, 0xEE, 0x61, 0x1F, 0xEF,
+0x64, 0x02, 0x60, 0x02, 0x61, 0x22, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x12, 0x1F, 0xA4, 0xFF,
+0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0xEF, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86,
+0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x44, 0x20, 0x54, 0x7F, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49,
+0x86, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00,
+0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x02, 0xEF, 0x12,
+0x1F, 0xFC, 0x90, 0x00, 0x03, 0x74, 0x20, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86,
+0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04,
+0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD,
+0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x05, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82,
+0xF4, 0x12, 0x49, 0x86, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49,
+0x86, 0x90, 0x00, 0x06, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xF4, 0x12, 0x49, 0x86, 0x90, 0x00,
+0x05, 0x12, 0x1F, 0xBD, 0xFF, 0x90, 0x82, 0xF1, 0x12, 0x49, 0x86, 0x90, 0x00, 0x07, 0xEF, 0x12,
+0x1F, 0xFC, 0x22, 0x00, 0xAF, 0x8C,
+};
+u4Byte ArrayLength_MP_8188E_FW_WoWLAN_S = 17222;
+
+
+void
+ODM_ReadFirmware_MP_8188E_FW_WoWLAN_S(
+ 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_8188E_FW_WoWLAN_S;
+#else
+ ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_WoWLAN_S, ArrayLength_MP_8188E_FW_WoWLAN_S);
+#endif
+ *pFirmwareSize = ArrayLength_MP_8188E_FW_WoWLAN_S;
+}
+
+
+u1Byte Array_MP_8188E_FW_WoWLAN_T[] = {
+0xE1, 0x88, 0x30, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x15, 0x22, 0x26, 0x28, 0x3D, 0x00, 0x00,
+0x8F, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x02, 0x46, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xE1, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xE1, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x50, 0x17, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+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,
+0xE7, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x46, 0xE7, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x3E,
+0x88, 0x82, 0x8C, 0x83, 0xE7, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x32, 0xE3, 0x09, 0xF6, 0x08,
+0xDF, 0xFA, 0x80, 0x78, 0xE3, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x70, 0x88, 0x82, 0x8C, 0x83,
+0xE3, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x64, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF6, 0x08,
+0xDF, 0xFA, 0x80, 0x58, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x4C,
+0x80, 0xD2, 0x80, 0xFA, 0x80, 0xC6, 0x80, 0xD4, 0x80, 0x69, 0x80, 0xF2, 0x80, 0x33, 0x80, 0x10,
+0x80, 0xA6, 0x80, 0xEA, 0x80, 0x9A, 0x80, 0xA8, 0x80, 0xDA, 0x80, 0xE2, 0x80, 0xCA, 0x80, 0x33,
+0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83,
+0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xE9, 0xDE, 0xE7, 0x80,
+0x0D, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF6, 0x08, 0xDF, 0xF9, 0xEC, 0xFA, 0xA9, 0xF0,
+0xED, 0xFB, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC,
+0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xEA, 0xDE,
+0xE8, 0x80, 0xDB, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF2, 0x08, 0xDF, 0xF9, 0x80, 0xCC,
+0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, 0xC3, 0x88, 0xF0, 0xED, 0x24, 0x02, 0xB4, 0x04,
+0x00, 0x50, 0xB9, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0xAF, 0x23, 0x23, 0x45,
+0x82, 0x23, 0x90, 0x41, 0x50, 0x73, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0, 0xC5, 0xF0, 0xF8,
+0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 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, 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, 0x43, 0x98,
+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, 0x43,
+0xA4, 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,
+0x42, 0xE0, 0x73, 0xC2, 0xAF, 0x80, 0xFE, 0x32, 0x12, 0x44, 0x17, 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, 0x47, 0x50,
+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, 0x47, 0x50, 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, 0x44, 0x60, 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, 0x44,
+0x5F, 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, 0x44, 0x60, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83,
+0xF4, 0xC2, 0xAF, 0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0x02, 0x46, 0xFA, 0x02,
+0x44, 0xF0, 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, 0x47, 0x3F, 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, 0x00,
+0x41, 0x83, 0xF1, 0x00, 0x41, 0x83, 0xF2, 0x00, 0x41, 0x84, 0x04, 0x00, 0x41, 0x84, 0x05, 0x00,
+0x59, 0x9D, 0x5F, 0xD5, 0x61, 0xA3, 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, 0x90, 0x01, 0xC4, 0x74, 0x56, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 0x12, 0x67, 0xDB,
+0xE5, 0x3C, 0x30, 0xE7, 0x02, 0xF1, 0xAD, 0x74, 0x56, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x47,
+0xA3, 0xF0, 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, 0x32, 0x06, 0x90, 0x00, 0xF2, 0xE0, 0x20, 0xE6, 0x0C, 0x90, 0x00, 0x05, 0xE0, 0x44,
+0x80, 0xFD, 0x7F, 0x05, 0x12, 0x32, 0x1E, 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, 0x90, 0x01, 0xC4, 0x74, 0xC8, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 0x12,
+0x68, 0x15, 0xE5, 0x41, 0x30, 0xE3, 0x03, 0x12, 0x57, 0xC6, 0xE5, 0x41, 0x30, 0xE4, 0x03, 0x12,
+0x57, 0xBF, 0xE5, 0x43, 0x30, 0xE0, 0x02, 0x11, 0x66, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x68,
+0x72, 0xE5, 0x43, 0x30, 0xE2, 0x03, 0x12, 0x68, 0xE9, 0xE5, 0x43, 0x30, 0xE3, 0x03, 0x12, 0x6F,
+0xCE, 0xE5, 0x43, 0x30, 0xE4, 0x03, 0x12, 0x6F, 0xEA, 0xE5, 0x43, 0x30, 0xE5, 0x03, 0x12, 0x6E,
+0x7E, 0xE5, 0x43, 0x30, 0xE6, 0x03, 0x12, 0x70, 0x19, 0xE5, 0x44, 0x30, 0xE1, 0x02, 0xF1, 0xDE,
+0x74, 0xC8, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 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, 0x19, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x72, 0x90,
+0x80, 0xF9, 0xE0, 0x64, 0x01, 0x70, 0x6A, 0x90, 0x81, 0x3C, 0xE0, 0xC4, 0x54, 0x0F, 0x60, 0x22,
+0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x1E, 0x90, 0x81, 0x45, 0xE0, 0x14, 0xF0, 0xE0, 0xFF, 0x60,
+0x06, 0x90, 0x81, 0x47, 0xE0, 0x60, 0x0E, 0xEF, 0x70, 0x08, 0x90, 0x81, 0x44, 0xE0, 0xA3, 0xF0,
+0x80, 0x00, 0x75, 0x19, 0x01, 0xE5, 0x19, 0x60, 0x38, 0x90, 0x81, 0x42, 0xE0, 0x44, 0x10, 0xF0,
+0x90, 0x81, 0x47, 0xE0, 0x60, 0x03, 0xB4, 0x01, 0x09, 0xE4, 0xF5, 0x52, 0x90, 0x81, 0x47, 0xE0,
+0x80, 0x0D, 0xE4, 0xF5, 0x52, 0x90, 0x81, 0x47, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF,
+0x90, 0x81, 0x46, 0xE0, 0x2F, 0x12, 0x57, 0xED, 0x90, 0x81, 0x41, 0xE0, 0x20, 0xE2, 0x02, 0x11,
+0xE2, 0x22, 0x7D, 0x01, 0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x84, 0x01,
+0xED, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0x41,
+0x3D, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0x41, 0x3D, 0x90, 0x81, 0x41,
+0xE0, 0xFE, 0x6F, 0x70, 0x02, 0x41, 0x3D, 0xEF, 0x70, 0x02, 0x21, 0xA5, 0x24, 0xFE, 0x70, 0x02,
+0x21, 0xDE, 0x24, 0xFE, 0x60, 0x47, 0x24, 0xFC, 0x70, 0x02, 0x41, 0x18, 0x24, 0xFC, 0x60, 0x02,
+0x41, 0x2D, 0xEE, 0xB4, 0x0E, 0x02, 0x51, 0xA9, 0x90, 0x81, 0x41, 0xE0, 0x70, 0x04, 0x7F, 0x01,
+0x51, 0xCC, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x88, 0x90, 0x81, 0x41, 0xE0, 0xB4,
+0x04, 0x0D, 0x90, 0x84, 0x01, 0xE0, 0xFF, 0x60, 0x04, 0x71, 0xE7, 0x80, 0x02, 0xF1, 0x1E, 0x90,
+0x81, 0x41, 0xE0, 0x64, 0x08, 0x60, 0x02, 0x41, 0x2D, 0x71, 0xA5, 0x41, 0x2D, 0x90, 0x81, 0x41,
+0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xCC, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x88,
+0x90, 0x81, 0x41, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x42, 0xBF, 0x01, 0x02, 0x51, 0xA9, 0x90, 0x81,
+0x41, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0x41, 0x2D, 0x51, 0x42, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x41,
+0x2D, 0x51, 0xF8, 0x41, 0x2D, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x42, 0xBF, 0x01,
+0x02, 0x51, 0xA9, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x88, 0x90, 0x81, 0x41, 0xE0,
+0xB4, 0x0C, 0x07, 0x51, 0x42, 0xBF, 0x01, 0x02, 0x51, 0xF8, 0x90, 0x81, 0x41, 0xE0, 0x64, 0x04,
+0x70, 0x5B, 0x12, 0x72, 0x95, 0xEF, 0x64, 0x01, 0x70, 0x53, 0x71, 0xB2, 0x80, 0x4F, 0x90, 0x81,
+0x41, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x42, 0xBF, 0x01, 0x02, 0x51, 0xA9, 0x90, 0x81, 0x41, 0xE0,
+0xB4, 0x06, 0x02, 0x51, 0x88, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x0C, 0x07, 0x51, 0x42, 0xBF, 0x01,
+0x02, 0x51, 0xF8, 0x90, 0x81, 0x41, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xCC, 0x90, 0x81, 0x41,
+0xE0, 0xB4, 0x04, 0x19, 0xF1, 0x12, 0x80, 0x15, 0x90, 0x81, 0x41, 0xE0, 0xB4, 0x0C, 0x0E, 0x90,
+0x81, 0x3B, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0x71, 0x9B, 0x90, 0x81, 0x41,
+0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x81, 0x40, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0xD0, 0xD0, 0x92,
+0xAF, 0x22, 0x12, 0x72, 0x7C, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0,
+0x80, 0x2D, 0x90, 0x81, 0x3A, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, 0x01,
+0xB8, 0x74, 0x02, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x40, 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, 0x81, 0x3B, 0xE0, 0x90, 0x06, 0x04, 0x20,
+0xE0, 0x08, 0xE0, 0x44, 0x40, 0xF0, 0x7D, 0x04, 0x80, 0x06, 0xE0, 0x54, 0x7F, 0xF0, 0x7D, 0x0C,
+0x7F, 0x01, 0x71, 0x33, 0xE4, 0xFD, 0xFF, 0x80, 0x44, 0x90, 0x81, 0x3B, 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, 0x33, 0xE4, 0xFD, 0xFF, 0x80, 0x21, 0x90, 0x84, 0x00, 0xEF,
+0xF0, 0xD1, 0x97, 0x90, 0x84, 0x00, 0xE0, 0x60, 0x05, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x7D, 0x04,
+0x7F, 0x01, 0x80, 0x4F, 0xE4, 0xFD, 0x7F, 0x0C, 0x11, 0xE6, 0xE4, 0xFD, 0xFF, 0x90, 0x05, 0x22,
+0xEF, 0xF0, 0x90, 0x80, 0x05, 0xED, 0xF0, 0x22, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01, 0x70, 0x2E,
+0x90, 0x81, 0x3B, 0xE0, 0x54, 0xFD, 0xF0, 0x7D, 0x2C, 0x7F, 0x6F, 0x51, 0xED, 0x7D, 0x08, 0x7F,
+0x01, 0x91, 0x29, 0xBF, 0x01, 0x0D, 0x90, 0x81, 0x3A, 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, 0xAC, 0x07, 0xEF, 0x14, 0x60, 0x15,
+0x14, 0x60, 0x19, 0x24, 0x02, 0x70, 0x1A, 0xED, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x3A, 0xE0, 0x54,
+0xFE, 0x4E, 0xF0, 0x80, 0x0C, 0x90, 0x81, 0x41, 0xED, 0xF0, 0x80, 0x05, 0x90, 0x81, 0x40, 0xED,
+0xF0, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE4, 0x2E, 0xEC, 0x14, 0x60, 0x07, 0x14, 0x60, 0x1D, 0x24,
+0x02, 0x70, 0x23, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x01, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0xFF,
+0x90, 0x81, 0x41, 0xE0, 0x54, 0x7F, 0x4F, 0xFD, 0x7F, 0x88, 0x80, 0x07, 0x90, 0x81, 0x40, 0xE0,
+0xFD, 0x7F, 0x89, 0x12, 0x32, 0x1E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7D, 0x2F, 0x91, 0xF4, 0x7D,
+0x08, 0x7F, 0x01, 0x80, 0x8E, 0xD1, 0x97, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x7D, 0x0C, 0x7F, 0x01,
+0x80, 0x81, 0x7D, 0x2D, 0xB1, 0x6E, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0xF1,
+0xC9, 0x91, 0xF8, 0xE4, 0xFD, 0x7F, 0x01, 0x61, 0x33, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x01, 0x70,
+0x15, 0x90, 0x81, 0x3C, 0xE0, 0x54, 0x0F, 0x60, 0x05, 0x51, 0xE4, 0x02, 0x56, 0xA5, 0x90, 0x81,
+0x41, 0xE0, 0x70, 0x02, 0x11, 0xE2, 0x22, 0xEF, 0x60, 0x3A, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01,
+0x70, 0x32, 0x90, 0x81, 0x3B, 0xE0, 0x54, 0xFE, 0xF0, 0x7D, 0x2B, 0x7F, 0x0F, 0x51, 0xED, 0x90,
+0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0x91, 0x25, 0xBF, 0x01, 0x0D, 0x90, 0x81, 0x3A, 0xE0, 0x44,
+0x40, 0xF0, 0x7D, 0x06, 0x7F, 0x01, 0x61, 0x33, 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, 0x83, 0xD5, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x80, 0x03, 0xE0, 0x04, 0xF0, 0x90, 0x04,
+0x1D, 0xE0, 0x60, 0x21, 0x90, 0x05, 0x22, 0xE0, 0x90, 0x83, 0xD9, 0xF0, 0x7D, 0x26, 0xB1, 0x6E,
+0xEF, 0x64, 0x01, 0x70, 0x03, 0x12, 0x6D, 0x88, 0x90, 0x83, 0xD9, 0xE0, 0xFF, 0x7D, 0x27, 0x51,
+0xED, 0x91, 0x77, 0x80, 0x05, 0x91, 0x77, 0x12, 0x6D, 0x88, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0,
+0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x83, 0xD5, 0xE0, 0xFF, 0xD3, 0x10, 0xAF, 0x01,
+0xC3, 0xC0, 0xD0, 0x90, 0x84, 0x02, 0xEF, 0xF0, 0x90, 0x80, 0x09, 0xE0, 0xFF, 0x90, 0x04, 0x1C,
+0xE0, 0x6F, 0x70, 0x4B, 0x90, 0x81, 0x41, 0xE0, 0x64, 0x0E, 0x70, 0x18, 0x90, 0x84, 0x02, 0xE0,
+0x70, 0x3D, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0,
+0x71, 0x2F, 0x80, 0x26, 0x90, 0x81, 0x41, 0xE0, 0x64, 0x06, 0x70, 0x23, 0x90, 0x84, 0x02, 0xE0,
+0x60, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0,
+0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x41, 0x74, 0x04, 0xF0, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0xD0,
+0xD0, 0x92, 0xAF, 0x22, 0x12, 0x56, 0xA5, 0x90, 0x81, 0x41, 0xE0, 0x64, 0x0C, 0x60, 0x04, 0x51,
+0xE4, 0x91, 0x25, 0x22, 0x7F, 0xFF, 0x51, 0xED, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xB1,
+0x72, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12,
+0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E,
+0x12, 0x2E, 0xA2, 0x90, 0x83, 0xCB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xFD, 0xFF,
+0x12, 0x64, 0xF6, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83,
+0xE6, 0x12, 0x20, 0xCE, 0x90, 0x83, 0xE6, 0x12, 0x42, 0x19, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE,
+0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54,
+0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0xFF,
+0x51, 0xED, 0xE4, 0x90, 0x83, 0xF7, 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,
+0x83, 0xF8, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0xF7, 0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0,
+0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x83,
+0xF7, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x80, 0xBF, 0xEF, 0x60, 0x59, 0x90, 0x04, 0xEC,
+0xE0, 0x54, 0xDD, 0xF0, 0x90, 0x83, 0x30, 0xE0, 0xFF, 0x60, 0x03, 0x12, 0x5F, 0x8B, 0x90, 0x01,
+0xC7, 0xE4, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00,
+0xFF, 0xEC, 0x3E, 0x90, 0x80, 0xF7, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x06, 0x09, 0xE0, 0x54, 0xFE,
+0xF0, 0x7D, 0x35, 0x91, 0xF4, 0x90, 0x02, 0x86, 0xE0, 0x44, 0x04, 0xF0, 0x12, 0x78, 0xFF, 0xF1,
+0xF2, 0xD1, 0x97, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x12, 0x7B, 0xCB, 0x90, 0x01, 0x34, 0x74, 0x08,
+0xF0, 0xFD, 0xE4, 0xFF, 0xE1, 0xC9, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22, 0xF0, 0x7D, 0x08, 0xE4,
+0xFF, 0x12, 0x68, 0xD1, 0x90, 0x06, 0x90, 0xE0, 0x54, 0xF0, 0xF0, 0x90, 0x02, 0x86, 0xE0, 0x54,
+0xFB, 0xF0, 0xF1, 0xF4, 0xF1, 0xF3, 0x90, 0x81, 0x7D, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x85,
+0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x20, 0xF0, 0xD3, 0x10, 0xAF, 0x01, 0xC3,
+0xC0, 0xD0, 0x90, 0x81, 0x80, 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, 0x81, 0x84, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x81,
+0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, 0x84, 0xE0, 0x54, 0xFD, 0xF0, 0xE4, 0xFD, 0x7F, 0x8F, 0x12,
+0x32, 0x1E, 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, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54,
+0x7F, 0xFC, 0x90, 0x83, 0xE2, 0x12, 0x20, 0xCE, 0x90, 0x83, 0xE2, 0x12, 0x42, 0x19, 0x90, 0x85,
+0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20,
+0xDA, 0xCC, 0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12,
+0x20, 0xDA, 0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0xCB,
+0x12, 0x20, 0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0x12, 0x64, 0xF6, 0xD0, 0xD0, 0x92,
+0xAF, 0x22, 0x7D, 0x2E, 0x7F, 0x6F, 0x51, 0xED, 0x7D, 0x02, 0x7F, 0x01, 0x61, 0x33, 0x90, 0x06,
+0x04, 0xE0, 0x54, 0x7F, 0xF0, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x7D, 0x0C, 0x7F, 0x01, 0x61, 0x33,
+0xEF, 0x70, 0x4E, 0x7D, 0x78, 0x7F, 0x02, 0x12, 0x68, 0xD1, 0x7D, 0x02, 0x7F, 0x03, 0x12, 0x68,
+0xD1, 0x7D, 0xC8, 0x7F, 0x02, 0x12, 0x71, 0x53, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C,
+0x74, 0x02, 0xF0, 0x90, 0x80, 0xF9, 0xE0, 0x70, 0x13, 0xD1, 0x97, 0xF1, 0x1E, 0x90, 0x81, 0x3A,
+0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x80, 0x06, 0x7D, 0x01, 0x7F, 0x0C,
+0x11, 0xE6, 0x90, 0x81, 0x3A, 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, 0xF1, 0xC9,
+0x7D, 0x02, 0x7F, 0x03, 0xF1, 0xC9, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x49,
+0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x80, 0xF9, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x81, 0x3B,
+0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x41, 0xE0, 0x20, 0xE2, 0x0D, 0x7D, 0x01, 0x7F, 0x04, 0x01,
+0xE6, 0x90, 0x81, 0x3B, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE,
+0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x81,
+0x3E, 0xE0, 0x60, 0x02, 0x71, 0xC9, 0x22, 0xE4, 0xFD, 0xFF, 0x51, 0xED, 0x7D, 0x04, 0x7F, 0x01,
+0x61, 0x33, 0x22, 0x22, 0xD1, 0x4B, 0x90, 0x01, 0x3F, 0x74, 0x04, 0xF0, 0x90, 0x80, 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, 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, 0x90, 0x01, 0xC4, 0x74, 0x17, 0xF0, 0x74, 0x50, 0xA3, 0xF0, 0x12, 0x68,
+0x42, 0xE5, 0x49, 0x30, 0xE1, 0x02, 0x11, 0x9B, 0xE5, 0x49, 0x30, 0xE2, 0x02, 0x11, 0xB6, 0xE5,
+0x4A, 0x30, 0xE0, 0x03, 0x12, 0x70, 0x35, 0xE5, 0x4C, 0x30, 0xE1, 0x04, 0x7F, 0x04, 0xF1, 0xB0,
+0xE5, 0x4C, 0x30, 0xE4, 0x02, 0x11, 0xA4, 0xE5, 0x4C, 0x30, 0xE5, 0x02, 0x11, 0xFE, 0xE5, 0x4C,
+0x30, 0xE6, 0x02, 0x31, 0x82, 0x74, 0x17, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x50, 0xA3, 0xF0,
+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, 0x81, 0x3E, 0xE0, 0x60,
+0x02, 0xF1, 0x67, 0x22, 0x11, 0xCF, 0x90, 0x81, 0x44, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D,
+0x02, 0x7F, 0x02, 0x02, 0x4F, 0xC9, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x12, 0x90, 0x06, 0x92, 0xE0,
+0x30, 0xE1, 0x02, 0xC1, 0xA5, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xF7, 0xF0, 0x31, 0xBF, 0x22, 0x90,
+0x81, 0x3E, 0xE0, 0x60, 0x28, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01, 0x70, 0x20, 0x90, 0x81, 0x45,
+0xF0, 0x04, 0x60, 0x19, 0x90, 0x81, 0x42, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x52, 0x90, 0x81,
+0x46, 0xF1, 0xEC, 0x90, 0x81, 0x41, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x48, 0xE2, 0x22, 0x90, 0x81,
+0x3A, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x26, 0xEF, 0x54, 0xBF, 0xF0, 0x90,
+0x04, 0xE0, 0xE0, 0x90, 0x81, 0x3B, 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, 0x31,
+0xBF, 0xE4, 0xFF, 0x90, 0x83, 0x44, 0xE0, 0x30, 0xE0, 0x47, 0x90, 0x83, 0x49, 0xE0, 0xFD, 0x60,
+0x40, 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, 0x0B, 0xE4, 0x90, 0x83, 0x49, 0xF0,
+0x90, 0x83, 0x4B, 0x04, 0xF0, 0x22, 0x90, 0x83, 0x46, 0xE0, 0xD3, 0x9D, 0x50, 0x0A, 0x31, 0xC9,
+0x90, 0x83, 0x44, 0xE0, 0x54, 0xFE, 0xF0, 0x22, 0x12, 0x4C, 0x25, 0x90, 0x83, 0x49, 0xE0, 0x04,
+0xF0, 0x22, 0x90, 0x81, 0x3A, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2B,
+0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x3B, 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, 0x81, 0x3E, 0xE0, 0x60, 0x02, 0x31, 0xBF, 0x7F, 0x01, 0x21, 0x33, 0x90,
+0x81, 0x40, 0xE0, 0xFF, 0x7D, 0x01, 0x02, 0x48, 0xE6, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x7F,
+0x01, 0x90, 0x84, 0x03, 0xEF, 0xF0, 0x90, 0x80, 0x06, 0xE0, 0x64, 0x02, 0x70, 0x1F, 0x90, 0x84,
+0x03, 0xE0, 0xFF, 0x64, 0x01, 0x70, 0x24, 0x90, 0x81, 0x81, 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, 0x84, 0x03, 0xE0, 0xFF, 0x51, 0x0C, 0x22, 0xAD, 0x07, 0x90, 0x81,
+0x82, 0xE0, 0x75, 0xF0, 0x40, 0xA4, 0xFF, 0x90, 0x83, 0xEA, 0xE5, 0xF0, 0xF0, 0xA3, 0xEF, 0xF0,
+0xE4, 0xA3, 0xF0, 0x90, 0x81, 0x83, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0x90, 0x83, 0xED, 0xF0, 0xED,
+0x64, 0x01, 0x60, 0x02, 0x41, 0xDC, 0x90, 0x83, 0xEA, 0xE0, 0x70, 0x02, 0xA3, 0xE0, 0x60, 0x0B,
+0x90, 0x83, 0xEA, 0x74, 0xFF, 0x75, 0xF0, 0xD0, 0x12, 0x41, 0xF6, 0x90, 0x81, 0x81, 0xE0, 0x54,
+0x7F, 0xFF, 0x90, 0x81, 0x80, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02,
+0x7D, 0x01, 0x51, 0xEE, 0x51, 0xDD, 0x90, 0x81, 0x83, 0xE0, 0x30, 0xE0, 0x6F, 0x90, 0x83, 0xEA,
+0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x32, 0xAA, 0x90, 0x81, 0x81, 0xE0, 0x54, 0x7F, 0xFF, 0x90,
+0x81, 0x80, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x51,
+0xEE, 0xE4, 0x90, 0x83, 0xEC, 0xF0, 0x90, 0x83, 0xED, 0xE0, 0xFF, 0x90, 0x83, 0xEC, 0xE0, 0xC3,
+0x9F, 0x50, 0x39, 0x90, 0x83, 0xEA, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x32, 0xAA, 0x51, 0xDD,
+0x90, 0x83, 0xEA, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x32, 0xAA, 0x90, 0x81, 0x81, 0xE0, 0x54,
+0x7F, 0xFF, 0x90, 0x81, 0x80, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02,
+0x7D, 0x01, 0x51, 0xEE, 0x90, 0x83, 0xEC, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x22, 0x90, 0x81, 0x81,
+0xE0, 0x54, 0x7F, 0xFF, 0x90, 0x81, 0x80, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x01, 0xFD, 0xD3, 0x10,
+0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0xFA, 0xED, 0xF0, 0x90, 0x83, 0xF9, 0xEF, 0xF0, 0xD3,
+0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8,
+0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0, 0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x83,
+0xF9, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90,
+0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xFA, 0xE0, 0x60, 0x18,
+0x90, 0x83, 0xF9, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC,
+0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80, 0x17, 0x90, 0x83, 0xF9, 0xE0, 0xFF, 0x74, 0x01, 0xA8,
+0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD,
+0x7F, 0x45, 0x80, 0x7E, 0x90, 0x83, 0xF9, 0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74,
+0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0,
+0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x83, 0xF9, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07,
+0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43,
+0x12, 0x32, 0x1E, 0x90, 0x83, 0xFA, 0xE0, 0x60, 0x1D, 0x90, 0x83, 0xF9, 0xE0, 0x24, 0x04, 0xFF,
+0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0,
+0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90, 0x83, 0xF9, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8,
+0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD,
+0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
+0xD0, 0x90, 0x83, 0x65, 0x74, 0x08, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0,
+0x90, 0x83, 0x6C, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E,
+0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x83, 0x5D, 0xF0, 0xA3, 0xEF, 0xF0, 0x90,
+0x02, 0x82, 0xE0, 0x90, 0x83, 0x64, 0xF0, 0x90, 0x81, 0x7D, 0xE0, 0x20, 0xE0, 0x02, 0xC1, 0xA0,
+0x90, 0x81, 0x85, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x19, 0x90, 0x80,
+0x06, 0xE0, 0xB4, 0x01, 0x0E, 0x90, 0xFD, 0x01, 0xE0, 0x20, 0xE6, 0x07, 0x90, 0xFD, 0x00, 0xE0,
+0x44, 0x10, 0xF0, 0x7F, 0x01, 0x31, 0xD1, 0xE4, 0x90, 0x83, 0x63, 0xF0, 0x90, 0x83, 0x64, 0xE0,
+0xFF, 0x90, 0x83, 0x63, 0xE0, 0xC3, 0x9F, 0x40, 0x02, 0xC1, 0xA0, 0x90, 0x83, 0x5D, 0xE0, 0xFC,
+0xA3, 0xE0, 0xFD, 0xEC, 0xFF, 0x90, 0xFD, 0x11, 0xF0, 0xAE, 0x05, 0xAA, 0x06, 0x90, 0x83, 0x67,
+0xEF, 0xF0, 0x74, 0x02, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33,
+0x33, 0x33, 0x54, 0xF8, 0xFF, 0x74, 0x03, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0,
+0x54, 0x03, 0xFE, 0xEF, 0x24, 0x18, 0x2E, 0x90, 0x83, 0x6C, 0xF0, 0xE0, 0xFF, 0x2A, 0x90, 0x83,
+0x5F, 0xF0, 0x7E, 0x00, 0x90, 0x83, 0x5D, 0xE0, 0xFC, 0xA3, 0xE0, 0x2F, 0xFF, 0xEE, 0x3C, 0x90,
+0x83, 0x60, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0x5F, 0xE0, 0xFD, 0x24, 0x00, 0xF5, 0x82, 0xE4,
+0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x54, 0xFC, 0x90, 0x83, 0x62, 0xF0, 0xAF, 0x06, 0x74, 0x01,
+0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x90, 0x83, 0x5F, 0xE0, 0x24, 0x04,
+0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF1, 0x42, 0x90, 0x83, 0x66, 0xEF, 0xF0, 0x74, 0x01, 0x2A, 0xF5,
+0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB,
+0xF5, 0x83, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x54, 0x3F, 0xFE, 0x90, 0x83, 0x68,
+0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0x6C, 0xE0, 0x2F, 0xFF, 0xEC, 0x3E, 0xFE, 0x12, 0x77, 0xDC,
+0x74, 0x0F, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x90, 0x83, 0x5D, 0xEE,
+0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x80, 0xF7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x83, 0x5D,
+0xE0, 0xFA, 0xA3, 0xE0, 0xD3, 0x9F, 0xEA, 0x9E, 0x40, 0x22, 0x90, 0x83, 0x5D, 0xE0, 0xFE, 0xA3,
+0xE0, 0xFF, 0x90, 0x80, 0xF7, 0xE0, 0xFA, 0xA3, 0xE0, 0x24, 0x01, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3,
+0xEF, 0x9B, 0xFF, 0xEE, 0x9A, 0x90, 0x83, 0x5D, 0xF0, 0xA3, 0xEF, 0xF0, 0xED, 0x30, 0xE7, 0x06,
+0x90, 0x01, 0xC7, 0x74, 0x21, 0xF0, 0xED, 0x30, 0xE6, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0,
+0xED, 0x30, 0xE5, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x23, 0xF0, 0x90, 0x83, 0x62, 0xE0, 0x24, 0x40,
+0x60, 0x04, 0x24, 0x20, 0x70, 0x1F, 0x90, 0x81, 0x80, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54,
+0x01, 0x20, 0xE0, 0x02, 0xC1, 0x46, 0xD1, 0xE0, 0xEF, 0x60, 0x7B, 0x90, 0x83, 0x62, 0xE0, 0xFF,
+0x12, 0x7A, 0xC8, 0x80, 0x71, 0xD1, 0xE0, 0xEF, 0x60, 0x26, 0x90, 0x83, 0x60, 0xE0, 0xFE, 0xA3,
+0xE0, 0xFF, 0x90, 0x83, 0x66, 0xE0, 0xFD, 0x90, 0x83, 0x65, 0xE0, 0xFB, 0x90, 0x83, 0x67, 0xE0,
+0x90, 0x83, 0x73, 0xF0, 0x12, 0x75, 0xD9, 0xEF, 0x60, 0x06, 0x90, 0x83, 0x6E, 0x74, 0x01, 0xF0,
+0x90, 0x81, 0x7D, 0xE0, 0xC3, 0x13, 0x30, 0xE0, 0x19, 0x90, 0x83, 0x60, 0xE0, 0xFE, 0xA3, 0xE0,
+0xFF, 0x90, 0x83, 0x66, 0xE0, 0xFD, 0x12, 0x73, 0xE7, 0xEF, 0x60, 0x06, 0x90, 0x83, 0x6E, 0x74,
+0x01, 0xF0, 0x90, 0x81, 0x7D, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x16,
+0x90, 0x83, 0x6E, 0xE0, 0x70, 0x10, 0x90, 0x83, 0x60, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x83,
+0x66, 0xE0, 0xFD, 0x12, 0x76, 0xBC, 0x90, 0x81, 0x85, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F,
+0xE0, 0x30, 0xE2, 0x04, 0x7F, 0x01, 0x31, 0xD1, 0x12, 0x7A, 0xA2, 0xEF, 0x64, 0x01, 0x70, 0x40,
+0x12, 0x79, 0x4F, 0x90, 0x83, 0x6D, 0xEF, 0xF0, 0x64, 0x01, 0x60, 0x27, 0x90, 0x81, 0x85, 0xE0,
+0x44, 0x01, 0xF0, 0x90, 0x83, 0x6D, 0xE0, 0xFF, 0xB4, 0x02, 0x08, 0x90, 0x01, 0xC7, 0x74, 0x42,
+0xF0, 0x80, 0x0A, 0xEF, 0xB4, 0x04, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x43, 0xF0, 0x7F, 0x01, 0x31,
+0xD1, 0x80, 0x0D, 0x90, 0x83, 0x5D, 0xF1, 0xD2, 0x90, 0x83, 0x63, 0xE0, 0x04, 0xF0, 0x81, 0x6C,
+0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x3A, 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, 0xF5, 0x52, 0x90, 0x81, 0x78, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x53, 0xE4,
+0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0xF1, 0xF6, 0x90, 0x81, 0x3A, 0xE0, 0x44, 0x08, 0xF0, 0x22,
+0x90, 0x83, 0x5F, 0xE0, 0xFF, 0xE4, 0xFE, 0xEF, 0x2E, 0x24, 0x04, 0xF5, 0x82, 0xE4, 0x34, 0xFB,
+0xF5, 0x83, 0xE0, 0xFD, 0x74, 0x6F, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xED, 0xF0,
+0x0E, 0xEE, 0xB4, 0x06, 0xE2, 0x78, 0x86, 0x7C, 0x81, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x83, 0x79,
+0x6F, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x43, 0xEF, 0xEF, 0x7F, 0x00, 0x70, 0x02, 0x7F, 0x01, 0x22,
+0xA3, 0xE0, 0xFE, 0x24, 0x20, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFF, 0x74, 0x21,
+0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFD, 0x74, 0x24, 0x2E, 0xF5, 0x82, 0xE4,
+0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFE, 0xEF, 0x30, 0xE7, 0x04, 0x7C, 0x02, 0x80, 0x02,
+0xE4, 0xFC, 0xED, 0x30, 0xE6, 0x09, 0xAF, 0x03, 0x12, 0x6E, 0x9B, 0xAE, 0x07, 0x80, 0x02, 0xE4,
+0xFE, 0xEC, 0x24, 0x18, 0x2E, 0xFF, 0x22, 0x90, 0x81, 0x3A, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F,
+0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07,
+0x70, 0x2D, 0x80, 0x29, 0x90, 0x81, 0x47, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xEF,
+0xF0, 0x90, 0x81, 0x76, 0xE0, 0xFF, 0x90, 0x81, 0x47, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x80,
+0xF9, 0xE0, 0xB4, 0x01, 0x0A, 0x90, 0x81, 0x3B, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x31, 0xBF, 0x22,
+0x8F, 0x0D, 0x7F, 0x02, 0x12, 0x46, 0x3A, 0x90, 0x80, 0x01, 0xE0, 0x45, 0x0D, 0xF0, 0x22, 0x12,
+0x66, 0x21, 0x7F, 0x02, 0x80, 0xEA, 0x90, 0x81, 0x7D, 0xE0, 0x30, 0xE0, 0x04, 0x7F, 0x10, 0xF1,
+0xB0, 0x22, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x02, 0x84, 0xEF, 0xF0, 0xEE, 0xA3, 0xF0, 0xA3,
+0xE0, 0x44, 0x01, 0xF0, 0x22, 0xF0, 0xE4, 0xF5, 0x52, 0x90, 0x81, 0x77, 0xE0, 0xF5, 0x53, 0xE4,
+0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8E, 0x4E, 0x8F,
+0x4F, 0xE5, 0x53, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0x85, 0x4E, 0x83, 0x85, 0x4F, 0x82, 0xF0,
+0xE5, 0x52, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x53, 0x13, 0x13, 0x13, 0x54, 0x1F,
+0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x52, 0x13, 0x13, 0x13,
+0x54, 0x1F, 0x4F, 0x85, 0x4F, 0x82, 0x85, 0x4E, 0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0D, 0x85,
+0x4F, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x03, 0xF0, 0x80, 0x0C, 0x85, 0x4F, 0x82, 0x85,
+0x4E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x85, 0x4F, 0x82, 0x85, 0x4E, 0x83, 0xA3, 0xA3,
+0xA3, 0x74, 0x05, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09,
+0xE0, 0x7F, 0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02,
+0x7F, 0x03, 0x22, 0x11, 0x69, 0x90, 0x80, 0x06, 0xEF, 0xF0, 0x11, 0x95, 0x90, 0x01, 0x64, 0x74,
+0x01, 0xF0, 0x02, 0x2D, 0xA7, 0x31, 0x01, 0x31, 0x31, 0x11, 0xC3, 0x11, 0xE2, 0xE4, 0xF5, 0x35,
+0xF5, 0x36, 0xF5, 0x37, 0x75, 0x38, 0x80, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36,
+0x7F, 0x51, 0x12, 0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53,
+0x02, 0x32, 0x1E, 0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, 0x07, 0x75, 0x40, 0x02, 0x90,
+0x01, 0x30, 0xE5, 0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40,
+0xF0, 0x22, 0x75, 0x45, 0x06, 0x75, 0x46, 0x01, 0x75, 0x47, 0x03, 0x75, 0x48, 0x62, 0x90, 0x01,
+0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, 0xF0, 0xA3, 0xE5, 0x48, 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, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x51,
+0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x32,
+0x1E, 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, 0x32, 0x1E, 0x7D, 0xFF, 0x7F,
+0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x57, 0x02,
+0x32, 0x1E, 0x90, 0x01, 0xCF, 0xE0, 0x90, 0x83, 0xFF, 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, 0x31, 0x01, 0x90, 0x00,
+0x03, 0xE0, 0x54, 0xFB, 0xFD, 0x7F, 0x03, 0x12, 0x32, 0x1E, 0x80, 0xFE, 0x22, 0x90, 0x00, 0x80,
+0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD, 0x00, 0xE0, 0x54, 0xBF, 0xF0,
+0x51, 0x2F, 0x12, 0x32, 0x77, 0x51, 0x10, 0x51, 0x4A, 0x7F, 0x01, 0x12, 0x45, 0x28, 0x90, 0x83,
+0x3F, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x45, 0x28, 0x90, 0x83, 0x3F, 0xE0, 0x04, 0xF0, 0x11, 0x83,
+0x31, 0xEC, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x75, 0x20,
+0xFF, 0x51, 0x17, 0x51, 0x1E, 0x51, 0x25, 0xE4, 0xFF, 0x02, 0x45, 0xB1, 0x51, 0x11, 0x51, 0x3C,
+0x12, 0x71, 0x6B, 0x12, 0x4E, 0x36, 0x51, 0x58, 0x51, 0x6F, 0x90, 0x83, 0x4C, 0xE0, 0x54, 0x7F,
+0xF0, 0x54, 0xBF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xF0, 0xF0, 0xE4, 0x90, 0x83, 0x4E, 0xF0, 0x22,
+0x22, 0xE4, 0x90, 0x80, 0xF9, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0x90, 0x01,
+0xC7, 0x74, 0xFE, 0xF0, 0x22, 0x90, 0x01, 0xE4, 0x74, 0x10, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90,
+0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x22, 0xE4, 0x90, 0x80, 0xF5,
+0xF0, 0xA3, 0xF0, 0x90, 0x80, 0x5D, 0xF0, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0x80, 0x01, 0xF0, 0xA3,
+0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x83, 0x40, 0xE0, 0x54, 0xFE, 0xF0, 0x54,
+0x7F, 0xF0, 0x54, 0xFB, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90,
+0x83, 0x44, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xE4, 0x90,
+0x83, 0x48, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x83, 0x44, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90,
+0x83, 0x47, 0xF0, 0x90, 0x83, 0x4B, 0xF0, 0x22, 0x51, 0x6F, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01,
+0xFE, 0x90, 0x83, 0x44, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x2C, 0x90,
+0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0x45, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90,
+0x83, 0x46, 0xF0, 0x12, 0x1F, 0xA4, 0x54, 0x04, 0xFF, 0x90, 0x83, 0x44, 0xE0, 0x54, 0xFB, 0x4F,
+0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0x47, 0xF0, 0x22, 0x90, 0x83, 0x5E, 0x12,
+0x42, 0x3A, 0x90, 0x83, 0x5D, 0xEF, 0xF0, 0x12, 0x42, 0x43, 0x5B, 0x1E, 0x00, 0x5B, 0x27, 0x01,
+0x5B, 0x2F, 0x02, 0x5B, 0x38, 0x03, 0x5B, 0x40, 0x04, 0x5B, 0x48, 0x14, 0x5B, 0x50, 0x20, 0x5B,
+0x58, 0x21, 0x5B, 0x61, 0x23, 0x5B, 0x69, 0x25, 0x5B, 0x79, 0x80, 0x5B, 0x71, 0x81, 0x5B, 0x82,
+0x82, 0x5B, 0x8A, 0x83, 0x5B, 0x93, 0x84, 0x5B, 0x9C, 0x88, 0x00, 0x00, 0x5B, 0xA4, 0x90, 0x83,
+0x5E, 0x12, 0x42, 0x31, 0x02, 0x65, 0x4E, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x81, 0x18, 0x90,
+0x83, 0x5E, 0x12, 0x42, 0x31, 0x02, 0x65, 0x9A, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1, 0xA9,
+0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x41, 0x98, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1, 0x2D,
+0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xA1, 0xEB, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x02, 0x65,
+0xDD, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1, 0x1D, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1,
+0x25, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x81, 0x97, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x02,
+0x79, 0x65, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0xE1, 0x71, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31,
+0x02, 0x7B, 0x07, 0x90, 0x83, 0x5E, 0x12, 0x42, 0x31, 0x02, 0x7B, 0x69, 0x90, 0x83, 0x5E, 0x12,
+0x42, 0x31, 0xE1, 0x3C, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x83, 0x5D, 0xE0, 0x90,
+0x01, 0xC2, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x80, 0x5E, 0xE0, 0xFF,
+0x90, 0x80, 0x5D, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x70, 0x43,
+0x90, 0x80, 0x5D, 0xE0, 0xFE, 0x75, 0xF0, 0x08, 0x90, 0x80, 0x0D, 0x12, 0x42, 0x25, 0xE0, 0xFD,
+0xEE, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x0E, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0xAF,
+0x05, 0x51, 0xDC, 0x90, 0x80, 0x5D, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F,
+0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0x5D, 0xF0, 0x12, 0x66, 0x21, 0x90, 0x80, 0x01, 0xE0,
+0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8B, 0x1A, 0x8A, 0x1B, 0x89, 0x1C, 0x90, 0x00,
+0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xF5, 0x1E, 0x12, 0x1F, 0xA4, 0xFE, 0xC3, 0x13, 0x30, 0xE0, 0x0A,
+0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xF5, 0x1F, 0x80, 0x02, 0x8F, 0x1F, 0x85, 0x1E, 0x1D, 0xE5,
+0x1D, 0xD3, 0x95, 0x1F, 0x50, 0x33, 0xAB, 0x1A, 0xAA, 0x1B, 0xA9, 0x1C, 0x12, 0x1F, 0xA4, 0x54,
+0x01, 0xFF, 0x74, 0xF9, 0x25, 0x1D, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEF, 0xF0, 0x74,
+0xF9, 0x25, 0x1D, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE0, 0xAF, 0x1D, 0x70, 0x04, 0xF1,
+0x1C, 0x80, 0x02, 0xF1, 0x1B, 0x05, 0x1D, 0x80, 0xC6, 0xE5, 0x1E, 0x70, 0x19, 0x90, 0x80, 0xF9,
+0xE0, 0x70, 0x13, 0x12, 0x4E, 0x97, 0x12, 0x4F, 0x1E, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xF7, 0xF0,
+0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F,
+0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x7D, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54,
+0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF,
+0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, 0x7D, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E,
+0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81,
+0x7D, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE,
+0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x81, 0x7D, 0xF0, 0xEE, 0x54, 0x80, 0xFE,
+0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x54, 0x01, 0xFF, 0x90, 0x81,
+0x7F, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16, 0xE0, 0x7C,
+0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0xF7, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x81, 0x7D,
+0xE0, 0xC3, 0x13, 0x54, 0x01, 0xFF, 0xB1, 0x47, 0x90, 0x81, 0x7D, 0xE0, 0x54, 0x01, 0xFF, 0x12,
+0x4D, 0xBA, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xEF, 0x60, 0x07, 0x90, 0x83, 0x31, 0xE0, 0xFF, 0xB1,
+0x52, 0x22, 0xF1, 0x5D, 0x90, 0x83, 0xEE, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0xEE, 0x12,
+0x57, 0x20, 0x90, 0x83, 0xF0, 0xEF, 0xF0, 0x90, 0x83, 0xEE, 0xA3, 0xE0, 0x24, 0x30, 0xF9, 0xE4,
+0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0x7B, 0x01, 0x7A, 0x81,
+0x79, 0x9C, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xEE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x36,
+0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0x7B, 0x01,
+0x7A, 0x81, 0x79, 0xA2, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xEE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F,
+0x24, 0x3A, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06,
+0x7B, 0x01, 0x7A, 0x81, 0x79, 0xA6, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xEE, 0xA3, 0xE0, 0xFF, 0xA3,
+0xE0, 0x2F, 0x24, 0x40, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75,
+0x16, 0x04, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xAC, 0x02, 0x2B, 0xED, 0x90, 0x83, 0x61, 0x12, 0x42,
+0x3A, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x7F, 0x90, 0x81, 0x3E, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13,
+0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F,
+0xFE, 0x90, 0x81, 0x3C, 0xE0, 0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x54,
+0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4,
+0x54, 0xF0, 0xFF, 0x90, 0x81, 0x3C, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F,
+0xBD, 0x90, 0x81, 0x3D, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0x30, 0xE0, 0x5E, 0xC3, 0x13,
+0x54, 0x07, 0xFF, 0xC3, 0x94, 0x04, 0x90, 0x81, 0x50, 0x50, 0x04, 0xEF, 0xF0, 0x80, 0x2E, 0x74,
+0x03, 0xF0, 0x90, 0x83, 0x61, 0x12, 0x42, 0x31, 0xE9, 0x24, 0x06, 0xF9, 0xE4, 0x3A, 0xFA, 0x12,
+0x1F, 0xA4, 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, 0x1F, 0xEA, 0x90, 0x83, 0x61,
+0x12, 0x42, 0x31, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0xC4, 0x54, 0x0F, 0xFF, 0xC3, 0x94, 0x04,
+0x90, 0x81, 0x46, 0x50, 0x05, 0x74, 0x04, 0xF0, 0x80, 0x02, 0xEF, 0xF0, 0x90, 0x83, 0x61, 0x12,
+0x42, 0x31, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFD, 0x7F, 0x02, 0x12, 0x4B, 0x33, 0x90, 0x83,
+0x61, 0x12, 0x42, 0x31, 0xD1, 0xEB, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0,
+0x90, 0x81, 0x3E, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x81, 0x40, 0xE0, 0x90, 0x01, 0xBB, 0xF0,
+0x90, 0x81, 0x3C, 0xE0, 0x54, 0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x83, 0x64, 0x12, 0x42,
+0x3A, 0xF1, 0x4C, 0x90, 0x81, 0x3E, 0xE0, 0xFF, 0x12, 0x4F, 0x30, 0x90, 0x81, 0x3E, 0xE0, 0x60,
+0x19, 0x90, 0x83, 0x64, 0x12, 0x42, 0x31, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF,
+0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFD, 0x12, 0x73, 0x14, 0x22, 0x22, 0x22, 0x12, 0x1F, 0xA4,
+0x90, 0x81, 0x48, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x7C, 0xF0, 0x22, 0x12, 0x1F, 0xA4,
+0x54, 0x01, 0xFF, 0x90, 0x83, 0x51, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0,
+0xFF, 0x12, 0x1F, 0xA4, 0xFE, 0xEF, 0x2E, 0x90, 0x83, 0x3E, 0xF0, 0x22, 0x90, 0x81, 0x3A, 0xE0,
+0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x47, 0xF0, 0x90, 0x81, 0x42, 0xF0, 0x22, 0xE4, 0xFE, 0xEF,
+0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0, 0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06,
+0x22, 0x90, 0x02, 0x09, 0xE0, 0x90, 0x83, 0x61, 0xF0, 0x12, 0x1F, 0xA4, 0x90, 0x83, 0x2E, 0xF0,
+0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0x2F, 0xF0, 0x22, 0xF1, 0x5D, 0x7E, 0x00, 0x74,
+0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x08,
+0x7B, 0x01, 0x7A, 0x82, 0x79, 0x48, 0x02, 0x2B, 0xED, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE,
+0x90, 0x83, 0x40, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x04, 0xFF, 0xEE, 0x54, 0xFB,
+0x4F, 0xF0, 0x12, 0x1F, 0xA4, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD,
+0x90, 0x83, 0x41, 0xF0, 0x22, 0xE4, 0x90, 0x83, 0x58, 0xF0, 0x90, 0x83, 0x58, 0xE0, 0x64, 0x01,
+0xF0, 0x24, 0xD5, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5F, 0xA3, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x60,
+0x0F, 0x90, 0x81, 0x41, 0xE0, 0xFF, 0x90, 0x81, 0x40, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x51, 0xBF,
+0xC2, 0xAF, 0x31, 0x12, 0xBF, 0x01, 0x02, 0x11, 0x12, 0xD2, 0xAF, 0x11, 0xF4, 0x12, 0x44, 0x60,
+0x80, 0xC8, 0x90, 0x81, 0x3A, 0xE0, 0x30, 0xE0, 0x02, 0x11, 0x1C, 0x22, 0x90, 0x81, 0x41, 0xE0,
+0xFF, 0x60, 0x03, 0xB4, 0x08, 0x0D, 0x31, 0x43, 0xBF, 0x01, 0x08, 0x11, 0x34, 0x90, 0x01, 0xE5,
+0xE0, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x11, 0xAF, 0x11, 0x44, 0xD0,
+0xD0, 0x92, 0xAF, 0x22, 0x11, 0xF5, 0x90, 0x00, 0x08, 0xE0, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12,
+0x32, 0x1E, 0xE4, 0xFF, 0x90, 0x83, 0x59, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01,
+0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x90, 0x83, 0x59, 0xE0, 0x6F, 0x60, 0x3E,
+0xC3, 0x90, 0x83, 0x5B, 0xE0, 0x94, 0x88, 0x90, 0x83, 0x5A, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90,
+0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x83, 0x5A, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41,
+0xF6, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x83, 0x5B, 0xE0, 0x94, 0x32, 0x90,
+0x83, 0x5A, 0xE0, 0x94, 0x00, 0x40, 0xB7, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, 0xB0, 0x22, 0x90,
+0x81, 0x48, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x32, 0x1E, 0x90, 0x81, 0x3F, 0xE0, 0x60, 0x12, 0x90,
+0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x90,
+0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0x7F, 0x01, 0x11,
+0x54, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E, 0x7F, 0x14, 0x7E,
+0x00, 0x02, 0x32, 0xAA, 0x22, 0x90, 0x01, 0xC4, 0x74, 0xF5, 0xF0, 0x74, 0x60, 0xA3, 0xF0, 0x90,
+0x00, 0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x74, 0xF5, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x60, 0xA3,
+0xF0, 0x22, 0x7D, 0x02, 0x90, 0x01, 0xC4, 0x74, 0x12, 0xF0, 0x74, 0x61, 0xA3, 0xF0, 0x90, 0x83,
+0x3F, 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, 0x90, 0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80,
+0x49, 0x90, 0x81, 0x7D, 0xE0, 0x30, 0xE0, 0x0E, 0x90, 0x02, 0x82, 0xE0, 0x60, 0x08, 0x90, 0x01,
+0xB8, 0x74, 0x02, 0xF0, 0x80, 0x34, 0x90, 0x81, 0x85, 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, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x46, 0x61, 0x90, 0x83, 0x5C, 0xEF,
+0xF0, 0x60, 0xF0, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x60, 0xE9, 0xC2, 0xAF, 0x30, 0xE1, 0x06, 0x54,
+0xFD, 0xF0, 0x12, 0x5B, 0xB4, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x30, 0xE2,
+0x05, 0x54, 0xFB, 0xF0, 0x31, 0xF1, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x30,
+0xE4, 0x0B, 0x54, 0xEF, 0xF0, 0x51, 0xAC, 0xBF, 0x01, 0x03, 0x12, 0x53, 0xFA, 0xD2, 0xAF, 0x80,
+0xC2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0x80, 0xF6, 0xE0, 0xFE, 0x90,
+0x80, 0xF5, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01,
+0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13, 0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x5F, 0xF9,
+0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x51, 0x49, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, 0x80,
+0xF5, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4,
+0x90, 0x80, 0xF5, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
+0x90, 0x83, 0x5D, 0x12, 0x42, 0x3A, 0x90, 0x83, 0xF2, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01,
+0xEF, 0x12, 0x1F, 0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x51, 0xE9, 0xEF, 0x60, 0x3A, 0x90, 0x83, 0x5D,
+0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x24,
+0x02, 0xF5, 0x16, 0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x5D, 0x12,
+0x42, 0x31, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74, 0xFF, 0xF0,
+0x90, 0x01, 0xCB, 0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, 0x83, 0xFB,
+0xF0, 0xA3, 0xF0, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x2C, 0xC3, 0x90, 0x83, 0xFC, 0xE0, 0x94,
+0xD0, 0x90, 0x83, 0xFB, 0xE0, 0x94, 0x07, 0x40, 0x0A, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x04, 0xF0,
+0x7F, 0x00, 0x22, 0x90, 0x83, 0xFB, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x7F, 0x0A, 0x7E,
+0x00, 0x12, 0x32, 0xAA, 0x80, 0xCD, 0x7F, 0x01, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0,
+0x90, 0x83, 0xDA, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x83, 0xDA,
+0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D, 0xC3, 0x90, 0x83, 0xDD, 0xE0,
+0x94, 0xE8, 0x90, 0x83, 0xDC, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80,
+0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x83, 0xDC, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x7F,
+0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90,
+0x83, 0x9A, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4,
+0x90, 0x83, 0xA8, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x90, 0x83, 0xA0, 0x12, 0x20,
+0xCE, 0x90, 0x83, 0x9A, 0xE0, 0xFB, 0x70, 0x08, 0x90, 0x83, 0xA0, 0x12, 0x42, 0x19, 0x80, 0x16,
+0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE,
+0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x83, 0xA4, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x9B, 0xE0,
+0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06,
+0xAB, 0x07, 0x90, 0x83, 0xA4, 0x12, 0x42, 0x19, 0xED, 0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC,
+0x12, 0x42, 0x0C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83, 0xA4, 0x12, 0x20, 0xCE, 0x90, 0x83, 0xA0,
+0x12, 0x42, 0x19, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E,
+0x08, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x9A, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82,
+0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x83,
+0xA4, 0x12, 0x42, 0x19, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E,
+0xA2, 0x90, 0x83, 0xA0, 0x12, 0x42, 0x19, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20,
+0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x9A, 0xE0, 0x70, 0x04, 0x7F, 0x20,
+0x80, 0x09, 0x90, 0x83, 0x9A, 0xE0, 0xB4, 0x01, 0x16, 0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C,
+0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF, 0xE4, 0x90, 0x83, 0xA8, 0xEF, 0xF0, 0x90,
+0x83, 0xA8, 0xE0, 0x90, 0x83, 0x9A, 0x60, 0x0E, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5,
+0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4,
+0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD,
+0xE4, 0xFC, 0x90, 0x83, 0x9C, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x9C, 0x02, 0x42, 0x19, 0xD3, 0x10,
+0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x71, 0x3F, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x83, 0xB7, 0xEF,
+0xF0, 0xAB, 0x05, 0x90, 0x83, 0xBD, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, 0xE4,
+0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07,
+0x90, 0x83, 0xB9, 0x12, 0x42, 0x19, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x42, 0x0C, 0xEC,
+0x54, 0x0F, 0xFC, 0x90, 0x83, 0xBD, 0x12, 0x20, 0xCE, 0x90, 0x83, 0xB7, 0xE0, 0x75, 0xF0, 0x08,
+0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0,
+0x06, 0xC0, 0x07, 0x90, 0x83, 0xBD, 0x12, 0x42, 0x19, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0,
+0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xC0, 0x07, 0xC0,
+0x05, 0x90, 0x83, 0xCB, 0x12, 0x42, 0x19, 0x90, 0x83, 0xB9, 0x12, 0x20, 0xCE, 0xD0, 0x05, 0xD0,
+0x07, 0x91, 0x8C, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x83, 0xFD, 0xEF, 0xF0, 0x7F, 0x02, 0x12,
+0x46, 0x3A, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x90, 0x83, 0xFD, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0x80,
+0x01, 0xF0, 0x22, 0x90, 0x83, 0xFE, 0xEF, 0xF0, 0x7F, 0x02, 0x12, 0x46, 0x3A, 0x90, 0x80, 0x02,
+0xE0, 0xFF, 0x90, 0x83, 0xFE, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0x80, 0x02, 0xF0, 0x22, 0x90, 0x02,
+0x09, 0xE0, 0xF5, 0x1A, 0x12, 0x1F, 0xA4, 0x25, 0x1A, 0x90, 0x80, 0x07, 0xF0, 0x90, 0x00, 0x01,
+0x12, 0x1F, 0xBD, 0x25, 0x1A, 0x90, 0x80, 0x08, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x25,
+0x1A, 0x90, 0x80, 0x09, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x25, 0x1A, 0x90, 0x80, 0x0A,
+0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x25, 0x1A, 0x90, 0x80, 0x0B, 0xF0, 0x90, 0x00, 0x05,
+0x12, 0x1F, 0xBD, 0x25, 0x1A, 0x90, 0x80, 0x0C, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0,
+0xD0, 0x8B, 0x1A, 0x8A, 0x1B, 0x89, 0x1C, 0x12, 0x1F, 0xA4, 0xFF, 0x90, 0x81, 0x39, 0xF0, 0xBF,
+0x01, 0x10, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x1C, 0x7D, 0x13, 0x7F, 0x6F,
+0x80, 0x13, 0xAB, 0x1A, 0xAA, 0x1B, 0xA9, 0x1C, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01,
+0x60, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x4A, 0xED, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x00, 0x02,
+0x12, 0x1F, 0xBD, 0xFF, 0x30, 0xE0, 0x26, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x00,
+0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x77, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01,
+0x4F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x79, 0xF0, 0x22, 0x90, 0x81, 0x76,
+0x74, 0x05, 0xF0, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0,
+0x22, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x83, 0xF3, 0xF0, 0x90, 0x83, 0xF3, 0xE0, 0xFD,
+0x70, 0x02, 0xE1, 0x70, 0x90, 0x80, 0x5D, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60,
+0x0A, 0xEF, 0x14, 0xFF, 0x90, 0x80, 0x5E, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F,
+0x00, 0xEF, 0x60, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x83, 0xF1, 0xE0,
+0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8,
+0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xE1, 0x4D, 0xE4, 0x90, 0x83, 0xF4, 0xF0, 0x90, 0x83, 0xF4,
+0xE0, 0xF9, 0xC3, 0x94, 0x04, 0x50, 0x73, 0x90, 0x83, 0xF1, 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, 0x80, 0x5E, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x80, 0x0D,
+0x12, 0x42, 0x25, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90,
+0x83, 0xF1, 0xE0, 0x75, 0xF0, 0x04, 0xA4, 0x2D, 0xFF, 0xEC, 0x35, 0xF0, 0xFE, 0x74, 0xF0, 0x2F,
+0xF5, 0x82, 0x74, 0x01, 0x3E, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x80, 0x5E, 0xE0, 0x75, 0xF0, 0x08,
+0x90, 0x80, 0x11, 0x12, 0x42, 0x25, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83,
+0xEF, 0xF0, 0x90, 0x83, 0xF4, 0xE0, 0x04, 0xF0, 0x80, 0x83, 0x90, 0x83, 0xF3, 0xE0, 0xFF, 0x90,
+0x83, 0xF1, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4,
+0x5F, 0x90, 0x83, 0xF3, 0xF0, 0x90, 0x83, 0xF1, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80,
+0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x83, 0xF1, 0xE0, 0x04, 0xF0, 0xE0,
+0x54, 0x03, 0xF0, 0x90, 0x80, 0x5E, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F,
+0x01, 0xEF, 0x70, 0x02, 0xC1, 0x2B, 0xE4, 0x90, 0x80, 0x5E, 0xF0, 0xC1, 0x2B, 0x90, 0x01, 0xC0,
+0xE0, 0x44, 0x02, 0xF0, 0x90, 0x83, 0xF1, 0xE0, 0x44, 0x80, 0x90, 0x00, 0x8A, 0xF0, 0x90, 0x83,
+0xF1, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12, 0x42, 0x25, 0xE0, 0x90, 0x01, 0xC3, 0xF0,
+0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x80, 0xF5, 0xE0, 0xFF, 0x70, 0x06, 0xA3,
+0xE0, 0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, 0xFF, 0x90, 0x80, 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, 0x80, 0xF6, 0xE0, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x5F, 0xF9, 0x74, 0x80,
+0x35, 0xF0, 0xA8, 0x01, 0xFC, 0x7D, 0x01, 0xD0, 0x01, 0x7E, 0x00, 0x7F, 0x0F, 0x12, 0x41, 0xD0,
+0x90, 0x80, 0xF6, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60,
+0x05, 0xE4, 0x90, 0x80, 0xF6, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x00, 0x54, 0xE0, 0x55,
+0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55, 0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5, 0x3B, 0xA3,
+0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD, 0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A, 0x7F, 0x55,
+0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57, 0x12, 0x32,
+0x1E, 0x53, 0x91, 0xEF, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, 0xA3, 0xE0, 0x55,
+0x3E, 0xF5, 0x42, 0xA3, 0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, 0xF5, 0x44, 0x90,
+0x01, 0x34, 0xE5, 0x41, 0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, 0xA3, 0xE5, 0x44,
+0xF0, 0x22, 0x90, 0x01, 0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, 0x46, 0xF5, 0x4A,
+0xA3, 0xE0, 0x55, 0x47, 0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, 0x01, 0x3C, 0xE5,
+0x49, 0xF0, 0xA3, 0xE5, 0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, 0xF0, 0x53, 0x91,
+0xDF, 0x22, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x45, 0x90, 0x81, 0x3B, 0xE0, 0xFF, 0x13, 0x13, 0x13,
+0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, 0x11, 0xC7, 0x90, 0x81,
+0x44, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x83, 0xF5, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41,
+0xF6, 0xC3, 0x90, 0x83, 0xF6, 0xE0, 0x94, 0x80, 0x90, 0x83, 0xF5, 0xE0, 0x64, 0x80, 0x94, 0x80,
+0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0xF1, 0x54, 0x31,
+0xDC, 0xE4, 0x90, 0x83, 0x43, 0xF0, 0x22, 0x7D, 0x02, 0x7F, 0x02, 0x11, 0xD1, 0x7D, 0x01, 0x7F,
+0x02, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5,
+0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x83, 0x4A, 0xE0, 0x04, 0xF0, 0x90,
+0x81, 0x41, 0xE0, 0x64, 0x02, 0x60, 0x28, 0x31, 0x20, 0x90, 0x81, 0x3B, 0xE0, 0x13, 0x13, 0x13,
+0x54, 0x1F, 0x30, 0xE0, 0x14, 0x90, 0x81, 0x44, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0x31,
+0xB8, 0x11, 0xC7, 0x90, 0x81, 0x45, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22,
+0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x21, 0xB7, 0x90, 0x81, 0x3E, 0xE0, 0x70, 0x02,
+0x21, 0xB7, 0x90, 0x81, 0x3C, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x26, 0x90, 0x06, 0xAB,
+0xE0, 0x90, 0x81, 0x45, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x04, 0x90, 0x81, 0x44, 0xF0, 0xA3, 0xE0,
+0xFF, 0x70, 0x08, 0x90, 0x81, 0x44, 0xE0, 0xFE, 0xFF, 0x80, 0x03, 0xEF, 0x04, 0xFF, 0x90, 0x81,
+0x45, 0xEF, 0xF0, 0x90, 0x81, 0x3B, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x47, 0xF0, 0x90,
+0x81, 0x49, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C,
+0x74, 0x02, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x3C,
+0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x02, 0x51, 0x40, 0x90, 0x81, 0x3B,
+0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x44, 0xE0, 0xFF, 0xA3, 0xE0,
+0xB5, 0x07, 0x04, 0x31, 0xB8, 0x11, 0xCD, 0x22, 0xEF, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x01,
+0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74,
+0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x83, 0x40, 0xE0,
+0x30, 0xE0, 0x37, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01, 0x70, 0x2F, 0x90, 0x84, 0x04, 0xE0, 0x04,
+0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x83, 0x42, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x84, 0x04, 0xF0,
+0x90, 0x83, 0x42, 0xE0, 0xFF, 0x90, 0x83, 0x41, 0xE0, 0xD3, 0x9F, 0x50, 0x0D, 0x90, 0x83, 0x43,
+0xE0, 0x70, 0x07, 0xE4, 0x90, 0x83, 0x42, 0xF0, 0x51, 0x1B, 0x22, 0x90, 0x83, 0x40, 0xE0, 0xFF,
+0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x16, 0x7B, 0x00, 0x7A, 0x00, 0x79, 0x00, 0x90, 0x83, 0x8B,
+0x12, 0x42, 0x3A, 0xE4, 0x90, 0x83, 0x8E, 0xF0, 0xA3, 0x04, 0xF0, 0x61, 0x5A, 0x02, 0x4C, 0x25,
+0xE4, 0xF5, 0x19, 0x90, 0x06, 0xA9, 0xE0, 0xF5, 0x19, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x81, 0x42,
+0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x51, 0xBF, 0xE5, 0x19, 0x30, 0xE6, 0x22, 0x90,
+0x81, 0x3E, 0xE0, 0x64, 0x01, 0x70, 0x21, 0x90, 0x81, 0x42, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81,
+0x3C, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0x51, 0xA3, 0x80, 0x0C, 0x12, 0x4C, 0xE4, 0x80,
+0x07, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0xE5, 0x19, 0x90, 0x81, 0x42, 0x30, 0xE7, 0x0E,
+0xE0, 0x44, 0x02, 0x12, 0x57, 0xE5, 0x90, 0x81, 0x3A, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54,
+0xFD, 0xF0, 0x22, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x19, 0x90, 0x80, 0x08, 0xE0, 0xFF, 0x7B, 0x18,
+0xE4, 0xFD, 0x51, 0xC3, 0x90, 0x83, 0x52, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x04, 0x1F, 0x74,
+0x20, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0xDF, 0xED, 0xF0, 0xA3,
+0xEB, 0xF0, 0x90, 0x83, 0xDE, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x12, 0x5F, 0x5D, 0x7C, 0x00, 0xAD,
+0x07, 0x90, 0x83, 0xDE, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x83, 0xDF, 0xE0, 0x60, 0x0E, 0x74,
+0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74,
+0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, 0xF5, 0x82,
+0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0xAF, 0x05, 0x74, 0x16, 0x2F, 0xF5, 0x82,
+0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x01, 0xFE, 0x90, 0x83, 0xE0, 0xE0, 0x25, 0xE0, 0x25,
+0xE0, 0xFB, 0xEE, 0x44, 0x02, 0x4B, 0xFE, 0x74, 0x16, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5,
+0x83, 0xEE, 0xF0, 0x74, 0x21, 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, 0x83, 0x88, 0x12, 0x42, 0x3A, 0x78, 0x94, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF, 0x7A,
+0x40, 0x79, 0xCE, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x41, 0xD0, 0x90, 0x05, 0x22, 0xE0, 0x90, 0x83,
+0x93, 0xF0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x0A, 0x7D, 0x33, 0x12, 0x4D, 0x6E, 0xBF, 0x01, 0x15,
+0x80, 0x00, 0x90, 0x83, 0x31, 0xE0, 0xFF, 0x7B, 0x18, 0x7D, 0x01, 0x51, 0xC3, 0x90, 0x83, 0x90,
+0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0x90, 0x12, 0x57, 0x20, 0x90, 0x83, 0x92, 0xEF, 0xF0,
+0x90, 0x83, 0x90, 0xA3, 0xE0, 0x24, 0x20, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0x90, 0x83,
+0x8E, 0xE0, 0xFD, 0x91, 0xDE, 0x90, 0x83, 0x8F, 0xE0, 0x60, 0x02, 0x81, 0x54, 0xA3, 0xA3, 0xE0,
+0x24, 0x30, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90,
+0x83, 0x8B, 0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01,
+0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x90, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F,
+0x24, 0x3A, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90,
+0x83, 0x8B, 0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01,
+0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x90, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F,
+0x24, 0x40, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90,
+0x83, 0x88, 0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0xD0, 0x01,
+0xD0, 0x02, 0x80, 0x69, 0x90, 0x83, 0x8F, 0xE0, 0x64, 0x01, 0x70, 0x66, 0xA3, 0xA3, 0xE0, 0x24,
+0x30, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x13, 0x75, 0x14, 0x81, 0x75,
+0x15, 0x9C, 0x75, 0x16, 0x06, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x90, 0xA3, 0xE0, 0xFF,
+0xA3, 0xE0, 0x2F, 0x24, 0x3A, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x13,
+0x75, 0x14, 0x81, 0x75, 0x15, 0xA6, 0x75, 0x16, 0x06, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x83,
+0x90, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x40, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01,
+0xC0, 0x03, 0x8B, 0x13, 0x75, 0x14, 0x81, 0x75, 0x15, 0xAC, 0x75, 0x16, 0x04, 0xD0, 0x03, 0x12,
+0x2B, 0xED, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x83, 0x93, 0xE0, 0xFF, 0x7D, 0x34,
+0x12, 0x4A, 0xED, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x83,
+0xD2, 0xED, 0xF0, 0x90, 0x83, 0xCF, 0x12, 0x42, 0x3A, 0xE4, 0x90, 0x83, 0xD3, 0xF0, 0xA3, 0xF0,
+0x12, 0x1F, 0xA4, 0xFF, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFD, 0x90, 0x00, 0x04, 0x12, 0x1F,
+0xBD, 0xFB, 0x12, 0x57, 0x46, 0x90, 0x83, 0xD3, 0xEF, 0xF0, 0x90, 0x83, 0xCF, 0x12, 0x42, 0x31,
+0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xD1, 0x9B, 0x90, 0x83, 0xD4, 0xEF, 0xF0, 0x90, 0x82,
+0x51, 0xE0, 0x24, 0xFE, 0x60, 0x1D, 0x24, 0xFE, 0x60, 0x19, 0x14, 0x60, 0x07, 0x14, 0x60, 0x04,
+0x24, 0x05, 0x70, 0x53, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x48, 0x90, 0x83, 0xD2, 0xE0, 0xFD, 0xD1,
+0xDA, 0x80, 0x16, 0x7B, 0x01, 0x7A, 0x82, 0x79, 0x48, 0x90, 0x83, 0xD2, 0xE0, 0xFD, 0x90, 0x82,
+0x51, 0xE0, 0x90, 0x83, 0xAD, 0xF0, 0x12, 0x7C, 0x03, 0x90, 0x83, 0xD4, 0xE0, 0xFF, 0x90, 0x83,
+0xCF, 0x12, 0x42, 0x31, 0x90, 0x83, 0xD3, 0xE0, 0x7C, 0x00, 0x29, 0xF9, 0xEC, 0x3A, 0xFA, 0xC3,
+0xE9, 0x9F, 0xF9, 0xEA, 0x94, 0x00, 0xFA, 0x75, 0x13, 0x01, 0x75, 0x14, 0x82, 0x75, 0x15, 0x48,
+0xA3, 0xE0, 0xF5, 0x16, 0x12, 0x2B, 0xED, 0x22, 0x90, 0x80, 0x09, 0xE0, 0xFF, 0x90, 0x83, 0xD6,
+0xE0, 0xFB, 0x7D, 0x01, 0x51, 0xC3, 0x90, 0x83, 0xD7, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, 0xF0, 0xFD,
+0x90, 0x83, 0xD5, 0xE0, 0xFF, 0xD1, 0x33, 0x90, 0x83, 0xD7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90,
+0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC,
+0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
+0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x16, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83,
+0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15, 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,
+0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4, 0xF0, 0x90, 0x04, 0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF,
+0xF0, 0x90, 0x04, 0x50, 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, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F,
+0xF0, 0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44,
+0x10, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0,
+0x22, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74,
+0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0x90, 0x80,
+0xF9, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x0F, 0x90, 0x81, 0x3C, 0xE0, 0x54,
+0x0F, 0x64, 0x02, 0x60, 0x02, 0x41, 0xA3, 0x12, 0x4C, 0xE4, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3,
+0xC0, 0xD0, 0xEF, 0x20, 0xE0, 0x05, 0x90, 0x83, 0x2E, 0x80, 0x03, 0x90, 0x83, 0x2F, 0xE0, 0x90,
+0x82, 0x51, 0xF0, 0x90, 0x82, 0x51, 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, 0x83, 0xC4, 0xED, 0xF0, 0x90,
+0x83, 0xC1, 0x12, 0x42, 0x3A, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xC8, 0xF0, 0x90,
+0x83, 0xC1, 0x12, 0x42, 0x31, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x03, 0x7B, 0x01,
+0x7A, 0x83, 0x79, 0xC5, 0x12, 0x2B, 0xED, 0x90, 0x83, 0xC4, 0xE0, 0x70, 0x46, 0xFF, 0x74, 0xC5,
+0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0xC5, 0x2F, 0xF5,
+0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74, 0xC5, 0x2F, 0xF5, 0x82, 0xE4,
+0x34, 0x83, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF, 0xB4, 0x03, 0xD0, 0x75, 0x13,
+0x01, 0x75, 0x14, 0x83, 0x75, 0x15, 0xC5, 0x75, 0x16, 0x03, 0x90, 0x83, 0xC1, 0x12, 0x42, 0x31,
+0x12, 0x2B, 0xED, 0x22, 0x90, 0x83, 0x44, 0xE0, 0x30, 0xE0, 0x72, 0x90, 0x83, 0x48, 0xE0, 0x04,
+0xF0, 0x90, 0x83, 0x4B, 0xE0, 0x64, 0x01, 0x70, 0x27, 0x90, 0x83, 0x44, 0xE0, 0x13, 0x13, 0x54,
+0x3F, 0x30, 0xE0, 0x1C, 0x90, 0x83, 0x4A, 0xE0, 0x70, 0x16, 0x90, 0x83, 0x47, 0xE0, 0xFF, 0xA3,
+0xE0, 0xC3, 0x9F, 0x40, 0x0B, 0x12, 0x51, 0xC9, 0x90, 0x83, 0x44, 0xE0, 0x54, 0xFE, 0xF0, 0x22,
+0x90, 0x83, 0x48, 0xE0, 0xFF, 0x90, 0x83, 0x45, 0xE0, 0xD3, 0x9F, 0x50, 0x30, 0x90, 0x06, 0x92,
+0xE0, 0x20, 0xE2, 0x1A, 0x90, 0x83, 0x4A, 0xE0, 0x70, 0x14, 0x7D, 0x08, 0xFF, 0x12, 0x4C, 0x29,
+0x90, 0x83, 0x49, 0xE0, 0x04, 0xF0, 0x90, 0x83, 0x43, 0xE0, 0x04, 0xF0, 0x80, 0x06, 0x90, 0x06,
+0x92, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0x83, 0x48, 0xF0, 0x90, 0x83, 0x4A, 0xF0, 0x22, 0x90, 0x80,
+0xF9, 0xE0, 0x64, 0x01, 0x70, 0x13, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x0D, 0x90, 0x01, 0x57, 0xE4,
+0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0x12, 0x57, 0xE5, 0x22, 0x90, 0x80, 0xF9, 0xE0, 0x64, 0x01,
+0x70, 0x26, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C,
+0x74, 0x02, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFD,
+0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, 0x51, 0xBF, 0x22, 0x90, 0x80, 0xF9, 0xE0, 0xB4, 0x01, 0x14,
+0x90, 0x81, 0x3E, 0xE0, 0x60, 0x0E, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70,
+0x03, 0x12, 0x51, 0xBF, 0x22, 0x11, 0xA8, 0x90, 0x83, 0x54, 0xEF, 0xF0, 0x30, 0xE0, 0x05, 0x7D,
+0x01, 0xE4, 0x80, 0x02, 0xE4, 0xFD, 0xFF, 0x12, 0x4B, 0x33, 0x90, 0x83, 0x54, 0xE0, 0x30, 0xE6,
+0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74,
+0x80, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x30, 0xE0, 0x25, 0x90, 0x81, 0x75, 0xE0, 0x24, 0x07, 0xFF,
+0x90, 0x81, 0x50, 0xE0, 0xFE, 0xC3, 0xEF, 0x9E, 0xFF, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x81, 0x49,
+0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x80, 0x10, 0x90, 0x81,
+0x49, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22, 0xF0, 0x90, 0x81,
+0x49, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x22, 0xE4, 0x90, 0x83, 0x55, 0xF0, 0xA3, 0xF0, 0xA3,
+0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x83, 0x55, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x83,
+0x55, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x83, 0x57, 0xE0, 0x94, 0x64, 0x90, 0x83,
+0x56, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x83, 0x55,
+0xE0, 0xFF, 0x22, 0x90, 0x83, 0x56, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x80, 0xC2, 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, 0xC3, 0xEE, 0x94,
+0x01, 0x40, 0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 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, 0x74, 0x45, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38,
+0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x3E, 0xF0,
+0xA3, 0xF0, 0x90, 0x81, 0x3C, 0xE0, 0x54, 0x0F, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x3C,
+0xE0, 0x54, 0xF0, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xF7,
+0xF0, 0x90, 0x81, 0x44, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xFB, 0xF0,
+0xA3, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x47, 0xF0, 0x90, 0x81, 0x46, 0x74, 0x08, 0xF0,
+0x90, 0x81, 0x49, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x42, 0xF0, 0x90, 0x81,
+0x3A, 0xE0, 0x54, 0xDF, 0xF0, 0xE4, 0xFD, 0xFF, 0x12, 0x4B, 0x33, 0x7D, 0x0C, 0x7F, 0x02, 0x12,
+0x4B, 0x33, 0x12, 0x4B, 0x2F, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3,
+0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x4B, 0x12, 0x20, 0xDA,
+0x54, 0x33, 0x77, 0x70, 0xE4, 0x90, 0x81, 0x75, 0xF0, 0x90, 0x81, 0x4F, 0xF0, 0x90, 0x80, 0x06,
+0xE0, 0xB4, 0x01, 0x08, 0x90, 0x81, 0x48, 0x74, 0x99, 0xF0, 0x80, 0x12, 0x90, 0x80, 0x06, 0xE0,
+0x90, 0x81, 0x48, 0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80, 0x03, 0x74, 0x40, 0xF0, 0x90, 0x81,
+0x76, 0x74, 0x05, 0xF0, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05,
+0xF0, 0xE4, 0x90, 0x81, 0x50, 0xF0, 0x90, 0x81, 0x75, 0xE0, 0x24, 0x07, 0x90, 0x81, 0x53, 0xF0,
+0xA3, 0x74, 0x08, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0x81, 0x7A, 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, 0x4A, 0xED, 0xE4, 0x90, 0x81, 0x7C, 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, 0x51, 0x7C, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74,
+0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x42, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8,
+0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x40, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90,
+0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08,
+0xF0, 0x80, 0x38, 0x90, 0x81, 0x42, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0,
+0x80, 0x29, 0x90, 0x81, 0x3B, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8,
+0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x7C, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x80,
+0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x04,
+0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0B, 0x04, 0x70, 0x27, 0x90, 0x81, 0x44, 0x74,
+0x02, 0xF0, 0x80, 0x16, 0xED, 0x70, 0x0A, 0x90, 0x81, 0x79, 0xE0, 0x90, 0x81, 0x44, 0xF0, 0x80,
+0x05, 0x90, 0x81, 0x44, 0xED, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x3B, 0xE0,
+0x44, 0x08, 0xF0, 0x22, 0xAC, 0x07, 0x90, 0x81, 0x3A, 0xE0, 0x30, 0xE0, 0x32, 0x90, 0x81, 0x50,
+0xE0, 0xD3, 0x94, 0x03, 0x50, 0x07, 0x90, 0x81, 0x46, 0xEB, 0xF0, 0x80, 0x0A, 0xED, 0x24, 0xFD,
+0x2B, 0x90, 0x81, 0x46, 0xF0, 0x7D, 0x03, 0x90, 0x81, 0x75, 0xE0, 0x24, 0x07, 0xC3, 0x9D, 0x2C,
+0xFF, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x81, 0x49, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x80, 0x0E, 0x90,
+0x81, 0x49, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x46, 0xEB, 0xF0, 0x90, 0x81, 0x49,
+0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x22, 0xFD, 0x90, 0x83, 0x6F, 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, 0x80, 0xF8, 0xE0, 0x9B, 0x90, 0x80, 0xF7, 0xE0, 0x9A, 0x50, 0x13,
+0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 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, 0x83, 0x6F, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3,
+0xED, 0xF0, 0x78, 0x78, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC0, 0x7E, 0x00,
+0x7F, 0x06, 0x12, 0x41, 0xD0, 0x78, 0x7E, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79,
+0xC6, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0x78, 0x82, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF,
+0x7A, 0x40, 0x79, 0xCA, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0xE4, 0x90, 0x83, 0x87, 0xF0,
+0x90, 0x83, 0x71, 0xE0, 0xFF, 0x90, 0x83, 0x70, 0xE0, 0x2F, 0xFF, 0x90, 0x83, 0x6F, 0xE0, 0x34,
+0x00, 0xCF, 0x24, 0x06, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x08, 0x60,
+0x02, 0xA1, 0xD3, 0x90, 0x83, 0x71, 0xE0, 0xFF, 0x90, 0x83, 0x70, 0xE0, 0x2F, 0xFF, 0x90, 0x83,
+0x6F, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x07, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x71, 0xA9, 0xEF,
+0x64, 0x06, 0x60, 0x02, 0xA1, 0xD3, 0x90, 0x83, 0x87, 0x04, 0xF0, 0xE4, 0x90, 0x83, 0x86, 0xF0,
+0x90, 0x83, 0x86, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x1F, 0x90, 0x83, 0x70, 0xE0, 0x24, 0x0A,
+0x71, 0x97, 0x90, 0x83, 0x86, 0xE0, 0x24, 0x72, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xEF,
+0xF0, 0x90, 0x83, 0x86, 0xE0, 0x04, 0xF0, 0x80, 0xD7, 0x78, 0x72, 0x7C, 0x83, 0x7D, 0x01, 0x7B,
+0x01, 0x7A, 0x81, 0x79, 0x8C, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x43, 0xEF, 0xEF, 0x60, 0x02, 0xA1,
+0xD3, 0x90, 0x83, 0x86, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2E, 0x90,
+0x83, 0x71, 0xE0, 0xFD, 0x90, 0x83, 0x70, 0xE0, 0x2D, 0xFD, 0x90, 0x83, 0x6F, 0xE0, 0x34, 0x00,
+0xCD, 0x24, 0x20, 0xCD, 0x71, 0x9C, 0x90, 0x83, 0x86, 0xE0, 0x24, 0x82, 0xF5, 0x82, 0xE4, 0x34,
+0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0x04, 0xF0, 0x80, 0xC8, 0x78, 0x82, 0x7C,
+0x83, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xA2, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x43, 0xEF,
+0xEF, 0x60, 0x02, 0xA1, 0xCA, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x01, 0x54, 0xDF, 0xF0, 0x90, 0x81,
+0x7F, 0xE0, 0x30, 0xE0, 0x0F, 0x90, 0x01, 0xC7, 0x74, 0x09, 0xF0, 0x90, 0x81, 0x85, 0xE0, 0x44,
+0x01, 0xF0, 0xA1, 0xD3, 0xE4, 0x90, 0x83, 0x86, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0xFF, 0xC3, 0x94,
+0x06, 0x50, 0x2E, 0x90, 0x83, 0x71, 0xE0, 0xFD, 0x90, 0x83, 0x70, 0xE0, 0x2D, 0xFD, 0x90, 0x83,
+0x6F, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x10, 0xCD, 0x71, 0x9C, 0x90, 0x83, 0x86, 0xE0, 0x24, 0x78,
+0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0x04, 0xF0, 0x80,
+0xC8, 0xE4, 0x90, 0x83, 0x86, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2E,
+0x90, 0x83, 0x71, 0xE0, 0xFD, 0x90, 0x83, 0x70, 0xE0, 0x2D, 0xFD, 0x90, 0x83, 0x6F, 0xE0, 0x34,
+0x00, 0xCD, 0x24, 0x16, 0xCD, 0x71, 0x9C, 0x90, 0x83, 0x86, 0xE0, 0x24, 0x7E, 0xF5, 0x82, 0xE4,
+0x34, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x83, 0x86, 0xE0, 0x04, 0xF0, 0x80, 0xC8, 0x7B, 0x01,
+0x7A, 0x83, 0x79, 0x78, 0x90, 0x83, 0x8B, 0x12, 0x42, 0x3A, 0xE4, 0x90, 0x83, 0x8E, 0xF0, 0xA3,
+0xF0, 0x7A, 0x83, 0x79, 0x7E, 0x12, 0x6B, 0x5A, 0x80, 0x09, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x21,
+0x54, 0xEF, 0xF0, 0x90, 0x83, 0x87, 0xE0, 0xFF, 0x22, 0x90, 0x83, 0x71, 0xED, 0xF0, 0xA3, 0xEB,
+0xF0, 0x90, 0x83, 0x6F, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0x90, 0x83, 0x74, 0xF0, 0xFD, 0x71,
+0xA9, 0xEF, 0x54, 0x0C, 0x64, 0x08, 0x70, 0x74, 0x90, 0x83, 0x6F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF,
+0xA3, 0xE0, 0x24, 0x06, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x88, 0x70, 0x60, 0x90, 0x83, 0x6F, 0xE0,
+0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x24, 0x07, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x8E, 0x70, 0x4C,
+0x90, 0x83, 0x74, 0x04, 0xF0, 0x90, 0x83, 0x6F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x83, 0x72,
+0xE0, 0xFD, 0x90, 0x83, 0x71, 0xE0, 0x2D, 0x04, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x03, 0x70, 0x2C,
+0x90, 0x83, 0x6F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x83, 0x72, 0xE0, 0xFD, 0x90, 0x83, 0x71,
+0xE0, 0x2D, 0x24, 0x06, 0xFD, 0x71, 0xA9, 0xEF, 0x90, 0x01, 0xC7, 0x30, 0xE3, 0x04, 0x74, 0x01,
+0x80, 0x02, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x85, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x83, 0x74, 0xE0,
+0xFF, 0x22, 0x90, 0x83, 0x7F, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x7D, 0x09, 0x71, 0xA9, 0xEF, 0x64,
+0x06, 0x70, 0x36, 0x90, 0x83, 0x7F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x7D, 0x14, 0x71, 0xA9, 0xEF,
+0x70, 0x27, 0x90, 0x83, 0x7F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x7D, 0x15, 0x71, 0xA9, 0xEF, 0x64,
+0x50, 0x70, 0x16, 0x90, 0x83, 0x7F, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x7D, 0x21, 0x71, 0xA9, 0xEF,
+0x20, 0xE0, 0x03, 0x30, 0xE2, 0x03, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x83, 0x6F, 0xEE,
+0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x78, 0x72, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0xFF, 0x7A,
+0x40, 0x79, 0xD4, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x41, 0xD0, 0x78, 0x79, 0x7C, 0x83, 0x7D, 0x01,
+0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xDA, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0xE4, 0x90, 0x83,
+0x78, 0xF0, 0x90, 0x83, 0x78, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x1F, 0x90, 0x83, 0x70, 0xE0,
+0x24, 0x04, 0x71, 0x97, 0x90, 0x83, 0x78, 0xE0, 0x24, 0x72, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5,
+0x83, 0xEF, 0xF0, 0x90, 0x83, 0x78, 0xE0, 0x04, 0xF0, 0x80, 0xD7, 0x78, 0x72, 0x7C, 0x83, 0x7D,
+0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x86, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x43, 0xEF, 0xEF, 0x60,
+0x02, 0xE1, 0xDB, 0x90, 0x83, 0x71, 0xE0, 0xFF, 0x90, 0x83, 0x70, 0xE0, 0x2F, 0xFF, 0x90, 0x83,
+0x6F, 0xE0, 0x34, 0x00, 0xFE, 0x90, 0x83, 0x7D, 0xF0, 0xA3, 0xEF, 0xF0, 0x24, 0x06, 0xFF, 0xE4,
+0x3E, 0xFE, 0xE4, 0xFD, 0x71, 0xA9, 0xEF, 0x64, 0x08, 0x60, 0x02, 0xE1, 0xDB, 0x90, 0x83, 0x7E,
+0xE0, 0x24, 0x07, 0xFF, 0x90, 0x83, 0x7D, 0xE0, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x71, 0xA9, 0xEF,
+0x70, 0x69, 0x90, 0x83, 0x78, 0xF0, 0x90, 0x83, 0x78, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x23,
+0x90, 0x83, 0x7E, 0xE0, 0x24, 0x18, 0xFD, 0x90, 0x83, 0x7D, 0x71, 0x9B, 0x90, 0x83, 0x78, 0xE0,
+0x24, 0x79, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x83, 0x78, 0xE0, 0x04,
+0xF0, 0x80, 0xD3, 0x78, 0x79, 0x7C, 0x83, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xA2, 0x7E,
+0x00, 0x7F, 0x04, 0x12, 0x43, 0xEF, 0xEF, 0x70, 0x22, 0x90, 0x83, 0x7E, 0xE0, 0x24, 0x08, 0xFF,
+0x90, 0x83, 0x7D, 0xE0, 0x34, 0x00, 0xFE, 0xD1, 0x72, 0xEF, 0x64, 0x01, 0x60, 0x0D, 0x90, 0x01,
+0xC7, 0x74, 0x22, 0xF0, 0x90, 0x81, 0x85, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x7D, 0x7F, 0xEF, 0x5D,
+0xC3, 0x60, 0x14, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0x24,
+0x80, 0xFF, 0xE4, 0x3E, 0xFE, 0x80, 0x0D, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E,
+0xFE, 0xED, 0x5F, 0xFF, 0x22, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, 0x7C, 0x00,
+0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x83, 0x61, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x87, 0xE0,
+0x90, 0x83, 0x65, 0xF0, 0x90, 0x81, 0x7D, 0xE0, 0x20, 0xE0, 0x02, 0x01, 0xFE, 0x90, 0x83, 0x65,
+0xE0, 0xFF, 0xEC, 0xC3, 0x9F, 0x40, 0x02, 0x01, 0xFE, 0x90, 0x83, 0x61, 0xE0, 0xFA, 0xA3, 0xE0,
+0xFB, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0xAD, 0x07, 0x74, 0x02, 0x2D, 0xF5, 0x82, 0xE4,
+0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8, 0xF9, 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, 0x83, 0x63,
+0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x03, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54,
+0x03, 0xFF, 0x7E, 0x00, 0xAD, 0x01, 0xED, 0x24, 0x18, 0xFB, 0xEA, 0x33, 0xCB, 0x2F, 0xFF, 0xEE,
+0x3B, 0x90, 0x83, 0x63, 0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x83, 0x63, 0xE0, 0xFE, 0xA3, 0xE0,
+0xFF, 0x12, 0x77, 0xDC, 0x90, 0x83, 0x63, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x83, 0x61, 0xEE,
+0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x80, 0xF7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xD3, 0x90, 0x83,
+0x62, 0xE0, 0x9F, 0x90, 0x83, 0x61, 0xE0, 0x9E, 0x40, 0x1B, 0x90, 0x80, 0xF8, 0xE0, 0x24, 0x01,
+0xFF, 0x90, 0x80, 0xF7, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0x90, 0x83, 0x62, 0xE0, 0x9F, 0xF0, 0x90,
+0x83, 0x61, 0xE0, 0x9E, 0xF0, 0x90, 0x83, 0x61, 0x12, 0x57, 0xD2, 0x0C, 0x01, 0x2D, 0x22, 0x31,
+0x4F, 0xAD, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xFF, 0xF0, 0x74, 0x78, 0xA3, 0xF0, 0xED, 0x64, 0x01,
+0x60, 0x22, 0x90, 0x81, 0x85, 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, 0x51, 0xD1, 0x11, 0x05, 0x90, 0x02, 0x87, 0xE0, 0x70, 0xF8, 0x90, 0x06, 0x90, 0xE0,
+0x44, 0x02, 0xF0, 0x74, 0xFF, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x78, 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, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x61, 0x12,
+0x42, 0x3A, 0x12, 0x1F, 0xA4, 0x20, 0xE0, 0x05, 0x12, 0x4F, 0xF4, 0x41, 0x9D, 0x90, 0x82, 0x50,
+0x74, 0x05, 0xF0, 0x90, 0x83, 0x61, 0x12, 0x42, 0x31, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE,
+0x90, 0x81, 0x80, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD,
+0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90,
+0x81, 0x80, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4,
+0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x80, 0xF0, 0xEE, 0x54, 0x20,
+0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54,
+0xBF, 0x4D, 0xFF, 0x90, 0x81, 0x80, 0xF0, 0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0,
+0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x80, 0xFF, 0x90, 0x81, 0x81, 0xE0, 0x54, 0x7F, 0x4F,
+0xF0, 0x12, 0x1F, 0xA4, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44,
+0x04, 0xF0, 0x90, 0x83, 0x61, 0x12, 0x42, 0x31, 0x12, 0x1F, 0xA4, 0x13, 0x13, 0x13, 0x54, 0x1F,
+0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x80, 0x06, 0xE0, 0xB4, 0x02,
+0x0D, 0x90, 0x81, 0x81, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x20, 0xE0, 0x51, 0x90, 0x00,
+0x01, 0x12, 0x1F, 0xBD, 0x54, 0x7F, 0xFF, 0x90, 0x81, 0x81, 0xE0, 0x54, 0x80, 0x4F, 0xF0, 0x90,
+0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x82, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF,
+0x54, 0x01, 0xFE, 0x90, 0x81, 0x83, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0xFE, 0xFF,
+0xEE, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x81, 0x81, 0xE0, 0x54, 0x7F, 0xFF, 0x90, 0x81, 0x80, 0xE0,
+0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x12, 0x52, 0xEE, 0x90,
+0x80, 0x06, 0xE0, 0xB4, 0x01, 0x07, 0x90, 0xFE, 0x10, 0xE0, 0x44, 0x04, 0xF0, 0xD0, 0xD0, 0x92,
+0xAF, 0x22, 0x90, 0x81, 0x85, 0xE0, 0xFF, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2,
+0x14, 0xEF, 0x44, 0x01, 0x90, 0x81, 0x85, 0xF0, 0x90, 0x81, 0x80, 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, 0x81, 0x85, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xE4,
+0xFF, 0x74, 0x48, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0xA4, 0x2F,
+0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x08, 0xE3, 0x90, 0x82,
+0x50, 0xE0, 0x90, 0x04, 0x4C, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE,
+0xAF, 0x05, 0xED, 0x2E, 0x90, 0x83, 0x30, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED,
+0x2F, 0x90, 0x83, 0x31, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83,
+0x32, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x33, 0xF0, 0x90,
+0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x34, 0xF0, 0x90, 0x00, 0x05, 0x12,
+0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x35, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0xFF,
+0xAE, 0x05, 0xED, 0x2F, 0x90, 0x83, 0x36, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F,
+0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x83, 0x37, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD,
+0xFF, 0xED, 0x2F, 0x90, 0x83, 0x38, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F,
+0x90, 0x83, 0x39, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x3A,
+0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x3B, 0xF0, 0x90, 0x00,
+0x05, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x83, 0x3C, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F,
+0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x83, 0x3D, 0xF0, 0x22, 0xE4, 0xFF, 0x74, 0x18, 0x2F,
+0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x8C, 0x2F, 0xF5, 0x82, 0xE4, 0x34,
+0x81, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x10, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0,
+0xFE, 0x74, 0x86, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4,
+0x06, 0xCB, 0x22, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x3A, 0x12, 0x1F, 0xA4, 0x90, 0x83, 0xAE, 0xF0,
+0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xAF, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD,
+0x90, 0x83, 0xB0, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xB1, 0xF0, 0x90, 0x00,
+0x06, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xB2, 0xF0, 0x90, 0x00, 0x07, 0x12, 0x1F, 0xBD, 0x90, 0x83,
+0xB3, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0xB6, 0xF0, 0xED, 0x70, 0x31, 0xFF,
+0x74, 0xAE, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0xAE,
+0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74, 0xAE, 0x2F, 0xF5,
+0x82, 0xE4, 0x34, 0x83, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF, 0xB4, 0x06, 0xD0,
+0x90, 0x83, 0xAD, 0xE0, 0xFF, 0xB4, 0x04, 0x25, 0xA3, 0xE0, 0xFE, 0x90, 0x83, 0xA9, 0x12, 0x42,
+0x31, 0xEE, 0x12, 0x1F, 0xEA, 0x90, 0x83, 0xAF, 0xE0, 0xFE, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x31,
+0x90, 0x00, 0x01, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x02, 0xE4, 0x80, 0x30, 0xEF, 0xB4, 0x02,
+0x2F, 0x90, 0x83, 0xAF, 0xE0, 0xFF, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x31, 0xEF, 0x12, 0x1F, 0xEA,
+0x90, 0x83, 0xAF, 0xE0, 0x44, 0x20, 0x54, 0x7F, 0xFF, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x31, 0x90,
+0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x83, 0xAE, 0xE0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xFC,
+0x90, 0x83, 0xA9, 0x12, 0x42, 0x31, 0xE9, 0x24, 0x03, 0xF9, 0xE4, 0x3A, 0xFA, 0x12, 0x1F, 0xA4,
+0x44, 0x20, 0x12, 0x1F, 0xEA, 0x90, 0x83, 0xB0, 0xE0, 0xFF, 0x90, 0x83, 0xA9, 0x12, 0x42, 0x31,
+0x90, 0x00, 0x04, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x83, 0xB1, 0xE0, 0x90, 0x00, 0x05, 0x12, 0x1F,
+0xFC, 0x90, 0x83, 0xB2, 0xE0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xFC, 0x90, 0x83, 0xB3, 0xE0, 0x90,
+0x00, 0x07, 0x02, 0x1F, 0xFC, 0x00, 0xD1, 0x45,
+};
+u4Byte ArrayLength_MP_8188E_FW_WoWLAN_T = 15688;
+
+
+void
+ODM_ReadFirmware_MP_8188E_FW_WoWLAN_T(
+ 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_8188E_FW_WoWLAN_T;
+#else
+ ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8188E_FW_WoWLAN_T, ArrayLength_MP_8188E_FW_WoWLAN_T);
+#endif
+ *pFirmwareSize = ArrayLength_MP_8188E_FW_WoWLAN_T;
+}
+
+
+
+#endif // end of DM_ODM_SUPPORT_TYPE & (ODM_AP)
+
+
+#endif // end of HWIMG_SUPPORT
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.h b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.h
index e43c886..0a8afdf 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.h
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_FW.h
@@ -1,83 +1,83 @@
-/******************************************************************************
-*
-* 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 (RTL8188E_SUPPORT == 1)
-#ifndef __INC_MP_FW_HW_IMG_8188E_H
-#define __INC_MP_FW_HW_IMG_8188E_H
-
-
-/******************************************************************************
-* FW_AP.TXT
-******************************************************************************/
-
-void
-ODM_ReadFirmware_MP_8188E_FW_AP(
- IN PDM_ODM_T pDM_Odm,
- OUT u1Byte *pFirmware,
- OUT u4Byte *pFirmwareSize
-);
-
-/******************************************************************************
-* FW_NIC_S.TXT
-******************************************************************************/
-
-void
-ODM_ReadFirmware_MP_8188E_FW_NIC_S(
- IN PDM_ODM_T pDM_Odm,
- OUT u1Byte *pFirmware,
- OUT u4Byte *pFirmwareSize
-);
-
-/******************************************************************************
-* FW_NIC_T.TXT
-******************************************************************************/
-
-void
-ODM_ReadFirmware_MP_8188E_FW_NIC_T(
- IN PDM_ODM_T pDM_Odm,
- OUT u1Byte *pFirmware,
- OUT u4Byte *pFirmwareSize
-);
-
-/******************************************************************************
-* FW_WoWLAN_S.TXT
-******************************************************************************/
-
-void
-ODM_ReadFirmware_MP_8188E_FW_WoWLAN_S(
- IN PDM_ODM_T pDM_Odm,
- OUT u1Byte *pFirmware,
- OUT u4Byte *pFirmwareSize
-);
-
-/******************************************************************************
-* FW_WoWLAN_T.TXT
-******************************************************************************/
-
-void
-ODM_ReadFirmware_MP_8188E_FW_WoWLAN_T(
- IN PDM_ODM_T pDM_Odm,
- OUT u1Byte *pFirmware,
- OUT u4Byte *pFirmwareSize
-);
-
-#endif
-#endif // end of HWIMG_SUPPORT
-
+/******************************************************************************
+*
+* 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 (RTL8188E_SUPPORT == 1)
+#ifndef __INC_MP_FW_HW_IMG_8188E_H
+#define __INC_MP_FW_HW_IMG_8188E_H
+
+
+/******************************************************************************
+* FW_AP.TXT
+******************************************************************************/
+
+void
+ODM_ReadFirmware_MP_8188E_FW_AP(
+ IN PDM_ODM_T pDM_Odm,
+ OUT u1Byte *pFirmware,
+ OUT u4Byte *pFirmwareSize
+);
+
+/******************************************************************************
+* FW_NIC_S.TXT
+******************************************************************************/
+
+void
+ODM_ReadFirmware_MP_8188E_FW_NIC_S(
+ IN PDM_ODM_T pDM_Odm,
+ OUT u1Byte *pFirmware,
+ OUT u4Byte *pFirmwareSize
+);
+
+/******************************************************************************
+* FW_NIC_T.TXT
+******************************************************************************/
+
+void
+ODM_ReadFirmware_MP_8188E_FW_NIC_T(
+ IN PDM_ODM_T pDM_Odm,
+ OUT u1Byte *pFirmware,
+ OUT u4Byte *pFirmwareSize
+);
+
+/******************************************************************************
+* FW_WoWLAN_S.TXT
+******************************************************************************/
+
+void
+ODM_ReadFirmware_MP_8188E_FW_WoWLAN_S(
+ IN PDM_ODM_T pDM_Odm,
+ OUT u1Byte *pFirmware,
+ OUT u4Byte *pFirmwareSize
+);
+
+/******************************************************************************
+* FW_WoWLAN_T.TXT
+******************************************************************************/
+
+void
+ODM_ReadFirmware_MP_8188E_FW_WoWLAN_T(
+ IN PDM_ODM_T pDM_Odm,
+ OUT u1Byte *pFirmware,
+ OUT u4Byte *pFirmwareSize
+);
+
+#endif
+#endif // end of HWIMG_SUPPORT
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.c b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.c
index 2c75091..1dc548e 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.c
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.c
@@ -1,608 +1,608 @@
-/******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-* more details.
-*
-* You should have received a copy of the GNU General Public License along with
-* this program; if not, write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-*
-*
-******************************************************************************/
-
-
-#include "../odm_precomp.h"
-#ifdef CONFIG_IOL_IOREG_CFG
-#include <rtw_iol.h>
-#endif
-#if (RTL8188E_SUPPORT == 1)
-static BOOLEAN
-CheckCondition(
- const u4Byte Condition,
- const u4Byte Hex
- )
-{
- u4Byte _board = (Hex & 0x000000FF);
- u4Byte _interface = (Hex & 0x0000FF00) >> 8;
- u4Byte _platform = (Hex & 0x00FF0000) >> 16;
- u4Byte cond = Condition;
-
- if ( Condition == 0xCDCDCDCD )
- return TRUE;
-
- cond = Condition & 0x000000FF;
- if ( (_board != cond) && (cond != 0xFF) )
- return FALSE;
-
- cond = Condition & 0x0000FF00;
- cond = cond >> 8;
- if ( ((_interface & cond) == 0) && (cond != 0x07) )
- return FALSE;
-
- cond = Condition & 0x00FF0000;
- cond = cond >> 16;
- if ( ((_platform & cond) == 0) && (cond != 0x0F) )
- return FALSE;
- return TRUE;
-}
-
-
-/******************************************************************************
-* MAC_REG.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_MAC_REG[] = {
- 0x026, 0x00000041,
- 0x027, 0x00000035,
- 0xFF0F0718, 0xABCD,
- 0x040, 0x0000000C,
- 0xCDCDCDCD, 0xCDCD,
- 0x040, 0x00000000,
- 0xFF0F0718, 0xDEAD,
- 0x428, 0x0000000A,
- 0x429, 0x00000010,
- 0x430, 0x00000000,
- 0x431, 0x00000001,
- 0x432, 0x00000002,
- 0x433, 0x00000004,
- 0x434, 0x00000005,
- 0x435, 0x00000006,
- 0x436, 0x00000007,
- 0x437, 0x00000008,
- 0x438, 0x00000000,
- 0x439, 0x00000000,
- 0x43A, 0x00000001,
- 0x43B, 0x00000002,
- 0x43C, 0x00000004,
- 0x43D, 0x00000005,
- 0x43E, 0x00000006,
- 0x43F, 0x00000007,
- 0x440, 0x0000005D,
- 0x441, 0x00000001,
- 0x442, 0x00000000,
- 0x444, 0x00000015,
- 0x445, 0x000000F0,
- 0x446, 0x0000000F,
- 0x447, 0x00000000,
- 0x458, 0x00000041,
- 0x459, 0x000000A8,
- 0x45A, 0x00000072,
- 0x45B, 0x000000B9,
- 0x460, 0x00000066,
- 0x461, 0x00000066,
- 0x480, 0x00000008,
- 0x4C8, 0x000000FF,
- 0x4C9, 0x00000008,
- 0x4CC, 0x000000FF,
- 0x4CD, 0x000000FF,
- 0x4CE, 0x00000001,
- 0x4D3, 0x00000001,
- 0x500, 0x00000026,
- 0x501, 0x000000A2,
- 0x502, 0x0000002F,
- 0x503, 0x00000000,
- 0x504, 0x00000028,
- 0x505, 0x000000A3,
- 0x506, 0x0000005E,
- 0x507, 0x00000000,
- 0x508, 0x0000002B,
- 0x509, 0x000000A4,
- 0x50A, 0x0000005E,
- 0x50B, 0x00000000,
- 0x50C, 0x0000004F,
- 0x50D, 0x000000A4,
- 0x50E, 0x00000000,
- 0x50F, 0x00000000,
- 0x512, 0x0000001C,
- 0x514, 0x0000000A,
- 0x516, 0x0000000A,
- 0x525, 0x0000004F,
- 0x550, 0x00000010,
- 0x551, 0x00000010,
- 0x559, 0x00000002,
- 0x55D, 0x000000FF,
- 0x605, 0x00000030,
- 0x608, 0x0000000E,
- 0x609, 0x0000002A,
- 0x620, 0x000000FF,
- 0x621, 0x000000FF,
- 0x622, 0x000000FF,
- 0x623, 0x000000FF,
- 0x624, 0x000000FF,
- 0x625, 0x000000FF,
- 0x626, 0x000000FF,
- 0x627, 0x000000FF,
- 0x652, 0x00000020,
- 0x63C, 0x0000000A,
- 0x63D, 0x0000000A,
- 0x63E, 0x0000000E,
- 0x63F, 0x0000000E,
- 0x640, 0x00000040,
- 0x66E, 0x00000005,
- 0x700, 0x00000021,
- 0x701, 0x00000043,
- 0x702, 0x00000065,
- 0x703, 0x00000087,
- 0x708, 0x00000021,
- 0x709, 0x00000043,
- 0x70A, 0x00000065,
- 0x70B, 0x00000087,
-
-};
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_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_8188E_MAC_REG)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_MAC_REG;
- BOOLEAN biol = FALSE;
-
-#ifdef CONFIG_IOL_IOREG_CFG
- PADAPTER Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame;
- u8 bndy_cnt = 1;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- struct cmd_cmp cmpdata[ArrayLen];
- u4Byte cmpdata_idx=0;
- #endif
-#endif //CONFIG_IOL_IOREG_CFG
- HAL_STATUS rst =HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += _interface << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG, hex = 0x%X\n", hex));
-
-#ifdef CONFIG_IOL_IOREG_CFG
- biol = rtw_IOL_applied(Adapter);
-
- if(biol){
- if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
- {
- printk("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-
-#endif //CONFIG_IOL_IOREG_CFG
- for (i = 0; i < ArrayLen; i += 2 )
- {
- u4Byte v1 = Array[i];
- u4Byte v2 = Array[i+1];
-
- // This (offset, data) pair meets the condition.
- if ( v1 < 0xCDCDCDCD )
- {
- #ifdef CONFIG_IOL_IOREG_CFG
-
- if(biol){
-
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
- else
- #endif //endif CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2);
- }
- continue;
- }
- else
- { // This line is the start line of branch.
- if ( !CheckCondition(Array[i], hex) )
- { // Discard the following (offset, data) pairs.
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; // prevent from for-loop += 2
- }
- else // Configure matched pairs and skip to end of if-else.
- {
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2);
- }
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- }
- }
- }
-
-#ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
-
- if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
- {
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- printk("~~~ IOL Config MAC Success !!! \n");
- //compare writed data
- {
- u4Byte idx;
- u1Byte cdata;
- // HAL_STATUS_FAILURE;
- printk(" MAC data compare => array_len:%d \n",cmpdata_idx);
- for(idx=0;idx< cmpdata_idx;idx++)
- {
- cdata = ODM_Read1Byte(pDM_Odm, cmpdata[idx].addr);
- if(cdata != cmpdata[idx].value){
- printk("### MAC data compared failed !! addr:0x%04x, data:(0x%02x : 0x%02x) ###\n",
- cmpdata[idx].addr,cmpdata[idx].value,cdata);
- //rst = HAL_STATUS_FAILURE;
- }
- }
-
-
- //dump data from TX packet buffer
- //if(rst == HAL_STATUS_FAILURE)
- {
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
-
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- }
- else{
- printk("~~~ MAC IOL_exec_cmds Failed !!! \n");
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
- rst = HAL_STATUS_FAILURE;
- }
-
- }
-#endif //#ifdef CONFIG_IOL_IOREG_CFG
- return rst;
-}
-
-/******************************************************************************
-* MAC_REG_ICUT.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_MAC_REG_ICUT[] = {
- 0x026, 0x00000041,
- 0x027, 0x00000035,
- 0x428, 0x0000000A,
- 0x429, 0x00000010,
- 0x430, 0x00000000,
- 0x431, 0x00000001,
- 0x432, 0x00000002,
- 0x433, 0x00000004,
- 0x434, 0x00000005,
- 0x435, 0x00000006,
- 0x436, 0x00000007,
- 0x437, 0x00000008,
- 0x438, 0x00000000,
- 0x439, 0x00000000,
- 0x43A, 0x00000001,
- 0x43B, 0x00000002,
- 0x43C, 0x00000004,
- 0x43D, 0x00000005,
- 0x43E, 0x00000006,
- 0x43F, 0x00000007,
- 0x440, 0x0000005D,
- 0x441, 0x00000001,
- 0x442, 0x00000000,
- 0x444, 0x00000015,
- 0x445, 0x000000F0,
- 0x446, 0x0000000F,
- 0x447, 0x00000000,
- 0x458, 0x00000041,
- 0x459, 0x000000A8,
- 0x45A, 0x00000072,
- 0x45B, 0x000000B9,
- 0x460, 0x00000066,
- 0x461, 0x00000066,
- 0x480, 0x00000008,
- 0x4C8, 0x000000FF,
- 0x4C9, 0x00000008,
- 0x4CC, 0x000000FF,
- 0x4CD, 0x000000FF,
- 0x4CE, 0x00000001,
- 0x4D3, 0x00000001,
- 0x500, 0x00000026,
- 0x501, 0x000000A2,
- 0x502, 0x0000002F,
- 0x503, 0x00000000,
- 0x504, 0x00000028,
- 0x505, 0x000000A3,
- 0x506, 0x0000005E,
- 0x507, 0x00000000,
- 0x508, 0x0000002B,
- 0x509, 0x000000A4,
- 0x50A, 0x0000005E,
- 0x50B, 0x00000000,
- 0x50C, 0x0000004F,
- 0x50D, 0x000000A4,
- 0x50E, 0x00000000,
- 0x50F, 0x00000000,
- 0x512, 0x0000001C,
- 0x514, 0x0000000A,
- 0x516, 0x0000000A,
- 0x525, 0x0000004F,
- 0x550, 0x00000010,
- 0x551, 0x00000010,
- 0x559, 0x00000002,
- 0x55D, 0x000000FF,
- 0x605, 0x00000030,
- 0x608, 0x0000000E,
- 0x609, 0x0000002A,
- 0x620, 0x000000FF,
- 0x621, 0x000000FF,
- 0x622, 0x000000FF,
- 0x623, 0x000000FF,
- 0x624, 0x000000FF,
- 0x625, 0x000000FF,
- 0x626, 0x000000FF,
- 0x627, 0x000000FF,
- 0x652, 0x00000020,
- 0x63C, 0x0000000A,
- 0x63D, 0x0000000A,
- 0x63E, 0x0000000E,
- 0x63F, 0x0000000E,
- 0x640, 0x00000040,
- 0x66E, 0x00000005,
- 0x700, 0x00000021,
- 0x701, 0x00000043,
- 0x702, 0x00000065,
- 0x703, 0x00000087,
- 0x708, 0x00000021,
- 0x709, 0x00000043,
- 0x70A, 0x00000065,
- 0x70B, 0x00000087,
-
-};
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT(
- 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_8188E_MAC_REG_ICUT)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_MAC_REG_ICUT;
- BOOLEAN biol = FALSE;
-
-#ifdef CONFIG_IOL_IOREG_CFG
- PADAPTER Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame;
- u8 bndy_cnt = 1;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- struct cmd_cmp cmpdata[ArrayLen];
- u4Byte cmpdata_idx=0;
- #endif
-#endif //CONFIG_IOL_IOREG_CFG
- HAL_STATUS rst =HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += _interface << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT, hex = 0x%X\n", hex));
-
-#ifdef CONFIG_IOL_IOREG_CFG
- biol = rtw_IOL_applied(Adapter);
-
- if(biol){
- if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
- {
- printk("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-
-#endif //CONFIG_IOL_IOREG_CFG
- for (i = 0; i < ArrayLen; i += 2 )
- {
- u4Byte v1 = Array[i];
- u4Byte v2 = Array[i+1];
-
- // This (offset, data) pair meets the condition.
- if ( v1 < 0xCDCDCDCD )
- {
- #ifdef CONFIG_IOL_IOREG_CFG
-
- if(biol){
-
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
- else
- #endif //endif CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2);
- }
- continue;
- }
- else
- { // This line is the start line of branch.
- if ( !CheckCondition(Array[i], hex) )
- { // Discard the following (offset, data) pairs.
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; // prevent from for-loop += 2
- }
- else // Configure matched pairs and skip to end of if-else.
- {
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2);
- }
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- }
- }
- }
-
-#ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
-
- if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
- {
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- printk("~~~ IOL Config MAC Success !!! \n");
- //compare writed data
- {
- u4Byte idx;
- u1Byte cdata;
- // HAL_STATUS_FAILURE;
- printk(" MAC data compare => array_len:%d \n",cmpdata_idx);
- for(idx=0;idx< cmpdata_idx;idx++)
- {
- cdata = ODM_Read1Byte(pDM_Odm, cmpdata[idx].addr);
- if(cdata != cmpdata[idx].value){
- printk("### MAC data compared failed !! addr:0x%04x, data:(0x%02x : 0x%02x) ###\n",
- cmpdata[idx].addr,cmpdata[idx].value,cdata);
- //rst = HAL_STATUS_FAILURE;
- }
- }
-
-
- //dump data from TX packet buffer
- //if(rst == HAL_STATUS_FAILURE)
- {
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
-
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- }
- else{
- printk("~~~ MAC IOL_exec_cmds Failed !!! \n");
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
- rst = HAL_STATUS_FAILURE;
- }
-
- }
-#endif //#ifdef CONFIG_IOL_IOREG_CFG
- return rst;
-}
-
-#endif // end of HWIMG_SUPPORT
-
+/******************************************************************************
+*
+* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+* more details.
+*
+* You should have received a copy of the GNU General Public License along with
+* this program; if not, write to the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+*
+*
+******************************************************************************/
+
+
+#include "../odm_precomp.h"
+#ifdef CONFIG_IOL_IOREG_CFG
+#include <rtw_iol.h>
+#endif
+#if (RTL8188E_SUPPORT == 1)
+static BOOLEAN
+CheckCondition(
+ const u4Byte Condition,
+ const u4Byte Hex
+ )
+{
+ u4Byte _board = (Hex & 0x000000FF);
+ u4Byte _interface = (Hex & 0x0000FF00) >> 8;
+ u4Byte _platform = (Hex & 0x00FF0000) >> 16;
+ u4Byte cond = Condition;
+
+ if ( Condition == 0xCDCDCDCD )
+ return TRUE;
+
+ cond = Condition & 0x000000FF;
+ if ( (_board != cond) && (cond != 0xFF) )
+ return FALSE;
+
+ cond = Condition & 0x0000FF00;
+ cond = cond >> 8;
+ if ( ((_interface & cond) == 0) && (cond != 0x07) )
+ return FALSE;
+
+ cond = Condition & 0x00FF0000;
+ cond = cond >> 16;
+ if ( ((_platform & cond) == 0) && (cond != 0x0F) )
+ return FALSE;
+ return TRUE;
+}
+
+
+/******************************************************************************
+* MAC_REG.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_MAC_REG[] = {
+ 0x026, 0x00000041,
+ 0x027, 0x00000035,
+ 0xFF0F0718, 0xABCD,
+ 0x040, 0x0000000C,
+ 0xCDCDCDCD, 0xCDCD,
+ 0x040, 0x00000000,
+ 0xFF0F0718, 0xDEAD,
+ 0x428, 0x0000000A,
+ 0x429, 0x00000010,
+ 0x430, 0x00000000,
+ 0x431, 0x00000001,
+ 0x432, 0x00000002,
+ 0x433, 0x00000004,
+ 0x434, 0x00000005,
+ 0x435, 0x00000006,
+ 0x436, 0x00000007,
+ 0x437, 0x00000008,
+ 0x438, 0x00000000,
+ 0x439, 0x00000000,
+ 0x43A, 0x00000001,
+ 0x43B, 0x00000002,
+ 0x43C, 0x00000004,
+ 0x43D, 0x00000005,
+ 0x43E, 0x00000006,
+ 0x43F, 0x00000007,
+ 0x440, 0x0000005D,
+ 0x441, 0x00000001,
+ 0x442, 0x00000000,
+ 0x444, 0x00000015,
+ 0x445, 0x000000F0,
+ 0x446, 0x0000000F,
+ 0x447, 0x00000000,
+ 0x458, 0x00000041,
+ 0x459, 0x000000A8,
+ 0x45A, 0x00000072,
+ 0x45B, 0x000000B9,
+ 0x460, 0x00000066,
+ 0x461, 0x00000066,
+ 0x480, 0x00000008,
+ 0x4C8, 0x000000FF,
+ 0x4C9, 0x00000008,
+ 0x4CC, 0x000000FF,
+ 0x4CD, 0x000000FF,
+ 0x4CE, 0x00000001,
+ 0x4D3, 0x00000001,
+ 0x500, 0x00000026,
+ 0x501, 0x000000A2,
+ 0x502, 0x0000002F,
+ 0x503, 0x00000000,
+ 0x504, 0x00000028,
+ 0x505, 0x000000A3,
+ 0x506, 0x0000005E,
+ 0x507, 0x00000000,
+ 0x508, 0x0000002B,
+ 0x509, 0x000000A4,
+ 0x50A, 0x0000005E,
+ 0x50B, 0x00000000,
+ 0x50C, 0x0000004F,
+ 0x50D, 0x000000A4,
+ 0x50E, 0x00000000,
+ 0x50F, 0x00000000,
+ 0x512, 0x0000001C,
+ 0x514, 0x0000000A,
+ 0x516, 0x0000000A,
+ 0x525, 0x0000004F,
+ 0x550, 0x00000010,
+ 0x551, 0x00000010,
+ 0x559, 0x00000002,
+ 0x55D, 0x000000FF,
+ 0x605, 0x00000030,
+ 0x608, 0x0000000E,
+ 0x609, 0x0000002A,
+ 0x620, 0x000000FF,
+ 0x621, 0x000000FF,
+ 0x622, 0x000000FF,
+ 0x623, 0x000000FF,
+ 0x624, 0x000000FF,
+ 0x625, 0x000000FF,
+ 0x626, 0x000000FF,
+ 0x627, 0x000000FF,
+ 0x652, 0x00000020,
+ 0x63C, 0x0000000A,
+ 0x63D, 0x0000000A,
+ 0x63E, 0x0000000E,
+ 0x63F, 0x0000000E,
+ 0x640, 0x00000040,
+ 0x66E, 0x00000005,
+ 0x700, 0x00000021,
+ 0x701, 0x00000043,
+ 0x702, 0x00000065,
+ 0x703, 0x00000087,
+ 0x708, 0x00000021,
+ 0x709, 0x00000043,
+ 0x70A, 0x00000065,
+ 0x70B, 0x00000087,
+
+};
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_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_8188E_MAC_REG)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_MAC_REG;
+ BOOLEAN biol = FALSE;
+
+#ifdef CONFIG_IOL_IOREG_CFG
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ struct xmit_frame *pxmit_frame;
+ u8 bndy_cnt = 1;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ struct cmd_cmp cmpdata[ArrayLen];
+ u4Byte cmpdata_idx=0;
+ #endif
+#endif //CONFIG_IOL_IOREG_CFG
+ HAL_STATUS rst =HAL_STATUS_SUCCESS;
+
+ hex += board;
+ hex += _interface << 8;
+ hex += platform << 16;
+ hex += 0xFF000000;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG, hex = 0x%X\n", hex));
+
+#ifdef CONFIG_IOL_IOREG_CFG
+ biol = rtw_IOL_applied(Adapter);
+
+ if(biol){
+ if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
+ {
+ printk("rtw_IOL_accquire_xmit_frame failed\n");
+ return HAL_STATUS_FAILURE;
+ }
+ }
+
+#endif //CONFIG_IOL_IOREG_CFG
+ for (i = 0; i < ArrayLen; i += 2 )
+ {
+ u4Byte v1 = Array[i];
+ u4Byte v2 = Array[i+1];
+
+ // This (offset, data) pair meets the condition.
+ if ( v1 < 0xCDCDCDCD )
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+
+ if(biol){
+
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+ else
+ #endif //endif CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2);
+ }
+ continue;
+ }
+ else
+ { // This line is the start line of branch.
+ if ( !CheckCondition(Array[i], hex) )
+ { // Discard the following (offset, data) pairs.
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+ i -= 2; // prevent from for-loop += 2
+ }
+ else // Configure matched pairs and skip to end of if-else.
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2);
+ }
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ while (v2 != 0xDEAD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ }
+ }
+ }
+
+#ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
+
+ if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ printk("~~~ IOL Config MAC Success !!! \n");
+ //compare writed data
+ {
+ u4Byte idx;
+ u1Byte cdata;
+ // HAL_STATUS_FAILURE;
+ printk(" MAC data compare => array_len:%d \n",cmpdata_idx);
+ for(idx=0;idx< cmpdata_idx;idx++)
+ {
+ cdata = ODM_Read1Byte(pDM_Odm, cmpdata[idx].addr);
+ if(cdata != cmpdata[idx].value){
+ printk("### MAC data compared failed !! addr:0x%04x, data:(0x%02x : 0x%02x) ###\n",
+ cmpdata[idx].addr,cmpdata[idx].value,cdata);
+ //rst = HAL_STATUS_FAILURE;
+ }
+ }
+
+
+ //dump data from TX packet buffer
+ //if(rst == HAL_STATUS_FAILURE)
+ {
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ }
+ else{
+ printk("~~~ MAC IOL_exec_cmds Failed !!! \n");
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+ rst = HAL_STATUS_FAILURE;
+ }
+
+ }
+#endif //#ifdef CONFIG_IOL_IOREG_CFG
+ return rst;
+}
+
+/******************************************************************************
+* MAC_REG_ICUT.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_MAC_REG_ICUT[] = {
+ 0x026, 0x00000041,
+ 0x027, 0x00000035,
+ 0x428, 0x0000000A,
+ 0x429, 0x00000010,
+ 0x430, 0x00000000,
+ 0x431, 0x00000001,
+ 0x432, 0x00000002,
+ 0x433, 0x00000004,
+ 0x434, 0x00000005,
+ 0x435, 0x00000006,
+ 0x436, 0x00000007,
+ 0x437, 0x00000008,
+ 0x438, 0x00000000,
+ 0x439, 0x00000000,
+ 0x43A, 0x00000001,
+ 0x43B, 0x00000002,
+ 0x43C, 0x00000004,
+ 0x43D, 0x00000005,
+ 0x43E, 0x00000006,
+ 0x43F, 0x00000007,
+ 0x440, 0x0000005D,
+ 0x441, 0x00000001,
+ 0x442, 0x00000000,
+ 0x444, 0x00000015,
+ 0x445, 0x000000F0,
+ 0x446, 0x0000000F,
+ 0x447, 0x00000000,
+ 0x458, 0x00000041,
+ 0x459, 0x000000A8,
+ 0x45A, 0x00000072,
+ 0x45B, 0x000000B9,
+ 0x460, 0x00000066,
+ 0x461, 0x00000066,
+ 0x480, 0x00000008,
+ 0x4C8, 0x000000FF,
+ 0x4C9, 0x00000008,
+ 0x4CC, 0x000000FF,
+ 0x4CD, 0x000000FF,
+ 0x4CE, 0x00000001,
+ 0x4D3, 0x00000001,
+ 0x500, 0x00000026,
+ 0x501, 0x000000A2,
+ 0x502, 0x0000002F,
+ 0x503, 0x00000000,
+ 0x504, 0x00000028,
+ 0x505, 0x000000A3,
+ 0x506, 0x0000005E,
+ 0x507, 0x00000000,
+ 0x508, 0x0000002B,
+ 0x509, 0x000000A4,
+ 0x50A, 0x0000005E,
+ 0x50B, 0x00000000,
+ 0x50C, 0x0000004F,
+ 0x50D, 0x000000A4,
+ 0x50E, 0x00000000,
+ 0x50F, 0x00000000,
+ 0x512, 0x0000001C,
+ 0x514, 0x0000000A,
+ 0x516, 0x0000000A,
+ 0x525, 0x0000004F,
+ 0x550, 0x00000010,
+ 0x551, 0x00000010,
+ 0x559, 0x00000002,
+ 0x55D, 0x000000FF,
+ 0x605, 0x00000030,
+ 0x608, 0x0000000E,
+ 0x609, 0x0000002A,
+ 0x620, 0x000000FF,
+ 0x621, 0x000000FF,
+ 0x622, 0x000000FF,
+ 0x623, 0x000000FF,
+ 0x624, 0x000000FF,
+ 0x625, 0x000000FF,
+ 0x626, 0x000000FF,
+ 0x627, 0x000000FF,
+ 0x652, 0x00000020,
+ 0x63C, 0x0000000A,
+ 0x63D, 0x0000000A,
+ 0x63E, 0x0000000E,
+ 0x63F, 0x0000000E,
+ 0x640, 0x00000040,
+ 0x66E, 0x00000005,
+ 0x700, 0x00000021,
+ 0x701, 0x00000043,
+ 0x702, 0x00000065,
+ 0x703, 0x00000087,
+ 0x708, 0x00000021,
+ 0x709, 0x00000043,
+ 0x70A, 0x00000065,
+ 0x70B, 0x00000087,
+
+};
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT(
+ 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_8188E_MAC_REG_ICUT)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_MAC_REG_ICUT;
+ BOOLEAN biol = FALSE;
+
+#ifdef CONFIG_IOL_IOREG_CFG
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ struct xmit_frame *pxmit_frame;
+ u8 bndy_cnt = 1;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ struct cmd_cmp cmpdata[ArrayLen];
+ u4Byte cmpdata_idx=0;
+ #endif
+#endif //CONFIG_IOL_IOREG_CFG
+ HAL_STATUS rst =HAL_STATUS_SUCCESS;
+
+ hex += board;
+ hex += _interface << 8;
+ hex += platform << 16;
+ hex += 0xFF000000;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT, hex = 0x%X\n", hex));
+
+#ifdef CONFIG_IOL_IOREG_CFG
+ biol = rtw_IOL_applied(Adapter);
+
+ if(biol){
+ if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
+ {
+ printk("rtw_IOL_accquire_xmit_frame failed\n");
+ return HAL_STATUS_FAILURE;
+ }
+ }
+
+#endif //CONFIG_IOL_IOREG_CFG
+ for (i = 0; i < ArrayLen; i += 2 )
+ {
+ u4Byte v1 = Array[i];
+ u4Byte v2 = Array[i+1];
+
+ // This (offset, data) pair meets the condition.
+ if ( v1 < 0xCDCDCDCD )
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+
+ if(biol){
+
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+ else
+ #endif //endif CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2);
+ }
+ continue;
+ }
+ else
+ { // This line is the start line of branch.
+ if ( !CheckCondition(Array[i], hex) )
+ { // Discard the following (offset, data) pairs.
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+ i -= 2; // prevent from for-loop += 2
+ }
+ else // Configure matched pairs and skip to end of if-else.
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+ rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2);
+ }
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ while (v2 != 0xDEAD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ }
+ }
+ }
+
+#ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
+
+ if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ printk("~~~ IOL Config MAC Success !!! \n");
+ //compare writed data
+ {
+ u4Byte idx;
+ u1Byte cdata;
+ // HAL_STATUS_FAILURE;
+ printk(" MAC data compare => array_len:%d \n",cmpdata_idx);
+ for(idx=0;idx< cmpdata_idx;idx++)
+ {
+ cdata = ODM_Read1Byte(pDM_Odm, cmpdata[idx].addr);
+ if(cdata != cmpdata[idx].value){
+ printk("### MAC data compared failed !! addr:0x%04x, data:(0x%02x : 0x%02x) ###\n",
+ cmpdata[idx].addr,cmpdata[idx].value,cdata);
+ //rst = HAL_STATUS_FAILURE;
+ }
+ }
+
+
+ //dump data from TX packet buffer
+ //if(rst == HAL_STATUS_FAILURE)
+ {
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ }
+ else{
+ printk("~~~ MAC IOL_exec_cmds Failed !!! \n");
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+ rst = HAL_STATUS_FAILURE;
+ }
+
+ }
+#endif //#ifdef CONFIG_IOL_IOREG_CFG
+ return rst;
+}
+
+#endif // end of HWIMG_SUPPORT
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.h b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.h
index e6b6d8e..38d0b2e 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.h
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_MAC.h
@@ -1,47 +1,47 @@
-/******************************************************************************
-*
-* 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 (RTL8188E_SUPPORT == 1)
-#ifndef __INC_MP_MAC_HW_IMG_8188E_H
-#define __INC_MP_MAC_HW_IMG_8188E_H
-
-//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex);
-
-/******************************************************************************
-* MAC_REG.TXT
-******************************************************************************/
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_MAC_REG( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* MAC_REG_ICUT.TXT
-******************************************************************************/
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-#endif
-#endif // end of HWIMG_SUPPORT
-
+/******************************************************************************
+*
+* 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 (RTL8188E_SUPPORT == 1)
+#ifndef __INC_MP_MAC_HW_IMG_8188E_H
+#define __INC_MP_MAC_HW_IMG_8188E_H
+
+//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex);
+
+/******************************************************************************
+* MAC_REG.TXT
+******************************************************************************/
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_MAC_REG( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* MAC_REG_ICUT.TXT
+******************************************************************************/
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+#endif
+#endif // end of HWIMG_SUPPORT
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.c b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.c
index f4c32e5..79a0410 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.c
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.c
@@ -1,1404 +1,1404 @@
-/******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-* more details.
-*
-* You should have received a copy of the GNU General Public License along with
-* this program; if not, write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-*
-*
-******************************************************************************/
-
-
-#include "../odm_precomp.h"
-
-#ifdef CONFIG_IOL_IOREG_CFG
-#include <rtw_iol.h>
-#endif
-
-#if (RTL8188E_SUPPORT == 1)
-static BOOLEAN
-CheckCondition(
- const u4Byte Condition,
- const u4Byte Hex
- )
-{
- u4Byte _board = (Hex & 0x000000FF);
- u4Byte _interface = (Hex & 0x0000FF00) >> 8;
- u4Byte _platform = (Hex & 0x00FF0000) >> 16;
- u4Byte cond = Condition;
-
- if ( Condition == 0xCDCDCDCD )
- return TRUE;
-
- cond = Condition & 0x000000FF;
- if ( (_board != cond) && (cond != 0xFF) )
- return FALSE;
-
- cond = Condition & 0x0000FF00;
- cond = cond >> 8;
- if ( ((_interface & cond) == 0) && (cond != 0x07) )
- return FALSE;
-
- cond = Condition & 0x00FF0000;
- cond = cond >> 16;
- if ( ((_platform & cond) == 0) && (cond != 0x0F) )
- return FALSE;
- return TRUE;
-}
-
-
-/******************************************************************************
-* RadioA_1T.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_RadioA_1T[] = {
- 0x000, 0x00030000,
- 0x008, 0x00084000,
- 0x018, 0x00000407,
- 0x019, 0x00000012,
- 0x01E, 0x00080009,
- 0x01F, 0x00000880,
- 0x02F, 0x0001A060,
- 0x03F, 0x00000000,
- 0x042, 0x000060C0,
- 0x057, 0x000D0000,
- 0x058, 0x000BE180,
- 0x067, 0x00001552,
- 0x083, 0x00000000,
- 0x0B0, 0x000FF8FC,
- 0x0B1, 0x00054400,
- 0x0B2, 0x000CCC19,
- 0x0B4, 0x00043003,
- 0x0B6, 0x0004953E,
- 0x0B7, 0x0001C718,
- 0x0B8, 0x000060FF,
- 0x0B9, 0x00080001,
- 0x0BA, 0x00040000,
- 0x0BB, 0x00000400,
- 0x0BF, 0x000C0000,
- 0x0C2, 0x00002400,
- 0x0C3, 0x00000009,
- 0x0C4, 0x00040C91,
- 0x0C5, 0x00099999,
- 0x0C6, 0x000000A3,
- 0x0C7, 0x00088820,
- 0x0C8, 0x00076C06,
- 0x0C9, 0x00000000,
- 0x0CA, 0x00080000,
- 0x0DF, 0x00000180,
- 0x0EF, 0x000001A0,
- 0x051, 0x0006B27D,
- 0xFF0F0400, 0xABCD,
- 0x052, 0x0007E4DD,
- 0xCDCDCDCD, 0xCDCD,
- 0x052, 0x0007E49D,
- 0xFF0F0400, 0xDEAD,
- 0x053, 0x00000073,
- 0x056, 0x00051FF3,
- 0x035, 0x00000086,
- 0x035, 0x00000186,
- 0x035, 0x00000286,
- 0x036, 0x00001C25,
- 0x036, 0x00009C25,
- 0x036, 0x00011C25,
- 0x036, 0x00019C25,
- 0x0B6, 0x00048538,
- 0x018, 0x00000C07,
- 0x05A, 0x0004BD00,
- 0x019, 0x000739D0,
- 0xFF0F0718, 0xABCD,
- 0x034, 0x0000A093,
- 0x034, 0x0000908F,
- 0x034, 0x0000808C,
- 0x034, 0x0000704F,
- 0x034, 0x0000604C,
- 0x034, 0x00005049,
- 0x034, 0x0000400C,
- 0x034, 0x00003009,
- 0x034, 0x00002006,
- 0x034, 0x00001003,
- 0x034, 0x00000000,
- 0xCDCDCDCD, 0xCDCD,
- 0x034, 0x0000ADF3,
- 0x034, 0x00009DF0,
- 0x034, 0x00008DED,
- 0x034, 0x00007DEA,
- 0x034, 0x00006DE7,
- 0x034, 0x000054EE,
- 0x034, 0x000044EB,
- 0x034, 0x000034E8,
- 0x034, 0x0000246B,
- 0x034, 0x00001468,
- 0x034, 0x0000006D,
- 0xFF0F0718, 0xDEAD,
- 0x000, 0x00030159,
- 0x084, 0x00068200,
- 0x086, 0x000000CE,
- 0x087, 0x00048A00,
- 0x08E, 0x00065540,
- 0x08F, 0x00088000,
- 0x0EF, 0x000020A0,
- 0x03B, 0x000F02B0,
- 0x03B, 0x000EF7B0,
- 0x03B, 0x000D4FB0,
- 0x03B, 0x000CF060,
- 0x03B, 0x000B0090,
- 0x03B, 0x000A0080,
- 0x03B, 0x00090080,
- 0x03B, 0x0008F780,
- 0x03B, 0x000722B0,
- 0x03B, 0x0006F7B0,
- 0x03B, 0x00054FB0,
- 0x03B, 0x0004F060,
- 0x03B, 0x00030090,
- 0x03B, 0x00020080,
- 0x03B, 0x00010080,
- 0x03B, 0x0000F780,
- 0x0EF, 0x000000A0,
- 0x000, 0x00010159,
- 0x018, 0x0000F407,
- 0xFFE, 0x00000000,
- 0xFFE, 0x00000000,
- 0x01F, 0x00080003,
- 0xFFE, 0x00000000,
- 0xFFE, 0x00000000,
- 0x01E, 0x00000001,
- 0x01F, 0x00080000,
- 0x000, 0x00033E60,
-
-};
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_RadioA_1T(
- 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_8188E_RadioA_1T)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_RadioA_1T;
- BOOLEAN biol = FALSE;
-#ifdef CONFIG_IOL_IOREG_CFG
- PADAPTER Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame;
- u8 bndy_cnt = 1;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- struct cmd_cmp cmpdata[ArrayLen];
- u4Byte cmpdata_idx=0;
- #endif
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
- HAL_STATUS rst =HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += _interface << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_8188E_RadioA_1T, hex = 0x%X\n", hex));
-#ifdef CONFIG_IOL_IOREG_CFG
- biol = rtw_IOL_applied(Adapter);
-
- if(biol){
- if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
- {
- printk("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
-
- for (i = 0; i < ArrayLen; i += 2 )
- {
- u4Byte v1 = Array[i];
- u4Byte v2 = Array[i+1];
-
- // This (offset, data) pair meets the condition.
- if ( v1 < 0xCDCDCDCD )
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
-
- if(v1 == 0xffe)
- {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfd){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xfc){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
- }
- else if (v1 == 0xfb){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfa){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xf9){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
- }
- else{
- rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
-
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
- }
- continue;
- }
- else
- { // This line is the start line of branch.
- if ( !CheckCondition(Array[i], hex) )
- { // Discard the following (offset, data) pairs.
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; // prevent from for-loop += 2
- }
- else // Configure matched pairs and skip to end of if-else.
- {
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
-
- if(v1 == 0xffe)
- {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfd){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xfc){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
- }
- else if (v1 == 0xfb){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfa){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xf9){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
- }
- else{
- rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
-
- }
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
- }
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- }
- }
- }
-#ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
- if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
- {
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- printk("~~~ %s Success !!! \n",__FUNCTION__);
- {
- u4Byte idx;
- u4Byte cdata;
- printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx);
- printk("### %s data compared !!###\n",__FUNCTION__);
- for(idx=0;idx< cmpdata_idx;idx++)
- {
- cdata = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A,cmpdata[idx].addr,bRFRegOffsetMask);
- if(cdata != cmpdata[idx].value){
- printk("addr:0x%04x, data:(0x%02x : 0x%02x) \n",
- cmpdata[idx].addr,cmpdata[idx].value,cdata);
- rst = HAL_STATUS_FAILURE;
- }
- }
- printk("### %s data compared !!###\n",__FUNCTION__);
- //if(rst == HAL_STATUS_FAILURE)
- {//dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
-
- }
- else{
- rst = HAL_STATUS_FAILURE;
- printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__);
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- {
- //dump data from TX packet buffer
- rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
- }
- #endif //CONFIG_IOL_IOREG_CFG_DBG
- }
- }
-
-
-#endif //#ifdef CONFIG_IOL_IOREG_CFG
- return rst;
-}
-
-/******************************************************************************
-* RadioA_1T_ICUT.TXT
-******************************************************************************/
-
-u4Byte Array_MP_8188E_RadioA_1T_ICUT[] = {
- 0x000, 0x00030000,
- 0x008, 0x00084000,
- 0x018, 0x00000407,
- 0x019, 0x00000012,
- 0x01E, 0x00080009,
- 0x01F, 0x00000880,
- 0x02F, 0x0001A060,
- 0x03F, 0x00000000,
- 0x042, 0x000060C0,
- 0x057, 0x000D0000,
- 0x058, 0x000BE180,
- 0x067, 0x00001552,
- 0x083, 0x00000000,
- 0x0B0, 0x000FF8FC,
- 0x0B1, 0x00054400,
- 0x0B2, 0x000CCC19,
- 0x0B4, 0x00043003,
- 0x0B6, 0x0004953E,
- 0x0B7, 0x0001C718,
- 0x0B8, 0x000060FF,
- 0x0B9, 0x00080001,
- 0x0BA, 0x00040000,
- 0x0BB, 0x00000400,
- 0x0BF, 0x000C0000,
- 0x0C2, 0x00002400,
- 0x0C3, 0x00000009,
- 0x0C4, 0x00040C91,
- 0x0C5, 0x00099999,
- 0x0C6, 0x000000A3,
- 0x0C7, 0x00088820,
- 0x0C8, 0x00076C06,
- 0x0C9, 0x00000000,
- 0x0CA, 0x00080000,
- 0x0DF, 0x00000180,
- 0x0EF, 0x000001A0,
- 0x051, 0x0006B27D,
- 0xFF0F0400, 0xABCD,
- 0x052, 0x0007E4DD,
- 0xCDCDCDCD, 0xCDCD,
- 0x052, 0x0007E49D,
- 0xFF0F0400, 0xDEAD,
- 0x053, 0x00000073,
- 0x056, 0x00051FF3,
- 0x035, 0x00000086,
- 0x035, 0x00000186,
- 0x035, 0x00000286,
- 0x036, 0x00001C25,
- 0x036, 0x00009C25,
- 0x036, 0x00011C25,
- 0x036, 0x00019C25,
- 0x0B6, 0x00048538,
- 0x018, 0x00000C07,
- 0x05A, 0x0004BD00,
- 0x019, 0x000739D0,
- 0x034, 0x0000ADF3,
- 0x034, 0x00009DF0,
- 0x034, 0x00008DED,
- 0x034, 0x00007DEA,
- 0x034, 0x00006DE7,
- 0x034, 0x000054EE,
- 0x034, 0x000044EB,
- 0x034, 0x000034E8,
- 0x034, 0x0000246B,
- 0x034, 0x00001468,
- 0x034, 0x0000006D,
- 0x000, 0x00030159,
- 0x084, 0x00068200,
- 0x086, 0x000000CE,
- 0x087, 0x00048A00,
- 0x08E, 0x00065540,
- 0x08F, 0x00088000,
- 0x0EF, 0x000020A0,
- 0x03B, 0x000F02B0,
- 0x03B, 0x000EF7B0,
- 0x03B, 0x000D4FB0,
- 0x03B, 0x000CF060,
- 0x03B, 0x000B0090,
- 0x03B, 0x000A0080,
- 0x03B, 0x00090080,
- 0x03B, 0x0008F780,
- 0x03B, 0x000722B0,
- 0x03B, 0x0006F7B0,
- 0x03B, 0x00054FB0,
- 0x03B, 0x0004F060,
- 0x03B, 0x00030090,
- 0x03B, 0x00020080,
- 0x03B, 0x00010080,
- 0x03B, 0x0000F780,
- 0x0EF, 0x000000A0,
- 0x000, 0x00010159,
- 0x018, 0x0000F407,
- 0xFFE, 0x00000000,
- 0xFFE, 0x00000000,
- 0x01F, 0x00080003,
- 0xFFE, 0x00000000,
- 0xFFE, 0x00000000,
- 0x01E, 0x00000001,
- 0x01F, 0x00080000,
- 0x000, 0x00033E60,
-
-};
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT(
- 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_8188E_RadioA_1T_ICUT)/sizeof(u4Byte);
- pu4Byte Array = Array_MP_8188E_RadioA_1T_ICUT;
- BOOLEAN biol = FALSE;
-#ifdef CONFIG_IOL_IOREG_CFG
- PADAPTER Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame;
- u8 bndy_cnt = 1;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- struct cmd_cmp cmpdata[ArrayLen];
- u4Byte cmpdata_idx=0;
- #endif
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
- HAL_STATUS rst =HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += _interface << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT, hex = 0x%X\n", hex));
-#ifdef CONFIG_IOL_IOREG_CFG
- biol = rtw_IOL_applied(Adapter);
-
- if(biol){
- if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
- {
- printk("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-#endif//#ifdef CONFIG_IOL_IOREG_CFG
-
- for (i = 0; i < ArrayLen; i += 2 )
- {
- u4Byte v1 = Array[i];
- u4Byte v2 = Array[i+1];
-
- // This (offset, data) pair meets the condition.
- if ( v1 < 0xCDCDCDCD )
- {
- #ifdef CONFIG_IOL_IOREG_CFG
- if(biol){
- if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
-
- if(v1 == 0xffe)
- {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfd){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xfc){
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
- }
- else if (v1 == 0xfb){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
- }
- else if (v1 == 0xfa){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
- }
- else if (v1 == 0xf9){
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
- }
- else{
- rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ;
- #ifdef CONFIG_IOL_IOREG_CFG_DBG
- cmpdata[cmpdata_idx].addr = v1;
- cmpdata[cmpdata_idx].value= v2;
- cmpdata_idx++;
- #endif
- }
-
- }
- else
- #endif //#ifdef CONFIG_IOL_IOREG_CFG
- {
- odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
- }
- continue;
- }
- else
- { // This line is the start line of branch.
- if ( !CheckCondition(Array[i], hex) )
- { // Discard the following (offset, data) pairs.
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; // prevent from for-loop += 2
- }
- else // Configure matched pairs and skip to end of if-else.
- {
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen -2)
- {
- odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < ArrayLen -2)
- {
- READ_NEXT_PAIR(v1, v2, i);
- }
-
- }
- }
- }
- return rst;
-}
-
-/******************************************************************************
-* TxPowerTrack_AP.TXT
-******************************************************************************/
-
-u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_AP_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_AP_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_AP_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_AP_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
-};
-u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_AP_8188E[] = {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11};
-u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_AP_8188E[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9};
-u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_AP_8188E[] = {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11};
-u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_AP_8188E[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_AP_8188E[] = {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_AP_8188E[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_AP_8188E[] = {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_AP_8188E[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9};
-
-void
-ODM_ReadAndConfig_MP_8188E_TxPowerTrack_AP(
- IN PDM_ODM_T pDM_Odm
- )
-{
- PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8188E\n"));
-
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P, gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE*3);
-}
-
-/******************************************************************************
-* TxPowerTrack_PCIE.TXT
-******************************************************************************/
-
-u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_PCIE_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_PCIE_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_PCIE_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_PCIE_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
-};
-u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_PCIE_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};
-u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_PCIE_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};
-u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_PCIE_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};
-u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_PCIE_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};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_PCIE_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};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_PCIE_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};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_PCIE_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};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_PCIE_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};
-
-void
-ODM_ReadAndConfig_MP_8188E_TxPowerTrack_PCIE(
- IN PDM_ODM_T pDM_Odm
- )
-{
- PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8188E\n"));
-
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P, gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE*3);
-}
-
-/******************************************************************************
-* TxPowerTrack_USB.TXT
-******************************************************************************/
-
-u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_USB_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_USB_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_USB_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
- {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
-};
-u1Byte gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_USB_8188E[][DELTA_SWINGIDX_SIZE] = {
- {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
-};
-u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_USB_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};
-u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_USB_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};
-u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_USB_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};
-u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_USB_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};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_USB_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};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_USB_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};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_USB_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};
-u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_USB_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};
-
-void
-ODM_ReadAndConfig_MP_8188E_TxPowerTrack_USB(
- IN PDM_ODM_T pDM_Odm
- )
-{
- PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8188E\n"));
-
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
-
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P, gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE*3);
- ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE*3);
-}
-
-/******************************************************************************
-* TXPWR_LMT.TXT
-******************************************************************************/
-
-pu1Byte Array_MP_8188E_TXPWR_LMT[] = {
- "FCC", "2.4G", "20M", "CCK", "1T", "01", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "01", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "01", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "02", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "02", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "02", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "03", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "03", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "03", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "04", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "04", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "04", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "05", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "05", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "05", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "06", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "06", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "06", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "07", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "07", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "07", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "08", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "08", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "08", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "09", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "09", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "09", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "10", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "10", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "10", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "11", "32",
- "ETSI", "2.4G", "20M", "CCK", "1T", "11", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "11", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "12", "63",
- "ETSI", "2.4G", "20M", "CCK", "1T", "12", "32",
- "MKK", "2.4G", "20M", "CCK", "1T", "12", "32",
- "FCC", "2.4G", "20M", "CCK", "1T", "13", "63",
- "ETSI", "2.4G", "20M", "CCK", "1T", "13", "32",
- "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",
- "FCC", "2.4G", "20M", "OFDM", "1T", "01", "28",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "01", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "01", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "02", "28",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "02", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "02", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "03", "30",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "03", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "03", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "04", "30",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "04", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "04", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "05", "30",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "05", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "05", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "06", "30",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "06", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "06", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "07", "30",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "07", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "07", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "08", "30",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "08", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "08", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "09", "28",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "09", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "09", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "10", "28",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "10", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "10", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "11", "28",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "11", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "11", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "12", "63",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "12", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "12", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "13", "63",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "13", "30",
- "MKK", "2.4G", "20M", "OFDM", "1T", "13", "30",
- "FCC", "2.4G", "20M", "OFDM", "1T", "14", "63",
- "ETSI", "2.4G", "20M", "OFDM", "1T", "14", "63",
- "MKK", "2.4G", "20M", "OFDM", "1T", "14", "63",
- "FCC", "2.4G", "20M", "HT", "1T", "01", "28",
- "ETSI", "2.4G", "20M", "HT", "1T", "01", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "01", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "02", "28",
- "ETSI", "2.4G", "20M", "HT", "1T", "02", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "02", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "03", "30",
- "ETSI", "2.4G", "20M", "HT", "1T", "03", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "03", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "04", "30",
- "ETSI", "2.4G", "20M", "HT", "1T", "04", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "04", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "05", "30",
- "ETSI", "2.4G", "20M", "HT", "1T", "05", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "05", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "06", "30",
- "ETSI", "2.4G", "20M", "HT", "1T", "06", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "06", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "07", "30",
- "ETSI", "2.4G", "20M", "HT", "1T", "07", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "07", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "08", "30",
- "ETSI", "2.4G", "20M", "HT", "1T", "08", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "08", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "09", "28",
- "ETSI", "2.4G", "20M", "HT", "1T", "09", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "09", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "10", "28",
- "ETSI", "2.4G", "20M", "HT", "1T", "10", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "10", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "11", "28",
- "ETSI", "2.4G", "20M", "HT", "1T", "11", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "11", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "12", "63",
- "ETSI", "2.4G", "20M", "HT", "1T", "12", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "12", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "13", "63",
- "ETSI", "2.4G", "20M", "HT", "1T", "13", "30",
- "MKK", "2.4G", "20M", "HT", "1T", "13", "30",
- "FCC", "2.4G", "20M", "HT", "1T", "14", "63",
- "ETSI", "2.4G", "20M", "HT", "1T", "14", "63",
- "MKK", "2.4G", "20M", "HT", "1T", "14", "63",
- "FCC", "2.4G", "20M", "HT", "2T", "01", "28",
- "ETSI", "2.4G", "20M", "HT", "2T", "01", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "01", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "02", "28",
- "ETSI", "2.4G", "20M", "HT", "2T", "02", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "02", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "03", "30",
- "ETSI", "2.4G", "20M", "HT", "2T", "03", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "03", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "04", "30",
- "ETSI", "2.4G", "20M", "HT", "2T", "04", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "04", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "05", "30",
- "ETSI", "2.4G", "20M", "HT", "2T", "05", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "05", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "06", "30",
- "ETSI", "2.4G", "20M", "HT", "2T", "06", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "06", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "07", "30",
- "ETSI", "2.4G", "20M", "HT", "2T", "07", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "07", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "08", "30",
- "ETSI", "2.4G", "20M", "HT", "2T", "08", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "08", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "09", "28",
- "ETSI", "2.4G", "20M", "HT", "2T", "09", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "09", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "10", "28",
- "ETSI", "2.4G", "20M", "HT", "2T", "10", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "10", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "11", "28",
- "ETSI", "2.4G", "20M", "HT", "2T", "11", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "11", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "12", "63",
- "ETSI", "2.4G", "20M", "HT", "2T", "12", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "12", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "13", "63",
- "ETSI", "2.4G", "20M", "HT", "2T", "13", "30",
- "MKK", "2.4G", "20M", "HT", "2T", "13", "30",
- "FCC", "2.4G", "20M", "HT", "2T", "14", "63",
- "ETSI", "2.4G", "20M", "HT", "2T", "14", "63",
- "MKK", "2.4G", "20M", "HT", "2T", "14", "63",
- "FCC", "2.4G", "40M", "HT", "1T", "01", "63",
- "ETSI", "2.4G", "40M", "HT", "1T", "01", "63",
- "MKK", "2.4G", "40M", "HT", "1T", "01", "63",
- "FCC", "2.4G", "40M", "HT", "1T", "02", "63",
- "ETSI", "2.4G", "40M", "HT", "1T", "02", "63",
- "MKK", "2.4G", "40M", "HT", "1T", "02", "63",
- "FCC", "2.4G", "40M", "HT", "1T", "03", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "03", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "03", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "04", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "04", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "04", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "05", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "05", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "05", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "06", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "06", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "06", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "07", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "07", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "07", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "08", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "08", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "08", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "09", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "09", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "09", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "10", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "10", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "10", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "11", "26",
- "ETSI", "2.4G", "40M", "HT", "1T", "11", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "11", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "12", "63",
- "ETSI", "2.4G", "40M", "HT", "1T", "12", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "12", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "13", "63",
- "ETSI", "2.4G", "40M", "HT", "1T", "13", "26",
- "MKK", "2.4G", "40M", "HT", "1T", "13", "26",
- "FCC", "2.4G", "40M", "HT", "1T", "14", "63",
- "ETSI", "2.4G", "40M", "HT", "1T", "14", "63",
- "MKK", "2.4G", "40M", "HT", "1T", "14", "63",
- "FCC", "2.4G", "40M", "HT", "2T", "01", "63",
- "ETSI", "2.4G", "40M", "HT", "2T", "01", "63",
- "MKK", "2.4G", "40M", "HT", "2T", "01", "63",
- "FCC", "2.4G", "40M", "HT", "2T", "02", "63",
- "ETSI", "2.4G", "40M", "HT", "2T", "02", "63",
- "MKK", "2.4G", "40M", "HT", "2T", "02", "63",
- "FCC", "2.4G", "40M", "HT", "2T", "03", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "03", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "03", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "04", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "04", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "04", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "05", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "05", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "05", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "06", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "06", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "06", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "07", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "07", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "07", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "08", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "08", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "08", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "09", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "09", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "09", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "10", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "10", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "10", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "11", "26",
- "ETSI", "2.4G", "40M", "HT", "2T", "11", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "11", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "12", "63",
- "ETSI", "2.4G", "40M", "HT", "2T", "12", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "12", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "13", "63",
- "ETSI", "2.4G", "40M", "HT", "2T", "13", "26",
- "MKK", "2.4G", "40M", "HT", "2T", "13", "26",
- "FCC", "2.4G", "40M", "HT", "2T", "14", "63",
- "ETSI", "2.4G", "40M", "HT", "2T", "14", "63",
- "MKK", "2.4G", "40M", "HT", "2T", "14", "63",
- "FCC", "5G", "20M", "OFDM", "1T", "36", "30",
- "ETSI", "5G", "20M", "OFDM", "1T", "36", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "36", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "40", "30",
- "ETSI", "5G", "20M", "OFDM", "1T", "40", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "40", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "44", "30",
- "ETSI", "5G", "20M", "OFDM", "1T", "44", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "44", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "48", "30",
- "ETSI", "5G", "20M", "OFDM", "1T", "48", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "48", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "52", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "52", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "52", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "56", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "56", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "56", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "60", "32",
- "ETSI", "5G", "20M", "OFDM", "1T", "60", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "60", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "64", "28",
- "ETSI", "5G", "20M", "OFDM", "1T", "64", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "64", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "100", "30",
- "ETSI", "5G", "20M", "OFDM", "1T", "100", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "100", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "114", "30",
- "ETSI", "5G", "20M", "OFDM", "1T", "114", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "114", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "108", "32",
- "ETSI", "5G", "20M", "OFDM", "1T", "108", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "108", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "112", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "112", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "112", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "116", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "116", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "116", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "120", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "120", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "120", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "124", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "124", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "124", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "128", "32",
- "ETSI", "5G", "20M", "OFDM", "1T", "128", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "128", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "132", "30",
- "ETSI", "5G", "20M", "OFDM", "1T", "132", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "132", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "136", "30",
- "ETSI", "5G", "20M", "OFDM", "1T", "136", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "136", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "140", "28",
- "ETSI", "5G", "20M", "OFDM", "1T", "140", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "140", "32",
- "FCC", "5G", "20M", "OFDM", "1T", "149", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "149", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "149", "63",
- "FCC", "5G", "20M", "OFDM", "1T", "153", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "153", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "153", "63",
- "FCC", "5G", "20M", "OFDM", "1T", "157", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "157", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "157", "63",
- "FCC", "5G", "20M", "OFDM", "1T", "161", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "161", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "161", "63",
- "FCC", "5G", "20M", "OFDM", "1T", "165", "34",
- "ETSI", "5G", "20M", "OFDM", "1T", "165", "32",
- "MKK", "5G", "20M", "OFDM", "1T", "165", "63",
- "FCC", "5G", "20M", "HT", "1T", "36", "30",
- "ETSI", "5G", "20M", "HT", "1T", "36", "32",
- "MKK", "5G", "20M", "HT", "1T", "36", "32",
- "FCC", "5G", "20M", "HT", "1T", "40", "30",
- "ETSI", "5G", "20M", "HT", "1T", "40", "32",
- "MKK", "5G", "20M", "HT", "1T", "40", "32",
- "FCC", "5G", "20M", "HT", "1T", "44", "30",
- "ETSI", "5G", "20M", "HT", "1T", "44", "32",
- "MKK", "5G", "20M", "HT", "1T", "44", "32",
- "FCC", "5G", "20M", "HT", "1T", "48", "30",
- "ETSI", "5G", "20M", "HT", "1T", "48", "32",
- "MKK", "5G", "20M", "HT", "1T", "48", "32",
- "FCC", "5G", "20M", "HT", "1T", "52", "34",
- "ETSI", "5G", "20M", "HT", "1T", "52", "32",
- "MKK", "5G", "20M", "HT", "1T", "52", "32",
- "FCC", "5G", "20M", "HT", "1T", "56", "34",
- "ETSI", "5G", "20M", "HT", "1T", "56", "32",
- "MKK", "5G", "20M", "HT", "1T", "56", "32",
- "FCC", "5G", "20M", "HT", "1T", "60", "32",
- "ETSI", "5G", "20M", "HT", "1T", "60", "32",
- "MKK", "5G", "20M", "HT", "1T", "60", "32",
- "FCC", "5G", "20M", "HT", "1T", "64", "28",
- "ETSI", "5G", "20M", "HT", "1T", "64", "32",
- "MKK", "5G", "20M", "HT", "1T", "64", "32",
- "FCC", "5G", "20M", "HT", "1T", "100", "30",
- "ETSI", "5G", "20M", "HT", "1T", "100", "32",
- "MKK", "5G", "20M", "HT", "1T", "100", "32",
- "FCC", "5G", "20M", "HT", "1T", "114", "30",
- "ETSI", "5G", "20M", "HT", "1T", "114", "32",
- "MKK", "5G", "20M", "HT", "1T", "114", "32",
- "FCC", "5G", "20M", "HT", "1T", "108", "32",
- "ETSI", "5G", "20M", "HT", "1T", "108", "32",
- "MKK", "5G", "20M", "HT", "1T", "108", "32",
- "FCC", "5G", "20M", "HT", "1T", "112", "34",
- "ETSI", "5G", "20M", "HT", "1T", "112", "32",
- "MKK", "5G", "20M", "HT", "1T", "112", "32",
- "FCC", "5G", "20M", "HT", "1T", "116", "34",
- "ETSI", "5G", "20M", "HT", "1T", "116", "32",
- "MKK", "5G", "20M", "HT", "1T", "116", "32",
- "FCC", "5G", "20M", "HT", "1T", "120", "34",
- "ETSI", "5G", "20M", "HT", "1T", "120", "32",
- "MKK", "5G", "20M", "HT", "1T", "120", "32",
- "FCC", "5G", "20M", "HT", "1T", "124", "34",
- "ETSI", "5G", "20M", "HT", "1T", "124", "32",
- "MKK", "5G", "20M", "HT", "1T", "124", "32",
- "FCC", "5G", "20M", "HT", "1T", "128", "32",
- "ETSI", "5G", "20M", "HT", "1T", "128", "32",
- "MKK", "5G", "20M", "HT", "1T", "128", "32",
- "FCC", "5G", "20M", "HT", "1T", "132", "30",
- "ETSI", "5G", "20M", "HT", "1T", "132", "32",
- "MKK", "5G", "20M", "HT", "1T", "132", "32",
- "FCC", "5G", "20M", "HT", "1T", "136", "30",
- "ETSI", "5G", "20M", "HT", "1T", "136", "32",
- "MKK", "5G", "20M", "HT", "1T", "136", "32",
- "FCC", "5G", "20M", "HT", "1T", "140", "28",
- "ETSI", "5G", "20M", "HT", "1T", "140", "32",
- "MKK", "5G", "20M", "HT", "1T", "140", "32",
- "FCC", "5G", "20M", "HT", "1T", "149", "34",
- "ETSI", "5G", "20M", "HT", "1T", "149", "32",
- "MKK", "5G", "20M", "HT", "1T", "149", "63",
- "FCC", "5G", "20M", "HT", "1T", "153", "34",
- "ETSI", "5G", "20M", "HT", "1T", "153", "32",
- "MKK", "5G", "20M", "HT", "1T", "153", "63",
- "FCC", "5G", "20M", "HT", "1T", "157", "34",
- "ETSI", "5G", "20M", "HT", "1T", "157", "32",
- "MKK", "5G", "20M", "HT", "1T", "157", "63",
- "FCC", "5G", "20M", "HT", "1T", "161", "34",
- "ETSI", "5G", "20M", "HT", "1T", "161", "32",
- "MKK", "5G", "20M", "HT", "1T", "161", "63",
- "FCC", "5G", "20M", "HT", "1T", "165", "34",
- "ETSI", "5G", "20M", "HT", "1T", "165", "32",
- "MKK", "5G", "20M", "HT", "1T", "165", "63",
- "FCC", "5G", "20M", "HT", "2T", "36", "28",
- "ETSI", "5G", "20M", "HT", "2T", "36", "30",
- "MKK", "5G", "20M", "HT", "2T", "36", "30",
- "FCC", "5G", "20M", "HT", "2T", "40", "28",
- "ETSI", "5G", "20M", "HT", "2T", "40", "30",
- "MKK", "5G", "20M", "HT", "2T", "40", "30",
- "FCC", "5G", "20M", "HT", "2T", "44", "28",
- "ETSI", "5G", "20M", "HT", "2T", "44", "30",
- "MKK", "5G", "20M", "HT", "2T", "44", "30",
- "FCC", "5G", "20M", "HT", "2T", "48", "28",
- "ETSI", "5G", "20M", "HT", "2T", "48", "30",
- "MKK", "5G", "20M", "HT", "2T", "48", "30",
- "FCC", "5G", "20M", "HT", "2T", "52", "34",
- "ETSI", "5G", "20M", "HT", "2T", "52", "30",
- "MKK", "5G", "20M", "HT", "2T", "52", "30",
- "FCC", "5G", "20M", "HT", "2T", "56", "32",
- "ETSI", "5G", "20M", "HT", "2T", "56", "30",
- "MKK", "5G", "20M", "HT", "2T", "56", "30",
- "FCC", "5G", "20M", "HT", "2T", "60", "30",
- "ETSI", "5G", "20M", "HT", "2T", "60", "30",
- "MKK", "5G", "20M", "HT", "2T", "60", "30",
- "FCC", "5G", "20M", "HT", "2T", "64", "26",
- "ETSI", "5G", "20M", "HT", "2T", "64", "30",
- "MKK", "5G", "20M", "HT", "2T", "64", "30",
- "FCC", "5G", "20M", "HT", "2T", "100", "28",
- "ETSI", "5G", "20M", "HT", "2T", "100", "30",
- "MKK", "5G", "20M", "HT", "2T", "100", "30",
- "FCC", "5G", "20M", "HT", "2T", "114", "28",
- "ETSI", "5G", "20M", "HT", "2T", "114", "30",
- "MKK", "5G", "20M", "HT", "2T", "114", "30",
- "FCC", "5G", "20M", "HT", "2T", "108", "30",
- "ETSI", "5G", "20M", "HT", "2T", "108", "30",
- "MKK", "5G", "20M", "HT", "2T", "108", "30",
- "FCC", "5G", "20M", "HT", "2T", "112", "32",
- "ETSI", "5G", "20M", "HT", "2T", "112", "30",
- "MKK", "5G", "20M", "HT", "2T", "112", "30",
- "FCC", "5G", "20M", "HT", "2T", "116", "32",
- "ETSI", "5G", "20M", "HT", "2T", "116", "30",
- "MKK", "5G", "20M", "HT", "2T", "116", "30",
- "FCC", "5G", "20M", "HT", "2T", "120", "34",
- "ETSI", "5G", "20M", "HT", "2T", "120", "30",
- "MKK", "5G", "20M", "HT", "2T", "120", "30",
- "FCC", "5G", "20M", "HT", "2T", "124", "32",
- "ETSI", "5G", "20M", "HT", "2T", "124", "30",
- "MKK", "5G", "20M", "HT", "2T", "124", "30",
- "FCC", "5G", "20M", "HT", "2T", "128", "30",
- "ETSI", "5G", "20M", "HT", "2T", "128", "30",
- "MKK", "5G", "20M", "HT", "2T", "128", "30",
- "FCC", "5G", "20M", "HT", "2T", "132", "28",
- "ETSI", "5G", "20M", "HT", "2T", "132", "30",
- "MKK", "5G", "20M", "HT", "2T", "132", "30",
- "FCC", "5G", "20M", "HT", "2T", "136", "28",
- "ETSI", "5G", "20M", "HT", "2T", "136", "30",
- "MKK", "5G", "20M", "HT", "2T", "136", "30",
- "FCC", "5G", "20M", "HT", "2T", "140", "26",
- "ETSI", "5G", "20M", "HT", "2T", "140", "30",
- "MKK", "5G", "20M", "HT", "2T", "140", "30",
- "FCC", "5G", "20M", "HT", "2T", "149", "34",
- "ETSI", "5G", "20M", "HT", "2T", "149", "30",
- "MKK", "5G", "20M", "HT", "2T", "149", "63",
- "FCC", "5G", "20M", "HT", "2T", "153", "34",
- "ETSI", "5G", "20M", "HT", "2T", "153", "30",
- "MKK", "5G", "20M", "HT", "2T", "153", "63",
- "FCC", "5G", "20M", "HT", "2T", "157", "34",
- "ETSI", "5G", "20M", "HT", "2T", "157", "30",
- "MKK", "5G", "20M", "HT", "2T", "157", "63",
- "FCC", "5G", "20M", "HT", "2T", "161", "34",
- "ETSI", "5G", "20M", "HT", "2T", "161", "30",
- "MKK", "5G", "20M", "HT", "2T", "161", "63",
- "FCC", "5G", "20M", "HT", "2T", "165", "34",
- "ETSI", "5G", "20M", "HT", "2T", "165", "30",
- "MKK", "5G", "20M", "HT", "2T", "165", "63",
- "FCC", "5G", "40M", "HT", "1T", "38", "30",
- "ETSI", "5G", "40M", "HT", "1T", "38", "32",
- "MKK", "5G", "40M", "HT", "1T", "38", "32",
- "FCC", "5G", "40M", "HT", "1T", "46", "30",
- "ETSI", "5G", "40M", "HT", "1T", "46", "32",
- "MKK", "5G", "40M", "HT", "1T", "46", "32",
- "FCC", "5G", "40M", "HT", "1T", "54", "32",
- "ETSI", "5G", "40M", "HT", "1T", "54", "32",
- "MKK", "5G", "40M", "HT", "1T", "54", "32",
- "FCC", "5G", "40M", "HT", "1T", "62", "32",
- "ETSI", "5G", "40M", "HT", "1T", "62", "32",
- "MKK", "5G", "40M", "HT", "1T", "62", "32",
- "FCC", "5G", "40M", "HT", "1T", "102", "28",
- "ETSI", "5G", "40M", "HT", "1T", "102", "32",
- "MKK", "5G", "40M", "HT", "1T", "102", "32",
- "FCC", "5G", "40M", "HT", "1T", "110", "32",
- "ETSI", "5G", "40M", "HT", "1T", "110", "32",
- "MKK", "5G", "40M", "HT", "1T", "110", "32",
- "FCC", "5G", "40M", "HT", "1T", "118", "34",
- "ETSI", "5G", "40M", "HT", "1T", "118", "32",
- "MKK", "5G", "40M", "HT", "1T", "118", "32",
- "FCC", "5G", "40M", "HT", "1T", "126", "34",
- "ETSI", "5G", "40M", "HT", "1T", "126", "32",
- "MKK", "5G", "40M", "HT", "1T", "126", "32",
- "FCC", "5G", "40M", "HT", "1T", "134", "32",
- "ETSI", "5G", "40M", "HT", "1T", "134", "32",
- "MKK", "5G", "40M", "HT", "1T", "134", "32",
- "FCC", "5G", "40M", "HT", "1T", "151", "34",
- "ETSI", "5G", "40M", "HT", "1T", "151", "32",
- "MKK", "5G", "40M", "HT", "1T", "151", "63",
- "FCC", "5G", "40M", "HT", "1T", "159", "34",
- "ETSI", "5G", "40M", "HT", "1T", "159", "32",
- "MKK", "5G", "40M", "HT", "1T", "159", "63",
- "FCC", "5G", "40M", "HT", "2T", "38", "28",
- "ETSI", "5G", "40M", "HT", "2T", "38", "30",
- "MKK", "5G", "40M", "HT", "2T", "38", "30",
- "FCC", "5G", "40M", "HT", "2T", "46", "28",
- "ETSI", "5G", "40M", "HT", "2T", "46", "30",
- "MKK", "5G", "40M", "HT", "2T", "46", "30",
- "FCC", "5G", "40M", "HT", "2T", "54", "30",
- "ETSI", "5G", "40M", "HT", "2T", "54", "30",
- "MKK", "5G", "40M", "HT", "2T", "54", "30",
- "FCC", "5G", "40M", "HT", "2T", "62", "30",
- "ETSI", "5G", "40M", "HT", "2T", "62", "30",
- "MKK", "5G", "40M", "HT", "2T", "62", "30",
- "FCC", "5G", "40M", "HT", "2T", "102", "26",
- "ETSI", "5G", "40M", "HT", "2T", "102", "30",
- "MKK", "5G", "40M", "HT", "2T", "102", "30",
- "FCC", "5G", "40M", "HT", "2T", "110", "30",
- "ETSI", "5G", "40M", "HT", "2T", "110", "30",
- "MKK", "5G", "40M", "HT", "2T", "110", "30",
- "FCC", "5G", "40M", "HT", "2T", "118", "34",
- "ETSI", "5G", "40M", "HT", "2T", "118", "30",
- "MKK", "5G", "40M", "HT", "2T", "118", "30",
- "FCC", "5G", "40M", "HT", "2T", "126", "32",
- "ETSI", "5G", "40M", "HT", "2T", "126", "30",
- "MKK", "5G", "40M", "HT", "2T", "126", "30",
- "FCC", "5G", "40M", "HT", "2T", "134", "30",
- "ETSI", "5G", "40M", "HT", "2T", "134", "30",
- "MKK", "5G", "40M", "HT", "2T", "134", "30",
- "FCC", "5G", "40M", "HT", "2T", "151", "34",
- "ETSI", "5G", "40M", "HT", "2T", "151", "30",
- "MKK", "5G", "40M", "HT", "2T", "151", "63",
- "FCC", "5G", "40M", "HT", "2T", "159", "34",
- "ETSI", "5G", "40M", "HT", "2T", "159", "30",
- "MKK", "5G", "40M", "HT", "2T", "159", "63",
- "FCC", "5G", "80M", "VHT", "1T", "42", "30",
- "ETSI", "5G", "80M", "VHT", "1T", "42", "32",
- "MKK", "5G", "80M", "VHT", "1T", "42", "32",
- "FCC", "5G", "80M", "VHT", "1T", "58", "28",
- "ETSI", "5G", "80M", "VHT", "1T", "58", "32",
- "MKK", "5G", "80M", "VHT", "1T", "58", "32",
- "FCC", "5G", "80M", "VHT", "1T", "106", "30",
- "ETSI", "5G", "80M", "VHT", "1T", "106", "32",
- "MKK", "5G", "80M", "VHT", "1T", "106", "32",
- "FCC", "5G", "80M", "VHT", "1T", "122", "34",
- "ETSI", "5G", "80M", "VHT", "1T", "122", "32",
- "MKK", "5G", "80M", "VHT", "1T", "122", "32",
- "FCC", "5G", "80M", "VHT", "1T", "155", "34",
- "ETSI", "5G", "80M", "VHT", "1T", "155", "32",
- "MKK", "5G", "80M", "VHT", "1T", "155", "63",
- "FCC", "5G", "80M", "VHT", "2T", "42", "28",
- "ETSI", "5G", "80M", "VHT", "2T", "42", "30",
- "MKK", "5G", "80M", "VHT", "2T", "42", "30",
- "FCC", "5G", "80M", "VHT", "2T", "58", "26",
- "ETSI", "5G", "80M", "VHT", "2T", "58", "30",
- "MKK", "5G", "80M", "VHT", "2T", "58", "30",
- "FCC", "5G", "80M", "VHT", "2T", "106", "28",
- "ETSI", "5G", "80M", "VHT", "2T", "106", "30",
- "MKK", "5G", "80M", "VHT", "2T", "106", "30",
- "FCC", "5G", "80M", "VHT", "2T", "122", "32",
- "ETSI", "5G", "80M", "VHT", "2T", "122", "30",
- "MKK", "5G", "80M", "VHT", "2T", "122", "30",
- "FCC", "5G", "80M", "VHT", "2T", "155", "34",
- "ETSI", "5G", "80M", "VHT", "2T", "155", "30",
- "MKK", "5G", "80M", "VHT", "2T", "155", "63"
-};
-
-void
-ODM_ReadAndConfig_MP_8188E_TXPWR_LMT(
- IN PDM_ODM_T pDM_Odm
- )
-{
- u4Byte i = 0;
- u4Byte ArrayLen = sizeof(Array_MP_8188E_TXPWR_LMT)/sizeof(pu1Byte);
- pu1Byte *Array = Array_MP_8188E_TXPWR_LMT;
-
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_TXPWR_LMT\n"));
-
- for (i = 0; i < ArrayLen; i += 7 )
- {
- pu1Byte regulation = Array[i];
- pu1Byte band = Array[i+1];
- pu1Byte bandwidth = Array[i+2];
- pu1Byte rate = Array[i+3];
- pu1Byte rfPath = Array[i+4];
- pu1Byte chnl = Array[i+5];
- pu1Byte val = Array[i+6];
-
- odm_ConfigBB_TXPWR_LMT_8188E(pDM_Odm, regulation, band, bandwidth, rate, rfPath, chnl, val);
- }
-
-}
-
-#endif // end of HWIMG_SUPPORT
-
+/******************************************************************************
+*
+* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+* more details.
+*
+* You should have received a copy of the GNU General Public License along with
+* this program; if not, write to the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+*
+*
+******************************************************************************/
+
+
+#include "../odm_precomp.h"
+
+#ifdef CONFIG_IOL_IOREG_CFG
+#include <rtw_iol.h>
+#endif
+
+#if (RTL8188E_SUPPORT == 1)
+static BOOLEAN
+CheckCondition(
+ const u4Byte Condition,
+ const u4Byte Hex
+ )
+{
+ u4Byte _board = (Hex & 0x000000FF);
+ u4Byte _interface = (Hex & 0x0000FF00) >> 8;
+ u4Byte _platform = (Hex & 0x00FF0000) >> 16;
+ u4Byte cond = Condition;
+
+ if ( Condition == 0xCDCDCDCD )
+ return TRUE;
+
+ cond = Condition & 0x000000FF;
+ if ( (_board != cond) && (cond != 0xFF) )
+ return FALSE;
+
+ cond = Condition & 0x0000FF00;
+ cond = cond >> 8;
+ if ( ((_interface & cond) == 0) && (cond != 0x07) )
+ return FALSE;
+
+ cond = Condition & 0x00FF0000;
+ cond = cond >> 16;
+ if ( ((_platform & cond) == 0) && (cond != 0x0F) )
+ return FALSE;
+ return TRUE;
+}
+
+
+/******************************************************************************
+* RadioA_1T.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_RadioA_1T[] = {
+ 0x000, 0x00030000,
+ 0x008, 0x00084000,
+ 0x018, 0x00000407,
+ 0x019, 0x00000012,
+ 0x01E, 0x00080009,
+ 0x01F, 0x00000880,
+ 0x02F, 0x0001A060,
+ 0x03F, 0x00000000,
+ 0x042, 0x000060C0,
+ 0x057, 0x000D0000,
+ 0x058, 0x000BE180,
+ 0x067, 0x00001552,
+ 0x083, 0x00000000,
+ 0x0B0, 0x000FF8FC,
+ 0x0B1, 0x00054400,
+ 0x0B2, 0x000CCC19,
+ 0x0B4, 0x00043003,
+ 0x0B6, 0x0004953E,
+ 0x0B7, 0x0001C718,
+ 0x0B8, 0x000060FF,
+ 0x0B9, 0x00080001,
+ 0x0BA, 0x00040000,
+ 0x0BB, 0x00000400,
+ 0x0BF, 0x000C0000,
+ 0x0C2, 0x00002400,
+ 0x0C3, 0x00000009,
+ 0x0C4, 0x00040C91,
+ 0x0C5, 0x00099999,
+ 0x0C6, 0x000000A3,
+ 0x0C7, 0x00088820,
+ 0x0C8, 0x00076C06,
+ 0x0C9, 0x00000000,
+ 0x0CA, 0x00080000,
+ 0x0DF, 0x00000180,
+ 0x0EF, 0x000001A0,
+ 0x051, 0x0006B27D,
+ 0xFF0F0400, 0xABCD,
+ 0x052, 0x0007E4DD,
+ 0xCDCDCDCD, 0xCDCD,
+ 0x052, 0x0007E49D,
+ 0xFF0F0400, 0xDEAD,
+ 0x053, 0x00000073,
+ 0x056, 0x00051FF3,
+ 0x035, 0x00000086,
+ 0x035, 0x00000186,
+ 0x035, 0x00000286,
+ 0x036, 0x00001C25,
+ 0x036, 0x00009C25,
+ 0x036, 0x00011C25,
+ 0x036, 0x00019C25,
+ 0x0B6, 0x00048538,
+ 0x018, 0x00000C07,
+ 0x05A, 0x0004BD00,
+ 0x019, 0x000739D0,
+ 0xFF0F0718, 0xABCD,
+ 0x034, 0x0000A093,
+ 0x034, 0x0000908F,
+ 0x034, 0x0000808C,
+ 0x034, 0x0000704F,
+ 0x034, 0x0000604C,
+ 0x034, 0x00005049,
+ 0x034, 0x0000400C,
+ 0x034, 0x00003009,
+ 0x034, 0x00002006,
+ 0x034, 0x00001003,
+ 0x034, 0x00000000,
+ 0xCDCDCDCD, 0xCDCD,
+ 0x034, 0x0000ADF3,
+ 0x034, 0x00009DF0,
+ 0x034, 0x00008DED,
+ 0x034, 0x00007DEA,
+ 0x034, 0x00006DE7,
+ 0x034, 0x000054EE,
+ 0x034, 0x000044EB,
+ 0x034, 0x000034E8,
+ 0x034, 0x0000246B,
+ 0x034, 0x00001468,
+ 0x034, 0x0000006D,
+ 0xFF0F0718, 0xDEAD,
+ 0x000, 0x00030159,
+ 0x084, 0x00068200,
+ 0x086, 0x000000CE,
+ 0x087, 0x00048A00,
+ 0x08E, 0x00065540,
+ 0x08F, 0x00088000,
+ 0x0EF, 0x000020A0,
+ 0x03B, 0x000F02B0,
+ 0x03B, 0x000EF7B0,
+ 0x03B, 0x000D4FB0,
+ 0x03B, 0x000CF060,
+ 0x03B, 0x000B0090,
+ 0x03B, 0x000A0080,
+ 0x03B, 0x00090080,
+ 0x03B, 0x0008F780,
+ 0x03B, 0x000722B0,
+ 0x03B, 0x0006F7B0,
+ 0x03B, 0x00054FB0,
+ 0x03B, 0x0004F060,
+ 0x03B, 0x00030090,
+ 0x03B, 0x00020080,
+ 0x03B, 0x00010080,
+ 0x03B, 0x0000F780,
+ 0x0EF, 0x000000A0,
+ 0x000, 0x00010159,
+ 0x018, 0x0000F407,
+ 0xFFE, 0x00000000,
+ 0xFFE, 0x00000000,
+ 0x01F, 0x00080003,
+ 0xFFE, 0x00000000,
+ 0xFFE, 0x00000000,
+ 0x01E, 0x00000001,
+ 0x01F, 0x00080000,
+ 0x000, 0x00033E60,
+
+};
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_RadioA_1T(
+ 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_8188E_RadioA_1T)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_RadioA_1T;
+ BOOLEAN biol = FALSE;
+#ifdef CONFIG_IOL_IOREG_CFG
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ struct xmit_frame *pxmit_frame;
+ u8 bndy_cnt = 1;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ struct cmd_cmp cmpdata[ArrayLen];
+ u4Byte cmpdata_idx=0;
+ #endif
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+ HAL_STATUS rst =HAL_STATUS_SUCCESS;
+
+ hex += board;
+ hex += _interface << 8;
+ hex += platform << 16;
+ hex += 0xFF000000;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_8188E_RadioA_1T, hex = 0x%X\n", hex));
+#ifdef CONFIG_IOL_IOREG_CFG
+ biol = rtw_IOL_applied(Adapter);
+
+ if(biol){
+ if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
+ {
+ printk("rtw_IOL_accquire_xmit_frame failed\n");
+ return HAL_STATUS_FAILURE;
+ }
+ }
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+
+ for (i = 0; i < ArrayLen; i += 2 )
+ {
+ u4Byte v1 = Array[i];
+ u4Byte v2 = Array[i+1];
+
+ // This (offset, data) pair meets the condition.
+ if ( v1 < 0xCDCDCDCD )
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+
+ if(v1 == 0xffe)
+ {
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfd){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xfc){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
+ }
+ else if (v1 == 0xfb){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfa){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xf9){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
+ }
+ else{
+ rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
+ }
+ continue;
+ }
+ else
+ { // This line is the start line of branch.
+ if ( !CheckCondition(Array[i], hex) )
+ { // Discard the following (offset, data) pairs.
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+ i -= 2; // prevent from for-loop += 2
+ }
+ else // Configure matched pairs and skip to end of if-else.
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+
+ if(v1 == 0xffe)
+ {
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfd){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xfc){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
+ }
+ else if (v1 == 0xfb){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfa){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xf9){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
+ }
+ else{
+ rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+
+ }
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
+ }
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ while (v2 != 0xDEAD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ }
+ }
+ }
+#ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt);
+ if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt))
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ printk("~~~ %s Success !!! \n",__FUNCTION__);
+ {
+ u4Byte idx;
+ u4Byte cdata;
+ printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx);
+ printk("### %s data compared !!###\n",__FUNCTION__);
+ for(idx=0;idx< cmpdata_idx;idx++)
+ {
+ cdata = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A,cmpdata[idx].addr,bRFRegOffsetMask);
+ if(cdata != cmpdata[idx].value){
+ printk("addr:0x%04x, data:(0x%02x : 0x%02x) \n",
+ cmpdata[idx].addr,cmpdata[idx].value,cdata);
+ rst = HAL_STATUS_FAILURE;
+ }
+ }
+ printk("### %s data compared !!###\n",__FUNCTION__);
+ //if(rst == HAL_STATUS_FAILURE)
+ {//dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+
+ }
+ else{
+ rst = HAL_STATUS_FAILURE;
+ printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__);
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ {
+ //dump data from TX packet buffer
+ rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32);
+ }
+ #endif //CONFIG_IOL_IOREG_CFG_DBG
+ }
+ }
+
+
+#endif //#ifdef CONFIG_IOL_IOREG_CFG
+ return rst;
+}
+
+/******************************************************************************
+* RadioA_1T_ICUT.TXT
+******************************************************************************/
+
+u4Byte Array_MP_8188E_RadioA_1T_ICUT[] = {
+ 0x000, 0x00030000,
+ 0x008, 0x00084000,
+ 0x018, 0x00000407,
+ 0x019, 0x00000012,
+ 0x01E, 0x00080009,
+ 0x01F, 0x00000880,
+ 0x02F, 0x0001A060,
+ 0x03F, 0x00000000,
+ 0x042, 0x000060C0,
+ 0x057, 0x000D0000,
+ 0x058, 0x000BE180,
+ 0x067, 0x00001552,
+ 0x083, 0x00000000,
+ 0x0B0, 0x000FF8FC,
+ 0x0B1, 0x00054400,
+ 0x0B2, 0x000CCC19,
+ 0x0B4, 0x00043003,
+ 0x0B6, 0x0004953E,
+ 0x0B7, 0x0001C718,
+ 0x0B8, 0x000060FF,
+ 0x0B9, 0x00080001,
+ 0x0BA, 0x00040000,
+ 0x0BB, 0x00000400,
+ 0x0BF, 0x000C0000,
+ 0x0C2, 0x00002400,
+ 0x0C3, 0x00000009,
+ 0x0C4, 0x00040C91,
+ 0x0C5, 0x00099999,
+ 0x0C6, 0x000000A3,
+ 0x0C7, 0x00088820,
+ 0x0C8, 0x00076C06,
+ 0x0C9, 0x00000000,
+ 0x0CA, 0x00080000,
+ 0x0DF, 0x00000180,
+ 0x0EF, 0x000001A0,
+ 0x051, 0x0006B27D,
+ 0xFF0F0400, 0xABCD,
+ 0x052, 0x0007E4DD,
+ 0xCDCDCDCD, 0xCDCD,
+ 0x052, 0x0007E49D,
+ 0xFF0F0400, 0xDEAD,
+ 0x053, 0x00000073,
+ 0x056, 0x00051FF3,
+ 0x035, 0x00000086,
+ 0x035, 0x00000186,
+ 0x035, 0x00000286,
+ 0x036, 0x00001C25,
+ 0x036, 0x00009C25,
+ 0x036, 0x00011C25,
+ 0x036, 0x00019C25,
+ 0x0B6, 0x00048538,
+ 0x018, 0x00000C07,
+ 0x05A, 0x0004BD00,
+ 0x019, 0x000739D0,
+ 0x034, 0x0000ADF3,
+ 0x034, 0x00009DF0,
+ 0x034, 0x00008DED,
+ 0x034, 0x00007DEA,
+ 0x034, 0x00006DE7,
+ 0x034, 0x000054EE,
+ 0x034, 0x000044EB,
+ 0x034, 0x000034E8,
+ 0x034, 0x0000246B,
+ 0x034, 0x00001468,
+ 0x034, 0x0000006D,
+ 0x000, 0x00030159,
+ 0x084, 0x00068200,
+ 0x086, 0x000000CE,
+ 0x087, 0x00048A00,
+ 0x08E, 0x00065540,
+ 0x08F, 0x00088000,
+ 0x0EF, 0x000020A0,
+ 0x03B, 0x000F02B0,
+ 0x03B, 0x000EF7B0,
+ 0x03B, 0x000D4FB0,
+ 0x03B, 0x000CF060,
+ 0x03B, 0x000B0090,
+ 0x03B, 0x000A0080,
+ 0x03B, 0x00090080,
+ 0x03B, 0x0008F780,
+ 0x03B, 0x000722B0,
+ 0x03B, 0x0006F7B0,
+ 0x03B, 0x00054FB0,
+ 0x03B, 0x0004F060,
+ 0x03B, 0x00030090,
+ 0x03B, 0x00020080,
+ 0x03B, 0x00010080,
+ 0x03B, 0x0000F780,
+ 0x0EF, 0x000000A0,
+ 0x000, 0x00010159,
+ 0x018, 0x0000F407,
+ 0xFFE, 0x00000000,
+ 0xFFE, 0x00000000,
+ 0x01F, 0x00080003,
+ 0xFFE, 0x00000000,
+ 0xFFE, 0x00000000,
+ 0x01E, 0x00000001,
+ 0x01F, 0x00080000,
+ 0x000, 0x00033E60,
+
+};
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT(
+ 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_8188E_RadioA_1T_ICUT)/sizeof(u4Byte);
+ pu4Byte Array = Array_MP_8188E_RadioA_1T_ICUT;
+ BOOLEAN biol = FALSE;
+#ifdef CONFIG_IOL_IOREG_CFG
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ struct xmit_frame *pxmit_frame;
+ u8 bndy_cnt = 1;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ struct cmd_cmp cmpdata[ArrayLen];
+ u4Byte cmpdata_idx=0;
+ #endif
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+ HAL_STATUS rst =HAL_STATUS_SUCCESS;
+
+ hex += board;
+ hex += _interface << 8;
+ hex += platform << 16;
+ hex += 0xFF000000;
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT, hex = 0x%X\n", hex));
+#ifdef CONFIG_IOL_IOREG_CFG
+ biol = rtw_IOL_applied(Adapter);
+
+ if(biol){
+ if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL)
+ {
+ printk("rtw_IOL_accquire_xmit_frame failed\n");
+ return HAL_STATUS_FAILURE;
+ }
+ }
+#endif//#ifdef CONFIG_IOL_IOREG_CFG
+
+ for (i = 0; i < ArrayLen; i += 2 )
+ {
+ u4Byte v1 = Array[i];
+ u4Byte v2 = Array[i+1];
+
+ // This (offset, data) pair meets the condition.
+ if ( v1 < 0xCDCDCDCD )
+ {
+ #ifdef CONFIG_IOL_IOREG_CFG
+ if(biol){
+ if(rtw_IOL_cmd_boundary_handle(pxmit_frame))
+ bndy_cnt++;
+
+ if(v1 == 0xffe)
+ {
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfd){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xfc){
+ rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1);
+ }
+ else if (v1 == 0xfb){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50);
+ }
+ else if (v1 == 0xfa){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5);
+ }
+ else if (v1 == 0xf9){
+ rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1);
+ }
+ else{
+ rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ;
+ #ifdef CONFIG_IOL_IOREG_CFG_DBG
+ cmpdata[cmpdata_idx].addr = v1;
+ cmpdata[cmpdata_idx].value= v2;
+ cmpdata_idx++;
+ #endif
+ }
+
+ }
+ else
+ #endif //#ifdef CONFIG_IOL_IOREG_CFG
+ {
+ odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
+ }
+ continue;
+ }
+ else
+ { // This line is the start line of branch.
+ if ( !CheckCondition(Array[i], hex) )
+ { // Discard the following (offset, data) pairs.
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+ i -= 2; // prevent from for-loop += 2
+ }
+ else // Configure matched pairs and skip to end of if-else.
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD &&
+ v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < ArrayLen -2)
+ {
+ odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ while (v2 != 0xDEAD && i < ArrayLen -2)
+ {
+ READ_NEXT_PAIR(v1, v2, i);
+ }
+
+ }
+ }
+ }
+ return rst;
+}
+
+/******************************************************************************
+* TxPowerTrack_AP.TXT
+******************************************************************************/
+
+u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_AP_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_AP_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_AP_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_AP_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+};
+u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_AP_8188E[] = {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11};
+u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_AP_8188E[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9};
+u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_AP_8188E[] = {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11};
+u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_AP_8188E[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_AP_8188E[] = {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_AP_8188E[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_AP_8188E[] = {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_AP_8188E[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9};
+
+void
+ODM_ReadAndConfig_MP_8188E_TxPowerTrack_AP(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8188E\n"));
+
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE);
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P, gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_AP_8188E, DELTA_SWINGIDX_SIZE*3);
+}
+
+/******************************************************************************
+* TxPowerTrack_PCIE.TXT
+******************************************************************************/
+
+u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_PCIE_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_PCIE_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_PCIE_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_PCIE_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+};
+u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_PCIE_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};
+u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_PCIE_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};
+u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_PCIE_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};
+u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_PCIE_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};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_PCIE_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};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_PCIE_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};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_PCIE_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};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_PCIE_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};
+
+void
+ODM_ReadAndConfig_MP_8188E_TxPowerTrack_PCIE(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8188E\n"));
+
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE);
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P, gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_PCIE_8188E, DELTA_SWINGIDX_SIZE*3);
+}
+
+/******************************************************************************
+* TxPowerTrack_USB.TXT
+******************************************************************************/
+
+u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_USB_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_USB_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_USB_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 17, 17, 17, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+ {0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18},
+};
+u1Byte gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_USB_8188E[][DELTA_SWINGIDX_SIZE] = {
+ {0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
+};
+u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_USB_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};
+u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_USB_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};
+u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_USB_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};
+u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_USB_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};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_USB_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};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_USB_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};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_USB_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};
+u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_USB_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};
+
+void
+ODM_ReadAndConfig_MP_8188E_TxPowerTrack_USB(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8188E\n"));
+
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE);
+
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P, gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE*3);
+ ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_USB_8188E, DELTA_SWINGIDX_SIZE*3);
+}
+
+/******************************************************************************
+* TXPWR_LMT.TXT
+******************************************************************************/
+
+pu1Byte Array_MP_8188E_TXPWR_LMT[] = {
+ "FCC", "2.4G", "20M", "CCK", "1T", "01", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "01", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "01", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "02", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "02", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "02", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "03", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "03", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "03", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "04", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "04", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "04", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "05", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "05", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "05", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "06", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "06", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "06", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "07", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "07", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "07", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "08", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "08", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "08", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "09", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "09", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "09", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "10", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "10", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "10", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "11", "32",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "11", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "11", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "12", "63",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "12", "32",
+ "MKK", "2.4G", "20M", "CCK", "1T", "12", "32",
+ "FCC", "2.4G", "20M", "CCK", "1T", "13", "63",
+ "ETSI", "2.4G", "20M", "CCK", "1T", "13", "32",
+ "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",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "01", "28",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "01", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "01", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "02", "28",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "02", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "02", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "03", "30",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "03", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "03", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "04", "30",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "04", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "04", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "05", "30",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "05", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "05", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "06", "30",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "06", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "06", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "07", "30",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "07", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "07", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "08", "30",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "08", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "08", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "09", "28",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "09", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "09", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "10", "28",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "10", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "10", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "11", "28",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "11", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "11", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "12", "63",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "12", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "12", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "13", "63",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "13", "30",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "13", "30",
+ "FCC", "2.4G", "20M", "OFDM", "1T", "14", "63",
+ "ETSI", "2.4G", "20M", "OFDM", "1T", "14", "63",
+ "MKK", "2.4G", "20M", "OFDM", "1T", "14", "63",
+ "FCC", "2.4G", "20M", "HT", "1T", "01", "28",
+ "ETSI", "2.4G", "20M", "HT", "1T", "01", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "01", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "02", "28",
+ "ETSI", "2.4G", "20M", "HT", "1T", "02", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "02", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "03", "30",
+ "ETSI", "2.4G", "20M", "HT", "1T", "03", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "03", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "04", "30",
+ "ETSI", "2.4G", "20M", "HT", "1T", "04", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "04", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "05", "30",
+ "ETSI", "2.4G", "20M", "HT", "1T", "05", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "05", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "06", "30",
+ "ETSI", "2.4G", "20M", "HT", "1T", "06", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "06", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "07", "30",
+ "ETSI", "2.4G", "20M", "HT", "1T", "07", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "07", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "08", "30",
+ "ETSI", "2.4G", "20M", "HT", "1T", "08", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "08", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "09", "28",
+ "ETSI", "2.4G", "20M", "HT", "1T", "09", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "09", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "10", "28",
+ "ETSI", "2.4G", "20M", "HT", "1T", "10", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "10", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "11", "28",
+ "ETSI", "2.4G", "20M", "HT", "1T", "11", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "11", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "12", "63",
+ "ETSI", "2.4G", "20M", "HT", "1T", "12", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "12", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "13", "63",
+ "ETSI", "2.4G", "20M", "HT", "1T", "13", "30",
+ "MKK", "2.4G", "20M", "HT", "1T", "13", "30",
+ "FCC", "2.4G", "20M", "HT", "1T", "14", "63",
+ "ETSI", "2.4G", "20M", "HT", "1T", "14", "63",
+ "MKK", "2.4G", "20M", "HT", "1T", "14", "63",
+ "FCC", "2.4G", "20M", "HT", "2T", "01", "28",
+ "ETSI", "2.4G", "20M", "HT", "2T", "01", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "01", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "02", "28",
+ "ETSI", "2.4G", "20M", "HT", "2T", "02", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "02", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "03", "30",
+ "ETSI", "2.4G", "20M", "HT", "2T", "03", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "03", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "04", "30",
+ "ETSI", "2.4G", "20M", "HT", "2T", "04", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "04", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "05", "30",
+ "ETSI", "2.4G", "20M", "HT", "2T", "05", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "05", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "06", "30",
+ "ETSI", "2.4G", "20M", "HT", "2T", "06", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "06", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "07", "30",
+ "ETSI", "2.4G", "20M", "HT", "2T", "07", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "07", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "08", "30",
+ "ETSI", "2.4G", "20M", "HT", "2T", "08", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "08", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "09", "28",
+ "ETSI", "2.4G", "20M", "HT", "2T", "09", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "09", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "10", "28",
+ "ETSI", "2.4G", "20M", "HT", "2T", "10", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "10", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "11", "28",
+ "ETSI", "2.4G", "20M", "HT", "2T", "11", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "11", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "12", "63",
+ "ETSI", "2.4G", "20M", "HT", "2T", "12", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "12", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "13", "63",
+ "ETSI", "2.4G", "20M", "HT", "2T", "13", "30",
+ "MKK", "2.4G", "20M", "HT", "2T", "13", "30",
+ "FCC", "2.4G", "20M", "HT", "2T", "14", "63",
+ "ETSI", "2.4G", "20M", "HT", "2T", "14", "63",
+ "MKK", "2.4G", "20M", "HT", "2T", "14", "63",
+ "FCC", "2.4G", "40M", "HT", "1T", "01", "63",
+ "ETSI", "2.4G", "40M", "HT", "1T", "01", "63",
+ "MKK", "2.4G", "40M", "HT", "1T", "01", "63",
+ "FCC", "2.4G", "40M", "HT", "1T", "02", "63",
+ "ETSI", "2.4G", "40M", "HT", "1T", "02", "63",
+ "MKK", "2.4G", "40M", "HT", "1T", "02", "63",
+ "FCC", "2.4G", "40M", "HT", "1T", "03", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "03", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "03", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "04", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "04", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "04", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "05", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "05", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "05", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "06", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "06", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "06", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "07", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "07", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "07", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "08", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "08", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "08", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "09", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "09", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "09", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "10", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "10", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "10", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "11", "26",
+ "ETSI", "2.4G", "40M", "HT", "1T", "11", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "11", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "12", "63",
+ "ETSI", "2.4G", "40M", "HT", "1T", "12", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "12", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "13", "63",
+ "ETSI", "2.4G", "40M", "HT", "1T", "13", "26",
+ "MKK", "2.4G", "40M", "HT", "1T", "13", "26",
+ "FCC", "2.4G", "40M", "HT", "1T", "14", "63",
+ "ETSI", "2.4G", "40M", "HT", "1T", "14", "63",
+ "MKK", "2.4G", "40M", "HT", "1T", "14", "63",
+ "FCC", "2.4G", "40M", "HT", "2T", "01", "63",
+ "ETSI", "2.4G", "40M", "HT", "2T", "01", "63",
+ "MKK", "2.4G", "40M", "HT", "2T", "01", "63",
+ "FCC", "2.4G", "40M", "HT", "2T", "02", "63",
+ "ETSI", "2.4G", "40M", "HT", "2T", "02", "63",
+ "MKK", "2.4G", "40M", "HT", "2T", "02", "63",
+ "FCC", "2.4G", "40M", "HT", "2T", "03", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "03", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "03", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "04", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "04", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "04", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "05", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "05", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "05", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "06", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "06", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "06", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "07", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "07", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "07", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "08", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "08", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "08", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "09", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "09", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "09", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "10", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "10", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "10", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "11", "26",
+ "ETSI", "2.4G", "40M", "HT", "2T", "11", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "11", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "12", "63",
+ "ETSI", "2.4G", "40M", "HT", "2T", "12", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "12", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "13", "63",
+ "ETSI", "2.4G", "40M", "HT", "2T", "13", "26",
+ "MKK", "2.4G", "40M", "HT", "2T", "13", "26",
+ "FCC", "2.4G", "40M", "HT", "2T", "14", "63",
+ "ETSI", "2.4G", "40M", "HT", "2T", "14", "63",
+ "MKK", "2.4G", "40M", "HT", "2T", "14", "63",
+ "FCC", "5G", "20M", "OFDM", "1T", "36", "30",
+ "ETSI", "5G", "20M", "OFDM", "1T", "36", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "36", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "40", "30",
+ "ETSI", "5G", "20M", "OFDM", "1T", "40", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "40", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "44", "30",
+ "ETSI", "5G", "20M", "OFDM", "1T", "44", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "44", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "48", "30",
+ "ETSI", "5G", "20M", "OFDM", "1T", "48", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "48", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "52", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "52", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "52", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "56", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "56", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "56", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "60", "32",
+ "ETSI", "5G", "20M", "OFDM", "1T", "60", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "60", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "64", "28",
+ "ETSI", "5G", "20M", "OFDM", "1T", "64", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "64", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "100", "30",
+ "ETSI", "5G", "20M", "OFDM", "1T", "100", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "100", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "114", "30",
+ "ETSI", "5G", "20M", "OFDM", "1T", "114", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "114", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "108", "32",
+ "ETSI", "5G", "20M", "OFDM", "1T", "108", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "108", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "112", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "112", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "112", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "116", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "116", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "116", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "120", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "120", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "120", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "124", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "124", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "124", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "128", "32",
+ "ETSI", "5G", "20M", "OFDM", "1T", "128", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "128", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "132", "30",
+ "ETSI", "5G", "20M", "OFDM", "1T", "132", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "132", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "136", "30",
+ "ETSI", "5G", "20M", "OFDM", "1T", "136", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "136", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "140", "28",
+ "ETSI", "5G", "20M", "OFDM", "1T", "140", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "140", "32",
+ "FCC", "5G", "20M", "OFDM", "1T", "149", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "149", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "149", "63",
+ "FCC", "5G", "20M", "OFDM", "1T", "153", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "153", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "153", "63",
+ "FCC", "5G", "20M", "OFDM", "1T", "157", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "157", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "157", "63",
+ "FCC", "5G", "20M", "OFDM", "1T", "161", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "161", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "161", "63",
+ "FCC", "5G", "20M", "OFDM", "1T", "165", "34",
+ "ETSI", "5G", "20M", "OFDM", "1T", "165", "32",
+ "MKK", "5G", "20M", "OFDM", "1T", "165", "63",
+ "FCC", "5G", "20M", "HT", "1T", "36", "30",
+ "ETSI", "5G", "20M", "HT", "1T", "36", "32",
+ "MKK", "5G", "20M", "HT", "1T", "36", "32",
+ "FCC", "5G", "20M", "HT", "1T", "40", "30",
+ "ETSI", "5G", "20M", "HT", "1T", "40", "32",
+ "MKK", "5G", "20M", "HT", "1T", "40", "32",
+ "FCC", "5G", "20M", "HT", "1T", "44", "30",
+ "ETSI", "5G", "20M", "HT", "1T", "44", "32",
+ "MKK", "5G", "20M", "HT", "1T", "44", "32",
+ "FCC", "5G", "20M", "HT", "1T", "48", "30",
+ "ETSI", "5G", "20M", "HT", "1T", "48", "32",
+ "MKK", "5G", "20M", "HT", "1T", "48", "32",
+ "FCC", "5G", "20M", "HT", "1T", "52", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "52", "32",
+ "MKK", "5G", "20M", "HT", "1T", "52", "32",
+ "FCC", "5G", "20M", "HT", "1T", "56", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "56", "32",
+ "MKK", "5G", "20M", "HT", "1T", "56", "32",
+ "FCC", "5G", "20M", "HT", "1T", "60", "32",
+ "ETSI", "5G", "20M", "HT", "1T", "60", "32",
+ "MKK", "5G", "20M", "HT", "1T", "60", "32",
+ "FCC", "5G", "20M", "HT", "1T", "64", "28",
+ "ETSI", "5G", "20M", "HT", "1T", "64", "32",
+ "MKK", "5G", "20M", "HT", "1T", "64", "32",
+ "FCC", "5G", "20M", "HT", "1T", "100", "30",
+ "ETSI", "5G", "20M", "HT", "1T", "100", "32",
+ "MKK", "5G", "20M", "HT", "1T", "100", "32",
+ "FCC", "5G", "20M", "HT", "1T", "114", "30",
+ "ETSI", "5G", "20M", "HT", "1T", "114", "32",
+ "MKK", "5G", "20M", "HT", "1T", "114", "32",
+ "FCC", "5G", "20M", "HT", "1T", "108", "32",
+ "ETSI", "5G", "20M", "HT", "1T", "108", "32",
+ "MKK", "5G", "20M", "HT", "1T", "108", "32",
+ "FCC", "5G", "20M", "HT", "1T", "112", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "112", "32",
+ "MKK", "5G", "20M", "HT", "1T", "112", "32",
+ "FCC", "5G", "20M", "HT", "1T", "116", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "116", "32",
+ "MKK", "5G", "20M", "HT", "1T", "116", "32",
+ "FCC", "5G", "20M", "HT", "1T", "120", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "120", "32",
+ "MKK", "5G", "20M", "HT", "1T", "120", "32",
+ "FCC", "5G", "20M", "HT", "1T", "124", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "124", "32",
+ "MKK", "5G", "20M", "HT", "1T", "124", "32",
+ "FCC", "5G", "20M", "HT", "1T", "128", "32",
+ "ETSI", "5G", "20M", "HT", "1T", "128", "32",
+ "MKK", "5G", "20M", "HT", "1T", "128", "32",
+ "FCC", "5G", "20M", "HT", "1T", "132", "30",
+ "ETSI", "5G", "20M", "HT", "1T", "132", "32",
+ "MKK", "5G", "20M", "HT", "1T", "132", "32",
+ "FCC", "5G", "20M", "HT", "1T", "136", "30",
+ "ETSI", "5G", "20M", "HT", "1T", "136", "32",
+ "MKK", "5G", "20M", "HT", "1T", "136", "32",
+ "FCC", "5G", "20M", "HT", "1T", "140", "28",
+ "ETSI", "5G", "20M", "HT", "1T", "140", "32",
+ "MKK", "5G", "20M", "HT", "1T", "140", "32",
+ "FCC", "5G", "20M", "HT", "1T", "149", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "149", "32",
+ "MKK", "5G", "20M", "HT", "1T", "149", "63",
+ "FCC", "5G", "20M", "HT", "1T", "153", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "153", "32",
+ "MKK", "5G", "20M", "HT", "1T", "153", "63",
+ "FCC", "5G", "20M", "HT", "1T", "157", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "157", "32",
+ "MKK", "5G", "20M", "HT", "1T", "157", "63",
+ "FCC", "5G", "20M", "HT", "1T", "161", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "161", "32",
+ "MKK", "5G", "20M", "HT", "1T", "161", "63",
+ "FCC", "5G", "20M", "HT", "1T", "165", "34",
+ "ETSI", "5G", "20M", "HT", "1T", "165", "32",
+ "MKK", "5G", "20M", "HT", "1T", "165", "63",
+ "FCC", "5G", "20M", "HT", "2T", "36", "28",
+ "ETSI", "5G", "20M", "HT", "2T", "36", "30",
+ "MKK", "5G", "20M", "HT", "2T", "36", "30",
+ "FCC", "5G", "20M", "HT", "2T", "40", "28",
+ "ETSI", "5G", "20M", "HT", "2T", "40", "30",
+ "MKK", "5G", "20M", "HT", "2T", "40", "30",
+ "FCC", "5G", "20M", "HT", "2T", "44", "28",
+ "ETSI", "5G", "20M", "HT", "2T", "44", "30",
+ "MKK", "5G", "20M", "HT", "2T", "44", "30",
+ "FCC", "5G", "20M", "HT", "2T", "48", "28",
+ "ETSI", "5G", "20M", "HT", "2T", "48", "30",
+ "MKK", "5G", "20M", "HT", "2T", "48", "30",
+ "FCC", "5G", "20M", "HT", "2T", "52", "34",
+ "ETSI", "5G", "20M", "HT", "2T", "52", "30",
+ "MKK", "5G", "20M", "HT", "2T", "52", "30",
+ "FCC", "5G", "20M", "HT", "2T", "56", "32",
+ "ETSI", "5G", "20M", "HT", "2T", "56", "30",
+ "MKK", "5G", "20M", "HT", "2T", "56", "30",
+ "FCC", "5G", "20M", "HT", "2T", "60", "30",
+ "ETSI", "5G", "20M", "HT", "2T", "60", "30",
+ "MKK", "5G", "20M", "HT", "2T", "60", "30",
+ "FCC", "5G", "20M", "HT", "2T", "64", "26",
+ "ETSI", "5G", "20M", "HT", "2T", "64", "30",
+ "MKK", "5G", "20M", "HT", "2T", "64", "30",
+ "FCC", "5G", "20M", "HT", "2T", "100", "28",
+ "ETSI", "5G", "20M", "HT", "2T", "100", "30",
+ "MKK", "5G", "20M", "HT", "2T", "100", "30",
+ "FCC", "5G", "20M", "HT", "2T", "114", "28",
+ "ETSI", "5G", "20M", "HT", "2T", "114", "30",
+ "MKK", "5G", "20M", "HT", "2T", "114", "30",
+ "FCC", "5G", "20M", "HT", "2T", "108", "30",
+ "ETSI", "5G", "20M", "HT", "2T", "108", "30",
+ "MKK", "5G", "20M", "HT", "2T", "108", "30",
+ "FCC", "5G", "20M", "HT", "2T", "112", "32",
+ "ETSI", "5G", "20M", "HT", "2T", "112", "30",
+ "MKK", "5G", "20M", "HT", "2T", "112", "30",
+ "FCC", "5G", "20M", "HT", "2T", "116", "32",
+ "ETSI", "5G", "20M", "HT", "2T", "116", "30",
+ "MKK", "5G", "20M", "HT", "2T", "116", "30",
+ "FCC", "5G", "20M", "HT", "2T", "120", "34",
+ "ETSI", "5G", "20M", "HT", "2T", "120", "30",
+ "MKK", "5G", "20M", "HT", "2T", "120", "30",
+ "FCC", "5G", "20M", "HT", "2T", "124", "32",
+ "ETSI", "5G", "20M", "HT", "2T", "124", "30",
+ "MKK", "5G", "20M", "HT", "2T", "124", "30",
+ "FCC", "5G", "20M", "HT", "2T", "128", "30",
+ "ETSI", "5G", "20M", "HT", "2T", "128", "30",
+ "MKK", "5G", "20M", "HT", "2T", "128", "30",
+ "FCC", "5G", "20M", "HT", "2T", "132", "28",
+ "ETSI", "5G", "20M", "HT", "2T", "132", "30",
+ "MKK", "5G", "20M", "HT", "2T", "132", "30",
+ "FCC", "5G", "20M", "HT", "2T", "136", "28",
+ "ETSI", "5G", "20M", "HT", "2T", "136", "30",
+ "MKK", "5G", "20M", "HT", "2T", "136", "30",
+ "FCC", "5G", "20M", "HT", "2T", "140", "26",
+ "ETSI", "5G", "20M", "HT", "2T", "140", "30",
+ "MKK", "5G", "20M", "HT", "2T", "140", "30",
+ "FCC", "5G", "20M", "HT", "2T", "149", "34",
+ "ETSI", "5G", "20M", "HT", "2T", "149", "30",
+ "MKK", "5G", "20M", "HT", "2T", "149", "63",
+ "FCC", "5G", "20M", "HT", "2T", "153", "34",
+ "ETSI", "5G", "20M", "HT", "2T", "153", "30",
+ "MKK", "5G", "20M", "HT", "2T", "153", "63",
+ "FCC", "5G", "20M", "HT", "2T", "157", "34",
+ "ETSI", "5G", "20M", "HT", "2T", "157", "30",
+ "MKK", "5G", "20M", "HT", "2T", "157", "63",
+ "FCC", "5G", "20M", "HT", "2T", "161", "34",
+ "ETSI", "5G", "20M", "HT", "2T", "161", "30",
+ "MKK", "5G", "20M", "HT", "2T", "161", "63",
+ "FCC", "5G", "20M", "HT", "2T", "165", "34",
+ "ETSI", "5G", "20M", "HT", "2T", "165", "30",
+ "MKK", "5G", "20M", "HT", "2T", "165", "63",
+ "FCC", "5G", "40M", "HT", "1T", "38", "30",
+ "ETSI", "5G", "40M", "HT", "1T", "38", "32",
+ "MKK", "5G", "40M", "HT", "1T", "38", "32",
+ "FCC", "5G", "40M", "HT", "1T", "46", "30",
+ "ETSI", "5G", "40M", "HT", "1T", "46", "32",
+ "MKK", "5G", "40M", "HT", "1T", "46", "32",
+ "FCC", "5G", "40M", "HT", "1T", "54", "32",
+ "ETSI", "5G", "40M", "HT", "1T", "54", "32",
+ "MKK", "5G", "40M", "HT", "1T", "54", "32",
+ "FCC", "5G", "40M", "HT", "1T", "62", "32",
+ "ETSI", "5G", "40M", "HT", "1T", "62", "32",
+ "MKK", "5G", "40M", "HT", "1T", "62", "32",
+ "FCC", "5G", "40M", "HT", "1T", "102", "28",
+ "ETSI", "5G", "40M", "HT", "1T", "102", "32",
+ "MKK", "5G", "40M", "HT", "1T", "102", "32",
+ "FCC", "5G", "40M", "HT", "1T", "110", "32",
+ "ETSI", "5G", "40M", "HT", "1T", "110", "32",
+ "MKK", "5G", "40M", "HT", "1T", "110", "32",
+ "FCC", "5G", "40M", "HT", "1T", "118", "34",
+ "ETSI", "5G", "40M", "HT", "1T", "118", "32",
+ "MKK", "5G", "40M", "HT", "1T", "118", "32",
+ "FCC", "5G", "40M", "HT", "1T", "126", "34",
+ "ETSI", "5G", "40M", "HT", "1T", "126", "32",
+ "MKK", "5G", "40M", "HT", "1T", "126", "32",
+ "FCC", "5G", "40M", "HT", "1T", "134", "32",
+ "ETSI", "5G", "40M", "HT", "1T", "134", "32",
+ "MKK", "5G", "40M", "HT", "1T", "134", "32",
+ "FCC", "5G", "40M", "HT", "1T", "151", "34",
+ "ETSI", "5G", "40M", "HT", "1T", "151", "32",
+ "MKK", "5G", "40M", "HT", "1T", "151", "63",
+ "FCC", "5G", "40M", "HT", "1T", "159", "34",
+ "ETSI", "5G", "40M", "HT", "1T", "159", "32",
+ "MKK", "5G", "40M", "HT", "1T", "159", "63",
+ "FCC", "5G", "40M", "HT", "2T", "38", "28",
+ "ETSI", "5G", "40M", "HT", "2T", "38", "30",
+ "MKK", "5G", "40M", "HT", "2T", "38", "30",
+ "FCC", "5G", "40M", "HT", "2T", "46", "28",
+ "ETSI", "5G", "40M", "HT", "2T", "46", "30",
+ "MKK", "5G", "40M", "HT", "2T", "46", "30",
+ "FCC", "5G", "40M", "HT", "2T", "54", "30",
+ "ETSI", "5G", "40M", "HT", "2T", "54", "30",
+ "MKK", "5G", "40M", "HT", "2T", "54", "30",
+ "FCC", "5G", "40M", "HT", "2T", "62", "30",
+ "ETSI", "5G", "40M", "HT", "2T", "62", "30",
+ "MKK", "5G", "40M", "HT", "2T", "62", "30",
+ "FCC", "5G", "40M", "HT", "2T", "102", "26",
+ "ETSI", "5G", "40M", "HT", "2T", "102", "30",
+ "MKK", "5G", "40M", "HT", "2T", "102", "30",
+ "FCC", "5G", "40M", "HT", "2T", "110", "30",
+ "ETSI", "5G", "40M", "HT", "2T", "110", "30",
+ "MKK", "5G", "40M", "HT", "2T", "110", "30",
+ "FCC", "5G", "40M", "HT", "2T", "118", "34",
+ "ETSI", "5G", "40M", "HT", "2T", "118", "30",
+ "MKK", "5G", "40M", "HT", "2T", "118", "30",
+ "FCC", "5G", "40M", "HT", "2T", "126", "32",
+ "ETSI", "5G", "40M", "HT", "2T", "126", "30",
+ "MKK", "5G", "40M", "HT", "2T", "126", "30",
+ "FCC", "5G", "40M", "HT", "2T", "134", "30",
+ "ETSI", "5G", "40M", "HT", "2T", "134", "30",
+ "MKK", "5G", "40M", "HT", "2T", "134", "30",
+ "FCC", "5G", "40M", "HT", "2T", "151", "34",
+ "ETSI", "5G", "40M", "HT", "2T", "151", "30",
+ "MKK", "5G", "40M", "HT", "2T", "151", "63",
+ "FCC", "5G", "40M", "HT", "2T", "159", "34",
+ "ETSI", "5G", "40M", "HT", "2T", "159", "30",
+ "MKK", "5G", "40M", "HT", "2T", "159", "63",
+ "FCC", "5G", "80M", "VHT", "1T", "42", "30",
+ "ETSI", "5G", "80M", "VHT", "1T", "42", "32",
+ "MKK", "5G", "80M", "VHT", "1T", "42", "32",
+ "FCC", "5G", "80M", "VHT", "1T", "58", "28",
+ "ETSI", "5G", "80M", "VHT", "1T", "58", "32",
+ "MKK", "5G", "80M", "VHT", "1T", "58", "32",
+ "FCC", "5G", "80M", "VHT", "1T", "106", "30",
+ "ETSI", "5G", "80M", "VHT", "1T", "106", "32",
+ "MKK", "5G", "80M", "VHT", "1T", "106", "32",
+ "FCC", "5G", "80M", "VHT", "1T", "122", "34",
+ "ETSI", "5G", "80M", "VHT", "1T", "122", "32",
+ "MKK", "5G", "80M", "VHT", "1T", "122", "32",
+ "FCC", "5G", "80M", "VHT", "1T", "155", "34",
+ "ETSI", "5G", "80M", "VHT", "1T", "155", "32",
+ "MKK", "5G", "80M", "VHT", "1T", "155", "63",
+ "FCC", "5G", "80M", "VHT", "2T", "42", "28",
+ "ETSI", "5G", "80M", "VHT", "2T", "42", "30",
+ "MKK", "5G", "80M", "VHT", "2T", "42", "30",
+ "FCC", "5G", "80M", "VHT", "2T", "58", "26",
+ "ETSI", "5G", "80M", "VHT", "2T", "58", "30",
+ "MKK", "5G", "80M", "VHT", "2T", "58", "30",
+ "FCC", "5G", "80M", "VHT", "2T", "106", "28",
+ "ETSI", "5G", "80M", "VHT", "2T", "106", "30",
+ "MKK", "5G", "80M", "VHT", "2T", "106", "30",
+ "FCC", "5G", "80M", "VHT", "2T", "122", "32",
+ "ETSI", "5G", "80M", "VHT", "2T", "122", "30",
+ "MKK", "5G", "80M", "VHT", "2T", "122", "30",
+ "FCC", "5G", "80M", "VHT", "2T", "155", "34",
+ "ETSI", "5G", "80M", "VHT", "2T", "155", "30",
+ "MKK", "5G", "80M", "VHT", "2T", "155", "63"
+};
+
+void
+ODM_ReadAndConfig_MP_8188E_TXPWR_LMT(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ u4Byte i = 0;
+ u4Byte ArrayLen = sizeof(Array_MP_8188E_TXPWR_LMT)/sizeof(pu1Byte);
+ pu1Byte *Array = Array_MP_8188E_TXPWR_LMT;
+
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_TXPWR_LMT\n"));
+
+ for (i = 0; i < ArrayLen; i += 7 )
+ {
+ pu1Byte regulation = Array[i];
+ pu1Byte band = Array[i+1];
+ pu1Byte bandwidth = Array[i+2];
+ pu1Byte rate = Array[i+3];
+ pu1Byte rfPath = Array[i+4];
+ pu1Byte chnl = Array[i+5];
+ pu1Byte val = Array[i+6];
+
+ odm_ConfigBB_TXPWR_LMT_8188E(pDM_Odm, regulation, band, bandwidth, rate, rfPath, chnl, val);
+ }
+
+}
+
+#endif // end of HWIMG_SUPPORT
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.h b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.h
index eb59afd..bb186b4 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.h
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalHWImg8188E_RF.h
@@ -1,83 +1,83 @@
-/******************************************************************************
-*
-* 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 (RTL8188E_SUPPORT == 1)
-#ifndef __INC_MP_RF_HW_IMG_8188E_H
-#define __INC_MP_RF_HW_IMG_8188E_H
-
-//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex);
-
-/******************************************************************************
-* RadioA_1T.TXT
-******************************************************************************/
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_RadioA_1T( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* RadioA_1T_ICUT.TXT
-******************************************************************************/
-
-HAL_STATUS
-ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* TxPowerTrack_AP.TXT
-******************************************************************************/
-
-void
-ODM_ReadAndConfig_MP_8188E_TxPowerTrack_AP( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* TxPowerTrack_PCIE.TXT
-******************************************************************************/
-
-void
-ODM_ReadAndConfig_MP_8188E_TxPowerTrack_PCIE( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* TxPowerTrack_USB.TXT
-******************************************************************************/
-
-void
-ODM_ReadAndConfig_MP_8188E_TxPowerTrack_USB( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-/******************************************************************************
-* TXPWR_LMT.TXT
-******************************************************************************/
-
-void
-ODM_ReadAndConfig_MP_8188E_TXPWR_LMT( // TC: Test Chip, MP: MP Chip
- IN PDM_ODM_T pDM_Odm
-);
-
-#endif
-#endif // end of HWIMG_SUPPORT
-
+/******************************************************************************
+*
+* 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 (RTL8188E_SUPPORT == 1)
+#ifndef __INC_MP_RF_HW_IMG_8188E_H
+#define __INC_MP_RF_HW_IMG_8188E_H
+
+//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex);
+
+/******************************************************************************
+* RadioA_1T.TXT
+******************************************************************************/
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_RadioA_1T( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* RadioA_1T_ICUT.TXT
+******************************************************************************/
+
+HAL_STATUS
+ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* TxPowerTrack_AP.TXT
+******************************************************************************/
+
+void
+ODM_ReadAndConfig_MP_8188E_TxPowerTrack_AP( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* TxPowerTrack_PCIE.TXT
+******************************************************************************/
+
+void
+ODM_ReadAndConfig_MP_8188E_TxPowerTrack_PCIE( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* TxPowerTrack_USB.TXT
+******************************************************************************/
+
+void
+ODM_ReadAndConfig_MP_8188E_TxPowerTrack_USB( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+/******************************************************************************
+* TXPWR_LMT.TXT
+******************************************************************************/
+
+void
+ODM_ReadAndConfig_MP_8188E_TXPWR_LMT( // TC: Test Chip, MP: MP Chip
+ IN PDM_ODM_T pDM_Odm
+);
+
+#endif
+#endif // end of HWIMG_SUPPORT
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.c b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.c
index 2f3779b..686e466 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.c
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.c
@@ -1,3299 +1,3299 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-
-#include "../odm_precomp.h"
-
-
-
-/*---------------------------Define Local Constant---------------------------*/
-// 2010/04/25 MH Define the max tx power tracking tx agc power.
-#define ODM_TXPWRTRACK_MAX_IDX_88E 6
-
-/*---------------------------Define Local Constant---------------------------*/
-
-
-//3============================================================
-//3 Tx Power Tracking
-//3============================================================
-
-
-void setIqkMatrix_8188E(
- PDM_ODM_T pDM_Odm,
- u1Byte OFDM_index,
- u1Byte RFPath,
- s4Byte IqkResult_X,
- s4Byte IqkResult_Y
- )
-{
- s4Byte ele_A=0, ele_D, ele_C=0, value32;
-
- ele_D = (OFDMSwingTable_New[OFDM_index] & 0xFFC00000)>>22;
-
- //new element A = element D x X
- if((IqkResult_X != 0) && (*(pDM_Odm->pBandType) == ODM_BAND_2_4G))
- {
- if ((IqkResult_X & 0x00000200) != 0) //consider minus
- IqkResult_X = IqkResult_X | 0xFFFFFC00;
- ele_A = ((IqkResult_X * ele_D)>>8)&0x000003FF;
-
- //new element C = element D x Y
- if ((IqkResult_Y & 0x00000200) != 0)
- IqkResult_Y = IqkResult_Y | 0xFFFFFC00;
- ele_C = ((IqkResult_Y * ele_D)>>8)&0x000003FF;
-
- //if (RFPath == ODM_RF_PATH_A)
- switch (RFPath)
- {
- case ODM_RF_PATH_A:
- //wirte new elements A, C, D to regC80 and regC94, element B is always 0
- value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A;
- ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, value32);
-
- value32 = (ele_C&0x000003C0)>>6;
- ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, value32);
-
- value32 = ((IqkResult_X * ele_D)>>7)&0x01;
- ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, value32);
- break;
- case ODM_RF_PATH_B:
- //wirte new elements A, C, D to regC88 and regC9C, element B is always 0
- value32=(ele_D<<22)|((ele_C&0x3F)<<16) |ele_A;
- ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, value32);
-
- value32 = (ele_C&0x000003C0)>>6;
- ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, value32);
-
- value32 = ((IqkResult_X * ele_D)>>7)&0x01;
- ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, value32);
-
- break;
- default:
- break;
- }
- }
- else
- {
- switch (RFPath)
- {
- case ODM_RF_PATH_A:
- ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, OFDMSwingTable_New[OFDM_index]);
- ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, 0x00);
- ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, 0x00);
- break;
-
- case ODM_RF_PATH_B:
- ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, OFDMSwingTable_New[OFDM_index]);
- ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00);
- ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, 0x00);
- break;
-
- default:
- break;
- }
- }
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("TxPwrTracking path B: X = 0x%x, Y = 0x%x ele_A = 0x%x ele_C = 0x%x ele_D = 0x%x 0xeb4 = 0x%x 0xebc = 0x%x\n",
- (u4Byte)IqkResult_X, (u4Byte)IqkResult_Y, (u4Byte)ele_A, (u4Byte)ele_C, (u4Byte)ele_D, (u4Byte)IqkResult_X, (u4Byte)IqkResult_Y));
-}
-
-void DoIQK_8188E(
- PDM_ODM_T pDM_Odm,
- u1Byte DeltaThermalIndex,
- u1Byte ThermalValue,
- u1Byte Threshold
- )
-{
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- PADAPTER Adapter = pDM_Odm->Adapter;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-#endif
-
- ODM_ResetIQKResult(pDM_Odm);
-
-#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
-#if USE_WORKITEM
- PlatformAcquireMutex(&pHalData->mxChnlBwControl);
-#else
- PlatformAcquireSpinLock(Adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK);
-#endif
-#elif((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- PlatformAcquireMutex(&pHalData->mxChnlBwControl);
-#endif
-#endif
-
-
- pDM_Odm->RFCalibrateInfo.ThermalValue_IQK= ThermalValue;
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- PHY_IQCalibrate_8188E(pDM_Odm, FALSE);
-#else
- PHY_IQCalibrate_8188E(Adapter, FALSE);
-#endif
-
-#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
-#if USE_WORKITEM
- PlatformReleaseMutex(&pHalData->mxChnlBwControl);
-#else
- PlatformReleaseSpinLock(Adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK);
-#endif
-#elif((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- PlatformReleaseMutex(&pHalData->mxChnlBwControl);
-#endif
-#endif
-}
-
-/*-----------------------------------------------------------------------------
- * Function: odm_TxPwrTrackSetPwr88E()
- *
- * Overview: 88E change all channel tx power accordign to flag.
- * OFDM & CCK are all different.
- *
- * Input: NONE
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Revised History:
- * When Who Remark
- * 04/23/2012 MHC Create Version 0.
- *
- *---------------------------------------------------------------------------*/
-VOID
-ODM_TxPwrTrackSetPwr88E(
- PDM_ODM_T pDM_Odm,
- PWRTRACK_METHOD Method,
- u1Byte RFPath,
- u1Byte ChannelMappedIndex
- )
-{
- PADAPTER Adapter = pDM_Odm->Adapter;
- PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
- u1Byte PwrTrackingLimit_OFDM = 30; //+0dB
- u1Byte PwrTrackingLimit_CCK= 28; //-2dB
- u1Byte TxRate = 0xFF;
- u1Byte Final_OFDM_Swing_Index = 0;
- u1Byte Final_CCK_Swing_Index = 0;
- u1Byte i = 0;
-
-#if (MP_DRIVER==1)
- if ( *(pDM_Odm->mp_mode) == 1)
- {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE ))
- #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- PMPT_CONTEXT pMptCtx = &(Adapter->MptCtx);
- #elif (DM_ODM_SUPPORT_TYPE & (ODM_CE))
- PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.MptCtx);
- #endif
- TxRate = MptToMgntRate(pMptCtx->MptRateIndex);
-#endif
- }
- else
-#endif
- {
- u2Byte rate = *(pDM_Odm->pForcedDataRate);
-
- if(!rate) //auto rate
- {
- if(pDM_Odm->TxRate != 0xFF)
- #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- TxRate = Adapter->HalFunc.GetHwRateFromMRateHandler(pDM_Odm->TxRate);
- #elif (DM_ODM_SUPPORT_TYPE & (ODM_CE))
- TxRate = HwRateToMRate(pDM_Odm->TxRate);
- #endif
- }
- else //force rate
- {
- TxRate = (u1Byte)rate;
- }
- }
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("===>ODM_TxPwrTrackSetPwr8723B\n"));
-
- if(TxRate != 0xFF)
- {
- //2 CCK
- if((TxRate >= MGN_1M)&&(TxRate <= MGN_11M))
- PwrTrackingLimit_CCK = 28; //-2dB
- //2 OFDM
- else if((TxRate >= MGN_6M)&&(TxRate <= MGN_48M))
- PwrTrackingLimit_OFDM= 36; //+3dB
- else if(TxRate == MGN_54M)
- PwrTrackingLimit_OFDM= 34; //+2dB
-
- //2 HT
- else if((TxRate >= MGN_MCS0)&&(TxRate <= MGN_MCS2)) //QPSK/BPSK
- PwrTrackingLimit_OFDM= 38; //+4dB
- else if((TxRate >= MGN_MCS3)&&(TxRate <= MGN_MCS4)) //16QAM
- PwrTrackingLimit_OFDM= 36; //+3dB
- else if((TxRate >= MGN_MCS5)&&(TxRate <= MGN_MCS7)) //64QAM
- PwrTrackingLimit_OFDM= 34; //+2dB
-
- else
- PwrTrackingLimit_OFDM = pDM_Odm->DefaultOfdmIndex; //Default OFDM index = 30
- }
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("TxRate=0x%x, PwrTrackingLimit=%d\n", TxRate, PwrTrackingLimit_OFDM));
-
- if (Method == TXAGC)
- {
- u4Byte pwr = 0, TxAGC = 0;
- PADAPTER Adapter = pDM_Odm->Adapter;
-
- pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = pDM_Odm->Absolute_OFDMSwingIdx[RFPath]; //Remnant index equal to aboslute compensate value.
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("odm_TxPwrTrackSetPwr88E CH=%d\n", *(pDM_Odm->pChannel)));
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE ))
-
- #if (MP_DRIVER == 1)
- if ( *(pDM_Odm->mp_mode) == 1)
- {
- pwr = PHY_QueryBBReg(Adapter, rTxAGC_A_Rate18_06, 0xFF);
- pwr += pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A];
- PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, pwr);
- TxAGC = (pwr<<16)|(pwr<<8)|(pwr);
- PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, TxAGC);
- //RT_DISP(FPHY, PHY_TXPWR, ("ODM_TxPwrTrackSetPwr88E: CCK Tx-rf(A) Power = 0x%x\n", TxAGC));
-
- pwr = PHY_QueryBBReg(Adapter, rTxAGC_A_Rate18_06, 0xFF);
- pwr += (pDM_Odm->BbSwingIdxOfdm[ODM_RF_PATH_A] - pDM_Odm->BbSwingIdxOfdmBase[RF_PATH_A]);
- TxAGC |= ((pwr<<24)|(pwr<<16)|(pwr<<8)|pwr);
- PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskDWord, TxAGC);
- PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskDWord, TxAGC);
- PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskDWord, TxAGC);
- PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskDWord, TxAGC);
- PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskDWord, TxAGC);
- PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskDWord, TxAGC);
- //RT_DISP(FPHY, PHY_TXPWR, ("ODM_TxPwrTrackSetPwr88E: OFDM Tx-rf(A) Power = 0x%x\n", TxAGC));
- }
- else
- #endif
- {
- //PHY_SetTxPowerLevel8188E(pDM_Odm->Adapter, *pDM_Odm->pChannel);
- pDM_Odm->Modify_TxAGC_Flag_PathA = TRUE;
- pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = TRUE;
-
- if (RFPath == ODM_RF_PATH_A)
- {
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, CCK );
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, OFDM );
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, HT_MCS0_MCS7 );
- }
- }
-
-
-#endif
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- //PHY_RF6052SetCCKTxPower(pDM_Odm->priv, *(pDM_Odm->pChannel));
- //PHY_RF6052SetOFDMTxPower(pDM_Odm->priv, *(pDM_Odm->pChannel));
-#endif
-
- }
- else if (Method == BBSWING)
- {
- Final_OFDM_Swing_Index = pDM_Odm->DefaultOfdmIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
- Final_CCK_Swing_Index = pDM_Odm->DefaultCckIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
-
- if (Final_OFDM_Swing_Index >= PwrTrackingLimit_OFDM)
- Final_OFDM_Swing_Index = PwrTrackingLimit_OFDM;
- 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)
- Final_CCK_Swing_Index = 0;
-
- // Adjust BB swing by OFDM IQ matrix
- if (RFPath == ODM_RF_PATH_A)
- {
- setIqkMatrix_8188E(pDM_Odm, Final_OFDM_Swing_Index, ODM_RF_PATH_A,
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0],
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]);
- // Adjust BB swing by CCK filter coefficient
- if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14){
- ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][0]);
- ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][1]);
- ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][2]);
- ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][3]);
- ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][4]);
- ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][5]);
- ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][6]);
- ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][7]);
- }
- else
- {
- ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][0]);
- ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][1]);
- ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][2]);
- ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][3]);
- ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][4]);
- ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][5]);
- ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][6]);
- ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][7]);
- }
- }
- }
- else if (Method == MIX_MODE)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("pDM_Odm->DefaultOfdmIndex=%d, pDM_Odm->DefaultCCKIndex=%d, pDM_Odm->Absolute_OFDMSwingIdx[RFPath]=%d, RF_Path = %d\n",
- pDM_Odm->DefaultOfdmIndex, pDM_Odm->DefaultCckIndex, pDM_Odm->Absolute_OFDMSwingIdx[RFPath],RFPath ));
-
- Final_CCK_Swing_Index = pDM_Odm->DefaultCckIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
- Final_OFDM_Swing_Index = pDM_Odm->DefaultOfdmIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
-
- if(Final_OFDM_Swing_Index > PwrTrackingLimit_OFDM ) //BBSwing higher then Limit
- {
- pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = Final_OFDM_Swing_Index - PwrTrackingLimit_OFDM;
-
- setIqkMatrix_8188E(pDM_Odm, PwrTrackingLimit_OFDM, ODM_RF_PATH_A,
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0],
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]);
-
- pDM_Odm->Modify_TxAGC_Flag_PathA = TRUE;
-
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, OFDM );
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, HT_MCS0_MCS7 );
-
- 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)
- {
- pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = Final_OFDM_Swing_Index ;
-
- setIqkMatrix_8188E(pDM_Odm, 0, ODM_RF_PATH_A,
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0],
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]);
-
- pDM_Odm->Modify_TxAGC_Flag_PathA = TRUE;
-
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, OFDM );
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, HT_MCS0_MCS7 );
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A Lower then BBSwing lower bound 0 , Remnant TxAGC Value = %d \n", pDM_Odm->Remnant_OFDMSwingIdx[RFPath]));
- }
- else
- {
- setIqkMatrix_8188E(pDM_Odm, Final_OFDM_Swing_Index, ODM_RF_PATH_A,
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0],
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]);
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A Compensate with BBSwing , Final_OFDM_Swing_Index = %d \n", Final_OFDM_Swing_Index));
-
- if(pDM_Odm->Modify_TxAGC_Flag_PathA) //If TxAGC has changed, reset TxAGC again
- {
- pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = 0;
-
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, OFDM );
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, HT_MCS0_MCS7 );
-
- pDM_Odm->Modify_TxAGC_Flag_PathA = FALSE;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A pDM_Odm->Modify_TxAGC_Flag = FALSE \n"));
- }
- }
-
- if(Final_CCK_Swing_Index > PwrTrackingLimit_CCK)
- {
- pDM_Odm->Remnant_CCKSwingIdx = Final_CCK_Swing_Index - PwrTrackingLimit_CCK;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A CCK Over Limit , PwrTrackingLimit_CCK = %d , pDM_Odm->Remnant_CCKSwingIdx = %d \n", PwrTrackingLimit_CCK, pDM_Odm->Remnant_CCKSwingIdx));
-
- // Adjust BB swing by CCK filter coefficient
-
- if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14)
- {
- ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][0]);
- ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][1]);
- ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][2]);
- ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][3]);
- ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][4]);
- ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][5]);
- ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][6]);
- ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][7]);
- }
- else
- {
- ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][0]);
- ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][1]);
- ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][2]);
- ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][3]);
- ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][4]);
- ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][5]);
- ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][6]);
- ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][7]);
- }
-
- pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = TRUE;
-
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, CCK );
-
- }
- else if(Final_CCK_Swing_Index < 0) // Lowest CCK Index = 0
- {
- pDM_Odm->Remnant_CCKSwingIdx = Final_CCK_Swing_Index;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A CCK Under Limit , PwrTrackingLimit_CCK = %d , pDM_Odm->Remnant_CCKSwingIdx = %d \n", 0, pDM_Odm->Remnant_CCKSwingIdx));
-
- if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14)
- {
- ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13_New[0][0]);
- ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13_New[0][1]);
- ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13_New[0][2]);
- ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13_New[0][3]);
- ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13_New[0][4]);
- ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13_New[0][5]);
- ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13_New[0][6]);
- ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13_New[0][7]);
- }
- else
- {
- ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14_New[0][0]);
- ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14_New[0][1]);
- ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14_New[0][2]);
- ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14_New[0][3]);
- ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14_New[0][4]);
- ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14_New[0][5]);
- ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14_New[0][6]);
- ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14_New[0][7]);
- }
-
- pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = TRUE;
-
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, CCK );
-
- }
- else
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A CCK Compensate with BBSwing , Final_CCK_Swing_Index = %d \n", Final_CCK_Swing_Index));
-
- if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14)
- {
- ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][0]);
- ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][1]);
- ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][2]);
- ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][3]);
- ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][4]);
- ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][5]);
- ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][6]);
- ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][7]);
- }
- else
- {
- ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][0]);
- ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][1]);
- ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][2]);
- ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][3]);
- ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][4]);
- ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][5]);
- ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][6]);
- ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][7]);
- }
-
- if(pDM_Odm->Modify_TxAGC_Flag_PathA_CCK) //If TxAGC has changed, reset TxAGC again
- {
- pDM_Odm->Remnant_CCKSwingIdx = 0;
- PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, CCK );
- pDM_Odm->Modify_TxAGC_Flag_PathA_CCK= FALSE;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A pDM_Odm->Modify_TxAGC_Flag_CCK = FALSE \n"));
- }
- }
- }
- else
- {
- return;
- }
-} // odm_TxPwrTrackSetPwr88E
-
-VOID
-GetDeltaSwingTable_8188E(
- IN PDM_ODM_T pDM_Odm,
- OUT pu1Byte *TemperatureUP_A,
- OUT pu1Byte *TemperatureDOWN_A,
- OUT pu1Byte *TemperatureUP_B,
- OUT pu1Byte *TemperatureDOWN_B
- )
-{
- *TemperatureUP_A = (pu1Byte)DeltaSwingTableIdx_2GA_P_8188E;
- *TemperatureDOWN_A = (pu1Byte)DeltaSwingTableIdx_2GA_N_8188E;
- *TemperatureUP_B = (pu1Byte)DeltaSwingTableIdx_2GA_P_8188E;
- *TemperatureDOWN_B = (pu1Byte)DeltaSwingTableIdx_2GA_N_8188E;
-}
-
-void ConfigureTxpowerTrack_8188E(
- PTXPWRTRACK_CFG pConfig
- )
-{
- pConfig->SwingTableSize_CCK = CCK_TABLE_SIZE;
- pConfig->SwingTableSize_OFDM = OFDM_TABLE_SIZE;
- pConfig->Threshold_IQK = IQK_THRESHOLD;
- pConfig->AverageThermalNum = AVG_THERMAL_NUM_88E;
- pConfig->RfPathCount = MAX_PATH_NUM_8188E;
- pConfig->ThermalRegAddr = RF_T_METER_88E;
-
- pConfig->ODM_TxPwrTrackSetPwr = ODM_TxPwrTrackSetPwr88E;
- pConfig->DoIQK = DoIQK_8188E;
- pConfig->PHY_LCCalibrate = PHY_LCCalibrate_8188E;
- pConfig->GetDeltaSwingTable = GetDeltaSwingTable_8188E;
-}
-
-//1 7. IQK
-#define MAX_TOLERANCE 5
-#define IQK_DELAY_TIME 1 //ms
-
-u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK
-phy_PathA_IQK_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN configPathB
- )
-{
- u4Byte regEAC, regE94, regE9C, regEA4;
- u1Byte result = 0x00;
-#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 IQK!\n"));
-
- //1 Tx IQK
- //path-A IQK setting
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A IQK setting!\n"));
- ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1c);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x30008c1c);
- ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x8214032a);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160000);
-
- //LO calibration setting
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n"));
- ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x00462911);
-
- //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, 0xf9000000);
- ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000);
-
- // delay x ms
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E));
- //PlatformStallExecution(IQK_DELAY_TIME_88E*1000);
- ODM_delay_ms(IQK_DELAY_TIME_88E);
-
- // Check failed
- regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC));
- regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94));
- regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C));
- regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4));
-
- if(!(regEAC & BIT28) &&
- (((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
- RT_DISP(FINIT, INIT_IQK, ("Path A Rx IQK fail!!\n"));
-#endif
-
- return result;
-
-
- }
-
-u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK
-phy_PathA_RxIQK(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN configPathB
- )
-{
- u4Byte regEAC, regE94, regE9C, regEA4, u4tmp;
- u1Byte result = 0x00;
-#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 Rx IQK!\n"));
-
- //1 Get TXIMR setting
- //modify RXIQK mode table
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table!\n"));
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
- 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_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000);
-
- //IQK setting
- ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00);
- ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x81004800);
-
- //path-A IQK setting
- ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1c);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x30008c1c);
- ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160804);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160000);
-
- //LO calibration setting
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n"));
- ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x0046a911);
-
- //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, 0xf9000000);
- ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000);
-
- // delay x ms
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E));
- //PlatformStallExecution(IQK_DELAY_TIME_88E*1000);
- ODM_delay_ms(IQK_DELAY_TIME_88E);
-
-
- // Check failed
- regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC));
- regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94));
- regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C));
-
- if(!(regEAC & BIT28) &&
- (((regE94 & 0x03FF0000)>>16) != 0x142) &&
- (((regE9C & 0x03FF0000)>>16) != 0x42) )
- result |= 0x01;
- else //if Tx not OK, ignore Rx
- return result;
-
- u4tmp = 0x80007C00 | (regE94&0x3FF0000) | ((regE9C&0x3FF0000) >> 16);
- ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, u4tmp);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe40 = 0x%x u4tmp = 0x%x \n", ODM_GetBBReg(pDM_Odm, rTx_IQK, bMaskDWord), u4tmp));
-
-
- //1 RX IQK
- //modify RXIQK mode table
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table 2!\n"));
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
- 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, 0xf7ffa );
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000);
-
- //IQK setting
- ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800);
-
- //path-A IQK setting
- ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x30008c1c);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x10008c1c);
- ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160c05);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160c05);
-
- //LO calibration setting
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n"));
- ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x0046a911);
-
- //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, 0xf9000000);
- ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000);
-
- // delay x ms
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E));
- //PlatformStallExecution(IQK_DELAY_TIME_88E*1000);
- ODM_delay_ms(IQK_DELAY_TIME_88E);
-
- // Check failed
- regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC));
- regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94));
- regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C));
- regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4));
-
-#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"));
-
- return result;
-
-
-}
-
-u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK
-phy_PathB_IQK_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm
-#else
- IN PADAPTER pAdapter
-#endif
- )
-{
- u4Byte regEAC, regEB4, regEBC, regEC4, regECC;
- u1Byte result = 0x00;
-#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 B IQK!\n"));
-
- //One shot, path B 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_Cont, bMaskDWord, 0x00000002);
- ODM_SetBBReg(pDM_Odm, rIQK_AGC_Cont, bMaskDWord, 0x00000000);
-
- // delay x ms
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path B LOK & IQK.\n", IQK_DELAY_TIME_88E));
- //PlatformStallExecution(IQK_DELAY_TIME_88E*1000);
- ODM_delay_ms(IQK_DELAY_TIME_88E);
-
- // Check failed
- regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC));
- regEB4 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeb4 = 0x%x\n", regEB4));
- regEBC= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xebc = 0x%x\n", regEBC));
- regEC4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_B_2, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xec4 = 0x%x\n", regEC4));
- regECC= ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xecc = 0x%x\n", regECC));
-
- if(!(regEAC & BIT31) &&
- (((regEB4 & 0x03FF0000)>>16) != 0x142) &&
- (((regEBC & 0x03FF0000)>>16) != 0x42))
- result |= 0x01;
- else
- return result;
-
- 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"));
-
-
- return result;
-
-}
-
-VOID
-_PHY_PathAFillIQKMatrix(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN bIQKOK,
- IN s4Byte result[][8],
- IN u1Byte final_candidate,
- IN BOOLEAN bTxOnly
- )
-{
- u4Byte Oldval_0, X, TX0_A, reg;
- s4Byte Y, TX0_C;
-#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 IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed"));
-
- if(final_candidate == 0xFF)
- return;
-
- else if(bIQKOK)
- {
- Oldval_0 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord) >> 22) & 0x3FF;
-
- X = result[final_candidate][0];
- if ((X & 0x00000200) != 0)
- X = X | 0xFFFFFC00;
- TX0_A = (X * Oldval_0) >> 8;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX0_A = 0x%x, Oldval_0 0x%x\n", X, TX0_A, Oldval_0));
- ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, 0x3FF, TX0_A);
-
- ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(31), ((X* Oldval_0>>7) & 0x1));
-
- Y = result[final_candidate][1];
- if ((Y & 0x00000200) != 0)
- Y = Y | 0xFFFFFC00;
-
-
- TX0_C = (Y * Oldval_0) >> 8;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Y = 0x%x, TX = 0x%x\n", Y, TX0_C));
- ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, 0xF0000000, ((TX0_C&0x3C0)>>6));
- ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, 0x003F0000, (TX0_C&0x3F));
-
- ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(29), ((Y* Oldval_0>>7) & 0x1));
-
- if(bTxOnly)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("_PHY_PathAFillIQKMatrix only Tx OK\n"));
- return;
- }
-
- reg = result[final_candidate][2];
-#if (DM_ODM_SUPPORT_TYPE==ODM_AP)
- if( RTL_ABS(reg ,0x100) >= 16)
- reg = 0x100;
-#endif
- ODM_SetBBReg(pDM_Odm, rOFDM0_XARxIQImbalance, 0x3FF, reg);
-
- reg = result[final_candidate][3] & 0x3F;
- ODM_SetBBReg(pDM_Odm, rOFDM0_XARxIQImbalance, 0xFC00, reg);
-
- reg = (result[final_candidate][3] >> 6) & 0xF;
- ODM_SetBBReg(pDM_Odm, rOFDM0_RxIQExtAnta, 0xF0000000, reg);
- }
-}
-
-VOID
-_PHY_PathBFillIQKMatrix(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN bIQKOK,
- IN s4Byte result[][8],
- IN u1Byte final_candidate,
- IN BOOLEAN bTxOnly //do Tx only
- )
-{
- u4Byte Oldval_1, X, TX1_A, reg;
- s4Byte Y, TX1_C;
-#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 B IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed"));
-
- if(final_candidate == 0xFF)
- return;
-
- else if(bIQKOK)
- {
- Oldval_1 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord) >> 22) & 0x3FF;
-
- X = result[final_candidate][4];
- if ((X & 0x00000200) != 0)
- X = X | 0xFFFFFC00;
- TX1_A = (X * Oldval_1) >> 8;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX1_A = 0x%x\n", X, TX1_A));
- ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, 0x3FF, TX1_A);
-
- ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(27), ((X* Oldval_1>>7) & 0x1));
-
- Y = result[final_candidate][5];
- if ((Y & 0x00000200) != 0)
- Y = Y | 0xFFFFFC00;
-
- TX1_C = (Y * Oldval_1) >> 8;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Y = 0x%x, TX1_C = 0x%x\n", Y, TX1_C));
- ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, 0xF0000000, ((TX1_C&0x3C0)>>6));
- ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, 0x003F0000, (TX1_C&0x3F));
-
- ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(25), ((Y* Oldval_1>>7) & 0x1));
-
- if(bTxOnly)
- return;
-
- reg = result[final_candidate][6];
- ODM_SetBBReg(pDM_Odm, rOFDM0_XBRxIQImbalance, 0x3FF, reg);
-
- reg = result[final_candidate][7] & 0x3F;
- ODM_SetBBReg(pDM_Odm, rOFDM0_XBRxIQImbalance, 0xFC00, reg);
-
- reg = (result[final_candidate][7] >> 6) & 0xF;
- ODM_SetBBReg(pDM_Odm, rOFDM0_AGCRSSITable, 0x0000F000, reg);
- }
-}
-
-//
-// 2011/07/26 MH Add an API for testing IQK fail case.
-//
-// MP Already declare in odm.c
-#if !(DM_ODM_SUPPORT_TYPE & ODM_WIN)
-BOOLEAN
-ODM_CheckPowerStatus(
- IN PADAPTER Adapter)
-{
-/*
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
- RT_RF_POWER_STATE rtState;
- PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
-
- // 2011/07/27 MH We are not testing ready~~!! We may fail to get correct value when init sequence.
- if (pMgntInfo->init_adpt_in_progress == TRUE)
- {
- ODM_RT_TRACE(pDM_Odm,COMP_INIT, DBG_LOUD, ("ODM_CheckPowerStatus Return TRUE, due to initadapter"));
- return TRUE;
- }
-
- //
- // 2011/07/19 MH We can not execute tx pwoer tracking/ LLC calibrate or IQK.
- //
- Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState));
- if(Adapter->bDriverStopped || Adapter->bDriverIsGoingToPnpSetPowerSleep || rtState == eRfOff)
- {
- ODM_RT_TRACE(pDM_Odm,COMP_INIT, DBG_LOUD, ("ODM_CheckPowerStatus Return FALSE, due to %d/%d/%d\n",
- Adapter->bDriverStopped, Adapter->bDriverIsGoingToPnpSetPowerSleep, rtState));
- return FALSE;
- }
-*/
- return TRUE;
-}
-#endif
-
-VOID
-_PHY_SaveADDARegisters(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte ADDAReg,
- IN pu4Byte ADDABackup,
- IN u4Byte RegisterNum
- )
-{
- u4Byte i;
-#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
-
- if (ODM_CheckPowerStatus(pAdapter) == FALSE)
- return;
-#endif
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save ADDA parameters.\n"));
- for( i = 0 ; i < RegisterNum ; i++){
- ADDABackup[i] = ODM_GetBBReg(pDM_Odm, ADDAReg[i], bMaskDWord);
- }
-}
-
-
-VOID
-_PHY_SaveMACRegisters(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte MACReg,
- IN pu4Byte MACBackup
- )
-{
- u4Byte i;
-#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, ("Save MAC parameters.\n"));
- for( i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++){
- MACBackup[i] = ODM_Read1Byte(pDM_Odm, MACReg[i]);
- }
- MACBackup[i] = ODM_Read4Byte(pDM_Odm, MACReg[i]);
-
-}
-
-
-VOID
-_PHY_ReloadADDARegisters(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte ADDAReg,
- IN pu4Byte ADDABackup,
- IN u4Byte RegiesterNum
- )
-{
- u4Byte i;
-#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, ("Reload ADDA power saving parameters !\n"));
- for(i = 0 ; i < RegiesterNum; i++)
- {
- ODM_SetBBReg(pDM_Odm, ADDAReg[i], bMaskDWord, ADDABackup[i]);
- }
-}
-
-VOID
-_PHY_ReloadMACRegisters(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte MACReg,
- IN pu4Byte MACBackup
- )
-{
- u4Byte i;
-#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, ("Reload MAC parameters !\n"));
- for(i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++){
- ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)MACBackup[i]);
- }
- ODM_Write4Byte(pDM_Odm, MACReg[i], MACBackup[i]);
-}
-
-
-VOID
-_PHY_PathADDAOn(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte ADDAReg,
- IN BOOLEAN isPathAOn,
- IN BOOLEAN is2T
- )
-{
- u4Byte pathOn;
- u4Byte i;
-#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, ("ADDA ON.\n"));
-
- pathOn = isPathAOn ? 0x04db25a4 : 0x0b1b25a4;
- if(FALSE == is2T){
- pathOn = 0x0bdb25a0;
- ODM_SetBBReg(pDM_Odm, ADDAReg[0], bMaskDWord, 0x0b1b25a0);
- }
- else{
- ODM_SetBBReg(pDM_Odm,ADDAReg[0], bMaskDWord, pathOn);
- }
-
- for( i = 1 ; i < IQK_ADDA_REG_NUM ; i++){
- ODM_SetBBReg(pDM_Odm,ADDAReg[i], bMaskDWord, pathOn);
- }
-
-}
-
-VOID
-_PHY_MACSettingCalibration(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte MACReg,
- IN pu4Byte MACBackup
- )
-{
- u4Byte i = 0;
-#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, ("MAC settings for Calibration.\n"));
-
- ODM_Write1Byte(pDM_Odm, MACReg[i], 0x3F);
-
- for(i = 1 ; i < (IQK_MAC_REG_NUM - 1); i++){
- ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)(MACBackup[i]&(~BIT3)));
- }
- ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)(MACBackup[i]&(~BIT5)));
-
-}
-
-VOID
-_PHY_PathAStandBy(
-#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, bMaskDWord, 0x0);
- ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x00010000);
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000);
-}
-
-VOID
-_PHY_PIModeSwitch(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN PIMode
- )
-{
- u4Byte mode;
-#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, ("BB Switch to %s mode!\n", (PIMode ? "PI" : "SI")));
-
- mode = PIMode ? 0x01000100 : 0x01000000;
- ODM_SetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, bMaskDWord, mode);
- ODM_SetBBReg(pDM_Odm, rFPGA0_XB_HSSIParameter1, bMaskDWord, mode);
-}
-
-BOOLEAN
-phy_SimularityCompare_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN s4Byte result[][8],
- IN u1Byte c1,
- IN u1Byte c2
- )
-{
- u4Byte i, j, diff, SimularityBitMap, bound = 0;
-#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
- u1Byte final_candidate[2] = {0xFF, 0xFF}; //for path A and path B
- BOOLEAN bResult = TRUE;
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- BOOLEAN is2T = IS_92C_SERIAL( pHalData->VersionID);
-#else
- BOOLEAN is2T = 0;
-#endif
-
- if(is2T)
- bound = 8;
- else
- bound = 4;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("===> IQK:phy_SimularityCompare_8188E c1 %d c2 %d!!!\n", c1, c2));
-
-
- SimularityBitMap = 0;
-
- for( i = 0; i < bound; i++ )
- {
- diff = (result[c1][i] > result[c2][i]) ? (result[c1][i] - result[c2][i]) : (result[c2][i] - result[c1][i]);
- if (diff > MAX_TOLERANCE)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:phy_SimularityCompare_8188E differnece overflow index %d compare1 0x%x compare2 0x%x!!!\n", i, result[c1][i], result[c2][i]));
-
- if((i == 2 || i == 6) && !SimularityBitMap)
- {
- if(result[c1][i]+result[c1][i+1] == 0)
- final_candidate[(i/4)] = c2;
- else if (result[c2][i]+result[c2][i+1] == 0)
- final_candidate[(i/4)] = c1;
- else
- SimularityBitMap = SimularityBitMap|(1<<i);
- }
- else
- SimularityBitMap = SimularityBitMap|(1<<i);
- }
- }
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:phy_SimularityCompare_8188E SimularityBitMap %d !!!\n", SimularityBitMap));
-
- if ( SimularityBitMap == 0)
- {
- for( i = 0; i < (bound/4); i++ )
- {
- if(final_candidate[i] != 0xFF)
- {
- for( j = i*4; j < (i+1)*4-2; j++)
- result[3][j] = result[final_candidate[i]][j];
- bResult = FALSE;
- }
- }
- return bResult;
- }
- else if (!(SimularityBitMap & 0x0F)) //path A OK
- {
- for(i = 0; i < 4; i++)
- result[3][i] = result[c1][i];
- return FALSE;
- }
- else if (!(SimularityBitMap & 0xF0) && is2T) //path B OK
- {
- for(i = 4; i < 8; i++)
- result[3][i] = result[c1][i];
- return FALSE;
- }
- else
- return FALSE;
-
-}
-
-
-
-VOID
-phy_IQCalibrate_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN s4Byte result[][8],
- IN u1Byte t,
- IN BOOLEAN is2T
- )
-{
-#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
- u4Byte i;
- u1Byte PathAOK=0, PathBOK=0;
- u4Byte ADDA_REG[IQK_ADDA_REG_NUM] = {
- rFPGA0_XCD_SwitchControl, rBlue_Tooth,
- rRx_Wait_CCA, rTx_CCK_RFON,
- rTx_CCK_BBON, rTx_OFDM_RFON,
- rTx_OFDM_BBON, rTx_To_Rx,
- rTx_To_Tx, rRx_CCK,
- rRx_OFDM, rRx_Wait_RIFS,
- rRx_TO_Rx, rStandby,
- rSleep, rPMPD_ANAEN };
- u4Byte IQK_MAC_REG[IQK_MAC_REG_NUM] = {
- REG_TXPAUSE, REG_BCN_CTRL,
- REG_BCN_CTRL_1, REG_GPIO_MUXCFG};
-
- //since 92C & 92D have the different define in IQK_BB_REG
- u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = {
- rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar,
- rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB,
- rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE,
- rFPGA0_XB_RFInterfaceOE, rCCK0_AFESetting
- };
-
- u4Byte retryCount = 2;
-
- if ( *(pDM_Odm->mp_mode) == 1)
- retryCount = 9;
-
- // Note: IQ calibration must be performed after loading
- // PHY_REG.txt , and radio_a, radio_b.txt
-
- //u4Byte bbvalue;
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
-#ifdef MP_TEST
- if(pDM_Odm->priv->pshare->rf_ft_var.mp_specific)
- retryCount = 9;
-#endif
-#endif
-
-
- if(t==0)
- {
-// bbvalue = ODM_GetBBReg(pDM_Odm, rFPGA0_RFMOD, bMaskDWord);
-// RT_DISP(FINIT, INIT_IQK, ("phy_IQCalibrate_8188E()==>0x%08x\n",bbvalue));
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t));
-
- // Save ADDA parameters, turn Path A ADDA on
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_SaveADDARegisters(pAdapter, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM);
- _PHY_SaveMACRegisters(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
- _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM);
-#else
- _PHY_SaveADDARegisters(pDM_Odm, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM);
- _PHY_SaveMACRegisters(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
- _PHY_SaveADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM);
-#endif
- }
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t));
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
- _PHY_PathADDAOn(pAdapter, ADDA_REG, TRUE, is2T);
-#else
- _PHY_PathADDAOn(pDM_Odm, ADDA_REG, TRUE, is2T);
-#endif
-
-
- if(t==0)
- {
- pDM_Odm->RFCalibrateInfo.bRfPiEnable = (u1Byte)ODM_GetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, BIT(8));
- }
-
- if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){
- // Switch BB to PI mode to do IQ Calibration.
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_PIModeSwitch(pAdapter, TRUE);
-#else
- _PHY_PIModeSwitch(pDM_Odm, TRUE);
-#endif
- }
-
-
- //MAC settings
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_MACSettingCalibration(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
-#else
- _PHY_MACSettingCalibration(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
-#endif
-
- //BB setting
- //ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 0x00);
- 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, 0x22204000);
-
-
- 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, 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);
- }
-
- //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, rTx_IQK, bMaskDWord, 0x01007c00);
- ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x81004800);
-
- for(i = 0 ; i < retryCount ; i++){
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- PathAOK = phy_PathA_IQK_8188E(pAdapter, is2T);
-#else
- PathAOK = phy_PathA_IQK_8188E(pDM_Odm, is2T);
-#endif
-// if(PathAOK == 0x03){
- if(PathAOK == 0x01){
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Tx IQK Success!!\n"));
- result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16;
- result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16;
- break;
- }
-#if 0
- else if (i == (retryCount-1) && PathAOK == 0x01) //Tx IQK OK
- {
- RT_DISP(FINIT, INIT_IQK, ("Path A IQK Only Tx Success!!\n"));
-
- result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16;
- result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16;
- }
-#endif
- }
-
- for(i = 0 ; i < retryCount ; i++){
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- PathAOK = phy_PathA_RxIQK(pAdapter, is2T);
-#else
- PathAOK = phy_PathA_RxIQK(pDM_Odm, is2T);
-#endif
- if(PathAOK == 0x03){
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Success!!\n"));
-// result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16;
-// result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16;
- result[t][2] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord)&0x3FF0000)>>16;
- result[t][3] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord)&0x3FF0000)>>16;
- break;
- }
- else
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Fail!!\n"));
- }
- }
-
- if(0x00 == PathAOK){
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK failed!!\n"));
- }
-
- if(is2T){
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_PathAStandBy(pAdapter);
-
- // Turn Path B ADDA on
- _PHY_PathADDAOn(pAdapter, ADDA_REG, FALSE, is2T);
-#else
- _PHY_PathAStandBy(pDM_Odm);
-
- // Turn Path B ADDA on
- _PHY_PathADDAOn(pDM_Odm, ADDA_REG, FALSE, is2T);
-#endif
-
- for(i = 0 ; i < retryCount ; i++){
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- PathBOK = phy_PathB_IQK_8188E(pAdapter);
-#else
- PathBOK = phy_PathB_IQK_8188E(pDM_Odm);
-#endif
- if(PathBOK == 0x03){
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK Success!!\n"));
- result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16;
- result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16;
- result[t][6] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_B_2, bMaskDWord)&0x3FF0000)>>16;
- result[t][7] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord)&0x3FF0000)>>16;
- break;
- }
- else if (i == (retryCount - 1) && PathBOK == 0x01) //Tx IQK OK
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Only Tx IQK Success!!\n"));
- result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16;
- result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16;
- }
- }
-
- if(0x00 == PathBOK){
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK failed!!\n"));
- }
- }
-
- //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);
-
- if(t!=0)
- {
- if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){
- // Switch back BB to SI mode after finish IQ Calibration.
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_PIModeSwitch(pAdapter, FALSE);
-#else
- _PHY_PIModeSwitch(pDM_Odm, FALSE);
-#endif
- }
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
- // Reload ADDA power saving parameters
- _PHY_ReloadADDARegisters(pAdapter, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM);
-
- // Reload MAC parameters
- _PHY_ReloadMACRegisters(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
-
- _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM);
-#else
- // Reload ADDA power saving parameters
- _PHY_ReloadADDARegisters(pDM_Odm, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM);
-
- // Reload MAC parameters
- _PHY_ReloadMACRegisters(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
-
- _PHY_ReloadADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM);
-#endif
-
-
- // Restore RX initial gain
- ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00032ed3);
- if(is2T){
- ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00032ed3);
- }
-
- //load 0xe30 IQC default value
- ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00);
-
- }
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_IQCalibrate_8188E() <==\n"));
-
-}
-
-
-VOID
-phy_LCCalibrate_8188E(
- IN PDM_ODM_T pDM_Odm,
- IN BOOLEAN is2T
- )
-{
- u1Byte tmpReg;
- u4Byte RF_Amode=0, RF_Bmode=0, LC_Cal;
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- PADAPTER pAdapter = pDM_Odm->Adapter;
-#endif
- //Check continuous TX and Packet TX
- tmpReg = ODM_Read1Byte(pDM_Odm, 0xd03);
-
- if((tmpReg&0x70) != 0) //Deal with contisuous TX case
- ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg&0x8F); //disable all continuous TX
- else // Deal with Packet TX case
- ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0xFF); // block all queues
-
- if((tmpReg&0x70) != 0)
- {
- //1. Read original RF mode
- //Path-A
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- RF_Amode = PHY_QueryRFReg(pAdapter, ODM_RF_PATH_A, RF_AC, bMask12Bits);
-
- //Path-B
- if(is2T)
- RF_Bmode = PHY_QueryRFReg(pAdapter, ODM_RF_PATH_B, RF_AC, bMask12Bits);
-#else
- RF_Amode = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMask12Bits);
-
- //Path-B
- if(is2T)
- RF_Bmode = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMask12Bits);
-#endif
-
- //2. Set RF mode = standby mode
- //Path-A
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode&0x8FFFF)|0x10000);
-
- //Path-B
- if(is2T)
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode&0x8FFFF)|0x10000);
- }
-
- //3. Read RF reg18
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- LC_Cal = PHY_QueryRFReg(pAdapter, ODM_RF_PATH_A, RF_CHNLBW, bMask12Bits);
-#else
- LC_Cal = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bMask12Bits);
-#endif
-
- //4. Set LC calibration begin bit15
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bMask12Bits, LC_Cal|0x08000);
-
- ODM_delay_ms(100);
-
-
- //Restore original situation
- if((tmpReg&0x70) != 0) //Deal with contisuous TX case
- {
- //Path-A
- ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg);
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMask12Bits, RF_Amode);
-
- //Path-B
- if(is2T)
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode);
- }
- else // Deal with Packet TX case
- {
- ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0x00);
- }
-}
-
-//Analog Pre-distortion calibration
-#define APK_BB_REG_NUM 8
-#define APK_CURVE_REG_NUM 4
-#define PATH_NUM 2
-
-VOID
-phy_APCalibrate_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN s1Byte delta,
- IN BOOLEAN is2T
- )
-{
-#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
- u4Byte regD[PATH_NUM];
- u4Byte tmpReg, index, offset, apkbound;
- u1Byte path, i, pathbound = PATH_NUM;
- u4Byte BB_backup[APK_BB_REG_NUM];
- u4Byte BB_REG[APK_BB_REG_NUM] = {
- rFPGA1_TxBlock, rOFDM0_TRxPathEnable,
- rFPGA0_RFMOD, rOFDM0_TRMuxPar,
- rFPGA0_XCD_RFInterfaceSW, rFPGA0_XAB_RFInterfaceSW,
- rFPGA0_XA_RFInterfaceOE, rFPGA0_XB_RFInterfaceOE };
- u4Byte BB_AP_MODE[APK_BB_REG_NUM] = {
- 0x00000020, 0x00a05430, 0x02040000,
- 0x000800e4, 0x00204000 };
- u4Byte BB_normal_AP_MODE[APK_BB_REG_NUM] = {
- 0x00000020, 0x00a05430, 0x02040000,
- 0x000800e4, 0x22204000 };
-
- u4Byte AFE_backup[IQK_ADDA_REG_NUM];
- u4Byte AFE_REG[IQK_ADDA_REG_NUM] = {
- rFPGA0_XCD_SwitchControl, rBlue_Tooth,
- rRx_Wait_CCA, rTx_CCK_RFON,
- rTx_CCK_BBON, rTx_OFDM_RFON,
- rTx_OFDM_BBON, rTx_To_Rx,
- rTx_To_Tx, rRx_CCK,
- rRx_OFDM, rRx_Wait_RIFS,
- rRx_TO_Rx, rStandby,
- rSleep, rPMPD_ANAEN };
-
- u4Byte MAC_backup[IQK_MAC_REG_NUM];
- u4Byte MAC_REG[IQK_MAC_REG_NUM] = {
- REG_TXPAUSE, REG_BCN_CTRL,
- REG_BCN_CTRL_1, REG_GPIO_MUXCFG};
-
- u4Byte APK_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = {
- {0x0852c, 0x1852c, 0x5852c, 0x1852c, 0x5852c},
- {0x2852e, 0x0852e, 0x3852e, 0x0852e, 0x0852e}
- };
-
- u4Byte APK_normal_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = {
- {0x0852c, 0x0a52c, 0x3a52c, 0x5a52c, 0x5a52c}, //path settings equal to path b settings
- {0x0852c, 0x0a52c, 0x5a52c, 0x5a52c, 0x5a52c}
- };
-
- u4Byte APK_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = {
- {0x52019, 0x52014, 0x52013, 0x5200f, 0x5208d},
- {0x5201a, 0x52019, 0x52016, 0x52033, 0x52050}
- };
-
- u4Byte APK_normal_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = {
- {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}, //path settings equal to path b settings
- {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}
- };
-
- u4Byte AFE_on_off[PATH_NUM] = {
- 0x04db25a4, 0x0b1b25a4}; //path A on path B off / path A off path B on
-
- u4Byte APK_offset[PATH_NUM] = {
- rConfig_AntA, rConfig_AntB};
-
- u4Byte APK_normal_offset[PATH_NUM] = {
- rConfig_Pmpd_AntA, rConfig_Pmpd_AntB};
-
- u4Byte APK_value[PATH_NUM] = {
- 0x92fc0000, 0x12fc0000};
-
- u4Byte APK_normal_value[PATH_NUM] = {
- 0x92680000, 0x12680000};
-
- s1Byte APK_delta_mapping[APK_BB_REG_NUM][13] = {
- {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
- {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
- {-6, -4, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
- {-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6},
- {-11, -9, -7, -5, -3, -1, 0, 0, 0, 0, 0, 0, 0}
- };
-
- u4Byte APK_normal_setting_value_1[13] = {
- 0x01017018, 0xf7ed8f84, 0x1b1a1816, 0x2522201e, 0x322e2b28,
- 0x433f3a36, 0x5b544e49, 0x7b726a62, 0xa69a8f84, 0xdfcfc0b3,
- 0x12680000, 0x00880000, 0x00880000
- };
-
- u4Byte APK_normal_setting_value_2[16] = {
- 0x01c7021d, 0x01670183, 0x01000123, 0x00bf00e2, 0x008d00a3,
- 0x0068007b, 0x004d0059, 0x003a0042, 0x002b0031, 0x001f0025,
- 0x0017001b, 0x00110014, 0x000c000f, 0x0009000b, 0x00070008,
- 0x00050006
- };
-
- u4Byte APK_result[PATH_NUM][APK_BB_REG_NUM]; //val_1_1a, val_1_2a, val_2a, val_3a, val_4a
-// u4Byte AP_curve[PATH_NUM][APK_CURVE_REG_NUM];
-
- s4Byte BB_offset, delta_V, delta_offset;
-
-#if MP_DRIVER == 1
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx);
-#else
- PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx);
-#endif
-
- if ( *(pDM_Odm->mp_mode) == 1)
- {
- pMptCtx->APK_bound[0] = 45;
- pMptCtx->APK_bound[1] = 52;
- }
-#endif
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("==>phy_APCalibrate_8188E() delta %d\n", delta));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("AP Calibration for %s\n", (is2T ? "2T2R" : "1T1R")));
- if(!is2T)
- pathbound = 1;
-
- //2 FOR NORMAL CHIP SETTINGS
-
-// Temporarily do not allow normal driver to do the following settings because these offset
-// and value will cause RF internal PA to be unpredictably disabled by HW, such that RF Tx signal
-// 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)
- return;
-//#endif
- //settings adjust for normal chip
- for(index = 0; index < PATH_NUM; index ++)
- {
- APK_offset[index] = APK_normal_offset[index];
- APK_value[index] = APK_normal_value[index];
- AFE_on_off[index] = 0x6fdb25a4;
- }
-
- for(index = 0; index < APK_BB_REG_NUM; index ++)
- {
- for(path = 0; path < pathbound; path++)
- {
- APK_RF_init_value[path][index] = APK_normal_RF_init_value[path][index];
- APK_RF_value_0[path][index] = APK_normal_RF_value_0[path][index];
- }
- BB_AP_MODE[index] = BB_normal_AP_MODE[index];
- }
-
- apkbound = 6;
-
- //save BB default value
- for(index = 0; index < APK_BB_REG_NUM ; index++)
- {
- if(index == 0) //skip
- continue;
- BB_backup[index] = ODM_GetBBReg(pDM_Odm, BB_REG[index], bMaskDWord);
- }
-
- //save MAC default value
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_SaveMACRegisters(pAdapter, MAC_REG, MAC_backup);
-
- //save AFE default value
- _PHY_SaveADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-#else
- _PHY_SaveMACRegisters(pDM_Odm, MAC_REG, MAC_backup);
-
- //save AFE default value
- _PHY_SaveADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-#endif
-
- for(path = 0; path < pathbound; path++)
- {
-
-
- if(path == ODM_RF_PATH_A)
- {
- //path A APK
- //load APK setting
- //path-A
- offset = rPdp_AntA;
- for(index = 0; index < 11; index ++)
- {
- ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
-
- offset += 0x04;
- }
-
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000);
-
- offset = rConfig_AntA;
- for(; index < 13; index ++)
- {
- ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
-
- offset += 0x04;
- }
-
- //page-B1
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000);
-
- //path A
- offset = rPdp_AntA;
- for(index = 0; index < 16; index++)
- {
- ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_2[index]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
-
- offset += 0x04;
- }
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
- }
- else if(path == ODM_RF_PATH_B)
- {
- //path B APK
- //load APK setting
- //path-B
- offset = rPdp_AntB;
- for(index = 0; index < 10; index ++)
- {
- ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
-
- offset += 0x04;
- }
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x12680000);
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- PHY_SetBBReg(pAdapter, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000);
-#else
- PHY_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000);
-#endif
-
- offset = rConfig_AntA;
- index = 11;
- for(; index < 13; index ++) //offset 0xb68, 0xb6c
- {
- ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
-
- offset += 0x04;
- }
-
- //page-B1
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000);
-
- //path B
- offset = 0xb60;
- for(index = 0; index < 16; index++)
- {
- ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_2[index]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
-
- offset += 0x04;
- }
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0);
- }
-
- //save RF default value
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- regD[path] = PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bMaskDWord);
-#else
- regD[path] = ODM_GetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_TXBIAS_A, bMaskDWord);
-#endif
-
- //Path A AFE all on, path B AFE All off or vise versa
- for(index = 0; index < IQK_ADDA_REG_NUM ; index++)
- ODM_SetBBReg(pDM_Odm, AFE_REG[index], bMaskDWord, AFE_on_off[path]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xe70 %x\n", ODM_GetBBReg(pDM_Odm, rRx_Wait_CCA, bMaskDWord)));
-
- //BB to AP mode
- if(path == 0)
- {
- for(index = 0; index < APK_BB_REG_NUM ; index++)
- {
-
- if(index == 0) //skip
- continue;
- else if (index < 5)
- ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_AP_MODE[index]);
- else if (BB_REG[index] == 0x870)
- ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]|BIT10|BIT26);
- else
- ODM_SetBBReg(pDM_Odm, BB_REG[index], BIT10, 0x0);
- }
-
- ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00);
- }
- else //path B
- {
- ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x01008c00);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x01008c00);
-
- }
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x800 %x\n", ODM_GetBBReg(pDM_Odm, 0x800, bMaskDWord)));
-
- //MAC settings
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_MACSettingCalibration(pAdapter, MAC_REG, MAC_backup);
-#else
- _PHY_MACSettingCalibration(pDM_Odm, MAC_REG, MAC_backup);
-#endif
-
- if(path == ODM_RF_PATH_A) //Path B to standby mode
- {
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMaskDWord, 0x10000);
- }
- else //Path A to standby mode
- {
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMaskDWord, 0x10000);
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f);
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE2, bMaskDWord, 0x20103);
- }
-
- delta_offset = ((delta+14)/2);
- if(delta_offset < 0)
- delta_offset = 0;
- else if (delta_offset > 12)
- delta_offset = 12;
-
- //AP calibration
- for(index = 0; index < APK_BB_REG_NUM; index++)
- {
- if(index != 1) //only DO PA11+PAD01001, AP RF setting
- continue;
-
- tmpReg = APK_RF_init_value[path][index];
-#if 1
- if(!pDM_Odm->RFCalibrateInfo.bAPKThermalMeterIgnore)
- {
- BB_offset = (tmpReg & 0xF0000) >> 16;
-
- if(!(tmpReg & BIT15)) //sign bit 0
- {
- BB_offset = -BB_offset;
- }
-
- delta_V = APK_delta_mapping[index][delta_offset];
-
- BB_offset += delta_V;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() APK index %d tmpReg 0x%x delta_V %d delta_offset %d\n", index, tmpReg, delta_V, delta_offset));
-
- if(BB_offset < 0)
- {
- tmpReg = tmpReg & (~BIT15);
- BB_offset = -BB_offset;
- }
- else
- {
- tmpReg = tmpReg | BIT15;
- }
- tmpReg = (tmpReg & 0xFFF0FFFF) | (BB_offset << 16);
- }
-#endif
-
- ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_IPA_A, bMaskDWord, 0x8992e);
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xc %x\n", PHY_QueryRFReg(pAdapter, path, RF_IPA_A, bMaskDWord)));
- ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_AC, bMaskDWord, APK_RF_value_0[path][index]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x0 %x\n", PHY_QueryRFReg(pAdapter, path, RF_AC, bMaskDWord)));
- ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_TXBIAS_A, bMaskDWord, tmpReg);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xd %x\n", PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bMaskDWord)));
-#else
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xc %x\n", ODM_GetRFReg(pDM_Odm, path, RF_IPA_A, bMaskDWord)));
- ODM_SetRFReg(pDM_Odm, path, RF_AC, bMaskDWord, APK_RF_value_0[path][index]);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x0 %x\n", ODM_GetRFReg(pDM_Odm, path, RF_AC, bMaskDWord)));
- ODM_SetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord, tmpReg);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xd %x\n", ODM_GetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord)));
-#endif
-
- // PA11+PAD01111, one shot
- i = 0;
- do
- {
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80000000);
- {
- 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)));
- ODM_delay_ms(3);
- ODM_SetBBReg(pDM_Odm, APK_offset[path], bMaskDWord, APK_value[1]);
- 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)));
-
- ODM_delay_ms(20);
- }
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
-
- if(path == ODM_RF_PATH_A)
- tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0x03E00000);
- else
- tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0xF8000000);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xbd8[25:21] %x\n", tmpReg));
-
-
- i++;
- }
- while(tmpReg > apkbound && i < 4);
-
- APK_result[path][index] = tmpReg;
- }
- }
-
- //reload MAC default value
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_ReloadMACRegisters(pAdapter, MAC_REG, MAC_backup);
-#else
- _PHY_ReloadMACRegisters(pDM_Odm, MAC_REG, MAC_backup);
-#endif
-
- //reload BB default value
- for(index = 0; index < APK_BB_REG_NUM ; index++)
- {
-
- if(index == 0) //skip
- continue;
- ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]);
- }
-
- //reload AFE default value
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_ReloadADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-#else
- _PHY_ReloadADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-#endif
-
- //reload RF path default value
- for(path = 0; path < pathbound; path++)
- {
- ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, 0xd, bMaskDWord, regD[path]);
- if(path == ODM_RF_PATH_B)
- {
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f);
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE2, bMaskDWord, 0x20101);
- }
-
- //note no index == 0
- if (APK_result[path][1] > 6)
- APK_result[path][1] = 6;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("apk path %d result %d 0x%x \t", path, 1, APK_result[path][1]));
- }
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("\n"));
-
-
- for(path = 0; path < pathbound; path++)
- {
- ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, 0x3, bMaskDWord,
- ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (APK_result[path][1] << 5) | APK_result[path][1]));
- if(path == ODM_RF_PATH_A)
- ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, 0x4, bMaskDWord,
- ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x00 << 5) | 0x05));
- else
- ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, 0x4, bMaskDWord,
- ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x02 << 5) | 0x05));
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if(!IS_HARDWARE_TYPE_8723A(pAdapter))
- ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_BS_PA_APSET_G9_G11, bMaskDWord,
- ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | 0x08));
-#endif
- }
-
- pDM_Odm->RFCalibrateInfo.bAPKdone = TRUE;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("<==phy_APCalibrate_8188E()\n"));
-}
-
-
-
-#define DP_BB_REG_NUM 7
-#define DP_RF_REG_NUM 1
-#define DP_RETRY_LIMIT 10
-#define DP_PATH_NUM 2
-#define DP_DPK_NUM 3
-#define DP_DPK_VALUE_NUM 2
-
-
-
-
-
-VOID
-PHY_IQCalibrate_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN bReCovery
- )
-{
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-
- #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
- #else // (DM_ODM_SUPPORT_TYPE == ODM_CE)
- PDM_ODM_T pDM_Odm = &pHalData->odmpriv;
- #endif
-
- #if (MP_DRIVER == 1)
- #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx);
- #else// (DM_ODM_SUPPORT_TYPE == ODM_CE)
- PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx);
- #endif
- #endif//(MP_DRIVER == 1)
-#endif
-
- s4Byte result[4][8]; //last is final result
- u1Byte i, final_candidate, Indexforchannel;
- u1Byte channelToIQK = 7;
- BOOLEAN bPathAOK, bPathBOK;
- s4Byte RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC, RegTmp = 0;
- BOOLEAN is12simular, is13simular, is23simular;
- BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE;
- u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = {
- rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance,
- rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable,
- rOFDM0_XATxIQImbalance, rOFDM0_XBTxIQImbalance,
- rOFDM0_XCTxAFE, rOFDM0_XDTxAFE,
- rOFDM0_RxIQExtAnta};
- u4Byte StartTime;
- s4Byte ProgressingTime;
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE) )
- if (ODM_CheckPowerStatus(pAdapter) == FALSE)
- return;
-#else
- prtl8192cd_priv priv = pDM_Odm->priv;
-
-#ifdef MP_TEST
- if(priv->pshare->rf_ft_var.mp_specific)
- {
- if((OPMODE & WIFI_MP_CTX_PACKET) || (OPMODE & WIFI_MP_CTX_ST))
- return;
- }
-#endif
-
- if(priv->pshare->IQK_88E_done)
- bReCovery= 1;
- priv->pshare->IQK_88E_done = 1;
-
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION))
- {
- return;
- }
-#endif
-
-#if MP_DRIVER == 1
- if (*(pDM_Odm->mp_mode) == 1)
- {
- bStartContTx = pMptCtx->bStartContTx;
- bSingleTone = pMptCtx->bSingleTone;
- bCarrierSuppression = pMptCtx->bCarrierSuppression;
- }
-#endif
-
- // 20120213<Kordan> Turn on when continuous Tx to pass lab testing. (required by Edlu)
- if(bSingleTone || bCarrierSuppression)
- return;
-
-#if DISABLE_BB_RF
- return;
-#endif
-
- if (pDM_Odm->RFCalibrateInfo.bIQKInProgress)
- 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
- if(bReCovery && (!pAdapter->bInHctTest)) //YJ,add for PowerTest,120405
-#endif
- {
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("PHY_IQCalibrate_8188E: Return due to bReCovery!\n"));
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9);
-#else
- _PHY_ReloadADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9);
-#endif
- return;
- }
- StartTime = ODM_GetCurrentTime( pDM_Odm);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Start!!!\n"));
-
-
-
- for(i = 0; i < 8; i++)
- {
- result[0][i] = 0;
- result[1][i] = 0;
- result[2][i] = 0;
- result[3][i] = 0;
- }
- final_candidate = 0xff;
- bPathAOK = FALSE;
- bPathBOK = FALSE;
- is12simular = FALSE;
- is23simular = FALSE;
- is13simular = FALSE;
-
-
- for (i=0; i<3; i++)
- {
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
- if(IS_92C_SERIAL( pHalData->VersionID))
- {
- phy_IQCalibrate_8188E(pAdapter, result, i, TRUE);
- }
- else
-#endif
- {
- // For 88C 1T1R
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- phy_IQCalibrate_8188E(pAdapter, result, i, FALSE);
-#else
- phy_IQCalibrate_8188E(pDM_Odm, result, i, FALSE);
-#endif
- }
-
- if(i == 1)
- {
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- is12simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 1);
-#else
- is12simular = phy_SimularityCompare_8188E(pDM_Odm, result, 0, 1);
-#endif
- if(is12simular)
- {
- final_candidate = 0;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is12simular final_candidate is %x\n",final_candidate));
- break;
- }
- }
-
- if(i == 2)
- {
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- is13simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 2);
-#else
- is13simular = phy_SimularityCompare_8188E(pDM_Odm, result, 0, 2);
-#endif
- if(is13simular)
- {
- final_candidate = 0;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is13simular final_candidate is %x\n",final_candidate));
-
- break;
- }
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- is23simular = phy_SimularityCompare_8188E(pAdapter, result, 1, 2);
-#else
- is23simular = phy_SimularityCompare_8188E(pDM_Odm, result, 1, 2);
-#endif
- if(is23simular)
- {
- final_candidate = 1;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is23simular final_candidate is %x\n",final_candidate));
- }
- else
- {
- for(i = 0; i < 8; i++)
- RegTmp += result[3][i];
-
- if(RegTmp != 0)
- final_candidate = 3;
- else
- final_candidate = 0xFF;
- }
- }
- }
-// RT_TRACE(COMP_INIT,DBG_LOUD,("Release Mutex in IQCalibrate \n"));
-
- for (i=0; i<4; i++)
- {
- RegE94 = result[i][0];
- RegE9C = result[i][1];
- RegEA4 = result[i][2];
- RegEAC = result[i][3];
- RegEB4 = result[i][4];
- RegEBC = result[i][5];
- RegEC4 = result[i][6];
- RegECC = result[i][7];
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC));
- }
-
- if(final_candidate != 0xff)
- {
- pDM_Odm->RFCalibrateInfo.RegE94 = RegE94 = result[final_candidate][0];
- pDM_Odm->RFCalibrateInfo.RegE9C = RegE9C = result[final_candidate][1];
- RegEA4 = result[final_candidate][2];
- RegEAC = result[final_candidate][3];
- pDM_Odm->RFCalibrateInfo.RegEB4 = RegEB4 = result[final_candidate][4];
- pDM_Odm->RFCalibrateInfo.RegEBC = RegEBC = result[final_candidate][5];
- RegEC4 = result[final_candidate][6];
- RegECC = result[final_candidate][7];
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: final_candidate is %x\n",final_candidate));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC));
- bPathAOK = bPathBOK = TRUE;
- }
- else
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: FAIL use default value\n"));
-
- pDM_Odm->RFCalibrateInfo.RegE94 = pDM_Odm->RFCalibrateInfo.RegEB4 = 0x100; //X default value
- pDM_Odm->RFCalibrateInfo.RegE9C = pDM_Odm->RFCalibrateInfo.RegEBC = 0x0; //Y default value
- }
-
- if((RegE94 != 0)/*&&(RegEA4 != 0)*/)
- {
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_PathAFillIQKMatrix(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0));
-#else
- _PHY_PathAFillIQKMatrix(pDM_Odm, bPathAOK, result, final_candidate, (RegEA4 == 0));
-#endif
- }
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (IS_92C_SERIAL(pHalData->VersionID))
- {
- if((RegEB4 != 0)/*&&(RegEC4 != 0)*/)
- {
- _PHY_PathBFillIQKMatrix(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0));
- }
- }
-#endif
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel);
-#else
- Indexforchannel = 0;
-#endif
-
-//To Fix BSOD when final_candidate is 0xff
-//by sherry 20120321
- if(final_candidate < 4)
- {
- for(i = 0; i < IQK_Matrix_REG_NUM; i++)
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i];
- pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].bIQKDone = TRUE;
- }
- //RT_DISP(FINIT, INIT_IQK, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel));
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
- _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9);
-#else
- _PHY_SaveADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, IQK_BB_REG_NUM);
-#endif
-
- ODM_AcquireSpinLock(pDM_Odm, RT_IQK_SPINLOCK);
- pDM_Odm->RFCalibrateInfo.bIQKInProgress = FALSE;
- ODM_ReleaseSpinLock(pDM_Odm, RT_IQK_SPINLOCK);
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK finished\n"));
- ProgressingTime = ODM_GetProgressingTime( pDM_Odm, StartTime);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK ProgressingTime = %d\n", ProgressingTime));
-
-}
-
-
-VOID
-PHY_LCCalibrate_8188E(
- IN PDM_ODM_T pDM_Odm
- )
-{
- BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE;
- u4Byte timeout = 2000, timecount = 0;
- u4Byte StartTime;
- s4Byte ProgressingTime;
-
-
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- PADAPTER pAdapter = pDM_Odm->Adapter;
- //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-
- #if (MP_DRIVER == 1)
- #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx);
- #else// (DM_ODM_SUPPORT_TYPE == ODM_CE)
- PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx);
- #endif
- #endif//(MP_DRIVER == 1)
-#endif
-
-#if MP_DRIVER == 1
- if (*(pDM_Odm->mp_mode) == 1)
- {
- bStartContTx = pMptCtx->bStartContTx;
- bSingleTone = pMptCtx->bSingleTone;
- bCarrierSuppression = pMptCtx->bCarrierSuppression;
- }
-#endif
-
-
-#if DISABLE_BB_RF
- return;
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION))
- {
- return;
- }
-#endif
- // 20120213<Kordan> Turn on when continuous Tx to pass lab testing. (required by Edlu)
- if(bSingleTone || bCarrierSuppression)
- return;
-
- StartTime = ODM_GetCurrentTime( pDM_Odm);
- while(*(pDM_Odm->pbScanInProcess) && timecount < timeout)
- {
- ODM_delay_ms(50);
- timecount += 50;
- }
-
- pDM_Odm->RFCalibrateInfo.bLCKInProgress = TRUE;
-
- //ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Start!!!interface %d currentband %x delay %d ms\n", pDM_Odm->interfaceIndex, pHalData->CurrentBandType92D, timecount));
- phy_LCCalibrate_8188E(pDM_Odm, FALSE);
-
- pDM_Odm->RFCalibrateInfo.bLCKInProgress = FALSE;
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Finish!!!interface %d\n", pDM_Odm->InterfaceIndex));
- ProgressingTime = ODM_GetProgressingTime( pDM_Odm, StartTime);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK ProgressingTime = %d\n", ProgressingTime));
-}
-
-VOID
-PHY_APCalibrate_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN s1Byte delta
- )
-{
-#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
-#if DISABLE_BB_RF
- return;
-#endif
-
- return;
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION))
- {
- return;
- }
-#endif
-
-#if FOR_BRAZIL_PRETEST != 1
- if(pDM_Odm->RFCalibrateInfo.bAPKdone)
-#endif
- return;
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if(IS_92C_SERIAL( pHalData->VersionID)){
- phy_APCalibrate_8188E(pAdapter, delta, TRUE);
- }
- else
-#endif
- {
- // For 88C 1T1R
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- phy_APCalibrate_8188E(pAdapter, delta, FALSE);
-#else
- phy_APCalibrate_8188E(pDM_Odm, delta, FALSE);
-#endif
- }
-}
-VOID phy_SetRFPathSwitch_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN bMain,
- IN BOOLEAN is2T
- )
-{
-#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;
- #elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
- #endif
-
- #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if(!pAdapter->bHWInitReady)
- #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- if(pAdapter->hw_init_completed == _FALSE)
- #endif
- {
- u1Byte u1bTmp;
- u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7;
- ODM_Write1Byte(pDM_Odm, REG_LEDCFG2, u1bTmp);
- //ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01);
- ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01);
- }
-
-#endif
-
- if(is2T) //92C
- {
- if(bMain)
- ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); //92C_Path_A
- else
- ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); //BT
- }
- else //88C
- {
-
- // <20120504, Kordan> [8188E] We should make AntDiversity controlled by HW (0x870[9:8] = 0),
- // otherwise the following action has no effect. (0x860[9:8] has the effect only if AntDiversity controlled by SW)
- ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFInterfaceSW, BIT8|BIT9, 0x0);
- ODM_SetBBReg(pDM_Odm, 0x914, bMaskLWord, 0x0201); // Set up the Ant mapping table
-
- if(bMain)
- {
- //ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x2); // Tx Main (SW control)(The right antenna)
- //4 [ Tx ]
- ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT14|BIT13|BIT12, 0x1); // Tx Main (HW control)(The right antenna)
-
- //4 [ Rx ]
- ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT4|BIT3, 0x1); // AntDivType = TRDiv, right antenna
- if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
- ODM_SetBBReg(pDM_Odm, rConfig_ram64x16, BIT31, 0x1); // RxCG, Default is RxCG. AntDivType = 2RDiv, left antenna
-
- }
- else
- {
- //ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x1); // Tx Aux (SW control)(The left antenna)
- //4 [ Tx ]
- ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT14|BIT13|BIT12, 0x0); // Tx Aux (HW control)(The left antenna)
-
- //4 [ Rx ]
- ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT4|BIT3, 0x0); // AntDivType = TRDiv, left antenna
- if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
- ODM_SetBBReg(pDM_Odm, rConfig_ram64x16, BIT31, 0x0); // RxCS, AntDivType = 2RDiv, right antenna
- }
-
- }
-}
-VOID PHY_SetRFPathSwitch_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN bMain
- )
-{
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-#endif
-
-#if DISABLE_BB_RF
- return;
-#endif
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (IS_92C_SERIAL(pHalData->VersionID))
- {
- phy_SetRFPathSwitch_8188E(pAdapter, bMain, TRUE);
- }
- else
-#endif
- {
- // For 88C 1T1R
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- phy_SetRFPathSwitch_8188E(pAdapter, bMain, FALSE);
-#else
- phy_SetRFPathSwitch_8188E(pDM_Odm, bMain, FALSE);
-#endif
- }
-}
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-//digital predistortion
-VOID
-phy_DigitalPredistortion(
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PADAPTER pAdapter,
-#else
- IN PDM_ODM_T pDM_Odm,
-#endif
- IN BOOLEAN is2T
- )
-{
-#if (RT_PLATFORM == PLATFORM_WINDOWS)
-#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
-
- u4Byte tmpReg, tmpReg2, index, i;
- u1Byte path, pathbound = PATH_NUM;
- u4Byte AFE_backup[IQK_ADDA_REG_NUM];
- u4Byte AFE_REG[IQK_ADDA_REG_NUM] = {
- rFPGA0_XCD_SwitchControl, rBlue_Tooth,
- rRx_Wait_CCA, rTx_CCK_RFON,
- rTx_CCK_BBON, rTx_OFDM_RFON,
- rTx_OFDM_BBON, rTx_To_Rx,
- rTx_To_Tx, rRx_CCK,
- rRx_OFDM, rRx_Wait_RIFS,
- rRx_TO_Rx, rStandby,
- rSleep, rPMPD_ANAEN };
-
- u4Byte BB_backup[DP_BB_REG_NUM];
- u4Byte BB_REG[DP_BB_REG_NUM] = {
- rOFDM0_TRxPathEnable, rFPGA0_RFMOD,
- rOFDM0_TRMuxPar, rFPGA0_XCD_RFInterfaceSW,
- rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE,
- rFPGA0_XB_RFInterfaceOE};
- u4Byte BB_settings[DP_BB_REG_NUM] = {
- 0x00a05430, 0x02040000, 0x000800e4, 0x22208000,
- 0x0, 0x0, 0x0};
-
- u4Byte RF_backup[DP_PATH_NUM][DP_RF_REG_NUM];
- u4Byte RF_REG[DP_RF_REG_NUM] = {
- RF_TXBIAS_A};
-
- u4Byte MAC_backup[IQK_MAC_REG_NUM];
- u4Byte MAC_REG[IQK_MAC_REG_NUM] = {
- REG_TXPAUSE, REG_BCN_CTRL,
- REG_BCN_CTRL_1, REG_GPIO_MUXCFG};
-
- u4Byte Tx_AGC[DP_DPK_NUM][DP_DPK_VALUE_NUM] = {
- {0x1e1e1e1e, 0x03901e1e},
- {0x18181818, 0x03901818},
- {0x0e0e0e0e, 0x03900e0e}
- };
-
- u4Byte AFE_on_off[PATH_NUM] = {
- 0x04db25a4, 0x0b1b25a4}; //path A on path B off / path A off path B on
-
- u1Byte RetryCount = 0;
-
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("==>phy_DigitalPredistortion()\n"));
-
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_DigitalPredistortion for %s\n", (is2T ? "2T2R" : "1T1R")));
-
- //save BB default value
- for(index=0; index<DP_BB_REG_NUM; index++)
- BB_backup[index] = ODM_GetBBReg(pDM_Odm, BB_REG[index], bMaskDWord);
-
- //save MAC default value
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_SaveMACRegisters(pAdapter, BB_REG, MAC_backup);
-#else
- _PHY_SaveMACRegisters(pDM_Odm, BB_REG, MAC_backup);
-#endif
-
- //save RF default value
- for(path=0; path<DP_PATH_NUM; path++)
- {
- for(index=0; index<DP_RF_REG_NUM; index++)
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- RF_backup[path][index] = PHY_QueryRFReg(pAdapter, path, RF_REG[index], bMaskDWord);
-#else
- RF_backup[path][index] = ODM_GetRFReg(pAdapter, path, RF_REG[index], bMaskDWord);
-#endif
- }
-
- //save AFE default value
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_SaveADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-#else
- _PHY_SaveADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-#endif
-
- //Path A/B AFE all on
- for(index = 0; index < IQK_ADDA_REG_NUM ; index++)
- ODM_SetBBReg(pDM_Odm, AFE_REG[index], bMaskDWord, 0x6fdb25a4);
-
- //BB register setting
- for(index = 0; index < DP_BB_REG_NUM; index++)
- {
- if(index < 4)
- ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_settings[index]);
- else if (index == 4)
- ODM_SetBBReg(pDM_Odm,BB_REG[index], bMaskDWord, BB_backup[index]|BIT10|BIT26);
- else
- ODM_SetBBReg(pDM_Odm, BB_REG[index], BIT10, 0x00);
- }
-
- //MAC register setting
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_MACSettingCalibration(pAdapter, MAC_REG, MAC_backup);
-#else
- _PHY_MACSettingCalibration(pDM_Odm, MAC_REG, MAC_backup);
-#endif
-
- //PAGE-E IQC setting
- ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00);
- ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x01008c00);
- ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x01008c00);
-
- //path_A DPK
- //Path B to standby mode
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMaskDWord, 0x10000);
-
- // PA gain = 11 & PAD1 => tx_agc 1f ~11
- // 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, 0xbc0, bMaskDWord, 0x0005361f);
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
-
- //do inner loopback DPK 3 times
- for(i = 0; i < 3; i++)
- {
- //PA gain = 11 & PAD2 => tx_agc = 0x0f/0x0c/0x07
- for(index = 0; index < 3; index++)
- ODM_SetBBReg(pDM_Odm, 0xe00+index*4, bMaskDWord, Tx_AGC[i][0]);
- ODM_SetBBReg(pDM_Odm,0xe00+index*4, bMaskDWord, Tx_AGC[i][1]);
- for(index = 0; index < 4; index++)
- ODM_SetBBReg(pDM_Odm,0xe10+index*4, bMaskDWord, Tx_AGC[i][0]);
-
- // PAGE_B for Path-A inner loopback DPK setting
- ODM_SetBBReg(pDM_Odm,rPdp_AntA, bMaskDWord, 0x02097098);
- ODM_SetBBReg(pDM_Odm,rPdp_AntA_4, bMaskDWord, 0xf76d9f84);
- ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x0004ab87);
- ODM_SetBBReg(pDM_Odm,rConfig_AntA, bMaskDWord, 0x00880000);
-
- //----send one shot signal----//
- // Path A
- ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x80047788);
- ODM_delay_ms(1);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x00047788);
- ODM_delay_ms(50);
- }
-
- //PA gain = 11 => tx_agc = 1a
- for(index = 0; index < 3; index++)
- ODM_SetBBReg(pDM_Odm,0xe00+index*4, bMaskDWord, 0x34343434);
- ODM_SetBBReg(pDM_Odm,0xe08+index*4, bMaskDWord, 0x03903434);
- for(index = 0; index < 4; index++)
- ODM_SetBBReg(pDM_Odm,0xe10+index*4, bMaskDWord, 0x34343434);
-
- //====================================
- // PAGE_B for Path-A DPK setting
- //====================================
- // open inner loopback @ b00[19]:10 od 0xb00 0x01097018
- ODM_SetBBReg(pDM_Odm,rPdp_AntA, bMaskDWord, 0x02017098);
- ODM_SetBBReg(pDM_Odm,rPdp_AntA_4, bMaskDWord, 0xf76d9f84);
- ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x0004ab87);
- ODM_SetBBReg(pDM_Odm,rConfig_AntA, bMaskDWord, 0x00880000);
-
- //rf_lpbk_setup
- //1.rf 00:5205a, rf 0d:0e52c
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x0c, bMaskDWord, 0x8992b);
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x0d, bMaskDWord, 0x0e52c);
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x00, bMaskDWord, 0x5205a );
-
- //----send one shot signal----//
- // Path A
- ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x800477c0);
- ODM_delay_ms(1);
- ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x000477c0);
- ODM_delay_ms(50);
-
- while(RetryCount < DP_RETRY_LIMIT && !pDM_Odm->RFCalibrateInfo.bDPPathAOK)
- {
- //----read back measurement results----//
- ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x0c297018);
- tmpReg = ODM_GetBBReg(pDM_Odm, 0xbe0, bMaskDWord);
- ODM_delay_ms(10);
- ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x0c29701f);
- tmpReg2 = ODM_GetBBReg(pDM_Odm, 0xbe8, bMaskDWord);
- ODM_delay_ms(10);
-
- tmpReg = (tmpReg & bMaskHWord) >> 16;
- tmpReg2 = (tmpReg2 & bMaskHWord) >> 16;
- if(tmpReg < 0xf0 || tmpReg > 0x105 || tmpReg2 > 0xff )
- {
- 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_delay_ms(1);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x800477c0);
- ODM_delay_ms(1);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x000477c0);
- ODM_delay_ms(50);
- RetryCount++;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path A DPK RetryCount %d 0xbe0[31:16] %x 0xbe8[31:16] %x\n", RetryCount, tmpReg, tmpReg2));
- }
- else
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path A DPK Sucess\n"));
- pDM_Odm->RFCalibrateInfo.bDPPathAOK = TRUE;
- break;
- }
- }
- RetryCount = 0;
-
- //DPP path A
- if(pDM_Odm->RFCalibrateInfo.bDPPathAOK)
- {
- // DP settings
- ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x01017098);
- 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);
-
- for(i=rPdp_AntA; i<=0xb3c; i+=4)
- {
- ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x40004000);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path A ofsset = 0x%x\n", i));
- }
-
- //pwsf
- ODM_SetBBReg(pDM_Odm, 0xb40, bMaskDWord, 0x40404040);
- ODM_SetBBReg(pDM_Odm, 0xb44, bMaskDWord, 0x28324040);
- ODM_SetBBReg(pDM_Odm, 0xb48, bMaskDWord, 0x10141920);
-
- for(i=0xb4c; i<=0xb5c; i+=4)
- {
- ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x0c0c0c0c);
- }
-
- //TX_AGC boundary
- ODM_SetBBReg(pDM_Odm, 0xbc0, bMaskDWord, 0x0005361f);
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
- }
- else
- {
- ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x00000000);
- ODM_SetBBReg(pDM_Odm, rPdp_AntA_4, bMaskDWord, 0x00000000);
- }
-
- //DPK path B
- if(is2T)
- {
- //Path A to standby mode
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMaskDWord, 0x10000);
-
- // LUTs => tx_agc
- // PA gain = 11 & PAD1, => tx_agc 1f ~11
- // 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, 0xbc4, bMaskDWord, 0x0005361f);
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
-
- //do inner loopback DPK 3 times
- for(i = 0; i < 3; i++)
- {
- //PA gain = 11 & PAD2 => tx_agc = 0x0f/0x0c/0x07
- for(index = 0; index < 4; index++)
- ODM_SetBBReg(pDM_Odm, 0x830+index*4, bMaskDWord, Tx_AGC[i][0]);
- for(index = 0; index < 2; index++)
- ODM_SetBBReg(pDM_Odm, 0x848+index*4, bMaskDWord, Tx_AGC[i][0]);
- for(index = 0; index < 2; index++)
- ODM_SetBBReg(pDM_Odm, 0x868+index*4, bMaskDWord, Tx_AGC[i][0]);
-
- // PAGE_B for Path-A inner loopback DPK setting
- ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x02097098);
- ODM_SetBBReg(pDM_Odm, rPdp_AntB_4, bMaskDWord, 0xf76d9f84);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x0004ab87);
- ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x00880000);
-
- //----send one shot signal----//
- // Path B
- ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntB, bMaskDWord, 0x80047788);
- ODM_delay_ms(1);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x00047788);
- ODM_delay_ms(50);
- }
-
- // PA gain = 11 => tx_agc = 1a
- for(index = 0; index < 4; index++)
- ODM_SetBBReg(pDM_Odm, 0x830+index*4, bMaskDWord, 0x34343434);
- for(index = 0; index < 2; index++)
- ODM_SetBBReg(pDM_Odm, 0x848+index*4, bMaskDWord, 0x34343434);
- for(index = 0; index < 2; index++)
- ODM_SetBBReg(pDM_Odm, 0x868+index*4, bMaskDWord, 0x34343434);
-
- // PAGE_B for Path-B DPK setting
- ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x02017098);
- ODM_SetBBReg(pDM_Odm, rPdp_AntB_4, bMaskDWord, 0xf76d9f84);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x0004ab87);
- ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x00880000);
-
- // RF lpbk switches on
- ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x0101000f);
- ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x01120103);
-
- //Path-B RF lpbk
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x0c, bMaskDWord, 0x8992b);
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x0d, bMaskDWord, 0x0e52c);
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMaskDWord, 0x5205a);
-
- //----send one shot signal----//
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x800477c0);
- ODM_delay_ms(1);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x000477c0);
- ODM_delay_ms(50);
-
- while(RetryCount < DP_RETRY_LIMIT && !pDM_Odm->RFCalibrateInfo.bDPPathBOK)
- {
- //----read back measurement results----//
- ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x0c297018);
- tmpReg = ODM_GetBBReg(pDM_Odm, 0xbf0, bMaskDWord);
- ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x0c29701f);
- tmpReg2 = ODM_GetBBReg(pDM_Odm, 0xbf8, bMaskDWord);
-
- tmpReg = (tmpReg & bMaskHWord) >> 16;
- tmpReg2 = (tmpReg2 & bMaskHWord) >> 16;
-
- if(tmpReg < 0xf0 || tmpReg > 0x105 || tmpReg2 > 0xff)
- {
- 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_delay_ms(1);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x800477c0);
- ODM_delay_ms(1);
- ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x000477c0);
- ODM_delay_ms(50);
- RetryCount++;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path B DPK RetryCount %d 0xbf0[31:16] %x, 0xbf8[31:16] %x\n", RetryCount , tmpReg, tmpReg2));
- }
- else
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path B DPK Success\n"));
- pDM_Odm->RFCalibrateInfo.bDPPathBOK = TRUE;
- break;
- }
- }
-
- //DPP path B
- if(pDM_Odm->RFCalibrateInfo.bDPPathBOK)
- {
- // DP setting
- // LUT by SRAM
- ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x01017098);
- ODM_SetBBReg(pDM_Odm, rPdp_AntB_4, bMaskDWord, 0x776d9f84);
- 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);
- for(i=0xb60; i<=0xb9c; i+=4)
- {
- ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x40004000);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path B ofsset = 0x%x\n", i));
- }
-
- // PWSF
- ODM_SetBBReg(pDM_Odm, 0xba0, bMaskDWord, 0x40404040);
- ODM_SetBBReg(pDM_Odm, 0xba4, bMaskDWord, 0x28324050);
- ODM_SetBBReg(pDM_Odm, 0xba8, bMaskDWord, 0x0c141920);
-
- for(i=0xbac; i<=0xbbc; i+=4)
- {
- ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x0c0c0c0c);
- }
-
- // tx_agc boundary
- ODM_SetBBReg(pDM_Odm, 0xbc4, bMaskDWord, 0x0005361f);
- ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
-
- }
- else
- {
- ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x00000000);
- ODM_SetBBReg(pDM_Odm, rPdp_AntB_4, bMaskDWord, 0x00000000);
- }
- }
-
- //reload BB default value
- for(index=0; index<DP_BB_REG_NUM; index++)
- ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]);
-
- //reload RF default value
- for(path = 0; path<DP_PATH_NUM; path++)
- {
- for( i = 0 ; i < DP_RF_REG_NUM ; i++){
- ODM_SetRFReg(pDM_Odm, path, RF_REG[i], bMaskDWord, RF_backup[path][i]);
- }
- }
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f); //standby mode
- ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE2, bMaskDWord, 0x20101); //RF lpbk switches off
-
- //reload AFE default value
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- _PHY_ReloadADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-
- //reload MAC default value
- _PHY_ReloadMACRegisters(pAdapter, MAC_REG, MAC_backup);
-#else
- _PHY_ReloadADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-
- //reload MAC default value
- _PHY_ReloadMACRegisters(pDM_Odm, MAC_REG, MAC_backup);
-#endif
-
- pDM_Odm->RFCalibrateInfo.bDPdone = TRUE;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("<==phy_DigitalPredistortion()\n"));
-#endif
-}
-
-VOID
-PHY_DigitalPredistortion_8188E(
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PADAPTER pAdapter
-#else
- IN PDM_ODM_T pDM_Odm
-#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
-#if DISABLE_BB_RF
- return;
-#endif
-
- return;
-
- if(pDM_Odm->RFCalibrateInfo.bDPdone)
- return;
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
- if(pDM_Odm->RFType == ODM_2T2R){
- phy_DigitalPredistortion(pAdapter, TRUE);
- }
- else
-#endif
- {
- // For 88C 1T1R
- phy_DigitalPredistortion(pAdapter, FALSE);
- }
-}
-
-
-
-//return value TRUE => Main; FALSE => Aux
-
-BOOLEAN phy_QueryRFPathSwitch_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN BOOLEAN is2T
- )
-{
-#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
- if(!pAdapter->bHWInitReady)
- {
- u1Byte u1bTmp;
- u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7;
- ODM_Write1Byte(pDM_Odm, REG_LEDCFG2, u1bTmp);
- //ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01);
- ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01);
- }
-
- if(is2T) //
- {
- if(ODM_GetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01)
- return TRUE;
- else
- return FALSE;
- }
- else
- {
- if((ODM_GetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT4|BIT3) == 0x1))
- return TRUE;
- else
- return FALSE;
- }
-}
-
-
-
-//return value TRUE => Main; FALSE => Aux
-BOOLEAN PHY_QueryRFPathSwitch_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm
-#else
- IN PADAPTER pAdapter
-#endif
- )
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-
-#if DISABLE_BB_RF
- return TRUE;
-#endif
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
- //if(IS_92C_SERIAL( pHalData->VersionID)){
- if(IS_2T2R( pHalData->VersionID)){
- return phy_QueryRFPathSwitch_8188E(pAdapter, TRUE);
- }
- else
-#endif
- {
- // For 88C 1T1R
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- return phy_QueryRFPathSwitch_8188E(pAdapter, FALSE);
-#else
- return phy_QueryRFPathSwitch_8188E(pDM_Odm, FALSE);
-#endif
- }
-}
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+
+
+#include "../odm_precomp.h"
+
+
+
+/*---------------------------Define Local Constant---------------------------*/
+// 2010/04/25 MH Define the max tx power tracking tx agc power.
+#define ODM_TXPWRTRACK_MAX_IDX_88E 6
+
+/*---------------------------Define Local Constant---------------------------*/
+
+
+//3============================================================
+//3 Tx Power Tracking
+//3============================================================
+
+
+void setIqkMatrix_8188E(
+ PDM_ODM_T pDM_Odm,
+ u1Byte OFDM_index,
+ u1Byte RFPath,
+ s4Byte IqkResult_X,
+ s4Byte IqkResult_Y
+ )
+{
+ s4Byte ele_A=0, ele_D, ele_C=0, value32;
+
+ ele_D = (OFDMSwingTable_New[OFDM_index] & 0xFFC00000)>>22;
+
+ //new element A = element D x X
+ if((IqkResult_X != 0) && (*(pDM_Odm->pBandType) == ODM_BAND_2_4G))
+ {
+ if ((IqkResult_X & 0x00000200) != 0) //consider minus
+ IqkResult_X = IqkResult_X | 0xFFFFFC00;
+ ele_A = ((IqkResult_X * ele_D)>>8)&0x000003FF;
+
+ //new element C = element D x Y
+ if ((IqkResult_Y & 0x00000200) != 0)
+ IqkResult_Y = IqkResult_Y | 0xFFFFFC00;
+ ele_C = ((IqkResult_Y * ele_D)>>8)&0x000003FF;
+
+ //if (RFPath == ODM_RF_PATH_A)
+ switch (RFPath)
+ {
+ case ODM_RF_PATH_A:
+ //wirte new elements A, C, D to regC80 and regC94, element B is always 0
+ value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, value32);
+
+ value32 = (ele_C&0x000003C0)>>6;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, value32);
+
+ value32 = ((IqkResult_X * ele_D)>>7)&0x01;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, value32);
+ break;
+ case ODM_RF_PATH_B:
+ //wirte new elements A, C, D to regC88 and regC9C, element B is always 0
+ value32=(ele_D<<22)|((ele_C&0x3F)<<16) |ele_A;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, value32);
+
+ value32 = (ele_C&0x000003C0)>>6;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, value32);
+
+ value32 = ((IqkResult_X * ele_D)>>7)&0x01;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, value32);
+
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch (RFPath)
+ {
+ case ODM_RF_PATH_A:
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, OFDMSwingTable_New[OFDM_index]);
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, 0x00);
+ ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, 0x00);
+ break;
+
+ case ODM_RF_PATH_B:
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, OFDMSwingTable_New[OFDM_index]);
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00);
+ ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, 0x00);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("TxPwrTracking path B: X = 0x%x, Y = 0x%x ele_A = 0x%x ele_C = 0x%x ele_D = 0x%x 0xeb4 = 0x%x 0xebc = 0x%x\n",
+ (u4Byte)IqkResult_X, (u4Byte)IqkResult_Y, (u4Byte)ele_A, (u4Byte)ele_C, (u4Byte)ele_D, (u4Byte)IqkResult_X, (u4Byte)IqkResult_Y));
+}
+
+void DoIQK_8188E(
+ PDM_ODM_T pDM_Odm,
+ u1Byte DeltaThermalIndex,
+ u1Byte ThermalValue,
+ u1Byte Threshold
+ )
+{
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+#endif
+
+ ODM_ResetIQKResult(pDM_Odm);
+
+#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
+#if USE_WORKITEM
+ PlatformAcquireMutex(&pHalData->mxChnlBwControl);
+#else
+ PlatformAcquireSpinLock(Adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK);
+#endif
+#elif((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
+ PlatformAcquireMutex(&pHalData->mxChnlBwControl);
+#endif
+#endif
+
+
+ pDM_Odm->RFCalibrateInfo.ThermalValue_IQK= ThermalValue;
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ PHY_IQCalibrate_8188E(pDM_Odm, FALSE);
+#else
+ PHY_IQCalibrate_8188E(Adapter, FALSE);
+#endif
+
+#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
+#if USE_WORKITEM
+ PlatformReleaseMutex(&pHalData->mxChnlBwControl);
+#else
+ PlatformReleaseSpinLock(Adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK);
+#endif
+#elif((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
+ PlatformReleaseMutex(&pHalData->mxChnlBwControl);
+#endif
+#endif
+}
+
+/*-----------------------------------------------------------------------------
+ * Function: odm_TxPwrTrackSetPwr88E()
+ *
+ * Overview: 88E change all channel tx power accordign to flag.
+ * OFDM & CCK are all different.
+ *
+ * Input: NONE
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ * Revised History:
+ * When Who Remark
+ * 04/23/2012 MHC Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+VOID
+ODM_TxPwrTrackSetPwr88E(
+ PDM_ODM_T pDM_Odm,
+ PWRTRACK_METHOD Method,
+ u1Byte RFPath,
+ u1Byte ChannelMappedIndex
+ )
+{
+ PADAPTER Adapter = pDM_Odm->Adapter;
+ PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
+ u1Byte PwrTrackingLimit_OFDM = 30; //+0dB
+ u1Byte PwrTrackingLimit_CCK= 28; //-2dB
+ u1Byte TxRate = 0xFF;
+ u1Byte Final_OFDM_Swing_Index = 0;
+ u1Byte Final_CCK_Swing_Index = 0;
+ u1Byte i = 0;
+
+#if (MP_DRIVER==1)
+ if ( *(pDM_Odm->mp_mode) == 1)
+ {
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE ))
+ #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
+ PMPT_CONTEXT pMptCtx = &(Adapter->MptCtx);
+ #elif (DM_ODM_SUPPORT_TYPE & (ODM_CE))
+ PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.MptCtx);
+ #endif
+ TxRate = MptToMgntRate(pMptCtx->MptRateIndex);
+#endif
+ }
+ else
+#endif
+ {
+ u2Byte rate = *(pDM_Odm->pForcedDataRate);
+
+ if(!rate) //auto rate
+ {
+ if(pDM_Odm->TxRate != 0xFF)
+ #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
+ TxRate = Adapter->HalFunc.GetHwRateFromMRateHandler(pDM_Odm->TxRate);
+ #elif (DM_ODM_SUPPORT_TYPE & (ODM_CE))
+ TxRate = HwRateToMRate(pDM_Odm->TxRate);
+ #endif
+ }
+ else //force rate
+ {
+ TxRate = (u1Byte)rate;
+ }
+ }
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("===>ODM_TxPwrTrackSetPwr8723B\n"));
+
+ if(TxRate != 0xFF)
+ {
+ //2 CCK
+ if((TxRate >= MGN_1M)&&(TxRate <= MGN_11M))
+ PwrTrackingLimit_CCK = 28; //-2dB
+ //2 OFDM
+ else if((TxRate >= MGN_6M)&&(TxRate <= MGN_48M))
+ PwrTrackingLimit_OFDM= 36; //+3dB
+ else if(TxRate == MGN_54M)
+ PwrTrackingLimit_OFDM= 34; //+2dB
+
+ //2 HT
+ else if((TxRate >= MGN_MCS0)&&(TxRate <= MGN_MCS2)) //QPSK/BPSK
+ PwrTrackingLimit_OFDM= 38; //+4dB
+ else if((TxRate >= MGN_MCS3)&&(TxRate <= MGN_MCS4)) //16QAM
+ PwrTrackingLimit_OFDM= 36; //+3dB
+ else if((TxRate >= MGN_MCS5)&&(TxRate <= MGN_MCS7)) //64QAM
+ PwrTrackingLimit_OFDM= 34; //+2dB
+
+ else
+ PwrTrackingLimit_OFDM = pDM_Odm->DefaultOfdmIndex; //Default OFDM index = 30
+ }
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("TxRate=0x%x, PwrTrackingLimit=%d\n", TxRate, PwrTrackingLimit_OFDM));
+
+ if (Method == TXAGC)
+ {
+ u4Byte pwr = 0, TxAGC = 0;
+ PADAPTER Adapter = pDM_Odm->Adapter;
+
+ pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = pDM_Odm->Absolute_OFDMSwingIdx[RFPath]; //Remnant index equal to aboslute compensate value.
+
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("odm_TxPwrTrackSetPwr88E CH=%d\n", *(pDM_Odm->pChannel)));
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE ))
+
+ #if (MP_DRIVER == 1)
+ if ( *(pDM_Odm->mp_mode) == 1)
+ {
+ pwr = PHY_QueryBBReg(Adapter, rTxAGC_A_Rate18_06, 0xFF);
+ pwr += pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A];
+ PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, pwr);
+ TxAGC = (pwr<<16)|(pwr<<8)|(pwr);
+ PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, TxAGC);
+ //RT_DISP(FPHY, PHY_TXPWR, ("ODM_TxPwrTrackSetPwr88E: CCK Tx-rf(A) Power = 0x%x\n", TxAGC));
+
+ pwr = PHY_QueryBBReg(Adapter, rTxAGC_A_Rate18_06, 0xFF);
+ pwr += (pDM_Odm->BbSwingIdxOfdm[ODM_RF_PATH_A] - pDM_Odm->BbSwingIdxOfdmBase[RF_PATH_A]);
+ TxAGC |= ((pwr<<24)|(pwr<<16)|(pwr<<8)|pwr);
+ PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskDWord, TxAGC);
+ PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskDWord, TxAGC);
+ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskDWord, TxAGC);
+ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskDWord, TxAGC);
+ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskDWord, TxAGC);
+ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskDWord, TxAGC);
+ //RT_DISP(FPHY, PHY_TXPWR, ("ODM_TxPwrTrackSetPwr88E: OFDM Tx-rf(A) Power = 0x%x\n", TxAGC));
+ }
+ else
+ #endif
+ {
+ //PHY_SetTxPowerLevel8188E(pDM_Odm->Adapter, *pDM_Odm->pChannel);
+ pDM_Odm->Modify_TxAGC_Flag_PathA = TRUE;
+ pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = TRUE;
+
+ if (RFPath == ODM_RF_PATH_A)
+ {
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, CCK );
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, OFDM );
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, HT_MCS0_MCS7 );
+ }
+ }
+
+
+#endif
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ //PHY_RF6052SetCCKTxPower(pDM_Odm->priv, *(pDM_Odm->pChannel));
+ //PHY_RF6052SetOFDMTxPower(pDM_Odm->priv, *(pDM_Odm->pChannel));
+#endif
+
+ }
+ else if (Method == BBSWING)
+ {
+ Final_OFDM_Swing_Index = pDM_Odm->DefaultOfdmIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
+ Final_CCK_Swing_Index = pDM_Odm->DefaultCckIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
+
+ if (Final_OFDM_Swing_Index >= PwrTrackingLimit_OFDM)
+ Final_OFDM_Swing_Index = PwrTrackingLimit_OFDM;
+ 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)
+ Final_CCK_Swing_Index = 0;
+
+ // Adjust BB swing by OFDM IQ matrix
+ if (RFPath == ODM_RF_PATH_A)
+ {
+ setIqkMatrix_8188E(pDM_Odm, Final_OFDM_Swing_Index, ODM_RF_PATH_A,
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0],
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]);
+ // Adjust BB swing by CCK filter coefficient
+ if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14){
+ ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][0]);
+ ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][1]);
+ ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][2]);
+ ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][3]);
+ ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][4]);
+ ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][5]);
+ ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][6]);
+ ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][7]);
+ }
+ else
+ {
+ ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][0]);
+ ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][1]);
+ ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][2]);
+ ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][3]);
+ ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][4]);
+ ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][5]);
+ ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][6]);
+ ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][7]);
+ }
+ }
+ }
+ else if (Method == MIX_MODE)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("pDM_Odm->DefaultOfdmIndex=%d, pDM_Odm->DefaultCCKIndex=%d, pDM_Odm->Absolute_OFDMSwingIdx[RFPath]=%d, RF_Path = %d\n",
+ pDM_Odm->DefaultOfdmIndex, pDM_Odm->DefaultCckIndex, pDM_Odm->Absolute_OFDMSwingIdx[RFPath],RFPath ));
+
+ Final_CCK_Swing_Index = pDM_Odm->DefaultCckIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
+ Final_OFDM_Swing_Index = pDM_Odm->DefaultOfdmIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
+
+ if(Final_OFDM_Swing_Index > PwrTrackingLimit_OFDM ) //BBSwing higher then Limit
+ {
+ pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = Final_OFDM_Swing_Index - PwrTrackingLimit_OFDM;
+
+ setIqkMatrix_8188E(pDM_Odm, PwrTrackingLimit_OFDM, ODM_RF_PATH_A,
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0],
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]);
+
+ pDM_Odm->Modify_TxAGC_Flag_PathA = TRUE;
+
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, OFDM );
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, HT_MCS0_MCS7 );
+
+ 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)
+ {
+ pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = Final_OFDM_Swing_Index ;
+
+ setIqkMatrix_8188E(pDM_Odm, 0, ODM_RF_PATH_A,
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0],
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]);
+
+ pDM_Odm->Modify_TxAGC_Flag_PathA = TRUE;
+
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, OFDM );
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, HT_MCS0_MCS7 );
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A Lower then BBSwing lower bound 0 , Remnant TxAGC Value = %d \n", pDM_Odm->Remnant_OFDMSwingIdx[RFPath]));
+ }
+ else
+ {
+ setIqkMatrix_8188E(pDM_Odm, Final_OFDM_Swing_Index, ODM_RF_PATH_A,
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0],
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]);
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A Compensate with BBSwing , Final_OFDM_Swing_Index = %d \n", Final_OFDM_Swing_Index));
+
+ if(pDM_Odm->Modify_TxAGC_Flag_PathA) //If TxAGC has changed, reset TxAGC again
+ {
+ pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = 0;
+
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, OFDM );
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, HT_MCS0_MCS7 );
+
+ pDM_Odm->Modify_TxAGC_Flag_PathA = FALSE;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A pDM_Odm->Modify_TxAGC_Flag = FALSE \n"));
+ }
+ }
+
+ if(Final_CCK_Swing_Index > PwrTrackingLimit_CCK)
+ {
+ pDM_Odm->Remnant_CCKSwingIdx = Final_CCK_Swing_Index - PwrTrackingLimit_CCK;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A CCK Over Limit , PwrTrackingLimit_CCK = %d , pDM_Odm->Remnant_CCKSwingIdx = %d \n", PwrTrackingLimit_CCK, pDM_Odm->Remnant_CCKSwingIdx));
+
+ // Adjust BB swing by CCK filter coefficient
+
+ if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14)
+ {
+ ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][0]);
+ ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][1]);
+ ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][2]);
+ ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][3]);
+ ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][4]);
+ ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][5]);
+ ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][6]);
+ ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13_New[PwrTrackingLimit_CCK][7]);
+ }
+ else
+ {
+ ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][0]);
+ ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][1]);
+ ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][2]);
+ ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][3]);
+ ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][4]);
+ ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][5]);
+ ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][6]);
+ ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14_New[PwrTrackingLimit_CCK][7]);
+ }
+
+ pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = TRUE;
+
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, CCK );
+
+ }
+ else if(Final_CCK_Swing_Index < 0) // Lowest CCK Index = 0
+ {
+ pDM_Odm->Remnant_CCKSwingIdx = Final_CCK_Swing_Index;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A CCK Under Limit , PwrTrackingLimit_CCK = %d , pDM_Odm->Remnant_CCKSwingIdx = %d \n", 0, pDM_Odm->Remnant_CCKSwingIdx));
+
+ if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14)
+ {
+ ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13_New[0][0]);
+ ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13_New[0][1]);
+ ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13_New[0][2]);
+ ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13_New[0][3]);
+ ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13_New[0][4]);
+ ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13_New[0][5]);
+ ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13_New[0][6]);
+ ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13_New[0][7]);
+ }
+ else
+ {
+ ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14_New[0][0]);
+ ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14_New[0][1]);
+ ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14_New[0][2]);
+ ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14_New[0][3]);
+ ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14_New[0][4]);
+ ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14_New[0][5]);
+ ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14_New[0][6]);
+ ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14_New[0][7]);
+ }
+
+ pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = TRUE;
+
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, CCK );
+
+ }
+ else
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A CCK Compensate with BBSwing , Final_CCK_Swing_Index = %d \n", Final_CCK_Swing_Index));
+
+ if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14)
+ {
+ ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][0]);
+ ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][1]);
+ ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][2]);
+ ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][3]);
+ ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][4]);
+ ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][5]);
+ ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][6]);
+ ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13_New[Final_CCK_Swing_Index][7]);
+ }
+ else
+ {
+ ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][0]);
+ ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][1]);
+ ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][2]);
+ ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][3]);
+ ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][4]);
+ ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][5]);
+ ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][6]);
+ ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14_New[Final_CCK_Swing_Index][7]);
+ }
+
+ if(pDM_Odm->Modify_TxAGC_Flag_PathA_CCK) //If TxAGC has changed, reset TxAGC again
+ {
+ pDM_Odm->Remnant_CCKSwingIdx = 0;
+ PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_A, pHalData->CurrentChannel, CCK );
+ pDM_Odm->Modify_TxAGC_Flag_PathA_CCK= FALSE;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A pDM_Odm->Modify_TxAGC_Flag_CCK = FALSE \n"));
+ }
+ }
+ }
+ else
+ {
+ return;
+ }
+} // odm_TxPwrTrackSetPwr88E
+
+VOID
+GetDeltaSwingTable_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ OUT pu1Byte *TemperatureUP_A,
+ OUT pu1Byte *TemperatureDOWN_A,
+ OUT pu1Byte *TemperatureUP_B,
+ OUT pu1Byte *TemperatureDOWN_B
+ )
+{
+ *TemperatureUP_A = (pu1Byte)DeltaSwingTableIdx_2GA_P_8188E;
+ *TemperatureDOWN_A = (pu1Byte)DeltaSwingTableIdx_2GA_N_8188E;
+ *TemperatureUP_B = (pu1Byte)DeltaSwingTableIdx_2GA_P_8188E;
+ *TemperatureDOWN_B = (pu1Byte)DeltaSwingTableIdx_2GA_N_8188E;
+}
+
+void ConfigureTxpowerTrack_8188E(
+ PTXPWRTRACK_CFG pConfig
+ )
+{
+ pConfig->SwingTableSize_CCK = CCK_TABLE_SIZE;
+ pConfig->SwingTableSize_OFDM = OFDM_TABLE_SIZE;
+ pConfig->Threshold_IQK = IQK_THRESHOLD;
+ pConfig->AverageThermalNum = AVG_THERMAL_NUM_88E;
+ pConfig->RfPathCount = MAX_PATH_NUM_8188E;
+ pConfig->ThermalRegAddr = RF_T_METER_88E;
+
+ pConfig->ODM_TxPwrTrackSetPwr = ODM_TxPwrTrackSetPwr88E;
+ pConfig->DoIQK = DoIQK_8188E;
+ pConfig->PHY_LCCalibrate = PHY_LCCalibrate_8188E;
+ pConfig->GetDeltaSwingTable = GetDeltaSwingTable_8188E;
+}
+
+//1 7. IQK
+#define MAX_TOLERANCE 5
+#define IQK_DELAY_TIME 1 //ms
+
+u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK
+phy_PathA_IQK_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN configPathB
+ )
+{
+ u4Byte regEAC, regE94, regE9C, regEA4;
+ u1Byte result = 0x00;
+#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 IQK!\n"));
+
+ //1 Tx IQK
+ //path-A IQK setting
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A IQK setting!\n"));
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1c);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x30008c1c);
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x8214032a);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160000);
+
+ //LO calibration setting
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n"));
+ ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x00462911);
+
+ //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, 0xf9000000);
+ ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000);
+
+ // delay x ms
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E));
+ //PlatformStallExecution(IQK_DELAY_TIME_88E*1000);
+ ODM_delay_ms(IQK_DELAY_TIME_88E);
+
+ // Check failed
+ regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC));
+ regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94));
+ regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C));
+ regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4));
+
+ if(!(regEAC & BIT28) &&
+ (((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
+ RT_DISP(FINIT, INIT_IQK, ("Path A Rx IQK fail!!\n"));
+#endif
+
+ return result;
+
+
+ }
+
+u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK
+phy_PathA_RxIQK(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN configPathB
+ )
+{
+ u4Byte regEAC, regE94, regE9C, regEA4, u4tmp;
+ u1Byte result = 0x00;
+#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 Rx IQK!\n"));
+
+ //1 Get TXIMR setting
+ //modify RXIQK mode table
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table!\n"));
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
+ 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_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000);
+
+ //IQK setting
+ ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x81004800);
+
+ //path-A IQK setting
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1c);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x30008c1c);
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160804);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160000);
+
+ //LO calibration setting
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n"));
+ ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x0046a911);
+
+ //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, 0xf9000000);
+ ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000);
+
+ // delay x ms
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E));
+ //PlatformStallExecution(IQK_DELAY_TIME_88E*1000);
+ ODM_delay_ms(IQK_DELAY_TIME_88E);
+
+
+ // Check failed
+ regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC));
+ regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94));
+ regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C));
+
+ if(!(regEAC & BIT28) &&
+ (((regE94 & 0x03FF0000)>>16) != 0x142) &&
+ (((regE9C & 0x03FF0000)>>16) != 0x42) )
+ result |= 0x01;
+ else //if Tx not OK, ignore Rx
+ return result;
+
+ u4tmp = 0x80007C00 | (regE94&0x3FF0000) | ((regE9C&0x3FF0000) >> 16);
+ ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, u4tmp);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe40 = 0x%x u4tmp = 0x%x \n", ODM_GetBBReg(pDM_Odm, rTx_IQK, bMaskDWord), u4tmp));
+
+
+ //1 RX IQK
+ //modify RXIQK mode table
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table 2!\n"));
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
+ 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, 0xf7ffa );
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000);
+
+ //IQK setting
+ ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800);
+
+ //path-A IQK setting
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x30008c1c);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x10008c1c);
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160c05);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160c05);
+
+ //LO calibration setting
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n"));
+ ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x0046a911);
+
+ //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, 0xf9000000);
+ ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000);
+
+ // delay x ms
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E));
+ //PlatformStallExecution(IQK_DELAY_TIME_88E*1000);
+ ODM_delay_ms(IQK_DELAY_TIME_88E);
+
+ // Check failed
+ regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC));
+ regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94));
+ regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C));
+ regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4));
+
+#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"));
+
+ return result;
+
+
+}
+
+u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK
+phy_PathB_IQK_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm
+#else
+ IN PADAPTER pAdapter
+#endif
+ )
+{
+ u4Byte regEAC, regEB4, regEBC, regEC4, regECC;
+ u1Byte result = 0x00;
+#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 B IQK!\n"));
+
+ //One shot, path B 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_Cont, bMaskDWord, 0x00000002);
+ ODM_SetBBReg(pDM_Odm, rIQK_AGC_Cont, bMaskDWord, 0x00000000);
+
+ // delay x ms
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path B LOK & IQK.\n", IQK_DELAY_TIME_88E));
+ //PlatformStallExecution(IQK_DELAY_TIME_88E*1000);
+ ODM_delay_ms(IQK_DELAY_TIME_88E);
+
+ // Check failed
+ regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC));
+ regEB4 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeb4 = 0x%x\n", regEB4));
+ regEBC= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xebc = 0x%x\n", regEBC));
+ regEC4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_B_2, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xec4 = 0x%x\n", regEC4));
+ regECC= ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xecc = 0x%x\n", regECC));
+
+ if(!(regEAC & BIT31) &&
+ (((regEB4 & 0x03FF0000)>>16) != 0x142) &&
+ (((regEBC & 0x03FF0000)>>16) != 0x42))
+ result |= 0x01;
+ else
+ return result;
+
+ 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"));
+
+
+ return result;
+
+}
+
+VOID
+_PHY_PathAFillIQKMatrix(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN bIQKOK,
+ IN s4Byte result[][8],
+ IN u1Byte final_candidate,
+ IN BOOLEAN bTxOnly
+ )
+{
+ u4Byte Oldval_0, X, TX0_A, reg;
+ s4Byte Y, TX0_C;
+#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 IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed"));
+
+ if(final_candidate == 0xFF)
+ return;
+
+ else if(bIQKOK)
+ {
+ Oldval_0 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord) >> 22) & 0x3FF;
+
+ X = result[final_candidate][0];
+ if ((X & 0x00000200) != 0)
+ X = X | 0xFFFFFC00;
+ TX0_A = (X * Oldval_0) >> 8;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX0_A = 0x%x, Oldval_0 0x%x\n", X, TX0_A, Oldval_0));
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, 0x3FF, TX0_A);
+
+ ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(31), ((X* Oldval_0>>7) & 0x1));
+
+ Y = result[final_candidate][1];
+ if ((Y & 0x00000200) != 0)
+ Y = Y | 0xFFFFFC00;
+
+
+ TX0_C = (Y * Oldval_0) >> 8;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Y = 0x%x, TX = 0x%x\n", Y, TX0_C));
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, 0xF0000000, ((TX0_C&0x3C0)>>6));
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, 0x003F0000, (TX0_C&0x3F));
+
+ ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(29), ((Y* Oldval_0>>7) & 0x1));
+
+ if(bTxOnly)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("_PHY_PathAFillIQKMatrix only Tx OK\n"));
+ return;
+ }
+
+ reg = result[final_candidate][2];
+#if (DM_ODM_SUPPORT_TYPE==ODM_AP)
+ if( RTL_ABS(reg ,0x100) >= 16)
+ reg = 0x100;
+#endif
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XARxIQImbalance, 0x3FF, reg);
+
+ reg = result[final_candidate][3] & 0x3F;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XARxIQImbalance, 0xFC00, reg);
+
+ reg = (result[final_candidate][3] >> 6) & 0xF;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_RxIQExtAnta, 0xF0000000, reg);
+ }
+}
+
+VOID
+_PHY_PathBFillIQKMatrix(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN bIQKOK,
+ IN s4Byte result[][8],
+ IN u1Byte final_candidate,
+ IN BOOLEAN bTxOnly //do Tx only
+ )
+{
+ u4Byte Oldval_1, X, TX1_A, reg;
+ s4Byte Y, TX1_C;
+#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 B IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed"));
+
+ if(final_candidate == 0xFF)
+ return;
+
+ else if(bIQKOK)
+ {
+ Oldval_1 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord) >> 22) & 0x3FF;
+
+ X = result[final_candidate][4];
+ if ((X & 0x00000200) != 0)
+ X = X | 0xFFFFFC00;
+ TX1_A = (X * Oldval_1) >> 8;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX1_A = 0x%x\n", X, TX1_A));
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, 0x3FF, TX1_A);
+
+ ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(27), ((X* Oldval_1>>7) & 0x1));
+
+ Y = result[final_candidate][5];
+ if ((Y & 0x00000200) != 0)
+ Y = Y | 0xFFFFFC00;
+
+ TX1_C = (Y * Oldval_1) >> 8;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Y = 0x%x, TX1_C = 0x%x\n", Y, TX1_C));
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, 0xF0000000, ((TX1_C&0x3C0)>>6));
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, 0x003F0000, (TX1_C&0x3F));
+
+ ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(25), ((Y* Oldval_1>>7) & 0x1));
+
+ if(bTxOnly)
+ return;
+
+ reg = result[final_candidate][6];
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XBRxIQImbalance, 0x3FF, reg);
+
+ reg = result[final_candidate][7] & 0x3F;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_XBRxIQImbalance, 0xFC00, reg);
+
+ reg = (result[final_candidate][7] >> 6) & 0xF;
+ ODM_SetBBReg(pDM_Odm, rOFDM0_AGCRSSITable, 0x0000F000, reg);
+ }
+}
+
+//
+// 2011/07/26 MH Add an API for testing IQK fail case.
+//
+// MP Already declare in odm.c
+#if !(DM_ODM_SUPPORT_TYPE & ODM_WIN)
+BOOLEAN
+ODM_CheckPowerStatus(
+ IN PADAPTER Adapter)
+{
+/*
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
+ RT_RF_POWER_STATE rtState;
+ PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
+
+ // 2011/07/27 MH We are not testing ready~~!! We may fail to get correct value when init sequence.
+ if (pMgntInfo->init_adpt_in_progress == TRUE)
+ {
+ ODM_RT_TRACE(pDM_Odm,COMP_INIT, DBG_LOUD, ("ODM_CheckPowerStatus Return TRUE, due to initadapter"));
+ return TRUE;
+ }
+
+ //
+ // 2011/07/19 MH We can not execute tx pwoer tracking/ LLC calibrate or IQK.
+ //
+ Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState));
+ if(Adapter->bDriverStopped || Adapter->bDriverIsGoingToPnpSetPowerSleep || rtState == eRfOff)
+ {
+ ODM_RT_TRACE(pDM_Odm,COMP_INIT, DBG_LOUD, ("ODM_CheckPowerStatus Return FALSE, due to %d/%d/%d\n",
+ Adapter->bDriverStopped, Adapter->bDriverIsGoingToPnpSetPowerSleep, rtState));
+ return FALSE;
+ }
+*/
+ return TRUE;
+}
+#endif
+
+VOID
+_PHY_SaveADDARegisters(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte ADDAReg,
+ IN pu4Byte ADDABackup,
+ IN u4Byte RegisterNum
+ )
+{
+ u4Byte i;
+#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
+
+ if (ODM_CheckPowerStatus(pAdapter) == FALSE)
+ return;
+#endif
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save ADDA parameters.\n"));
+ for( i = 0 ; i < RegisterNum ; i++){
+ ADDABackup[i] = ODM_GetBBReg(pDM_Odm, ADDAReg[i], bMaskDWord);
+ }
+}
+
+
+VOID
+_PHY_SaveMACRegisters(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte MACReg,
+ IN pu4Byte MACBackup
+ )
+{
+ u4Byte i;
+#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, ("Save MAC parameters.\n"));
+ for( i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++){
+ MACBackup[i] = ODM_Read1Byte(pDM_Odm, MACReg[i]);
+ }
+ MACBackup[i] = ODM_Read4Byte(pDM_Odm, MACReg[i]);
+
+}
+
+
+VOID
+_PHY_ReloadADDARegisters(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte ADDAReg,
+ IN pu4Byte ADDABackup,
+ IN u4Byte RegiesterNum
+ )
+{
+ u4Byte i;
+#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, ("Reload ADDA power saving parameters !\n"));
+ for(i = 0 ; i < RegiesterNum; i++)
+ {
+ ODM_SetBBReg(pDM_Odm, ADDAReg[i], bMaskDWord, ADDABackup[i]);
+ }
+}
+
+VOID
+_PHY_ReloadMACRegisters(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte MACReg,
+ IN pu4Byte MACBackup
+ )
+{
+ u4Byte i;
+#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, ("Reload MAC parameters !\n"));
+ for(i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++){
+ ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)MACBackup[i]);
+ }
+ ODM_Write4Byte(pDM_Odm, MACReg[i], MACBackup[i]);
+}
+
+
+VOID
+_PHY_PathADDAOn(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte ADDAReg,
+ IN BOOLEAN isPathAOn,
+ IN BOOLEAN is2T
+ )
+{
+ u4Byte pathOn;
+ u4Byte i;
+#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, ("ADDA ON.\n"));
+
+ pathOn = isPathAOn ? 0x04db25a4 : 0x0b1b25a4;
+ if(FALSE == is2T){
+ pathOn = 0x0bdb25a0;
+ ODM_SetBBReg(pDM_Odm, ADDAReg[0], bMaskDWord, 0x0b1b25a0);
+ }
+ else{
+ ODM_SetBBReg(pDM_Odm,ADDAReg[0], bMaskDWord, pathOn);
+ }
+
+ for( i = 1 ; i < IQK_ADDA_REG_NUM ; i++){
+ ODM_SetBBReg(pDM_Odm,ADDAReg[i], bMaskDWord, pathOn);
+ }
+
+}
+
+VOID
+_PHY_MACSettingCalibration(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte MACReg,
+ IN pu4Byte MACBackup
+ )
+{
+ u4Byte i = 0;
+#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, ("MAC settings for Calibration.\n"));
+
+ ODM_Write1Byte(pDM_Odm, MACReg[i], 0x3F);
+
+ for(i = 1 ; i < (IQK_MAC_REG_NUM - 1); i++){
+ ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)(MACBackup[i]&(~BIT3)));
+ }
+ ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)(MACBackup[i]&(~BIT5)));
+
+}
+
+VOID
+_PHY_PathAStandBy(
+#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, bMaskDWord, 0x0);
+ ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x00010000);
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000);
+}
+
+VOID
+_PHY_PIModeSwitch(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN PIMode
+ )
+{
+ u4Byte mode;
+#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, ("BB Switch to %s mode!\n", (PIMode ? "PI" : "SI")));
+
+ mode = PIMode ? 0x01000100 : 0x01000000;
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, bMaskDWord, mode);
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XB_HSSIParameter1, bMaskDWord, mode);
+}
+
+BOOLEAN
+phy_SimularityCompare_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN s4Byte result[][8],
+ IN u1Byte c1,
+ IN u1Byte c2
+ )
+{
+ u4Byte i, j, diff, SimularityBitMap, bound = 0;
+#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
+ u1Byte final_candidate[2] = {0xFF, 0xFF}; //for path A and path B
+ BOOLEAN bResult = TRUE;
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ BOOLEAN is2T = IS_92C_SERIAL( pHalData->VersionID);
+#else
+ BOOLEAN is2T = 0;
+#endif
+
+ if(is2T)
+ bound = 8;
+ else
+ bound = 4;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("===> IQK:phy_SimularityCompare_8188E c1 %d c2 %d!!!\n", c1, c2));
+
+
+ SimularityBitMap = 0;
+
+ for( i = 0; i < bound; i++ )
+ {
+ diff = (result[c1][i] > result[c2][i]) ? (result[c1][i] - result[c2][i]) : (result[c2][i] - result[c1][i]);
+ if (diff > MAX_TOLERANCE)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:phy_SimularityCompare_8188E differnece overflow index %d compare1 0x%x compare2 0x%x!!!\n", i, result[c1][i], result[c2][i]));
+
+ if((i == 2 || i == 6) && !SimularityBitMap)
+ {
+ if(result[c1][i]+result[c1][i+1] == 0)
+ final_candidate[(i/4)] = c2;
+ else if (result[c2][i]+result[c2][i+1] == 0)
+ final_candidate[(i/4)] = c1;
+ else
+ SimularityBitMap = SimularityBitMap|(1<<i);
+ }
+ else
+ SimularityBitMap = SimularityBitMap|(1<<i);
+ }
+ }
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:phy_SimularityCompare_8188E SimularityBitMap %d !!!\n", SimularityBitMap));
+
+ if ( SimularityBitMap == 0)
+ {
+ for( i = 0; i < (bound/4); i++ )
+ {
+ if(final_candidate[i] != 0xFF)
+ {
+ for( j = i*4; j < (i+1)*4-2; j++)
+ result[3][j] = result[final_candidate[i]][j];
+ bResult = FALSE;
+ }
+ }
+ return bResult;
+ }
+ else if (!(SimularityBitMap & 0x0F)) //path A OK
+ {
+ for(i = 0; i < 4; i++)
+ result[3][i] = result[c1][i];
+ return FALSE;
+ }
+ else if (!(SimularityBitMap & 0xF0) && is2T) //path B OK
+ {
+ for(i = 4; i < 8; i++)
+ result[3][i] = result[c1][i];
+ return FALSE;
+ }
+ else
+ return FALSE;
+
+}
+
+
+
+VOID
+phy_IQCalibrate_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN s4Byte result[][8],
+ IN u1Byte t,
+ IN BOOLEAN is2T
+ )
+{
+#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
+ u4Byte i;
+ u1Byte PathAOK=0, PathBOK=0;
+ u4Byte ADDA_REG[IQK_ADDA_REG_NUM] = {
+ rFPGA0_XCD_SwitchControl, rBlue_Tooth,
+ rRx_Wait_CCA, rTx_CCK_RFON,
+ rTx_CCK_BBON, rTx_OFDM_RFON,
+ rTx_OFDM_BBON, rTx_To_Rx,
+ rTx_To_Tx, rRx_CCK,
+ rRx_OFDM, rRx_Wait_RIFS,
+ rRx_TO_Rx, rStandby,
+ rSleep, rPMPD_ANAEN };
+ u4Byte IQK_MAC_REG[IQK_MAC_REG_NUM] = {
+ REG_TXPAUSE, REG_BCN_CTRL,
+ REG_BCN_CTRL_1, REG_GPIO_MUXCFG};
+
+ //since 92C & 92D have the different define in IQK_BB_REG
+ u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = {
+ rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar,
+ rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB,
+ rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE,
+ rFPGA0_XB_RFInterfaceOE, rCCK0_AFESetting
+ };
+
+ u4Byte retryCount = 2;
+
+ if ( *(pDM_Odm->mp_mode) == 1)
+ retryCount = 9;
+
+ // Note: IQ calibration must be performed after loading
+ // PHY_REG.txt , and radio_a, radio_b.txt
+
+ //u4Byte bbvalue;
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
+#ifdef MP_TEST
+ if(pDM_Odm->priv->pshare->rf_ft_var.mp_specific)
+ retryCount = 9;
+#endif
+#endif
+
+
+ if(t==0)
+ {
+// bbvalue = ODM_GetBBReg(pDM_Odm, rFPGA0_RFMOD, bMaskDWord);
+// RT_DISP(FINIT, INIT_IQK, ("phy_IQCalibrate_8188E()==>0x%08x\n",bbvalue));
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t));
+
+ // Save ADDA parameters, turn Path A ADDA on
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_SaveADDARegisters(pAdapter, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM);
+ _PHY_SaveMACRegisters(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
+ _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM);
+#else
+ _PHY_SaveADDARegisters(pDM_Odm, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM);
+ _PHY_SaveMACRegisters(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
+ _PHY_SaveADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM);
+#endif
+ }
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t));
+
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+
+ _PHY_PathADDAOn(pAdapter, ADDA_REG, TRUE, is2T);
+#else
+ _PHY_PathADDAOn(pDM_Odm, ADDA_REG, TRUE, is2T);
+#endif
+
+
+ if(t==0)
+ {
+ pDM_Odm->RFCalibrateInfo.bRfPiEnable = (u1Byte)ODM_GetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, BIT(8));
+ }
+
+ if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){
+ // Switch BB to PI mode to do IQ Calibration.
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_PIModeSwitch(pAdapter, TRUE);
+#else
+ _PHY_PIModeSwitch(pDM_Odm, TRUE);
+#endif
+ }
+
+
+ //MAC settings
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_MACSettingCalibration(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
+#else
+ _PHY_MACSettingCalibration(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
+#endif
+
+ //BB setting
+ //ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 0x00);
+ 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, 0x22204000);
+
+
+ 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, 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);
+ }
+
+ //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, rTx_IQK, bMaskDWord, 0x01007c00);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x81004800);
+
+ for(i = 0 ; i < retryCount ; i++){
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ PathAOK = phy_PathA_IQK_8188E(pAdapter, is2T);
+#else
+ PathAOK = phy_PathA_IQK_8188E(pDM_Odm, is2T);
+#endif
+// if(PathAOK == 0x03){
+ if(PathAOK == 0x01){
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Tx IQK Success!!\n"));
+ result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16;
+ result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16;
+ break;
+ }
+#if 0
+ else if (i == (retryCount-1) && PathAOK == 0x01) //Tx IQK OK
+ {
+ RT_DISP(FINIT, INIT_IQK, ("Path A IQK Only Tx Success!!\n"));
+
+ result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16;
+ result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16;
+ }
+#endif
+ }
+
+ for(i = 0 ; i < retryCount ; i++){
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ PathAOK = phy_PathA_RxIQK(pAdapter, is2T);
+#else
+ PathAOK = phy_PathA_RxIQK(pDM_Odm, is2T);
+#endif
+ if(PathAOK == 0x03){
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Success!!\n"));
+// result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16;
+// result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16;
+ result[t][2] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord)&0x3FF0000)>>16;
+ result[t][3] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord)&0x3FF0000)>>16;
+ break;
+ }
+ else
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Fail!!\n"));
+ }
+ }
+
+ if(0x00 == PathAOK){
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK failed!!\n"));
+ }
+
+ if(is2T){
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_PathAStandBy(pAdapter);
+
+ // Turn Path B ADDA on
+ _PHY_PathADDAOn(pAdapter, ADDA_REG, FALSE, is2T);
+#else
+ _PHY_PathAStandBy(pDM_Odm);
+
+ // Turn Path B ADDA on
+ _PHY_PathADDAOn(pDM_Odm, ADDA_REG, FALSE, is2T);
+#endif
+
+ for(i = 0 ; i < retryCount ; i++){
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ PathBOK = phy_PathB_IQK_8188E(pAdapter);
+#else
+ PathBOK = phy_PathB_IQK_8188E(pDM_Odm);
+#endif
+ if(PathBOK == 0x03){
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK Success!!\n"));
+ result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16;
+ result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16;
+ result[t][6] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_B_2, bMaskDWord)&0x3FF0000)>>16;
+ result[t][7] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord)&0x3FF0000)>>16;
+ break;
+ }
+ else if (i == (retryCount - 1) && PathBOK == 0x01) //Tx IQK OK
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Only Tx IQK Success!!\n"));
+ result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16;
+ result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16;
+ }
+ }
+
+ if(0x00 == PathBOK){
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK failed!!\n"));
+ }
+ }
+
+ //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);
+
+ if(t!=0)
+ {
+ if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){
+ // Switch back BB to SI mode after finish IQ Calibration.
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_PIModeSwitch(pAdapter, FALSE);
+#else
+ _PHY_PIModeSwitch(pDM_Odm, FALSE);
+#endif
+ }
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+
+ // Reload ADDA power saving parameters
+ _PHY_ReloadADDARegisters(pAdapter, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM);
+
+ // Reload MAC parameters
+ _PHY_ReloadMACRegisters(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
+
+ _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM);
+#else
+ // Reload ADDA power saving parameters
+ _PHY_ReloadADDARegisters(pDM_Odm, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM);
+
+ // Reload MAC parameters
+ _PHY_ReloadMACRegisters(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup);
+
+ _PHY_ReloadADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM);
+#endif
+
+
+ // Restore RX initial gain
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00032ed3);
+ if(is2T){
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00032ed3);
+ }
+
+ //load 0xe30 IQC default value
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00);
+
+ }
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_IQCalibrate_8188E() <==\n"));
+
+}
+
+
+VOID
+phy_LCCalibrate_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ IN BOOLEAN is2T
+ )
+{
+ u1Byte tmpReg;
+ u4Byte RF_Amode=0, RF_Bmode=0, LC_Cal;
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ PADAPTER pAdapter = pDM_Odm->Adapter;
+#endif
+ //Check continuous TX and Packet TX
+ tmpReg = ODM_Read1Byte(pDM_Odm, 0xd03);
+
+ if((tmpReg&0x70) != 0) //Deal with contisuous TX case
+ ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg&0x8F); //disable all continuous TX
+ else // Deal with Packet TX case
+ ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0xFF); // block all queues
+
+ if((tmpReg&0x70) != 0)
+ {
+ //1. Read original RF mode
+ //Path-A
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ RF_Amode = PHY_QueryRFReg(pAdapter, ODM_RF_PATH_A, RF_AC, bMask12Bits);
+
+ //Path-B
+ if(is2T)
+ RF_Bmode = PHY_QueryRFReg(pAdapter, ODM_RF_PATH_B, RF_AC, bMask12Bits);
+#else
+ RF_Amode = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMask12Bits);
+
+ //Path-B
+ if(is2T)
+ RF_Bmode = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMask12Bits);
+#endif
+
+ //2. Set RF mode = standby mode
+ //Path-A
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode&0x8FFFF)|0x10000);
+
+ //Path-B
+ if(is2T)
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode&0x8FFFF)|0x10000);
+ }
+
+ //3. Read RF reg18
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ LC_Cal = PHY_QueryRFReg(pAdapter, ODM_RF_PATH_A, RF_CHNLBW, bMask12Bits);
+#else
+ LC_Cal = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bMask12Bits);
+#endif
+
+ //4. Set LC calibration begin bit15
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bMask12Bits, LC_Cal|0x08000);
+
+ ODM_delay_ms(100);
+
+
+ //Restore original situation
+ if((tmpReg&0x70) != 0) //Deal with contisuous TX case
+ {
+ //Path-A
+ ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg);
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMask12Bits, RF_Amode);
+
+ //Path-B
+ if(is2T)
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode);
+ }
+ else // Deal with Packet TX case
+ {
+ ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0x00);
+ }
+}
+
+//Analog Pre-distortion calibration
+#define APK_BB_REG_NUM 8
+#define APK_CURVE_REG_NUM 4
+#define PATH_NUM 2
+
+VOID
+phy_APCalibrate_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN s1Byte delta,
+ IN BOOLEAN is2T
+ )
+{
+#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
+ u4Byte regD[PATH_NUM];
+ u4Byte tmpReg, index, offset, apkbound;
+ u1Byte path, i, pathbound = PATH_NUM;
+ u4Byte BB_backup[APK_BB_REG_NUM];
+ u4Byte BB_REG[APK_BB_REG_NUM] = {
+ rFPGA1_TxBlock, rOFDM0_TRxPathEnable,
+ rFPGA0_RFMOD, rOFDM0_TRMuxPar,
+ rFPGA0_XCD_RFInterfaceSW, rFPGA0_XAB_RFInterfaceSW,
+ rFPGA0_XA_RFInterfaceOE, rFPGA0_XB_RFInterfaceOE };
+ u4Byte BB_AP_MODE[APK_BB_REG_NUM] = {
+ 0x00000020, 0x00a05430, 0x02040000,
+ 0x000800e4, 0x00204000 };
+ u4Byte BB_normal_AP_MODE[APK_BB_REG_NUM] = {
+ 0x00000020, 0x00a05430, 0x02040000,
+ 0x000800e4, 0x22204000 };
+
+ u4Byte AFE_backup[IQK_ADDA_REG_NUM];
+ u4Byte AFE_REG[IQK_ADDA_REG_NUM] = {
+ rFPGA0_XCD_SwitchControl, rBlue_Tooth,
+ rRx_Wait_CCA, rTx_CCK_RFON,
+ rTx_CCK_BBON, rTx_OFDM_RFON,
+ rTx_OFDM_BBON, rTx_To_Rx,
+ rTx_To_Tx, rRx_CCK,
+ rRx_OFDM, rRx_Wait_RIFS,
+ rRx_TO_Rx, rStandby,
+ rSleep, rPMPD_ANAEN };
+
+ u4Byte MAC_backup[IQK_MAC_REG_NUM];
+ u4Byte MAC_REG[IQK_MAC_REG_NUM] = {
+ REG_TXPAUSE, REG_BCN_CTRL,
+ REG_BCN_CTRL_1, REG_GPIO_MUXCFG};
+
+ u4Byte APK_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = {
+ {0x0852c, 0x1852c, 0x5852c, 0x1852c, 0x5852c},
+ {0x2852e, 0x0852e, 0x3852e, 0x0852e, 0x0852e}
+ };
+
+ u4Byte APK_normal_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = {
+ {0x0852c, 0x0a52c, 0x3a52c, 0x5a52c, 0x5a52c}, //path settings equal to path b settings
+ {0x0852c, 0x0a52c, 0x5a52c, 0x5a52c, 0x5a52c}
+ };
+
+ u4Byte APK_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = {
+ {0x52019, 0x52014, 0x52013, 0x5200f, 0x5208d},
+ {0x5201a, 0x52019, 0x52016, 0x52033, 0x52050}
+ };
+
+ u4Byte APK_normal_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = {
+ {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}, //path settings equal to path b settings
+ {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}
+ };
+
+ u4Byte AFE_on_off[PATH_NUM] = {
+ 0x04db25a4, 0x0b1b25a4}; //path A on path B off / path A off path B on
+
+ u4Byte APK_offset[PATH_NUM] = {
+ rConfig_AntA, rConfig_AntB};
+
+ u4Byte APK_normal_offset[PATH_NUM] = {
+ rConfig_Pmpd_AntA, rConfig_Pmpd_AntB};
+
+ u4Byte APK_value[PATH_NUM] = {
+ 0x92fc0000, 0x12fc0000};
+
+ u4Byte APK_normal_value[PATH_NUM] = {
+ 0x92680000, 0x12680000};
+
+ s1Byte APK_delta_mapping[APK_BB_REG_NUM][13] = {
+ {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
+ {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
+ {-6, -4, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
+ {-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6},
+ {-11, -9, -7, -5, -3, -1, 0, 0, 0, 0, 0, 0, 0}
+ };
+
+ u4Byte APK_normal_setting_value_1[13] = {
+ 0x01017018, 0xf7ed8f84, 0x1b1a1816, 0x2522201e, 0x322e2b28,
+ 0x433f3a36, 0x5b544e49, 0x7b726a62, 0xa69a8f84, 0xdfcfc0b3,
+ 0x12680000, 0x00880000, 0x00880000
+ };
+
+ u4Byte APK_normal_setting_value_2[16] = {
+ 0x01c7021d, 0x01670183, 0x01000123, 0x00bf00e2, 0x008d00a3,
+ 0x0068007b, 0x004d0059, 0x003a0042, 0x002b0031, 0x001f0025,
+ 0x0017001b, 0x00110014, 0x000c000f, 0x0009000b, 0x00070008,
+ 0x00050006
+ };
+
+ u4Byte APK_result[PATH_NUM][APK_BB_REG_NUM]; //val_1_1a, val_1_2a, val_2a, val_3a, val_4a
+// u4Byte AP_curve[PATH_NUM][APK_CURVE_REG_NUM];
+
+ s4Byte BB_offset, delta_V, delta_offset;
+
+#if MP_DRIVER == 1
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx);
+#else
+ PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx);
+#endif
+
+ if ( *(pDM_Odm->mp_mode) == 1)
+ {
+ pMptCtx->APK_bound[0] = 45;
+ pMptCtx->APK_bound[1] = 52;
+ }
+#endif
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("==>phy_APCalibrate_8188E() delta %d\n", delta));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("AP Calibration for %s\n", (is2T ? "2T2R" : "1T1R")));
+ if(!is2T)
+ pathbound = 1;
+
+ //2 FOR NORMAL CHIP SETTINGS
+
+// Temporarily do not allow normal driver to do the following settings because these offset
+// and value will cause RF internal PA to be unpredictably disabled by HW, such that RF Tx signal
+// 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)
+ return;
+//#endif
+ //settings adjust for normal chip
+ for(index = 0; index < PATH_NUM; index ++)
+ {
+ APK_offset[index] = APK_normal_offset[index];
+ APK_value[index] = APK_normal_value[index];
+ AFE_on_off[index] = 0x6fdb25a4;
+ }
+
+ for(index = 0; index < APK_BB_REG_NUM; index ++)
+ {
+ for(path = 0; path < pathbound; path++)
+ {
+ APK_RF_init_value[path][index] = APK_normal_RF_init_value[path][index];
+ APK_RF_value_0[path][index] = APK_normal_RF_value_0[path][index];
+ }
+ BB_AP_MODE[index] = BB_normal_AP_MODE[index];
+ }
+
+ apkbound = 6;
+
+ //save BB default value
+ for(index = 0; index < APK_BB_REG_NUM ; index++)
+ {
+ if(index == 0) //skip
+ continue;
+ BB_backup[index] = ODM_GetBBReg(pDM_Odm, BB_REG[index], bMaskDWord);
+ }
+
+ //save MAC default value
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_SaveMACRegisters(pAdapter, MAC_REG, MAC_backup);
+
+ //save AFE default value
+ _PHY_SaveADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
+#else
+ _PHY_SaveMACRegisters(pDM_Odm, MAC_REG, MAC_backup);
+
+ //save AFE default value
+ _PHY_SaveADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
+#endif
+
+ for(path = 0; path < pathbound; path++)
+ {
+
+
+ if(path == ODM_RF_PATH_A)
+ {
+ //path A APK
+ //load APK setting
+ //path-A
+ offset = rPdp_AntA;
+ for(index = 0; index < 11; index ++)
+ {
+ ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
+
+ offset += 0x04;
+ }
+
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000);
+
+ offset = rConfig_AntA;
+ for(; index < 13; index ++)
+ {
+ ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
+
+ offset += 0x04;
+ }
+
+ //page-B1
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000);
+
+ //path A
+ offset = rPdp_AntA;
+ for(index = 0; index < 16; index++)
+ {
+ ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_2[index]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
+
+ offset += 0x04;
+ }
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
+ }
+ else if(path == ODM_RF_PATH_B)
+ {
+ //path B APK
+ //load APK setting
+ //path-B
+ offset = rPdp_AntB;
+ for(index = 0; index < 10; index ++)
+ {
+ ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
+
+ offset += 0x04;
+ }
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x12680000);
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ PHY_SetBBReg(pAdapter, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000);
+#else
+ PHY_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000);
+#endif
+
+ offset = rConfig_AntA;
+ index = 11;
+ for(; index < 13; index ++) //offset 0xb68, 0xb6c
+ {
+ ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
+
+ offset += 0x04;
+ }
+
+ //page-B1
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000);
+
+ //path B
+ offset = 0xb60;
+ for(index = 0; index < 16; index++)
+ {
+ ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_2[index]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord)));
+
+ offset += 0x04;
+ }
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0);
+ }
+
+ //save RF default value
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ regD[path] = PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bMaskDWord);
+#else
+ regD[path] = ODM_GetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_TXBIAS_A, bMaskDWord);
+#endif
+
+ //Path A AFE all on, path B AFE All off or vise versa
+ for(index = 0; index < IQK_ADDA_REG_NUM ; index++)
+ ODM_SetBBReg(pDM_Odm, AFE_REG[index], bMaskDWord, AFE_on_off[path]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xe70 %x\n", ODM_GetBBReg(pDM_Odm, rRx_Wait_CCA, bMaskDWord)));
+
+ //BB to AP mode
+ if(path == 0)
+ {
+ for(index = 0; index < APK_BB_REG_NUM ; index++)
+ {
+
+ if(index == 0) //skip
+ continue;
+ else if (index < 5)
+ ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_AP_MODE[index]);
+ else if (BB_REG[index] == 0x870)
+ ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]|BIT10|BIT26);
+ else
+ ODM_SetBBReg(pDM_Odm, BB_REG[index], BIT10, 0x0);
+ }
+
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00);
+ }
+ else //path B
+ {
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x01008c00);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x01008c00);
+
+ }
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x800 %x\n", ODM_GetBBReg(pDM_Odm, 0x800, bMaskDWord)));
+
+ //MAC settings
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_MACSettingCalibration(pAdapter, MAC_REG, MAC_backup);
+#else
+ _PHY_MACSettingCalibration(pDM_Odm, MAC_REG, MAC_backup);
+#endif
+
+ if(path == ODM_RF_PATH_A) //Path B to standby mode
+ {
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMaskDWord, 0x10000);
+ }
+ else //Path A to standby mode
+ {
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMaskDWord, 0x10000);
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f);
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE2, bMaskDWord, 0x20103);
+ }
+
+ delta_offset = ((delta+14)/2);
+ if(delta_offset < 0)
+ delta_offset = 0;
+ else if (delta_offset > 12)
+ delta_offset = 12;
+
+ //AP calibration
+ for(index = 0; index < APK_BB_REG_NUM; index++)
+ {
+ if(index != 1) //only DO PA11+PAD01001, AP RF setting
+ continue;
+
+ tmpReg = APK_RF_init_value[path][index];
+#if 1
+ if(!pDM_Odm->RFCalibrateInfo.bAPKThermalMeterIgnore)
+ {
+ BB_offset = (tmpReg & 0xF0000) >> 16;
+
+ if(!(tmpReg & BIT15)) //sign bit 0
+ {
+ BB_offset = -BB_offset;
+ }
+
+ delta_V = APK_delta_mapping[index][delta_offset];
+
+ BB_offset += delta_V;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() APK index %d tmpReg 0x%x delta_V %d delta_offset %d\n", index, tmpReg, delta_V, delta_offset));
+
+ if(BB_offset < 0)
+ {
+ tmpReg = tmpReg & (~BIT15);
+ BB_offset = -BB_offset;
+ }
+ else
+ {
+ tmpReg = tmpReg | BIT15;
+ }
+ tmpReg = (tmpReg & 0xFFF0FFFF) | (BB_offset << 16);
+ }
+#endif
+
+ ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_IPA_A, bMaskDWord, 0x8992e);
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xc %x\n", PHY_QueryRFReg(pAdapter, path, RF_IPA_A, bMaskDWord)));
+ ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_AC, bMaskDWord, APK_RF_value_0[path][index]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x0 %x\n", PHY_QueryRFReg(pAdapter, path, RF_AC, bMaskDWord)));
+ ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_TXBIAS_A, bMaskDWord, tmpReg);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xd %x\n", PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bMaskDWord)));
+#else
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xc %x\n", ODM_GetRFReg(pDM_Odm, path, RF_IPA_A, bMaskDWord)));
+ ODM_SetRFReg(pDM_Odm, path, RF_AC, bMaskDWord, APK_RF_value_0[path][index]);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x0 %x\n", ODM_GetRFReg(pDM_Odm, path, RF_AC, bMaskDWord)));
+ ODM_SetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord, tmpReg);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xd %x\n", ODM_GetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord)));
+#endif
+
+ // PA11+PAD01111, one shot
+ i = 0;
+ do
+ {
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80000000);
+ {
+ 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)));
+ ODM_delay_ms(3);
+ ODM_SetBBReg(pDM_Odm, APK_offset[path], bMaskDWord, APK_value[1]);
+ 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)));
+
+ ODM_delay_ms(20);
+ }
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
+
+ if(path == ODM_RF_PATH_A)
+ tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0x03E00000);
+ else
+ tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0xF8000000);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xbd8[25:21] %x\n", tmpReg));
+
+
+ i++;
+ }
+ while(tmpReg > apkbound && i < 4);
+
+ APK_result[path][index] = tmpReg;
+ }
+ }
+
+ //reload MAC default value
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_ReloadMACRegisters(pAdapter, MAC_REG, MAC_backup);
+#else
+ _PHY_ReloadMACRegisters(pDM_Odm, MAC_REG, MAC_backup);
+#endif
+
+ //reload BB default value
+ for(index = 0; index < APK_BB_REG_NUM ; index++)
+ {
+
+ if(index == 0) //skip
+ continue;
+ ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]);
+ }
+
+ //reload AFE default value
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_ReloadADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
+#else
+ _PHY_ReloadADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
+#endif
+
+ //reload RF path default value
+ for(path = 0; path < pathbound; path++)
+ {
+ ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, 0xd, bMaskDWord, regD[path]);
+ if(path == ODM_RF_PATH_B)
+ {
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f);
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE2, bMaskDWord, 0x20101);
+ }
+
+ //note no index == 0
+ if (APK_result[path][1] > 6)
+ APK_result[path][1] = 6;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("apk path %d result %d 0x%x \t", path, 1, APK_result[path][1]));
+ }
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("\n"));
+
+
+ for(path = 0; path < pathbound; path++)
+ {
+ ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, 0x3, bMaskDWord,
+ ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (APK_result[path][1] << 5) | APK_result[path][1]));
+ if(path == ODM_RF_PATH_A)
+ ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, 0x4, bMaskDWord,
+ ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x00 << 5) | 0x05));
+ else
+ ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, 0x4, bMaskDWord,
+ ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x02 << 5) | 0x05));
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ if(!IS_HARDWARE_TYPE_8723A(pAdapter))
+ ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)path, RF_BS_PA_APSET_G9_G11, bMaskDWord,
+ ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | 0x08));
+#endif
+ }
+
+ pDM_Odm->RFCalibrateInfo.bAPKdone = TRUE;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("<==phy_APCalibrate_8188E()\n"));
+}
+
+
+
+#define DP_BB_REG_NUM 7
+#define DP_RF_REG_NUM 1
+#define DP_RETRY_LIMIT 10
+#define DP_PATH_NUM 2
+#define DP_DPK_NUM 3
+#define DP_DPK_VALUE_NUM 2
+
+
+
+
+
+VOID
+PHY_IQCalibrate_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN bReCovery
+ )
+{
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+
+ #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
+ #else // (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv;
+ #endif
+
+ #if (MP_DRIVER == 1)
+ #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx);
+ #else// (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx);
+ #endif
+ #endif//(MP_DRIVER == 1)
+#endif
+
+ s4Byte result[4][8]; //last is final result
+ u1Byte i, final_candidate, Indexforchannel;
+ u1Byte channelToIQK = 7;
+ BOOLEAN bPathAOK, bPathBOK;
+ s4Byte RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC, RegTmp = 0;
+ BOOLEAN is12simular, is13simular, is23simular;
+ BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE;
+ u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = {
+ rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance,
+ rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable,
+ rOFDM0_XATxIQImbalance, rOFDM0_XBTxIQImbalance,
+ rOFDM0_XCTxAFE, rOFDM0_XDTxAFE,
+ rOFDM0_RxIQExtAnta};
+ u4Byte StartTime;
+ s4Byte ProgressingTime;
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE) )
+ if (ODM_CheckPowerStatus(pAdapter) == FALSE)
+ return;
+#else
+ prtl8192cd_priv priv = pDM_Odm->priv;
+
+#ifdef MP_TEST
+ if(priv->pshare->rf_ft_var.mp_specific)
+ {
+ if((OPMODE & WIFI_MP_CTX_PACKET) || (OPMODE & WIFI_MP_CTX_ST))
+ return;
+ }
+#endif
+
+ if(priv->pshare->IQK_88E_done)
+ bReCovery= 1;
+ priv->pshare->IQK_88E_done = 1;
+
+#endif
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION))
+ {
+ return;
+ }
+#endif
+
+#if MP_DRIVER == 1
+ if (*(pDM_Odm->mp_mode) == 1)
+ {
+ bStartContTx = pMptCtx->bStartContTx;
+ bSingleTone = pMptCtx->bSingleTone;
+ bCarrierSuppression = pMptCtx->bCarrierSuppression;
+ }
+#endif
+
+ // 20120213<Kordan> Turn on when continuous Tx to pass lab testing. (required by Edlu)
+ if(bSingleTone || bCarrierSuppression)
+ return;
+
+#if DISABLE_BB_RF
+ return;
+#endif
+
+ if (pDM_Odm->RFCalibrateInfo.bIQKInProgress)
+ return;
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_AP))
+ if(bReCovery)
+#else//for ODM_WIN
+ if(bReCovery && (!pAdapter->bInHctTest)) //YJ,add for PowerTest,120405
+#endif
+ {
+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("PHY_IQCalibrate_8188E: Return due to bReCovery!\n"));
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9);
+#else
+ _PHY_ReloadADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9);
+#endif
+ return;
+ }
+
+ ODM_AcquireSpinLock(pDM_Odm, RT_IQK_SPINLOCK);
+ pDM_Odm->RFCalibrateInfo.bIQKInProgress = TRUE;
+ ODM_ReleaseSpinLock(pDM_Odm, RT_IQK_SPINLOCK);
+
+ StartTime = ODM_GetCurrentTime( pDM_Odm);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Start!!!\n"));
+
+
+
+ for(i = 0; i < 8; i++)
+ {
+ result[0][i] = 0;
+ result[1][i] = 0;
+ result[2][i] = 0;
+ result[3][i] = 0;
+ }
+ final_candidate = 0xff;
+ bPathAOK = FALSE;
+ bPathBOK = FALSE;
+ is12simular = FALSE;
+ is23simular = FALSE;
+ is13simular = FALSE;
+
+
+ for (i=0; i<3; i++)
+ {
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+
+ if(IS_92C_SERIAL( pHalData->VersionID))
+ {
+ phy_IQCalibrate_8188E(pAdapter, result, i, TRUE);
+ }
+ else
+#endif
+ {
+ // For 88C 1T1R
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ phy_IQCalibrate_8188E(pAdapter, result, i, FALSE);
+#else
+ phy_IQCalibrate_8188E(pDM_Odm, result, i, FALSE);
+#endif
+ }
+
+ if(i == 1)
+ {
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ is12simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 1);
+#else
+ is12simular = phy_SimularityCompare_8188E(pDM_Odm, result, 0, 1);
+#endif
+ if(is12simular)
+ {
+ final_candidate = 0;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is12simular final_candidate is %x\n",final_candidate));
+ break;
+ }
+ }
+
+ if(i == 2)
+ {
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ is13simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 2);
+#else
+ is13simular = phy_SimularityCompare_8188E(pDM_Odm, result, 0, 2);
+#endif
+ if(is13simular)
+ {
+ final_candidate = 0;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is13simular final_candidate is %x\n",final_candidate));
+
+ break;
+ }
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ is23simular = phy_SimularityCompare_8188E(pAdapter, result, 1, 2);
+#else
+ is23simular = phy_SimularityCompare_8188E(pDM_Odm, result, 1, 2);
+#endif
+ if(is23simular)
+ {
+ final_candidate = 1;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is23simular final_candidate is %x\n",final_candidate));
+ }
+ else
+ {
+ for(i = 0; i < 8; i++)
+ RegTmp += result[3][i];
+
+ if(RegTmp != 0)
+ final_candidate = 3;
+ else
+ final_candidate = 0xFF;
+ }
+ }
+ }
+// RT_TRACE(COMP_INIT,DBG_LOUD,("Release Mutex in IQCalibrate \n"));
+
+ for (i=0; i<4; i++)
+ {
+ RegE94 = result[i][0];
+ RegE9C = result[i][1];
+ RegEA4 = result[i][2];
+ RegEAC = result[i][3];
+ RegEB4 = result[i][4];
+ RegEBC = result[i][5];
+ RegEC4 = result[i][6];
+ RegECC = result[i][7];
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC));
+ }
+
+ if(final_candidate != 0xff)
+ {
+ pDM_Odm->RFCalibrateInfo.RegE94 = RegE94 = result[final_candidate][0];
+ pDM_Odm->RFCalibrateInfo.RegE9C = RegE9C = result[final_candidate][1];
+ RegEA4 = result[final_candidate][2];
+ RegEAC = result[final_candidate][3];
+ pDM_Odm->RFCalibrateInfo.RegEB4 = RegEB4 = result[final_candidate][4];
+ pDM_Odm->RFCalibrateInfo.RegEBC = RegEBC = result[final_candidate][5];
+ RegEC4 = result[final_candidate][6];
+ RegECC = result[final_candidate][7];
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: final_candidate is %x\n",final_candidate));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC));
+ bPathAOK = bPathBOK = TRUE;
+ }
+ else
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: FAIL use default value\n"));
+
+ pDM_Odm->RFCalibrateInfo.RegE94 = pDM_Odm->RFCalibrateInfo.RegEB4 = 0x100; //X default value
+ pDM_Odm->RFCalibrateInfo.RegE9C = pDM_Odm->RFCalibrateInfo.RegEBC = 0x0; //Y default value
+ }
+
+ if((RegE94 != 0)/*&&(RegEA4 != 0)*/)
+ {
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_PathAFillIQKMatrix(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0));
+#else
+ _PHY_PathAFillIQKMatrix(pDM_Odm, bPathAOK, result, final_candidate, (RegEA4 == 0));
+#endif
+ }
+
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ if (IS_92C_SERIAL(pHalData->VersionID))
+ {
+ if((RegEB4 != 0)/*&&(RegEC4 != 0)*/)
+ {
+ _PHY_PathBFillIQKMatrix(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0));
+ }
+ }
+#endif
+
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel);
+#else
+ Indexforchannel = 0;
+#endif
+
+//To Fix BSOD when final_candidate is 0xff
+//by sherry 20120321
+ if(final_candidate < 4)
+ {
+ for(i = 0; i < IQK_Matrix_REG_NUM; i++)
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i];
+ pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].bIQKDone = TRUE;
+ }
+ //RT_DISP(FINIT, INIT_IQK, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel));
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+
+ _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9);
+#else
+ _PHY_SaveADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, IQK_BB_REG_NUM);
+#endif
+
+ ODM_AcquireSpinLock(pDM_Odm, RT_IQK_SPINLOCK);
+ pDM_Odm->RFCalibrateInfo.bIQKInProgress = FALSE;
+ ODM_ReleaseSpinLock(pDM_Odm, RT_IQK_SPINLOCK);
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK finished\n"));
+ ProgressingTime = ODM_GetProgressingTime( pDM_Odm, StartTime);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK ProgressingTime = %d\n", ProgressingTime));
+
+}
+
+
+VOID
+PHY_LCCalibrate_8188E(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE;
+ u4Byte timeout = 2000, timecount = 0;
+ u4Byte StartTime;
+ s4Byte ProgressingTime;
+
+
+
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ PADAPTER pAdapter = pDM_Odm->Adapter;
+ //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+
+ #if (MP_DRIVER == 1)
+ #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx);
+ #else// (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx);
+ #endif
+ #endif//(MP_DRIVER == 1)
+#endif
+
+#if MP_DRIVER == 1
+ if (*(pDM_Odm->mp_mode) == 1)
+ {
+ bStartContTx = pMptCtx->bStartContTx;
+ bSingleTone = pMptCtx->bSingleTone;
+ bCarrierSuppression = pMptCtx->bCarrierSuppression;
+ }
+#endif
+
+
+#if DISABLE_BB_RF
+ return;
+#endif
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION))
+ {
+ return;
+ }
+#endif
+ // 20120213<Kordan> Turn on when continuous Tx to pass lab testing. (required by Edlu)
+ if(bSingleTone || bCarrierSuppression)
+ return;
+
+ StartTime = ODM_GetCurrentTime( pDM_Odm);
+ while(*(pDM_Odm->pbScanInProcess) && timecount < timeout)
+ {
+ ODM_delay_ms(50);
+ timecount += 50;
+ }
+
+ pDM_Odm->RFCalibrateInfo.bLCKInProgress = TRUE;
+
+ //ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Start!!!interface %d currentband %x delay %d ms\n", pDM_Odm->interfaceIndex, pHalData->CurrentBandType92D, timecount));
+ phy_LCCalibrate_8188E(pDM_Odm, FALSE);
+
+ pDM_Odm->RFCalibrateInfo.bLCKInProgress = FALSE;
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Finish!!!interface %d\n", pDM_Odm->InterfaceIndex));
+ ProgressingTime = ODM_GetProgressingTime( pDM_Odm, StartTime);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK ProgressingTime = %d\n", ProgressingTime));
+}
+
+VOID
+PHY_APCalibrate_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN s1Byte delta
+ )
+{
+#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
+#if DISABLE_BB_RF
+ return;
+#endif
+
+ return;
+#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION))
+ {
+ return;
+ }
+#endif
+
+#if FOR_BRAZIL_PRETEST != 1
+ if(pDM_Odm->RFCalibrateInfo.bAPKdone)
+#endif
+ return;
+
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ if(IS_92C_SERIAL( pHalData->VersionID)){
+ phy_APCalibrate_8188E(pAdapter, delta, TRUE);
+ }
+ else
+#endif
+ {
+ // For 88C 1T1R
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ phy_APCalibrate_8188E(pAdapter, delta, FALSE);
+#else
+ phy_APCalibrate_8188E(pDM_Odm, delta, FALSE);
+#endif
+ }
+}
+VOID phy_SetRFPathSwitch_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN bMain,
+ IN BOOLEAN is2T
+ )
+{
+#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;
+ #elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
+ #endif
+
+ #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ if(!pAdapter->bHWInitReady)
+ #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
+ if(pAdapter->hw_init_completed == _FALSE)
+ #endif
+ {
+ u1Byte u1bTmp;
+ u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7;
+ ODM_Write1Byte(pDM_Odm, REG_LEDCFG2, u1bTmp);
+ //ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01);
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01);
+ }
+
+#endif
+
+ if(is2T) //92C
+ {
+ if(bMain)
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); //92C_Path_A
+ else
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); //BT
+ }
+ else //88C
+ {
+
+ // <20120504, Kordan> [8188E] We should make AntDiversity controlled by HW (0x870[9:8] = 0),
+ // otherwise the following action has no effect. (0x860[9:8] has the effect only if AntDiversity controlled by SW)
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFInterfaceSW, BIT8|BIT9, 0x0);
+ ODM_SetBBReg(pDM_Odm, 0x914, bMaskLWord, 0x0201); // Set up the Ant mapping table
+
+ if(bMain)
+ {
+ //ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x2); // Tx Main (SW control)(The right antenna)
+ //4 [ Tx ]
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT14|BIT13|BIT12, 0x1); // Tx Main (HW control)(The right antenna)
+
+ //4 [ Rx ]
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT4|BIT3, 0x1); // AntDivType = TRDiv, right antenna
+ if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
+ ODM_SetBBReg(pDM_Odm, rConfig_ram64x16, BIT31, 0x1); // RxCG, Default is RxCG. AntDivType = 2RDiv, left antenna
+
+ }
+ else
+ {
+ //ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x1); // Tx Aux (SW control)(The left antenna)
+ //4 [ Tx ]
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT14|BIT13|BIT12, 0x0); // Tx Aux (HW control)(The left antenna)
+
+ //4 [ Rx ]
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT4|BIT3, 0x0); // AntDivType = TRDiv, left antenna
+ if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
+ ODM_SetBBReg(pDM_Odm, rConfig_ram64x16, BIT31, 0x0); // RxCS, AntDivType = 2RDiv, right antenna
+ }
+
+ }
+}
+VOID PHY_SetRFPathSwitch_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN bMain
+ )
+{
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+#endif
+
+#if DISABLE_BB_RF
+ return;
+#endif
+
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ if (IS_92C_SERIAL(pHalData->VersionID))
+ {
+ phy_SetRFPathSwitch_8188E(pAdapter, bMain, TRUE);
+ }
+ else
+#endif
+ {
+ // For 88C 1T1R
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ phy_SetRFPathSwitch_8188E(pAdapter, bMain, FALSE);
+#else
+ phy_SetRFPathSwitch_8188E(pDM_Odm, bMain, FALSE);
+#endif
+ }
+}
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+//digital predistortion
+VOID
+phy_DigitalPredistortion(
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PADAPTER pAdapter,
+#else
+ IN PDM_ODM_T pDM_Odm,
+#endif
+ IN BOOLEAN is2T
+ )
+{
+#if (RT_PLATFORM == PLATFORM_WINDOWS)
+#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
+
+ u4Byte tmpReg, tmpReg2, index, i;
+ u1Byte path, pathbound = PATH_NUM;
+ u4Byte AFE_backup[IQK_ADDA_REG_NUM];
+ u4Byte AFE_REG[IQK_ADDA_REG_NUM] = {
+ rFPGA0_XCD_SwitchControl, rBlue_Tooth,
+ rRx_Wait_CCA, rTx_CCK_RFON,
+ rTx_CCK_BBON, rTx_OFDM_RFON,
+ rTx_OFDM_BBON, rTx_To_Rx,
+ rTx_To_Tx, rRx_CCK,
+ rRx_OFDM, rRx_Wait_RIFS,
+ rRx_TO_Rx, rStandby,
+ rSleep, rPMPD_ANAEN };
+
+ u4Byte BB_backup[DP_BB_REG_NUM];
+ u4Byte BB_REG[DP_BB_REG_NUM] = {
+ rOFDM0_TRxPathEnable, rFPGA0_RFMOD,
+ rOFDM0_TRMuxPar, rFPGA0_XCD_RFInterfaceSW,
+ rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE,
+ rFPGA0_XB_RFInterfaceOE};
+ u4Byte BB_settings[DP_BB_REG_NUM] = {
+ 0x00a05430, 0x02040000, 0x000800e4, 0x22208000,
+ 0x0, 0x0, 0x0};
+
+ u4Byte RF_backup[DP_PATH_NUM][DP_RF_REG_NUM];
+ u4Byte RF_REG[DP_RF_REG_NUM] = {
+ RF_TXBIAS_A};
+
+ u4Byte MAC_backup[IQK_MAC_REG_NUM];
+ u4Byte MAC_REG[IQK_MAC_REG_NUM] = {
+ REG_TXPAUSE, REG_BCN_CTRL,
+ REG_BCN_CTRL_1, REG_GPIO_MUXCFG};
+
+ u4Byte Tx_AGC[DP_DPK_NUM][DP_DPK_VALUE_NUM] = {
+ {0x1e1e1e1e, 0x03901e1e},
+ {0x18181818, 0x03901818},
+ {0x0e0e0e0e, 0x03900e0e}
+ };
+
+ u4Byte AFE_on_off[PATH_NUM] = {
+ 0x04db25a4, 0x0b1b25a4}; //path A on path B off / path A off path B on
+
+ u1Byte RetryCount = 0;
+
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("==>phy_DigitalPredistortion()\n"));
+
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_DigitalPredistortion for %s\n", (is2T ? "2T2R" : "1T1R")));
+
+ //save BB default value
+ for(index=0; index<DP_BB_REG_NUM; index++)
+ BB_backup[index] = ODM_GetBBReg(pDM_Odm, BB_REG[index], bMaskDWord);
+
+ //save MAC default value
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_SaveMACRegisters(pAdapter, BB_REG, MAC_backup);
+#else
+ _PHY_SaveMACRegisters(pDM_Odm, BB_REG, MAC_backup);
+#endif
+
+ //save RF default value
+ for(path=0; path<DP_PATH_NUM; path++)
+ {
+ for(index=0; index<DP_RF_REG_NUM; index++)
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ RF_backup[path][index] = PHY_QueryRFReg(pAdapter, path, RF_REG[index], bMaskDWord);
+#else
+ RF_backup[path][index] = ODM_GetRFReg(pAdapter, path, RF_REG[index], bMaskDWord);
+#endif
+ }
+
+ //save AFE default value
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_SaveADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
+#else
+ _PHY_SaveADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
+#endif
+
+ //Path A/B AFE all on
+ for(index = 0; index < IQK_ADDA_REG_NUM ; index++)
+ ODM_SetBBReg(pDM_Odm, AFE_REG[index], bMaskDWord, 0x6fdb25a4);
+
+ //BB register setting
+ for(index = 0; index < DP_BB_REG_NUM; index++)
+ {
+ if(index < 4)
+ ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_settings[index]);
+ else if (index == 4)
+ ODM_SetBBReg(pDM_Odm,BB_REG[index], bMaskDWord, BB_backup[index]|BIT10|BIT26);
+ else
+ ODM_SetBBReg(pDM_Odm, BB_REG[index], BIT10, 0x00);
+ }
+
+ //MAC register setting
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_MACSettingCalibration(pAdapter, MAC_REG, MAC_backup);
+#else
+ _PHY_MACSettingCalibration(pDM_Odm, MAC_REG, MAC_backup);
+#endif
+
+ //PAGE-E IQC setting
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00);
+ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x01008c00);
+ ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x01008c00);
+
+ //path_A DPK
+ //Path B to standby mode
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMaskDWord, 0x10000);
+
+ // PA gain = 11 & PAD1 => tx_agc 1f ~11
+ // 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, 0xbc0, bMaskDWord, 0x0005361f);
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
+
+ //do inner loopback DPK 3 times
+ for(i = 0; i < 3; i++)
+ {
+ //PA gain = 11 & PAD2 => tx_agc = 0x0f/0x0c/0x07
+ for(index = 0; index < 3; index++)
+ ODM_SetBBReg(pDM_Odm, 0xe00+index*4, bMaskDWord, Tx_AGC[i][0]);
+ ODM_SetBBReg(pDM_Odm,0xe00+index*4, bMaskDWord, Tx_AGC[i][1]);
+ for(index = 0; index < 4; index++)
+ ODM_SetBBReg(pDM_Odm,0xe10+index*4, bMaskDWord, Tx_AGC[i][0]);
+
+ // PAGE_B for Path-A inner loopback DPK setting
+ ODM_SetBBReg(pDM_Odm,rPdp_AntA, bMaskDWord, 0x02097098);
+ ODM_SetBBReg(pDM_Odm,rPdp_AntA_4, bMaskDWord, 0xf76d9f84);
+ ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x0004ab87);
+ ODM_SetBBReg(pDM_Odm,rConfig_AntA, bMaskDWord, 0x00880000);
+
+ //----send one shot signal----//
+ // Path A
+ ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x80047788);
+ ODM_delay_ms(1);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x00047788);
+ ODM_delay_ms(50);
+ }
+
+ //PA gain = 11 => tx_agc = 1a
+ for(index = 0; index < 3; index++)
+ ODM_SetBBReg(pDM_Odm,0xe00+index*4, bMaskDWord, 0x34343434);
+ ODM_SetBBReg(pDM_Odm,0xe08+index*4, bMaskDWord, 0x03903434);
+ for(index = 0; index < 4; index++)
+ ODM_SetBBReg(pDM_Odm,0xe10+index*4, bMaskDWord, 0x34343434);
+
+ //====================================
+ // PAGE_B for Path-A DPK setting
+ //====================================
+ // open inner loopback @ b00[19]:10 od 0xb00 0x01097018
+ ODM_SetBBReg(pDM_Odm,rPdp_AntA, bMaskDWord, 0x02017098);
+ ODM_SetBBReg(pDM_Odm,rPdp_AntA_4, bMaskDWord, 0xf76d9f84);
+ ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x0004ab87);
+ ODM_SetBBReg(pDM_Odm,rConfig_AntA, bMaskDWord, 0x00880000);
+
+ //rf_lpbk_setup
+ //1.rf 00:5205a, rf 0d:0e52c
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x0c, bMaskDWord, 0x8992b);
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x0d, bMaskDWord, 0x0e52c);
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x00, bMaskDWord, 0x5205a );
+
+ //----send one shot signal----//
+ // Path A
+ ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x800477c0);
+ ODM_delay_ms(1);
+ ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntA, bMaskDWord, 0x000477c0);
+ ODM_delay_ms(50);
+
+ while(RetryCount < DP_RETRY_LIMIT && !pDM_Odm->RFCalibrateInfo.bDPPathAOK)
+ {
+ //----read back measurement results----//
+ ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x0c297018);
+ tmpReg = ODM_GetBBReg(pDM_Odm, 0xbe0, bMaskDWord);
+ ODM_delay_ms(10);
+ ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x0c29701f);
+ tmpReg2 = ODM_GetBBReg(pDM_Odm, 0xbe8, bMaskDWord);
+ ODM_delay_ms(10);
+
+ tmpReg = (tmpReg & bMaskHWord) >> 16;
+ tmpReg2 = (tmpReg2 & bMaskHWord) >> 16;
+ if(tmpReg < 0xf0 || tmpReg > 0x105 || tmpReg2 > 0xff )
+ {
+ 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_delay_ms(1);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x800477c0);
+ ODM_delay_ms(1);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x000477c0);
+ ODM_delay_ms(50);
+ RetryCount++;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path A DPK RetryCount %d 0xbe0[31:16] %x 0xbe8[31:16] %x\n", RetryCount, tmpReg, tmpReg2));
+ }
+ else
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path A DPK Sucess\n"));
+ pDM_Odm->RFCalibrateInfo.bDPPathAOK = TRUE;
+ break;
+ }
+ }
+ RetryCount = 0;
+
+ //DPP path A
+ if(pDM_Odm->RFCalibrateInfo.bDPPathAOK)
+ {
+ // DP settings
+ ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x01017098);
+ 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);
+
+ for(i=rPdp_AntA; i<=0xb3c; i+=4)
+ {
+ ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x40004000);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path A ofsset = 0x%x\n", i));
+ }
+
+ //pwsf
+ ODM_SetBBReg(pDM_Odm, 0xb40, bMaskDWord, 0x40404040);
+ ODM_SetBBReg(pDM_Odm, 0xb44, bMaskDWord, 0x28324040);
+ ODM_SetBBReg(pDM_Odm, 0xb48, bMaskDWord, 0x10141920);
+
+ for(i=0xb4c; i<=0xb5c; i+=4)
+ {
+ ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x0c0c0c0c);
+ }
+
+ //TX_AGC boundary
+ ODM_SetBBReg(pDM_Odm, 0xbc0, bMaskDWord, 0x0005361f);
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
+ }
+ else
+ {
+ ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x00000000);
+ ODM_SetBBReg(pDM_Odm, rPdp_AntA_4, bMaskDWord, 0x00000000);
+ }
+
+ //DPK path B
+ if(is2T)
+ {
+ //Path A to standby mode
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bMaskDWord, 0x10000);
+
+ // LUTs => tx_agc
+ // PA gain = 11 & PAD1, => tx_agc 1f ~11
+ // 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, 0xbc4, bMaskDWord, 0x0005361f);
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
+
+ //do inner loopback DPK 3 times
+ for(i = 0; i < 3; i++)
+ {
+ //PA gain = 11 & PAD2 => tx_agc = 0x0f/0x0c/0x07
+ for(index = 0; index < 4; index++)
+ ODM_SetBBReg(pDM_Odm, 0x830+index*4, bMaskDWord, Tx_AGC[i][0]);
+ for(index = 0; index < 2; index++)
+ ODM_SetBBReg(pDM_Odm, 0x848+index*4, bMaskDWord, Tx_AGC[i][0]);
+ for(index = 0; index < 2; index++)
+ ODM_SetBBReg(pDM_Odm, 0x868+index*4, bMaskDWord, Tx_AGC[i][0]);
+
+ // PAGE_B for Path-A inner loopback DPK setting
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x02097098);
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB_4, bMaskDWord, 0xf76d9f84);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x0004ab87);
+ ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x00880000);
+
+ //----send one shot signal----//
+ // Path B
+ ODM_SetBBReg(pDM_Odm,rConfig_Pmpd_AntB, bMaskDWord, 0x80047788);
+ ODM_delay_ms(1);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x00047788);
+ ODM_delay_ms(50);
+ }
+
+ // PA gain = 11 => tx_agc = 1a
+ for(index = 0; index < 4; index++)
+ ODM_SetBBReg(pDM_Odm, 0x830+index*4, bMaskDWord, 0x34343434);
+ for(index = 0; index < 2; index++)
+ ODM_SetBBReg(pDM_Odm, 0x848+index*4, bMaskDWord, 0x34343434);
+ for(index = 0; index < 2; index++)
+ ODM_SetBBReg(pDM_Odm, 0x868+index*4, bMaskDWord, 0x34343434);
+
+ // PAGE_B for Path-B DPK setting
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x02017098);
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB_4, bMaskDWord, 0xf76d9f84);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x0004ab87);
+ ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x00880000);
+
+ // RF lpbk switches on
+ ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x0101000f);
+ ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x01120103);
+
+ //Path-B RF lpbk
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x0c, bMaskDWord, 0x8992b);
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x0d, bMaskDWord, 0x0e52c);
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_AC, bMaskDWord, 0x5205a);
+
+ //----send one shot signal----//
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x800477c0);
+ ODM_delay_ms(1);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x000477c0);
+ ODM_delay_ms(50);
+
+ while(RetryCount < DP_RETRY_LIMIT && !pDM_Odm->RFCalibrateInfo.bDPPathBOK)
+ {
+ //----read back measurement results----//
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x0c297018);
+ tmpReg = ODM_GetBBReg(pDM_Odm, 0xbf0, bMaskDWord);
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x0c29701f);
+ tmpReg2 = ODM_GetBBReg(pDM_Odm, 0xbf8, bMaskDWord);
+
+ tmpReg = (tmpReg & bMaskHWord) >> 16;
+ tmpReg2 = (tmpReg2 & bMaskHWord) >> 16;
+
+ if(tmpReg < 0xf0 || tmpReg > 0x105 || tmpReg2 > 0xff)
+ {
+ 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_delay_ms(1);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x800477c0);
+ ODM_delay_ms(1);
+ ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x000477c0);
+ ODM_delay_ms(50);
+ RetryCount++;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path B DPK RetryCount %d 0xbf0[31:16] %x, 0xbf8[31:16] %x\n", RetryCount , tmpReg, tmpReg2));
+ }
+ else
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path B DPK Success\n"));
+ pDM_Odm->RFCalibrateInfo.bDPPathBOK = TRUE;
+ break;
+ }
+ }
+
+ //DPP path B
+ if(pDM_Odm->RFCalibrateInfo.bDPPathBOK)
+ {
+ // DP setting
+ // LUT by SRAM
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x01017098);
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB_4, bMaskDWord, 0x776d9f84);
+ 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);
+ for(i=0xb60; i<=0xb9c; i+=4)
+ {
+ ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x40004000);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path B ofsset = 0x%x\n", i));
+ }
+
+ // PWSF
+ ODM_SetBBReg(pDM_Odm, 0xba0, bMaskDWord, 0x40404040);
+ ODM_SetBBReg(pDM_Odm, 0xba4, bMaskDWord, 0x28324050);
+ ODM_SetBBReg(pDM_Odm, 0xba8, bMaskDWord, 0x0c141920);
+
+ for(i=0xbac; i<=0xbbc; i+=4)
+ {
+ ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x0c0c0c0c);
+ }
+
+ // tx_agc boundary
+ ODM_SetBBReg(pDM_Odm, 0xbc4, bMaskDWord, 0x0005361f);
+ ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000);
+
+ }
+ else
+ {
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x00000000);
+ ODM_SetBBReg(pDM_Odm, rPdp_AntB_4, bMaskDWord, 0x00000000);
+ }
+ }
+
+ //reload BB default value
+ for(index=0; index<DP_BB_REG_NUM; index++)
+ ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]);
+
+ //reload RF default value
+ for(path = 0; path<DP_PATH_NUM; path++)
+ {
+ for( i = 0 ; i < DP_RF_REG_NUM ; i++){
+ ODM_SetRFReg(pDM_Odm, path, RF_REG[i], bMaskDWord, RF_backup[path][i]);
+ }
+ }
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f); //standby mode
+ ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_MODE2, bMaskDWord, 0x20101); //RF lpbk switches off
+
+ //reload AFE default value
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ _PHY_ReloadADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
+
+ //reload MAC default value
+ _PHY_ReloadMACRegisters(pAdapter, MAC_REG, MAC_backup);
+#else
+ _PHY_ReloadADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
+
+ //reload MAC default value
+ _PHY_ReloadMACRegisters(pDM_Odm, MAC_REG, MAC_backup);
+#endif
+
+ pDM_Odm->RFCalibrateInfo.bDPdone = TRUE;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("<==phy_DigitalPredistortion()\n"));
+#endif
+}
+
+VOID
+PHY_DigitalPredistortion_8188E(
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PADAPTER pAdapter
+#else
+ IN PDM_ODM_T pDM_Odm
+#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
+#if DISABLE_BB_RF
+ return;
+#endif
+
+ return;
+
+ if(pDM_Odm->RFCalibrateInfo.bDPdone)
+ return;
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+
+ if(pDM_Odm->RFType == ODM_2T2R){
+ phy_DigitalPredistortion(pAdapter, TRUE);
+ }
+ else
+#endif
+ {
+ // For 88C 1T1R
+ phy_DigitalPredistortion(pAdapter, FALSE);
+ }
+}
+
+
+
+//return value TRUE => Main; FALSE => Aux
+
+BOOLEAN phy_QueryRFPathSwitch_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN BOOLEAN is2T
+ )
+{
+#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
+ if(!pAdapter->bHWInitReady)
+ {
+ u1Byte u1bTmp;
+ u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7;
+ ODM_Write1Byte(pDM_Odm, REG_LEDCFG2, u1bTmp);
+ //ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01);
+ ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01);
+ }
+
+ if(is2T) //
+ {
+ if(ODM_GetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01)
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ {
+ if((ODM_GetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT4|BIT3) == 0x1))
+ return TRUE;
+ else
+ return FALSE;
+ }
+}
+
+
+
+//return value TRUE => Main; FALSE => Aux
+BOOLEAN PHY_QueryRFPathSwitch_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm
+#else
+ IN PADAPTER pAdapter
+#endif
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+
+#if DISABLE_BB_RF
+ return TRUE;
+#endif
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+
+ //if(IS_92C_SERIAL( pHalData->VersionID)){
+ if(IS_2T2R( pHalData->VersionID)){
+ return phy_QueryRFPathSwitch_8188E(pAdapter, TRUE);
+ }
+ else
+#endif
+ {
+ // For 88C 1T1R
+#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
+ return phy_QueryRFPathSwitch_8188E(pAdapter, FALSE);
+#else
+ return phy_QueryRFPathSwitch_8188E(pDM_Odm, FALSE);
+#endif
+ }
+}
+#endif
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.h b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.h
index 204e156..fdb42a3 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.h
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/HalPhyRf_8188e.h
@@ -1,141 +1,141 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-#ifndef __HAL_PHY_RF_8188E_H__
-#define __HAL_PHY_RF_8188E_H__
-
-/*--------------------------Define Parameters-------------------------------*/
-#define IQK_DELAY_TIME_88E 10 //ms
-#define index_mapping_NUM_88E 15
-#define AVG_THERMAL_NUM_88E 4
-
-#include "../HalPhyRf.h"
-
-void ConfigureTxpowerTrack_8188E(
- PTXPWRTRACK_CFG pConfig
- );
-
-VOID
-GetDeltaSwingTable_8188E(
- IN PDM_ODM_T pDM_Odm,
- OUT pu1Byte *TemperatureUP_A,
- OUT pu1Byte *TemperatureDOWN_A,
- OUT pu1Byte *TemperatureUP_B,
- OUT pu1Byte *TemperatureDOWN_B
- );
-
-void DoIQK_8188E(
- PDM_ODM_T pDM_Odm,
- u1Byte DeltaThermalIndex,
- u1Byte ThermalValue,
- u1Byte Threshold
- );
-
-VOID
-ODM_TxPwrTrackSetPwr88E(
- PDM_ODM_T pDM_Odm,
- PWRTRACK_METHOD Method,
- u1Byte RFPath,
- u1Byte ChannelMappedIndex
- );
-
-//1 7. IQK
-
-void
-PHY_IQCalibrate_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER Adapter,
-#endif
- IN BOOLEAN bReCovery);
-
-
-//
-// LC calibrate
-//
-void
-PHY_LCCalibrate_8188E(
- IN PDM_ODM_T pDM_Odm
-);
-
-//
-// AP calibrate
-//
-void
-PHY_APCalibrate_8188E(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN s1Byte delta);
-void
-PHY_DigitalPredistortion_8188E( IN PADAPTER pAdapter);
-
-
-VOID
-_PHY_SaveADDARegisters(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte ADDAReg,
- IN pu4Byte ADDABackup,
- IN u4Byte RegisterNum
- );
-
-VOID
-_PHY_PathADDAOn(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte ADDAReg,
- IN BOOLEAN isPathAOn,
- IN BOOLEAN is2T
- );
-
-VOID
-_PHY_MACSettingCalibration(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm,
-#else
- IN PADAPTER pAdapter,
-#endif
- IN pu4Byte MACReg,
- IN pu4Byte MACBackup
- );
-
-
-VOID
-_PHY_PathAStandBy(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- IN PDM_ODM_T pDM_Odm
-#else
- IN PADAPTER pAdapter
-#endif
- );
-
-
-#endif // #ifndef __HAL_PHY_RF_8188E_H__
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+
+#ifndef __HAL_PHY_RF_8188E_H__
+#define __HAL_PHY_RF_8188E_H__
+
+/*--------------------------Define Parameters-------------------------------*/
+#define IQK_DELAY_TIME_88E 10 //ms
+#define index_mapping_NUM_88E 15
+#define AVG_THERMAL_NUM_88E 4
+
+#include "../HalPhyRf.h"
+
+void ConfigureTxpowerTrack_8188E(
+ PTXPWRTRACK_CFG pConfig
+ );
+
+VOID
+GetDeltaSwingTable_8188E(
+ IN PDM_ODM_T pDM_Odm,
+ OUT pu1Byte *TemperatureUP_A,
+ OUT pu1Byte *TemperatureDOWN_A,
+ OUT pu1Byte *TemperatureUP_B,
+ OUT pu1Byte *TemperatureDOWN_B
+ );
+
+void DoIQK_8188E(
+ PDM_ODM_T pDM_Odm,
+ u1Byte DeltaThermalIndex,
+ u1Byte ThermalValue,
+ u1Byte Threshold
+ );
+
+VOID
+ODM_TxPwrTrackSetPwr88E(
+ PDM_ODM_T pDM_Odm,
+ PWRTRACK_METHOD Method,
+ u1Byte RFPath,
+ u1Byte ChannelMappedIndex
+ );
+
+//1 7. IQK
+
+void
+PHY_IQCalibrate_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER Adapter,
+#endif
+ IN BOOLEAN bReCovery);
+
+
+//
+// LC calibrate
+//
+void
+PHY_LCCalibrate_8188E(
+ IN PDM_ODM_T pDM_Odm
+);
+
+//
+// AP calibrate
+//
+void
+PHY_APCalibrate_8188E(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN s1Byte delta);
+void
+PHY_DigitalPredistortion_8188E( IN PADAPTER pAdapter);
+
+
+VOID
+_PHY_SaveADDARegisters(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte ADDAReg,
+ IN pu4Byte ADDABackup,
+ IN u4Byte RegisterNum
+ );
+
+VOID
+_PHY_PathADDAOn(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte ADDAReg,
+ IN BOOLEAN isPathAOn,
+ IN BOOLEAN is2T
+ );
+
+VOID
+_PHY_MACSettingCalibration(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm,
+#else
+ IN PADAPTER pAdapter,
+#endif
+ IN pu4Byte MACReg,
+ IN pu4Byte MACBackup
+ );
+
+
+VOID
+_PHY_PathAStandBy(
+#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
+ IN PDM_ODM_T pDM_Odm
+#else
+ IN PADAPTER pAdapter
+#endif
+ );
+
+
+#endif // #ifndef __HAL_PHY_RF_8188E_H__
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.c b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.c
index 9ad4641..27281df 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.c
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.c
@@ -1,459 +1,459 @@
-/******************************************************************************
- *
- * 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 "../odm_precomp.h"
-
-#if (RTL8188E_SUPPORT == 1)
-
-VOID
-ODM_DIG_LowerBound_88E(
- IN PDM_ODM_T pDM_Odm
-)
-{
- pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable;
-
- if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
- {
- pDM_DigTable->rx_gain_range_min = (u1Byte) pDM_DigTable->AntDiv_RSSI_max;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_DIG_LowerBound_88E(): pDM_DigTable->AntDiv_RSSI_max=%d \n",pDM_DigTable->AntDiv_RSSI_max));
- }
- //If only one Entry connected
-}
-
-
-//3============================================================
-//3 Dynamic Primary CCA
-//3============================================================
-
-VOID
-odm_PrimaryCCA_Init(
- IN PDM_ODM_T pDM_Odm)
-{
- pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA);
- PrimaryCCA->DupRTS_flag = 0;
- PrimaryCCA->intf_flag = 0;
- PrimaryCCA->intf_type = 0;
- PrimaryCCA->Monitor_flag = 0;
- PrimaryCCA->PriCCA_flag = 0;
-}
-
-BOOLEAN
-ODM_DynamicPrimaryCCA_DupRTS(
- IN PDM_ODM_T pDM_Odm
- )
-{
- pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA);
-
- return PrimaryCCA->DupRTS_flag;
-}
-
-VOID
-odm_DynamicPrimaryCCA(
- IN PDM_ODM_T pDM_Odm
- )
-{
- PADAPTER Adapter = pDM_Odm->Adapter; // for NIC
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- PRT_WLAN_STA pEntry;
-#endif
-
- PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt);
- pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA);
-
- BOOLEAN Is40MHz;
- BOOLEAN Client_40MHz = FALSE, Client_tmp = FALSE; // connected client BW
- BOOLEAN bConnected = FALSE; // connected or not
- static u1Byte Client_40MHz_pre = 0;
- static u8Byte lastTxOkCnt = 0;
- static u8Byte lastRxOkCnt = 0;
- static u4Byte Counter = 0;
- static u1Byte Delay = 1;
- u8Byte curTxOkCnt;
- u8Byte curRxOkCnt;
- u1Byte SecCHOffset;
- u1Byte i;
-
-#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL) ||( DM_ODM_SUPPORT_TYPE==ODM_CE))
- return;
-#endif
-
- if(pDM_Odm->SupportICType != ODM_RTL8188E)
- return;
-
- Is40MHz = *(pDM_Odm->pBandWidth);
- SecCHOffset = *(pDM_Odm->pSecChOffset);
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", SecCHOffset));
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if(Is40MHz==1)
- SecCHOffset = SecCHOffset%2+1; // NIC's definition is reverse to AP 1:secondary below, 2: secondary above
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", SecCHOffset));
- //3 Check Current WLAN Traffic
- curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - lastTxOkCnt;
- curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - lastRxOkCnt;
- lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast;
- lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast;
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
- //3 Check Current WLAN Traffic
- curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast)-lastTxOkCnt;
- curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast)-lastRxOkCnt;
- lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast);
- lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast);
-#endif
-
- //==================Debug Message====================
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("TP = %llu\n", curTxOkCnt+curRxOkCnt));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is40MHz = %d\n", Is40MHz));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_LSC = %d\n", FalseAlmCnt->Cnt_BW_LSC));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_USC = %d\n", FalseAlmCnt->Cnt_BW_USC));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA OFDM = %d\n", FalseAlmCnt->Cnt_OFDM_CCA));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA CCK = %d\n", FalseAlmCnt->Cnt_CCK_CCA));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("OFDM FA = %d\n", FalseAlmCnt->Cnt_Ofdm_fail));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCK FA = %d\n", FalseAlmCnt->Cnt_Cck_fail));
- //================================================
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (ACTING_AS_AP(Adapter)) // primary cca process only do at AP mode
-#endif
- {
-
- #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("ACTING as AP mode=%d\n", ACTING_AS_AP(Adapter)));
- //3 To get entry's connection and BW infomation status.
- for(i=0;i<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)
- {
- Client_tmp = pEntry->BandWidth; // client BW
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Client_BW=%d\n", Client_tmp));
- if(Client_tmp>Client_40MHz)
- Client_40MHz = Client_tmp; // 40M/20M coexist => 40M priority is High
-
- if(pEntry->bAssociated)
- {
- bConnected=TRUE; // client is connected or not
- break;
- }
- }
- else
- {
- break;
- }
- }
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
- //3 To get entry's connection and BW infomation status.
-
- PSTA_INFO_T pstat;
-
- for(i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
- {
- pstat = pDM_Odm->pODM_StaInfo[i];
- if(IS_STA_VALID(pstat) )
- {
- Client_tmp = pstat->tx_bw;
- if(Client_tmp>Client_40MHz)
- Client_40MHz = Client_tmp; // 40M/20M coexist => 40M priority is High
-
- bConnected = TRUE;
- }
- }
-#endif
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("bConnected=%d\n", bConnected));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is Client 40MHz=%d\n", Client_40MHz));
- //1 Monitor whether the interference exists or not
- if(PrimaryCCA->Monitor_flag == 1)
- {
- if(SecCHOffset == 1) // secondary channel is below the primary channel
- {
- if((FalseAlmCnt->Cnt_OFDM_CCA > 500)&&(FalseAlmCnt->Cnt_BW_LSC > FalseAlmCnt->Cnt_BW_USC+500))
- {
- if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
- {
- PrimaryCCA->intf_type = 1;
- PrimaryCCA->PriCCA_flag = 1;
- ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2); // USC MF
- if(PrimaryCCA->DupRTS_flag == 1)
- PrimaryCCA->DupRTS_flag = 0;
- }
- else
- {
- PrimaryCCA->intf_type = 2;
- if(PrimaryCCA->DupRTS_flag == 0)
- PrimaryCCA->DupRTS_flag = 1;
- }
-
- }
- else // interferecne disappear
- {
- PrimaryCCA->DupRTS_flag = 0;
- PrimaryCCA->intf_flag = 0;
- PrimaryCCA->intf_type = 0;
- }
- }
- else if(SecCHOffset == 2) // secondary channel is above the primary channel
- {
- if((FalseAlmCnt->Cnt_OFDM_CCA > 500)&&(FalseAlmCnt->Cnt_BW_USC > FalseAlmCnt->Cnt_BW_LSC+500))
- {
- if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
- {
- PrimaryCCA->intf_type = 1;
- PrimaryCCA->PriCCA_flag = 1;
- ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1); // LSC MF
- if(PrimaryCCA->DupRTS_flag == 1)
- PrimaryCCA->DupRTS_flag = 0;
- }
- else
- {
- PrimaryCCA->intf_type = 2;
- if(PrimaryCCA->DupRTS_flag == 0)
- PrimaryCCA->DupRTS_flag = 1;
- }
-
- }
- else // interferecne disappear
- {
- PrimaryCCA->DupRTS_flag = 0;
- PrimaryCCA->intf_flag = 0;
- PrimaryCCA->intf_type = 0;
- }
-
-
- }
- PrimaryCCA->Monitor_flag = 0;
- }
-
- //1 Dynamic Primary CCA Main Function
- if(PrimaryCCA->Monitor_flag == 0)
- {
- if(Is40MHz) // if RFBW==40M mode which require to process primary cca
- {
- //2 STA is NOT Connected
- if(!bConnected)
- {
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA NOT Connected!!!!\n"));
-
- if(PrimaryCCA->PriCCA_flag == 1) // reset primary cca when STA is disconnected
- {
- PrimaryCCA->PriCCA_flag = 0;
- ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 0);
- }
- if(PrimaryCCA->DupRTS_flag == 1) // reset Duplicate RTS when STA is disconnected
- PrimaryCCA->DupRTS_flag = 0;
-
- if(SecCHOffset == 1) // secondary channel is below the primary channel
- {
- if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_LSC*5 > FalseAlmCnt->Cnt_BW_USC*9))
- {
- PrimaryCCA->intf_flag = 1; // secondary channel interference is detected!!!
- if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
- PrimaryCCA->intf_type = 1; // interference is shift
- else
- PrimaryCCA->intf_type = 2; // interference is in-band
- }
- else
- {
- PrimaryCCA->intf_flag = 0;
- PrimaryCCA->intf_type = 0;
- }
- }
- else if(SecCHOffset == 2) // secondary channel is above the primary channel
- {
- if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_USC*5 > FalseAlmCnt->Cnt_BW_LSC*9))
- {
- PrimaryCCA->intf_flag = 1; // secondary channel interference is detected!!!
- if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
- PrimaryCCA->intf_type = 1; // interference is shift
- else
- PrimaryCCA->intf_type = 2; // interference is in-band
- }
- else
- {
- PrimaryCCA->intf_flag = 0;
- PrimaryCCA->intf_type = 0;
- }
- }
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("PrimaryCCA=%d\n",PrimaryCCA->PriCCA_flag));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Intf_Type=%d\n", PrimaryCCA->intf_type));
- }
- //2 STA is Connected
- else
- {
- if(Client_40MHz == 0) //3 // client BW = 20MHz
- {
- if(PrimaryCCA->PriCCA_flag == 0)
- {
- PrimaryCCA->PriCCA_flag = 1;
- if(SecCHOffset==1)
- ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2);
- else if(SecCHOffset==2)
- ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1);
- }
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA Connected 20M!!! PrimaryCCA=%d\n", PrimaryCCA->PriCCA_flag));
- }
- else //3 // client BW = 40MHz
- {
- if(PrimaryCCA->intf_flag == 1) // interference is detected!!
- {
- if(PrimaryCCA->intf_type == 1)
- {
- if(PrimaryCCA->PriCCA_flag!=1)
- {
- PrimaryCCA->PriCCA_flag = 1;
- if(SecCHOffset==1)
- ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2);
- else if(SecCHOffset==2)
- ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1);
- }
- }
- else if(PrimaryCCA->intf_type == 2)
- {
- if(PrimaryCCA->DupRTS_flag!=1)
- PrimaryCCA->DupRTS_flag = 1;
- }
- }
- else // if intf_flag==0
- {
- if((curTxOkCnt+curRxOkCnt)<10000) //idle mode or TP traffic is very low
- {
- if(SecCHOffset == 1)
- {
- if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_LSC*5 > FalseAlmCnt->Cnt_BW_USC*9))
- {
- PrimaryCCA->intf_flag = 1;
- if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
- PrimaryCCA->intf_type = 1; // interference is shift
- else
- PrimaryCCA->intf_type = 2; // interference is in-band
- }
- }
- else if(SecCHOffset == 2)
- {
- if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_USC*5 > FalseAlmCnt->Cnt_BW_LSC*9))
- {
- PrimaryCCA->intf_flag = 1;
- if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
- PrimaryCCA->intf_type = 1; // interference is shift
- else
- PrimaryCCA->intf_type = 2; // interference is in-band
- }
-
- }
- }
- else // TP Traffic is High
- {
- if(SecCHOffset == 1)
- {
- if(FalseAlmCnt->Cnt_BW_LSC > (FalseAlmCnt->Cnt_BW_USC+500))
- {
- if(Delay == 0) // add delay to avoid interference occurring abruptly, jump one time
- {
- PrimaryCCA->intf_flag = 1;
- if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
- PrimaryCCA->intf_type = 1; // interference is shift
- else
- PrimaryCCA->intf_type = 2; // interference is in-band
- Delay = 1;
- }
- else
- Delay = 0;
- }
- }
- else if(SecCHOffset == 2)
- {
- if(FalseAlmCnt->Cnt_BW_USC > (FalseAlmCnt->Cnt_BW_LSC+500))
- {
- if(Delay == 0) // add delay to avoid interference occurring abruptly
- {
- PrimaryCCA->intf_flag = 1;
- if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
- PrimaryCCA->intf_type = 1; // interference is shift
- else
- PrimaryCCA->intf_type = 2; // interference is in-band
- Delay = 1;
- }
- else
- Delay = 0;
- }
- }
- }
- }
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Primary CCA=%d\n", PrimaryCCA->PriCCA_flag));
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Duplicate RTS=%d\n", PrimaryCCA->DupRTS_flag));
- }
-
- }// end of connected
- }
- }
- //1 Dynamic Primary CCA Monitor Counter
- if((PrimaryCCA->PriCCA_flag == 1)||(PrimaryCCA->DupRTS_flag == 1))
- {
- if(Client_40MHz == 0) // client=20M no need to monitor primary cca flag
- {
- Client_40MHz_pre = Client_40MHz;
- return;
- }
- Counter++;
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Counter=%d\n", Counter));
- if((Counter == 30)||((Client_40MHz -Client_40MHz_pre)==1)) // Every 60 sec to monitor one time
- {
- PrimaryCCA->Monitor_flag = 1; // monitor flag is triggered!!!!!
- if(PrimaryCCA->PriCCA_flag == 1)
- {
- PrimaryCCA->PriCCA_flag = 0;
- ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 0);
- }
- Counter = 0;
- }
- }
- }
-
- Client_40MHz_pre = Client_40MHz;
-}
-#else //#if (RTL8188E_SUPPORT == 1)
-
-VOID
-odm_PrimaryCCA_Init(
- IN PDM_ODM_T pDM_Odm)
-{
-}
-VOID
-odm_DynamicPrimaryCCA(
- IN PDM_ODM_T pDM_Odm
- )
-{
-}
-BOOLEAN
-ODM_DynamicPrimaryCCA_DupRTS(
- IN PDM_ODM_T pDM_Odm
- )
-{
- return FALSE;
-}
-#endif //#if (RTL8188E_SUPPORT == 1)
-
+/******************************************************************************
+ *
+ * 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 "../odm_precomp.h"
+
+#if (RTL8188E_SUPPORT == 1)
+
+VOID
+ODM_DIG_LowerBound_88E(
+ IN PDM_ODM_T pDM_Odm
+)
+{
+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable;
+
+ if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
+ {
+ pDM_DigTable->rx_gain_range_min = (u1Byte) pDM_DigTable->AntDiv_RSSI_max;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_DIG_LowerBound_88E(): pDM_DigTable->AntDiv_RSSI_max=%d \n",pDM_DigTable->AntDiv_RSSI_max));
+ }
+ //If only one Entry connected
+}
+
+
+//3============================================================
+//3 Dynamic Primary CCA
+//3============================================================
+
+VOID
+odm_PrimaryCCA_Init(
+ IN PDM_ODM_T pDM_Odm)
+{
+ pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA);
+ PrimaryCCA->DupRTS_flag = 0;
+ PrimaryCCA->intf_flag = 0;
+ PrimaryCCA->intf_type = 0;
+ PrimaryCCA->Monitor_flag = 0;
+ PrimaryCCA->PriCCA_flag = 0;
+}
+
+BOOLEAN
+ODM_DynamicPrimaryCCA_DupRTS(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA);
+
+ return PrimaryCCA->DupRTS_flag;
+}
+
+VOID
+odm_DynamicPrimaryCCA(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ PADAPTER Adapter = pDM_Odm->Adapter; // for NIC
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
+ PRT_WLAN_STA pEntry;
+#endif
+
+ PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt);
+ pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA);
+
+ BOOLEAN Is40MHz;
+ BOOLEAN Client_40MHz = FALSE, Client_tmp = FALSE; // connected client BW
+ BOOLEAN bConnected = FALSE; // connected or not
+ static u1Byte Client_40MHz_pre = 0;
+ static u8Byte lastTxOkCnt = 0;
+ static u8Byte lastRxOkCnt = 0;
+ static u4Byte Counter = 0;
+ static u1Byte Delay = 1;
+ u8Byte curTxOkCnt;
+ u8Byte curRxOkCnt;
+ u1Byte SecCHOffset;
+ u1Byte i;
+
+#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL) ||( DM_ODM_SUPPORT_TYPE==ODM_CE))
+ return;
+#endif
+
+ if(pDM_Odm->SupportICType != ODM_RTL8188E)
+ return;
+
+ Is40MHz = *(pDM_Odm->pBandWidth);
+ SecCHOffset = *(pDM_Odm->pSecChOffset);
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", SecCHOffset));
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ if(Is40MHz==1)
+ SecCHOffset = SecCHOffset%2+1; // NIC's definition is reverse to AP 1:secondary below, 2: secondary above
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", SecCHOffset));
+ //3 Check Current WLAN Traffic
+ curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - lastTxOkCnt;
+ curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - lastRxOkCnt;
+ lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast;
+ lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast;
+#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
+ //3 Check Current WLAN Traffic
+ curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast)-lastTxOkCnt;
+ curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast)-lastRxOkCnt;
+ lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast);
+ lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast);
+#endif
+
+ //==================Debug Message====================
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("TP = %llu\n", curTxOkCnt+curRxOkCnt));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is40MHz = %d\n", Is40MHz));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_LSC = %d\n", FalseAlmCnt->Cnt_BW_LSC));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_USC = %d\n", FalseAlmCnt->Cnt_BW_USC));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA OFDM = %d\n", FalseAlmCnt->Cnt_OFDM_CCA));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA CCK = %d\n", FalseAlmCnt->Cnt_CCK_CCA));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("OFDM FA = %d\n", FalseAlmCnt->Cnt_Ofdm_fail));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCK FA = %d\n", FalseAlmCnt->Cnt_Cck_fail));
+ //================================================
+
+#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ if (ACTING_AS_AP(Adapter)) // primary cca process only do at AP mode
+#endif
+ {
+
+ #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("ACTING as AP mode=%d\n", ACTING_AS_AP(Adapter)));
+ //3 To get entry's connection and BW infomation status.
+ for(i=0;i<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)
+ {
+ Client_tmp = pEntry->BandWidth; // client BW
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Client_BW=%d\n", Client_tmp));
+ if(Client_tmp>Client_40MHz)
+ Client_40MHz = Client_tmp; // 40M/20M coexist => 40M priority is High
+
+ if(pEntry->bAssociated)
+ {
+ bConnected=TRUE; // client is connected or not
+ break;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
+ //3 To get entry's connection and BW infomation status.
+
+ PSTA_INFO_T pstat;
+
+ for(i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
+ {
+ pstat = pDM_Odm->pODM_StaInfo[i];
+ if(IS_STA_VALID(pstat) )
+ {
+ Client_tmp = pstat->tx_bw;
+ if(Client_tmp>Client_40MHz)
+ Client_40MHz = Client_tmp; // 40M/20M coexist => 40M priority is High
+
+ bConnected = TRUE;
+ }
+ }
+#endif
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("bConnected=%d\n", bConnected));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is Client 40MHz=%d\n", Client_40MHz));
+ //1 Monitor whether the interference exists or not
+ if(PrimaryCCA->Monitor_flag == 1)
+ {
+ if(SecCHOffset == 1) // secondary channel is below the primary channel
+ {
+ if((FalseAlmCnt->Cnt_OFDM_CCA > 500)&&(FalseAlmCnt->Cnt_BW_LSC > FalseAlmCnt->Cnt_BW_USC+500))
+ {
+ if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
+ {
+ PrimaryCCA->intf_type = 1;
+ PrimaryCCA->PriCCA_flag = 1;
+ ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2); // USC MF
+ if(PrimaryCCA->DupRTS_flag == 1)
+ PrimaryCCA->DupRTS_flag = 0;
+ }
+ else
+ {
+ PrimaryCCA->intf_type = 2;
+ if(PrimaryCCA->DupRTS_flag == 0)
+ PrimaryCCA->DupRTS_flag = 1;
+ }
+
+ }
+ else // interferecne disappear
+ {
+ PrimaryCCA->DupRTS_flag = 0;
+ PrimaryCCA->intf_flag = 0;
+ PrimaryCCA->intf_type = 0;
+ }
+ }
+ else if(SecCHOffset == 2) // secondary channel is above the primary channel
+ {
+ if((FalseAlmCnt->Cnt_OFDM_CCA > 500)&&(FalseAlmCnt->Cnt_BW_USC > FalseAlmCnt->Cnt_BW_LSC+500))
+ {
+ if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
+ {
+ PrimaryCCA->intf_type = 1;
+ PrimaryCCA->PriCCA_flag = 1;
+ ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1); // LSC MF
+ if(PrimaryCCA->DupRTS_flag == 1)
+ PrimaryCCA->DupRTS_flag = 0;
+ }
+ else
+ {
+ PrimaryCCA->intf_type = 2;
+ if(PrimaryCCA->DupRTS_flag == 0)
+ PrimaryCCA->DupRTS_flag = 1;
+ }
+
+ }
+ else // interferecne disappear
+ {
+ PrimaryCCA->DupRTS_flag = 0;
+ PrimaryCCA->intf_flag = 0;
+ PrimaryCCA->intf_type = 0;
+ }
+
+
+ }
+ PrimaryCCA->Monitor_flag = 0;
+ }
+
+ //1 Dynamic Primary CCA Main Function
+ if(PrimaryCCA->Monitor_flag == 0)
+ {
+ if(Is40MHz) // if RFBW==40M mode which require to process primary cca
+ {
+ //2 STA is NOT Connected
+ if(!bConnected)
+ {
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA NOT Connected!!!!\n"));
+
+ if(PrimaryCCA->PriCCA_flag == 1) // reset primary cca when STA is disconnected
+ {
+ PrimaryCCA->PriCCA_flag = 0;
+ ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 0);
+ }
+ if(PrimaryCCA->DupRTS_flag == 1) // reset Duplicate RTS when STA is disconnected
+ PrimaryCCA->DupRTS_flag = 0;
+
+ if(SecCHOffset == 1) // secondary channel is below the primary channel
+ {
+ if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_LSC*5 > FalseAlmCnt->Cnt_BW_USC*9))
+ {
+ PrimaryCCA->intf_flag = 1; // secondary channel interference is detected!!!
+ if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
+ PrimaryCCA->intf_type = 1; // interference is shift
+ else
+ PrimaryCCA->intf_type = 2; // interference is in-band
+ }
+ else
+ {
+ PrimaryCCA->intf_flag = 0;
+ PrimaryCCA->intf_type = 0;
+ }
+ }
+ else if(SecCHOffset == 2) // secondary channel is above the primary channel
+ {
+ if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_USC*5 > FalseAlmCnt->Cnt_BW_LSC*9))
+ {
+ PrimaryCCA->intf_flag = 1; // secondary channel interference is detected!!!
+ if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
+ PrimaryCCA->intf_type = 1; // interference is shift
+ else
+ PrimaryCCA->intf_type = 2; // interference is in-band
+ }
+ else
+ {
+ PrimaryCCA->intf_flag = 0;
+ PrimaryCCA->intf_type = 0;
+ }
+ }
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("PrimaryCCA=%d\n",PrimaryCCA->PriCCA_flag));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Intf_Type=%d\n", PrimaryCCA->intf_type));
+ }
+ //2 STA is Connected
+ else
+ {
+ if(Client_40MHz == 0) //3 // client BW = 20MHz
+ {
+ if(PrimaryCCA->PriCCA_flag == 0)
+ {
+ PrimaryCCA->PriCCA_flag = 1;
+ if(SecCHOffset==1)
+ ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2);
+ else if(SecCHOffset==2)
+ ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1);
+ }
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA Connected 20M!!! PrimaryCCA=%d\n", PrimaryCCA->PriCCA_flag));
+ }
+ else //3 // client BW = 40MHz
+ {
+ if(PrimaryCCA->intf_flag == 1) // interference is detected!!
+ {
+ if(PrimaryCCA->intf_type == 1)
+ {
+ if(PrimaryCCA->PriCCA_flag!=1)
+ {
+ PrimaryCCA->PriCCA_flag = 1;
+ if(SecCHOffset==1)
+ ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2);
+ else if(SecCHOffset==2)
+ ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1);
+ }
+ }
+ else if(PrimaryCCA->intf_type == 2)
+ {
+ if(PrimaryCCA->DupRTS_flag!=1)
+ PrimaryCCA->DupRTS_flag = 1;
+ }
+ }
+ else // if intf_flag==0
+ {
+ if((curTxOkCnt+curRxOkCnt)<10000) //idle mode or TP traffic is very low
+ {
+ if(SecCHOffset == 1)
+ {
+ if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_LSC*5 > FalseAlmCnt->Cnt_BW_USC*9))
+ {
+ PrimaryCCA->intf_flag = 1;
+ if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
+ PrimaryCCA->intf_type = 1; // interference is shift
+ else
+ PrimaryCCA->intf_type = 2; // interference is in-band
+ }
+ }
+ else if(SecCHOffset == 2)
+ {
+ if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_USC*5 > FalseAlmCnt->Cnt_BW_LSC*9))
+ {
+ PrimaryCCA->intf_flag = 1;
+ if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
+ PrimaryCCA->intf_type = 1; // interference is shift
+ else
+ PrimaryCCA->intf_type = 2; // interference is in-band
+ }
+
+ }
+ }
+ else // TP Traffic is High
+ {
+ if(SecCHOffset == 1)
+ {
+ if(FalseAlmCnt->Cnt_BW_LSC > (FalseAlmCnt->Cnt_BW_USC+500))
+ {
+ if(Delay == 0) // add delay to avoid interference occurring abruptly, jump one time
+ {
+ PrimaryCCA->intf_flag = 1;
+ if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
+ PrimaryCCA->intf_type = 1; // interference is shift
+ else
+ PrimaryCCA->intf_type = 2; // interference is in-band
+ Delay = 1;
+ }
+ else
+ Delay = 0;
+ }
+ }
+ else if(SecCHOffset == 2)
+ {
+ if(FalseAlmCnt->Cnt_BW_USC > (FalseAlmCnt->Cnt_BW_LSC+500))
+ {
+ if(Delay == 0) // add delay to avoid interference occurring abruptly
+ {
+ PrimaryCCA->intf_flag = 1;
+ if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1)
+ PrimaryCCA->intf_type = 1; // interference is shift
+ else
+ PrimaryCCA->intf_type = 2; // interference is in-band
+ Delay = 1;
+ }
+ else
+ Delay = 0;
+ }
+ }
+ }
+ }
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Primary CCA=%d\n", PrimaryCCA->PriCCA_flag));
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Duplicate RTS=%d\n", PrimaryCCA->DupRTS_flag));
+ }
+
+ }// end of connected
+ }
+ }
+ //1 Dynamic Primary CCA Monitor Counter
+ if((PrimaryCCA->PriCCA_flag == 1)||(PrimaryCCA->DupRTS_flag == 1))
+ {
+ if(Client_40MHz == 0) // client=20M no need to monitor primary cca flag
+ {
+ Client_40MHz_pre = Client_40MHz;
+ return;
+ }
+ Counter++;
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Counter=%d\n", Counter));
+ if((Counter == 30)||((Client_40MHz -Client_40MHz_pre)==1)) // Every 60 sec to monitor one time
+ {
+ PrimaryCCA->Monitor_flag = 1; // monitor flag is triggered!!!!!
+ if(PrimaryCCA->PriCCA_flag == 1)
+ {
+ PrimaryCCA->PriCCA_flag = 0;
+ ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 0);
+ }
+ Counter = 0;
+ }
+ }
+ }
+
+ Client_40MHz_pre = Client_40MHz;
+}
+#else //#if (RTL8188E_SUPPORT == 1)
+
+VOID
+odm_PrimaryCCA_Init(
+ IN PDM_ODM_T pDM_Odm)
+{
+}
+VOID
+odm_DynamicPrimaryCCA(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+}
+BOOLEAN
+ODM_DynamicPrimaryCCA_DupRTS(
+ IN PDM_ODM_T pDM_Odm
+ )
+{
+ return FALSE;
+}
+#endif //#if (RTL8188E_SUPPORT == 1)
+
diff --git a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.h b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.h
index 60406e6..45a9d11 100755
--- a/rtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.h
+++ b/rtl8xxx_EU/hal/OUTSRC/rtl8188e/odm_RTL8188E.h
@@ -1,64 +1,64 @@
-/******************************************************************************
- *
- * 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 __ODM_RTL8188E_H__
-#define __ODM_RTL8188E_H__
-
-
-#define MAIN_ANT_CG_TRX 1
-#define AUX_ANT_CG_TRX 0
-#define MAIN_ANT_CGCS_RX 0
-#define AUX_ANT_CGCS_RX 1
-
-VOID
-ODM_DIG_LowerBound_88E(
- IN PDM_ODM_T pDM_Odm
-);
-
-
-
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
-VOID
-ODM_SetTxAntByTxInfo_88E(
- IN PDM_ODM_T pDM_Odm,
- IN pu1Byte pDesc,
- IN u1Byte macId
-);
-#else// (DM_ODM_SUPPORT_TYPE == ODM_AP)
-VOID
-ODM_SetTxAntByTxInfo_88E(
- IN PDM_ODM_T pDM_Odm
-);
-#endif
-
-VOID
-odm_PrimaryCCA_Init(
- IN PDM_ODM_T pDM_Odm);
-
-BOOLEAN
-ODM_DynamicPrimaryCCA_DupRTS(
- IN PDM_ODM_T pDM_Odm);
-
-VOID
-odm_DynamicPrimaryCCA(
- IN PDM_ODM_T pDM_Odm);
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __ODM_RTL8188E_H__
+#define __ODM_RTL8188E_H__
+
+
+#define MAIN_ANT_CG_TRX 1
+#define AUX_ANT_CG_TRX 0
+#define MAIN_ANT_CGCS_RX 0
+#define AUX_ANT_CGCS_RX 1
+
+VOID
+ODM_DIG_LowerBound_88E(
+ IN PDM_ODM_T pDM_Odm
+);
+
+
+
+
+#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
+VOID
+ODM_SetTxAntByTxInfo_88E(
+ IN PDM_ODM_T pDM_Odm,
+ IN pu1Byte pDesc,
+ IN u1Byte macId
+);
+#else// (DM_ODM_SUPPORT_TYPE == ODM_AP)
+VOID
+ODM_SetTxAntByTxInfo_88E(
+ IN PDM_ODM_T pDM_Odm
+);
+#endif
+
+VOID
+odm_PrimaryCCA_Init(
+ IN PDM_ODM_T pDM_Odm);
+
+BOOLEAN
+ODM_DynamicPrimaryCCA_DupRTS(
+ IN PDM_ODM_T pDM_Odm);
+
+VOID
+odm_DynamicPrimaryCCA(
+ IN PDM_ODM_T pDM_Odm);
+
+#endif
+
diff --git a/rtl8xxx_EU/hal/led/hal_usb_led.c b/rtl8xxx_EU/hal/led/hal_usb_led.c
index 7f17221..6b0d2ad 100755
--- a/rtl8xxx_EU/hal/led/hal_usb_led.c
+++ b/rtl8xxx_EU/hal/led/hal_usb_led.c
@@ -1,5226 +1,5226 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-#include <drv_types.h>
-#include <hal_data.h>
-
-//
-// Description:
-// Implementation of LED blinking behavior.
-// It toggle off LED and schedule corresponding timer if necessary.
-//
-void
-SwLedBlink(
- PLED_USB pLed
- )
-{
- _adapter *padapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- u8 bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
- // Determine if we shall change LED state again.
- pLed->BlinkTimes--;
- switch(pLed->CurrLedState)
- {
-
- case LED_BLINK_NORMAL:
- if(pLed->BlinkTimes == 0)
- {
- bStopBlinking = _TRUE;
- }
- break;
-
- case LED_BLINK_StartToBlink:
- if( check_fwstate(pmlmepriv, _FW_LINKED) && check_fwstate(pmlmepriv, WIFI_STATION_STATE) )
- {
- bStopBlinking = _TRUE;
- }
- if( check_fwstate(pmlmepriv, _FW_LINKED) &&
- (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) )
- {
- bStopBlinking = _TRUE;
- }
- else if(pLed->BlinkTimes == 0)
- {
- bStopBlinking = _TRUE;
- }
- break;
-
- case LED_BLINK_WPS:
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- break;
-
-
- default:
- bStopBlinking = _TRUE;
- break;
-
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && (pLed->bLedOn == _FALSE))
- {
- SwLedOn(padapter, pLed);
- }
- else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) && pLed->bLedOn == _TRUE)
- {
- SwLedOff(padapter, pLed);
- }
-
- pLed->BlinkTimes = 0;
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- // Assign LED state to toggle.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- // Schedule a timer to toggle LED state.
- switch( pLed->CurrLedState )
- {
- case LED_BLINK_NORMAL:
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- break;
-
- case LED_BLINK_SLOWLY:
- case LED_BLINK_StartToBlink:
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- break;
-
- case LED_BLINK_WPS:
- {
- if( pLed->BlinkingLedState == RTW_LED_ON )
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
- else
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
- }
- break;
-
- default:
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- break;
- }
- }
-}
-
-void
-SwLedBlink1(
- PLED_USB pLed
- )
-{
- _adapter *padapter = pLed->padapter;
- EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
- struct led_priv *ledpriv = &(padapter->ledpriv);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- PLED_USB pLed1 = &(ledpriv->SwLed1);
- u8 bStopBlinking = _FALSE;
-
- u32 uLedBlinkNoLinkInterval = LED_BLINK_NO_LINK_INTERVAL_ALPHA; //add by ylb 20121012 for customer led for alpha
- if(pEEPROM->CustomerID == RT_CID_819x_ALPHA_Dlink)
- uLedBlinkNoLinkInterval= LED_BLINK_NO_LINK_INTERVAL_ALPHA_500MS;
-
- if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
- pLed = &(ledpriv->SwLed1);
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
-
- if(pEEPROM->CustomerID == RT_CID_DEFAULT)
- {
- if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- if(!pLed1->bSWLedCtrl)
- {
- SwLedOn(padapter, pLed1);
- pLed1->bSWLedCtrl = _TRUE;
- }
- else if(!pLed1->bLedOn)
- SwLedOn(padapter, pLed1);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn on pLed1\n"));
- }
- else
- {
- if(!pLed1->bSWLedCtrl)
- {
- SwLedOff(padapter, pLed1);
- pLed1->bSWLedCtrl = _TRUE;
- }
- else if(pLed1->bLedOn)
- SwLedOff(padapter, pLed1);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn off pLed1\n"));
- }
- }
-
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_SLOWLY:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
- break;
-
- case LED_BLINK_NORMAL:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- break;
-
- case LED_BLINK_SCAN:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->bLedLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_NORMAL;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
-
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->bLedLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_NORMAL;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->BlinkTimes = 0;
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_WPS:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- break;
-
- case LED_BLINK_WPS_STOP: //WPS success
- if(pLed->BlinkingLedState == RTW_LED_ON)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
- bStopBlinking = _FALSE;
- }
- else
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- pLed->bLedLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_NORMAL;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- break;
-
- default:
- break;
- }
-
-}
-
-void
-SwLedBlink2(
- PLED_USB pLed
- )
-{
- _adapter *padapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- u8 bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON)
- {
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_SCAN:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState));
-
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState));
-
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- default:
- break;
- }
-
-}
-
-void
-SwLedBlink3(
- PLED_USB pLed
- )
-{
- _adapter *padapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- u8 bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_SCAN:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if( !pLed->bLedOn )
- SwLedOn(padapter, pLed);
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedOn )
- SwLedOff(padapter, pLed);
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
-
- if( !pLed->bLedOn )
- SwLedOn(padapter, pLed);
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- if( pLed->bLedOn )
- SwLedOff(padapter, pLed);
-
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_WPS:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- break;
-
- case LED_BLINK_WPS_STOP: //WPS success
- if(pLed->BlinkingLedState == RTW_LED_ON)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
- bStopBlinking = _FALSE;
- }
- else
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- break;
-
-
- default:
- break;
- }
-
-}
-
-
-void
-SwLedBlink4(
- PLED_USB pLed
- )
-{
- _adapter *padapter = pLed->padapter;
- struct led_priv *ledpriv = &(padapter->ledpriv);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- PLED_USB pLed1 = &(ledpriv->SwLed1);
- u8 bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
- if(!pLed1->bLedWPSBlinkInProgress && pLed1->BlinkingLedState == LED_UNKNOWN)
- {
- pLed1->BlinkingLedState = RTW_LED_OFF;
- pLed1->CurrLedState = RTW_LED_OFF;
- SwLedOff(padapter, pLed1);
- }
-
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_SLOWLY:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- break;
-
- case LED_BLINK_StartToBlink:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- break;
-
- case LED_BLINK_SCAN:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _FALSE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if(IS_HARDWARE_TYPE_8192DU(padapter))
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_WPS:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- break;
-
- case LED_BLINK_WPS_STOP: //WPS authentication fail
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- break;
-
- case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
- pLed->BlinkTimes--;
- if(pLed->BlinkTimes == 0)
- {
- if(pLed->bLedOn)
- {
- pLed->BlinkTimes = 1;
- }
- else
- {
- bStopBlinking = _TRUE;
- }
- }
-
- if(bStopBlinking)
- {
- pLed->BlinkTimes = 10;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- break;
-
- case LED_BLINK_ALWAYS_ON:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if(IS_HARDWARE_TYPE_8192DU(padapter))
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- }
- else
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
- SwLedOff(padapter, pLed);
- }
- else
- {
- if(IS_HARDWARE_TYPE_8192DU(padapter))
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink4 CurrLedState %d\n", pLed->CurrLedState));
-
-
-}
-
-void
-SwLedBlink5(
- PLED_USB pLed
- )
-{
- _adapter *padapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- u8 bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_SCAN:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if(pLed->bLedOn)
- SwLedOff(padapter, pLed);
- }
- else
- { pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if(!pLed->bLedOn)
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
-
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- }
- break;
-
-
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if(pLed->bLedOn)
- SwLedOff(padapter, pLed);
- }
- else
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if(!pLed->bLedOn)
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
-
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(padapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState));
-
-
-}
-
-void
-SwLedBlink6(
- PLED_USB pLed
- )
-{
- _adapter *padapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- u8 bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(padapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink6\n"));
-}
-
-void
-SwLedBlink7(
- PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_SCAN:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(Adapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if( !pLed->bLedOn )
- SwLedOn(Adapter, pLed);
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedOn )
- SwLedOff(Adapter, pLed);
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
- }
- break;
-
- case LED_BLINK_WPS:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
- break;
-
- case LED_BLINK_WPS_STOP: //WPS success
- if(pLed->BlinkingLedState == RTW_LED_ON)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
- bStopBlinking = _FALSE;
- }
- else
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- break;
-
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink7\n"));
-
-}
-
-void
-SwLedBlink8(
- PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes blink8(%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes blink8(%d): turn off\n", pLed->BlinkTimes));
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink8\n"));
-
-}
-
-//page added for Belkin AC950. 20120813
-void
-SwLedBlink9(
- PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
-
- switch(pLed->CurrLedState)
- {
- case RTW_LED_ON:
- SwLedOn(Adapter, pLed);
- break;
-
- case RTW_LED_OFF:
- SwLedOff(Adapter, pLed);
- break;
-
- case LED_BLINK_SLOWLY:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- break;
-
- case LED_BLINK_StartToBlink:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- break;
-
- case LED_BLINK_SCAN:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(Adapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
- {
- pLed->bLedLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
-
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->BlinkTimes = 0;
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if(IS_HARDWARE_TYPE_8192DU(Adapter))
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_WPS:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- break;
-
- case LED_BLINK_WPS_STOP: //WPS authentication fail
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- break;
-
- case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
- pLed->BlinkTimes--;
- pLed->BlinkCounter --;
- if(pLed->BlinkCounter == 0)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- pLed->CurrLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- else
- {
- if(pLed->BlinkTimes == 0)
- {
- if(pLed->bLedOn)
- {
- pLed->BlinkTimes = 1;
- }
- else
- {
- bStopBlinking = _TRUE;
- }
- }
-
- if(bStopBlinking)
- {
- pLed->BlinkTimes = 10;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- }
- break;
-
- case LED_BLINK_ALWAYS_ON:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- }
- else
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8723AU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_LINK_IN_PROCESS:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ON_BELKIN);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_OFF_BELKIN);
- }
- break;
-
- case LED_BLINK_AUTH_ERROR:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking == _FALSE)
- {
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
- }
- }
- else
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
- }
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink9 CurrLedState %d\n", pLed->CurrLedState));
-}
-
-//page added for Netgear A6200V2. 20120827
-void
-SwLedBlink10(
- PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
-
- switch(pLed->CurrLedState)
- {
- case RTW_LED_ON:
- SwLedOn(Adapter, pLed);
- break;
-
- case RTW_LED_OFF:
- SwLedOff(Adapter, pLed);
- break;
-
- case LED_BLINK_SLOWLY:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- break;
-
- case LED_BLINK_StartToBlink:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- break;
-
- case LED_BLINK_SCAN:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
- {
- SwLedOff(Adapter, pLed);
- }
- else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- pLed->BlinkTimes = 0;
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_SLOWLY_INTERVAL_NETGEAR+LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
- }
- }
- break;
-
- case LED_BLINK_WPS:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL+LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
- break;
-
- case LED_BLINK_WPS_STOP: //WPS authentication fail
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- break;
-
- case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
- pLed->BlinkTimes--;
- pLed->BlinkCounter --;
- if(pLed->BlinkCounter == 0)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- pLed->CurrLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- else
- {
- if(pLed->BlinkTimes == 0)
- {
- if(pLed->bLedOn)
- {
- pLed->BlinkTimes = 1;
- }
- else
- {
- bStopBlinking = _TRUE;
- }
- }
-
- if(bStopBlinking)
- {
- pLed->BlinkTimes = 10;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- }
- break;
-
- case LED_BLINK_ALWAYS_ON:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- }
- else
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8723AU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- case LED_BLINK_LINK_IN_PROCESS:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ON_BELKIN);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_OFF_BELKIN);
- }
- break;
-
- case LED_BLINK_AUTH_ERROR:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking == _FALSE)
- {
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
- }
- }
- else
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
- }
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink10 CurrLedState %d\n", pLed->CurrLedState));
-
-}
-
-void
-SwLedBlink11(
- PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
-
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_TXRX:
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
-
- break;
-
- case LED_BLINK_WPS:
- if(pLed->BlinkTimes == 5)
- {
- SwLedOn(Adapter, pLed);
- _set_timer(&(pLed->BlinkTimer), LED_CM11_LINK_ON_INTERVEL);
- }
- else
- {
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_CM11_BLINK_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_CM11_BLINK_INTERVAL);
- }
- }
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking == _TRUE)
- pLed->BlinkTimes = 5;
- break;
-
- case LED_BLINK_WPS_STOP: //WPS authentication fail
- if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- else
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- SwLedOn(Adapter, pLed);
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState));
-}
-
-void
-SwLedBlink12(
- PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bStopBlinking = _FALSE;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%ld): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%ld): turn off\n", pLed->BlinkTimes));
- }
-
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_SLOWLY:
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- break;
-
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
-
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if(pLed->bLedOn)
- SwLedOff(Adapter, pLed);
- }
- else
- {
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
-
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink8 CurrLedState %d\n", pLed->CurrLedState));
-
-
-}
-
-VOID
-SwLedBlink13(
- IN PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bStopBlinking = _FALSE;
- static u8 LinkBlinkCnt=0;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("!!! SwLedBlink13 CurrLedState %d, bLedWPSBlinkInProgress %d, bLedBlinkInProgress %d\n", pLed->CurrLedState,pLed->bLedWPSBlinkInProgress,pLed->bLedBlinkInProgress));
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_LINK_IN_PROCESS:
- if(!pLed->bLedWPSBlinkInProgress)
- LinkBlinkCnt++;
-
- if(LinkBlinkCnt>15)
- {
- LinkBlinkCnt=0;
- pLed->bLedBlinkInProgress = _FALSE;
- break;
- }
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 500);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 500);
- }
-
- break;
-
- case LED_BLINK_WPS:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_NETGEAR);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_NETGEAR);
- }
-
- break;
-
- case LED_BLINK_WPS_STOP: //WPS success
- SwLedOff(Adapter, pLed);
- pLed->bLedWPSBlinkInProgress = _FALSE;
- break;
-
- default:
- LinkBlinkCnt=0;
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink13\n"));
-
-}
-
-VOID
-SwLedBlink14(
- IN PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bStopBlinking = _FALSE;
- static u8 LinkBlinkCnt=0;
-
- // Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("!!! SwLedBlink14 CurrLedState %d, bLedWPSBlinkInProgress %d, bLedBlinkInProgress %d\n", pLed->CurrLedState,pLed->bLedWPSBlinkInProgress,pLed->bLedBlinkInProgress));
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- SwLedOn(Adapter, pLed);
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- if (IS_HARDWARE_TYPE_8812AU(Adapter))
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- else
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- if (IS_HARDWARE_TYPE_8812AU(Adapter))
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- else
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- }
-
- break;
-
- default:
- LinkBlinkCnt=0;
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink14\n"));
-}
-
-VOID
-SwLedBlink15(
- IN PLED_USB pLed
- )
-{
- PADAPTER Adapter = pLed->padapter;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bStopBlinking = _FALSE;
- static u8 LinkBlinkCnt=0;
- // Change LED according to BlinkingLedState specified.
-
- if( pLed->BlinkingLedState == RTW_LED_ON )
- {
- SwLedOn(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
- }
- else
- {
- if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
- SwLedOff(Adapter, pLed);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
- }
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("!!! SwLedBlink15 CurrLedState %d, bLedWPSBlinkInProgress %d, bLedBlinkInProgress %d\n", pLed->CurrLedState,pLed->bLedWPSBlinkInProgress,pLed->bLedBlinkInProgress));
- switch(pLed->CurrLedState)
- {
- case LED_BLINK_WPS:
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_DLINK);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_DLINK);
- }
- break;
-
- case LED_BLINK_WPS_STOP: //WPS success
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("blink15, LED_BLINK_WPS_STOP BlinkingLedState %d\n",pLed->BlinkingLedState));
-
- if(pLed->BlinkingLedState == RTW_LED_OFF)
- {
- pLed->bLedWPSBlinkInProgress = _FALSE;
- return;
- }
-
- pLed->CurrLedState = LED_BLINK_WPS_STOP;
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_LINKED_ON_INTERVAL_DLINK);
- break;
-
- case LED_BLINK_NO_LINK:
- {
- static BOOLEAN bLedOn=_TRUE;
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("blink15, LED_NO_LINK_BLINK bLedOn %d\n",bLedOn));
- if(bLedOn)
- {
- bLedOn=_FALSE;
- pLed->BlinkingLedState = RTW_LED_OFF;
- }
- else
- {
- bLedOn=_TRUE;
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- pLed->bLedBlinkInProgress = _TRUE;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL);
- }
- break;
-
- case LED_BLINK_LINK_IDEL:
- {
- static BOOLEAN bLedOn=_TRUE;
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("blink15, LED_BLINK_LINK_IDEL bLedOn %d\n",bLedOn));
- if(bLedOn)
- {
- bLedOn=_FALSE;
- pLed->BlinkingLedState = RTW_LED_OFF;
- }
- else
- {
- bLedOn=_TRUE;
- pLed->BlinkingLedState = RTW_LED_ON;
-
- }
- pLed->bLedBlinkInProgress = _TRUE;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_IDEL_INTERVAL);
- }
- break;
-
- case LED_BLINK_SCAN:
- {
- static u8 BlinkTime=0;
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("blink15, LED_SCAN_BLINK bLedOn %d\n",BlinkTime));
- if(BlinkTime %2==0)
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- }
- BlinkTime ++;
-
- if(BlinkTime<24)
- {
- pLed->bLedBlinkInProgress = _TRUE;
-
- if(pLed->BlinkingLedState == RTW_LED_ON)
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_OFF_INTERVAL);
- else
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_ON_INTERVAL);
- }
- else
- {
- //if(pLed->OLDLedState ==LED_NO_LINK_BLINK)
- if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
- {
- pLed->CurrLedState = LED_BLINK_NO_LINK;
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), 100);
- }
- BlinkTime =0;
- }
- }
- break;
-
- case LED_BLINK_TXRX:
- pLed->BlinkTimes--;
- if( pLed->BlinkTimes == 0 )
- {
- bStopBlinking = _TRUE;
- }
- if(bStopBlinking)
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- SwLedOn(Adapter, pLed);
- }
- pLed->bLedBlinkInProgress = _FALSE;
- }
- else
- {
- if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
- {
- SwLedOff(Adapter, pLed);
- }
- else
- {
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- default:
- LinkBlinkCnt=0;
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink15\n"));
-}
-
-//
-// Description:
-// Handler function of LED Blinking.
-// We dispatch acture LED blink action according to LedStrategy.
-//
-void BlinkHandler(PLED_USB pLed)
-{
- _adapter *padapter = pLed->padapter;
- struct led_priv *ledpriv = &(padapter->ledpriv);
-
- //DBG_871X("%s (%s:%d)\n",__FUNCTION__, current->comm, current->pid);
-
- if( (padapter->bSurpriseRemoved == _TRUE) || (padapter->hw_init_completed == _FALSE))
- {
- //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped);
- return;
- }
-
- switch(ledpriv->LedStrategy)
- {
- case SW_LED_MODE0:
- SwLedBlink(pLed);
- break;
-
- case SW_LED_MODE1:
- SwLedBlink1(pLed);
- break;
-
- case SW_LED_MODE2:
- SwLedBlink2(pLed);
- break;
-
- case SW_LED_MODE3:
- SwLedBlink3(pLed);
- break;
-
- case SW_LED_MODE4:
- SwLedBlink4(pLed);
- break;
-
- case SW_LED_MODE5:
- SwLedBlink5(pLed);
- break;
-
- case SW_LED_MODE6:
- SwLedBlink6(pLed);
- break;
-
- case SW_LED_MODE7:
- SwLedBlink7(pLed);
- break;
-
- case SW_LED_MODE8:
- SwLedBlink8(pLed);
- break;
-
- case SW_LED_MODE9:
- SwLedBlink9(pLed);
- break;
-
- case SW_LED_MODE10:
- SwLedBlink10(pLed);
- break;
-
- case SW_LED_MODE11:
- SwLedBlink11(pLed);
- break;
-
- case SW_LED_MODE12:
- SwLedBlink12(pLed);
- break;
-
- case SW_LED_MODE13:
- SwLedBlink13(pLed);
- break;
-
- case SW_LED_MODE14:
- SwLedBlink14(pLed);
- break;
-
- case SW_LED_MODE15:
- SwLedBlink15(pLed);
- break;
-
- default:
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("BlinkWorkItemCallback 0x%x \n", ledpriv->LedStrategy));
- //SwLedBlink(pLed);
- break;
- }
-}
-
-//
-// Description:
-// Callback function of LED BlinkTimer,
-// it just schedules to corresponding BlinkWorkItem/led_blink_hdl
-//
-void BlinkTimerCallback(void *data)
-{
- PLED_USB pLed = (PLED_USB)data;
- _adapter *padapter = pLed->padapter;
-
- //DBG_871X("%s\n", __FUNCTION__);
-
- if( (padapter->bSurpriseRemoved == _TRUE) || (padapter->hw_init_completed == _FALSE))
- {
- //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped);
- return;
- }
-
- #ifdef CONFIG_LED_HANDLED_BY_CMD_THREAD
- rtw_led_blink_cmd(padapter, (PVOID)pLed);
- #else
- _set_workitem(&(pLed->BlinkWorkItem));
- #endif
-}
-
-//
-// Description:
-// Callback function of LED BlinkWorkItem.
-// We dispatch acture LED blink action according to LedStrategy.
-//
-void BlinkWorkItemCallback(_workitem *work)
-{
- PLED_USB pLed = container_of(work, LED_USB, BlinkWorkItem);
- BlinkHandler(pLed);
-}
-
-static void
-SwLedControlMode0(
- _adapter *padapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(padapter->ledpriv);
- PLED_USB pLed = &(ledpriv->SwLed1);
-
- // Decide led state
- switch(LedAction)
- {
- case LED_CTL_TX:
- case LED_CTL_RX:
- if( pLed->bLedBlinkInProgress == _FALSE )
- {
- pLed->bLedBlinkInProgress = _TRUE;
-
- pLed->CurrLedState = LED_BLINK_NORMAL;
- pLed->BlinkTimes = 2;
-
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- break;
-
- case LED_CTL_START_TO_LINK:
- if( pLed->bLedBlinkInProgress == _FALSE )
- {
- pLed->bLedBlinkInProgress = _TRUE;
-
- pLed->CurrLedState = LED_BLINK_StartToBlink;
- pLed->BlinkTimes = 24;
-
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- }
- else
- {
- pLed->CurrLedState = LED_BLINK_StartToBlink;
- }
- break;
-
- case LED_CTL_LINK:
- pLed->CurrLedState = RTW_LED_ON;
- if( pLed->bLedBlinkInProgress == _FALSE )
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_NO_LINK:
- pLed->CurrLedState = RTW_LED_OFF;
- if( pLed->bLedBlinkInProgress == _FALSE )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- if(pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- SwLedOff(padapter, pLed);
- break;
-
- case LED_CTL_START_WPS:
- if( pLed->bLedBlinkInProgress == _FALSE || pLed->CurrLedState == RTW_LED_ON)
- {
- pLed->bLedBlinkInProgress = _TRUE;
-
- pLed->CurrLedState = LED_BLINK_WPS;
- pLed->BlinkTimes = 20;
-
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
- }
- }
- break;
-
- case LED_CTL_STOP_WPS:
- if(pLed->bLedBlinkInProgress)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- break;
-
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
-
-}
-
- //ALPHA, added by chiyoko, 20090106
-static void
-SwLedControlMode1(
- _adapter *padapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(padapter->ledpriv);
- PLED_USB pLed = &(ledpriv->SwLed0);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
-
- u32 uLedBlinkNoLinkInterval = LED_BLINK_NO_LINK_INTERVAL_ALPHA; //add by ylb 20121012 for customer led for alpha
- if(pEEPROM->CustomerID == RT_CID_819x_ALPHA_Dlink)
- uLedBlinkNoLinkInterval= LED_BLINK_NO_LINK_INTERVAL_ALPHA_500MS;
-
- if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
- pLed = &(ledpriv->SwLed1);
-
- switch(LedAction)
- {
- case LED_CTL_POWER_ON:
- case LED_CTL_START_TO_LINK:
- case LED_CTL_NO_LINK:
- if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
- if( pLed->bLedLinkBlinkInProgress == _TRUE )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
-
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
- }
- break;
-
- case LED_CTL_LINK:
- if( pLed->bLedLinkBlinkInProgress == _FALSE )
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_NORMAL;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_SITE_SURVEY:
- if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
- ;
- else if(pLed->bLedScanBlinkInProgress ==_FALSE)
- {
- if(IS_LED_WPS_BLINKING(pLed))
- return;
-
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedLinkBlinkInProgress == _TRUE )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedScanBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkTimes = 24;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason == RF_CHANGE_BY_IPS)
- _set_timer(&(pLed->BlinkTimer), LED_INITIAL_INTERVAL);
- else
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
-
- }
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if(pLed->bLedBlinkInProgress ==_FALSE)
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedLinkBlinkInProgress == _TRUE )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- if(pLed->bLedWPSBlinkInProgress ==_FALSE)
- {
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedLinkBlinkInProgress == _TRUE )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedScanBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_WPS;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- break;
-
-
- case LED_CTL_STOP_WPS:
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedLinkBlinkInProgress == _TRUE )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedScanBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- }
- else
- {
- pLed->bLedWPSBlinkInProgress = _TRUE;
- }
-
- pLed->CurrLedState = LED_BLINK_WPS_STOP;
- if(pLed->bLedOn)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_STOP_WPS_FAIL:
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedNoLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
-
- SwLedOff(padapter, pLed);
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
-}
-
- //Arcadyan/Sitecom , added by chiyoko, 20090216
-static void
-SwLedControlMode2(
- _adapter *padapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(padapter->ledpriv);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- switch(LedAction)
- {
- case LED_CTL_SITE_SURVEY:
- if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
- ;
- else if(pLed->bLedScanBlinkInProgress ==_FALSE)
- {
- if(IS_LED_WPS_BLINKING(pLed))
- return;
-
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedScanBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkTimes = 24;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
-
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_LINK:
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
-
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- if(pLed->bLedWPSBlinkInProgress ==_FALSE)
- {
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedScanBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_STOP_WPS:
- pLed->bLedWPSBlinkInProgress = _FALSE;
- if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on)
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- else
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 0);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- }
- break;
-
- case LED_CTL_STOP_WPS_FAIL:
- pLed->bLedWPSBlinkInProgress = _FALSE;
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
- break;
-
- case LED_CTL_START_TO_LINK:
- case LED_CTL_NO_LINK:
- if(!IS_LED_BLINKING(pLed))
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- if( pLed->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- SwLedOff(padapter, pLed);
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
-}
-
- //COREGA, added by chiyoko, 20090316
- static void
- SwLedControlMode3(
- _adapter *padapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(padapter->ledpriv);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- switch(LedAction)
- {
- case LED_CTL_SITE_SURVEY:
- if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
- ;
- else if(pLed->bLedScanBlinkInProgress ==_FALSE)
- {
- if(IS_LED_WPS_BLINKING(pLed))
- return;
-
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedScanBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkTimes = 24;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
-
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_LINK:
- if(IS_LED_WPS_BLINKING(pLed))
- return;
-
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
-
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- if(pLed->bLedWPSBlinkInProgress ==_FALSE)
- {
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedScanBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_WPS;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_STOP_WPS:
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- else
- {
- pLed->bLedWPSBlinkInProgress = _TRUE;
- }
-
- pLed->CurrLedState = LED_BLINK_WPS_STOP;
- if(pLed->bLedOn)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
-
- break;
-
- case LED_CTL_STOP_WPS_FAIL:
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_START_TO_LINK:
- case LED_CTL_NO_LINK:
- if(!IS_LED_BLINKING(pLed))
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- if( pLed->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- SwLedOff(padapter, pLed);
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
-}
-
-
- //Edimax-Belkin, added by chiyoko, 20090413
-static void
-SwLedControlMode4(
- _adapter *padapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(padapter->ledpriv);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
- PLED_USB pLed1 = &(ledpriv->SwLed1);
-
- switch(LedAction)
- {
- case LED_CTL_START_TO_LINK:
- if(pLed1->bLedWPSBlinkInProgress)
- {
- pLed1->bLedWPSBlinkInProgress = _FALSE;
- _cancel_timer_ex(&(pLed1->BlinkTimer));
-
- pLed1->BlinkingLedState = RTW_LED_OFF;
- pLed1->CurrLedState = RTW_LED_OFF;
-
- if(pLed1->bLedOn)
- _set_timer(&(pLed->BlinkTimer), 0);
- }
-
- if( pLed->bLedStartToLinkBlinkInProgress == _FALSE )
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedNoLinkBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
-
- pLed->bLedStartToLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_StartToBlink;
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- }
- break;
-
- case LED_CTL_LINK:
- case LED_CTL_NO_LINK:
- //LED1 settings
- if(LedAction == LED_CTL_LINK)
- {
- if(pLed1->bLedWPSBlinkInProgress)
- {
- pLed1->bLedWPSBlinkInProgress = _FALSE;
- _cancel_timer_ex(&(pLed1->BlinkTimer));
-
- pLed1->BlinkingLedState = RTW_LED_OFF;
- pLed1->CurrLedState = RTW_LED_OFF;
-
- if(pLed1->bLedOn)
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- }
-
- if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
-
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- if(IS_HARDWARE_TYPE_8192DU(padapter))
- {
- if(LedAction == LED_CTL_LINK)
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- }
- else
- {
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
-
- }
- }
- else
- {
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_SITE_SURVEY:
- if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
- ;
- else if(pLed->bLedScanBlinkInProgress ==_FALSE)
- {
- if(IS_LED_WPS_BLINKING(pLed))
- return;
-
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedScanBlinkInProgress = _TRUE;
- if(IS_HARDWARE_TYPE_8192D(padapter))
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- else
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkTimes = 24;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if(pLed->bLedBlinkInProgress ==_FALSE)
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- if(pLed1->bLedWPSBlinkInProgress)
- {
- pLed1->bLedWPSBlinkInProgress = _FALSE;
- _cancel_timer_ex(&(pLed1->BlinkTimer));
-
- pLed1->BlinkingLedState = RTW_LED_OFF;
- pLed1->CurrLedState = RTW_LED_OFF;
-
- if(pLed1->bLedOn)
- _set_timer(&(pLed->BlinkTimer), 0);
- }
-
- if(pLed->bLedWPSBlinkInProgress ==_FALSE)
- {
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedScanBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_WPS;
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- }
- }
- break;
-
- case LED_CTL_STOP_WPS: //WPS connect success
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
-
- break;
-
- case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
-
- //LED1 settings
- if(pLed1->bLedWPSBlinkInProgress)
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- else
- pLed1->bLedWPSBlinkInProgress = _TRUE;
-
- pLed1->CurrLedState = LED_BLINK_WPS_STOP;
- if( pLed1->bLedOn )
- pLed1->BlinkingLedState = RTW_LED_OFF;
- else
- pLed1->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
-
- break;
-
- case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
-
- //LED1 settings
- if(pLed1->bLedWPSBlinkInProgress)
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- else
- pLed1->bLedWPSBlinkInProgress = _TRUE;
-
- pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP;
- pLed1->BlinkTimes = 10;
- if( pLed1->bLedOn )
- pLed1->BlinkingLedState = RTW_LED_OFF;
- else
- pLed1->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
-
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- if( pLed->bLedNoLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- if( pLed->bLedStartToLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedStartToLinkBlinkInProgress = _FALSE;
- }
-
- if( pLed1->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- pLed1->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed1->BlinkingLedState = LED_UNKNOWN;
- SwLedOff(padapter, pLed);
- SwLedOff(padapter, pLed1);
- break;
-
- case LED_CTL_CONNECTION_NO_TRANSFER:
- if(pLed->bLedBlinkInProgress == _FALSE)
- {
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- pLed->bLedBlinkInProgress = _TRUE;
-
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
-}
-
-
-
- //Sercomm-Belkin, added by chiyoko, 20090415
-static void
-SwLedControlMode5(
- _adapter *padapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(padapter->ledpriv);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
- pLed = &(ledpriv->SwLed1);
-
- switch(LedAction)
- {
- case LED_CTL_POWER_ON:
- case LED_CTL_NO_LINK:
- case LED_CTL_LINK: //solid blue
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_SITE_SURVEY:
- if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
- ;
- else if(pLed->bLedScanBlinkInProgress ==_FALSE)
- {
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedScanBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkTimes = 24;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if(pLed->bLedBlinkInProgress ==_FALSE)
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN)
- {
- return;
- }
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
-
- SwLedOff(padapter, pLed);
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
-}
-
- //WNC-Corega, added by chiyoko, 20090902
-static void
-SwLedControlMode6(
- _adapter *padapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(padapter->ledpriv);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- PLED_USB pLed0 = &(ledpriv->SwLed0);
-
- switch(LedAction)
- {
- case LED_CTL_POWER_ON:
- case LED_CTL_LINK:
- case LED_CTL_NO_LINK:
- _cancel_timer_ex(&(pLed0->BlinkTimer));
- pLed0->CurrLedState = RTW_LED_ON;
- pLed0->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed0->BlinkTimer), 0);
- break;
-
- case LED_CTL_POWER_OFF:
- SwLedOff(padapter, pLed0);
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("ledcontrol 6 Led %d\n", pLed0->CurrLedState));
-}
-
-//Netgear, added by sinda, 2011/11/11
- void
- SwLedControlMode7(
- PADAPTER Adapter,
- LED_CTL_MODE LedAction
- )
-{
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- switch(LedAction)
- {
- case LED_CTL_SITE_SURVEY:
- if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
- ;
- else if(pLed->bLedScanBlinkInProgress == _FALSE)
- {
- if(IS_LED_WPS_BLINKING(pLed))
- return;
-
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedScanBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkTimes = 6;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
- break;
-
- case LED_CTL_LINK:
- if(IS_LED_WPS_BLINKING(pLed))
- return;
-
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
-
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- if(pLed->bLedWPSBlinkInProgress ==_FALSE)
- {
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedScanBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_WPS;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
- break;
-
- case LED_CTL_STOP_WPS:
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- else
- {
- pLed->bLedWPSBlinkInProgress = _TRUE;
- }
-
- pLed->CurrLedState = LED_BLINK_WPS_STOP;
- if(pLed->bLedOn)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
-
- break;
-
-
- case LED_CTL_STOP_WPS_FAIL:
- case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_START_TO_LINK:
- case LED_CTL_NO_LINK:
- if(!IS_LED_BLINKING(pLed))
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_POWER_OFF:
- case LED_CTL_POWER_ON:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- if( pLed->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("LEd control mode 7 CurrLedState %d\n", pLed->CurrLedState));
-}
-
-void
-SwLedControlMode8(
- PADAPTER Adapter,
- LED_CTL_MODE LedAction
- )
-{
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- PLED_USB pLed0 = &(ledpriv->SwLed0);
-
- switch(LedAction)
- {
- case LED_CTL_LINK:
- _cancel_timer_ex(&(pLed0->BlinkTimer));
- pLed0->CurrLedState = RTW_LED_ON;
- pLed0->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed0->BlinkTimer), 0);
- break;
-
- case LED_CTL_NO_LINK:
- _cancel_timer_ex(&(pLed0->BlinkTimer));
- pLed0->CurrLedState = RTW_LED_OFF;
- pLed0->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed0->BlinkTimer), 0);
- break;
-
- case LED_CTL_POWER_OFF:
- SwLedOff(Adapter, pLed0);
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 8 %d\n", pLed0->CurrLedState));
-
-}
-
-//page added for Belkin AC950, 20120813
-void
-SwLedControlMode9(
- IN PADAPTER Adapter,
- IN LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
- PLED_USB pLed1 = &(ledpriv->SwLed1);
- PLED_USB pLed2 = &(ledpriv->SwLed2);
- BOOLEAN bWPSOverLap = _FALSE;
-
- switch(LedAction)
- {
- case LED_CTL_START_TO_LINK:
- if(pLed2->bLedBlinkInProgress == _FALSE)
- {
- pLed2->bLedBlinkInProgress = _TRUE;
- pLed2->BlinkingLedState = RTW_LED_ON;
- pLed2->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
-
- _set_timer(&(pLed2->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_LINK:
- case LED_CTL_NO_LINK:
- //LED1 settings
- if(LedAction == LED_CTL_NO_LINK)
- {
- //if(pMgntInfo->AuthStatus == AUTH_STATUS_FAILED)
- if(0)
- {
- pLed1->CurrLedState = LED_BLINK_AUTH_ERROR;
- if( pLed1->bLedOn )
- pLed1->BlinkingLedState = RTW_LED_OFF;
- else
- pLed1->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed1->BlinkTimer), 0);
- }
- else
- {
- pLed1->CurrLedState = RTW_LED_OFF;
- pLed1->BlinkingLedState = RTW_LED_OFF;
- if( pLed1->bLedOn )
- _set_timer(&(pLed1->BlinkTimer), 0);
- }
- }
- else
- {
- pLed1->CurrLedState = RTW_LED_OFF;
- pLed1->BlinkingLedState = RTW_LED_OFF;
- if( pLed1->bLedOn )
- _set_timer(&(pLed1->BlinkTimer), 0);
- }
-
- //LED2 settings
- if(LedAction == LED_CTL_LINK)
- {
- if(Adapter->securitypriv.dot11PrivacyAlgrthm != _NO_PRIVACY_)
- {
- if(pLed2->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed2->BlinkTimer));
- pLed2->bLedBlinkInProgress = _FALSE;
- }
- pLed2->CurrLedState = RTW_LED_ON;
- pLed2->bLedNoLinkBlinkInProgress = _TRUE;
- if(!pLed2->bLedOn)
- _set_timer(&(pLed2->BlinkTimer), 0);
- }
- else
- {
- if(pLed2->bLedWPSBlinkInProgress != _TRUE)
- {
- pLed2->CurrLedState = RTW_LED_OFF;
- pLed2->BlinkingLedState = RTW_LED_OFF;
- if(pLed2->bLedOn)
- _set_timer(&(pLed2->BlinkTimer), 0);
- }
- }
- }
- else //NO_LINK
- {
- if(pLed2->bLedWPSBlinkInProgress == _FALSE)
- {
- pLed2->CurrLedState = RTW_LED_OFF;
- pLed2->BlinkingLedState = RTW_LED_OFF;
- if(pLed2->bLedOn)
- _set_timer(&(pLed2->BlinkTimer), 0);
- }
- }
-
- //LED0 settings
- if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
-
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
- {
- if(LedAction == LED_CTL_LINK)
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- }
- else
- {
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- }
- else
- {
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- }
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
-
- break;
-
- case LED_CTL_SITE_SURVEY:
- if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
- ;
- else //if(pLed->bLedScanBlinkInProgress ==FALSE)
- {
- if(IS_LED_WPS_BLINKING(pLed))
- return;
-
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedScanBlinkInProgress = _TRUE;
- if(IS_HARDWARE_TYPE_8192D(Adapter))
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- else
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkTimes = 24;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
-
- }
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if(pLed->bLedBlinkInProgress == _FALSE)
- {
- if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
- {
- return;
- }
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- pLed2->bLedBlinkInProgress = _TRUE;
- pLed2->BlinkingLedState = RTW_LED_ON;
- pLed2->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
- pLed2->bLedWPSBlinkInProgress = _TRUE;
-
- _set_timer(&(pLed2->BlinkTimer), 0);
-
- break;
-
- case LED_CTL_STOP_WPS: //WPS connect success
- //LED2 settings
- if(pLed2->bLedWPSBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed2->BlinkTimer));
- pLed2->bLedBlinkInProgress = _FALSE;
- pLed2->bLedWPSBlinkInProgress = _FALSE;
- }
- pLed2->CurrLedState = RTW_LED_ON;
- pLed2->bLedNoLinkBlinkInProgress = _TRUE;
- if(!pLed2->bLedOn)
- _set_timer(&(pLed2->BlinkTimer), 0);
-
- //LED1 settings
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- pLed1->CurrLedState = RTW_LED_OFF;
- pLed1->BlinkingLedState = RTW_LED_OFF;
- if( pLed1->bLedOn )
- _set_timer(&(pLed1->BlinkTimer), 0);
-
-
- break;
-
- case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
- //LED1 settings
- //if(bWPSOverLap == _FALSE)
- {
- pLed1->CurrLedState = LED_BLINK_AUTH_ERROR;
- pLed1->BlinkTimes = 50;
- if( pLed1->bLedOn )
- pLed1->BlinkingLedState = RTW_LED_OFF;
- else
- pLed1->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed1->BlinkTimer), 0);
- }
- //else
- //{
- // bWPSOverLap = _FALSE;
- // pLed1->CurrLedState = RTW_LED_OFF;
- // pLed1->BlinkingLedState = RTW_LED_OFF;
- // _set_timer(&(pLed1->BlinkTimer), 0);
- //}
-
- //LED2 settings
- pLed2->CurrLedState = RTW_LED_OFF;
- pLed2->BlinkingLedState = RTW_LED_OFF;
- pLed2->bLedWPSBlinkInProgress = _FALSE;
- if( pLed2->bLedOn )
- _set_timer(&(pLed2->BlinkTimer), 0);
-
- break;
-
- case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
- //LED1 settings
- bWPSOverLap = _TRUE;
- pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP;
- pLed1->BlinkTimes = 10;
- pLed1->BlinkCounter = 50;
- if( pLed1->bLedOn )
- pLed1->BlinkingLedState = RTW_LED_OFF;
- else
- pLed1->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed1->BlinkTimer), 0);
-
- //LED2 settings
- pLed2->CurrLedState = RTW_LED_OFF;
- pLed2->BlinkingLedState = RTW_LED_OFF;
- pLed2->bLedWPSBlinkInProgress = _FALSE;
- if( pLed2->bLedOn )
- _set_timer(&(pLed2->BlinkTimer), 0);
-
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- if( pLed->bLedNoLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- if( pLed->bLedStartToLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedStartToLinkBlinkInProgress = _FALSE;
- }
-
- if( pLed1->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- pLed1->bLedWPSBlinkInProgress = _FALSE;
- }
-
-
- pLed1->BlinkingLedState = LED_UNKNOWN;
- SwLedOff(Adapter, pLed);
- SwLedOff(Adapter, pLed1);
- break;
-
- case LED_CTL_CONNECTION_NO_TRANSFER:
- if(pLed->bLedBlinkInProgress == _FALSE)
- {
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- pLed->bLedBlinkInProgress = _TRUE;
-
- pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 9 Led %d\n", pLed->CurrLedState));
-}
-
-//page added for Netgear A6200V2, 20120827
-void
-SwLedControlMode10(
- PADAPTER Adapter,
- LED_CTL_MODE LedAction
-)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
- PLED_USB pLed1 = &(ledpriv->SwLed1);
-
- switch(LedAction)
- {
- case LED_CTL_START_TO_LINK:
- if(pLed1->bLedBlinkInProgress == _FALSE)
- {
- pLed1->bLedBlinkInProgress = _TRUE;
- pLed1->BlinkingLedState = RTW_LED_ON;
- pLed1->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
-
- _set_timer(&(pLed1->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_LINK:
- case LED_CTL_NO_LINK:
- if(LedAction == LED_CTL_LINK)
- {
- if(pLed->bLedWPSBlinkInProgress == _TRUE || pLed1->bLedWPSBlinkInProgress == _TRUE)
- ;
- else
- {
- if(pHalData->CurrentBandType == BAND_ON_2_4G)
- //LED0 settings
- {
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- _set_timer(&(pLed->BlinkTimer), 0);
-
- pLed1->CurrLedState = RTW_LED_OFF;
- pLed1->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed1->BlinkTimer), 0);
- }
- else if(pHalData->CurrentBandType == BAND_ON_5G)
- //LED1 settings
- {
- pLed1->CurrLedState = RTW_LED_ON;
- pLed1->BlinkingLedState = RTW_LED_ON;
- if(pLed1->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- pLed1->bLedBlinkInProgress = _FALSE;
- }
- _set_timer(&(pLed1->BlinkTimer), 0);
-
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- }
- }
- else if(LedAction == LED_CTL_NO_LINK) //TODO by page
- {
- if(pLed->bLedWPSBlinkInProgress == _TRUE || pLed1->bLedWPSBlinkInProgress == _TRUE)
- ;
- else
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedOn )
- _set_timer(&(pLed->BlinkTimer), 0);
-
- pLed1->CurrLedState = RTW_LED_OFF;
- pLed1->BlinkingLedState = RTW_LED_OFF;
- if( pLed1->bLedOn )
- _set_timer(&(pLed1->BlinkTimer), 0);
- }
- }
-
- break;
-
- case LED_CTL_SITE_SURVEY:
- if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- ; //don't blink when media connect
- else //if(pLed->bLedScanBlinkInProgress ==FALSE)
- {
- if(IS_LED_WPS_BLINKING(pLed) || IS_LED_WPS_BLINKING(pLed1))
- return;
-
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedScanBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkTimes = 12;
- pLed->BlinkingLedState = LED_BLINK_SCAN;
- _set_timer(&(pLed->BlinkTimer), 0);
-
- if(pLed1->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- pLed1->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if(pLed1->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- pLed1->bLedBlinkInProgress = _FALSE;
- }
- pLed1->bLedScanBlinkInProgress = _TRUE;
- pLed1->CurrLedState = LED_BLINK_SCAN;
- pLed1->BlinkTimes = 12;
- pLed1->BlinkingLedState = LED_BLINK_SCAN;
- _set_timer(&(pLed1->BlinkTimer), LED_BLINK_LINK_SLOWLY_INTERVAL_NETGEAR);
-
- }
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- //LED0 settings
- if(pLed->bLedBlinkInProgress == _FALSE)
- {
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->BlinkingLedState = LED_BLINK_WPS;
- pLed->CurrLedState = LED_BLINK_WPS;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
-
- //LED1 settings
- if(pLed1->bLedBlinkInProgress == _FALSE)
- {
- pLed1->bLedBlinkInProgress = _TRUE;
- pLed1->bLedWPSBlinkInProgress = _TRUE;
- pLed1->BlinkingLedState = LED_BLINK_WPS;
- pLed1->CurrLedState = LED_BLINK_WPS;
- _set_timer(&(pLed1->BlinkTimer), LED_BLINK_NORMAL_INTERVAL+LED_BLINK_LINK_INTERVAL_NETGEAR);
- }
-
-
- break;
-
- case LED_CTL_STOP_WPS: //WPS connect success
- if(pHalData->CurrentBandType == BAND_ON_2_4G)
- //LED0 settings
- {
- pLed->bLedWPSBlinkInProgress = _FALSE;
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- _set_timer(&(pLed->BlinkTimer), 0);
-
- pLed1->CurrLedState = RTW_LED_OFF;
- pLed1->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed1->BlinkTimer), 0);
- }
- else if(pHalData->CurrentBandType == BAND_ON_5G)
- //LED1 settings
- {
- pLed1->bLedWPSBlinkInProgress = _FALSE;
- pLed1->CurrLedState = RTW_LED_ON;
- pLed1->BlinkingLedState = RTW_LED_ON;
- if(pLed1->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed1->BlinkTimer));
- pLed1->bLedBlinkInProgress = _FALSE;
- }
- _set_timer(&(pLed1->BlinkTimer), 0);
-
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
-
- break;
-
- case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
- //LED1 settings
- pLed1->bLedWPSBlinkInProgress = _FALSE;
- pLed1->CurrLedState = RTW_LED_OFF;
- pLed1->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed1->BlinkTimer), 0);
-
- //LED0 settings
- pLed->bLedWPSBlinkInProgress = _FALSE;
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedOn )
- _set_timer(&(pLed->BlinkTimer), 0);
-
- break;
-
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 10 Led %d\n", pLed->CurrLedState));
-}
-
- //Edimax-ASUS, added by Page, 20121221
-void
-SwLedControlMode11(
- PADAPTER Adapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- switch(LedAction)
- {
- case LED_CTL_POWER_ON:
- case LED_CTL_START_TO_LINK:
- case LED_CTL_NO_LINK:
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_LINK:
- if( pLed->bLedBlinkInProgress == _TRUE )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_WPS;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->BlinkTimes = 5;
- _set_timer(&(pLed->BlinkTimer), 0);
-
- break;
-
-
- case LED_CTL_STOP_WPS:
- case LED_CTL_STOP_WPS_FAIL:
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->CurrLedState = LED_BLINK_WPS_STOP;
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- if( pLed->bLedNoLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedLinkBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedLinkBlinkInProgress = _FALSE;
- }
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
-
- SwLedOff(Adapter, pLed);
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led mode 1 CurrLedState %d\n", pLed->CurrLedState));
-}
-
-// page added for NEC
-
-VOID
-SwLedControlMode12(
- PADAPTER Adapter,
- LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- switch(LedAction)
- {
- case LED_CTL_POWER_ON:
- case LED_CTL_NO_LINK:
- case LED_CTL_LINK:
- case LED_CTL_SITE_SURVEY:
-
- if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
- {
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
-
- pLed->bLedNoLinkBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_SLOWLY;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if(pLed->bLedBlinkInProgress == _FALSE)
- {
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- break;
-
- case LED_CTL_POWER_OFF:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
-
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
-
- if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- }
-
- SwLedOff(Adapter, pLed);
- break;
-
- default:
- break;
-
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SWLed12 %d\n", pLed->CurrLedState));
-}
-
-// Maddest add for NETGEAR R6100
-
-VOID
-SwLedControlMode13(
- IN PADAPTER Adapter,
- IN LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 13 CurrLedState %d, LedAction %d\n", pLed->CurrLedState,LedAction));
- switch(LedAction)
- {
- case LED_CTL_LINK:
- if(pLed->bLedWPSBlinkInProgress)
- {
- return;
- }
-
-
- pLed->CurrLedState = RTW_LED_ON;
- pLed->BlinkingLedState = RTW_LED_ON;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
-
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- if(pLed->bLedWPSBlinkInProgress == _FALSE)
- {
- if(pLed->bLedBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedScanBlinkInProgress == _TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_WPS;
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_NETGEAR);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_NETGEAR);
- }
- }
- break;
-
- case LED_CTL_STOP_WPS:
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
- else
- {
- pLed->bLedWPSBlinkInProgress = _TRUE;
- }
-
- pLed->bLedWPSBlinkInProgress = _FALSE;
- pLed->CurrLedState = LED_BLINK_WPS_STOP;
- if(pLed->bLedOn)
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
-
- _set_timer(&(pLed->BlinkTimer), 0);
- }
-
- break;
-
-
- case LED_CTL_STOP_WPS_FAIL:
- case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_START_TO_LINK:
- if((pLed->bLedBlinkInProgress == _FALSE) && (pLed->bLedWPSBlinkInProgress == _FALSE))
- {
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->BlinkingLedState = RTW_LED_ON;
- pLed->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
-
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_NO_LINK:
-
- if(pLed->bLedWPSBlinkInProgress)
- {
- return;
- }
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- //if(!IS_LED_BLINKING(pLed))
- {
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- }
- break;
-
- case LED_CTL_POWER_OFF:
- case LED_CTL_POWER_ON:
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- if( pLed->bLedWPSBlinkInProgress )
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- if (LedAction == LED_CTL_POWER_ON)
- _set_timer(&(pLed->BlinkTimer), 0);
- else
- SwLedOff(Adapter, pLed);
- break;
-
- default:
- break;
-
- }
-
-
-}
-
-// Maddest add for DNI Buffalo
-
-VOID
-SwLedControlMode14(
- IN PADAPTER Adapter,
- IN LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 14 CurrLedState %d, LedAction %d\n", pLed->CurrLedState,LedAction));
- switch(LedAction)
- {
- case LED_CTL_POWER_OFF:
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 14 LED_CTL_POWER_OFF\n"));
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- SwLedOff(Adapter, pLed);
- break;
-
- case LED_CTL_POWER_ON:
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 14 LED_CTL_POWER_ON\n"));
- SwLedOn(Adapter, pLed);
- break;
-
- case LED_CTL_LINK:
- case LED_CTL_NO_LINK:
- if (IS_HARDWARE_TYPE_8812AU(Adapter))
- SwLedOn(Adapter, pLed);
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if(pLed->bLedBlinkInProgress ==_FALSE)
- {
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- if (IS_HARDWARE_TYPE_8812AU(Adapter))
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
- else
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- if (IS_HARDWARE_TYPE_8812AU(Adapter))
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
- else
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- }
- }
- break;
-
- default:
- break;
- }
-}
-
-// Maddest add for Dlink
-
-VOID
-SwLedControlMode15(
- IN PADAPTER Adapter,
- IN LED_CTL_MODE LedAction
-)
-{
- struct led_priv *ledpriv = &(Adapter->ledpriv);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- PLED_USB pLed = &(ledpriv->SwLed0);
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 CurrLedState %d, LedAction %d\n", pLed->CurrLedState,LedAction));
- switch(LedAction)
- {
- case LED_CTL_START_WPS: //wait until xinpin finish
- case LED_CTL_START_WPS_BOTTON:
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_START_WPS\n"));
- if(pLed->bLedWPSBlinkInProgress ==_FALSE)
- {
- if(pLed->bLedBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if(pLed->bLedScanBlinkInProgress ==_TRUE)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- pLed->bLedWPSBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_WPS;
- if( pLed->bLedOn )
- {
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_NETGEAR);
- }
- else
- {
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_NETGEAR);
- }
- }
- break;
-
- case LED_CTL_STOP_WPS:
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_STOP_WPS\n"));
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- }
-
- pLed->CurrLedState = LED_BLINK_WPS_STOP;
- //if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- {
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), 0);
- }
-
- break;
-
- case LED_CTL_STOP_WPS_FAIL:
- case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_STOP_WPS_FAIL\n"));
- if(pLed->bLedWPSBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedWPSBlinkInProgress = _FALSE;
- }
-
- pLed->CurrLedState = RTW_LED_OFF;
- pLed->BlinkingLedState = RTW_LED_OFF;
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_NO_LINK:
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_NO_LINK\n"));
- if(pLed->bLedWPSBlinkInProgress)
- {
- return;
- }
-
- /*if(Adapter->securitypriv.dot11PrivacyAlgrthm > _NO_PRIVACY_)
- {
- if(SecIsTxKeyInstalled(Adapter, pMgntInfo->Bssid))
- {
- }
- else
- {
- if(pMgntInfo->LEDAssocState ==LED_ASSOC_SECURITY_BEGIN)
- return;
- }
- }*/
-
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- if( pLed->bLedScanBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedScanBlinkInProgress = _FALSE;
- }
- //if(!IS_LED_BLINKING(pLed))
- {
- pLed->CurrLedState = LED_BLINK_NO_LINK;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 30);
- }
- break;
-
- case LED_CTL_LINK:
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_LINK\n"));
-
- if(pLed->bLedWPSBlinkInProgress)
- {
- return;
- }
-
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
-
- pLed->CurrLedState = LED_BLINK_LINK_IDEL;
- pLed->BlinkingLedState = RTW_LED_ON;
-
- _set_timer(&(pLed->BlinkTimer), 30);
- break;
-
- case LED_CTL_SITE_SURVEY :
- if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
- return;
-
- if(pLed->bLedWPSBlinkInProgress ==_TRUE)
- return;
-
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
- pLed->CurrLedState = LED_BLINK_SCAN;
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), 0);
- break;
-
- case LED_CTL_TX:
- case LED_CTL_RX:
- if(pLed->bLedWPSBlinkInProgress)
- {
- return;
- }
-
- if( pLed->bLedBlinkInProgress)
- {
- _cancel_timer_ex(&(pLed->BlinkTimer));
- pLed->bLedBlinkInProgress = _FALSE;
- }
-
- pLed->bLedBlinkInProgress = _TRUE;
- pLed->CurrLedState = LED_BLINK_TXRX;
- pLed->BlinkTimes = 2;
- if( pLed->bLedOn )
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
- break;
-
- default:
- break;
- }
-}
-
-void
-LedControlUSB(
- _adapter *padapter,
- LED_CTL_MODE LedAction
- )
-{
- struct led_priv *ledpriv = &(padapter->ledpriv);
-
-#if(MP_DRIVER == 1)
- if (padapter->registrypriv.mp_mode == 1)
- return;
-#endif
-
- if( (padapter->bSurpriseRemoved == _TRUE) ||(padapter->hw_init_completed == _FALSE) )
- {
- return;
- }
-
- if( ledpriv->bRegUseLed == _FALSE)
- return;
-
- //if(priv->bInHctTest)
- // return;
-
-#ifdef CONFIG_CONCURRENT_MODE
- // Only do led action for PRIMARY_ADAPTER
- if (padapter->adapter_type != PRIMARY_ADAPTER)
- return;
-#endif
-
- if( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on &&
- adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) &&
- (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX ||
- LedAction == LED_CTL_SITE_SURVEY ||
- LedAction == LED_CTL_LINK ||
- LedAction == LED_CTL_NO_LINK ||
- LedAction == LED_CTL_POWER_ON) )
- {
- return;
- }
-
- switch(ledpriv->LedStrategy)
- {
- case SW_LED_MODE0:
- SwLedControlMode0(padapter, LedAction);
- break;
-
- case SW_LED_MODE1:
- SwLedControlMode1(padapter, LedAction);
- break;
-
- case SW_LED_MODE2:
- SwLedControlMode2(padapter, LedAction);
- break;
-
- case SW_LED_MODE3:
- SwLedControlMode3(padapter, LedAction);
- break;
-
- case SW_LED_MODE4:
- SwLedControlMode4(padapter, LedAction);
- break;
-
- case SW_LED_MODE5:
- SwLedControlMode5(padapter, LedAction);
- break;
-
- case SW_LED_MODE6:
- SwLedControlMode6(padapter, LedAction);
- break;
-
- case SW_LED_MODE7:
- SwLedControlMode7(padapter, LedAction);
- break;
-
- case SW_LED_MODE8:
- SwLedControlMode8(padapter, LedAction);
- break;
-
- case SW_LED_MODE9:
- SwLedControlMode9(padapter, LedAction);
- break;
-
- case SW_LED_MODE10:
- SwLedControlMode10(padapter, LedAction);
- break;
-
- case SW_LED_MODE11:
- SwLedControlMode11(padapter, LedAction);
- break;
-
- case SW_LED_MODE12:
- SwLedControlMode12(padapter, LedAction);
- break;
-
- case SW_LED_MODE13:
- SwLedControlMode13(padapter, LedAction);
- break;
-
- case SW_LED_MODE14:
- SwLedControlMode14(padapter, LedAction);
- break;
-
- case SW_LED_MODE15:
- SwLedControlMode15(padapter, LedAction);
- break;
-
- default:
- break;
- }
-
- RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("LedStrategy:%d, LedAction %d\n", ledpriv->LedStrategy,LedAction));
-}
-
-//
-// Description:
-// Reset status of LED_871x object.
-//
-void ResetLedStatus(PLED_USB pLed) {
-
- pLed->CurrLedState = RTW_LED_OFF; // Current LED state.
- pLed->bLedOn = _FALSE; // true if LED is ON, false if LED is OFF.
-
- pLed->bLedBlinkInProgress = _FALSE; // true if it is blinking, false o.w..
- pLed->bLedWPSBlinkInProgress = _FALSE;
-
- pLed->BlinkTimes = 0; // Number of times to toggle led state for blinking.
- pLed->BlinkCounter = 0;
- pLed->BlinkingLedState = LED_UNKNOWN; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are.
-
- pLed->bLedNoLinkBlinkInProgress = _FALSE;
- pLed->bLedLinkBlinkInProgress = _FALSE;
- pLed->bLedStartToLinkBlinkInProgress = _FALSE;
- pLed->bLedScanBlinkInProgress = _FALSE;
-}
-
- //
-// Description:
-// Initialize an LED_871x object.
-//
-void
-InitLed(
- _adapter *padapter,
- PLED_USB pLed,
- LED_PIN LedPin
- )
-{
- pLed->padapter = padapter;
- pLed->LedPin = LedPin;
-
- ResetLedStatus(pLed);
-
- _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed);
-
- _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed);
-}
-
-
-//
-// Description:
-// DeInitialize an LED_871x object.
-//
-void
-DeInitLed(
- PLED_USB pLed
- )
-{
- _cancel_workitem_sync(&(pLed->BlinkWorkItem));
- _cancel_timer_ex(&(pLed->BlinkTimer));
- ResetLedStatus(pLed);
-}
-
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+
+#include <drv_types.h>
+#include <hal_data.h>
+
+//
+// Description:
+// Implementation of LED blinking behavior.
+// It toggle off LED and schedule corresponding timer if necessary.
+//
+void
+SwLedBlink(
+ PLED_USB pLed
+ )
+{
+ _adapter *padapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ u8 bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ // Determine if we shall change LED state again.
+ pLed->BlinkTimes--;
+ switch(pLed->CurrLedState)
+ {
+
+ case LED_BLINK_NORMAL:
+ if(pLed->BlinkTimes == 0)
+ {
+ bStopBlinking = _TRUE;
+ }
+ break;
+
+ case LED_BLINK_StartToBlink:
+ if( check_fwstate(pmlmepriv, _FW_LINKED) && check_fwstate(pmlmepriv, WIFI_STATION_STATE) )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if( check_fwstate(pmlmepriv, _FW_LINKED) &&
+ (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) )
+ {
+ bStopBlinking = _TRUE;
+ }
+ else if(pLed->BlinkTimes == 0)
+ {
+ bStopBlinking = _TRUE;
+ }
+ break;
+
+ case LED_BLINK_WPS:
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ break;
+
+
+ default:
+ bStopBlinking = _TRUE;
+ break;
+
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && (pLed->bLedOn == _FALSE))
+ {
+ SwLedOn(padapter, pLed);
+ }
+ else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) && pLed->bLedOn == _TRUE)
+ {
+ SwLedOff(padapter, pLed);
+ }
+
+ pLed->BlinkTimes = 0;
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ // Assign LED state to toggle.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ // Schedule a timer to toggle LED state.
+ switch( pLed->CurrLedState )
+ {
+ case LED_BLINK_NORMAL:
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ break;
+
+ case LED_BLINK_SLOWLY:
+ case LED_BLINK_StartToBlink:
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ break;
+
+ case LED_BLINK_WPS:
+ {
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
+ else
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
+ }
+ break;
+
+ default:
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ break;
+ }
+ }
+}
+
+void
+SwLedBlink1(
+ PLED_USB pLed
+ )
+{
+ _adapter *padapter = pLed->padapter;
+ EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ PLED_USB pLed1 = &(ledpriv->SwLed1);
+ u8 bStopBlinking = _FALSE;
+
+ u32 uLedBlinkNoLinkInterval = LED_BLINK_NO_LINK_INTERVAL_ALPHA; //add by ylb 20121012 for customer led for alpha
+ if(pEEPROM->CustomerID == RT_CID_819x_ALPHA_Dlink)
+ uLedBlinkNoLinkInterval= LED_BLINK_NO_LINK_INTERVAL_ALPHA_500MS;
+
+ if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
+ pLed = &(ledpriv->SwLed1);
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+
+ if(pEEPROM->CustomerID == RT_CID_DEFAULT)
+ {
+ if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ if(!pLed1->bSWLedCtrl)
+ {
+ SwLedOn(padapter, pLed1);
+ pLed1->bSWLedCtrl = _TRUE;
+ }
+ else if(!pLed1->bLedOn)
+ SwLedOn(padapter, pLed1);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn on pLed1\n"));
+ }
+ else
+ {
+ if(!pLed1->bSWLedCtrl)
+ {
+ SwLedOff(padapter, pLed1);
+ pLed1->bSWLedCtrl = _TRUE;
+ }
+ else if(pLed1->bLedOn)
+ SwLedOff(padapter, pLed1);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn off pLed1\n"));
+ }
+ }
+
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_SLOWLY:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
+ break;
+
+ case LED_BLINK_NORMAL:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ break;
+
+ case LED_BLINK_SCAN:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->bLedLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_NORMAL;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->bLedLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_NORMAL;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->BlinkTimes = 0;
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_WPS:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS success
+ if(pLed->BlinkingLedState == RTW_LED_ON)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
+ bStopBlinking = _FALSE;
+ }
+ else
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ pLed->bLedLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_NORMAL;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+}
+
+void
+SwLedBlink2(
+ PLED_USB pLed
+ )
+{
+ _adapter *padapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ u8 bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON)
+ {
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_SCAN:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState));
+
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState));
+
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+}
+
+void
+SwLedBlink3(
+ PLED_USB pLed
+ )
+{
+ _adapter *padapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ u8 bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_SCAN:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if( !pLed->bLedOn )
+ SwLedOn(padapter, pLed);
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedOn )
+ SwLedOff(padapter, pLed);
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ if( !pLed->bLedOn )
+ SwLedOn(padapter, pLed);
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ if( pLed->bLedOn )
+ SwLedOff(padapter, pLed);
+
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_WPS:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS success
+ if(pLed->BlinkingLedState == RTW_LED_ON)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
+ bStopBlinking = _FALSE;
+ }
+ else
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+}
+
+
+void
+SwLedBlink4(
+ PLED_USB pLed
+ )
+{
+ _adapter *padapter = pLed->padapter;
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ PLED_USB pLed1 = &(ledpriv->SwLed1);
+ u8 bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ if(!pLed1->bLedWPSBlinkInProgress && pLed1->BlinkingLedState == LED_UNKNOWN)
+ {
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ pLed1->CurrLedState = RTW_LED_OFF;
+ SwLedOff(padapter, pLed1);
+ }
+
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_SLOWLY:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ break;
+
+ case LED_BLINK_StartToBlink:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ break;
+
+ case LED_BLINK_SCAN:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _FALSE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if(IS_HARDWARE_TYPE_8192DU(padapter))
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_WPS:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS authentication fail
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ break;
+
+ case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
+ pLed->BlinkTimes--;
+ if(pLed->BlinkTimes == 0)
+ {
+ if(pLed->bLedOn)
+ {
+ pLed->BlinkTimes = 1;
+ }
+ else
+ {
+ bStopBlinking = _TRUE;
+ }
+ }
+
+ if(bStopBlinking)
+ {
+ pLed->BlinkTimes = 10;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ break;
+
+ case LED_BLINK_ALWAYS_ON:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if(IS_HARDWARE_TYPE_8192DU(padapter))
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ }
+ else
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if(IS_HARDWARE_TYPE_8192DU(padapter))
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink4 CurrLedState %d\n", pLed->CurrLedState));
+
+
+}
+
+void
+SwLedBlink5(
+ PLED_USB pLed
+ )
+{
+ _adapter *padapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ u8 bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_SCAN:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if(pLed->bLedOn)
+ SwLedOff(padapter, pLed);
+ }
+ else
+ { pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if(!pLed->bLedOn)
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if(pLed->bLedOn)
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if(!pLed->bLedOn)
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(padapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState));
+
+
+}
+
+void
+SwLedBlink6(
+ PLED_USB pLed
+ )
+{
+ _adapter *padapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ u8 bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(padapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink6\n"));
+}
+
+void
+SwLedBlink7(
+ PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_SCAN:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if( !pLed->bLedOn )
+ SwLedOn(Adapter, pLed);
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedOn )
+ SwLedOff(Adapter, pLed);
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+ }
+ break;
+
+ case LED_BLINK_WPS:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS success
+ if(pLed->BlinkingLedState == RTW_LED_ON)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
+ bStopBlinking = _FALSE;
+ }
+ else
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink7\n"));
+
+}
+
+void
+SwLedBlink8(
+ PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes blink8(%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes blink8(%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink8\n"));
+
+}
+
+//page added for Belkin AC950. 20120813
+void
+SwLedBlink9(
+ PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+
+ switch(pLed->CurrLedState)
+ {
+ case RTW_LED_ON:
+ SwLedOn(Adapter, pLed);
+ break;
+
+ case RTW_LED_OFF:
+ SwLedOff(Adapter, pLed);
+ break;
+
+ case LED_BLINK_SLOWLY:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ break;
+
+ case LED_BLINK_StartToBlink:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ break;
+
+ case LED_BLINK_SCAN:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
+ {
+ pLed->bLedLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->BlinkTimes = 0;
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if(IS_HARDWARE_TYPE_8192DU(Adapter))
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_WPS:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS authentication fail
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ break;
+
+ case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
+ pLed->BlinkTimes--;
+ pLed->BlinkCounter --;
+ if(pLed->BlinkCounter == 0)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ pLed->CurrLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ else
+ {
+ if(pLed->BlinkTimes == 0)
+ {
+ if(pLed->bLedOn)
+ {
+ pLed->BlinkTimes = 1;
+ }
+ else
+ {
+ bStopBlinking = _TRUE;
+ }
+ }
+
+ if(bStopBlinking)
+ {
+ pLed->BlinkTimes = 10;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ }
+ break;
+
+ case LED_BLINK_ALWAYS_ON:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ }
+ else
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8723AU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_LINK_IN_PROCESS:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ON_BELKIN);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_OFF_BELKIN);
+ }
+ break;
+
+ case LED_BLINK_AUTH_ERROR:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking == _FALSE)
+ {
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
+ }
+ }
+ else
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink9 CurrLedState %d\n", pLed->CurrLedState));
+}
+
+//page added for Netgear A6200V2. 20120827
+void
+SwLedBlink10(
+ PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+
+ switch(pLed->CurrLedState)
+ {
+ case RTW_LED_ON:
+ SwLedOn(Adapter, pLed);
+ break;
+
+ case RTW_LED_OFF:
+ SwLedOff(Adapter, pLed);
+ break;
+
+ case LED_BLINK_SLOWLY:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ break;
+
+ case LED_BLINK_StartToBlink:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ break;
+
+ case LED_BLINK_SCAN:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on )
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ pLed->BlinkTimes = 0;
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_SLOWLY_INTERVAL_NETGEAR+LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+ }
+ }
+ break;
+
+ case LED_BLINK_WPS:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL+LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS authentication fail
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ break;
+
+ case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
+ pLed->BlinkTimes--;
+ pLed->BlinkCounter --;
+ if(pLed->BlinkCounter == 0)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ pLed->CurrLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ else
+ {
+ if(pLed->BlinkTimes == 0)
+ {
+ if(pLed->bLedOn)
+ {
+ pLed->BlinkTimes = 1;
+ }
+ else
+ {
+ bStopBlinking = _TRUE;
+ }
+ }
+
+ if(bStopBlinking)
+ {
+ pLed->BlinkTimes = 10;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ }
+ break;
+
+ case LED_BLINK_ALWAYS_ON:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ }
+ else
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8723AU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ case LED_BLINK_LINK_IN_PROCESS:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ON_BELKIN);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_OFF_BELKIN);
+ }
+ break;
+
+ case LED_BLINK_AUTH_ERROR:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking == _FALSE)
+ {
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
+ }
+ }
+ else
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink10 CurrLedState %d\n", pLed->CurrLedState));
+
+}
+
+void
+SwLedBlink11(
+ PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_TXRX:
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+
+ break;
+
+ case LED_BLINK_WPS:
+ if(pLed->BlinkTimes == 5)
+ {
+ SwLedOn(Adapter, pLed);
+ _set_timer(&(pLed->BlinkTimer), LED_CM11_LINK_ON_INTERVEL);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_CM11_BLINK_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_CM11_BLINK_INTERVAL);
+ }
+ }
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking == _TRUE)
+ pLed->BlinkTimes = 5;
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS authentication fail
+ if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ else
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ SwLedOn(Adapter, pLed);
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState));
+}
+
+void
+SwLedBlink12(
+ PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bStopBlinking = _FALSE;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%ld): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%ld): turn off\n", pLed->BlinkTimes));
+ }
+
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_SLOWLY:
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ break;
+
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if(pLed->bLedOn)
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink8 CurrLedState %d\n", pLed->CurrLedState));
+
+
+}
+
+VOID
+SwLedBlink13(
+ IN PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bStopBlinking = _FALSE;
+ static u8 LinkBlinkCnt=0;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("!!! SwLedBlink13 CurrLedState %d, bLedWPSBlinkInProgress %d, bLedBlinkInProgress %d\n", pLed->CurrLedState,pLed->bLedWPSBlinkInProgress,pLed->bLedBlinkInProgress));
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_LINK_IN_PROCESS:
+ if(!pLed->bLedWPSBlinkInProgress)
+ LinkBlinkCnt++;
+
+ if(LinkBlinkCnt>15)
+ {
+ LinkBlinkCnt=0;
+ pLed->bLedBlinkInProgress = _FALSE;
+ break;
+ }
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 500);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 500);
+ }
+
+ break;
+
+ case LED_BLINK_WPS:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_NETGEAR);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_NETGEAR);
+ }
+
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS success
+ SwLedOff(Adapter, pLed);
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ break;
+
+ default:
+ LinkBlinkCnt=0;
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink13\n"));
+
+}
+
+VOID
+SwLedBlink14(
+ IN PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bStopBlinking = _FALSE;
+ static u8 LinkBlinkCnt=0;
+
+ // Change LED according to BlinkingLedState specified.
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("!!! SwLedBlink14 CurrLedState %d, bLedWPSBlinkInProgress %d, bLedBlinkInProgress %d\n", pLed->CurrLedState,pLed->bLedWPSBlinkInProgress,pLed->bLedBlinkInProgress));
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ SwLedOn(Adapter, pLed);
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if (IS_HARDWARE_TYPE_8812AU(Adapter))
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ else
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if (IS_HARDWARE_TYPE_8812AU(Adapter))
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ else
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ }
+
+ break;
+
+ default:
+ LinkBlinkCnt=0;
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink14\n"));
+}
+
+VOID
+SwLedBlink15(
+ IN PLED_USB pLed
+ )
+{
+ PADAPTER Adapter = pLed->padapter;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bStopBlinking = _FALSE;
+ static u8 LinkBlinkCnt=0;
+ // Change LED according to BlinkingLedState specified.
+
+ if( pLed->BlinkingLedState == RTW_LED_ON )
+ {
+ SwLedOn(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
+ }
+ else
+ {
+ if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
+ SwLedOff(Adapter, pLed);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
+ }
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("!!! SwLedBlink15 CurrLedState %d, bLedWPSBlinkInProgress %d, bLedBlinkInProgress %d\n", pLed->CurrLedState,pLed->bLedWPSBlinkInProgress,pLed->bLedBlinkInProgress));
+ switch(pLed->CurrLedState)
+ {
+ case LED_BLINK_WPS:
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_DLINK);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_DLINK);
+ }
+ break;
+
+ case LED_BLINK_WPS_STOP: //WPS success
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("blink15, LED_BLINK_WPS_STOP BlinkingLedState %d\n",pLed->BlinkingLedState));
+
+ if(pLed->BlinkingLedState == RTW_LED_OFF)
+ {
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ return;
+ }
+
+ pLed->CurrLedState = LED_BLINK_WPS_STOP;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_LINKED_ON_INTERVAL_DLINK);
+ break;
+
+ case LED_BLINK_NO_LINK:
+ {
+ static BOOLEAN bLedOn=_TRUE;
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("blink15, LED_NO_LINK_BLINK bLedOn %d\n",bLedOn));
+ if(bLedOn)
+ {
+ bLedOn=_FALSE;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ }
+ else
+ {
+ bLedOn=_TRUE;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL);
+ }
+ break;
+
+ case LED_BLINK_LINK_IDEL:
+ {
+ static BOOLEAN bLedOn=_TRUE;
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("blink15, LED_BLINK_LINK_IDEL bLedOn %d\n",bLedOn));
+ if(bLedOn)
+ {
+ bLedOn=_FALSE;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ }
+ else
+ {
+ bLedOn=_TRUE;
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_IDEL_INTERVAL);
+ }
+ break;
+
+ case LED_BLINK_SCAN:
+ {
+ static u8 BlinkTime=0;
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("blink15, LED_SCAN_BLINK bLedOn %d\n",BlinkTime));
+ if(BlinkTime %2==0)
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ }
+ BlinkTime ++;
+
+ if(BlinkTime<24)
+ {
+ pLed->bLedBlinkInProgress = _TRUE;
+
+ if(pLed->BlinkingLedState == RTW_LED_ON)
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_OFF_INTERVAL);
+ else
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_ON_INTERVAL);
+ }
+ else
+ {
+ //if(pLed->OLDLedState ==LED_NO_LINK_BLINK)
+ if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
+ {
+ pLed->CurrLedState = LED_BLINK_NO_LINK;
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), 100);
+ }
+ BlinkTime =0;
+ }
+ }
+ break;
+
+ case LED_BLINK_TXRX:
+ pLed->BlinkTimes--;
+ if( pLed->BlinkTimes == 0 )
+ {
+ bStopBlinking = _TRUE;
+ }
+ if(bStopBlinking)
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ SwLedOn(Adapter, pLed);
+ }
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ if( adapter_to_pwrctl(Adapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(Adapter)->rfoff_reason > RF_CHANGE_BY_PS)
+ {
+ SwLedOff(Adapter, pLed);
+ }
+ else
+ {
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ default:
+ LinkBlinkCnt=0;
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink15\n"));
+}
+
+//
+// Description:
+// Handler function of LED Blinking.
+// We dispatch acture LED blink action according to LedStrategy.
+//
+void BlinkHandler(PLED_USB pLed)
+{
+ _adapter *padapter = pLed->padapter;
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+
+ //DBG_871X("%s (%s:%d)\n",__FUNCTION__, current->comm, current->pid);
+
+ if( (padapter->bSurpriseRemoved == _TRUE) || (padapter->hw_init_completed == _FALSE))
+ {
+ //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped);
+ return;
+ }
+
+ switch(ledpriv->LedStrategy)
+ {
+ case SW_LED_MODE0:
+ SwLedBlink(pLed);
+ break;
+
+ case SW_LED_MODE1:
+ SwLedBlink1(pLed);
+ break;
+
+ case SW_LED_MODE2:
+ SwLedBlink2(pLed);
+ break;
+
+ case SW_LED_MODE3:
+ SwLedBlink3(pLed);
+ break;
+
+ case SW_LED_MODE4:
+ SwLedBlink4(pLed);
+ break;
+
+ case SW_LED_MODE5:
+ SwLedBlink5(pLed);
+ break;
+
+ case SW_LED_MODE6:
+ SwLedBlink6(pLed);
+ break;
+
+ case SW_LED_MODE7:
+ SwLedBlink7(pLed);
+ break;
+
+ case SW_LED_MODE8:
+ SwLedBlink8(pLed);
+ break;
+
+ case SW_LED_MODE9:
+ SwLedBlink9(pLed);
+ break;
+
+ case SW_LED_MODE10:
+ SwLedBlink10(pLed);
+ break;
+
+ case SW_LED_MODE11:
+ SwLedBlink11(pLed);
+ break;
+
+ case SW_LED_MODE12:
+ SwLedBlink12(pLed);
+ break;
+
+ case SW_LED_MODE13:
+ SwLedBlink13(pLed);
+ break;
+
+ case SW_LED_MODE14:
+ SwLedBlink14(pLed);
+ break;
+
+ case SW_LED_MODE15:
+ SwLedBlink15(pLed);
+ break;
+
+ default:
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("BlinkWorkItemCallback 0x%x \n", ledpriv->LedStrategy));
+ //SwLedBlink(pLed);
+ break;
+ }
+}
+
+//
+// Description:
+// Callback function of LED BlinkTimer,
+// it just schedules to corresponding BlinkWorkItem/led_blink_hdl
+//
+void BlinkTimerCallback(void *data)
+{
+ PLED_USB pLed = (PLED_USB)data;
+ _adapter *padapter = pLed->padapter;
+
+ //DBG_871X("%s\n", __FUNCTION__);
+
+ if( (padapter->bSurpriseRemoved == _TRUE) || (padapter->hw_init_completed == _FALSE))
+ {
+ //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped);
+ return;
+ }
+
+ #ifdef CONFIG_LED_HANDLED_BY_CMD_THREAD
+ rtw_led_blink_cmd(padapter, (PVOID)pLed);
+ #else
+ _set_workitem(&(pLed->BlinkWorkItem));
+ #endif
+}
+
+//
+// Description:
+// Callback function of LED BlinkWorkItem.
+// We dispatch acture LED blink action according to LedStrategy.
+//
+void BlinkWorkItemCallback(_workitem *work)
+{
+ PLED_USB pLed = container_of(work, LED_USB, BlinkWorkItem);
+ BlinkHandler(pLed);
+}
+
+static void
+SwLedControlMode0(
+ _adapter *padapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ PLED_USB pLed = &(ledpriv->SwLed1);
+
+ // Decide led state
+ switch(LedAction)
+ {
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if( pLed->bLedBlinkInProgress == _FALSE )
+ {
+ pLed->bLedBlinkInProgress = _TRUE;
+
+ pLed->CurrLedState = LED_BLINK_NORMAL;
+ pLed->BlinkTimes = 2;
+
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ break;
+
+ case LED_CTL_START_TO_LINK:
+ if( pLed->bLedBlinkInProgress == _FALSE )
+ {
+ pLed->bLedBlinkInProgress = _TRUE;
+
+ pLed->CurrLedState = LED_BLINK_StartToBlink;
+ pLed->BlinkTimes = 24;
+
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ }
+ else
+ {
+ pLed->CurrLedState = LED_BLINK_StartToBlink;
+ }
+ break;
+
+ case LED_CTL_LINK:
+ pLed->CurrLedState = RTW_LED_ON;
+ if( pLed->bLedBlinkInProgress == _FALSE )
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_NO_LINK:
+ pLed->CurrLedState = RTW_LED_OFF;
+ if( pLed->bLedBlinkInProgress == _FALSE )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ if(pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ SwLedOff(padapter, pLed);
+ break;
+
+ case LED_CTL_START_WPS:
+ if( pLed->bLedBlinkInProgress == _FALSE || pLed->CurrLedState == RTW_LED_ON)
+ {
+ pLed->bLedBlinkInProgress = _TRUE;
+
+ pLed->CurrLedState = LED_BLINK_WPS;
+ pLed->BlinkTimes = 20;
+
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
+ }
+ }
+ break;
+
+ case LED_CTL_STOP_WPS:
+ if(pLed->bLedBlinkInProgress)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
+
+}
+
+ //ALPHA, added by chiyoko, 20090106
+static void
+SwLedControlMode1(
+ _adapter *padapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ PLED_USB pLed = &(ledpriv->SwLed0);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
+
+ u32 uLedBlinkNoLinkInterval = LED_BLINK_NO_LINK_INTERVAL_ALPHA; //add by ylb 20121012 for customer led for alpha
+ if(pEEPROM->CustomerID == RT_CID_819x_ALPHA_Dlink)
+ uLedBlinkNoLinkInterval= LED_BLINK_NO_LINK_INTERVAL_ALPHA_500MS;
+
+ if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
+ pLed = &(ledpriv->SwLed1);
+
+ switch(LedAction)
+ {
+ case LED_CTL_POWER_ON:
+ case LED_CTL_START_TO_LINK:
+ case LED_CTL_NO_LINK:
+ if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+ if( pLed->bLedLinkBlinkInProgress == _TRUE )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
+ }
+ break;
+
+ case LED_CTL_LINK:
+ if( pLed->bLedLinkBlinkInProgress == _FALSE )
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_NORMAL;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_SITE_SURVEY:
+ if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
+ ;
+ else if(pLed->bLedScanBlinkInProgress ==_FALSE)
+ {
+ if(IS_LED_WPS_BLINKING(pLed))
+ return;
+
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedLinkBlinkInProgress == _TRUE )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedScanBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkTimes = 24;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason == RF_CHANGE_BY_IPS)
+ _set_timer(&(pLed->BlinkTimer), LED_INITIAL_INTERVAL);
+ else
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+
+ }
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if(pLed->bLedBlinkInProgress ==_FALSE)
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedLinkBlinkInProgress == _TRUE )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ if(pLed->bLedWPSBlinkInProgress ==_FALSE)
+ {
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedLinkBlinkInProgress == _TRUE )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedScanBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ break;
+
+
+ case LED_CTL_STOP_WPS:
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedLinkBlinkInProgress == _TRUE )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedScanBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ }
+ else
+ {
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ }
+
+ pLed->CurrLedState = LED_BLINK_WPS_STOP;
+ if(pLed->bLedOn)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL:
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedNoLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+
+ SwLedOff(padapter, pLed);
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
+}
+
+ //Arcadyan/Sitecom , added by chiyoko, 20090216
+static void
+SwLedControlMode2(
+ _adapter *padapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ switch(LedAction)
+ {
+ case LED_CTL_SITE_SURVEY:
+ if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
+ ;
+ else if(pLed->bLedScanBlinkInProgress ==_FALSE)
+ {
+ if(IS_LED_WPS_BLINKING(pLed))
+ return;
+
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedScanBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkTimes = 24;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_LINK:
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ if(pLed->bLedWPSBlinkInProgress ==_FALSE)
+ {
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedScanBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_STOP_WPS:
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on)
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ else
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ }
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL:
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+ break;
+
+ case LED_CTL_START_TO_LINK:
+ case LED_CTL_NO_LINK:
+ if(!IS_LED_BLINKING(pLed))
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ SwLedOff(padapter, pLed);
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+}
+
+ //COREGA, added by chiyoko, 20090316
+ static void
+ SwLedControlMode3(
+ _adapter *padapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ switch(LedAction)
+ {
+ case LED_CTL_SITE_SURVEY:
+ if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
+ ;
+ else if(pLed->bLedScanBlinkInProgress ==_FALSE)
+ {
+ if(IS_LED_WPS_BLINKING(pLed))
+ return;
+
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedScanBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkTimes = 24;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_LINK:
+ if(IS_LED_WPS_BLINKING(pLed))
+ return;
+
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ if(pLed->bLedWPSBlinkInProgress ==_FALSE)
+ {
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedScanBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_STOP_WPS:
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ }
+
+ pLed->CurrLedState = LED_BLINK_WPS_STOP;
+ if(pLed->bLedOn)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL:
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_START_TO_LINK:
+ case LED_CTL_NO_LINK:
+ if(!IS_LED_BLINKING(pLed))
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ SwLedOff(padapter, pLed);
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
+}
+
+
+ //Edimax-Belkin, added by chiyoko, 20090413
+static void
+SwLedControlMode4(
+ _adapter *padapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+ PLED_USB pLed1 = &(ledpriv->SwLed1);
+
+ switch(LedAction)
+ {
+ case LED_CTL_START_TO_LINK:
+ if(pLed1->bLedWPSBlinkInProgress)
+ {
+ pLed1->bLedWPSBlinkInProgress = _FALSE;
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ pLed1->CurrLedState = RTW_LED_OFF;
+
+ if(pLed1->bLedOn)
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+
+ if( pLed->bLedStartToLinkBlinkInProgress == _FALSE )
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedNoLinkBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedStartToLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_StartToBlink;
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ }
+ break;
+
+ case LED_CTL_LINK:
+ case LED_CTL_NO_LINK:
+ //LED1 settings
+ if(LedAction == LED_CTL_LINK)
+ {
+ if(pLed1->bLedWPSBlinkInProgress)
+ {
+ pLed1->bLedWPSBlinkInProgress = _FALSE;
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ pLed1->CurrLedState = RTW_LED_OFF;
+
+ if(pLed1->bLedOn)
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ }
+
+ if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ if(IS_HARDWARE_TYPE_8192DU(padapter))
+ {
+ if(LedAction == LED_CTL_LINK)
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ }
+ else
+ {
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ }
+ }
+ else
+ {
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_SITE_SURVEY:
+ if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
+ ;
+ else if(pLed->bLedScanBlinkInProgress ==_FALSE)
+ {
+ if(IS_LED_WPS_BLINKING(pLed))
+ return;
+
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedScanBlinkInProgress = _TRUE;
+ if(IS_HARDWARE_TYPE_8192D(padapter))
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ else
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkTimes = 24;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if(pLed->bLedBlinkInProgress ==_FALSE)
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ if(pLed1->bLedWPSBlinkInProgress)
+ {
+ pLed1->bLedWPSBlinkInProgress = _FALSE;
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ pLed1->CurrLedState = RTW_LED_OFF;
+
+ if(pLed1->bLedOn)
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+
+ if(pLed->bLedWPSBlinkInProgress ==_FALSE)
+ {
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedScanBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ }
+ }
+ break;
+
+ case LED_CTL_STOP_WPS: //WPS connect success
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+
+ //LED1 settings
+ if(pLed1->bLedWPSBlinkInProgress)
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ else
+ pLed1->bLedWPSBlinkInProgress = _TRUE;
+
+ pLed1->CurrLedState = LED_BLINK_WPS_STOP;
+ if( pLed1->bLedOn )
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed1->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+
+ //LED1 settings
+ if(pLed1->bLedWPSBlinkInProgress)
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ else
+ pLed1->bLedWPSBlinkInProgress = _TRUE;
+
+ pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP;
+ pLed1->BlinkTimes = 10;
+ if( pLed1->bLedOn )
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed1->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ if( pLed->bLedNoLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedStartToLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedStartToLinkBlinkInProgress = _FALSE;
+ }
+
+ if( pLed1->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ pLed1->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed1->BlinkingLedState = LED_UNKNOWN;
+ SwLedOff(padapter, pLed);
+ SwLedOff(padapter, pLed1);
+ break;
+
+ case LED_CTL_CONNECTION_NO_TRANSFER:
+ if(pLed->bLedBlinkInProgress == _FALSE)
+ {
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
+}
+
+
+
+ //Sercomm-Belkin, added by chiyoko, 20090415
+static void
+SwLedControlMode5(
+ _adapter *padapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
+ pLed = &(ledpriv->SwLed1);
+
+ switch(LedAction)
+ {
+ case LED_CTL_POWER_ON:
+ case LED_CTL_NO_LINK:
+ case LED_CTL_LINK: //solid blue
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_SITE_SURVEY:
+ if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
+ ;
+ else if(pLed->bLedScanBlinkInProgress ==_FALSE)
+ {
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedScanBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkTimes = 24;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if(pLed->bLedBlinkInProgress ==_FALSE)
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN)
+ {
+ return;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+
+ SwLedOff(padapter, pLed);
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
+}
+
+ //WNC-Corega, added by chiyoko, 20090902
+static void
+SwLedControlMode6(
+ _adapter *padapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ PLED_USB pLed0 = &(ledpriv->SwLed0);
+
+ switch(LedAction)
+ {
+ case LED_CTL_POWER_ON:
+ case LED_CTL_LINK:
+ case LED_CTL_NO_LINK:
+ _cancel_timer_ex(&(pLed0->BlinkTimer));
+ pLed0->CurrLedState = RTW_LED_ON;
+ pLed0->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed0->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_POWER_OFF:
+ SwLedOff(padapter, pLed0);
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("ledcontrol 6 Led %d\n", pLed0->CurrLedState));
+}
+
+//Netgear, added by sinda, 2011/11/11
+ void
+ SwLedControlMode7(
+ PADAPTER Adapter,
+ LED_CTL_MODE LedAction
+ )
+{
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ switch(LedAction)
+ {
+ case LED_CTL_SITE_SURVEY:
+ if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
+ ;
+ else if(pLed->bLedScanBlinkInProgress == _FALSE)
+ {
+ if(IS_LED_WPS_BLINKING(pLed))
+ return;
+
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedScanBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkTimes = 6;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+ break;
+
+ case LED_CTL_LINK:
+ if(IS_LED_WPS_BLINKING(pLed))
+ return;
+
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ if(pLed->bLedWPSBlinkInProgress ==_FALSE)
+ {
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedScanBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+ break;
+
+ case LED_CTL_STOP_WPS:
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ }
+
+ pLed->CurrLedState = LED_BLINK_WPS_STOP;
+ if(pLed->bLedOn)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+
+ break;
+
+
+ case LED_CTL_STOP_WPS_FAIL:
+ case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_START_TO_LINK:
+ case LED_CTL_NO_LINK:
+ if(!IS_LED_BLINKING(pLed))
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_POWER_OFF:
+ case LED_CTL_POWER_ON:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("LEd control mode 7 CurrLedState %d\n", pLed->CurrLedState));
+}
+
+void
+SwLedControlMode8(
+ PADAPTER Adapter,
+ LED_CTL_MODE LedAction
+ )
+{
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ PLED_USB pLed0 = &(ledpriv->SwLed0);
+
+ switch(LedAction)
+ {
+ case LED_CTL_LINK:
+ _cancel_timer_ex(&(pLed0->BlinkTimer));
+ pLed0->CurrLedState = RTW_LED_ON;
+ pLed0->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed0->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_NO_LINK:
+ _cancel_timer_ex(&(pLed0->BlinkTimer));
+ pLed0->CurrLedState = RTW_LED_OFF;
+ pLed0->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed0->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_POWER_OFF:
+ SwLedOff(Adapter, pLed0);
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 8 %d\n", pLed0->CurrLedState));
+
+}
+
+//page added for Belkin AC950, 20120813
+void
+SwLedControlMode9(
+ IN PADAPTER Adapter,
+ IN LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+ PLED_USB pLed1 = &(ledpriv->SwLed1);
+ PLED_USB pLed2 = &(ledpriv->SwLed2);
+ BOOLEAN bWPSOverLap = _FALSE;
+
+ switch(LedAction)
+ {
+ case LED_CTL_START_TO_LINK:
+ if(pLed2->bLedBlinkInProgress == _FALSE)
+ {
+ pLed2->bLedBlinkInProgress = _TRUE;
+ pLed2->BlinkingLedState = RTW_LED_ON;
+ pLed2->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
+
+ _set_timer(&(pLed2->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_LINK:
+ case LED_CTL_NO_LINK:
+ //LED1 settings
+ if(LedAction == LED_CTL_NO_LINK)
+ {
+ //if(pMgntInfo->AuthStatus == AUTH_STATUS_FAILED)
+ if(0)
+ {
+ pLed1->CurrLedState = LED_BLINK_AUTH_ERROR;
+ if( pLed1->bLedOn )
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed1->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed1->BlinkTimer), 0);
+ }
+ else
+ {
+ pLed1->CurrLedState = RTW_LED_OFF;
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ if( pLed1->bLedOn )
+ _set_timer(&(pLed1->BlinkTimer), 0);
+ }
+ }
+ else
+ {
+ pLed1->CurrLedState = RTW_LED_OFF;
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ if( pLed1->bLedOn )
+ _set_timer(&(pLed1->BlinkTimer), 0);
+ }
+
+ //LED2 settings
+ if(LedAction == LED_CTL_LINK)
+ {
+ if(Adapter->securitypriv.dot11PrivacyAlgrthm != _NO_PRIVACY_)
+ {
+ if(pLed2->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed2->BlinkTimer));
+ pLed2->bLedBlinkInProgress = _FALSE;
+ }
+ pLed2->CurrLedState = RTW_LED_ON;
+ pLed2->bLedNoLinkBlinkInProgress = _TRUE;
+ if(!pLed2->bLedOn)
+ _set_timer(&(pLed2->BlinkTimer), 0);
+ }
+ else
+ {
+ if(pLed2->bLedWPSBlinkInProgress != _TRUE)
+ {
+ pLed2->CurrLedState = RTW_LED_OFF;
+ pLed2->BlinkingLedState = RTW_LED_OFF;
+ if(pLed2->bLedOn)
+ _set_timer(&(pLed2->BlinkTimer), 0);
+ }
+ }
+ }
+ else //NO_LINK
+ {
+ if(pLed2->bLedWPSBlinkInProgress == _FALSE)
+ {
+ pLed2->CurrLedState = RTW_LED_OFF;
+ pLed2->BlinkingLedState = RTW_LED_OFF;
+ if(pLed2->bLedOn)
+ _set_timer(&(pLed2->BlinkTimer), 0);
+ }
+ }
+
+ //LED0 settings
+ if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
+ {
+ if(LedAction == LED_CTL_LINK)
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ }
+ else
+ {
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ }
+ else
+ {
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ }
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+
+ break;
+
+ case LED_CTL_SITE_SURVEY:
+ if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
+ ;
+ else //if(pLed->bLedScanBlinkInProgress ==FALSE)
+ {
+ if(IS_LED_WPS_BLINKING(pLed))
+ return;
+
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedScanBlinkInProgress = _TRUE;
+ if(IS_HARDWARE_TYPE_8192D(Adapter))
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ else
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkTimes = 24;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+
+ }
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if(pLed->bLedBlinkInProgress == _FALSE)
+ {
+ if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+ {
+ return;
+ }
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ pLed2->bLedBlinkInProgress = _TRUE;
+ pLed2->BlinkingLedState = RTW_LED_ON;
+ pLed2->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
+ pLed2->bLedWPSBlinkInProgress = _TRUE;
+
+ _set_timer(&(pLed2->BlinkTimer), 0);
+
+ break;
+
+ case LED_CTL_STOP_WPS: //WPS connect success
+ //LED2 settings
+ if(pLed2->bLedWPSBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed2->BlinkTimer));
+ pLed2->bLedBlinkInProgress = _FALSE;
+ pLed2->bLedWPSBlinkInProgress = _FALSE;
+ }
+ pLed2->CurrLedState = RTW_LED_ON;
+ pLed2->bLedNoLinkBlinkInProgress = _TRUE;
+ if(!pLed2->bLedOn)
+ _set_timer(&(pLed2->BlinkTimer), 0);
+
+ //LED1 settings
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ pLed1->CurrLedState = RTW_LED_OFF;
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ if( pLed1->bLedOn )
+ _set_timer(&(pLed1->BlinkTimer), 0);
+
+
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
+ //LED1 settings
+ //if(bWPSOverLap == _FALSE)
+ {
+ pLed1->CurrLedState = LED_BLINK_AUTH_ERROR;
+ pLed1->BlinkTimes = 50;
+ if( pLed1->bLedOn )
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed1->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed1->BlinkTimer), 0);
+ }
+ //else
+ //{
+ // bWPSOverLap = _FALSE;
+ // pLed1->CurrLedState = RTW_LED_OFF;
+ // pLed1->BlinkingLedState = RTW_LED_OFF;
+ // _set_timer(&(pLed1->BlinkTimer), 0);
+ //}
+
+ //LED2 settings
+ pLed2->CurrLedState = RTW_LED_OFF;
+ pLed2->BlinkingLedState = RTW_LED_OFF;
+ pLed2->bLedWPSBlinkInProgress = _FALSE;
+ if( pLed2->bLedOn )
+ _set_timer(&(pLed2->BlinkTimer), 0);
+
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
+ //LED1 settings
+ bWPSOverLap = _TRUE;
+ pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP;
+ pLed1->BlinkTimes = 10;
+ pLed1->BlinkCounter = 50;
+ if( pLed1->bLedOn )
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed1->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed1->BlinkTimer), 0);
+
+ //LED2 settings
+ pLed2->CurrLedState = RTW_LED_OFF;
+ pLed2->BlinkingLedState = RTW_LED_OFF;
+ pLed2->bLedWPSBlinkInProgress = _FALSE;
+ if( pLed2->bLedOn )
+ _set_timer(&(pLed2->BlinkTimer), 0);
+
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ if( pLed->bLedNoLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedStartToLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedStartToLinkBlinkInProgress = _FALSE;
+ }
+
+ if( pLed1->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ pLed1->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+
+ pLed1->BlinkingLedState = LED_UNKNOWN;
+ SwLedOff(Adapter, pLed);
+ SwLedOff(Adapter, pLed1);
+ break;
+
+ case LED_CTL_CONNECTION_NO_TRANSFER:
+ if(pLed->bLedBlinkInProgress == _FALSE)
+ {
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+
+ pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 9 Led %d\n", pLed->CurrLedState));
+}
+
+//page added for Netgear A6200V2, 20120827
+void
+SwLedControlMode10(
+ PADAPTER Adapter,
+ LED_CTL_MODE LedAction
+)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+ PLED_USB pLed1 = &(ledpriv->SwLed1);
+
+ switch(LedAction)
+ {
+ case LED_CTL_START_TO_LINK:
+ if(pLed1->bLedBlinkInProgress == _FALSE)
+ {
+ pLed1->bLedBlinkInProgress = _TRUE;
+ pLed1->BlinkingLedState = RTW_LED_ON;
+ pLed1->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
+
+ _set_timer(&(pLed1->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_LINK:
+ case LED_CTL_NO_LINK:
+ if(LedAction == LED_CTL_LINK)
+ {
+ if(pLed->bLedWPSBlinkInProgress == _TRUE || pLed1->bLedWPSBlinkInProgress == _TRUE)
+ ;
+ else
+ {
+ if(pHalData->CurrentBandType == BAND_ON_2_4G)
+ //LED0 settings
+ {
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ _set_timer(&(pLed->BlinkTimer), 0);
+
+ pLed1->CurrLedState = RTW_LED_OFF;
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed1->BlinkTimer), 0);
+ }
+ else if(pHalData->CurrentBandType == BAND_ON_5G)
+ //LED1 settings
+ {
+ pLed1->CurrLedState = RTW_LED_ON;
+ pLed1->BlinkingLedState = RTW_LED_ON;
+ if(pLed1->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ pLed1->bLedBlinkInProgress = _FALSE;
+ }
+ _set_timer(&(pLed1->BlinkTimer), 0);
+
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ }
+ }
+ else if(LedAction == LED_CTL_NO_LINK) //TODO by page
+ {
+ if(pLed->bLedWPSBlinkInProgress == _TRUE || pLed1->bLedWPSBlinkInProgress == _TRUE)
+ ;
+ else
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedOn )
+ _set_timer(&(pLed->BlinkTimer), 0);
+
+ pLed1->CurrLedState = RTW_LED_OFF;
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ if( pLed1->bLedOn )
+ _set_timer(&(pLed1->BlinkTimer), 0);
+ }
+ }
+
+ break;
+
+ case LED_CTL_SITE_SURVEY:
+ if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ ; //don't blink when media connect
+ else //if(pLed->bLedScanBlinkInProgress ==FALSE)
+ {
+ if(IS_LED_WPS_BLINKING(pLed) || IS_LED_WPS_BLINKING(pLed1))
+ return;
+
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedScanBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkTimes = 12;
+ pLed->BlinkingLedState = LED_BLINK_SCAN;
+ _set_timer(&(pLed->BlinkTimer), 0);
+
+ if(pLed1->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ pLed1->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if(pLed1->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ pLed1->bLedBlinkInProgress = _FALSE;
+ }
+ pLed1->bLedScanBlinkInProgress = _TRUE;
+ pLed1->CurrLedState = LED_BLINK_SCAN;
+ pLed1->BlinkTimes = 12;
+ pLed1->BlinkingLedState = LED_BLINK_SCAN;
+ _set_timer(&(pLed1->BlinkTimer), LED_BLINK_LINK_SLOWLY_INTERVAL_NETGEAR);
+
+ }
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ //LED0 settings
+ if(pLed->bLedBlinkInProgress == _FALSE)
+ {
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->BlinkingLedState = LED_BLINK_WPS;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+
+ //LED1 settings
+ if(pLed1->bLedBlinkInProgress == _FALSE)
+ {
+ pLed1->bLedBlinkInProgress = _TRUE;
+ pLed1->bLedWPSBlinkInProgress = _TRUE;
+ pLed1->BlinkingLedState = LED_BLINK_WPS;
+ pLed1->CurrLedState = LED_BLINK_WPS;
+ _set_timer(&(pLed1->BlinkTimer), LED_BLINK_NORMAL_INTERVAL+LED_BLINK_LINK_INTERVAL_NETGEAR);
+ }
+
+
+ break;
+
+ case LED_CTL_STOP_WPS: //WPS connect success
+ if(pHalData->CurrentBandType == BAND_ON_2_4G)
+ //LED0 settings
+ {
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ _set_timer(&(pLed->BlinkTimer), 0);
+
+ pLed1->CurrLedState = RTW_LED_OFF;
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed1->BlinkTimer), 0);
+ }
+ else if(pHalData->CurrentBandType == BAND_ON_5G)
+ //LED1 settings
+ {
+ pLed1->bLedWPSBlinkInProgress = _FALSE;
+ pLed1->CurrLedState = RTW_LED_ON;
+ pLed1->BlinkingLedState = RTW_LED_ON;
+ if(pLed1->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed1->BlinkTimer));
+ pLed1->bLedBlinkInProgress = _FALSE;
+ }
+ _set_timer(&(pLed1->BlinkTimer), 0);
+
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
+ //LED1 settings
+ pLed1->bLedWPSBlinkInProgress = _FALSE;
+ pLed1->CurrLedState = RTW_LED_OFF;
+ pLed1->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed1->BlinkTimer), 0);
+
+ //LED0 settings
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedOn )
+ _set_timer(&(pLed->BlinkTimer), 0);
+
+ break;
+
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 10 Led %d\n", pLed->CurrLedState));
+}
+
+ //Edimax-ASUS, added by Page, 20121221
+void
+SwLedControlMode11(
+ PADAPTER Adapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ switch(LedAction)
+ {
+ case LED_CTL_POWER_ON:
+ case LED_CTL_START_TO_LINK:
+ case LED_CTL_NO_LINK:
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_LINK:
+ if( pLed->bLedBlinkInProgress == _TRUE )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->BlinkTimes = 5;
+ _set_timer(&(pLed->BlinkTimer), 0);
+
+ break;
+
+
+ case LED_CTL_STOP_WPS:
+ case LED_CTL_STOP_WPS_FAIL:
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->CurrLedState = LED_BLINK_WPS_STOP;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ if( pLed->bLedNoLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedLinkBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+
+ SwLedOff(Adapter, pLed);
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led mode 1 CurrLedState %d\n", pLed->CurrLedState));
+}
+
+// page added for NEC
+
+VOID
+SwLedControlMode12(
+ PADAPTER Adapter,
+ LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ switch(LedAction)
+ {
+ case LED_CTL_POWER_ON:
+ case LED_CTL_NO_LINK:
+ case LED_CTL_LINK:
+ case LED_CTL_SITE_SURVEY:
+
+ if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
+ {
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedNoLinkBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_SLOWLY;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if(pLed->bLedBlinkInProgress == _FALSE)
+ {
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ break;
+
+ case LED_CTL_POWER_OFF:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+
+ if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ }
+
+ SwLedOff(Adapter, pLed);
+ break;
+
+ default:
+ break;
+
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SWLed12 %d\n", pLed->CurrLedState));
+}
+
+// Maddest add for NETGEAR R6100
+
+VOID
+SwLedControlMode13(
+ IN PADAPTER Adapter,
+ IN LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 13 CurrLedState %d, LedAction %d\n", pLed->CurrLedState,LedAction));
+ switch(LedAction)
+ {
+ case LED_CTL_LINK:
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ return;
+ }
+
+
+ pLed->CurrLedState = RTW_LED_ON;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ if(pLed->bLedWPSBlinkInProgress == _FALSE)
+ {
+ if(pLed->bLedBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedScanBlinkInProgress == _TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_NETGEAR);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_NETGEAR);
+ }
+ }
+ break;
+
+ case LED_CTL_STOP_WPS:
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+ else
+ {
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ }
+
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ pLed->CurrLedState = LED_BLINK_WPS_STOP;
+ if(pLed->bLedOn)
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+
+ break;
+
+
+ case LED_CTL_STOP_WPS_FAIL:
+ case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_START_TO_LINK:
+ if((pLed->bLedBlinkInProgress == _FALSE) && (pLed->bLedWPSBlinkInProgress == _FALSE))
+ {
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ pLed->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_NO_LINK:
+
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ return;
+ }
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ //if(!IS_LED_BLINKING(pLed))
+ {
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+ break;
+
+ case LED_CTL_POWER_OFF:
+ case LED_CTL_POWER_ON:
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedWPSBlinkInProgress )
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ if (LedAction == LED_CTL_POWER_ON)
+ _set_timer(&(pLed->BlinkTimer), 0);
+ else
+ SwLedOff(Adapter, pLed);
+ break;
+
+ default:
+ break;
+
+ }
+
+
+}
+
+// Maddest add for DNI Buffalo
+
+VOID
+SwLedControlMode14(
+ IN PADAPTER Adapter,
+ IN LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 14 CurrLedState %d, LedAction %d\n", pLed->CurrLedState,LedAction));
+ switch(LedAction)
+ {
+ case LED_CTL_POWER_OFF:
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 14 LED_CTL_POWER_OFF\n"));
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ SwLedOff(Adapter, pLed);
+ break;
+
+ case LED_CTL_POWER_ON:
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 14 LED_CTL_POWER_ON\n"));
+ SwLedOn(Adapter, pLed);
+ break;
+
+ case LED_CTL_LINK:
+ case LED_CTL_NO_LINK:
+ if (IS_HARDWARE_TYPE_8812AU(Adapter))
+ SwLedOn(Adapter, pLed);
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if(pLed->bLedBlinkInProgress ==_FALSE)
+ {
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ if (IS_HARDWARE_TYPE_8812AU(Adapter))
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
+ else
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ if (IS_HARDWARE_TYPE_8812AU(Adapter))
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
+ else
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+// Maddest add for Dlink
+
+VOID
+SwLedControlMode15(
+ IN PADAPTER Adapter,
+ IN LED_CTL_MODE LedAction
+)
+{
+ struct led_priv *ledpriv = &(Adapter->ledpriv);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ PLED_USB pLed = &(ledpriv->SwLed0);
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 CurrLedState %d, LedAction %d\n", pLed->CurrLedState,LedAction));
+ switch(LedAction)
+ {
+ case LED_CTL_START_WPS: //wait until xinpin finish
+ case LED_CTL_START_WPS_BOTTON:
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_START_WPS\n"));
+ if(pLed->bLedWPSBlinkInProgress ==_FALSE)
+ {
+ if(pLed->bLedBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if(pLed->bLedScanBlinkInProgress ==_TRUE)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ pLed->bLedWPSBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ if( pLed->bLedOn )
+ {
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_NETGEAR);
+ }
+ else
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_NETGEAR);
+ }
+ }
+ break;
+
+ case LED_CTL_STOP_WPS:
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_STOP_WPS\n"));
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ }
+
+ pLed->CurrLedState = LED_BLINK_WPS_STOP;
+ //if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ {
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), 0);
+ }
+
+ break;
+
+ case LED_CTL_STOP_WPS_FAIL:
+ case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_STOP_WPS_FAIL\n"));
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+ }
+
+ pLed->CurrLedState = RTW_LED_OFF;
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_NO_LINK:
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_NO_LINK\n"));
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ return;
+ }
+
+ /*if(Adapter->securitypriv.dot11PrivacyAlgrthm > _NO_PRIVACY_)
+ {
+ if(SecIsTxKeyInstalled(Adapter, pMgntInfo->Bssid))
+ {
+ }
+ else
+ {
+ if(pMgntInfo->LEDAssocState ==LED_ASSOC_SECURITY_BEGIN)
+ return;
+ }
+ }*/
+
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ if( pLed->bLedScanBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedScanBlinkInProgress = _FALSE;
+ }
+ //if(!IS_LED_BLINKING(pLed))
+ {
+ pLed->CurrLedState = LED_BLINK_NO_LINK;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 30);
+ }
+ break;
+
+ case LED_CTL_LINK:
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 15 LED_CTL_LINK\n"));
+
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ return;
+ }
+
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+
+ pLed->CurrLedState = LED_BLINK_LINK_IDEL;
+ pLed->BlinkingLedState = RTW_LED_ON;
+
+ _set_timer(&(pLed->BlinkTimer), 30);
+ break;
+
+ case LED_CTL_SITE_SURVEY :
+ if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
+ return;
+
+ if(pLed->bLedWPSBlinkInProgress ==_TRUE)
+ return;
+
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+ pLed->CurrLedState = LED_BLINK_SCAN;
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), 0);
+ break;
+
+ case LED_CTL_TX:
+ case LED_CTL_RX:
+ if(pLed->bLedWPSBlinkInProgress)
+ {
+ return;
+ }
+
+ if( pLed->bLedBlinkInProgress)
+ {
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ pLed->bLedBlinkInProgress = _FALSE;
+ }
+
+ pLed->bLedBlinkInProgress = _TRUE;
+ pLed->CurrLedState = LED_BLINK_TXRX;
+ pLed->BlinkTimes = 2;
+ if( pLed->bLedOn )
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void
+LedControlUSB(
+ _adapter *padapter,
+ LED_CTL_MODE LedAction
+ )
+{
+ struct led_priv *ledpriv = &(padapter->ledpriv);
+
+#if(MP_DRIVER == 1)
+ if (padapter->registrypriv.mp_mode == 1)
+ return;
+#endif
+
+ if( (padapter->bSurpriseRemoved == _TRUE) ||(padapter->hw_init_completed == _FALSE) )
+ {
+ return;
+ }
+
+ if( ledpriv->bRegUseLed == _FALSE)
+ return;
+
+ //if(priv->bInHctTest)
+ // return;
+
+#ifdef CONFIG_CONCURRENT_MODE
+ // Only do led action for PRIMARY_ADAPTER
+ if (padapter->adapter_type != PRIMARY_ADAPTER)
+ return;
+#endif
+
+ if( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on &&
+ adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) &&
+ (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX ||
+ LedAction == LED_CTL_SITE_SURVEY ||
+ LedAction == LED_CTL_LINK ||
+ LedAction == LED_CTL_NO_LINK ||
+ LedAction == LED_CTL_POWER_ON) )
+ {
+ return;
+ }
+
+ switch(ledpriv->LedStrategy)
+ {
+ case SW_LED_MODE0:
+ SwLedControlMode0(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE1:
+ SwLedControlMode1(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE2:
+ SwLedControlMode2(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE3:
+ SwLedControlMode3(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE4:
+ SwLedControlMode4(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE5:
+ SwLedControlMode5(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE6:
+ SwLedControlMode6(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE7:
+ SwLedControlMode7(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE8:
+ SwLedControlMode8(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE9:
+ SwLedControlMode9(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE10:
+ SwLedControlMode10(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE11:
+ SwLedControlMode11(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE12:
+ SwLedControlMode12(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE13:
+ SwLedControlMode13(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE14:
+ SwLedControlMode14(padapter, LedAction);
+ break;
+
+ case SW_LED_MODE15:
+ SwLedControlMode15(padapter, LedAction);
+ break;
+
+ default:
+ break;
+ }
+
+ RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("LedStrategy:%d, LedAction %d\n", ledpriv->LedStrategy,LedAction));
+}
+
+//
+// Description:
+// Reset status of LED_871x object.
+//
+void ResetLedStatus(PLED_USB pLed) {
+
+ pLed->CurrLedState = RTW_LED_OFF; // Current LED state.
+ pLed->bLedOn = _FALSE; // true if LED is ON, false if LED is OFF.
+
+ pLed->bLedBlinkInProgress = _FALSE; // true if it is blinking, false o.w..
+ pLed->bLedWPSBlinkInProgress = _FALSE;
+
+ pLed->BlinkTimes = 0; // Number of times to toggle led state for blinking.
+ pLed->BlinkCounter = 0;
+ pLed->BlinkingLedState = LED_UNKNOWN; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are.
+
+ pLed->bLedNoLinkBlinkInProgress = _FALSE;
+ pLed->bLedLinkBlinkInProgress = _FALSE;
+ pLed->bLedStartToLinkBlinkInProgress = _FALSE;
+ pLed->bLedScanBlinkInProgress = _FALSE;
+}
+
+ //
+// Description:
+// Initialize an LED_871x object.
+//
+void
+InitLed(
+ _adapter *padapter,
+ PLED_USB pLed,
+ LED_PIN LedPin
+ )
+{
+ pLed->padapter = padapter;
+ pLed->LedPin = LedPin;
+
+ ResetLedStatus(pLed);
+
+ _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed);
+
+ _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed);
+}
+
+
+//
+// Description:
+// DeInitialize an LED_871x object.
+//
+void
+DeInitLed(
+ PLED_USB pLed
+ )
+{
+ _cancel_workitem_sync(&(pLed->BlinkWorkItem));
+ _cancel_timer_ex(&(pLed->BlinkTimer));
+ ResetLedStatus(pLed);
+}
+
+
diff --git a/rtl8xxx_EU/hal/rtl8188e/Hal8188EPwrSeq.c b/rtl8xxx_EU/hal/rtl8188e/Hal8188EPwrSeq.c
index c38c25a..8eb4389 100755
--- a/rtl8xxx_EU/hal/rtl8188e/Hal8188EPwrSeq.c
+++ b/rtl8xxx_EU/hal/rtl8188e/Hal8188EPwrSeq.c
@@ -1,97 +1,97 @@
-/******************************************************************************
- *
- * 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 "Hal8188EPwrSeq.h"
-#include <rtl8188e_hal.h>
-
-/*
- drivers should parse below arrays and do the corresponding actions
-*/
-//3 Power on Array
-WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- RTL8188E_TRANS_CARDEMU_TO_ACT
- RTL8188E_TRANS_END
-};
-
-//3Radio off Array
-WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- RTL8188E_TRANS_ACT_TO_CARDEMU
- RTL8188E_TRANS_END
-};
-
-//3Card Disable Array
-WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- RTL8188E_TRANS_ACT_TO_CARDEMU
- RTL8188E_TRANS_CARDEMU_TO_CARDDIS
- RTL8188E_TRANS_END
-};
-
-//3 Card Enable Array
-WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- RTL8188E_TRANS_CARDDIS_TO_CARDEMU
- RTL8188E_TRANS_CARDEMU_TO_ACT
- RTL8188E_TRANS_END
-};
-
-//3Suspend Array
-WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- RTL8188E_TRANS_ACT_TO_CARDEMU
- RTL8188E_TRANS_CARDEMU_TO_SUS
- RTL8188E_TRANS_END
-};
-
-//3 Resume Array
-WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- RTL8188E_TRANS_SUS_TO_CARDEMU
- RTL8188E_TRANS_CARDEMU_TO_ACT
- RTL8188E_TRANS_END
-};
-
-
-//3HWPDN Array
-WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- RTL8188E_TRANS_ACT_TO_CARDEMU
- RTL8188E_TRANS_CARDEMU_TO_PDN
- RTL8188E_TRANS_END
-};
-
-//3 Enter LPS
-WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- //FW behavior
- RTL8188E_TRANS_ACT_TO_LPS
- RTL8188E_TRANS_END
-};
-
-//3 Leave LPS
-WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]=
-{
- //FW behavior
- RTL8188E_TRANS_LPS_TO_ACT
- RTL8188E_TRANS_END
-};
-
+/******************************************************************************
+ *
+ * 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 "Hal8188EPwrSeq.h"
+#include <rtl8188e_hal.h>
+
+/*
+ drivers should parse below arrays and do the corresponding actions
+*/
+//3 Power on Array
+WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ RTL8188E_TRANS_CARDEMU_TO_ACT
+ RTL8188E_TRANS_END
+};
+
+//3Radio off Array
+WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ RTL8188E_TRANS_ACT_TO_CARDEMU
+ RTL8188E_TRANS_END
+};
+
+//3Card Disable Array
+WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ RTL8188E_TRANS_ACT_TO_CARDEMU
+ RTL8188E_TRANS_CARDEMU_TO_CARDDIS
+ RTL8188E_TRANS_END
+};
+
+//3 Card Enable Array
+WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ RTL8188E_TRANS_CARDDIS_TO_CARDEMU
+ RTL8188E_TRANS_CARDEMU_TO_ACT
+ RTL8188E_TRANS_END
+};
+
+//3Suspend Array
+WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ RTL8188E_TRANS_ACT_TO_CARDEMU
+ RTL8188E_TRANS_CARDEMU_TO_SUS
+ RTL8188E_TRANS_END
+};
+
+//3 Resume Array
+WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ RTL8188E_TRANS_SUS_TO_CARDEMU
+ RTL8188E_TRANS_CARDEMU_TO_ACT
+ RTL8188E_TRANS_END
+};
+
+
+//3HWPDN Array
+WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ RTL8188E_TRANS_ACT_TO_CARDEMU
+ RTL8188E_TRANS_CARDEMU_TO_PDN
+ RTL8188E_TRANS_END
+};
+
+//3 Enter LPS
+WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ //FW behavior
+ RTL8188E_TRANS_ACT_TO_LPS
+ RTL8188E_TRANS_END
+};
+
+//3 Leave LPS
+WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]=
+{
+ //FW behavior
+ RTL8188E_TRANS_LPS_TO_ACT
+ RTL8188E_TRANS_END
+};
+
diff --git a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_cmd.c b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_cmd.c
index cc763cf..ee6e4b3 100644..100755
--- a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_cmd.c
+++ b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_cmd.c
@@ -1,1481 +1,1481 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#define _RTL8188E_CMD_C_
-
-#include <drv_types.h>
-#include <rtl8188e_hal.h>
-#include "hal_com_h2c.h"
-
-#define CONFIG_H2C_EF
-
-#define RTL88E_MAX_H2C_BOX_NUMS 4
-#define RTL88E_MAX_CMD_LEN 7
-#define RTL88E_MESSAGE_BOX_SIZE 4
-#define RTL88E_EX_MESSAGE_BOX_SIZE 4
-
-static u8 _is_fw_read_cmd_down(_adapter* padapter, u8 msgbox_num)
-{
- u8 read_down = _FALSE;
- int retry_cnts = 100;
-
- u8 valid;
-
- //DBG_8192C(" _is_fw_read_cmd_down ,reg_1cc(%x),msg_box(%d)...\n",rtw_read8(padapter,REG_HMETFR),msgbox_num);
-
- do{
- valid = rtw_read8(padapter,REG_HMETFR) & BIT(msgbox_num);
- if(0 == valid ){
- read_down = _TRUE;
- }
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTL8188E_CMD_C_
+
+#include <drv_types.h>
+#include <rtl8188e_hal.h>
+#include "hal_com_h2c.h"
+
+#define CONFIG_H2C_EF
+
+#define RTL88E_MAX_H2C_BOX_NUMS 4
+#define RTL88E_MAX_CMD_LEN 7
+#define RTL88E_MESSAGE_BOX_SIZE 4
+#define RTL88E_EX_MESSAGE_BOX_SIZE 4
+
+static u8 _is_fw_read_cmd_down(_adapter* padapter, u8 msgbox_num)
+{
+ u8 read_down = _FALSE;
+ int retry_cnts = 100;
+
+ u8 valid;
+
+ //DBG_8192C(" _is_fw_read_cmd_down ,reg_1cc(%x),msg_box(%d)...\n",rtw_read8(padapter,REG_HMETFR),msgbox_num);
+
+ do{
+ valid = rtw_read8(padapter,REG_HMETFR) & BIT(msgbox_num);
+ if(0 == valid ){
+ read_down = _TRUE;
+ }
else
rtw_msleep_os(1);
- }while( (!read_down) && (retry_cnts--));
-
- return read_down;
-
-}
-
-
-/*****************************************
-* H2C Msg format :
-* 0x1DF - 0x1D0
-*| 31 - 8 | 7-5 4 - 0 |
-*| h2c_msg |Class_ID CMD_ID |
-*
-* Extend 0x1FF - 0x1F0
-*|31 - 0 |
-*|ext_msg|
-******************************************/
-static s32 FillH2CCmd_88E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer)
-{
- struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- u8 h2c_box_num;
- u32 msgbox_addr;
- u32 msgbox_ex_addr;
- u8 cmd_idx,ext_cmd_len;
- u32 h2c_cmd = 0;
- u32 h2c_cmd_ex = 0;
- s32 ret = _FAIL;
-
-_func_enter_;
-
- padapter = GET_PRIMARY_ADAPTER(padapter);
- pHalData = GET_HAL_DATA(padapter);
-
- if(padapter->bFWReady == _FALSE)
- {
- DBG_8192C("FillH2CCmd_88E(): return H2C cmd because fw is not ready\n");
- return ret;
- }
-
- _enter_critical_mutex(&(dvobj->h2c_fwcmd_mutex), NULL);
-
- if (!pCmdBuffer) {
- goto exit;
- }
- if (CmdLen > RTL88E_MAX_CMD_LEN) {
- goto exit;
- }
- if (padapter->bSurpriseRemoved == _TRUE)
- goto exit;
-
- //pay attention to if race condition happened in H2C cmd setting.
- do{
- h2c_box_num = pHalData->LastHMEBoxNum;
-
- if(!_is_fw_read_cmd_down(padapter, h2c_box_num)){
- DBG_8192C(" fw read cmd failed...\n");
- goto exit;
- }
-
- *(u8*)(&h2c_cmd) = ElementID;
-
- if(CmdLen<=3)
- {
- _rtw_memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer, CmdLen );
- }
- else{
- _rtw_memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer,3);
- ext_cmd_len = CmdLen-3;
- _rtw_memcpy((u8*)(&h2c_cmd_ex), pCmdBuffer+3,ext_cmd_len );
-
- //Write Ext command
- msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num *RTL88E_EX_MESSAGE_BOX_SIZE);
- #ifdef CONFIG_H2C_EF
- for(cmd_idx=0;cmd_idx<ext_cmd_len;cmd_idx++ ){
- rtw_write8(padapter,msgbox_ex_addr+cmd_idx,*((u8*)(&h2c_cmd_ex)+cmd_idx));
- }
- #else
- h2c_cmd_ex = le32_to_cpu( h2c_cmd_ex );
- rtw_write32(padapter, msgbox_ex_addr, h2c_cmd_ex);
- #endif
- }
- // Write command
- msgbox_addr =REG_HMEBOX_0 + (h2c_box_num *RTL88E_MESSAGE_BOX_SIZE);
- #ifdef CONFIG_H2C_EF
- for(cmd_idx=0;cmd_idx<RTL88E_MESSAGE_BOX_SIZE;cmd_idx++ ){
- rtw_write8(padapter,msgbox_addr+cmd_idx,*((u8*)(&h2c_cmd)+cmd_idx));
- }
- #else
- h2c_cmd = le32_to_cpu( h2c_cmd );
- rtw_write32(padapter,msgbox_addr, h2c_cmd);
- #endif
-
-
- // DBG_8192C("MSG_BOX:%d,CmdLen(%d), reg:0x%x =>h2c_cmd:0x%x, reg:0x%x =>h2c_cmd_ex:0x%x ..\n"
- // ,pHalData->LastHMEBoxNum ,CmdLen,msgbox_addr,h2c_cmd,msgbox_ex_addr,h2c_cmd_ex);
-
- pHalData->LastHMEBoxNum = (h2c_box_num+1) % RTL88E_MAX_H2C_BOX_NUMS;
-
- }while(0);
-
- ret = _SUCCESS;
-
-exit:
-
- _exit_critical_mutex(&(dvobj->h2c_fwcmd_mutex), NULL);
-
-_func_exit_;
-
- return ret;
-}
-
-u8 rtl8192c_h2c_msg_hdl(_adapter *padapter, unsigned char *pbuf)
-{
- u8 ElementID, CmdLen;
- u8 *pCmdBuffer;
- struct cmd_msg_parm *pcmdmsg;
-
- if(!pbuf)
- return H2C_PARAMETERS_ERROR;
-
- pcmdmsg = (struct cmd_msg_parm*)pbuf;
- ElementID = pcmdmsg->eid;
- CmdLen = pcmdmsg->sz;
- pCmdBuffer = pcmdmsg->buf;
-
- FillH2CCmd_88E(padapter, ElementID, CmdLen, pCmdBuffer);
-
- return H2C_SUCCESS;
-}
-/*
-#if defined(CONFIG_AUTOSUSPEND) && defined(SUPPORT_HW_RFOFF_DETECTED)
-u8 rtl8192c_set_FwSelectSuspend_cmd(_adapter *padapter ,u8 bfwpoll, u16 period)
-{
- u8 res=_SUCCESS;
- struct H2C_SS_RFOFF_PARAM param;
- DBG_8192C("==>%s bfwpoll(%x)\n",__FUNCTION__,bfwpoll);
- param.gpio_period = period;//Polling GPIO_11 period time
- param.ROFOn = (_TRUE == bfwpoll)?1:0;
- FillH2CCmd_88E(padapter, SELECTIVE_SUSPEND_ROF_CMD, sizeof(param), (u8*)(&param));
- return res;
-}
-#endif //CONFIG_AUTOSUSPEND && SUPPORT_HW_RFOFF_DETECTED
-*/
-u8 rtl8188e_set_rssi_cmd(_adapter*padapter, u8 *param)
-{
- u8 res=_SUCCESS;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
-_func_enter_;
-
- if(pHalData->fw_ractrl == _TRUE){
- #if 0
- *((u32*) param ) = cpu_to_le32( *((u32*) param ) );
-
- FillH2CCmd_88E(padapter, RSSI_SETTING_EID, 3, param);
- #endif
- }else{
- DBG_8192C("==>%s fw dont support RA \n",__FUNCTION__);
- res=_FAIL;
- }
-
-_func_exit_;
-
- return res;
-}
-
-u8 rtl8188e_set_raid_cmd(_adapter*padapter, u32 mask)
-{
- u8 buf[3];
- u8 res=_SUCCESS;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
-_func_enter_;
- if(pHalData->fw_ractrl == _TRUE){
- _rtw_memset(buf, 0, 3);
- mask = cpu_to_le32( mask );
- _rtw_memcpy(buf, &mask, 3);
-
- FillH2CCmd_88E(padapter, H2C_DM_MACID_CFG, 3, buf);
- }else{
- DBG_8192C("==>%s fw dont support RA \n",__FUNCTION__);
- res=_FAIL;
- }
-
-_func_exit_;
-
- return res;
-
-}
-
-//bitmap[0:27] = tx_rate_bitmap
-//bitmap[28:31]= Rate Adaptive id
-//arg[0:4] = macid
-//arg[5] = Short GI
-void rtl8188e_Add_RateATid(PADAPTER pAdapter, u32 bitmap, u8* arg, u8 rssi_level)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- u8 macid, init_rate, raid, shortGIrate=_FALSE;
-
- macid = arg[0];
- raid = arg[1];
- shortGIrate = arg[2];
- init_rate = arg[3];
-
- bitmap &=0x0fffffff;
-
- if(rssi_level != DM_RATR_STA_INIT)
- bitmap = ODM_Get_Rate_Bitmap(&pHalData->odmpriv, macid, bitmap, rssi_level);
-
- if (shortGIrate==_TRUE)
- init_rate |= BIT(6);
-
- bitmap &= 0x0fffffff;
-
- DBG_871X("%s=> mac_id:%d , raid:%d , ra_bitmap=0x%x, shortGIrate=0x%02x\n",
- __FUNCTION__,macid ,raid ,bitmap, shortGIrate);
-
-
-#if(RATE_ADAPTIVE_SUPPORT == 1)
- ODM_RA_UpdateRateInfo_8188E(
- &(pHalData->odmpriv),
- macid,
- raid,
- bitmap,
- shortGIrate
- );
-#endif
-
-}
-
-void rtl8188e_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode)
-{
- SETPWRMODE_PARM H2CSetPwrMode;
- struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
- u8 RLBM = 0; // 0:Min, 1:Max , 2:User define
-_func_enter_;
-
- DBG_871X("%s: Mode=%d SmartPS=%d UAPSD=%d\n", __FUNCTION__,
- Mode, pwrpriv->smart_ps, padapter->registrypriv.uapsd_enable);
-
- H2CSetPwrMode.AwakeInterval = 2; //DTIM = 1
-
- switch(Mode)
- {
- case PS_MODE_ACTIVE:
- H2CSetPwrMode.Mode = 0;
- break;
- case PS_MODE_MIN:
- H2CSetPwrMode.Mode = 1;
- break;
- case PS_MODE_MAX:
- RLBM = 1;
- H2CSetPwrMode.Mode = 1;
- break;
- case PS_MODE_DTIM:
- RLBM = 2;
- H2CSetPwrMode.AwakeInterval = 3; //DTIM = 2
- H2CSetPwrMode.Mode = 1;
- break;
- case PS_MODE_UAPSD_WMM:
- H2CSetPwrMode.Mode = 2;
- break;
- default:
- H2CSetPwrMode.Mode = 0;
- break;
- }
-
- //H2CSetPwrMode.Mode = Mode;
-
- H2CSetPwrMode.SmartPS_RLBM = (((pwrpriv->smart_ps<<4)&0xf0) | (RLBM & 0x0f));
-
- H2CSetPwrMode.bAllQueueUAPSD = padapter->registrypriv.uapsd_enable;
-
- if(Mode > 0)
- {
- H2CSetPwrMode.PwrState = 0x00;// AllON(0x0C), RFON(0x04), RFOFF(0x00)
-#ifdef CONFIG_EXT_CLK
- H2CSetPwrMode.Mode |= BIT(7);//supporting 26M XTAL CLK_Request feature.
-#endif //CONFIG_EXT_CLK
- }
- else
- H2CSetPwrMode.PwrState = 0x0C;// AllON(0x0C), RFON(0x04), RFOFF(0x00)
-
- FillH2CCmd_88E(padapter, H2C_PS_PWR_MODE, sizeof(H2CSetPwrMode), (u8 *)&H2CSetPwrMode);
-
-
-_func_exit_;
-}
-
-void rtl8188e_set_FwMediaStatus_cmd(PADAPTER padapter, u16 mstatus_rpt )
-{
- u8 opmode,macid;
- u16 mst_rpt = cpu_to_le16 (mstatus_rpt);
- u32 reg_macid_no_link = REG_MACID_NO_LINK_0;
- opmode = (u8) mst_rpt;
- macid = (u8)(mst_rpt >> 8) ;
- DBG_871X("### %s: MStatus=%x MACID=%d \n", __FUNCTION__,opmode,macid);
- FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(mst_rpt), (u8 *)&mst_rpt);
-
- if(macid > 31){
- macid = macid-32;
- reg_macid_no_link = REG_MACID_NO_LINK_1;
- }
-
- //Delete select macid (MACID 0~63) from queue list.
- if(opmode == 1)// 1:connect
- {
- rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link) & (~BIT(macid))));
- }
- else//0: disconnect
- {
- rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link)|BIT(macid)));
- }
-
-
-
-}
-
-void ConstructBeacon(_adapter *padapter, u8 *pframe, u32 *pLength)
-{
- struct rtw_ieee80211_hdr *pwlanhdr;
- u16 *fctrl;
- u32 rate_len, pktlen;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
- u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
-
- //DBG_871X("%s\n", __FUNCTION__);
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
- fctrl = &(pwlanhdr->frame_ctl);
- *(fctrl) = 0;
-
- _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN);
-
- SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
- //pmlmeext->mgnt_seq++;
- SetFrameSubType(pframe, WIFI_BEACON);
-
- pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
- pktlen = sizeof (struct rtw_ieee80211_hdr_3addr);
-
- //timestamp will be inserted by hardware
- pframe += 8;
- pktlen += 8;
-
- // beacon interval: 2 bytes
- _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2);
-
- pframe += 2;
- pktlen += 2;
-
- // capability info: 2 bytes
- _rtw_memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->IEs)), 2);
-
- pframe += 2;
- pktlen += 2;
-
- if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
- {
- //DBG_871X("ie len=%d\n", cur_network->IELength);
- pktlen += cur_network->IELength - sizeof(NDIS_802_11_FIXED_IEs);
- _rtw_memcpy(pframe, cur_network->IEs+sizeof(NDIS_802_11_FIXED_IEs), pktlen);
-
- goto _ConstructBeacon;
- }
-
- //below for ad-hoc mode
-
- // SSID
- pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pktlen);
-
- // supported rates...
- rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pktlen);
-
- // DS parameter set
- pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pktlen);
-
- if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
- {
- u32 ATIMWindow;
- // IBSS Parameter Set...
- //ATIMWindow = cur->Configuration.ATIMWindow;
- ATIMWindow = 0;
- pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &pktlen);
- }
-
-
- //todo: ERP IE
-
-
- // EXTERNDED SUPPORTED RATE
- if (rate_len > 8)
- {
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pktlen);
- }
-
-
- //todo:HT for adhoc
-
-_ConstructBeacon:
-
- if ((pktlen + TXDESC_SIZE) > 512)
- {
- DBG_871X("beacon frame too large\n");
- return;
- }
-
- *pLength = pktlen;
-
- //DBG_871X("%s bcn_sz=%d\n", __FUNCTION__, pktlen);
-
-}
-
-void ConstructPSPoll(_adapter *padapter, u8 *pframe, u32 *pLength)
-{
- struct rtw_ieee80211_hdr *pwlanhdr;
- u16 *fctrl;
- u32 pktlen;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- //DBG_871X("%s\n", __FUNCTION__);
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
- // Frame control.
- fctrl = &(pwlanhdr->frame_ctl);
- *(fctrl) = 0;
- SetPwrMgt(fctrl);
- SetFrameSubType(pframe, WIFI_PSPOLL);
-
- // AID.
- SetDuration(pframe, (pmlmeinfo->aid | 0xc000));
-
- // BSSID.
- _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-
- // TA.
- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
-
- *pLength = 16;
-}
-
-void ConstructNullFunctionData(
- 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_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);
-
-
- //DBG_871X("%s:%d\n", __FUNCTION__, bForcePowerSave);
-
- pwlanhdr = (struct rtw_ieee80211_hdr*)pframe;
-
- fctrl = &pwlanhdr->frame_ctl;
- *(fctrl) = 0;
- if (bForcePowerSave)
- {
- SetPwrMgt(fctrl);
- }
-
- switch(cur_network->network.InfrastructureMode)
- {
- case Ndis802_11Infrastructure:
- 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, StaAddr, ETH_ALEN);
- break;
- case Ndis802_11APMode:
- SetFrDs(fctrl);
- _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
- break;
- case Ndis802_11IBSS:
- default:
- _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
- break;
- }
-
- 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;
-}
-
-#ifdef CONFIG_WOWLAN
-//
-// Description:
-// Construct the ARP response packet to support ARP offload.
-//
-static void ConstructARPResponse(
- PADAPTER padapter,
- u8 *pframe,
- u32 *pLength,
- u8 *pIPAddress
- )
-{
- struct rtw_ieee80211_hdr *pwlanhdr;
- 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 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06};
-
- u16 *fctrl;
- u32 pktlen;
- u8 *pARPRspPkt = pframe;
- //for TKIP Cal MIC
- u8 *payload = pframe;
- u8 EncryptionHeadOverhead = 0;
-
- 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);
- //SET_80211_HDR_FRAME_CONTROL(pARPRspPkt, 0);
- //SET_80211_HDR_TYPE_AND_SUBTYPE(pARPRspPkt, Type_Data);
- //SET_80211_HDR_TO_DS(pARPRspPkt, 1);
- //SET_80211_HDR_ADDRESS1(pARPRspPkt, pMgntInfo->Bssid);
- //SET_80211_HDR_ADDRESS2(pARPRspPkt, Adapter->CurrentAddress);
- //SET_80211_HDR_ADDRESS3(pARPRspPkt, pMgntInfo->Bssid);
-
- //SET_80211_HDR_DURATION(pARPRspPkt, 0);
- //SET_80211_HDR_FRAGMENT_SEQUENCE(pARPRspPkt, 0);
-#ifdef CONFIG_WAPI_SUPPORT
- *pLength = sMacHdrLng;
-#else
- *pLength = 24;
-#endif
-
-
-//YJ,del,120503
-#if 0
- //-------------------------------------------------------------------------
- // Qos Header: leave space for it if necessary.
- //-------------------------------------------------------------------------
- if(pStaQos->CurrentQosMode > QOS_DISABLE)
- {
- SET_80211_HDR_QOS_EN(pARPRspPkt, 1);
- PlatformZeroMemory(&(Buffer[*pLength]), sQoSCtlLng);
- *pLength += sQoSCtlLng;
- }
-#endif
- //-------------------------------------------------------------------------
- // Security Header: leave space for it if necessary.
- //-------------------------------------------------------------------------
-
- 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
- default:
- EncryptionHeadOverhead = 0;
- }
-
- if(EncryptionHeadOverhead > 0)
- {
- _rtw_memset(&(pframe[*pLength]), 0,EncryptionHeadOverhead);
- *pLength += EncryptionHeadOverhead;
- //SET_80211_HDR_WEP(pARPRspPkt, 1); //Suggested by CCW.
- SetPrivacy(fctrl);
- }
-
- //-------------------------------------------------------------------------
- // Frame Body.
- //-------------------------------------------------------------------------
- pARPRspPkt = (u8*)(pframe+ *pLength);
- // LLC header
- _rtw_memcpy(pARPRspPkt, ARPLLCHeader, 8);
- *pLength += 8;
-
- // ARP element
- pARPRspPkt += 8;
- SET_ARP_PKT_HW(pARPRspPkt, 0x0100);
- SET_ARP_PKT_PROTOCOL(pARPRspPkt, 0x0008); // IP protocol
- SET_ARP_PKT_HW_ADDR_LEN(pARPRspPkt, 6);
- SET_ARP_PKT_PROTOCOL_ADDR_LEN(pARPRspPkt, 4);
- SET_ARP_PKT_OPERATION(pARPRspPkt, 0x0200); // ARP response
- SET_ARP_PKT_SENDER_MAC_ADDR(pARPRspPkt, myid(&(padapter->eeprompriv)));
- SET_ARP_PKT_SENDER_IP_ADDR(pARPRspPkt, pIPAddress);
- #ifdef CONFIG_ARP_KEEP_ALIVE
- if (rtw_gw_addr_query(padapter)==0) {
- SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, pmlmepriv->gw_mac_addr);
- SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pmlmepriv->gw_ip);
- }
- else
-#endif
- {
- SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, get_my_bssid(&(pmlmeinfo->network)));
- SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pIPAddress);
- DBG_871X("%s Target Mac Addr:" MAC_FMT "\n", __FUNCTION__, MAC_ARG(get_my_bssid(&(pmlmeinfo->network))));
- DBG_871X("%s Target IP Addr" IP_FMT "\n", __FUNCTION__, IP_ARG(pIPAddress));
- }
- *pLength += 28;
- if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_)
- {
- u8 mic[8];
- struct mic_data micdata;
- struct sta_info *psta = NULL;
- u8 priority[4]={0x0,0x0,0x0,0x0};
- u8 null_key[16]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
-
- DBG_871X("%s(): Add MIC\n",__FUNCTION__);
-
- psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network)));
- if (psta != NULL) {
- if(_rtw_memcmp(&psta->dot11tkiptxmickey.skey[0],null_key, 16)==_TRUE){
- DBG_871X("%s(): STA dot11tkiptxmickey==0\n",__FUNCTION__);
- }
- //start to calculate the mic code
- rtw_secmicsetkey(&micdata, &psta->dot11tkiptxmickey.skey[0]);
- }
-
- rtw_secmicappend(&micdata, pwlanhdr->addr3, 6); //DA
-
- rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); //SA
-
- priority[0]=0;
- rtw_secmicappend(&micdata, &priority[0], 4);
-
- rtw_secmicappend(&micdata, payload, 36); //payload length = 8 + 28
-
- rtw_secgetmic(&micdata,&(mic[0]));
-
- pARPRspPkt += 28;
- _rtw_memcpy(pARPRspPkt, &(mic[0]),8);
-
- *pLength += 8;
- }
-}
-#endif
-
-void ConstructProbeRsp(_adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, BOOLEAN bHideSSID)
-{
- struct rtw_ieee80211_hdr *pwlanhdr;
- u16 *fctrl;
- u8 *mac, *bssid;
- u32 pktlen;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
-
-
- //DBG_871X("%s\n", __FUNCTION__);
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
- mac = myid(&(padapter->eeprompriv));
- bssid = cur_network->MacAddress;
-
- fctrl = &(pwlanhdr->frame_ctl);
- *(fctrl) = 0;
- _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, bssid, ETH_ALEN);
-
- SetSeqNum(pwlanhdr, 0);
- SetFrameSubType(fctrl, WIFI_PROBERSP);
-
- pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
- pframe += pktlen;
-
- if(cur_network->IELength>MAX_IE_SZ)
- return;
-
- _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength);
- pframe += cur_network->IELength;
- pktlen += cur_network->IELength;
-
- *pLength = pktlen;
-}
-
-void rtl8188e_set_FwRsvdPage_cmd(PADAPTER padapter, PRSVDPAGE_LOC rsvdpageloc)
-{
- u8 u1H2CRsvdPageParm[H2C_RSVDPAGE_LOC_LEN]={0};
- u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN]={0};
-
- //DBG_871X("8188RsvdPageLoc: PsPoll=%d Null=%d QoSNull=%d\n",
- // rsvdpageloc->LocPsPoll, rsvdpageloc->LocNullData, rsvdpageloc->LocQosNull);
-
- SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1H2CRsvdPageParm, rsvdpageloc->LocPsPoll);
- SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1H2CRsvdPageParm, rsvdpageloc->LocNullData);
- SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1H2CRsvdPageParm, rsvdpageloc->LocQosNull);
-
- FillH2CCmd_88E(padapter, H2C_COM_RSVD_PAGE, H2C_RSVDPAGE_LOC_LEN, u1H2CRsvdPageParm);
-
-#ifdef CONFIG_WOWLAN
- //DBG_871X("8188E_AOACRsvdPageLoc: RWC=%d ArpRsp=%d\n", rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp);
- SET_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocRemoteCtrlInfo);
- SET_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocArpRsp);
-
- FillH2CCmd_88E(padapter, H2C_COM_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm);
-#endif
-}
-
-// To check if reserved page content is destroyed by beacon beacuse beacon is too large.
-// 2010.06.23. Added by tynli.
-VOID
-CheckFwRsvdPageContent(
- IN PADAPTER Adapter
-)
-{
- HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter);
- u32 MaxBcnPageNum;
-
- if(pHalData->FwRsvdPageStartOffset != 0)
- {
- /*MaxBcnPageNum = PageNum_128(pMgntInfo->MaxBeaconSize);
- RT_ASSERT((MaxBcnPageNum <= pHalData->FwRsvdPageStartOffset),
- ("CheckFwRsvdPageContent(): The reserved page content has been"\
- "destroyed by beacon!!! MaxBcnPageNum(%d) FwRsvdPageStartOffset(%d)\n!",
- MaxBcnPageNum, pHalData->FwRsvdPageStartOffset));*/
- }
-}
-
-//
-// Description: Fill the reserved packets that FW will use to RSVD page.
-// Now we just send 4 types packet to rsvd page.
-// (1)Beacon, (2)Ps-poll, (3)Null data, (4)ProbeRsp.
-// Input:
-// bDLFinished - FALSE: At the first time we will send all the packets as a large packet to Hw,
-// so we need to set the packet length to total lengh.
-// TRUE: At the second time, we should send the first packet (default:beacon)
-// to Hw again and set the lengh in descriptor to the real beacon lengh.
-// 2009.10.15 by tynli.
-static void SetFwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished)
-{
- 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;
- u32 BeaconLength, ProbeRspLength, PSPollLength;
- u32 NullDataLength, QosNullLength, BTQosNullLength;
- u8 *ReservedPagePacket;
- u8 RsvdPageNum = 0;
- u8 PageNum, PageNeed, TxDescLen;
- u16 BufIndex, PageSize = 128;
- u32 TotalPacketLen, MaxRsvdPageBufSize=0;
- RSVDPAGE_LOC RsvdPageLoc;
-#ifdef CONFIG_WOWLAN
- u32 ARPLegnth = 0;
- struct security_priv *psecuritypriv = &padapter->securitypriv; //added by xx
- u8 currentip[4];
- u8 cur_dot11txpn[8];
-#endif
-
- DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
-
-#ifdef CONFIG_WOWLAN
- RsvdPageNum = BCNQ_PAGE_NUM_88E + WOWLAN_PAGE_NUM_88E;
-#else
- RsvdPageNum = BCNQ_PAGE_NUM_88E;
-#endif
- printk("RsvdPageNum: %d\n", RsvdPageNum);
-
- MaxRsvdPageBufSize = RsvdPageNum*PageSize;
-
- ReservedPagePacket = (u8*)rtw_zmalloc(MaxRsvdPageBufSize);
-
- if (ReservedPagePacket == NULL) {
- DBG_871X("%s: alloc ReservedPagePacket fail!\n", __FUNCTION__);
- }
-
- pHalData = GET_HAL_DATA(padapter);
- pxmitpriv = &padapter->xmitpriv;
- pmlmeext = &padapter->mlmeextpriv;
- pmlmeinfo = &pmlmeext->mlmext_info;
-
- TxDescLen = TXDESC_SIZE;
- PageNum = 0;
-
- //3 (1) beacon * 2 pages
- BufIndex = TXDESC_OFFSET;
- ConstructBeacon(padapter, &ReservedPagePacket[BufIndex], &BeaconLength);
-
- // When we count the first page size, we need to reserve description size for the RSVD
- // packet, it will be filled in front of the packet in TXPKTBUF.
- PageNeed = (u8)PageNum_128(TxDescLen + BeaconLength);
- // To reserved 2 pages for beacon buffer. 2010.06.24.
- if (PageNeed == 1)
- PageNeed += 1;
- PageNum += PageNeed;
- pHalData->FwRsvdPageStartOffset = PageNum;
-
- BufIndex += PageNeed * PageSize;
-
- //3 (2) ps-poll *1 page
- RsvdPageLoc.LocPsPoll = PageNum;
- ConstructPSPoll(padapter, &ReservedPagePacket[BufIndex], &PSPollLength);
- rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], PSPollLength, _TRUE, _FALSE);
-
- PageNeed = (u8)PageNum_128(TxDescLen + PSPollLength);
- PageNum += PageNeed;
-
- BufIndex += PageNeed * PageSize;
-
- //3 (3) null data * 1 page
- RsvdPageLoc.LocNullData = PageNum;
- ConstructNullFunctionData(
- padapter,
- &ReservedPagePacket[BufIndex],
- &NullDataLength,
- get_my_bssid(&pmlmeinfo->network),
- _FALSE, 0, 0, _FALSE);
- rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], NullDataLength, _FALSE, _FALSE);
-
- PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength);
- PageNum += PageNeed;
-
- BufIndex += PageNeed * PageSize;
-
- //3 (5) Qos null data
- RsvdPageLoc.LocQosNull = PageNum;
- ConstructNullFunctionData(
- padapter,
- &ReservedPagePacket[BufIndex],
- &QosNullLength,
- get_my_bssid(&pmlmeinfo->network),
- _TRUE, 0, 0, _FALSE);
- rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], QosNullLength, _FALSE, _FALSE);
-
- PageNeed = (u8)PageNum_128(TxDescLen + QosNullLength);
- PageNum += PageNeed;
-
- BufIndex += PageNeed * PageSize;
-
-/*
- //3 (6) BT Qos null data
- RsvdPageLoc.LocBTQosNull = PageNum;
- ConstructNullFunctionData(
- padapter,
- &ReservedPagePacket[BufIndex],
- &BTQosNullLength,
- get_my_bssid(&pmlmeinfo->network),
- _TRUE, 0, 0, _FALSE);
- rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, _FALSE, _TRUE);
-
- TotalPacketLen = BufIndex + BTQosNullLength;
-*/
-
-#ifdef CONFIG_WOWLAN
- //3(7) ARP
- rtw_get_current_ip_address(padapter, currentip);
- RsvdPageLoc.LocArpRsp = PageNum;
- ConstructARPResponse(
- padapter,
- &ReservedPagePacket[BufIndex],
- &ARPLegnth,
- currentip
- );
- rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ARPLegnth, _FALSE, _FALSE);
-
- PageNeed = (u8)PageNum_128(TxDescLen + ARPLegnth);
- PageNum += PageNeed;
-
- BufIndex += PageNeed * PageSize;
-
- //3(8) sec IV
- rtw_get_sec_iv(padapter, cur_dot11txpn, get_my_bssid(&pmlmeinfo->network));
- RsvdPageLoc.LocRemoteCtrlInfo = PageNum;
- _rtw_memcpy(ReservedPagePacket+BufIndex-TxDescLen, cur_dot11txpn, 8);
-
- TotalPacketLen = BufIndex-TxDescLen + sizeof (union pn48); //IV len
-#else
- TotalPacketLen = BufIndex + QosNullLength;
-#endif
-
- pcmdframe = alloc_mgtxmitframe(pxmitpriv);
- if (pcmdframe == NULL)
- goto exit;
-
- // update attribute
- pattrib = &pcmdframe->attrib;
- update_mgntframe_attrib(padapter, pattrib);
- pattrib->qsel = 0x10;
- pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET;
-
- if (TotalPacketLen < MaxRsvdPageBufSize)
- _rtw_memcpy(pcmdframe->buf_addr, ReservedPagePacket, TotalPacketLen);
- else
- DBG_871X("%s: memory copy fail at Line:%d\n", __FUNCTION__, __LINE__);
-
- rtw_hal_mgnt_xmit(padapter, pcmdframe);
-
- DBG_871X("%s: Set RSVD page location to Fw ,TotalPacketLen(%d)\n", __FUNCTION__,TotalPacketLen);
- rtl8188e_set_FwRsvdPage_cmd(padapter, &RsvdPageLoc);
-exit:
- rtw_mfree(ReservedPagePacket, MaxRsvdPageBufSize);
-}
-
-void rtl8188e_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus)
-{
- JOINBSSRPT_PARM_88E JoinBssRptParm;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-#ifdef CONFIG_WOWLAN
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct sta_info *psta = NULL;
-#endif
- BOOLEAN bSendBeacon=_FALSE;
- BOOLEAN bcn_valid = _FALSE;
- u8 DLBcnCount=0;
- u32 poll = 0;
-
-_func_enter_;
-
- DBG_871X("%s mstatus(%x)\n", __FUNCTION__,mstatus);
-
- if(mstatus == 1)
- {
- // 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));
- // Do not set TSF again here or vWiFi beacon DMA INT will not work.
- //correct_TSF(padapter, pmlmeext);
- // Hw sequende enable by dedault. 2010.06.23. by tynli.
- //rtw_write16(padapter, REG_NQOS_SEQ, ((pmlmeext->mgnt_seq+100)&0xFFF));
- //rtw_write8(padapter, REG_HWSEQ_CTRL, 0xFF);
-
- //Set REG_CR bit 8. DMA beacon by SW.
- pHalData->RegCR_1 |= BIT0;
- rtw_write8(padapter, REG_CR+1, pHalData->RegCR_1);
-
- // 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.
- //SetBcnCtrlReg(padapter, 0, BIT3);
- //SetBcnCtrlReg(padapter, BIT4, 0);
- rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(3)));
- rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(4));
-
- if(pHalData->RegFwHwTxQCtrl&BIT6)
- {
- DBG_871X("HalDownloadRSVDPage(): There is an Adapter is sending beacon.\n");
- bSendBeacon = _TRUE;
- }
-
- // Set FWHW_TXQ_CTRL 0x422[6]=0 to tell Hw the packet is not a real beacon frame.
- rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl&(~BIT6)));
- pHalData->RegFwHwTxQCtrl &= (~BIT6);
-
- // Clear beacon valid check bit.
- rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL);
- DLBcnCount = 0;
- poll = 0;
- do
- {
- // download rsvd page.
- SetFwRsvdPagePkt(padapter, _FALSE);
- 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);
-
- //RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage88ES(): 1 Download RSVD page failed!\n"));
- if(padapter->bSurpriseRemoved || padapter->bDriverStopped)
- {
- }
- else if(!bcn_valid)
- DBG_871X(ADPT_FMT": 1 DL RSVD page failed! DLBcnCount:%u, poll:%u\n",
- ADPT_ARG(padapter) ,DLBcnCount, poll);
- else {
- struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
- pwrctl->fw_psmode_iface_id = padapter->iface_id;
- DBG_871X(ADPT_FMT": 1 DL RSVD page success! DLBcnCount:%u, poll:%u\n",
- ADPT_ARG(padapter), DLBcnCount, poll);
- }
- //
- // We just can send the reserved page twice during the time that Tx thread is stopped (e.g. pnpsetpower)
- // becuase we need to free the Tx BCN Desc which is used by the first reserved page packet.
- // At run time, we cannot get the Tx Desc until it is released in TxHandleInterrupt() so we will return
- // the beacon TCB in the following code. 2011.11.23. by tynli.
- //
- //if(bcn_valid && padapter->bEnterPnpSleep)
- if(0)
- {
- if(bSendBeacon)
- {
- rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL);
- DLBcnCount = 0;
- poll = 0;
- do
- {
- SetFwRsvdPagePkt(padapter, _TRUE);
- 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);
-
- //RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage(): 2 Download RSVD page failed!\n"));
- if(padapter->bSurpriseRemoved || padapter->bDriverStopped)
- {
- }
- else if(!bcn_valid)
- DBG_871X("%s: 2 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __FUNCTION__ ,DLBcnCount, poll);
- else
- DBG_871X("%s: 2 Download RSVD success! DLBcnCount:%u, poll:%u\n", __FUNCTION__, DLBcnCount, poll);
- }
- }
-
- // Enable Bcn
- //SetBcnCtrlReg(padapter, BIT3, 0);
- //SetBcnCtrlReg(padapter, 0, BIT4);
- rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(3));
- rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(4)));
-
- // To make sure that if there exists an adapter which would like to send beacon.
- // If exists, the origianl value of 0x422[6] will be 1, we should check this to
- // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause
- // the beacon cannot be sent by HW.
- // 2010.06.23. Added by tynli.
- if(bSendBeacon)
- {
- rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl|BIT6));
- pHalData->RegFwHwTxQCtrl |= BIT6;
- }
-
- //
- // Update RSVD page location H2C to Fw.
- //
- if(bcn_valid)
- {
- rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL);
- DBG_871X("Set RSVD page location to Fw.\n");
- //FillH2CCmd88E(Adapter, H2C_88E_RSVDPAGE, H2C_RSVDPAGE_LOC_LENGTH, pMgntInfo->u1RsvdPageLoc);
- }
-
- // Do not enable HW DMA BCN or it will cause Pcie interface hang by timing issue. 2011.11.24. by tynli.
- //if(!padapter->bEnterPnpSleep)
- {
- // Clear CR[8] or beacon packet will not be send to TxBuf anymore.
- pHalData->RegCR_1 &= (~BIT0);
- rtw_write8(padapter, REG_CR+1, pHalData->RegCR_1);
- }
- }
-#ifdef CONFIG_WOWLAN
- if (adapter_to_pwrctl(padapter)->wowlan_mode){
- JoinBssRptParm.OpMode = mstatus;
- psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv));
- if (psta != NULL) {
- JoinBssRptParm.MacID = psta->mac_id;
- } else {
- JoinBssRptParm.MacID = 0;
- }
- FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(JoinBssRptParm), (u8 *)&JoinBssRptParm);
- DBG_871X_LEVEL(_drv_info_, "%s opmode:%d MacId:%d\n", __func__, JoinBssRptParm.OpMode, JoinBssRptParm.MacID);
- } else {
- DBG_871X_LEVEL(_drv_info_, "%s wowlan_mode is off\n", __func__);
- }
-#endif //CONFIG_WOWLAN
-_func_exit_;
-}
-
-#ifdef CONFIG_P2P_PS
-void rtl8188e_set_p2p_ps_offload_cmd(_adapter* padapter, u8 p2p_ps_state)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
- struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
- struct P2P_PS_Offload_t *p2p_ps_offload = (struct P2P_PS_Offload_t *)(&pHalData->p2p_ps_offload);
- u8 i;
-
-_func_enter_;
-
-#if 1
- switch(p2p_ps_state)
- {
- case P2P_PS_DISABLE:
- DBG_8192C("P2P_PS_DISABLE \n");
- _rtw_memset(p2p_ps_offload, 0 ,1);
- break;
- case P2P_PS_ENABLE:
- DBG_8192C("P2P_PS_ENABLE \n");
- // update CTWindow value.
- if( pwdinfo->ctwindow > 0 )
- {
- p2p_ps_offload->CTWindow_En = 1;
- rtw_write8(padapter, REG_P2P_CTWIN, pwdinfo->ctwindow);
- }
-
- // hw only support 2 set of NoA
- for( i=0 ; i<pwdinfo->noa_num ; i++)
- {
- // To control the register setting for which NOA
- rtw_write8(padapter, REG_NOA_DESC_SEL, (i << 4));
- if(i == 0)
- p2p_ps_offload->NoA0_En = 1;
- else
- p2p_ps_offload->NoA1_En = 1;
-
- // config P2P NoA Descriptor Register
- //DBG_8192C("%s(): noa_duration = %x\n",__FUNCTION__,pwdinfo->noa_duration[i]);
- rtw_write32(padapter, REG_NOA_DESC_DURATION, pwdinfo->noa_duration[i]);
-
- //DBG_8192C("%s(): noa_interval = %x\n",__FUNCTION__,pwdinfo->noa_interval[i]);
- rtw_write32(padapter, REG_NOA_DESC_INTERVAL, pwdinfo->noa_interval[i]);
-
- //DBG_8192C("%s(): start_time = %x\n",__FUNCTION__,pwdinfo->noa_start_time[i]);
- rtw_write32(padapter, REG_NOA_DESC_START, pwdinfo->noa_start_time[i]);
-
- //DBG_8192C("%s(): noa_count = %x\n",__FUNCTION__,pwdinfo->noa_count[i]);
- rtw_write8(padapter, REG_NOA_DESC_COUNT, pwdinfo->noa_count[i]);
- }
-
- if( (pwdinfo->opp_ps == 1) || (pwdinfo->noa_num > 0) )
- {
- // rst p2p circuit
- rtw_write8(padapter, REG_DUAL_TSF_RST, BIT(4));
-
- p2p_ps_offload->Offload_En = 1;
-
- if(pwdinfo->role == P2P_ROLE_GO)
- {
- p2p_ps_offload->role= 1;
- p2p_ps_offload->AllStaSleep = 0;
- }
- else
- {
- p2p_ps_offload->role= 0;
- }
-
- p2p_ps_offload->discovery = 0;
- }
- break;
- case P2P_PS_SCAN:
- DBG_8192C("P2P_PS_SCAN \n");
- p2p_ps_offload->discovery = 1;
- break;
- case P2P_PS_SCAN_DONE:
- DBG_8192C("P2P_PS_SCAN_DONE \n");
- p2p_ps_offload->discovery = 0;
- pwdinfo->p2p_ps_state = P2P_PS_ENABLE;
- break;
- default:
- break;
- }
-
- FillH2CCmd_88E(padapter, H2C_PS_P2P_OFFLOAD, 1, (u8 *)p2p_ps_offload);
-#endif
-
-_func_exit_;
-
-}
-#endif //CONFIG_P2P_PS
-
-#ifdef CONFIG_TSF_RESET_OFFLOAD
-/*
- ask FW to Reset sync register at Beacon early interrupt
-*/
-u8 rtl8188e_reset_tsf(_adapter *padapter, u8 reset_port )
-{
- u8 buf[2];
- u8 res=_SUCCESS;
-
- s32 ret;
-_func_enter_;
- if (IFACE_PORT0==reset_port) {
- buf[0] = 0x1; buf[1] = 0;
- } else{
- buf[0] = 0x0; buf[1] = 0x1;
- }
-
- ret = FillH2CCmd_88E(padapter, H2C_RESET_TSF, 2, buf);
-
-_func_exit_;
-
- return res;
-}
-
-int reset_tsf(PADAPTER Adapter, u8 reset_port )
-{
- u8 reset_cnt_before = 0, reset_cnt_after = 0, loop_cnt = 0;
- u32 reg_reset_tsf_cnt = (IFACE_PORT0==reset_port) ?
- REG_FW_RESET_TSF_CNT_0:REG_FW_RESET_TSF_CNT_1;
- u32 reg_bcncrtl = (IFACE_PORT0==reset_port) ?
- REG_BCN_CTRL_1:REG_BCN_CTRL;
-
- rtw_scan_abort(Adapter->pbuddy_adapter); /* site survey will cause reset_tsf fail */
- reset_cnt_after = reset_cnt_before = rtw_read8(Adapter,reg_reset_tsf_cnt);
- rtl8188e_reset_tsf(Adapter, reset_port);
-
- while ((reset_cnt_after == reset_cnt_before ) && (loop_cnt < 10)) {
- rtw_msleep_os(100);
- loop_cnt++;
- reset_cnt_after = rtw_read8(Adapter, reg_reset_tsf_cnt);
- }
-
- return(loop_cnt >= 10) ? _FAIL : _TRUE;
-}
-
-
-#endif // CONFIG_TSF_RESET_OFFLOAD
-
-#ifdef CONFIG_WOWLAN
-#ifdef CONFIG_GPIO_WAKEUP
-void rtl8188es_set_output_gpio(_adapter* padapter, u8 index, u8 outputval)
-{
- if ( index <= 7 ) {
- /* config GPIO mode */
- rtw_write8(padapter, REG_GPIO_PIN_CTRL + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 3) & ~BIT(index) );
-
- /* config GPIO Sel */
- /* 0: input */
- /* 1: output */
- rtw_write8(padapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 2) | BIT(index));
-
- /* set output value */
- if ( outputval ) {
- rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) | BIT(index));
- } else {
- rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(index));
- }
- } else {
- /* 88C Series: */
- /* index: 11~8 transform to 3~0 */
- /* 8723 Series: */
- /* index: 12~8 transform to 4~0 */
- index -= 8;
-
- /* config GPIO mode */
- rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 3) & ~BIT(index) );
-
- /* config GPIO Sel */
- /* 0: input */
- /* 1: output */
- rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 2) | BIT(index));
-
- /* set output value */
- if ( outputval ) {
- rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) | BIT(index));
- } else {
- rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) & ~BIT(index));
- }
- }
-}
-#endif //CONFIG_GPIO_WAKEUP
-
-void rtl8188es_set_wowlan_cmd(_adapter* padapter, u8 enable)
-{
- u8 res=_SUCCESS;
- u32 test=0;
- struct recv_priv *precvpriv = &padapter->recvpriv;
- SETWOWLAN_PARM pwowlan_parm;
- SETAOAC_GLOBAL_INFO paoac_global_info_parm;
- struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
- struct security_priv *psecpriv = &padapter->securitypriv;
-#ifdef CONFIG_GPIO_WAKEUP
- u8 gpio_wake_pin = 7;
- u8 gpio_high_active = 0; //default low active
-#endif
-
-_func_enter_;
- DBG_871X_LEVEL(_drv_always_, "+%s+\n", __func__);
-
- pwowlan_parm.mode =0;
- pwowlan_parm.gpio_index=0;
- pwowlan_parm.gpio_duration=0;
- pwowlan_parm.second_mode =0;
- pwowlan_parm.reserve=0;
-
- if(enable){
-
- pwowlan_parm.mode |=FW_WOWLAN_FUN_EN;
- pwrpriv->wowlan_magic =_TRUE;
- if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_)
- pwrpriv->wowlan_unicast =_TRUE;
-
- if(pwrpriv->wowlan_pattern ==_TRUE){
- pwowlan_parm.mode |= FW_WOWLAN_PATTERN_MATCH;
- DBG_871X_LEVEL(_drv_info_, "%s 2.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
- }
- if(pwrpriv->wowlan_magic ==_TRUE){
- pwowlan_parm.mode |=FW_WOWLAN_MAGIC_PKT;
- DBG_871X_LEVEL(_drv_info_, "%s 3.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
- }
- if(pwrpriv->wowlan_unicast ==_TRUE){
- pwowlan_parm.mode |=FW_WOWLAN_UNICAST;
- DBG_871X_LEVEL(_drv_info_, "%s 4.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
- }
-
- pwowlan_parm.mode |=FW_WOWLAN_REKEY_WAKEUP;
- pwowlan_parm.mode |=FW_WOWLAN_DEAUTH_WAKEUP;
-
- //DataPinWakeUp
-#ifdef CONFIG_USB_HCI
- pwowlan_parm.gpio_index=0x0;
-#endif //CONFIG_USB_HCI
-
-#ifdef CONFIG_SDIO_HCI
- pwowlan_parm.gpio_index = 0x80;
-#endif //CONFIG_SDIO_HCI
-
-#ifdef CONFIG_GPIO_WAKEUP
- pwowlan_parm.gpio_index = gpio_wake_pin;
-
- //WOWLAN_GPIO_ACTIVE means GPIO high active
- //pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE;
- if (gpio_high_active)
- pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE;
-#endif //CONFIG_GPIO_WAKEUP
-
- DBG_871X_LEVEL(_drv_info_, "%s 5.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode);
- DBG_871X_LEVEL(_drv_info_, "%s 6.pwowlan_parm.index=0x%x \n",__FUNCTION__,pwowlan_parm.gpio_index);
- res = FillH2CCmd_88E(padapter, H2C_COM_WWLAN, 2, (u8 *)&pwowlan_parm);
-
- rtw_msleep_os(2);
-
- //disconnect decision
- pwowlan_parm.mode =1;
- pwowlan_parm.gpio_index=0;
- pwowlan_parm.gpio_duration=0;
- FillH2CCmd_88E(padapter, H2C_COM_DISCNT_DECISION, 3, (u8 *)&pwowlan_parm);
-
- //keep alive period = 10 * 10 BCN interval
- pwowlan_parm.mode = FW_WOWLAN_KEEP_ALIVE_EN | FW_ADOPT_USER | FW_WOWLAN_KEEP_ALIVE_PKT_TYPE;
- pwowlan_parm.gpio_index = 5;
- res = FillH2CCmd_88E(padapter, H2C_COM_KEEP_ALIVE, 2, (u8 *)&pwowlan_parm);
-
- rtw_msleep_os(2);
- //Configure STA security information for GTK rekey wakeup event.
- paoac_global_info_parm.pairwiseEncAlg =
- padapter->securitypriv.dot11PrivacyAlgrthm;
- paoac_global_info_parm.groupEncAlg =
- padapter->securitypriv.dot118021XGrpPrivacy;
- FillH2CCmd_88E(padapter, H2C_COM_AOAC_GLOBAL_INFO, 2, (u8 *)&paoac_global_info_parm);
-
- rtw_msleep_os(2);
- //enable Remote wake ctrl
- pwowlan_parm.mode = FW_REMOTE_WAKE_CTRL_EN | FW_WOW_FW_UNICAST_EN | FW_ARP_EN;
- if (psecpriv->dot11PrivacyAlgrthm == _AES_ || psecpriv->dot11PrivacyAlgrthm == _NO_PRIVACY_)
- {
- pwowlan_parm.gpio_index=0;
- } else {
- pwowlan_parm.gpio_index=1;
- }
- pwowlan_parm.gpio_duration=0;
-
- res = FillH2CCmd_88E(padapter, H2C_COM_REMOTE_WAKE_CTRL, 3, (u8 *)&pwowlan_parm);
- } else {
- pwrpriv->wowlan_magic =_FALSE;
-#ifdef CONFIG_GPIO_WAKEUP
- rtl8188es_set_output_gpio(padapter, gpio_wake_pin, !gpio_high_active);
-#endif //CONFIG_GPIO_WAKEUP
- res = FillH2CCmd_88E(padapter, H2C_COM_WWLAN, 2, (u8 *)&pwowlan_parm);
- rtw_msleep_os(2);
- res = FillH2CCmd_88E(padapter, H2C_COM_REMOTE_WAKE_CTRL, 3, (u8 *)&pwowlan_parm);
- }
-_func_exit_;
- DBG_871X_LEVEL(_drv_always_, "-%s res:%d-\n", __func__, res);
- return ;
-}
-#endif //CONFIG_WOWLAN
+ }while( (!read_down) && (retry_cnts--));
+
+ return read_down;
+
+}
+
+
+/*****************************************
+* H2C Msg format :
+* 0x1DF - 0x1D0
+*| 31 - 8 | 7-5 4 - 0 |
+*| h2c_msg |Class_ID CMD_ID |
+*
+* Extend 0x1FF - 0x1F0
+*|31 - 0 |
+*|ext_msg|
+******************************************/
+static s32 FillH2CCmd_88E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer)
+{
+ struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ u8 h2c_box_num;
+ u32 msgbox_addr;
+ u32 msgbox_ex_addr;
+ u8 cmd_idx,ext_cmd_len;
+ u32 h2c_cmd = 0;
+ u32 h2c_cmd_ex = 0;
+ s32 ret = _FAIL;
+
+_func_enter_;
+
+ padapter = GET_PRIMARY_ADAPTER(padapter);
+ pHalData = GET_HAL_DATA(padapter);
+
+ if(padapter->bFWReady == _FALSE)
+ {
+ DBG_8192C("FillH2CCmd_88E(): return H2C cmd because fw is not ready\n");
+ return ret;
+ }
+
+ _enter_critical_mutex(&(dvobj->h2c_fwcmd_mutex), NULL);
+
+ if (!pCmdBuffer) {
+ goto exit;
+ }
+ if (CmdLen > RTL88E_MAX_CMD_LEN) {
+ goto exit;
+ }
+ if (padapter->bSurpriseRemoved == _TRUE)
+ goto exit;
+
+ //pay attention to if race condition happened in H2C cmd setting.
+ do{
+ h2c_box_num = pHalData->LastHMEBoxNum;
+
+ if(!_is_fw_read_cmd_down(padapter, h2c_box_num)){
+ DBG_8192C(" fw read cmd failed...\n");
+ goto exit;
+ }
+
+ *(u8*)(&h2c_cmd) = ElementID;
+
+ if(CmdLen<=3)
+ {
+ _rtw_memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer, CmdLen );
+ }
+ else{
+ _rtw_memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer,3);
+ ext_cmd_len = CmdLen-3;
+ _rtw_memcpy((u8*)(&h2c_cmd_ex), pCmdBuffer+3,ext_cmd_len );
+
+ //Write Ext command
+ msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num *RTL88E_EX_MESSAGE_BOX_SIZE);
+ #ifdef CONFIG_H2C_EF
+ for(cmd_idx=0;cmd_idx<ext_cmd_len;cmd_idx++ ){
+ rtw_write8(padapter,msgbox_ex_addr+cmd_idx,*((u8*)(&h2c_cmd_ex)+cmd_idx));
+ }
+ #else
+ h2c_cmd_ex = le32_to_cpu( h2c_cmd_ex );
+ rtw_write32(padapter, msgbox_ex_addr, h2c_cmd_ex);
+ #endif
+ }
+ // Write command
+ msgbox_addr =REG_HMEBOX_0 + (h2c_box_num *RTL88E_MESSAGE_BOX_SIZE);
+ #ifdef CONFIG_H2C_EF
+ for(cmd_idx=0;cmd_idx<RTL88E_MESSAGE_BOX_SIZE;cmd_idx++ ){
+ rtw_write8(padapter,msgbox_addr+cmd_idx,*((u8*)(&h2c_cmd)+cmd_idx));
+ }
+ #else
+ h2c_cmd = le32_to_cpu( h2c_cmd );
+ rtw_write32(padapter,msgbox_addr, h2c_cmd);
+ #endif
+
+
+ // DBG_8192C("MSG_BOX:%d,CmdLen(%d), reg:0x%x =>h2c_cmd:0x%x, reg:0x%x =>h2c_cmd_ex:0x%x ..\n"
+ // ,pHalData->LastHMEBoxNum ,CmdLen,msgbox_addr,h2c_cmd,msgbox_ex_addr,h2c_cmd_ex);
+
+ pHalData->LastHMEBoxNum = (h2c_box_num+1) % RTL88E_MAX_H2C_BOX_NUMS;
+
+ }while(0);
+
+ ret = _SUCCESS;
+
+exit:
+
+ _exit_critical_mutex(&(dvobj->h2c_fwcmd_mutex), NULL);
+
+_func_exit_;
+
+ return ret;
+}
+
+u8 rtl8192c_h2c_msg_hdl(_adapter *padapter, unsigned char *pbuf)
+{
+ u8 ElementID, CmdLen;
+ u8 *pCmdBuffer;
+ struct cmd_msg_parm *pcmdmsg;
+
+ if(!pbuf)
+ return H2C_PARAMETERS_ERROR;
+
+ pcmdmsg = (struct cmd_msg_parm*)pbuf;
+ ElementID = pcmdmsg->eid;
+ CmdLen = pcmdmsg->sz;
+ pCmdBuffer = pcmdmsg->buf;
+
+ FillH2CCmd_88E(padapter, ElementID, CmdLen, pCmdBuffer);
+
+ return H2C_SUCCESS;
+}
+/*
+#if defined(CONFIG_AUTOSUSPEND) && defined(SUPPORT_HW_RFOFF_DETECTED)
+u8 rtl8192c_set_FwSelectSuspend_cmd(_adapter *padapter ,u8 bfwpoll, u16 period)
+{
+ u8 res=_SUCCESS;
+ struct H2C_SS_RFOFF_PARAM param;
+ DBG_8192C("==>%s bfwpoll(%x)\n",__FUNCTION__,bfwpoll);
+ param.gpio_period = period;//Polling GPIO_11 period time
+ param.ROFOn = (_TRUE == bfwpoll)?1:0;
+ FillH2CCmd_88E(padapter, SELECTIVE_SUSPEND_ROF_CMD, sizeof(param), (u8*)(&param));
+ return res;
+}
+#endif //CONFIG_AUTOSUSPEND && SUPPORT_HW_RFOFF_DETECTED
+*/
+u8 rtl8188e_set_rssi_cmd(_adapter*padapter, u8 *param)
+{
+ u8 res=_SUCCESS;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+_func_enter_;
+
+ if(pHalData->fw_ractrl == _TRUE){
+ #if 0
+ *((u32*) param ) = cpu_to_le32( *((u32*) param ) );
+
+ FillH2CCmd_88E(padapter, RSSI_SETTING_EID, 3, param);
+ #endif
+ }else{
+ DBG_8192C("==>%s fw dont support RA \n",__FUNCTION__);
+ res=_FAIL;
+ }
+
+_func_exit_;
+
+ return res;
+}
+
+u8 rtl8188e_set_raid_cmd(_adapter*padapter, u32 mask)
+{
+ u8 buf[3];
+ u8 res=_SUCCESS;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+_func_enter_;
+ if(pHalData->fw_ractrl == _TRUE){
+ _rtw_memset(buf, 0, 3);
+ mask = cpu_to_le32( mask );
+ _rtw_memcpy(buf, &mask, 3);
+
+ FillH2CCmd_88E(padapter, H2C_DM_MACID_CFG, 3, buf);
+ }else{
+ DBG_8192C("==>%s fw dont support RA \n",__FUNCTION__);
+ res=_FAIL;
+ }
+
+_func_exit_;
+
+ return res;
+
+}
+
+//bitmap[0:27] = tx_rate_bitmap
+//bitmap[28:31]= Rate Adaptive id
+//arg[0:4] = macid
+//arg[5] = Short GI
+void rtl8188e_Add_RateATid(PADAPTER pAdapter, u32 bitmap, u8* arg, u8 rssi_level)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ u8 macid, init_rate, raid, shortGIrate=_FALSE;
+
+ macid = arg[0];
+ raid = arg[1];
+ shortGIrate = arg[2];
+ init_rate = arg[3];
+
+ bitmap &=0x0fffffff;
+
+ if(rssi_level != DM_RATR_STA_INIT)
+ bitmap = ODM_Get_Rate_Bitmap(&pHalData->odmpriv, macid, bitmap, rssi_level);
+
+ if (shortGIrate==_TRUE)
+ init_rate |= BIT(6);
+
+ bitmap &= 0x0fffffff;
+
+ DBG_871X("%s=> mac_id:%d , raid:%d , ra_bitmap=0x%x, shortGIrate=0x%02x\n",
+ __FUNCTION__,macid ,raid ,bitmap, shortGIrate);
+
+
+#if(RATE_ADAPTIVE_SUPPORT == 1)
+ ODM_RA_UpdateRateInfo_8188E(
+ &(pHalData->odmpriv),
+ macid,
+ raid,
+ bitmap,
+ shortGIrate
+ );
+#endif
+
+}
+
+void rtl8188e_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode)
+{
+ SETPWRMODE_PARM H2CSetPwrMode;
+ struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
+ u8 RLBM = 0; // 0:Min, 1:Max , 2:User define
+_func_enter_;
+
+ DBG_871X("%s: Mode=%d SmartPS=%d UAPSD=%d\n", __FUNCTION__,
+ Mode, pwrpriv->smart_ps, padapter->registrypriv.uapsd_enable);
+
+ H2CSetPwrMode.AwakeInterval = 2; //DTIM = 1
+
+ switch(Mode)
+ {
+ case PS_MODE_ACTIVE:
+ H2CSetPwrMode.Mode = 0;
+ break;
+ case PS_MODE_MIN:
+ H2CSetPwrMode.Mode = 1;
+ break;
+ case PS_MODE_MAX:
+ RLBM = 1;
+ H2CSetPwrMode.Mode = 1;
+ break;
+ case PS_MODE_DTIM:
+ RLBM = 2;
+ H2CSetPwrMode.AwakeInterval = 3; //DTIM = 2
+ H2CSetPwrMode.Mode = 1;
+ break;
+ case PS_MODE_UAPSD_WMM:
+ H2CSetPwrMode.Mode = 2;
+ break;
+ default:
+ H2CSetPwrMode.Mode = 0;
+ break;
+ }
+
+ //H2CSetPwrMode.Mode = Mode;
+
+ H2CSetPwrMode.SmartPS_RLBM = (((pwrpriv->smart_ps<<4)&0xf0) | (RLBM & 0x0f));
+
+ H2CSetPwrMode.bAllQueueUAPSD = padapter->registrypriv.uapsd_enable;
+
+ if(Mode > 0)
+ {
+ H2CSetPwrMode.PwrState = 0x00;// AllON(0x0C), RFON(0x04), RFOFF(0x00)
+#ifdef CONFIG_EXT_CLK
+ H2CSetPwrMode.Mode |= BIT(7);//supporting 26M XTAL CLK_Request feature.
+#endif //CONFIG_EXT_CLK
+ }
+ else
+ H2CSetPwrMode.PwrState = 0x0C;// AllON(0x0C), RFON(0x04), RFOFF(0x00)
+
+ FillH2CCmd_88E(padapter, H2C_PS_PWR_MODE, sizeof(H2CSetPwrMode), (u8 *)&H2CSetPwrMode);
+
+
+_func_exit_;
+}
+
+void rtl8188e_set_FwMediaStatus_cmd(PADAPTER padapter, u16 mstatus_rpt )
+{
+ u8 opmode,macid;
+ u16 mst_rpt = cpu_to_le16 (mstatus_rpt);
+ u32 reg_macid_no_link = REG_MACID_NO_LINK_0;
+ opmode = (u8) mst_rpt;
+ macid = (u8)(mst_rpt >> 8) ;
+ DBG_871X("### %s: MStatus=%x MACID=%d \n", __FUNCTION__,opmode,macid);
+ FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(mst_rpt), (u8 *)&mst_rpt);
+
+ if(macid > 31){
+ macid = macid-32;
+ reg_macid_no_link = REG_MACID_NO_LINK_1;
+ }
+
+ //Delete select macid (MACID 0~63) from queue list.
+ if(opmode == 1)// 1:connect
+ {
+ rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link) & (~BIT(macid))));
+ }
+ else//0: disconnect
+ {
+ rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link)|BIT(macid)));
+ }
+
+
+
+}
+
+void ConstructBeacon(_adapter *padapter, u8 *pframe, u32 *pLength)
+{
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ u16 *fctrl;
+ u32 rate_len, pktlen;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
+ u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+
+ //DBG_871X("%s\n", __FUNCTION__);
+
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+
+ _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN);
+
+ SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
+ //pmlmeext->mgnt_seq++;
+ SetFrameSubType(pframe, WIFI_BEACON);
+
+ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
+ pktlen = sizeof (struct rtw_ieee80211_hdr_3addr);
+
+ //timestamp will be inserted by hardware
+ pframe += 8;
+ pktlen += 8;
+
+ // beacon interval: 2 bytes
+ _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2);
+
+ pframe += 2;
+ pktlen += 2;
+
+ // capability info: 2 bytes
+ _rtw_memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->IEs)), 2);
+
+ pframe += 2;
+ pktlen += 2;
+
+ if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
+ {
+ //DBG_871X("ie len=%d\n", cur_network->IELength);
+ pktlen += cur_network->IELength - sizeof(NDIS_802_11_FIXED_IEs);
+ _rtw_memcpy(pframe, cur_network->IEs+sizeof(NDIS_802_11_FIXED_IEs), pktlen);
+
+ goto _ConstructBeacon;
+ }
+
+ //below for ad-hoc mode
+
+ // SSID
+ pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pktlen);
+
+ // supported rates...
+ rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pktlen);
+
+ // DS parameter set
+ pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pktlen);
+
+ if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
+ {
+ u32 ATIMWindow;
+ // IBSS Parameter Set...
+ //ATIMWindow = cur->Configuration.ATIMWindow;
+ ATIMWindow = 0;
+ pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &pktlen);
+ }
+
+
+ //todo: ERP IE
+
+
+ // EXTERNDED SUPPORTED RATE
+ if (rate_len > 8)
+ {
+ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pktlen);
+ }
+
+
+ //todo:HT for adhoc
+
+_ConstructBeacon:
+
+ if ((pktlen + TXDESC_SIZE) > 512)
+ {
+ DBG_871X("beacon frame too large\n");
+ return;
+ }
+
+ *pLength = pktlen;
+
+ //DBG_871X("%s bcn_sz=%d\n", __FUNCTION__, pktlen);
+
+}
+
+void ConstructPSPoll(_adapter *padapter, u8 *pframe, u32 *pLength)
+{
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ u16 *fctrl;
+ u32 pktlen;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ //DBG_871X("%s\n", __FUNCTION__);
+
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+
+ // Frame control.
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+ SetPwrMgt(fctrl);
+ SetFrameSubType(pframe, WIFI_PSPOLL);
+
+ // AID.
+ SetDuration(pframe, (pmlmeinfo->aid | 0xc000));
+
+ // BSSID.
+ _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+
+ // TA.
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+
+ *pLength = 16;
+}
+
+void ConstructNullFunctionData(
+ 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_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);
+
+
+ //DBG_871X("%s:%d\n", __FUNCTION__, bForcePowerSave);
+
+ pwlanhdr = (struct rtw_ieee80211_hdr*)pframe;
+
+ fctrl = &pwlanhdr->frame_ctl;
+ *(fctrl) = 0;
+ if (bForcePowerSave)
+ {
+ SetPwrMgt(fctrl);
+ }
+
+ switch(cur_network->network.InfrastructureMode)
+ {
+ case Ndis802_11Infrastructure:
+ 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, StaAddr, ETH_ALEN);
+ break;
+ case Ndis802_11APMode:
+ SetFrDs(fctrl);
+ _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ break;
+ case Ndis802_11IBSS:
+ default:
+ _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+ break;
+ }
+
+ 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;
+}
+
+#ifdef CONFIG_WOWLAN
+//
+// Description:
+// Construct the ARP response packet to support ARP offload.
+//
+static void ConstructARPResponse(
+ PADAPTER padapter,
+ u8 *pframe,
+ u32 *pLength,
+ u8 *pIPAddress
+ )
+{
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ 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 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06};
+
+ u16 *fctrl;
+ u32 pktlen;
+ u8 *pARPRspPkt = pframe;
+ //for TKIP Cal MIC
+ u8 *payload = pframe;
+ u8 EncryptionHeadOverhead = 0;
+
+ 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);
+ //SET_80211_HDR_FRAME_CONTROL(pARPRspPkt, 0);
+ //SET_80211_HDR_TYPE_AND_SUBTYPE(pARPRspPkt, Type_Data);
+ //SET_80211_HDR_TO_DS(pARPRspPkt, 1);
+ //SET_80211_HDR_ADDRESS1(pARPRspPkt, pMgntInfo->Bssid);
+ //SET_80211_HDR_ADDRESS2(pARPRspPkt, Adapter->CurrentAddress);
+ //SET_80211_HDR_ADDRESS3(pARPRspPkt, pMgntInfo->Bssid);
+
+ //SET_80211_HDR_DURATION(pARPRspPkt, 0);
+ //SET_80211_HDR_FRAGMENT_SEQUENCE(pARPRspPkt, 0);
+#ifdef CONFIG_WAPI_SUPPORT
+ *pLength = sMacHdrLng;
+#else
+ *pLength = 24;
+#endif
+
+
+//YJ,del,120503
+#if 0
+ //-------------------------------------------------------------------------
+ // Qos Header: leave space for it if necessary.
+ //-------------------------------------------------------------------------
+ if(pStaQos->CurrentQosMode > QOS_DISABLE)
+ {
+ SET_80211_HDR_QOS_EN(pARPRspPkt, 1);
+ PlatformZeroMemory(&(Buffer[*pLength]), sQoSCtlLng);
+ *pLength += sQoSCtlLng;
+ }
+#endif
+ //-------------------------------------------------------------------------
+ // Security Header: leave space for it if necessary.
+ //-------------------------------------------------------------------------
+
+ 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
+ default:
+ EncryptionHeadOverhead = 0;
+ }
+
+ if(EncryptionHeadOverhead > 0)
+ {
+ _rtw_memset(&(pframe[*pLength]), 0,EncryptionHeadOverhead);
+ *pLength += EncryptionHeadOverhead;
+ //SET_80211_HDR_WEP(pARPRspPkt, 1); //Suggested by CCW.
+ SetPrivacy(fctrl);
+ }
+
+ //-------------------------------------------------------------------------
+ // Frame Body.
+ //-------------------------------------------------------------------------
+ pARPRspPkt = (u8*)(pframe+ *pLength);
+ // LLC header
+ _rtw_memcpy(pARPRspPkt, ARPLLCHeader, 8);
+ *pLength += 8;
+
+ // ARP element
+ pARPRspPkt += 8;
+ SET_ARP_PKT_HW(pARPRspPkt, 0x0100);
+ SET_ARP_PKT_PROTOCOL(pARPRspPkt, 0x0008); // IP protocol
+ SET_ARP_PKT_HW_ADDR_LEN(pARPRspPkt, 6);
+ SET_ARP_PKT_PROTOCOL_ADDR_LEN(pARPRspPkt, 4);
+ SET_ARP_PKT_OPERATION(pARPRspPkt, 0x0200); // ARP response
+ SET_ARP_PKT_SENDER_MAC_ADDR(pARPRspPkt, myid(&(padapter->eeprompriv)));
+ SET_ARP_PKT_SENDER_IP_ADDR(pARPRspPkt, pIPAddress);
+ #ifdef CONFIG_ARP_KEEP_ALIVE
+ if (rtw_gw_addr_query(padapter)==0) {
+ SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, pmlmepriv->gw_mac_addr);
+ SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pmlmepriv->gw_ip);
+ }
+ else
+#endif
+ {
+ SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, get_my_bssid(&(pmlmeinfo->network)));
+ SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pIPAddress);
+ DBG_871X("%s Target Mac Addr:" MAC_FMT "\n", __FUNCTION__, MAC_ARG(get_my_bssid(&(pmlmeinfo->network))));
+ DBG_871X("%s Target IP Addr" IP_FMT "\n", __FUNCTION__, IP_ARG(pIPAddress));
+ }
+ *pLength += 28;
+ if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_)
+ {
+ u8 mic[8];
+ struct mic_data micdata;
+ struct sta_info *psta = NULL;
+ u8 priority[4]={0x0,0x0,0x0,0x0};
+ u8 null_key[16]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
+
+ DBG_871X("%s(): Add MIC\n",__FUNCTION__);
+
+ psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network)));
+ if (psta != NULL) {
+ if(_rtw_memcmp(&psta->dot11tkiptxmickey.skey[0],null_key, 16)==_TRUE){
+ DBG_871X("%s(): STA dot11tkiptxmickey==0\n",__FUNCTION__);
+ }
+ //start to calculate the mic code
+ rtw_secmicsetkey(&micdata, &psta->dot11tkiptxmickey.skey[0]);
+ }
+
+ rtw_secmicappend(&micdata, pwlanhdr->addr3, 6); //DA
+
+ rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); //SA
+
+ priority[0]=0;
+ rtw_secmicappend(&micdata, &priority[0], 4);
+
+ rtw_secmicappend(&micdata, payload, 36); //payload length = 8 + 28
+
+ rtw_secgetmic(&micdata,&(mic[0]));
+
+ pARPRspPkt += 28;
+ _rtw_memcpy(pARPRspPkt, &(mic[0]),8);
+
+ *pLength += 8;
+ }
+}
+#endif
+
+void ConstructProbeRsp(_adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, BOOLEAN bHideSSID)
+{
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ u16 *fctrl;
+ u8 *mac, *bssid;
+ u32 pktlen;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
+
+
+ //DBG_871X("%s\n", __FUNCTION__);
+
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+
+ mac = myid(&(padapter->eeprompriv));
+ bssid = cur_network->MacAddress;
+
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+ _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, bssid, ETH_ALEN);
+
+ SetSeqNum(pwlanhdr, 0);
+ SetFrameSubType(fctrl, WIFI_PROBERSP);
+
+ pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+ pframe += pktlen;
+
+ if(cur_network->IELength>MAX_IE_SZ)
+ return;
+
+ _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength);
+ pframe += cur_network->IELength;
+ pktlen += cur_network->IELength;
+
+ *pLength = pktlen;
+}
+
+void rtl8188e_set_FwRsvdPage_cmd(PADAPTER padapter, PRSVDPAGE_LOC rsvdpageloc)
+{
+ u8 u1H2CRsvdPageParm[H2C_RSVDPAGE_LOC_LEN]={0};
+ u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN]={0};
+
+ //DBG_871X("8188RsvdPageLoc: PsPoll=%d Null=%d QoSNull=%d\n",
+ // rsvdpageloc->LocPsPoll, rsvdpageloc->LocNullData, rsvdpageloc->LocQosNull);
+
+ SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1H2CRsvdPageParm, rsvdpageloc->LocPsPoll);
+ SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1H2CRsvdPageParm, rsvdpageloc->LocNullData);
+ SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1H2CRsvdPageParm, rsvdpageloc->LocQosNull);
+
+ FillH2CCmd_88E(padapter, H2C_COM_RSVD_PAGE, H2C_RSVDPAGE_LOC_LEN, u1H2CRsvdPageParm);
+
+#ifdef CONFIG_WOWLAN
+ //DBG_871X("8188E_AOACRsvdPageLoc: RWC=%d ArpRsp=%d\n", rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp);
+ SET_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocRemoteCtrlInfo);
+ SET_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocArpRsp);
+
+ FillH2CCmd_88E(padapter, H2C_COM_AOAC_RSVD_PAGE, H2C_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm);
+#endif
+}
+
+// To check if reserved page content is destroyed by beacon beacuse beacon is too large.
+// 2010.06.23. Added by tynli.
+VOID
+CheckFwRsvdPageContent(
+ IN PADAPTER Adapter
+)
+{
+ HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter);
+ u32 MaxBcnPageNum;
+
+ if(pHalData->FwRsvdPageStartOffset != 0)
+ {
+ /*MaxBcnPageNum = PageNum_128(pMgntInfo->MaxBeaconSize);
+ RT_ASSERT((MaxBcnPageNum <= pHalData->FwRsvdPageStartOffset),
+ ("CheckFwRsvdPageContent(): The reserved page content has been"\
+ "destroyed by beacon!!! MaxBcnPageNum(%d) FwRsvdPageStartOffset(%d)\n!",
+ MaxBcnPageNum, pHalData->FwRsvdPageStartOffset));*/
+ }
+}
+
+//
+// Description: Fill the reserved packets that FW will use to RSVD page.
+// Now we just send 4 types packet to rsvd page.
+// (1)Beacon, (2)Ps-poll, (3)Null data, (4)ProbeRsp.
+// Input:
+// bDLFinished - FALSE: At the first time we will send all the packets as a large packet to Hw,
+// so we need to set the packet length to total lengh.
+// TRUE: At the second time, we should send the first packet (default:beacon)
+// to Hw again and set the lengh in descriptor to the real beacon lengh.
+// 2009.10.15 by tynli.
+static void SetFwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished)
+{
+ 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;
+ u32 BeaconLength, ProbeRspLength, PSPollLength;
+ u32 NullDataLength, QosNullLength, BTQosNullLength;
+ u8 *ReservedPagePacket;
+ u8 RsvdPageNum = 0;
+ u8 PageNum, PageNeed, TxDescLen;
+ u16 BufIndex, PageSize = 128;
+ u32 TotalPacketLen, MaxRsvdPageBufSize=0;
+ RSVDPAGE_LOC RsvdPageLoc;
+#ifdef CONFIG_WOWLAN
+ u32 ARPLegnth = 0;
+ struct security_priv *psecuritypriv = &padapter->securitypriv; //added by xx
+ u8 currentip[4];
+ u8 cur_dot11txpn[8];
+#endif
+
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+
+#ifdef CONFIG_WOWLAN
+ RsvdPageNum = BCNQ_PAGE_NUM_88E + WOWLAN_PAGE_NUM_88E;
+#else
+ RsvdPageNum = BCNQ_PAGE_NUM_88E;
+#endif
+ printk("RsvdPageNum: %d\n", RsvdPageNum);
+
+ MaxRsvdPageBufSize = RsvdPageNum*PageSize;
+
+ ReservedPagePacket = (u8*)rtw_zmalloc(MaxRsvdPageBufSize);
+
+ if (ReservedPagePacket == NULL) {
+ DBG_871X("%s: alloc ReservedPagePacket fail!\n", __FUNCTION__);
+ }
+
+ pHalData = GET_HAL_DATA(padapter);
+ pxmitpriv = &padapter->xmitpriv;
+ pmlmeext = &padapter->mlmeextpriv;
+ pmlmeinfo = &pmlmeext->mlmext_info;
+
+ TxDescLen = TXDESC_SIZE;
+ PageNum = 0;
+
+ //3 (1) beacon * 2 pages
+ BufIndex = TXDESC_OFFSET;
+ ConstructBeacon(padapter, &ReservedPagePacket[BufIndex], &BeaconLength);
+
+ // When we count the first page size, we need to reserve description size for the RSVD
+ // packet, it will be filled in front of the packet in TXPKTBUF.
+ PageNeed = (u8)PageNum_128(TxDescLen + BeaconLength);
+ // To reserved 2 pages for beacon buffer. 2010.06.24.
+ if (PageNeed == 1)
+ PageNeed += 1;
+ PageNum += PageNeed;
+ pHalData->FwRsvdPageStartOffset = PageNum;
+
+ BufIndex += PageNeed * PageSize;
+
+ //3 (2) ps-poll *1 page
+ RsvdPageLoc.LocPsPoll = PageNum;
+ ConstructPSPoll(padapter, &ReservedPagePacket[BufIndex], &PSPollLength);
+ rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], PSPollLength, _TRUE, _FALSE);
+
+ PageNeed = (u8)PageNum_128(TxDescLen + PSPollLength);
+ PageNum += PageNeed;
+
+ BufIndex += PageNeed * PageSize;
+
+ //3 (3) null data * 1 page
+ RsvdPageLoc.LocNullData = PageNum;
+ ConstructNullFunctionData(
+ padapter,
+ &ReservedPagePacket[BufIndex],
+ &NullDataLength,
+ get_my_bssid(&pmlmeinfo->network),
+ _FALSE, 0, 0, _FALSE);
+ rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], NullDataLength, _FALSE, _FALSE);
+
+ PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength);
+ PageNum += PageNeed;
+
+ BufIndex += PageNeed * PageSize;
+
+ //3 (5) Qos null data
+ RsvdPageLoc.LocQosNull = PageNum;
+ ConstructNullFunctionData(
+ padapter,
+ &ReservedPagePacket[BufIndex],
+ &QosNullLength,
+ get_my_bssid(&pmlmeinfo->network),
+ _TRUE, 0, 0, _FALSE);
+ rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], QosNullLength, _FALSE, _FALSE);
+
+ PageNeed = (u8)PageNum_128(TxDescLen + QosNullLength);
+ PageNum += PageNeed;
+
+ BufIndex += PageNeed * PageSize;
+
+/*
+ //3 (6) BT Qos null data
+ RsvdPageLoc.LocBTQosNull = PageNum;
+ ConstructNullFunctionData(
+ padapter,
+ &ReservedPagePacket[BufIndex],
+ &BTQosNullLength,
+ get_my_bssid(&pmlmeinfo->network),
+ _TRUE, 0, 0, _FALSE);
+ rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, _FALSE, _TRUE);
+
+ TotalPacketLen = BufIndex + BTQosNullLength;
+*/
+
+#ifdef CONFIG_WOWLAN
+ //3(7) ARP
+ rtw_get_current_ip_address(padapter, currentip);
+ RsvdPageLoc.LocArpRsp = PageNum;
+ ConstructARPResponse(
+ padapter,
+ &ReservedPagePacket[BufIndex],
+ &ARPLegnth,
+ currentip
+ );
+ rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ARPLegnth, _FALSE, _FALSE);
+
+ PageNeed = (u8)PageNum_128(TxDescLen + ARPLegnth);
+ PageNum += PageNeed;
+
+ BufIndex += PageNeed * PageSize;
+
+ //3(8) sec IV
+ rtw_get_sec_iv(padapter, cur_dot11txpn, get_my_bssid(&pmlmeinfo->network));
+ RsvdPageLoc.LocRemoteCtrlInfo = PageNum;
+ _rtw_memcpy(ReservedPagePacket+BufIndex-TxDescLen, cur_dot11txpn, 8);
+
+ TotalPacketLen = BufIndex-TxDescLen + sizeof (union pn48); //IV len
+#else
+ TotalPacketLen = BufIndex + QosNullLength;
+#endif
+
+ pcmdframe = alloc_mgtxmitframe(pxmitpriv);
+ if (pcmdframe == NULL)
+ goto exit;
+
+ // update attribute
+ pattrib = &pcmdframe->attrib;
+ update_mgntframe_attrib(padapter, pattrib);
+ pattrib->qsel = 0x10;
+ pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET;
+
+ if (TotalPacketLen < MaxRsvdPageBufSize)
+ _rtw_memcpy(pcmdframe->buf_addr, ReservedPagePacket, TotalPacketLen);
+ else
+ DBG_871X("%s: memory copy fail at Line:%d\n", __FUNCTION__, __LINE__);
+
+ rtw_hal_mgnt_xmit(padapter, pcmdframe);
+
+ DBG_871X("%s: Set RSVD page location to Fw ,TotalPacketLen(%d)\n", __FUNCTION__,TotalPacketLen);
+ rtl8188e_set_FwRsvdPage_cmd(padapter, &RsvdPageLoc);
+exit:
+ rtw_mfree(ReservedPagePacket, MaxRsvdPageBufSize);
+}
+
+void rtl8188e_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus)
+{
+ JOINBSSRPT_PARM_88E JoinBssRptParm;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+#ifdef CONFIG_WOWLAN
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct sta_info *psta = NULL;
+#endif
+ BOOLEAN bSendBeacon=_FALSE;
+ BOOLEAN bcn_valid = _FALSE;
+ u8 DLBcnCount=0;
+ u32 poll = 0;
+
+_func_enter_;
+
+ DBG_871X("%s mstatus(%x)\n", __FUNCTION__,mstatus);
+
+ if(mstatus == 1)
+ {
+ // 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));
+ // Do not set TSF again here or vWiFi beacon DMA INT will not work.
+ //correct_TSF(padapter, pmlmeext);
+ // Hw sequende enable by dedault. 2010.06.23. by tynli.
+ //rtw_write16(padapter, REG_NQOS_SEQ, ((pmlmeext->mgnt_seq+100)&0xFFF));
+ //rtw_write8(padapter, REG_HWSEQ_CTRL, 0xFF);
+
+ //Set REG_CR bit 8. DMA beacon by SW.
+ pHalData->RegCR_1 |= BIT0;
+ rtw_write8(padapter, REG_CR+1, pHalData->RegCR_1);
+
+ // 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.
+ //SetBcnCtrlReg(padapter, 0, BIT3);
+ //SetBcnCtrlReg(padapter, BIT4, 0);
+ rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(3)));
+ rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(4));
+
+ if(pHalData->RegFwHwTxQCtrl&BIT6)
+ {
+ DBG_871X("HalDownloadRSVDPage(): There is an Adapter is sending beacon.\n");
+ bSendBeacon = _TRUE;
+ }
+
+ // Set FWHW_TXQ_CTRL 0x422[6]=0 to tell Hw the packet is not a real beacon frame.
+ rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl&(~BIT6)));
+ pHalData->RegFwHwTxQCtrl &= (~BIT6);
+
+ // Clear beacon valid check bit.
+ rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL);
+ DLBcnCount = 0;
+ poll = 0;
+ do
+ {
+ // download rsvd page.
+ SetFwRsvdPagePkt(padapter, _FALSE);
+ 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);
+
+ //RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage88ES(): 1 Download RSVD page failed!\n"));
+ if(padapter->bSurpriseRemoved || padapter->bDriverStopped)
+ {
+ }
+ else if(!bcn_valid)
+ DBG_871X(ADPT_FMT": 1 DL RSVD page failed! DLBcnCount:%u, poll:%u\n",
+ ADPT_ARG(padapter) ,DLBcnCount, poll);
+ else {
+ struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
+ pwrctl->fw_psmode_iface_id = padapter->iface_id;
+ DBG_871X(ADPT_FMT": 1 DL RSVD page success! DLBcnCount:%u, poll:%u\n",
+ ADPT_ARG(padapter), DLBcnCount, poll);
+ }
+ //
+ // We just can send the reserved page twice during the time that Tx thread is stopped (e.g. pnpsetpower)
+ // becuase we need to free the Tx BCN Desc which is used by the first reserved page packet.
+ // At run time, we cannot get the Tx Desc until it is released in TxHandleInterrupt() so we will return
+ // the beacon TCB in the following code. 2011.11.23. by tynli.
+ //
+ //if(bcn_valid && padapter->bEnterPnpSleep)
+ if(0)
+ {
+ if(bSendBeacon)
+ {
+ rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL);
+ DLBcnCount = 0;
+ poll = 0;
+ do
+ {
+ SetFwRsvdPagePkt(padapter, _TRUE);
+ 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);
+
+ //RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage(): 2 Download RSVD page failed!\n"));
+ if(padapter->bSurpriseRemoved || padapter->bDriverStopped)
+ {
+ }
+ else if(!bcn_valid)
+ DBG_871X("%s: 2 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __FUNCTION__ ,DLBcnCount, poll);
+ else
+ DBG_871X("%s: 2 Download RSVD success! DLBcnCount:%u, poll:%u\n", __FUNCTION__, DLBcnCount, poll);
+ }
+ }
+
+ // Enable Bcn
+ //SetBcnCtrlReg(padapter, BIT3, 0);
+ //SetBcnCtrlReg(padapter, 0, BIT4);
+ rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(3));
+ rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(4)));
+
+ // To make sure that if there exists an adapter which would like to send beacon.
+ // If exists, the origianl value of 0x422[6] will be 1, we should check this to
+ // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause
+ // the beacon cannot be sent by HW.
+ // 2010.06.23. Added by tynli.
+ if(bSendBeacon)
+ {
+ rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl|BIT6));
+ pHalData->RegFwHwTxQCtrl |= BIT6;
+ }
+
+ //
+ // Update RSVD page location H2C to Fw.
+ //
+ if(bcn_valid)
+ {
+ rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL);
+ DBG_871X("Set RSVD page location to Fw.\n");
+ //FillH2CCmd88E(Adapter, H2C_88E_RSVDPAGE, H2C_RSVDPAGE_LOC_LENGTH, pMgntInfo->u1RsvdPageLoc);
+ }
+
+ // Do not enable HW DMA BCN or it will cause Pcie interface hang by timing issue. 2011.11.24. by tynli.
+ //if(!padapter->bEnterPnpSleep)
+ {
+ // Clear CR[8] or beacon packet will not be send to TxBuf anymore.
+ pHalData->RegCR_1 &= (~BIT0);
+ rtw_write8(padapter, REG_CR+1, pHalData->RegCR_1);
+ }
+ }
+#ifdef CONFIG_WOWLAN
+ if (adapter_to_pwrctl(padapter)->wowlan_mode){
+ JoinBssRptParm.OpMode = mstatus;
+ psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv));
+ if (psta != NULL) {
+ JoinBssRptParm.MacID = psta->mac_id;
+ } else {
+ JoinBssRptParm.MacID = 0;
+ }
+ FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(JoinBssRptParm), (u8 *)&JoinBssRptParm);
+ DBG_871X_LEVEL(_drv_info_, "%s opmode:%d MacId:%d\n", __func__, JoinBssRptParm.OpMode, JoinBssRptParm.MacID);
+ } else {
+ DBG_871X_LEVEL(_drv_info_, "%s wowlan_mode is off\n", __func__);
+ }
+#endif //CONFIG_WOWLAN
+_func_exit_;
+}
+
+#ifdef CONFIG_P2P_PS
+void rtl8188e_set_p2p_ps_offload_cmd(_adapter* padapter, u8 p2p_ps_state)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
+ struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
+ struct P2P_PS_Offload_t *p2p_ps_offload = (struct P2P_PS_Offload_t *)(&pHalData->p2p_ps_offload);
+ u8 i;
+
+_func_enter_;
+
+#if 1
+ switch(p2p_ps_state)
+ {
+ case P2P_PS_DISABLE:
+ DBG_8192C("P2P_PS_DISABLE \n");
+ _rtw_memset(p2p_ps_offload, 0 ,1);
+ break;
+ case P2P_PS_ENABLE:
+ DBG_8192C("P2P_PS_ENABLE \n");
+ // update CTWindow value.
+ if( pwdinfo->ctwindow > 0 )
+ {
+ p2p_ps_offload->CTWindow_En = 1;
+ rtw_write8(padapter, REG_P2P_CTWIN, pwdinfo->ctwindow);
+ }
+
+ // hw only support 2 set of NoA
+ for( i=0 ; i<pwdinfo->noa_num ; i++)
+ {
+ // To control the register setting for which NOA
+ rtw_write8(padapter, REG_NOA_DESC_SEL, (i << 4));
+ if(i == 0)
+ p2p_ps_offload->NoA0_En = 1;
+ else
+ p2p_ps_offload->NoA1_En = 1;
+
+ // config P2P NoA Descriptor Register
+ //DBG_8192C("%s(): noa_duration = %x\n",__FUNCTION__,pwdinfo->noa_duration[i]);
+ rtw_write32(padapter, REG_NOA_DESC_DURATION, pwdinfo->noa_duration[i]);
+
+ //DBG_8192C("%s(): noa_interval = %x\n",__FUNCTION__,pwdinfo->noa_interval[i]);
+ rtw_write32(padapter, REG_NOA_DESC_INTERVAL, pwdinfo->noa_interval[i]);
+
+ //DBG_8192C("%s(): start_time = %x\n",__FUNCTION__,pwdinfo->noa_start_time[i]);
+ rtw_write32(padapter, REG_NOA_DESC_START, pwdinfo->noa_start_time[i]);
+
+ //DBG_8192C("%s(): noa_count = %x\n",__FUNCTION__,pwdinfo->noa_count[i]);
+ rtw_write8(padapter, REG_NOA_DESC_COUNT, pwdinfo->noa_count[i]);
+ }
+
+ if( (pwdinfo->opp_ps == 1) || (pwdinfo->noa_num > 0) )
+ {
+ // rst p2p circuit
+ rtw_write8(padapter, REG_DUAL_TSF_RST, BIT(4));
+
+ p2p_ps_offload->Offload_En = 1;
+
+ if(pwdinfo->role == P2P_ROLE_GO)
+ {
+ p2p_ps_offload->role= 1;
+ p2p_ps_offload->AllStaSleep = 0;
+ }
+ else
+ {
+ p2p_ps_offload->role= 0;
+ }
+
+ p2p_ps_offload->discovery = 0;
+ }
+ break;
+ case P2P_PS_SCAN:
+ DBG_8192C("P2P_PS_SCAN \n");
+ p2p_ps_offload->discovery = 1;
+ break;
+ case P2P_PS_SCAN_DONE:
+ DBG_8192C("P2P_PS_SCAN_DONE \n");
+ p2p_ps_offload->discovery = 0;
+ pwdinfo->p2p_ps_state = P2P_PS_ENABLE;
+ break;
+ default:
+ break;
+ }
+
+ FillH2CCmd_88E(padapter, H2C_PS_P2P_OFFLOAD, 1, (u8 *)p2p_ps_offload);
+#endif
+
+_func_exit_;
+
+}
+#endif //CONFIG_P2P_PS
+
+#ifdef CONFIG_TSF_RESET_OFFLOAD
+/*
+ ask FW to Reset sync register at Beacon early interrupt
+*/
+u8 rtl8188e_reset_tsf(_adapter *padapter, u8 reset_port )
+{
+ u8 buf[2];
+ u8 res=_SUCCESS;
+
+ s32 ret;
+_func_enter_;
+ if (IFACE_PORT0==reset_port) {
+ buf[0] = 0x1; buf[1] = 0;
+ } else{
+ buf[0] = 0x0; buf[1] = 0x1;
+ }
+
+ ret = FillH2CCmd_88E(padapter, H2C_RESET_TSF, 2, buf);
+
+_func_exit_;
+
+ return res;
+}
+
+int reset_tsf(PADAPTER Adapter, u8 reset_port )
+{
+ u8 reset_cnt_before = 0, reset_cnt_after = 0, loop_cnt = 0;
+ u32 reg_reset_tsf_cnt = (IFACE_PORT0==reset_port) ?
+ REG_FW_RESET_TSF_CNT_0:REG_FW_RESET_TSF_CNT_1;
+ u32 reg_bcncrtl = (IFACE_PORT0==reset_port) ?
+ REG_BCN_CTRL_1:REG_BCN_CTRL;
+
+ rtw_scan_abort(Adapter->pbuddy_adapter); /* site survey will cause reset_tsf fail */
+ reset_cnt_after = reset_cnt_before = rtw_read8(Adapter,reg_reset_tsf_cnt);
+ rtl8188e_reset_tsf(Adapter, reset_port);
+
+ while ((reset_cnt_after == reset_cnt_before ) && (loop_cnt < 10)) {
+ rtw_msleep_os(100);
+ loop_cnt++;
+ reset_cnt_after = rtw_read8(Adapter, reg_reset_tsf_cnt);
+ }
+
+ return(loop_cnt >= 10) ? _FAIL : _TRUE;
+}
+
+
+#endif // CONFIG_TSF_RESET_OFFLOAD
+
+#ifdef CONFIG_WOWLAN
+#ifdef CONFIG_GPIO_WAKEUP
+void rtl8188es_set_output_gpio(_adapter* padapter, u8 index, u8 outputval)
+{
+ if ( index <= 7 ) {
+ /* config GPIO mode */
+ rtw_write8(padapter, REG_GPIO_PIN_CTRL + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 3) & ~BIT(index) );
+
+ /* config GPIO Sel */
+ /* 0: input */
+ /* 1: output */
+ rtw_write8(padapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 2) | BIT(index));
+
+ /* set output value */
+ if ( outputval ) {
+ rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) | BIT(index));
+ } else {
+ rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(index));
+ }
+ } else {
+ /* 88C Series: */
+ /* index: 11~8 transform to 3~0 */
+ /* 8723 Series: */
+ /* index: 12~8 transform to 4~0 */
+ index -= 8;
+
+ /* config GPIO mode */
+ rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 3) & ~BIT(index) );
+
+ /* config GPIO Sel */
+ /* 0: input */
+ /* 1: output */
+ rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 2) | BIT(index));
+
+ /* set output value */
+ if ( outputval ) {
+ rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) | BIT(index));
+ } else {
+ rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) & ~BIT(index));
+ }
+ }
+}
+#endif //CONFIG_GPIO_WAKEUP
+
+void rtl8188es_set_wowlan_cmd(_adapter* padapter, u8 enable)
+{
+ u8 res=_SUCCESS;
+ u32 test=0;
+ struct recv_priv *precvpriv = &padapter->recvpriv;
+ SETWOWLAN_PARM pwowlan_parm;
+ SETAOAC_GLOBAL_INFO paoac_global_info_parm;
+ struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
+ struct security_priv *psecpriv = &padapter->securitypriv;
+#ifdef CONFIG_GPIO_WAKEUP
+ u8 gpio_wake_pin = 7;
+ u8 gpio_high_active = 0; //default low active
+#endif
+
+_func_enter_;
+ DBG_871X_LEVEL(_drv_always_, "+%s+\n", __func__);
+
+ pwowlan_parm.mode =0;
+ pwowlan_parm.gpio_index=0;
+ pwowlan_parm.gpio_duration=0;
+ pwowlan_parm.second_mode =0;
+ pwowlan_parm.reserve=0;
+
+ if(enable){
+
+ pwowlan_parm.mode |=FW_WOWLAN_FUN_EN;
+ pwrpriv->wowlan_magic =_TRUE;
+ if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_)
+ pwrpriv->wowlan_unicast =_TRUE;
+
+ if(pwrpriv->wowlan_pattern ==_TRUE){
+ pwowlan_parm.mode |= FW_WOWLAN_PATTERN_MATCH;
+ DBG_871X_LEVEL(_drv_info_, "%s 2.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
+ }
+ if(pwrpriv->wowlan_magic ==_TRUE){
+ pwowlan_parm.mode |=FW_WOWLAN_MAGIC_PKT;
+ DBG_871X_LEVEL(_drv_info_, "%s 3.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
+ }
+ if(pwrpriv->wowlan_unicast ==_TRUE){
+ pwowlan_parm.mode |=FW_WOWLAN_UNICAST;
+ DBG_871X_LEVEL(_drv_info_, "%s 4.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
+ }
+
+ pwowlan_parm.mode |=FW_WOWLAN_REKEY_WAKEUP;
+ pwowlan_parm.mode |=FW_WOWLAN_DEAUTH_WAKEUP;
+
+ //DataPinWakeUp
+#ifdef CONFIG_USB_HCI
+ pwowlan_parm.gpio_index=0x0;
+#endif //CONFIG_USB_HCI
+
+#ifdef CONFIG_SDIO_HCI
+ pwowlan_parm.gpio_index = 0x80;
+#endif //CONFIG_SDIO_HCI
+
+#ifdef CONFIG_GPIO_WAKEUP
+ pwowlan_parm.gpio_index = gpio_wake_pin;
+
+ //WOWLAN_GPIO_ACTIVE means GPIO high active
+ //pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE;
+ if (gpio_high_active)
+ pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE;
+#endif //CONFIG_GPIO_WAKEUP
+
+ DBG_871X_LEVEL(_drv_info_, "%s 5.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode);
+ DBG_871X_LEVEL(_drv_info_, "%s 6.pwowlan_parm.index=0x%x \n",__FUNCTION__,pwowlan_parm.gpio_index);
+ res = FillH2CCmd_88E(padapter, H2C_COM_WWLAN, 2, (u8 *)&pwowlan_parm);
+
+ rtw_msleep_os(2);
+
+ //disconnect decision
+ pwowlan_parm.mode =1;
+ pwowlan_parm.gpio_index=0;
+ pwowlan_parm.gpio_duration=0;
+ FillH2CCmd_88E(padapter, H2C_COM_DISCNT_DECISION, 3, (u8 *)&pwowlan_parm);
+
+ //keep alive period = 10 * 10 BCN interval
+ pwowlan_parm.mode = FW_WOWLAN_KEEP_ALIVE_EN | FW_ADOPT_USER | FW_WOWLAN_KEEP_ALIVE_PKT_TYPE;
+ pwowlan_parm.gpio_index = 5;
+ res = FillH2CCmd_88E(padapter, H2C_COM_KEEP_ALIVE, 2, (u8 *)&pwowlan_parm);
+
+ rtw_msleep_os(2);
+ //Configure STA security information for GTK rekey wakeup event.
+ paoac_global_info_parm.pairwiseEncAlg =
+ padapter->securitypriv.dot11PrivacyAlgrthm;
+ paoac_global_info_parm.groupEncAlg =
+ padapter->securitypriv.dot118021XGrpPrivacy;
+ FillH2CCmd_88E(padapter, H2C_COM_AOAC_GLOBAL_INFO, 2, (u8 *)&paoac_global_info_parm);
+
+ rtw_msleep_os(2);
+ //enable Remote wake ctrl
+ pwowlan_parm.mode = FW_REMOTE_WAKE_CTRL_EN | FW_WOW_FW_UNICAST_EN | FW_ARP_EN;
+ if (psecpriv->dot11PrivacyAlgrthm == _AES_ || psecpriv->dot11PrivacyAlgrthm == _NO_PRIVACY_)
+ {
+ pwowlan_parm.gpio_index=0;
+ } else {
+ pwowlan_parm.gpio_index=1;
+ }
+ pwowlan_parm.gpio_duration=0;
+
+ res = FillH2CCmd_88E(padapter, H2C_COM_REMOTE_WAKE_CTRL, 3, (u8 *)&pwowlan_parm);
+ } else {
+ pwrpriv->wowlan_magic =_FALSE;
+#ifdef CONFIG_GPIO_WAKEUP
+ rtl8188es_set_output_gpio(padapter, gpio_wake_pin, !gpio_high_active);
+#endif //CONFIG_GPIO_WAKEUP
+ res = FillH2CCmd_88E(padapter, H2C_COM_WWLAN, 2, (u8 *)&pwowlan_parm);
+ rtw_msleep_os(2);
+ res = FillH2CCmd_88E(padapter, H2C_COM_REMOTE_WAKE_CTRL, 3, (u8 *)&pwowlan_parm);
+ }
+_func_exit_;
+ DBG_871X_LEVEL(_drv_always_, "-%s res:%d-\n", __func__, res);
+ return ;
+}
+#endif //CONFIG_WOWLAN
diff --git a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_dm.c b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_dm.c
index dc96677..d545ecc 100755
--- a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_dm.c
+++ b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_dm.c
@@ -1,628 +1,630 @@
-/******************************************************************************
- *
- * 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
- *
- *
- ******************************************************************************/
-//============================================================
-// Description:
-//
-// This file is for 92CE/92CU dynamic mechanism only
-//
-//
-//============================================================
-#define _RTL8188E_DM_C_
-
-//============================================================
-// include files
-//============================================================
-#include <drv_types.h>
-#include <rtl8188e_hal.h>
-
-//============================================================
-// Global var
-//============================================================
-
-
-static VOID
-dm_CheckProtection(
- IN PADAPTER Adapter
- )
-{
-#if 0
- PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
- u1Byte CurRate, RateThreshold;
-
- if(pMgntInfo->pHTInfo->bCurBW40MHz)
- RateThreshold = MGN_MCS1;
- else
- RateThreshold = MGN_MCS3;
-
- if(Adapter->TxStats.CurrentInitTxRate <= RateThreshold)
- {
- pMgntInfo->bDmDisableProtect = TRUE;
- DbgPrint("Forced disable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
- }
- else
- {
- pMgntInfo->bDmDisableProtect = FALSE;
- DbgPrint("Enable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
- }
-#endif
-}
-
-static VOID
-dm_CheckStatistics(
- IN PADAPTER Adapter
- )
-{
-#if 0
- if(!Adapter->MgntInfo.bMediaConnect)
- return;
-
- //2008.12.10 tynli Add for getting Current_Tx_Rate_Reg flexibly.
- rtw_hal_get_hwreg( Adapter, HW_VAR_INIT_TX_RATE, (pu1Byte)(&Adapter->TxStats.CurrentInitTxRate) );
-
- // Calculate current Tx Rate(Successful transmited!!)
-
- // Calculate current Rx Rate(Successful received!!)
-
- //for tx tx retry count
- rtw_hal_get_hwreg( Adapter, HW_VAR_RETRY_COUNT, (pu1Byte)(&Adapter->TxStats.NumTxRetryCount) );
-#endif
-}
-
-#ifdef CONFIG_SUPPORT_HW_WPS_PBC
-static void dm_CheckPbcGPIO(_adapter *padapter)
-{
- u8 tmp1byte;
- u8 bPbcPressed = _FALSE;
-
- if(!padapter->registrypriv.hw_wps_pbc)
- return;
-
-#ifdef CONFIG_USB_HCI
- tmp1byte = rtw_read8(padapter, GPIO_IO_SEL);
- tmp1byte |= (HAL_8188E_HW_GPIO_WPS_BIT);
- rtw_write8(padapter, GPIO_IO_SEL, tmp1byte); //enable GPIO[2] as output mode
-
- tmp1byte &= ~(HAL_8188E_HW_GPIO_WPS_BIT);
- rtw_write8(padapter, GPIO_IN, tmp1byte); //reset the floating voltage level
-
- tmp1byte = rtw_read8(padapter, GPIO_IO_SEL);
- tmp1byte &= ~(HAL_8188E_HW_GPIO_WPS_BIT);
- rtw_write8(padapter, GPIO_IO_SEL, tmp1byte); //enable GPIO[2] as input mode
-
- tmp1byte =rtw_read8(padapter, GPIO_IN);
-
- if (tmp1byte == 0xff)
- return ;
-
- if (tmp1byte&HAL_8188E_HW_GPIO_WPS_BIT)
- {
- bPbcPressed = _TRUE;
- }
-#else
- tmp1byte = rtw_read8(padapter, GPIO_IN);
- //RT_TRACE(COMP_IO, DBG_TRACE, ("dm_CheckPbcGPIO - %x\n", tmp1byte));
-
- if (tmp1byte == 0xff || padapter->init_adpt_in_progress)
- return ;
-
- if((tmp1byte&HAL_8188E_HW_GPIO_WPS_BIT)==0)
- {
- bPbcPressed = _TRUE;
- }
-#endif
-
- if( _TRUE == bPbcPressed)
- {
- // Here we only set bPbcPressed to true
- // After trigger PBC, the variable will be set to false
- DBG_8192C("CheckPbcGPIO - PBC is pressed\n");
- rtw_request_wps_pbc_event(padapter);
- }
-}
-#endif//#ifdef CONFIG_SUPPORT_HW_WPS_PBC
-
-#ifdef CONFIG_PCI_HCI
-//
-// Description:
-// Perform interrupt migration dynamically to reduce CPU utilization.
-//
-// Assumption:
-// 1. Do not enable migration under WIFI test.
-//
-// Created by Roger, 2010.03.05.
-//
-VOID
-dm_InterruptMigration(
- IN PADAPTER Adapter
- )
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
- BOOLEAN bCurrentIntMt, bCurrentACIntDisable;
- BOOLEAN IntMtToSet = _FALSE;
- BOOLEAN ACIntToSet = _FALSE;
-
-
- // Retrieve current interrupt migration and Tx four ACs IMR settings first.
- bCurrentIntMt = pHalData->bInterruptMigration;
- bCurrentACIntDisable = pHalData->bDisableTxInt;
-
- //
- // <Roger_Notes> Currently we use busy traffic for reference instead of RxIntOK counts to prevent non-linear Rx statistics
- // when interrupt migration is set before. 2010.03.05.
- //
- if(!Adapter->registrypriv.wifi_spec &&
- (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) &&
- pmlmepriv->LinkDetectInfo.bHigherBusyTraffic)
- {
- IntMtToSet = _TRUE;
-
- // To check whether we should disable Tx interrupt or not.
- if(pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic )
- ACIntToSet = _TRUE;
- }
-
- //Update current settings.
- if( bCurrentIntMt != IntMtToSet ){
- DBG_8192C("%s(): Update interrrupt migration(%d)\n",__FUNCTION__,IntMtToSet);
- if(IntMtToSet)
- {
- //
- // <Roger_Notes> Set interrrupt migration timer and corresponging Tx/Rx counter.
- // timer 25ns*0xfa0=100us for 0xf packets.
- // 2010.03.05.
- //
- rtw_write32(Adapter, REG_INT_MIG, 0xff000fa0);// 0x306:Rx, 0x307:Tx
- pHalData->bInterruptMigration = IntMtToSet;
- }
- else
- {
- // Reset all interrupt migration settings.
- rtw_write32(Adapter, REG_INT_MIG, 0);
- pHalData->bInterruptMigration = IntMtToSet;
- }
- }
-
- /*if( bCurrentACIntDisable != ACIntToSet ){
- DBG_8192C("%s(): Update AC interrrupt(%d)\n",__FUNCTION__,ACIntToSet);
- if(ACIntToSet) // Disable four ACs interrupts.
- {
- //
- // <Roger_Notes> Disable VO, VI, BE and BK four AC interrupts to gain more efficient CPU utilization.
- // When extremely highly Rx OK occurs, we will disable Tx interrupts.
- // 2010.03.05.
- //
- UpdateInterruptMask8192CE( Adapter, 0, RT_AC_INT_MASKS );
- pHalData->bDisableTxInt = ACIntToSet;
- }
- else// Enable four ACs interrupts.
- {
- UpdateInterruptMask8192CE( Adapter, RT_AC_INT_MASKS, 0 );
- pHalData->bDisableTxInt = ACIntToSet;
- }
- }*/
-
-}
-
-#endif
-
-//
-// Initialize GPIO setting registers
-//
-static void
-dm_InitGPIOSetting(
- IN PADAPTER Adapter
- )
-{
- PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
-
- u8 tmp1byte;
-
- 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);
-
-}
-
-//============================================================
-// functions
-//============================================================
-static void Init_ODM_ComInfo_88E(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;
-
- //
- // 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);
-
- ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_IC_TYPE,ODM_RTL8188E);
-
- fab_ver = ODM_TSMC;
- cut_ver = ODM_CUT_A;
-
- if(IS_I_CUT(pHalData->VersionID) || IS_J_CUT(pHalData->VersionID) || IS_K_CUT(pHalData->VersionID))
- cut_ver = ODM_CUT_I;
-
- ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_FAB_VER,fab_ver);
- ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_CUT_VER,cut_ver);
-
- ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP,IS_NORMAL_CHIP(pHalData->VersionID));
-
-#if 0
-//#ifdef CONFIG_USB_HCI
- ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_BOARD_TYPE,pHalData->BoardType);
-
- if(pHalData->BoardType == BOARD_USB_High_PA){
- ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_LNA,_TRUE);
- ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_PA,_TRUE);
- }
-#endif
- 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
- pdmpriv->InitODMFlag = 0;
- #else
- pdmpriv->InitODMFlag = ODM_RF_CALIBRATION |
- ODM_RF_TX_PWR_TRACK //|
- ;
- //if(pHalData->AntDivCfg)
- // pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV;
- #endif
-
- ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_ABILITY,pdmpriv->InitODMFlag);
-
-}
-static void Update_ODM_ComInfo_88E(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;
-
- pdmpriv->InitODMFlag = 0
- | ODM_BB_DIG
- | ODM_BB_RA_MASK
- | ODM_BB_DYNAMIC_TXPWR
- | ODM_BB_FA_CNT
- | ODM_BB_RSSI_MONITOR
- | ODM_BB_CCK_PD
- | ODM_BB_PWR_SAVE
- | ODM_RF_CALIBRATION
- | ODM_RF_TX_PWR_TRACK
-#ifdef CONFIG_ODM_ADAPTIVITY
- | ODM_BB_ADAPTIVITY
-#endif
- ;
-
- if (!Adapter->registrypriv.qos_opt_enable) {
- pdmpriv->InitODMFlag |= ODM_MAC_EDCA_TURBO;
- }
-
- if(pHalData->AntDivCfg)
- pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV;
-
-#if (MP_DRIVER==1)
- if (Adapter->registrypriv.mp_mode == 1) {
- pdmpriv->InitODMFlag = 0
- | ODM_RF_CALIBRATION
- | ODM_RF_TX_PWR_TRACK
- ;
- }
-#endif//(MP_DRIVER==1)
-
-#ifdef CONFIG_DISABLE_ODM
- pdmpriv->InitODMFlag = 0;
-#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_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 =================
-
- //pHalData->CurrentBandType92D hook fake band_type for power tracking
- //ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BAND,&(pDM_Odm->u1Byte_temp));
- 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_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
-rtl8188e_InitHalDm(
- IN PADAPTER Adapter
- )
-{
- PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
- struct dm_priv *pdmpriv = &pHalData->dmpriv;
- PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
- u8 i;
-
-#ifdef CONFIG_USB_HCI
- dm_InitGPIOSetting(Adapter);
-#endif
-
- pdmpriv->DM_Type = DM_Type_ByDriver;
- pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE;
-
- Update_ODM_ComInfo_88E(Adapter);
- ODM_DMInit(pDM_Odm);
-}
-
-
-VOID
-rtl8188e_HalDmWatchDog(
- IN PADAPTER Adapter
- )
-{
- BOOLEAN bFwCurrentInPSMode = _FALSE;
- BOOLEAN bFwPSAwake = _TRUE;
- u8 hw_init_completed = _FALSE;
- PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
- struct dm_priv *pdmpriv = &pHalData->dmpriv;
- PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
-#ifdef CONFIG_CONCURRENT_MODE
- PADAPTER pbuddy_adapter = Adapter->pbuddy_adapter;
-#endif //CONFIG_CONCURRENT_MODE
-
- _func_enter_;
-
- hw_init_completed = Adapter->hw_init_completed;
-
- if (hw_init_completed == _FALSE)
- goto skip_dm;
-
-#ifdef CONFIG_LPS
- bFwCurrentInPSMode = adapter_to_pwrctl(Adapter)->bFwCurrentInPSMode;
- rtw_hal_get_hwreg(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bFwPSAwake));
-#endif
-
-#ifdef CONFIG_P2P_PS
- // Fw is under p2p powersaving mode, driver should stop dynamic mechanism.
- // modifed by thomas. 2011.06.11.
- if(Adapter->wdinfo.p2p_ps_mode)
- bFwPSAwake = _FALSE;
-#endif //CONFIG_P2P_PS
-
- if( (hw_init_completed == _TRUE)
- && ((!bFwCurrentInPSMode) && bFwPSAwake))
- {
- //
- // Calculate Tx/Rx statistics.
- //
- dm_CheckStatistics(Adapter);
-
- rtw_hal_check_rxfifo_full(Adapter);
- //
- // Dynamically switch RTS/CTS protection.
- //
- //dm_CheckProtection(Adapter);
-
-#ifdef CONFIG_PCI_HCI
- // 20100630 Joseph: Disable Interrupt Migration mechanism temporarily because it degrades Rx throughput.
- // Tx Migration settings.
- //dm_InterruptMigration(Adapter);
-
- //if(Adapter->HalFunc.TxCheckStuckHandler(Adapter))
- // PlatformScheduleWorkItem(&(GET_HAL_DATA(Adapter)->HalResetWorkItem));
-#endif
-
- }
-
-
- //ODM
- if (hw_init_completed == _TRUE)
- {
- u8 bLinked=_FALSE;
- u8 bsta_state=_FALSE;
- #ifdef CONFIG_DISABLE_ODM
- pHalData->odmpriv.SupportAbility = 0;
- #endif
-
- if(rtw_linked_check(Adapter)){
- bLinked = _TRUE;
- if (check_fwstate(&Adapter->mlmepriv, WIFI_STATION_STATE))
- bsta_state = _TRUE;
- }
-
-#ifdef CONFIG_CONCURRENT_MODE
- if(pbuddy_adapter && rtw_linked_check(pbuddy_adapter)){
- bLinked = _TRUE;
- if(pbuddy_adapter && check_fwstate(&pbuddy_adapter->mlmepriv, WIFI_STATION_STATE))
- bsta_state = _TRUE;
- }
-#endif //CONFIG_CONCURRENT_MODE
-
- ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_LINK, bLinked);
- ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_STATION_STATE, bsta_state);
-
-
- ODM_DMWatchdog(&pHalData->odmpriv);
-
- }
-
-skip_dm:
-
-#ifdef CONFIG_SUPPORT_HW_WPS_PBC
- // Check GPIO to determine current Pbc status.
- dm_CheckPbcGPIO(Adapter);
-#endif
- return;
-}
-
-void rtl8188e_init_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_memset(pdmpriv, 0, sizeof(struct dm_priv));
- //_rtw_spinlock_init(&(pHalData->odm_stainfo_lock));
- Init_ODM_ComInfo_88E(Adapter);
-#ifdef CONFIG_SW_ANTENNA_DIVERSITY
- //_init_timer(&(pdmpriv->SwAntennaSwitchTimer), Adapter->pnetdev , odm_SW_AntennaSwitchCallback, Adapter);
- ODM_InitAllTimers(podmpriv );
-#endif
- ODM_InitDebugSetting(podmpriv);
-}
-
-void rtl8188e_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);
-#ifdef CONFIG_SW_ANTENNA_DIVERSITY
- //_cancel_timer_ex(&pdmpriv->SwAntennaSwitchTimer);
- ODM_CancelAllTimers(podmpriv);
-#endif
-}
-
-
-#ifdef CONFIG_ANTENNA_DIVERSITY
-// Add new function to reset the state of antenna diversity before link.
-//
-// Compare RSSI for deciding antenna
-void AntDivCompare8188E(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src)
-{
- //PADAPTER Adapter = pDM_Odm->Adapter ;
-
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- if(0 != pHalData->AntDivCfg )
- {
- //DBG_8192C("update_network=> orgRSSI(%d)(%d),newRSSI(%d)(%d)\n",dst->Rssi,query_rx_pwr_percentage(dst->Rssi),
- // src->Rssi,query_rx_pwr_percentage(src->Rssi));
- //select optimum_antenna for before linked =>For antenna diversity
- if(dst->Rssi >= src->Rssi )//keep org parameter
- {
- src->Rssi = dst->Rssi;
- src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna;
- }
- }
-}
-
-// Add new function to reset the state of antenna diversity before link.
-u8 AntDivBeforeLink8188E(PADAPTER Adapter )
-{
-
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- PDM_ODM_T pDM_Odm =&pHalData->odmpriv;
- SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
- struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
-
- // Condition that does not need to use antenna diversity.
- if(pHalData->AntDivCfg==0)
- {
- //DBG_8192C("odm_AntDivBeforeLink8192C(): No AntDiv Mechanism.\n");
- return _FALSE;
- }
-
- if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
- {
- return _FALSE;
- }
-
-
- if(pDM_SWAT_Table->SWAS_NoLink_State == 0){
- //switch channel
- pDM_SWAT_Table->SWAS_NoLink_State = 1;
- pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?AUX_ANT:MAIN_ANT;
-
- //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, pDM_SWAT_Table->CurAntenna);
- rtw_antenna_select_cmd(Adapter, pDM_SWAT_Table->CurAntenna, _FALSE);
- //DBG_8192C("%s change antenna to ANT_( %s ).....\n",__FUNCTION__, (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?"MAIN":"AUX");
- return _TRUE;
- }
- else
- {
- pDM_SWAT_Table->SWAS_NoLink_State = 0;
- return _FALSE;
- }
-
-}
-#endif
-
+/******************************************************************************
+ *
+ * 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
+ *
+ *
+ ******************************************************************************/
+//============================================================
+// Description:
+//
+// This file is for 92CE/92CU dynamic mechanism only
+//
+//
+//============================================================
+#define _RTL8188E_DM_C_
+
+//============================================================
+// include files
+//============================================================
+#include <drv_types.h>
+#include <rtl8188e_hal.h>
+
+//============================================================
+// Global var
+//============================================================
+
+
+static VOID
+dm_CheckProtection(
+ IN PADAPTER Adapter
+ )
+{
+#if 0
+ PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
+ u1Byte CurRate, RateThreshold;
+
+ if(pMgntInfo->pHTInfo->bCurBW40MHz)
+ RateThreshold = MGN_MCS1;
+ else
+ RateThreshold = MGN_MCS3;
+
+ if(Adapter->TxStats.CurrentInitTxRate <= RateThreshold)
+ {
+ pMgntInfo->bDmDisableProtect = TRUE;
+ DbgPrint("Forced disable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
+ }
+ else
+ {
+ pMgntInfo->bDmDisableProtect = FALSE;
+ DbgPrint("Enable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
+ }
+#endif
+}
+
+static VOID
+dm_CheckStatistics(
+ IN PADAPTER Adapter
+ )
+{
+#if 0
+ if(!Adapter->MgntInfo.bMediaConnect)
+ return;
+
+ //2008.12.10 tynli Add for getting Current_Tx_Rate_Reg flexibly.
+ rtw_hal_get_hwreg( Adapter, HW_VAR_INIT_TX_RATE, (pu1Byte)(&Adapter->TxStats.CurrentInitTxRate) );
+
+ // Calculate current Tx Rate(Successful transmited!!)
+
+ // Calculate current Rx Rate(Successful received!!)
+
+ //for tx tx retry count
+ rtw_hal_get_hwreg( Adapter, HW_VAR_RETRY_COUNT, (pu1Byte)(&Adapter->TxStats.NumTxRetryCount) );
+#endif
+}
+
+#ifdef CONFIG_SUPPORT_HW_WPS_PBC
+static void dm_CheckPbcGPIO(_adapter *padapter)
+{
+ u8 tmp1byte;
+ u8 bPbcPressed = _FALSE;
+
+ if(!padapter->registrypriv.hw_wps_pbc)
+ return;
+
+#ifdef CONFIG_USB_HCI
+ tmp1byte = rtw_read8(padapter, GPIO_IO_SEL);
+ tmp1byte |= (HAL_8188E_HW_GPIO_WPS_BIT);
+ rtw_write8(padapter, GPIO_IO_SEL, tmp1byte); //enable GPIO[2] as output mode
+
+ tmp1byte &= ~(HAL_8188E_HW_GPIO_WPS_BIT);
+ rtw_write8(padapter, GPIO_IN, tmp1byte); //reset the floating voltage level
+
+ tmp1byte = rtw_read8(padapter, GPIO_IO_SEL);
+ tmp1byte &= ~(HAL_8188E_HW_GPIO_WPS_BIT);
+ rtw_write8(padapter, GPIO_IO_SEL, tmp1byte); //enable GPIO[2] as input mode
+
+ tmp1byte =rtw_read8(padapter, GPIO_IN);
+
+ if (tmp1byte == 0xff)
+ return ;
+
+ if (tmp1byte&HAL_8188E_HW_GPIO_WPS_BIT)
+ {
+ bPbcPressed = _TRUE;
+ }
+#else
+ tmp1byte = rtw_read8(padapter, GPIO_IN);
+ //RT_TRACE(COMP_IO, DBG_TRACE, ("dm_CheckPbcGPIO - %x\n", tmp1byte));
+
+ if (tmp1byte == 0xff || padapter->init_adpt_in_progress)
+ return ;
+
+ if((tmp1byte&HAL_8188E_HW_GPIO_WPS_BIT)==0)
+ {
+ bPbcPressed = _TRUE;
+ }
+#endif
+
+ if( _TRUE == bPbcPressed)
+ {
+ // Here we only set bPbcPressed to true
+ // After trigger PBC, the variable will be set to false
+ DBG_8192C("CheckPbcGPIO - PBC is pressed\n");
+ rtw_request_wps_pbc_event(padapter);
+ }
+}
+#endif//#ifdef CONFIG_SUPPORT_HW_WPS_PBC
+
+#ifdef CONFIG_PCI_HCI
+//
+// Description:
+// Perform interrupt migration dynamically to reduce CPU utilization.
+//
+// Assumption:
+// 1. Do not enable migration under WIFI test.
+//
+// Created by Roger, 2010.03.05.
+//
+VOID
+dm_InterruptMigration(
+ IN PADAPTER Adapter
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+ BOOLEAN bCurrentIntMt, bCurrentACIntDisable;
+ BOOLEAN IntMtToSet = _FALSE;
+ BOOLEAN ACIntToSet = _FALSE;
+
+
+ // Retrieve current interrupt migration and Tx four ACs IMR settings first.
+ bCurrentIntMt = pHalData->bInterruptMigration;
+ bCurrentACIntDisable = pHalData->bDisableTxInt;
+
+ //
+ // <Roger_Notes> Currently we use busy traffic for reference instead of RxIntOK counts to prevent non-linear Rx statistics
+ // when interrupt migration is set before. 2010.03.05.
+ //
+ if(!Adapter->registrypriv.wifi_spec &&
+ (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) &&
+ pmlmepriv->LinkDetectInfo.bHigherBusyTraffic)
+ {
+ IntMtToSet = _TRUE;
+
+ // To check whether we should disable Tx interrupt or not.
+ if(pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic )
+ ACIntToSet = _TRUE;
+ }
+
+ //Update current settings.
+ if( bCurrentIntMt != IntMtToSet ){
+ DBG_8192C("%s(): Update interrrupt migration(%d)\n",__FUNCTION__,IntMtToSet);
+ if(IntMtToSet)
+ {
+ //
+ // <Roger_Notes> Set interrrupt migration timer and corresponging Tx/Rx counter.
+ // timer 25ns*0xfa0=100us for 0xf packets.
+ // 2010.03.05.
+ //
+ rtw_write32(Adapter, REG_INT_MIG, 0xff000fa0);// 0x306:Rx, 0x307:Tx
+ pHalData->bInterruptMigration = IntMtToSet;
+ }
+ else
+ {
+ // Reset all interrupt migration settings.
+ rtw_write32(Adapter, REG_INT_MIG, 0);
+ pHalData->bInterruptMigration = IntMtToSet;
+ }
+ }
+
+ /*if( bCurrentACIntDisable != ACIntToSet ){
+ DBG_8192C("%s(): Update AC interrrupt(%d)\n",__FUNCTION__,ACIntToSet);
+ if(ACIntToSet) // Disable four ACs interrupts.
+ {
+ //
+ // <Roger_Notes> Disable VO, VI, BE and BK four AC interrupts to gain more efficient CPU utilization.
+ // When extremely highly Rx OK occurs, we will disable Tx interrupts.
+ // 2010.03.05.
+ //
+ UpdateInterruptMask8192CE( Adapter, 0, RT_AC_INT_MASKS );
+ pHalData->bDisableTxInt = ACIntToSet;
+ }
+ else// Enable four ACs interrupts.
+ {
+ UpdateInterruptMask8192CE( Adapter, RT_AC_INT_MASKS, 0 );
+ pHalData->bDisableTxInt = ACIntToSet;
+ }
+ }*/
+
+}
+
+#endif
+
+//
+// Initialize GPIO setting registers
+//
+static void
+dm_InitGPIOSetting(
+ IN PADAPTER Adapter
+ )
+{
+ PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
+
+ u8 tmp1byte;
+
+ 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);
+
+}
+
+//============================================================
+// functions
+//============================================================
+static void Init_ODM_ComInfo_88E(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;
+
+ //
+ // 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);
+
+ ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_IC_TYPE,ODM_RTL8188E);
+
+ fab_ver = ODM_TSMC;
+ cut_ver = ODM_CUT_A;
+
+ if(IS_I_CUT(pHalData->VersionID) || IS_J_CUT(pHalData->VersionID) || IS_K_CUT(pHalData->VersionID))
+ cut_ver = ODM_CUT_I;
+
+ ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_FAB_VER,fab_ver);
+ ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_CUT_VER,cut_ver);
+
+ ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP,IS_NORMAL_CHIP(pHalData->VersionID));
+
+#if 0
+//#ifdef CONFIG_USB_HCI
+ ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_BOARD_TYPE,pHalData->BoardType);
+
+ if(pHalData->BoardType == BOARD_USB_High_PA){
+ ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_LNA,_TRUE);
+ ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_PA,_TRUE);
+ }
+#endif
+ 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
+ pdmpriv->InitODMFlag = 0;
+ #else
+ pdmpriv->InitODMFlag = ODM_RF_CALIBRATION |
+ ODM_RF_TX_PWR_TRACK //|
+ ;
+ //if(pHalData->AntDivCfg)
+ // pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV;
+ #endif
+
+ ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_ABILITY,pdmpriv->InitODMFlag);
+
+}
+static void Update_ODM_ComInfo_88E(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;
+
+ pdmpriv->InitODMFlag = 0
+ | ODM_BB_DIG
+ | ODM_BB_RA_MASK
+ | ODM_BB_DYNAMIC_TXPWR
+ | ODM_BB_FA_CNT
+ | ODM_BB_RSSI_MONITOR
+ | ODM_BB_CCK_PD
+ | ODM_BB_PWR_SAVE
+ | ODM_RF_CALIBRATION
+ | ODM_RF_TX_PWR_TRACK
+ ;
+
+ if (rtw_odm_adaptivity_needed(Adapter) == _TRUE) {
+ rtw_odm_adaptivity_config_msg(RTW_DBGDUMP, Adapter);
+ pdmpriv->InitODMFlag |= ODM_BB_ADAPTIVITY;
+ }
+
+ if (!Adapter->registrypriv.qos_opt_enable) {
+ pdmpriv->InitODMFlag |= ODM_MAC_EDCA_TURBO;
+ }
+
+ if(pHalData->AntDivCfg)
+ pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV;
+
+#if (MP_DRIVER==1)
+ if (Adapter->registrypriv.mp_mode == 1) {
+ pdmpriv->InitODMFlag = 0
+ | ODM_RF_CALIBRATION
+ | ODM_RF_TX_PWR_TRACK
+ ;
+ }
+#endif//(MP_DRIVER==1)
+
+#ifdef CONFIG_DISABLE_ODM
+ pdmpriv->InitODMFlag = 0;
+#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_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 =================
+
+ //pHalData->CurrentBandType92D hook fake band_type for power tracking
+ //ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BAND,&(pDM_Odm->u1Byte_temp));
+ 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_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
+rtl8188e_InitHalDm(
+ IN PADAPTER Adapter
+ )
+{
+ PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
+ struct dm_priv *pdmpriv = &pHalData->dmpriv;
+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
+ u8 i;
+
+#ifdef CONFIG_USB_HCI
+ dm_InitGPIOSetting(Adapter);
+#endif
+
+ pdmpriv->DM_Type = DM_Type_ByDriver;
+ pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE;
+
+ Update_ODM_ComInfo_88E(Adapter);
+ ODM_DMInit(pDM_Odm);
+}
+
+
+VOID
+rtl8188e_HalDmWatchDog(
+ IN PADAPTER Adapter
+ )
+{
+ BOOLEAN bFwCurrentInPSMode = _FALSE;
+ BOOLEAN bFwPSAwake = _TRUE;
+ u8 hw_init_completed = _FALSE;
+ PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
+ struct dm_priv *pdmpriv = &pHalData->dmpriv;
+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
+#ifdef CONFIG_CONCURRENT_MODE
+ PADAPTER pbuddy_adapter = Adapter->pbuddy_adapter;
+#endif //CONFIG_CONCURRENT_MODE
+
+ _func_enter_;
+
+ hw_init_completed = Adapter->hw_init_completed;
+
+ if (hw_init_completed == _FALSE)
+ goto skip_dm;
+
+#ifdef CONFIG_LPS
+ bFwCurrentInPSMode = adapter_to_pwrctl(Adapter)->bFwCurrentInPSMode;
+ rtw_hal_get_hwreg(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bFwPSAwake));
+#endif
+
+#ifdef CONFIG_P2P_PS
+ // Fw is under p2p powersaving mode, driver should stop dynamic mechanism.
+ // modifed by thomas. 2011.06.11.
+ if(Adapter->wdinfo.p2p_ps_mode)
+ bFwPSAwake = _FALSE;
+#endif //CONFIG_P2P_PS
+
+ if( (hw_init_completed == _TRUE)
+ && ((!bFwCurrentInPSMode) && bFwPSAwake))
+ {
+ //
+ // Calculate Tx/Rx statistics.
+ //
+ dm_CheckStatistics(Adapter);
+
+ rtw_hal_check_rxfifo_full(Adapter);
+ //
+ // Dynamically switch RTS/CTS protection.
+ //
+ //dm_CheckProtection(Adapter);
+
+#ifdef CONFIG_PCI_HCI
+ // 20100630 Joseph: Disable Interrupt Migration mechanism temporarily because it degrades Rx throughput.
+ // Tx Migration settings.
+ //dm_InterruptMigration(Adapter);
+
+ //if(Adapter->HalFunc.TxCheckStuckHandler(Adapter))
+ // PlatformScheduleWorkItem(&(GET_HAL_DATA(Adapter)->HalResetWorkItem));
+#endif
+
+ }
+
+
+ //ODM
+ if (hw_init_completed == _TRUE)
+ {
+ u8 bLinked=_FALSE;
+ u8 bsta_state=_FALSE;
+ #ifdef CONFIG_DISABLE_ODM
+ pHalData->odmpriv.SupportAbility = 0;
+ #endif
+
+ if(rtw_linked_check(Adapter)){
+ bLinked = _TRUE;
+ if (check_fwstate(&Adapter->mlmepriv, WIFI_STATION_STATE))
+ bsta_state = _TRUE;
+ }
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if(pbuddy_adapter && rtw_linked_check(pbuddy_adapter)){
+ bLinked = _TRUE;
+ if(pbuddy_adapter && check_fwstate(&pbuddy_adapter->mlmepriv, WIFI_STATION_STATE))
+ bsta_state = _TRUE;
+ }
+#endif //CONFIG_CONCURRENT_MODE
+
+ ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_LINK, bLinked);
+ ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_STATION_STATE, bsta_state);
+
+
+ ODM_DMWatchdog(&pHalData->odmpriv);
+
+ }
+
+skip_dm:
+
+#ifdef CONFIG_SUPPORT_HW_WPS_PBC
+ // Check GPIO to determine current Pbc status.
+ dm_CheckPbcGPIO(Adapter);
+#endif
+ return;
+}
+
+void rtl8188e_init_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_memset(pdmpriv, 0, sizeof(struct dm_priv));
+ //_rtw_spinlock_init(&(pHalData->odm_stainfo_lock));
+ Init_ODM_ComInfo_88E(Adapter);
+#ifdef CONFIG_SW_ANTENNA_DIVERSITY
+ //_init_timer(&(pdmpriv->SwAntennaSwitchTimer), Adapter->pnetdev , odm_SW_AntennaSwitchCallback, Adapter);
+ ODM_InitAllTimers(podmpriv );
+#endif
+ ODM_InitDebugSetting(podmpriv);
+}
+
+void rtl8188e_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);
+#ifdef CONFIG_SW_ANTENNA_DIVERSITY
+ //_cancel_timer_ex(&pdmpriv->SwAntennaSwitchTimer);
+ ODM_CancelAllTimers(podmpriv);
+#endif
+}
+
+
+#ifdef CONFIG_ANTENNA_DIVERSITY
+// Add new function to reset the state of antenna diversity before link.
+//
+// Compare RSSI for deciding antenna
+void AntDivCompare8188E(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src)
+{
+ //PADAPTER Adapter = pDM_Odm->Adapter ;
+
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ if(0 != pHalData->AntDivCfg )
+ {
+ //DBG_8192C("update_network=> orgRSSI(%d)(%d),newRSSI(%d)(%d)\n",dst->Rssi,query_rx_pwr_percentage(dst->Rssi),
+ // src->Rssi,query_rx_pwr_percentage(src->Rssi));
+ //select optimum_antenna for before linked =>For antenna diversity
+ if(dst->Rssi >= src->Rssi )//keep org parameter
+ {
+ src->Rssi = dst->Rssi;
+ src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna;
+ }
+ }
+}
+
+// Add new function to reset the state of antenna diversity before link.
+u8 AntDivBeforeLink8188E(PADAPTER Adapter )
+{
+
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ PDM_ODM_T pDM_Odm =&pHalData->odmpriv;
+ SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+
+ // Condition that does not need to use antenna diversity.
+ if(pHalData->AntDivCfg==0)
+ {
+ //DBG_8192C("odm_AntDivBeforeLink8192C(): No AntDiv Mechanism.\n");
+ return _FALSE;
+ }
+
+ if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
+ {
+ return _FALSE;
+ }
+
+
+ if(pDM_SWAT_Table->SWAS_NoLink_State == 0){
+ //switch channel
+ pDM_SWAT_Table->SWAS_NoLink_State = 1;
+ pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?AUX_ANT:MAIN_ANT;
+
+ //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, pDM_SWAT_Table->CurAntenna);
+ rtw_antenna_select_cmd(Adapter, pDM_SWAT_Table->CurAntenna, _FALSE);
+ //DBG_8192C("%s change antenna to ANT_( %s ).....\n",__FUNCTION__, (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?"MAIN":"AUX");
+ return _TRUE;
+ }
+ else
+ {
+ pDM_SWAT_Table->SWAS_NoLink_State = 0;
+ return _FALSE;
+ }
+
+}
+#endif
+
diff --git a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_hal_init.c b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_hal_init.c
index 10dd48a..78a3fca 100644..100755
--- a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_hal_init.c
+++ b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_hal_init.c
@@ -3824,6 +3824,589 @@ void _InitTransferPageSize(PADAPTER padapter)
rtw_write8(padapter, REG_PBP, value8);
}
+void ResumeTxBeacon(_adapter *padapter)
+{
+ HAL_DATA_TYPE* pHalData = GET_HAL_DATA(padapter);
+
+ // 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value
+ // which should be read from register to a global variable.
+
+ rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl) | BIT6);
+ pHalData->RegFwHwTxQCtrl |= BIT6;
+ rtw_write8(padapter, REG_TBTT_PROHIBIT+1, 0xff);
+ pHalData->RegReg542 |= BIT0;
+ rtw_write8(padapter, REG_TBTT_PROHIBIT+2, pHalData->RegReg542);
+}
+
+void StopTxBeacon(_adapter *padapter)
+{
+ HAL_DATA_TYPE* pHalData = GET_HAL_DATA(padapter);
+
+ // 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value
+ // which should be read from register to a global variable.
+
+ rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl) & (~BIT6));
+ pHalData->RegFwHwTxQCtrl &= (~BIT6);
+ rtw_write8(padapter, REG_TBTT_PROHIBIT+1, 0x64);
+ pHalData->RegReg542 &= ~(BIT0);
+ rtw_write8(padapter, REG_TBTT_PROHIBIT+2, pHalData->RegReg542);
+
+ CheckFwRsvdPageContent(padapter); // 2010.06.23. Added by tynli.
+}
+
+static void hw_var_set_monitor(PADAPTER Adapter, u8 variable, u8 *val)
+{
+ u32 value_rcr, rcr_bits;
+ u16 value_rxfltmap2;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
+
+ if (*((u8 *)val) == _HW_STATE_MONITOR_) {
+
+ /* Leave IPS */
+ rtw_pm_set_ips(Adapter, IPS_NONE);
+ LeaveAllPowerSaveMode(Adapter);
+
+ /* Receive all type */
+ rcr_bits = RCR_AAP | RCR_APM | RCR_AM | RCR_AB | RCR_APWRMGT | RCR_ADF | RCR_ACF | RCR_AMF | RCR_APP_PHYST_RXFF;
+
+ /* Append FCS */
+ rcr_bits |= RCR_APPFCS;
+
+ #if 0
+ /*
+ CRC and ICV packet will drop in recvbuf2recvframe()
+ We no turn on it.
+ */
+ rcr_bits |= (RCR_ACRC32 | RCR_AICV);
+ #endif
+
+ /* Receive all data frames */
+ value_rxfltmap2 = 0xFFFF;
+
+ value_rcr = rcr_bits;
+ rtw_write32(Adapter, REG_RCR, value_rcr);
+
+ rtw_write16(Adapter, REG_RXFLTMAP2, value_rxfltmap2);
+
+ #if 0
+ /* tx pause */
+ rtw_write8(padapter, REG_TXPAUSE, 0xFF);
+ #endif
+ } else {
+ /* do nothing */
+ }
+
+}
+
+static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val)
+{
+ u8 val8;
+ u8 mode = *((u8 *)val);
+
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+ /* reset RCR */
+ rtw_write32(Adapter, REG_RCR, pHalData->ReceiveConfig);
+
+ if (mode == _HW_STATE_MONITOR_) {
+ /* set net_type */
+ Set_MSR(Adapter, _HW_STATE_NOLINK_);
+
+ hw_var_set_monitor(Adapter, variable, val);
+ return;
+ }
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if(Adapter->iface_type == IFACE_PORT1)
+ {
+ // disable Port1 TSF update
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(4));
+
+ // set net_type
+ val8 = rtw_read8(Adapter, MSR)&0x03;
+ val8 |= (mode<<2);
+ rtw_write8(Adapter, MSR, val8);
+
+ DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode);
+
+ if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_))
+ {
+ if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
+ {
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN
+
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
+ rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms
+ UpdateInterruptMask8188EU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_88E);
+ #endif // CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
+
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
+ UpdateInterruptMask8188EU(Adapter,_TRUE ,0, (IMR_TBDER_88E|IMR_TBDOK_88E));
+ #endif// CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
+
+ #endif //CONFIG_INTERRUPT_BASED_TXBCN
+
+
+ StopTxBeacon(Adapter);
+ }
+
+ rtw_write8(Adapter,REG_BCN_CTRL_1, 0x11);//disable atim wnd and disable beacon function
+ //rtw_write8(Adapter,REG_BCN_CTRL_1, 0x18);
+ }
+ else if((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/)
+ {
+ ResumeTxBeacon(Adapter);
+ rtw_write8(Adapter,REG_BCN_CTRL_1, 0x1a);
+ //BIT4 - If set 0, hw will clr bcnq when tx becon ok/fail or port 1
+ rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
+ }
+ else if(mode == _HW_STATE_AP_)
+ {
+#ifdef CONFIG_INTERRUPT_BASED_TXBCN
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
+ UpdateInterruptMask8188EU(Adapter,_TRUE ,IMR_BCNDMAINT0_88E, 0);
+ #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
+
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
+ UpdateInterruptMask8188EU(Adapter,_TRUE ,(IMR_TBDER_88E|IMR_TBDOK_88E), 0);
+ #endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
+
+#endif //CONFIG_INTERRUPT_BASED_TXBCN
+
+ ResumeTxBeacon(Adapter);
+
+ rtw_write8(Adapter, REG_BCN_CTRL_1, 0x12);
+
+ //Set RCR
+ //rtw_write32(padapter, REG_RCR, 0x70002a8e);//CBSSID_DATA must set to 0
+ //rtw_write32(Adapter, REG_RCR, 0x7000228e);//CBSSID_DATA must set to 0
+ rtw_write32(Adapter, REG_RCR, 0x7000208e);//CBSSID_DATA must set to 0,reject ICV_ERR packet
+ //enable to rx data frame
+ rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF);
+ //enable to rx ps-poll
+ rtw_write16(Adapter, REG_RXFLTMAP1, 0x0400);
+
+ //Beacon Control related register for first time
+ rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms
+
+ //rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF);
+ rtw_write8(Adapter, REG_ATIMWND_1, 0x0a); // 10ms for port1
+ rtw_write16(Adapter, REG_BCNTCFG, 0x00);
+ rtw_write16(Adapter, REG_TBTT_PROHIBIT, 0xff04);
+ rtw_write16(Adapter, REG_TSFTR_SYN_OFFSET, 0x7fff);// +32767 (~32ms)
+
+ //reset TSF2
+ rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1));
+
+
+ //BIT4 - If set 0, hw will clr bcnq when tx becon ok/fail or port 1
+ rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
+ //enable BCN1 Function for if2
+ //don't enable update TSF1 for if2 (due to TSF update when beacon/probe rsp are received)
+ rtw_write8(Adapter, REG_BCN_CTRL_1, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION | EN_TXBCN_RPT|BIT(1)));
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE))
+ rtw_write8(Adapter, REG_BCN_CTRL,
+ rtw_read8(Adapter, REG_BCN_CTRL) & ~EN_BCN_FUNCTION);
+#endif
+ //BCN1 TSF will sync to BCN0 TSF with offset(0x518) if if1_sta linked
+ //rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(5));
+ //rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(3));
+
+ //dis BCN0 ATIM WND if if1 is station
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(0));
+
+#ifdef CONFIG_TSF_RESET_OFFLOAD
+ // Reset TSF for STA+AP concurrent mode
+ if ( check_buddy_fwstate(Adapter, (WIFI_STATION_STATE|WIFI_ASOC_STATE)) ) {
+ if (reset_tsf(Adapter, IFACE_PORT1) == _FALSE)
+ DBG_871X("ERROR! %s()-%d: Reset port1 TSF fail\n",
+ __FUNCTION__, __LINE__);
+ }
+#endif // CONFIG_TSF_RESET_OFFLOAD
+ }
+ }
+ else
+#endif //CONFIG_CONCURRENT_MODE
+ {
+ // disable Port0 TSF update
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
+
+ // set net_type
+ val8 = rtw_read8(Adapter, MSR)&0x0c;
+ val8 |= mode;
+ rtw_write8(Adapter, MSR, val8);
+
+ DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode);
+
+ if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_))
+ {
+#ifdef CONFIG_CONCURRENT_MODE
+ if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
+#endif //CONFIG_CONCURRENT_MODE
+ {
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
+ rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms
+ UpdateInterruptMask8188EU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_88E);
+ #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
+
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
+ UpdateInterruptMask8188EU(Adapter,_TRUE ,0, (IMR_TBDER_88E|IMR_TBDOK_88E));
+ #endif //CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
+
+ #endif //CONFIG_INTERRUPT_BASED_TXBCN
+ StopTxBeacon(Adapter);
+ }
+
+ rtw_write8(Adapter,REG_BCN_CTRL, 0x19);//disable atim wnd
+ //rtw_write8(Adapter,REG_BCN_CTRL, 0x18);
+ }
+ else if((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/)
+ {
+ ResumeTxBeacon(Adapter);
+ rtw_write8(Adapter,REG_BCN_CTRL, 0x1a);
+ //BIT3 - If set 0, hw will clr bcnq when tx becon ok/fail or port 0
+ rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
+ }
+ else if(mode == _HW_STATE_AP_)
+ {
+
+#ifdef CONFIG_INTERRUPT_BASED_TXBCN
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
+ UpdateInterruptMask8188EU(Adapter,_TRUE ,IMR_BCNDMAINT0_88E, 0);
+ #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
+
+ #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
+ UpdateInterruptMask8188EU(Adapter,_TRUE ,(IMR_TBDER_88E|IMR_TBDOK_88E), 0);
+ #endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
+
+#endif //CONFIG_INTERRUPT_BASED_TXBCN
+
+
+ ResumeTxBeacon(Adapter);
+
+ rtw_write8(Adapter, REG_BCN_CTRL, 0x12);
+
+ //Set RCR
+ //rtw_write32(padapter, REG_RCR, 0x70002a8e);//CBSSID_DATA must set to 0
+ //rtw_write32(Adapter, REG_RCR, 0x7000228e);//CBSSID_DATA must set to 0
+ rtw_write32(Adapter, REG_RCR, 0x7000208e);//CBSSID_DATA must set to 0,reject ICV_ERR packet
+ //enable to rx data frame
+ rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF);
+ //enable to rx ps-poll
+ rtw_write16(Adapter, REG_RXFLTMAP1, 0x0400);
+
+ //Beacon Control related register for first time
+ rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms
+
+ //rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF);
+ rtw_write8(Adapter, REG_ATIMWND, 0x0a); // 10ms
+ rtw_write16(Adapter, REG_BCNTCFG, 0x00);
+ rtw_write16(Adapter, REG_TBTT_PROHIBIT, 0xff04);
+ rtw_write16(Adapter, REG_TSFTR_SYN_OFFSET, 0x7fff);// +32767 (~32ms)
+
+ //reset TSF
+ rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(0));
+
+ //BIT3 - If set 0, hw will clr bcnq when tx becon ok/fail or port 0
+ rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
+
+ //enable BCN0 Function for if1
+ //don't enable update TSF0 for if1 (due to TSF update when beacon/probe rsp are received)
+ #if defined(CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR)
+ rtw_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION | EN_TXBCN_RPT|BIT(1)));
+ #else
+ rtw_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION |BIT(1)));
+ #endif
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE))
+ rtw_write8(Adapter, REG_BCN_CTRL_1,
+ rtw_read8(Adapter, REG_BCN_CTRL_1) & ~EN_BCN_FUNCTION);
+#endif
+
+ //dis BCN1 ATIM WND if if2 is station
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(0));
+#ifdef CONFIG_TSF_RESET_OFFLOAD
+ // Reset TSF for STA+AP concurrent mode
+ if ( check_buddy_fwstate(Adapter, (WIFI_STATION_STATE|WIFI_ASOC_STATE)) ) {
+ if (reset_tsf(Adapter, IFACE_PORT0) == _FALSE)
+ DBG_871X("ERROR! %s()-%d: Reset port0 TSF fail\n",
+ __FUNCTION__, __LINE__);
+ }
+#endif // CONFIG_TSF_RESET_OFFLOAD
+ }
+ }
+}
+
+static void hw_var_set_correct_tsf(PADAPTER Adapter, u8 variable, u8* val)
+{
+#ifdef CONFIG_CONCURRENT_MODE
+ u64 tsf;
+ struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ PADAPTER pbuddy_adapter = Adapter->pbuddy_adapter;
+
+ //tsf = pmlmeext->TSFValue - ((u32)pmlmeext->TSFValue % (pmlmeinfo->bcn_interval*1024)) -1024; //us
+ tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us
+
+ if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
+ {
+ //pHalData->RegTxPause |= STOP_BCNQ;BIT(6)
+ //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6)));
+ StopTxBeacon(Adapter);
+ }
+
+ if(Adapter->iface_type == IFACE_PORT1)
+ {
+ //disable related TSF function
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3)));
+
+ rtw_write32(Adapter, REG_TSFTR1, tsf);
+ rtw_write32(Adapter, REG_TSFTR1+4, tsf>>32);
+
+
+ //enable related TSF function
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3));
+
+ // Update buddy port's TSF if it is SoftAP for beacon TX issue!
+ if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE
+ && check_buddy_fwstate(Adapter, WIFI_AP_STATE)
+ ) {
+ //disable related TSF function
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3)));
+
+ rtw_write32(Adapter, REG_TSFTR, tsf);
+ rtw_write32(Adapter, REG_TSFTR+4, tsf>>32);
+
+ //enable related TSF function
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3));
+#ifdef CONFIG_TSF_RESET_OFFLOAD
+ // Update buddy port's TSF(TBTT) if it is SoftAP for beacon TX issue!
+ if (reset_tsf(Adapter, IFACE_PORT0) == _FALSE)
+ DBG_871X("ERROR! %s()-%d: Reset port0 TSF fail\n",
+ __FUNCTION__, __LINE__);
+
+#endif // CONFIG_TSF_RESET_OFFLOAD
+ }
+
+
+ }
+ else
+ {
+ //disable related TSF function
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3)));
+
+ rtw_write32(Adapter, REG_TSFTR, tsf);
+ rtw_write32(Adapter, REG_TSFTR+4, tsf>>32);
+
+ //enable related TSF function
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3));
+
+ // Update buddy port's TSF if it is SoftAP for beacon TX issue!
+ if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE
+ && check_buddy_fwstate(Adapter, WIFI_AP_STATE)
+ ) {
+ //disable related TSF function
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3)));
+
+ rtw_write32(Adapter, REG_TSFTR1, tsf);
+ rtw_write32(Adapter, REG_TSFTR1+4, tsf>>32);
+
+ //enable related TSF function
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3));
+#ifdef CONFIG_TSF_RESET_OFFLOAD
+ // Update buddy port's TSF if it is SoftAP for beacon TX issue!
+ if (reset_tsf(Adapter, IFACE_PORT1) == _FALSE)
+ DBG_871X("ERROR! %s()-%d: Reset port1 TSF fail\n",
+ __FUNCTION__, __LINE__);
+#endif // CONFIG_TSF_RESET_OFFLOAD
+ }
+
+ }
+
+
+ if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
+ {
+ //pHalData->RegTxPause &= (~STOP_BCNQ);
+ //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)&(~BIT(6))));
+ ResumeTxBeacon(Adapter);
+ }
+#endif
+}
+
+static void hw_var_set_mlme_sitesurvey(PADAPTER Adapter, u8 variable, u8* val)
+{
+#ifdef CONFIG_CONCURRENT_MODE
+ struct mlme_priv *pmlmepriv=&(Adapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ u32 value_rcr, rcr_clear_bit, value_rxfltmap2;
+
+#ifdef CONFIG_FIND_BEST_CHANNEL
+ rcr_clear_bit = (RCR_CBSSID_BCN | RCR_CBSSID_DATA);
+ // Recieve all data frames
+ value_rxfltmap2 = 0xFFFF;
+#else /* CONFIG_FIND_BEST_CHANNEL */
+ rcr_clear_bit = RCR_CBSSID_BCN;
+ //config RCR to receive different BSSID & not to receive data frame
+ value_rxfltmap2 = 0;
+#endif /* CONFIG_FIND_BEST_CHANNEL */
+
+ if( (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
+ #ifdef CONFIG_CONCURRENT_MODE
+ || (check_buddy_fwstate(Adapter, WIFI_AP_STATE) == _TRUE)
+ #endif
+ ){
+ rcr_clear_bit = RCR_CBSSID_BCN;
+ }
+#ifdef CONFIG_TDLS
+ // TDLS will clear RCR_CBSSID_DATA bit for connection.
+ else if (Adapter->tdlsinfo.link_established == _TRUE)
+ {
+ rcr_clear_bit = RCR_CBSSID_BCN;
+ }
+#endif // CONFIG_TDLS
+
+ value_rcr = rtw_read32(Adapter, REG_RCR);
+ if(*((u8 *)val))//under sitesurvey
+ {
+ value_rcr &= ~(rcr_clear_bit);
+ rtw_write32(Adapter, REG_RCR, value_rcr);
+ rtw_write16(Adapter, REG_RXFLTMAP2, value_rxfltmap2);
+
+ //disable update TSF
+ if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
+ {
+ if(Adapter->iface_type == IFACE_PORT1)
+ {
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(4));
+ }
+ else
+ {
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
+ }
+ }
+
+ if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
+ check_buddy_fwstate(Adapter, _FW_LINKED))
+ {
+ StopTxBeacon(Adapter);
+ }
+ }
+ else//sitesurvey done
+ {
+ //enable to rx data frame
+ //write32(Adapter, REG_RCR, read32(padapter, REG_RCR)|RCR_ADF);
+ if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE))
+ || check_buddy_fwstate(Adapter, (_FW_LINKED|WIFI_AP_STATE)))
+ rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
+
+ //enable update TSF
+ if(Adapter->iface_type == IFACE_PORT1)
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4)));
+ else
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
+
+ value_rcr |= rcr_clear_bit;
+ rtw_write32(Adapter, REG_RCR, value_rcr);
+
+ if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
+ check_buddy_fwstate(Adapter, _FW_LINKED))
+ {
+ ResumeTxBeacon(Adapter);
+ }
+ }
+#endif
+}
+
+static void hw_var_set_mlme_join(PADAPTER Adapter, u8 variable, u8* val)
+{
+#ifdef CONFIG_CONCURRENT_MODE
+ u8 RetryLimit = 0x30;
+ u8 type = *((u8 *)val);
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
+ EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter);
+
+ if(type == 0) // prepare to join
+ {
+ if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
+ check_buddy_fwstate(Adapter, _FW_LINKED))
+ {
+ StopTxBeacon(Adapter);
+ }
+
+ //enable to rx data frame.Accept all data frame
+ //rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
+ rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
+
+ if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
+ rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN);
+ else
+ rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
+
+ if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
+ {
+ RetryLimit = (pEEPROM->CustomerID == RT_CID_CCX) ? 7 : 48;
+ }
+ else // Ad-hoc Mode
+ {
+ RetryLimit = 0x7;
+ }
+ }
+ else if(type == 1) //joinbss_event call back when join res < 0
+ {
+ if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_))
+ rtw_write16(Adapter, REG_RXFLTMAP2,0x00);
+
+ if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
+ check_buddy_fwstate(Adapter, _FW_LINKED))
+ {
+ ResumeTxBeacon(Adapter);
+
+ //reset TSF 1/2 after ResumeTxBeacon
+ rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0));
+
+ }
+ }
+ else if(type == 2) //sta add event call back
+ {
+
+ //enable update TSF
+ if(Adapter->iface_type == IFACE_PORT1)
+ rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4)));
+ else
+ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
+
+
+ if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE))
+ {
+ //fixed beacon issue for 8191su...........
+ rtw_write8(Adapter,0x542 ,0x02);
+ RetryLimit = 0x7;
+ }
+
+
+ if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
+ check_buddy_fwstate(Adapter, _FW_LINKED))
+ {
+ ResumeTxBeacon(Adapter);
+
+ //reset TSF 1/2 after ResumeTxBeacon
+ rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0));
+ }
+
+ }
+
+ rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT);
+
+#endif
+}
+
void SetHwReg8188E(_adapter *adapter, u8 variable, u8 *val)
{
HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter);
@@ -3831,11 +4414,14 @@ void SetHwReg8188E(_adapter *adapter, u8 variable, u8 *val)
_func_enter_;
switch (variable) {
+ case HW_VAR_SET_OPMODE:
+ hw_var_set_opmode(adapter, variable, val);
+ break;
case HW_VAR_BASIC_RATE:
{
struct mlme_ext_info *mlmext_info = &adapter->mlmeextpriv.mlmext_info;
u16 input_b = 0, masked = 0, ioted = 0, BrateCfg = 0, RateIndex = 0;
- u16 rrsr_2g_force_mask = (RRSR_11M|RRSR_5_5M|RRSR_1M);
+ u16 rrsr_2g_force_mask = (RRSR_11M|RRSR_5_5M|RRSR_2M|RRSR_1M);
u16 rrsr_2g_allow_mask = (RRSR_24M|RRSR_12M|RRSR_6M|RRSR_11M|RRSR_5_5M|RRSR_2M|RRSR_1M);
HalSetBrateCfg(adapter, val, &BrateCfg);
@@ -3871,6 +4457,178 @@ _func_enter_;
rtw_write8(adapter, REG_INIRTS_RATE_SEL, RateIndex);
}
break;
+ case HW_VAR_CORRECT_TSF:
+#ifdef CONFIG_CONCURRENT_MODE
+ hw_var_set_correct_tsf(adapter, variable, val);
+#else
+ {
+ u64 tsf;
+ struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ //tsf = pmlmeext->TSFValue - ((u32)pmlmeext->TSFValue % (pmlmeinfo->bcn_interval*1024)) -1024; //us
+ tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us
+
+ if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
+ {
+ //pHalData->RegTxPause |= STOP_BCNQ;BIT(6)
+ //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6)));
+ StopTxBeacon(adapter);
+ }
+
+ //disable related TSF function
+ rtw_write8(adapter, REG_BCN_CTRL, rtw_read8(adapter, REG_BCN_CTRL)&(~BIT(3)));
+
+ rtw_write32(adapter, REG_TSFTR, tsf);
+ rtw_write32(adapter, REG_TSFTR+4, tsf>>32);
+
+ //enable related TSF function
+ rtw_write8(adapter, REG_BCN_CTRL, rtw_read8(adapter, REG_BCN_CTRL)|BIT(3));
+
+
+ if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
+ {
+ //pHalData->RegTxPause &= (~STOP_BCNQ);
+ //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)&(~BIT(6))));
+ ResumeTxBeacon(adapter);
+ }
+ }
+#endif
+ break;
+ case HW_VAR_MLME_SITESURVEY:
+#ifdef CONFIG_CONCURRENT_MODE
+ hw_var_set_mlme_sitesurvey(adapter, variable, val);
+#else
+ {
+ u32 value_rcr, rcr_clear_bit, value_rxfltmap2;
+#ifdef CONFIG_FIND_BEST_CHANNEL
+
+ rcr_clear_bit = (RCR_CBSSID_BCN | RCR_CBSSID_DATA);
+
+ // Recieve all data frames
+ value_rxfltmap2 = 0xFFFF;
+
+#else /* CONFIG_FIND_BEST_CHANNEL */
+
+ rcr_clear_bit = RCR_CBSSID_BCN;
+
+ //config RCR to receive different BSSID & not to receive data frame
+ value_rxfltmap2 = 0;
+
+#endif /* CONFIG_FIND_BEST_CHANNEL */
+
+ if (check_fwstate(&adapter->mlmepriv, WIFI_AP_STATE) == _TRUE) {
+ rcr_clear_bit = RCR_CBSSID_BCN;
+ }
+#ifdef CONFIG_TDLS
+ // TDLS will clear RCR_CBSSID_DATA bit for connection.
+ else if (adapter->tdlsinfo.link_established == _TRUE) {
+ rcr_clear_bit = RCR_CBSSID_BCN;
+ }
+#endif // CONFIG_TDLS
+
+ value_rcr = rtw_read32(adapter, REG_RCR);
+ if(*((u8 *)val))//under sitesurvey
+ {
+ //config RCR to receive different BSSID & not to receive data frame
+ value_rcr &= ~(rcr_clear_bit);
+ rtw_write32(adapter, REG_RCR, value_rcr);
+ rtw_write16(adapter, REG_RXFLTMAP2, value_rxfltmap2);
+
+ //disable update TSF
+ rtw_write8(adapter, REG_BCN_CTRL, rtw_read8(adapter, REG_BCN_CTRL)|BIT(4));
+ }
+ else//sitesurvey done
+ {
+ struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+
+ if ((is_client_associated_to_ap(adapter) == _TRUE) ||
+ ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) )
+ {
+ //enable to rx data frame
+ //rtw_write32(Adapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
+ rtw_write16(adapter, REG_RXFLTMAP2,0xFFFF);
+
+ //enable update TSF
+ rtw_write8(adapter, REG_BCN_CTRL, rtw_read8(adapter, REG_BCN_CTRL)&(~BIT(4)));
+ }
+ else if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
+ {
+ //rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_ADF);
+ rtw_write16(adapter, REG_RXFLTMAP2,0xFFFF);
+
+ //enable update TSF
+ rtw_write8(adapter, REG_BCN_CTRL, rtw_read8(adapter, REG_BCN_CTRL)&(~BIT(4)));
+ }
+
+ value_rcr |= rcr_clear_bit;
+ if(((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) && (adapter->in_cta_test)) {
+ u32 v = rtw_read32(adapter, REG_RCR);
+ v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );//| RCR_ADF
+ rtw_write32(adapter, REG_RCR, v);
+ } else {
+ rtw_write32(adapter, REG_RCR, value_rcr);
+ }
+ }
+ }
+#endif
+ break;
+ case HW_VAR_MLME_JOIN:
+#ifdef CONFIG_CONCURRENT_MODE
+ hw_var_set_mlme_join(adapter, variable, val);
+#else
+ {
+ u8 RetryLimit = 0x30;
+ u8 type = *((u8 *)val);
+ struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
+ EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(adapter);
+
+ if(type == 0) // prepare to join
+ {
+ //enable to rx data frame.Accept all data frame
+ //rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
+ rtw_write16(adapter, REG_RXFLTMAP2,0xFFFF);
+
+ if(adapter->in_cta_test)
+ {
+ u32 v = rtw_read32(adapter, REG_RCR);
+ v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );//| RCR_ADF
+ rtw_write32(adapter, REG_RCR, v);
+ }
+ else
+ {
+ rtw_write32(adapter, REG_RCR, rtw_read32(adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
+ }
+
+ if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
+ {
+ RetryLimit = (pEEPROM->CustomerID == RT_CID_CCX) ? 7 : 48;
+ }
+ else // Ad-hoc Mode
+ {
+ RetryLimit = 0x7;
+ }
+ }
+ else if(type == 1) //joinbss_event call back when join res < 0
+ {
+ rtw_write16(adapter, REG_RXFLTMAP2,0x00);
+ }
+ else if(type == 2) //sta add event call back
+ {
+ //enable update TSF
+ rtw_write8(adapter, REG_BCN_CTRL, rtw_read8(adapter, REG_BCN_CTRL)&(~BIT(4)));
+
+ if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE))
+ {
+ RetryLimit = 0x7;
+ }
+ }
+
+ rtw_write16(adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT);
+ }
+#endif
+ break;
case HW_VAR_CHECK_TXBUF:
{
u8 retry_limit;
diff --git a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_mp.c b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_mp.c
index 7e63d5c..bb3980c 100755
--- a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_mp.c
+++ b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_mp.c
@@ -1,1157 +1,1157 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#define _RTL8188E_MP_C_
-#ifdef CONFIG_MP_INCLUDED
-
-#include <drv_types.h>
-#include <rtw_mp.h>
-
-#include <rtl8188e_hal.h>
-#include <rtl8188e_dm.h>
-
-
-s32 Hal_SetPowerTracking(PADAPTER padapter, u8 enable)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
-
- struct dm_priv *pdmpriv = &pHalData->dmpriv;
- PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
-
-
- if (!netif_running(padapter->pnetdev)) {
- RT_TRACE(_module_mp_, _drv_warning_, ("SetPowerTracking! Fail: interface not opened!\n"));
- return _FAIL;
- }
-
- if (check_fwstate(&padapter->mlmepriv, WIFI_MP_STATE) == _FALSE) {
- RT_TRACE(_module_mp_, _drv_warning_, ("SetPowerTracking! Fail: not in MP mode!\n"));
- return _FAIL;
- }
-
- if (enable)
- {
- pDM_Odm->RFCalibrateInfo.bTXPowerTracking = _TRUE;
- }
- else
- pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit= _FALSE;
-
- return _SUCCESS;
-}
-
-void Hal_GetPowerTracking(PADAPTER padapter, u8 *enable)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
-
- struct dm_priv *pdmpriv = &pHalData->dmpriv;
- PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
-
-
- *enable = pDM_Odm->RFCalibrateInfo.TxPowerTrackControl;
-}
-
-static void Hal_disable_dm(PADAPTER padapter)
-{
- u8 v8;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
-
- struct dm_priv *pdmpriv = &pHalData->dmpriv;
- PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
-
-
- //3 1. disable firmware dynamic mechanism
- // disable Power Training, Rate Adaptive
- v8 = rtw_read8(padapter, REG_BCN_CTRL);
- v8 &= ~EN_BCN_FUNCTION;
- rtw_write8(padapter, REG_BCN_CTRL, v8);
-
- //3 2. disable driver dynamic mechanism
- // disable Dynamic Initial Gain
- // disable High Power
- // disable Power Tracking
- Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-
- // enable APK, LCK and IQK but disable power tracking
- pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _FALSE;
- Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _TRUE);
-}
-
-/*-----------------------------------------------------------------------------
- * Function: mpt_SwitchRfSetting
- *
- * Overview: Change RF Setting when we siwthc channel/rate/BW for MP.
- *
- * Input: IN PADAPTER pAdapter
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Revised History:
- * When Who Remark
- * 01/08/2009 MHC Suggestion from SD3 Willis for 92S series.
- * 01/09/2009 MHC Add CCK modification for 40MHZ. Suggestion from SD3.
- *
- *---------------------------------------------------------------------------*/
-void Hal_mpt_SwitchRfSetting(PADAPTER pAdapter)
-{
- //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- struct mp_priv *pmp = &pAdapter->mppriv;
- u1Byte ChannelToSw = pmp->channel;
- ULONG ulRateIdx = pmp->rateidx;
- ULONG ulbandwidth = pmp->bandwidth;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-
- // <20120525, Kordan> Dynamic mechanism for APK, asked by Dennis.
- if (IS_HARDWARE_TYPE_8188ES(pAdapter) && (1 <= ChannelToSw && ChannelToSw <= 11) &&
- (ulRateIdx == MPT_RATE_MCS0 || ulRateIdx == MPT_RATE_1M || ulRateIdx == MPT_RATE_6M))
- {
- pmp->MptCtx.backup0x52_RF_A = (u1Byte)PHY_QueryRFReg(pAdapter, ODM_RF_PATH_A, RF_0x52, 0x000F0);
- pmp->MptCtx.backup0x52_RF_B = (u1Byte)PHY_QueryRFReg(pAdapter, ODM_RF_PATH_B, RF_0x52, 0x000F0);
- PHY_SetRFReg(pAdapter, ODM_RF_PATH_A, RF_0x52, 0x000F0, 0xD);
- PHY_SetRFReg(pAdapter, ODM_RF_PATH_B, RF_0x52, 0x000F0, 0xD);
- }
- else if (IS_HARDWARE_TYPE_8188E(pAdapter))
- {
- PHY_SetRFReg(pAdapter, ODM_RF_PATH_A, RF_0x52, 0x000F0, pmp->MptCtx.backup0x52_RF_A);
- PHY_SetRFReg(pAdapter, ODM_RF_PATH_B, RF_0x52, 0x000F0, pmp->MptCtx.backup0x52_RF_B);
- }
-
- return ;
-}
-/*---------------------------hal\rtl8192c\MPT_Phy.c---------------------------*/
-
-/*---------------------------hal\rtl8192c\MPT_HelperFunc.c---------------------------*/
-void Hal_MPT_CCKTxPowerAdjust(PADAPTER Adapter, BOOLEAN bInCH14)
-{
- u32 TempVal = 0, TempVal2 = 0, TempVal3 = 0;
- u32 CurrCCKSwingVal = 0, CCKSwingIndex = 12;
- u8 i;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
-
- // get current cck swing value and check 0xa22 & 0xa23 later to match the table.
- CurrCCKSwingVal = read_bbreg(Adapter, rCCK0_TxFilter1, bMaskHWord);
-
- if (!bInCH14)
- {
- // Readback the current bb cck swing value and compare with the table to
- // get the current swing index
- for (i = 0; i < CCK_TABLE_SIZE; i++)
- {
- if (((CurrCCKSwingVal&0xff) == (u32)CCKSwingTable_Ch1_Ch13[i][0]) &&
- (((CurrCCKSwingVal&0xff00)>>8) == (u32)CCKSwingTable_Ch1_Ch13[i][1]))
- {
- CCKSwingIndex = i;
-// RT_TRACE(COMP_INIT, DBG_LOUD,("Ch1~13, Current reg0x%x = 0x%lx, CCKSwingIndex=0x%x\n",
-// (rCCK0_TxFilter1+2), CurrCCKSwingVal, CCKSwingIndex));
- break;
- }
- }
-
- //Write 0xa22 0xa23
- TempVal = CCKSwingTable_Ch1_Ch13[CCKSwingIndex][0] +
- (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][1]<<8) ;
-
-
- //Write 0xa24 ~ 0xa27
- TempVal2 = 0;
- TempVal2 = CCKSwingTable_Ch1_Ch13[CCKSwingIndex][2] +
- (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][3]<<8) +
- (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][4]<<16 )+
- (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][5]<<24);
-
- //Write 0xa28 0xa29
- TempVal3 = 0;
- TempVal3 = CCKSwingTable_Ch1_Ch13[CCKSwingIndex][6] +
- (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][7]<<8) ;
- }
- else
- {
- for (i = 0; i < CCK_TABLE_SIZE; i++)
- {
- if (((CurrCCKSwingVal&0xff) == (u32)CCKSwingTable_Ch14[i][0]) &&
- (((CurrCCKSwingVal&0xff00)>>8) == (u32)CCKSwingTable_Ch14[i][1]))
- {
- CCKSwingIndex = i;
-// RT_TRACE(COMP_INIT, DBG_LOUD,("Ch14, Current reg0x%x = 0x%lx, CCKSwingIndex=0x%x\n",
-// (rCCK0_TxFilter1+2), CurrCCKSwingVal, CCKSwingIndex));
- break;
- }
- }
-
- //Write 0xa22 0xa23
- TempVal = CCKSwingTable_Ch14[CCKSwingIndex][0] +
- (CCKSwingTable_Ch14[CCKSwingIndex][1]<<8) ;
-
- //Write 0xa24 ~ 0xa27
- TempVal2 = 0;
- TempVal2 = CCKSwingTable_Ch14[CCKSwingIndex][2] +
- (CCKSwingTable_Ch14[CCKSwingIndex][3]<<8) +
- (CCKSwingTable_Ch14[CCKSwingIndex][4]<<16 )+
- (CCKSwingTable_Ch14[CCKSwingIndex][5]<<24);
-
- //Write 0xa28 0xa29
- TempVal3 = 0;
- TempVal3 = CCKSwingTable_Ch14[CCKSwingIndex][6] +
- (CCKSwingTable_Ch14[CCKSwingIndex][7]<<8) ;
- }
-
- write_bbreg(Adapter, rCCK0_TxFilter1, bMaskHWord, TempVal);
- write_bbreg(Adapter, rCCK0_TxFilter2, bMaskDWord, TempVal2);
- write_bbreg(Adapter, rCCK0_DebugPort, bMaskLWord, TempVal3);
-}
-
-void Hal_MPT_CCKTxPowerAdjustbyIndex(PADAPTER pAdapter, BOOLEAN beven)
-{
- s32 TempCCk;
- u8 CCK_index, CCK_index_old=0;
- u8 Action = 0; //0: no action, 1: even->odd, 2:odd->even
- u8 TimeOut = 100;
- s32 i = 0;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx;
-
- struct dm_priv *pdmpriv = &pHalData->dmpriv;
- PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
-
-
- if (!IS_92C_SERIAL(pHalData->VersionID))
- return;
-#if 0
- while(PlatformAtomicExchange(&Adapter->IntrCCKRefCount, TRUE) == TRUE)
- {
- PlatformSleepUs(100);
- TimeOut--;
- if(TimeOut <= 0)
- {
- RTPRINT(FINIT, INIT_TxPower,
- ("!!!MPT_CCKTxPowerAdjustbyIndex Wait for check CCK gain index too long!!!\n" ));
- break;
- }
- }
-#endif
- if (beven && !pMptCtx->bMptIndexEven) //odd->even
- {
- Action = 2;
- pMptCtx->bMptIndexEven = _TRUE;
- }
- else if (!beven && pMptCtx->bMptIndexEven) //even->odd
- {
- Action = 1;
- pMptCtx->bMptIndexEven = _FALSE;
- }
-
- if (Action != 0)
- {
- //Query CCK default setting From 0xa24
- TempCCk = read_bbreg(pAdapter, rCCK0_TxFilter2, bMaskDWord) & bMaskCCK;
- for (i = 0; i < CCK_TABLE_SIZE; i++)
- {
- if (pDM_Odm->RFCalibrateInfo.bCCKinCH14)
- {
- if (_rtw_memcmp((void*)&TempCCk, (void*)&CCKSwingTable_Ch14[i][2], 4) == _TRUE)
- {
- CCK_index_old = (u8) i;
-// RTPRINT(FINIT, INIT_TxPower,("MPT_CCKTxPowerAdjustbyIndex: Initial reg0x%x = 0x%lx, CCK_index=0x%x, ch 14 %d\n",
-// rCCK0_TxFilter2, TempCCk, CCK_index_old, pHalData->bCCKinCH14));
- break;
- }
- }
- else
- {
- if (_rtw_memcmp((void*)&TempCCk, (void*)&CCKSwingTable_Ch1_Ch13[i][2], 4) == _TRUE)
- {
- CCK_index_old = (u8) i;
-// RTPRINT(FINIT, INIT_TxPower,("MPT_CCKTxPowerAdjustbyIndex: Initial reg0x%x = 0x%lx, CCK_index=0x%x, ch14 %d\n",
-// rCCK0_TxFilter2, TempCCk, CCK_index_old, pHalData->bCCKinCH14));
- break;
- }
- }
- }
-
- if (Action == 1) {
- if (CCK_index_old == 0)
- CCK_index_old = 1;
- CCK_index = CCK_index_old - 1;
- } else {
- CCK_index = CCK_index_old + 1;
- }
-
- if (CCK_index == CCK_TABLE_SIZE) {
- CCK_index = CCK_TABLE_SIZE -1;
- RT_TRACE(_module_mp_, _drv_info_, ("CCK_index == CCK_TABLE_SIZE\n"));
- }
-
-// RTPRINT(FINIT, INIT_TxPower,("MPT_CCKTxPowerAdjustbyIndex: new CCK_index=0x%x\n",
-// CCK_index));
-
- //Adjust CCK according to gain index
- if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14) {
- rtw_write8(pAdapter, 0xa22, CCKSwingTable_Ch1_Ch13[CCK_index][0]);
- rtw_write8(pAdapter, 0xa23, CCKSwingTable_Ch1_Ch13[CCK_index][1]);
- rtw_write8(pAdapter, 0xa24, CCKSwingTable_Ch1_Ch13[CCK_index][2]);
- rtw_write8(pAdapter, 0xa25, CCKSwingTable_Ch1_Ch13[CCK_index][3]);
- rtw_write8(pAdapter, 0xa26, CCKSwingTable_Ch1_Ch13[CCK_index][4]);
- rtw_write8(pAdapter, 0xa27, CCKSwingTable_Ch1_Ch13[CCK_index][5]);
- rtw_write8(pAdapter, 0xa28, CCKSwingTable_Ch1_Ch13[CCK_index][6]);
- rtw_write8(pAdapter, 0xa29, CCKSwingTable_Ch1_Ch13[CCK_index][7]);
- } else {
- rtw_write8(pAdapter, 0xa22, CCKSwingTable_Ch14[CCK_index][0]);
- rtw_write8(pAdapter, 0xa23, CCKSwingTable_Ch14[CCK_index][1]);
- rtw_write8(pAdapter, 0xa24, CCKSwingTable_Ch14[CCK_index][2]);
- rtw_write8(pAdapter, 0xa25, CCKSwingTable_Ch14[CCK_index][3]);
- rtw_write8(pAdapter, 0xa26, CCKSwingTable_Ch14[CCK_index][4]);
- rtw_write8(pAdapter, 0xa27, CCKSwingTable_Ch14[CCK_index][5]);
- rtw_write8(pAdapter, 0xa28, CCKSwingTable_Ch14[CCK_index][6]);
- rtw_write8(pAdapter, 0xa29, CCKSwingTable_Ch14[CCK_index][7]);
- }
- }
-#if 0
- RTPRINT(FINIT, INIT_TxPower,
- ("MPT_CCKTxPowerAdjustbyIndex 0xa20=%x\n", PlatformEFIORead4Byte(Adapter, 0xa20)));
-
- PlatformAtomicExchange(&Adapter->IntrCCKRefCount, FALSE);
-#endif
-}
-/*---------------------------hal\rtl8192c\MPT_HelperFunc.c---------------------------*/
-
-/*
- * SetChannel
- * Description
- * Use H2C command to change channel,
- * not only modify rf register, but also other setting need to be done.
- */
-void Hal_SetChannel(PADAPTER pAdapter)
-{
-#if 0
- struct mp_priv *pmp = &pAdapter->mppriv;
-
-// SelectChannel(pAdapter, pmp->channel);
- set_channel_bwmode(pAdapter, pmp->channel, pmp->channel_offset, pmp->bandwidth);
-#else
- u8 eRFPath;
-
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- struct mp_priv *pmp = &pAdapter->mppriv;
- struct dm_priv *pdmpriv = &pHalData->dmpriv;
- PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
-
- u8 channel = pmp->channel;
- u8 bandwidth = pmp->bandwidth;
- u8 rate = pmp->rateidx;
-
-
- // set RF channel register
- for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++)
- {
- if(IS_HARDWARE_TYPE_8192D(pAdapter))
- _write_rfreg(pAdapter, eRFPath, ODM_CHANNEL, 0xFF, channel);
- else
- _write_rfreg(pAdapter, eRFPath, ODM_CHANNEL, 0x3FF, channel);
- }
- Hal_mpt_SwitchRfSetting(pAdapter);
-
- SelectChannel(pAdapter, channel);
-
- if (pHalData->CurrentChannel == 14 && !pDM_Odm->RFCalibrateInfo.bCCKinCH14) {
- pDM_Odm->RFCalibrateInfo.bCCKinCH14 = _TRUE;
- Hal_MPT_CCKTxPowerAdjust(pAdapter, pDM_Odm->RFCalibrateInfo.bCCKinCH14);
- }
- else if (pHalData->CurrentChannel != 14 && pDM_Odm->RFCalibrateInfo.bCCKinCH14) {
- pDM_Odm->RFCalibrateInfo.bCCKinCH14 = _FALSE;
- Hal_MPT_CCKTxPowerAdjust(pAdapter, pDM_Odm->RFCalibrateInfo.bCCKinCH14);
- }
-
-#endif
-}
-
-/*
- * Notice
- * Switch bandwitdth may change center frequency(channel)
- */
-void Hal_SetBandwidth(PADAPTER pAdapter)
-{
- struct mp_priv *pmp = &pAdapter->mppriv;
-
-
- SetBWMode(pAdapter, pmp->bandwidth, pmp->prime_channel_offset);
- Hal_mpt_SwitchRfSetting(pAdapter);
-}
-
-void Hal_SetCCKTxPower(PADAPTER pAdapter, u8 *TxPower)
-{
- u32 tmpval = 0;
-
-
- // 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);
-
- // 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);
-
- RT_TRACE(_module_mp_, _drv_notice_,
- ("-SetCCKTxPower: A[0x%02x] B[0x%02x]\n",
- TxPower[RF_PATH_A], TxPower[RF_PATH_B]));
-}
-
-void Hal_SetOFDMTxPower(PADAPTER pAdapter, u8 *TxPower)
-{
- u32 TxAGC = 0;
- u8 tmpval = 0;
- PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-
-
- // HT Tx-rf(A)
- tmpval = TxPower[RF_PATH_A];
- TxAGC = (tmpval<<24) | (tmpval<<16) | (tmpval<<8) | tmpval;
-
- write_bbreg(pAdapter, rTxAGC_A_Rate18_06, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_A_Rate54_24, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_A_Mcs03_Mcs00, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_A_Mcs07_Mcs04, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_A_Mcs11_Mcs08, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_A_Mcs15_Mcs12, bMaskDWord, TxAGC);
-
- // HT Tx-rf(B)
- tmpval = TxPower[RF_PATH_B];
- TxAGC = (tmpval<<24) | (tmpval<<16) | (tmpval<<8) | tmpval;
-
- write_bbreg(pAdapter, rTxAGC_B_Rate18_06, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_B_Rate54_24, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_B_Mcs03_Mcs00, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_B_Mcs07_Mcs04, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_B_Mcs11_Mcs08, bMaskDWord, TxAGC);
- write_bbreg(pAdapter, rTxAGC_B_Mcs15_Mcs12, bMaskDWord, TxAGC);
-
-}
-
-void Hal_SetAntennaPathPower(PADAPTER pAdapter)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- u8 TxPowerLevel[MAX_RF_PATH_NUMS];
- u8 rfPath;
-
- TxPowerLevel[RF_PATH_A] = pAdapter->mppriv.txpoweridx;
- TxPowerLevel[RF_PATH_B] = pAdapter->mppriv.txpoweridx_b;
-
- switch (pAdapter->mppriv.antenna_tx)
- {
- case ANTENNA_A:
- default:
- rfPath = RF_PATH_A;
- break;
- case ANTENNA_B:
- rfPath = RF_PATH_B;
- break;
- case ANTENNA_C:
- rfPath = RF_PATH_C;
- break;
- }
-
- switch (pHalData->rf_chip)
- {
- case RF_8225:
- case RF_8256:
- case RF_6052:
- Hal_SetCCKTxPower(pAdapter, TxPowerLevel);
- if (pAdapter->mppriv.rateidx < MPT_RATE_6M) // CCK rate
- Hal_MPT_CCKTxPowerAdjustbyIndex(pAdapter, TxPowerLevel[rfPath]%2 == 0);
- Hal_SetOFDMTxPower(pAdapter, TxPowerLevel);
- break;
-
- default:
- break;
- }
-}
-
-void Hal_SetTxPower(PADAPTER pAdapter)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- u8 TxPower = pAdapter->mppriv.txpoweridx;
- u8 TxPowerLevel[MAX_RF_PATH_NUMS];
- u8 rf, rfPath;
-
- for (rf = 0; rf < MAX_RF_PATH_NUMS; rf++) {
- TxPowerLevel[rf] = TxPower;
- }
-
- switch (pAdapter->mppriv.antenna_tx)
- {
- case ANTENNA_A:
- default:
- rfPath = RF_PATH_A;
- break;
- case ANTENNA_B:
- rfPath = RF_PATH_B;
- break;
- case ANTENNA_C:
- rfPath = RF_PATH_C;
- break;
- }
-
- switch (pHalData->rf_chip)
- {
- // 2008/09/12 MH Test only !! We enable the TX power tracking for MP!!!!!
- // We should call normal driver API later!!
- case RF_8225:
- case RF_8256:
- case RF_6052:
- Hal_SetCCKTxPower(pAdapter, TxPowerLevel);
- if (pAdapter->mppriv.rateidx < MPT_RATE_6M) // CCK rate
- Hal_MPT_CCKTxPowerAdjustbyIndex(pAdapter, TxPowerLevel[rfPath]%2 == 0);
- Hal_SetOFDMTxPower(pAdapter, TxPowerLevel);
- break;
-
- default:
- break;
- }
-
-// SetCCKTxPower(pAdapter, TxPower);
-// SetOFDMTxPower(pAdapter, TxPower);
-}
-
-void Hal_SetTxAGCOffset(PADAPTER pAdapter, u32 ulTxAGCOffset)
-{
- u32 TxAGCOffset_B, TxAGCOffset_C, TxAGCOffset_D,tmpAGC;
-
- TxAGCOffset_B = (ulTxAGCOffset&0x000000ff);
- TxAGCOffset_C = ((ulTxAGCOffset&0x0000ff00)>>8);
- TxAGCOffset_D = ((ulTxAGCOffset&0x00ff0000)>>16);
-
- tmpAGC = (TxAGCOffset_D<<8 | TxAGCOffset_C<<4 | TxAGCOffset_B);
- write_bbreg(pAdapter, rFPGA0_TxGainStage,
- (bXBTxAGC|bXCTxAGC|bXDTxAGC), tmpAGC);
-}
-
-void Hal_SetDataRate(PADAPTER pAdapter)
-{
- Hal_mpt_SwitchRfSetting(pAdapter);
-}
-
-void Hal_SetAntenna(PADAPTER pAdapter)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-
- R_ANTENNA_SELECT_OFDM *p_ofdm_tx; /* OFDM Tx register */
- R_ANTENNA_SELECT_CCK *p_cck_txrx;
-
- u8 r_rx_antenna_ofdm = 0, r_ant_select_cck_val = 0;
- u8 chgTx = 0, chgRx = 0;
- u32 r_ant_sel_cck_val = 0, r_ant_select_ofdm_val = 0, r_ofdm_tx_en_val = 0;
-
-
- p_ofdm_tx = (R_ANTENNA_SELECT_OFDM *)&r_ant_select_ofdm_val;
- p_cck_txrx = (R_ANTENNA_SELECT_CCK *)&r_ant_select_cck_val;
-
- p_ofdm_tx->r_ant_ht1 = 0x1;
- p_ofdm_tx->r_ant_ht2 = 0x2; // Second TX RF path is A
- p_ofdm_tx->r_ant_non_ht = 0x3; // 0x1+0x2=0x3
-
- switch (pAdapter->mppriv.antenna_tx)
- {
- case ANTENNA_A:
- p_ofdm_tx->r_tx_antenna = 0x1;
- r_ofdm_tx_en_val = 0x1;
- p_ofdm_tx->r_ant_l = 0x1;
- p_ofdm_tx->r_ant_ht_s1 = 0x1;
- p_ofdm_tx->r_ant_non_ht_s1 = 0x1;
- p_cck_txrx->r_ccktx_enable = 0x8;
- chgTx = 1;
-
- // From SD3 Willis suggestion !!! Set RF A=TX and B as standby
-// if (IS_HARDWARE_TYPE_8192S(pAdapter))
- {
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter2, 0xe, 2);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter2, 0xe, 1);
- r_ofdm_tx_en_val = 0x3;
-
- // Power save
- //cosa r_ant_select_ofdm_val = 0x11111111;
-
- // We need to close RFB by SW control
- if (pHalData->rf_type == RF_2T2R)
- {
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT10, 0);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT26, 1);
- PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT10, 0);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT1, 1);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT17, 0);
- }
- }
- break;
-
- case ANTENNA_B:
- p_ofdm_tx->r_tx_antenna = 0x2;
- r_ofdm_tx_en_val = 0x2;
- p_ofdm_tx->r_ant_l = 0x2;
- p_ofdm_tx->r_ant_ht_s1 = 0x2;
- p_ofdm_tx->r_ant_non_ht_s1 = 0x2;
- p_cck_txrx->r_ccktx_enable = 0x4;
- chgTx = 1;
-
- // From SD3 Willis suggestion !!! Set RF A as standby
- //if (IS_HARDWARE_TYPE_8192S(pAdapter))
- {
- PHY_SetBBReg(pAdapter, rFPGA0_XA_HSSIParameter2, 0xe, 1);
- PHY_SetBBReg(pAdapter, rFPGA0_XB_HSSIParameter2, 0xe, 2);
-// r_ofdm_tx_en_val = 0x3;
-
- // Power save
- //cosa r_ant_select_ofdm_val = 0x22222222;
-
- // 2008/10/31 MH From SD3 Willi's suggestion. We must read RF 1T table.
- // 2009/01/08 MH From Sd3 Willis. We need to close RFA by SW control
- if (pHalData->rf_type == RF_2T2R || pHalData->rf_type == RF_1T2R)
- {
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT10, 1);
- PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, BIT10, 0);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT26, 0);
-// PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT10, 0);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT1, 0);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT17, 1);
- }
- }
- break;
-
- case ANTENNA_AB: // For 8192S
- p_ofdm_tx->r_tx_antenna = 0x3;
- r_ofdm_tx_en_val = 0x3;
- p_ofdm_tx->r_ant_l = 0x3;
- p_ofdm_tx->r_ant_ht_s1 = 0x3;
- p_ofdm_tx->r_ant_non_ht_s1 = 0x3;
- p_cck_txrx->r_ccktx_enable = 0xC;
- chgTx = 1;
-
- // From SD3 Willis suggestion !!! Set RF B as standby
- //if (IS_HARDWARE_TYPE_8192S(pAdapter))
- {
- PHY_SetBBReg(pAdapter, rFPGA0_XA_HSSIParameter2, 0xe, 2);
- PHY_SetBBReg(pAdapter, rFPGA0_XB_HSSIParameter2, 0xe, 2);
-
- // Disable Power save
- //cosa r_ant_select_ofdm_val = 0x3321333;
-#if 0
- // 2008/10/31 MH From SD3 Willi's suggestion. We must read RFA 2T table.
- if ((pHalData->VersionID == VERSION_8192S_ACUT)) // For RTL8192SU A-Cut only, by Roger, 2008.11.07.
- {
- mpt_RFConfigFromPreParaArrary(pAdapter, 1, RF_PATH_A);
- }
-#endif
- // 2009/01/08 MH From Sd3 Willis. We need to enable RFA/B by SW control
- if (pHalData->rf_type == RF_2T2R)
- {
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT10, 0);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT26, 0);
-// PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT10, 0);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT1, 1);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT17, 1);
- }
- }
- break;
-
- default:
- break;
- }
-
- //
- // r_rx_antenna_ofdm, bit0=A, bit1=B, bit2=C, bit3=D
- // r_cckrx_enable : CCK default, 0=A, 1=B, 2=C, 3=D
- // r_cckrx_enable_2 : CCK option, 0=A, 1=B, 2=C, 3=D
- //
- switch (pAdapter->mppriv.antenna_rx)
- {
- case ANTENNA_A:
- r_rx_antenna_ofdm = 0x1; // A
- p_cck_txrx->r_cckrx_enable = 0x0; // default: A
- p_cck_txrx->r_cckrx_enable_2 = 0x0; // option: A
- chgRx = 1;
- break;
-
- case ANTENNA_B:
- r_rx_antenna_ofdm = 0x2; // B
- p_cck_txrx->r_cckrx_enable = 0x1; // default: B
- p_cck_txrx->r_cckrx_enable_2 = 0x1; // option: B
- chgRx = 1;
- break;
-
- case ANTENNA_AB:
- r_rx_antenna_ofdm = 0x3; // AB
- p_cck_txrx->r_cckrx_enable = 0x0; // default:A
- p_cck_txrx->r_cckrx_enable_2 = 0x1; // option:B
- chgRx = 1;
- break;
-
- default:
- break;
- }
-
- if (chgTx && chgRx)
- {
- switch(pHalData->rf_chip)
- {
- case RF_8225:
- case RF_8256:
- case RF_6052:
- //r_ant_sel_cck_val = r_ant_select_cck_val;
- PHY_SetBBReg(pAdapter, rFPGA1_TxInfo, 0x7fffffff, r_ant_select_ofdm_val); //OFDM Tx
- PHY_SetBBReg(pAdapter, rFPGA0_TxInfo, 0x0000000f, r_ofdm_tx_en_val); //OFDM Tx
- PHY_SetBBReg(pAdapter, rOFDM0_TRxPathEnable, 0x0000000f, r_rx_antenna_ofdm); //OFDM Rx
- PHY_SetBBReg(pAdapter, rOFDM1_TRxPathEnable, 0x0000000f, r_rx_antenna_ofdm); //OFDM Rx
- PHY_SetBBReg(pAdapter, rCCK0_AFESetting, bMaskByte3, r_ant_select_cck_val);//r_ant_sel_cck_val); //CCK TxRx
-
- break;
-
- default:
- break;
- }
- }
-
- RT_TRACE(_module_mp_, _drv_notice_, ("-SwitchAntenna: finished\n"));
-}
-
-s32 Hal_SetThermalMeter(PADAPTER pAdapter, u8 target_ther)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-
-
- if (!netif_running(pAdapter->pnetdev)) {
- RT_TRACE(_module_mp_, _drv_warning_, ("SetThermalMeter! Fail: interface not opened!\n"));
- return _FAIL;
- }
-
- if (check_fwstate(&pAdapter->mlmepriv, WIFI_MP_STATE) == _FALSE) {
- RT_TRACE(_module_mp_, _drv_warning_, ("SetThermalMeter: Fail! not in MP mode!\n"));
- return _FAIL;
- }
-
- target_ther &= 0xff;
- if (target_ther < 0x07)
- target_ther = 0x07;
- else if (target_ther > 0x1d)
- target_ther = 0x1d;
-
- pHalData->EEPROMThermalMeter = target_ther;
-
- return _SUCCESS;
-}
-
-void Hal_TriggerRFThermalMeter(PADAPTER pAdapter)
-{
-
- _write_rfreg( pAdapter, RF_PATH_A , RF_T_METER_88E , BIT17 |BIT16 , 0x03 );
-
-// RT_TRACE(_module_mp_,_drv_alert_, ("TriggerRFThermalMeter() finished.\n" ));
-}
-
-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 = _read_rfreg(pAdapter, RF_PATH_A, RF_T_METER_88E, 0xfc00);
-
-// RT_TRACE(_module_mp_, _drv_alert_, ("ThermalValue = 0x%x\n", ThermalValue));
- return (u8)ThermalValue;
-}
-
-void Hal_GetThermalMeter(PADAPTER pAdapter, u8 *value)
-{
-#if 0
- fw_cmd(pAdapter, IOCMD_GET_THERMAL_METER);
- rtw_msleep_os(1000);
- fw_cmd_data(pAdapter, value, 1);
- *value &= 0xFF;
-#else
-
- Hal_TriggerRFThermalMeter(pAdapter);
- rtw_msleep_os(1000);
- *value = Hal_ReadRFThermalMeter(pAdapter);
-#endif
-}
-
-void Hal_SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- pAdapter->mppriv.MptCtx.bSingleCarrier = bStart;
- if (bStart)// Start Single Carrier.
- {
- RT_TRACE(_module_mp_,_drv_alert_, ("SetSingleCarrierTx: test start\n"));
- // 1. if OFDM block on?
- if(!read_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn))
- write_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn, bEnable);//set OFDM block on
-
- {
- // 2. set CCK test mode off, set to CCK normal mode
- write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, bDisable);
- // 3. turn on scramble setting
- write_bbreg(pAdapter, rCCK0_System, bCCKScramble, bEnable);
- }
- // 4. Turn On Single Carrier Tx and turn off the other test modes.
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bEnable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
-#ifdef CONFIG_RTL8192C
- // 5. Disable TX power saving at STF & LLTF
- write_bbreg(pAdapter, rOFDM1_LSTF, BIT22, 1);
-#endif
- //for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
-
- }
- else// Stop Single Carrier.
- {
- RT_TRACE(_module_mp_,_drv_alert_, ("SetSingleCarrierTx: test stop\n"));
-
- // Turn off all test modes.
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
-#ifdef CONFIG_RTL8192C
- // Cancel disable TX power saving at STF&LLTF
- write_bbreg(pAdapter, rOFDM1_LSTF, BIT22, 0);
-#endif
- //Delay 10 ms //delay_ms(10);
- rtw_msleep_os(10);
-
- //BB Reset
- write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
- write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
-
- //Stop for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
-
- }
-}
-
-
-void Hal_SetSingleToneTx(PADAPTER pAdapter, u8 bStart)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- BOOLEAN is92C = IS_92C_SERIAL(pHalData->VersionID);
-
- u8 rfPath;
- u32 reg58 = 0x0;
- switch (pAdapter->mppriv.antenna_tx)
- {
- case ANTENNA_A:
- default:
- rfPath = RF_PATH_A;
- break;
- case ANTENNA_B:
- rfPath = RF_PATH_B;
- break;
- case ANTENNA_C:
- rfPath = RF_PATH_C;
- break;
- }
-
- pAdapter->mppriv.MptCtx.bSingleTone = bStart;
- if (bStart)// Start Single Tone.
- {
- RT_TRACE(_module_mp_,_drv_alert_, ("SetSingleToneTx: test start\n"));
- { // <20120326, Kordan> To amplify the power of tone for Xtal calibration. (asked by Edlu)
- if (IS_HARDWARE_TYPE_8188E(pAdapter))
- {
- reg58 = PHY_QueryRFReg(pAdapter, RF_PATH_A, LNA_Low_Gain_3, bRFRegOffsetMask);
- reg58 &= 0xFFFFFFF0;
- reg58 += 2;
- PHY_SetRFReg(pAdapter, RF_PATH_A, LNA_Low_Gain_3, bRFRegOffsetMask, reg58);
- }
- PHY_SetBBReg(pAdapter, rFPGA0_RFMOD, bCCKEn, 0x0);
- PHY_SetBBReg(pAdapter, rFPGA0_RFMOD, bOFDMEn, 0x0);
- }
-
- if (is92C)
- {
- _write_rfreg(pAdapter, RF_PATH_A, 0x21, BIT19, 0x01);
- rtw_usleep_os(100);
- if (rfPath == RF_PATH_A)
- write_rfreg(pAdapter, RF_PATH_B, 0x00, 0x10000); // PAD all on.
- else if (rfPath == RF_PATH_B)
- write_rfreg(pAdapter, RF_PATH_A, 0x00, 0x10000); // PAD all on.
- write_rfreg(pAdapter, rfPath, 0x00, 0x2001f); // PAD all on.
- rtw_usleep_os(100);
- }
- else
- {
- write_rfreg(pAdapter, rfPath, 0x21, 0xd4000);
- rtw_usleep_os(100);
- write_rfreg(pAdapter, rfPath, 0x00, 0x2001f); // PAD all on.
- rtw_usleep_os(100);
- }
-
- //for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
-
- }
- else// Stop Single Tone.
- {
- RT_TRACE(_module_mp_,_drv_alert_, ("SetSingleToneTx: test stop\n"));
-
- { // <20120326, Kordan> To amplify the power of tone for Xtal calibration. (asked by Edlu)
- // <20120326, Kordan> Only in single tone mode. (asked by Edlu)
- if (IS_HARDWARE_TYPE_8188E(pAdapter))
- {
- reg58 = PHY_QueryRFReg(pAdapter, RF_PATH_A, LNA_Low_Gain_3, bRFRegOffsetMask);
- reg58 &= 0xFFFFFFF0;
- PHY_SetRFReg(pAdapter, RF_PATH_A, LNA_Low_Gain_3, bRFRegOffsetMask, reg58);
- }
-
- write_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn, 0x1);
- write_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn, 0x1);
- }
- if (is92C) {
- _write_rfreg(pAdapter, RF_PATH_A, 0x21, BIT19, 0x00);
- rtw_usleep_os(100);
- write_rfreg(pAdapter, RF_PATH_A, 0x00, 0x32d75); // PAD all on.
- write_rfreg(pAdapter, RF_PATH_B, 0x00, 0x32d75); // PAD all on.
- rtw_usleep_os(100);
- } else {
- write_rfreg(pAdapter, rfPath, 0x21, 0x54000);
- rtw_usleep_os(100);
- write_rfreg(pAdapter, rfPath, 0x00, 0x30000); // PAD all on.
- rtw_usleep_os(100);
- }
-
- //Stop for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
-
- }
-
-}
-
-
-
-void Hal_SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart)
-{
- pAdapter->mppriv.MptCtx.bCarrierSuppression = bStart;
- if (bStart) // Start Carrier Suppression.
- {
- RT_TRACE(_module_mp_,_drv_alert_, ("SetCarrierSuppressionTx: test start\n"));
- //if(pMgntInfo->dot11CurrentWirelessMode == WIRELESS_MODE_B)
- if (pAdapter->mppriv.rateidx <= MPT_RATE_11M)
- {
- // 1. if CCK block on?
- if(!read_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn))
- write_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn, bEnable);//set CCK block on
-
- //Turn Off All Test Mode
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
-
- write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, 0x2); //transmit mode
- write_bbreg(pAdapter, rCCK0_System, bCCKScramble, 0x0); //turn off scramble setting
-
- //Set CCK Tx Test Rate
- //PHY_SetBBReg(pAdapter, rCCK0_System, bCCKTxRate, pMgntInfo->ForcedDataRate);
- write_bbreg(pAdapter, rCCK0_System, bCCKTxRate, 0x0); //Set FTxRate to 1Mbps
- }
-
- //for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
-
- }
- else// Stop Carrier Suppression.
- {
- RT_TRACE(_module_mp_,_drv_alert_, ("SetCarrierSuppressionTx: test stop\n"));
- //if(pMgntInfo->dot11CurrentWirelessMode == WIRELESS_MODE_B)
- if (pAdapter->mppriv.rateidx <= MPT_RATE_11M ) {
- write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, 0x0); //normal mode
- write_bbreg(pAdapter, rCCK0_System, bCCKScramble, 0x1); //turn on scramble setting
-
- //BB Reset
- write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
- write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
- }
-
- //Stop for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
-
- }
- //DbgPrint("\n MPT_ProSetCarrierSupp() is finished. \n");
-}
-
-void Hal_SetCCKContinuousTx(PADAPTER pAdapter, u8 bStart)
-{
- u32 cckrate;
-
- if (bStart)
- {
- RT_TRACE(_module_mp_, _drv_alert_,
- ("SetCCKContinuousTx: test start\n"));
-
- // 1. if CCK block on?
- if(!read_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn))
- write_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn, bEnable);//set CCK block on
-
- //Turn Off All Test Mode
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
- //Set CCK Tx Test Rate
- #if 0
- switch(pAdapter->mppriv.rateidx)
- {
- case 2:
- cckrate = 0;
- break;
- case 4:
- cckrate = 1;
- break;
- case 11:
- cckrate = 2;
- break;
- case 22:
- cckrate = 3;
- break;
- default:
- cckrate = 0;
- break;
- }
- #else
- cckrate = pAdapter->mppriv.rateidx;
- #endif
- write_bbreg(pAdapter, rCCK0_System, bCCKTxRate, cckrate);
- write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, 0x2); //transmit mode
- write_bbreg(pAdapter, rCCK0_System, bCCKScramble, bEnable); //turn on scramble setting
-
-#ifdef CONFIG_RTL8192C
- // Patch for CCK 11M waveform
- if (cckrate == MPT_RATE_1M)
- write_bbreg(pAdapter, 0xA71, BIT(6), bDisable);
- else
- write_bbreg(pAdapter, 0xA71, BIT(6), bEnable);
-#endif
- //for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
-
- }
- else {
- RT_TRACE(_module_mp_, _drv_info_,
- ("SetCCKContinuousTx: test stop\n"));
-
- write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, 0x0); //normal mode
- write_bbreg(pAdapter, rCCK0_System, bCCKScramble, bEnable); //turn on scramble setting
-
- //BB Reset
- write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
- write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
-
- //Stop for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
- }
-
- pAdapter->mppriv.MptCtx.bCckContTx = bStart;
- pAdapter->mppriv.MptCtx.bOfdmContTx = _FALSE;
-}/* mpt_StartCckContTx */
-
-void Hal_SetOFDMContinuousTx(PADAPTER pAdapter, u8 bStart)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
-
- if (bStart) {
- RT_TRACE(_module_mp_, _drv_info_, ("SetOFDMContinuousTx: test start\n"));
- // 1. if OFDM block on?
- if(!read_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn))
- write_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn, bEnable);//set OFDM block on
- {
-
- // 2. set CCK test mode off, set to CCK normal mode
- write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, bDisable);
-
- // 3. turn on scramble setting
- write_bbreg(pAdapter, rCCK0_System, bCCKScramble, bEnable);
- }
- // 4. Turn On Continue Tx and turn off the other test modes.
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bEnable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
-
- //for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
-
- } else {
- RT_TRACE(_module_mp_,_drv_info_, ("SetOFDMContinuousTx: test stop\n"));
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
- write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
- //Delay 10 ms
- rtw_msleep_os(10);
- //BB Reset
- write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
- write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
-
- //Stop for dynamic set Power index.
- write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
- write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
- }
-
- pAdapter->mppriv.MptCtx.bCckContTx = _FALSE;
- pAdapter->mppriv.MptCtx.bOfdmContTx = bStart;
-}/* mpt_StartOfdmContTx */
-
-void Hal_SetContinuousTx(PADAPTER pAdapter, u8 bStart)
-{
-#if 0
- // ADC turn off [bit24-21] adc port0 ~ port1
- if (bStart) {
- write_bbreg(pAdapter, rRx_Wait_CCCA, read_bbreg(pAdapter, rRx_Wait_CCCA) & 0xFE1FFFFF);
- rtw_usleep_os(100);
- }
-#endif
- RT_TRACE(_module_mp_, _drv_info_,
- ("SetContinuousTx: rate:%d\n", pAdapter->mppriv.rateidx));
-
- pAdapter->mppriv.MptCtx.bStartContTx = bStart;
- if (pAdapter->mppriv.rateidx <= MPT_RATE_11M)
- {
- Hal_SetCCKContinuousTx(pAdapter, bStart);
- }
- else if ((pAdapter->mppriv.rateidx >= MPT_RATE_6M) &&
- (pAdapter->mppriv.rateidx <= MPT_RATE_MCS15))
- {
- Hal_SetOFDMContinuousTx(pAdapter, bStart);
- }
-#if 0
- // ADC turn on [bit24-21] adc port0 ~ port1
- if (!bStart) {
- write_bbreg(pAdapter, rRx_Wait_CCCA, read_bbreg(pAdapter, rRx_Wait_CCCA) | 0x01E00000);
- }
-#endif
-}
-
-#endif // CONFIG_MP_INCLUDE
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTL8188E_MP_C_
+#ifdef CONFIG_MP_INCLUDED
+
+#include <drv_types.h>
+#include <rtw_mp.h>
+
+#include <rtl8188e_hal.h>
+#include <rtl8188e_dm.h>
+
+
+s32 Hal_SetPowerTracking(PADAPTER padapter, u8 enable)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+
+ struct dm_priv *pdmpriv = &pHalData->dmpriv;
+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
+
+
+ if (!netif_running(padapter->pnetdev)) {
+ RT_TRACE(_module_mp_, _drv_warning_, ("SetPowerTracking! Fail: interface not opened!\n"));
+ return _FAIL;
+ }
+
+ if (check_fwstate(&padapter->mlmepriv, WIFI_MP_STATE) == _FALSE) {
+ RT_TRACE(_module_mp_, _drv_warning_, ("SetPowerTracking! Fail: not in MP mode!\n"));
+ return _FAIL;
+ }
+
+ if (enable)
+ {
+ pDM_Odm->RFCalibrateInfo.bTXPowerTracking = _TRUE;
+ }
+ else
+ pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit= _FALSE;
+
+ return _SUCCESS;
+}
+
+void Hal_GetPowerTracking(PADAPTER padapter, u8 *enable)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+
+ struct dm_priv *pdmpriv = &pHalData->dmpriv;
+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
+
+
+ *enable = pDM_Odm->RFCalibrateInfo.TxPowerTrackControl;
+}
+
+static void Hal_disable_dm(PADAPTER padapter)
+{
+ u8 v8;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+
+ struct dm_priv *pdmpriv = &pHalData->dmpriv;
+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
+
+
+ //3 1. disable firmware dynamic mechanism
+ // disable Power Training, Rate Adaptive
+ v8 = rtw_read8(padapter, REG_BCN_CTRL);
+ v8 &= ~EN_BCN_FUNCTION;
+ rtw_write8(padapter, REG_BCN_CTRL, v8);
+
+ //3 2. disable driver dynamic mechanism
+ // disable Dynamic Initial Gain
+ // disable High Power
+ // disable Power Tracking
+ Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
+
+ // enable APK, LCK and IQK but disable power tracking
+ pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _FALSE;
+ Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _TRUE);
+}
+
+/*-----------------------------------------------------------------------------
+ * Function: mpt_SwitchRfSetting
+ *
+ * Overview: Change RF Setting when we siwthc channel/rate/BW for MP.
+ *
+ * Input: IN PADAPTER pAdapter
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ * Revised History:
+ * When Who Remark
+ * 01/08/2009 MHC Suggestion from SD3 Willis for 92S series.
+ * 01/09/2009 MHC Add CCK modification for 40MHZ. Suggestion from SD3.
+ *
+ *---------------------------------------------------------------------------*/
+void Hal_mpt_SwitchRfSetting(PADAPTER pAdapter)
+{
+ //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ struct mp_priv *pmp = &pAdapter->mppriv;
+ u1Byte ChannelToSw = pmp->channel;
+ ULONG ulRateIdx = pmp->rateidx;
+ ULONG ulbandwidth = pmp->bandwidth;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+
+ // <20120525, Kordan> Dynamic mechanism for APK, asked by Dennis.
+ if (IS_HARDWARE_TYPE_8188ES(pAdapter) && (1 <= ChannelToSw && ChannelToSw <= 11) &&
+ (ulRateIdx == MPT_RATE_MCS0 || ulRateIdx == MPT_RATE_1M || ulRateIdx == MPT_RATE_6M))
+ {
+ pmp->MptCtx.backup0x52_RF_A = (u1Byte)PHY_QueryRFReg(pAdapter, ODM_RF_PATH_A, RF_0x52, 0x000F0);
+ pmp->MptCtx.backup0x52_RF_B = (u1Byte)PHY_QueryRFReg(pAdapter, ODM_RF_PATH_B, RF_0x52, 0x000F0);
+ PHY_SetRFReg(pAdapter, ODM_RF_PATH_A, RF_0x52, 0x000F0, 0xD);
+ PHY_SetRFReg(pAdapter, ODM_RF_PATH_B, RF_0x52, 0x000F0, 0xD);
+ }
+ else if (IS_HARDWARE_TYPE_8188E(pAdapter))
+ {
+ PHY_SetRFReg(pAdapter, ODM_RF_PATH_A, RF_0x52, 0x000F0, pmp->MptCtx.backup0x52_RF_A);
+ PHY_SetRFReg(pAdapter, ODM_RF_PATH_B, RF_0x52, 0x000F0, pmp->MptCtx.backup0x52_RF_B);
+ }
+
+ return ;
+}
+/*---------------------------hal\rtl8192c\MPT_Phy.c---------------------------*/
+
+/*---------------------------hal\rtl8192c\MPT_HelperFunc.c---------------------------*/
+void Hal_MPT_CCKTxPowerAdjust(PADAPTER Adapter, BOOLEAN bInCH14)
+{
+ u32 TempVal = 0, TempVal2 = 0, TempVal3 = 0;
+ u32 CurrCCKSwingVal = 0, CCKSwingIndex = 12;
+ u8 i;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+
+ // get current cck swing value and check 0xa22 & 0xa23 later to match the table.
+ CurrCCKSwingVal = read_bbreg(Adapter, rCCK0_TxFilter1, bMaskHWord);
+
+ if (!bInCH14)
+ {
+ // Readback the current bb cck swing value and compare with the table to
+ // get the current swing index
+ for (i = 0; i < CCK_TABLE_SIZE; i++)
+ {
+ if (((CurrCCKSwingVal&0xff) == (u32)CCKSwingTable_Ch1_Ch13[i][0]) &&
+ (((CurrCCKSwingVal&0xff00)>>8) == (u32)CCKSwingTable_Ch1_Ch13[i][1]))
+ {
+ CCKSwingIndex = i;
+// RT_TRACE(COMP_INIT, DBG_LOUD,("Ch1~13, Current reg0x%x = 0x%lx, CCKSwingIndex=0x%x\n",
+// (rCCK0_TxFilter1+2), CurrCCKSwingVal, CCKSwingIndex));
+ break;
+ }
+ }
+
+ //Write 0xa22 0xa23
+ TempVal = CCKSwingTable_Ch1_Ch13[CCKSwingIndex][0] +
+ (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][1]<<8) ;
+
+
+ //Write 0xa24 ~ 0xa27
+ TempVal2 = 0;
+ TempVal2 = CCKSwingTable_Ch1_Ch13[CCKSwingIndex][2] +
+ (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][3]<<8) +
+ (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][4]<<16 )+
+ (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][5]<<24);
+
+ //Write 0xa28 0xa29
+ TempVal3 = 0;
+ TempVal3 = CCKSwingTable_Ch1_Ch13[CCKSwingIndex][6] +
+ (CCKSwingTable_Ch1_Ch13[CCKSwingIndex][7]<<8) ;
+ }
+ else
+ {
+ for (i = 0; i < CCK_TABLE_SIZE; i++)
+ {
+ if (((CurrCCKSwingVal&0xff) == (u32)CCKSwingTable_Ch14[i][0]) &&
+ (((CurrCCKSwingVal&0xff00)>>8) == (u32)CCKSwingTable_Ch14[i][1]))
+ {
+ CCKSwingIndex = i;
+// RT_TRACE(COMP_INIT, DBG_LOUD,("Ch14, Current reg0x%x = 0x%lx, CCKSwingIndex=0x%x\n",
+// (rCCK0_TxFilter1+2), CurrCCKSwingVal, CCKSwingIndex));
+ break;
+ }
+ }
+
+ //Write 0xa22 0xa23
+ TempVal = CCKSwingTable_Ch14[CCKSwingIndex][0] +
+ (CCKSwingTable_Ch14[CCKSwingIndex][1]<<8) ;
+
+ //Write 0xa24 ~ 0xa27
+ TempVal2 = 0;
+ TempVal2 = CCKSwingTable_Ch14[CCKSwingIndex][2] +
+ (CCKSwingTable_Ch14[CCKSwingIndex][3]<<8) +
+ (CCKSwingTable_Ch14[CCKSwingIndex][4]<<16 )+
+ (CCKSwingTable_Ch14[CCKSwingIndex][5]<<24);
+
+ //Write 0xa28 0xa29
+ TempVal3 = 0;
+ TempVal3 = CCKSwingTable_Ch14[CCKSwingIndex][6] +
+ (CCKSwingTable_Ch14[CCKSwingIndex][7]<<8) ;
+ }
+
+ write_bbreg(Adapter, rCCK0_TxFilter1, bMaskHWord, TempVal);
+ write_bbreg(Adapter, rCCK0_TxFilter2, bMaskDWord, TempVal2);
+ write_bbreg(Adapter, rCCK0_DebugPort, bMaskLWord, TempVal3);
+}
+
+void Hal_MPT_CCKTxPowerAdjustbyIndex(PADAPTER pAdapter, BOOLEAN beven)
+{
+ s32 TempCCk;
+ u8 CCK_index, CCK_index_old=0;
+ u8 Action = 0; //0: no action, 1: even->odd, 2:odd->even
+ u8 TimeOut = 100;
+ s32 i = 0;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx;
+
+ struct dm_priv *pdmpriv = &pHalData->dmpriv;
+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
+
+
+ if (!IS_92C_SERIAL(pHalData->VersionID))
+ return;
+#if 0
+ while(PlatformAtomicExchange(&Adapter->IntrCCKRefCount, TRUE) == TRUE)
+ {
+ PlatformSleepUs(100);
+ TimeOut--;
+ if(TimeOut <= 0)
+ {
+ RTPRINT(FINIT, INIT_TxPower,
+ ("!!!MPT_CCKTxPowerAdjustbyIndex Wait for check CCK gain index too long!!!\n" ));
+ break;
+ }
+ }
+#endif
+ if (beven && !pMptCtx->bMptIndexEven) //odd->even
+ {
+ Action = 2;
+ pMptCtx->bMptIndexEven = _TRUE;
+ }
+ else if (!beven && pMptCtx->bMptIndexEven) //even->odd
+ {
+ Action = 1;
+ pMptCtx->bMptIndexEven = _FALSE;
+ }
+
+ if (Action != 0)
+ {
+ //Query CCK default setting From 0xa24
+ TempCCk = read_bbreg(pAdapter, rCCK0_TxFilter2, bMaskDWord) & bMaskCCK;
+ for (i = 0; i < CCK_TABLE_SIZE; i++)
+ {
+ if (pDM_Odm->RFCalibrateInfo.bCCKinCH14)
+ {
+ if (_rtw_memcmp((void*)&TempCCk, (void*)&CCKSwingTable_Ch14[i][2], 4) == _TRUE)
+ {
+ CCK_index_old = (u8) i;
+// RTPRINT(FINIT, INIT_TxPower,("MPT_CCKTxPowerAdjustbyIndex: Initial reg0x%x = 0x%lx, CCK_index=0x%x, ch 14 %d\n",
+// rCCK0_TxFilter2, TempCCk, CCK_index_old, pHalData->bCCKinCH14));
+ break;
+ }
+ }
+ else
+ {
+ if (_rtw_memcmp((void*)&TempCCk, (void*)&CCKSwingTable_Ch1_Ch13[i][2], 4) == _TRUE)
+ {
+ CCK_index_old = (u8) i;
+// RTPRINT(FINIT, INIT_TxPower,("MPT_CCKTxPowerAdjustbyIndex: Initial reg0x%x = 0x%lx, CCK_index=0x%x, ch14 %d\n",
+// rCCK0_TxFilter2, TempCCk, CCK_index_old, pHalData->bCCKinCH14));
+ break;
+ }
+ }
+ }
+
+ if (Action == 1) {
+ if (CCK_index_old == 0)
+ CCK_index_old = 1;
+ CCK_index = CCK_index_old - 1;
+ } else {
+ CCK_index = CCK_index_old + 1;
+ }
+
+ if (CCK_index == CCK_TABLE_SIZE) {
+ CCK_index = CCK_TABLE_SIZE -1;
+ RT_TRACE(_module_mp_, _drv_info_, ("CCK_index == CCK_TABLE_SIZE\n"));
+ }
+
+// RTPRINT(FINIT, INIT_TxPower,("MPT_CCKTxPowerAdjustbyIndex: new CCK_index=0x%x\n",
+// CCK_index));
+
+ //Adjust CCK according to gain index
+ if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14) {
+ rtw_write8(pAdapter, 0xa22, CCKSwingTable_Ch1_Ch13[CCK_index][0]);
+ rtw_write8(pAdapter, 0xa23, CCKSwingTable_Ch1_Ch13[CCK_index][1]);
+ rtw_write8(pAdapter, 0xa24, CCKSwingTable_Ch1_Ch13[CCK_index][2]);
+ rtw_write8(pAdapter, 0xa25, CCKSwingTable_Ch1_Ch13[CCK_index][3]);
+ rtw_write8(pAdapter, 0xa26, CCKSwingTable_Ch1_Ch13[CCK_index][4]);
+ rtw_write8(pAdapter, 0xa27, CCKSwingTable_Ch1_Ch13[CCK_index][5]);
+ rtw_write8(pAdapter, 0xa28, CCKSwingTable_Ch1_Ch13[CCK_index][6]);
+ rtw_write8(pAdapter, 0xa29, CCKSwingTable_Ch1_Ch13[CCK_index][7]);
+ } else {
+ rtw_write8(pAdapter, 0xa22, CCKSwingTable_Ch14[CCK_index][0]);
+ rtw_write8(pAdapter, 0xa23, CCKSwingTable_Ch14[CCK_index][1]);
+ rtw_write8(pAdapter, 0xa24, CCKSwingTable_Ch14[CCK_index][2]);
+ rtw_write8(pAdapter, 0xa25, CCKSwingTable_Ch14[CCK_index][3]);
+ rtw_write8(pAdapter, 0xa26, CCKSwingTable_Ch14[CCK_index][4]);
+ rtw_write8(pAdapter, 0xa27, CCKSwingTable_Ch14[CCK_index][5]);
+ rtw_write8(pAdapter, 0xa28, CCKSwingTable_Ch14[CCK_index][6]);
+ rtw_write8(pAdapter, 0xa29, CCKSwingTable_Ch14[CCK_index][7]);
+ }
+ }
+#if 0
+ RTPRINT(FINIT, INIT_TxPower,
+ ("MPT_CCKTxPowerAdjustbyIndex 0xa20=%x\n", PlatformEFIORead4Byte(Adapter, 0xa20)));
+
+ PlatformAtomicExchange(&Adapter->IntrCCKRefCount, FALSE);
+#endif
+}
+/*---------------------------hal\rtl8192c\MPT_HelperFunc.c---------------------------*/
+
+/*
+ * SetChannel
+ * Description
+ * Use H2C command to change channel,
+ * not only modify rf register, but also other setting need to be done.
+ */
+void Hal_SetChannel(PADAPTER pAdapter)
+{
+#if 0
+ struct mp_priv *pmp = &pAdapter->mppriv;
+
+// SelectChannel(pAdapter, pmp->channel);
+ set_channel_bwmode(pAdapter, pmp->channel, pmp->channel_offset, pmp->bandwidth);
+#else
+ u8 eRFPath;
+
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ struct mp_priv *pmp = &pAdapter->mppriv;
+ struct dm_priv *pdmpriv = &pHalData->dmpriv;
+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
+
+ u8 channel = pmp->channel;
+ u8 bandwidth = pmp->bandwidth;
+ u8 rate = pmp->rateidx;
+
+
+ // set RF channel register
+ for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++)
+ {
+ if(IS_HARDWARE_TYPE_8192D(pAdapter))
+ _write_rfreg(pAdapter, eRFPath, ODM_CHANNEL, 0xFF, channel);
+ else
+ _write_rfreg(pAdapter, eRFPath, ODM_CHANNEL, 0x3FF, channel);
+ }
+ Hal_mpt_SwitchRfSetting(pAdapter);
+
+ SelectChannel(pAdapter, channel);
+
+ if (pHalData->CurrentChannel == 14 && !pDM_Odm->RFCalibrateInfo.bCCKinCH14) {
+ pDM_Odm->RFCalibrateInfo.bCCKinCH14 = _TRUE;
+ Hal_MPT_CCKTxPowerAdjust(pAdapter, pDM_Odm->RFCalibrateInfo.bCCKinCH14);
+ }
+ else if (pHalData->CurrentChannel != 14 && pDM_Odm->RFCalibrateInfo.bCCKinCH14) {
+ pDM_Odm->RFCalibrateInfo.bCCKinCH14 = _FALSE;
+ Hal_MPT_CCKTxPowerAdjust(pAdapter, pDM_Odm->RFCalibrateInfo.bCCKinCH14);
+ }
+
+#endif
+}
+
+/*
+ * Notice
+ * Switch bandwitdth may change center frequency(channel)
+ */
+void Hal_SetBandwidth(PADAPTER pAdapter)
+{
+ struct mp_priv *pmp = &pAdapter->mppriv;
+
+
+ SetBWMode(pAdapter, pmp->bandwidth, pmp->prime_channel_offset);
+ Hal_mpt_SwitchRfSetting(pAdapter);
+}
+
+void Hal_SetCCKTxPower(PADAPTER pAdapter, u8 *TxPower)
+{
+ u32 tmpval = 0;
+
+
+ // 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);
+
+ // 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);
+
+ RT_TRACE(_module_mp_, _drv_notice_,
+ ("-SetCCKTxPower: A[0x%02x] B[0x%02x]\n",
+ TxPower[RF_PATH_A], TxPower[RF_PATH_B]));
+}
+
+void Hal_SetOFDMTxPower(PADAPTER pAdapter, u8 *TxPower)
+{
+ u32 TxAGC = 0;
+ u8 tmpval = 0;
+ PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+
+
+ // HT Tx-rf(A)
+ tmpval = TxPower[RF_PATH_A];
+ TxAGC = (tmpval<<24) | (tmpval<<16) | (tmpval<<8) | tmpval;
+
+ write_bbreg(pAdapter, rTxAGC_A_Rate18_06, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_A_Rate54_24, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_A_Mcs03_Mcs00, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_A_Mcs07_Mcs04, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_A_Mcs11_Mcs08, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_A_Mcs15_Mcs12, bMaskDWord, TxAGC);
+
+ // HT Tx-rf(B)
+ tmpval = TxPower[RF_PATH_B];
+ TxAGC = (tmpval<<24) | (tmpval<<16) | (tmpval<<8) | tmpval;
+
+ write_bbreg(pAdapter, rTxAGC_B_Rate18_06, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_B_Rate54_24, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_B_Mcs03_Mcs00, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_B_Mcs07_Mcs04, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_B_Mcs11_Mcs08, bMaskDWord, TxAGC);
+ write_bbreg(pAdapter, rTxAGC_B_Mcs15_Mcs12, bMaskDWord, TxAGC);
+
+}
+
+void Hal_SetAntennaPathPower(PADAPTER pAdapter)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ u8 TxPowerLevel[MAX_RF_PATH_NUMS];
+ u8 rfPath;
+
+ TxPowerLevel[RF_PATH_A] = pAdapter->mppriv.txpoweridx;
+ TxPowerLevel[RF_PATH_B] = pAdapter->mppriv.txpoweridx_b;
+
+ switch (pAdapter->mppriv.antenna_tx)
+ {
+ case ANTENNA_A:
+ default:
+ rfPath = RF_PATH_A;
+ break;
+ case ANTENNA_B:
+ rfPath = RF_PATH_B;
+ break;
+ case ANTENNA_C:
+ rfPath = RF_PATH_C;
+ break;
+ }
+
+ switch (pHalData->rf_chip)
+ {
+ case RF_8225:
+ case RF_8256:
+ case RF_6052:
+ Hal_SetCCKTxPower(pAdapter, TxPowerLevel);
+ if (pAdapter->mppriv.rateidx < MPT_RATE_6M) // CCK rate
+ Hal_MPT_CCKTxPowerAdjustbyIndex(pAdapter, TxPowerLevel[rfPath]%2 == 0);
+ Hal_SetOFDMTxPower(pAdapter, TxPowerLevel);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Hal_SetTxPower(PADAPTER pAdapter)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ u8 TxPower = pAdapter->mppriv.txpoweridx;
+ u8 TxPowerLevel[MAX_RF_PATH_NUMS];
+ u8 rf, rfPath;
+
+ for (rf = 0; rf < MAX_RF_PATH_NUMS; rf++) {
+ TxPowerLevel[rf] = TxPower;
+ }
+
+ switch (pAdapter->mppriv.antenna_tx)
+ {
+ case ANTENNA_A:
+ default:
+ rfPath = RF_PATH_A;
+ break;
+ case ANTENNA_B:
+ rfPath = RF_PATH_B;
+ break;
+ case ANTENNA_C:
+ rfPath = RF_PATH_C;
+ break;
+ }
+
+ switch (pHalData->rf_chip)
+ {
+ // 2008/09/12 MH Test only !! We enable the TX power tracking for MP!!!!!
+ // We should call normal driver API later!!
+ case RF_8225:
+ case RF_8256:
+ case RF_6052:
+ Hal_SetCCKTxPower(pAdapter, TxPowerLevel);
+ if (pAdapter->mppriv.rateidx < MPT_RATE_6M) // CCK rate
+ Hal_MPT_CCKTxPowerAdjustbyIndex(pAdapter, TxPowerLevel[rfPath]%2 == 0);
+ Hal_SetOFDMTxPower(pAdapter, TxPowerLevel);
+ break;
+
+ default:
+ break;
+ }
+
+// SetCCKTxPower(pAdapter, TxPower);
+// SetOFDMTxPower(pAdapter, TxPower);
+}
+
+void Hal_SetTxAGCOffset(PADAPTER pAdapter, u32 ulTxAGCOffset)
+{
+ u32 TxAGCOffset_B, TxAGCOffset_C, TxAGCOffset_D,tmpAGC;
+
+ TxAGCOffset_B = (ulTxAGCOffset&0x000000ff);
+ TxAGCOffset_C = ((ulTxAGCOffset&0x0000ff00)>>8);
+ TxAGCOffset_D = ((ulTxAGCOffset&0x00ff0000)>>16);
+
+ tmpAGC = (TxAGCOffset_D<<8 | TxAGCOffset_C<<4 | TxAGCOffset_B);
+ write_bbreg(pAdapter, rFPGA0_TxGainStage,
+ (bXBTxAGC|bXCTxAGC|bXDTxAGC), tmpAGC);
+}
+
+void Hal_SetDataRate(PADAPTER pAdapter)
+{
+ Hal_mpt_SwitchRfSetting(pAdapter);
+}
+
+void Hal_SetAntenna(PADAPTER pAdapter)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+
+ R_ANTENNA_SELECT_OFDM *p_ofdm_tx; /* OFDM Tx register */
+ R_ANTENNA_SELECT_CCK *p_cck_txrx;
+
+ u8 r_rx_antenna_ofdm = 0, r_ant_select_cck_val = 0;
+ u8 chgTx = 0, chgRx = 0;
+ u32 r_ant_sel_cck_val = 0, r_ant_select_ofdm_val = 0, r_ofdm_tx_en_val = 0;
+
+
+ p_ofdm_tx = (R_ANTENNA_SELECT_OFDM *)&r_ant_select_ofdm_val;
+ p_cck_txrx = (R_ANTENNA_SELECT_CCK *)&r_ant_select_cck_val;
+
+ p_ofdm_tx->r_ant_ht1 = 0x1;
+ p_ofdm_tx->r_ant_ht2 = 0x2; // Second TX RF path is A
+ p_ofdm_tx->r_ant_non_ht = 0x3; // 0x1+0x2=0x3
+
+ switch (pAdapter->mppriv.antenna_tx)
+ {
+ case ANTENNA_A:
+ p_ofdm_tx->r_tx_antenna = 0x1;
+ r_ofdm_tx_en_val = 0x1;
+ p_ofdm_tx->r_ant_l = 0x1;
+ p_ofdm_tx->r_ant_ht_s1 = 0x1;
+ p_ofdm_tx->r_ant_non_ht_s1 = 0x1;
+ p_cck_txrx->r_ccktx_enable = 0x8;
+ chgTx = 1;
+
+ // From SD3 Willis suggestion !!! Set RF A=TX and B as standby
+// if (IS_HARDWARE_TYPE_8192S(pAdapter))
+ {
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter2, 0xe, 2);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter2, 0xe, 1);
+ r_ofdm_tx_en_val = 0x3;
+
+ // Power save
+ //cosa r_ant_select_ofdm_val = 0x11111111;
+
+ // We need to close RFB by SW control
+ if (pHalData->rf_type == RF_2T2R)
+ {
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT10, 0);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT26, 1);
+ PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT10, 0);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT1, 1);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT17, 0);
+ }
+ }
+ break;
+
+ case ANTENNA_B:
+ p_ofdm_tx->r_tx_antenna = 0x2;
+ r_ofdm_tx_en_val = 0x2;
+ p_ofdm_tx->r_ant_l = 0x2;
+ p_ofdm_tx->r_ant_ht_s1 = 0x2;
+ p_ofdm_tx->r_ant_non_ht_s1 = 0x2;
+ p_cck_txrx->r_ccktx_enable = 0x4;
+ chgTx = 1;
+
+ // From SD3 Willis suggestion !!! Set RF A as standby
+ //if (IS_HARDWARE_TYPE_8192S(pAdapter))
+ {
+ PHY_SetBBReg(pAdapter, rFPGA0_XA_HSSIParameter2, 0xe, 1);
+ PHY_SetBBReg(pAdapter, rFPGA0_XB_HSSIParameter2, 0xe, 2);
+// r_ofdm_tx_en_val = 0x3;
+
+ // Power save
+ //cosa r_ant_select_ofdm_val = 0x22222222;
+
+ // 2008/10/31 MH From SD3 Willi's suggestion. We must read RF 1T table.
+ // 2009/01/08 MH From Sd3 Willis. We need to close RFA by SW control
+ if (pHalData->rf_type == RF_2T2R || pHalData->rf_type == RF_1T2R)
+ {
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT10, 1);
+ PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, BIT10, 0);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT26, 0);
+// PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT10, 0);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT1, 0);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT17, 1);
+ }
+ }
+ break;
+
+ case ANTENNA_AB: // For 8192S
+ p_ofdm_tx->r_tx_antenna = 0x3;
+ r_ofdm_tx_en_val = 0x3;
+ p_ofdm_tx->r_ant_l = 0x3;
+ p_ofdm_tx->r_ant_ht_s1 = 0x3;
+ p_ofdm_tx->r_ant_non_ht_s1 = 0x3;
+ p_cck_txrx->r_ccktx_enable = 0xC;
+ chgTx = 1;
+
+ // From SD3 Willis suggestion !!! Set RF B as standby
+ //if (IS_HARDWARE_TYPE_8192S(pAdapter))
+ {
+ PHY_SetBBReg(pAdapter, rFPGA0_XA_HSSIParameter2, 0xe, 2);
+ PHY_SetBBReg(pAdapter, rFPGA0_XB_HSSIParameter2, 0xe, 2);
+
+ // Disable Power save
+ //cosa r_ant_select_ofdm_val = 0x3321333;
+#if 0
+ // 2008/10/31 MH From SD3 Willi's suggestion. We must read RFA 2T table.
+ if ((pHalData->VersionID == VERSION_8192S_ACUT)) // For RTL8192SU A-Cut only, by Roger, 2008.11.07.
+ {
+ mpt_RFConfigFromPreParaArrary(pAdapter, 1, RF_PATH_A);
+ }
+#endif
+ // 2009/01/08 MH From Sd3 Willis. We need to enable RFA/B by SW control
+ if (pHalData->rf_type == RF_2T2R)
+ {
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT10, 0);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT26, 0);
+// PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT10, 0);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT1, 1);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT17, 1);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ //
+ // r_rx_antenna_ofdm, bit0=A, bit1=B, bit2=C, bit3=D
+ // r_cckrx_enable : CCK default, 0=A, 1=B, 2=C, 3=D
+ // r_cckrx_enable_2 : CCK option, 0=A, 1=B, 2=C, 3=D
+ //
+ switch (pAdapter->mppriv.antenna_rx)
+ {
+ case ANTENNA_A:
+ r_rx_antenna_ofdm = 0x1; // A
+ p_cck_txrx->r_cckrx_enable = 0x0; // default: A
+ p_cck_txrx->r_cckrx_enable_2 = 0x0; // option: A
+ chgRx = 1;
+ break;
+
+ case ANTENNA_B:
+ r_rx_antenna_ofdm = 0x2; // B
+ p_cck_txrx->r_cckrx_enable = 0x1; // default: B
+ p_cck_txrx->r_cckrx_enable_2 = 0x1; // option: B
+ chgRx = 1;
+ break;
+
+ case ANTENNA_AB:
+ r_rx_antenna_ofdm = 0x3; // AB
+ p_cck_txrx->r_cckrx_enable = 0x0; // default:A
+ p_cck_txrx->r_cckrx_enable_2 = 0x1; // option:B
+ chgRx = 1;
+ break;
+
+ default:
+ break;
+ }
+
+ if (chgTx && chgRx)
+ {
+ switch(pHalData->rf_chip)
+ {
+ case RF_8225:
+ case RF_8256:
+ case RF_6052:
+ //r_ant_sel_cck_val = r_ant_select_cck_val;
+ PHY_SetBBReg(pAdapter, rFPGA1_TxInfo, 0x7fffffff, r_ant_select_ofdm_val); //OFDM Tx
+ PHY_SetBBReg(pAdapter, rFPGA0_TxInfo, 0x0000000f, r_ofdm_tx_en_val); //OFDM Tx
+ PHY_SetBBReg(pAdapter, rOFDM0_TRxPathEnable, 0x0000000f, r_rx_antenna_ofdm); //OFDM Rx
+ PHY_SetBBReg(pAdapter, rOFDM1_TRxPathEnable, 0x0000000f, r_rx_antenna_ofdm); //OFDM Rx
+ PHY_SetBBReg(pAdapter, rCCK0_AFESetting, bMaskByte3, r_ant_select_cck_val);//r_ant_sel_cck_val); //CCK TxRx
+
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ RT_TRACE(_module_mp_, _drv_notice_, ("-SwitchAntenna: finished\n"));
+}
+
+s32 Hal_SetThermalMeter(PADAPTER pAdapter, u8 target_ther)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+
+
+ if (!netif_running(pAdapter->pnetdev)) {
+ RT_TRACE(_module_mp_, _drv_warning_, ("SetThermalMeter! Fail: interface not opened!\n"));
+ return _FAIL;
+ }
+
+ if (check_fwstate(&pAdapter->mlmepriv, WIFI_MP_STATE) == _FALSE) {
+ RT_TRACE(_module_mp_, _drv_warning_, ("SetThermalMeter: Fail! not in MP mode!\n"));
+ return _FAIL;
+ }
+
+ target_ther &= 0xff;
+ if (target_ther < 0x07)
+ target_ther = 0x07;
+ else if (target_ther > 0x1d)
+ target_ther = 0x1d;
+
+ pHalData->EEPROMThermalMeter = target_ther;
+
+ return _SUCCESS;
+}
+
+void Hal_TriggerRFThermalMeter(PADAPTER pAdapter)
+{
+
+ _write_rfreg( pAdapter, RF_PATH_A , RF_T_METER_88E , BIT17 |BIT16 , 0x03 );
+
+// RT_TRACE(_module_mp_,_drv_alert_, ("TriggerRFThermalMeter() finished.\n" ));
+}
+
+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 = _read_rfreg(pAdapter, RF_PATH_A, RF_T_METER_88E, 0xfc00);
+
+// RT_TRACE(_module_mp_, _drv_alert_, ("ThermalValue = 0x%x\n", ThermalValue));
+ return (u8)ThermalValue;
+}
+
+void Hal_GetThermalMeter(PADAPTER pAdapter, u8 *value)
+{
+#if 0
+ fw_cmd(pAdapter, IOCMD_GET_THERMAL_METER);
+ rtw_msleep_os(1000);
+ fw_cmd_data(pAdapter, value, 1);
+ *value &= 0xFF;
+#else
+
+ Hal_TriggerRFThermalMeter(pAdapter);
+ rtw_msleep_os(1000);
+ *value = Hal_ReadRFThermalMeter(pAdapter);
+#endif
+}
+
+void Hal_SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ pAdapter->mppriv.MptCtx.bSingleCarrier = bStart;
+ if (bStart)// Start Single Carrier.
+ {
+ RT_TRACE(_module_mp_,_drv_alert_, ("SetSingleCarrierTx: test start\n"));
+ // 1. if OFDM block on?
+ if(!read_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn))
+ write_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn, bEnable);//set OFDM block on
+
+ {
+ // 2. set CCK test mode off, set to CCK normal mode
+ write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, bDisable);
+ // 3. turn on scramble setting
+ write_bbreg(pAdapter, rCCK0_System, bCCKScramble, bEnable);
+ }
+ // 4. Turn On Single Carrier Tx and turn off the other test modes.
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bEnable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
+#ifdef CONFIG_RTL8192C
+ // 5. Disable TX power saving at STF & LLTF
+ write_bbreg(pAdapter, rOFDM1_LSTF, BIT22, 1);
+#endif
+ //for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
+
+ }
+ else// Stop Single Carrier.
+ {
+ RT_TRACE(_module_mp_,_drv_alert_, ("SetSingleCarrierTx: test stop\n"));
+
+ // Turn off all test modes.
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
+#ifdef CONFIG_RTL8192C
+ // Cancel disable TX power saving at STF&LLTF
+ write_bbreg(pAdapter, rOFDM1_LSTF, BIT22, 0);
+#endif
+ //Delay 10 ms //delay_ms(10);
+ rtw_msleep_os(10);
+
+ //BB Reset
+ write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
+ write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
+
+ //Stop for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
+
+ }
+}
+
+
+void Hal_SetSingleToneTx(PADAPTER pAdapter, u8 bStart)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ BOOLEAN is92C = IS_92C_SERIAL(pHalData->VersionID);
+
+ u8 rfPath;
+ u32 reg58 = 0x0;
+ switch (pAdapter->mppriv.antenna_tx)
+ {
+ case ANTENNA_A:
+ default:
+ rfPath = RF_PATH_A;
+ break;
+ case ANTENNA_B:
+ rfPath = RF_PATH_B;
+ break;
+ case ANTENNA_C:
+ rfPath = RF_PATH_C;
+ break;
+ }
+
+ pAdapter->mppriv.MptCtx.bSingleTone = bStart;
+ if (bStart)// Start Single Tone.
+ {
+ RT_TRACE(_module_mp_,_drv_alert_, ("SetSingleToneTx: test start\n"));
+ { // <20120326, Kordan> To amplify the power of tone for Xtal calibration. (asked by Edlu)
+ if (IS_HARDWARE_TYPE_8188E(pAdapter))
+ {
+ reg58 = PHY_QueryRFReg(pAdapter, RF_PATH_A, LNA_Low_Gain_3, bRFRegOffsetMask);
+ reg58 &= 0xFFFFFFF0;
+ reg58 += 2;
+ PHY_SetRFReg(pAdapter, RF_PATH_A, LNA_Low_Gain_3, bRFRegOffsetMask, reg58);
+ }
+ PHY_SetBBReg(pAdapter, rFPGA0_RFMOD, bCCKEn, 0x0);
+ PHY_SetBBReg(pAdapter, rFPGA0_RFMOD, bOFDMEn, 0x0);
+ }
+
+ if (is92C)
+ {
+ _write_rfreg(pAdapter, RF_PATH_A, 0x21, BIT19, 0x01);
+ rtw_usleep_os(100);
+ if (rfPath == RF_PATH_A)
+ write_rfreg(pAdapter, RF_PATH_B, 0x00, 0x10000); // PAD all on.
+ else if (rfPath == RF_PATH_B)
+ write_rfreg(pAdapter, RF_PATH_A, 0x00, 0x10000); // PAD all on.
+ write_rfreg(pAdapter, rfPath, 0x00, 0x2001f); // PAD all on.
+ rtw_usleep_os(100);
+ }
+ else
+ {
+ write_rfreg(pAdapter, rfPath, 0x21, 0xd4000);
+ rtw_usleep_os(100);
+ write_rfreg(pAdapter, rfPath, 0x00, 0x2001f); // PAD all on.
+ rtw_usleep_os(100);
+ }
+
+ //for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
+
+ }
+ else// Stop Single Tone.
+ {
+ RT_TRACE(_module_mp_,_drv_alert_, ("SetSingleToneTx: test stop\n"));
+
+ { // <20120326, Kordan> To amplify the power of tone for Xtal calibration. (asked by Edlu)
+ // <20120326, Kordan> Only in single tone mode. (asked by Edlu)
+ if (IS_HARDWARE_TYPE_8188E(pAdapter))
+ {
+ reg58 = PHY_QueryRFReg(pAdapter, RF_PATH_A, LNA_Low_Gain_3, bRFRegOffsetMask);
+ reg58 &= 0xFFFFFFF0;
+ PHY_SetRFReg(pAdapter, RF_PATH_A, LNA_Low_Gain_3, bRFRegOffsetMask, reg58);
+ }
+
+ write_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn, 0x1);
+ write_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn, 0x1);
+ }
+ if (is92C) {
+ _write_rfreg(pAdapter, RF_PATH_A, 0x21, BIT19, 0x00);
+ rtw_usleep_os(100);
+ write_rfreg(pAdapter, RF_PATH_A, 0x00, 0x32d75); // PAD all on.
+ write_rfreg(pAdapter, RF_PATH_B, 0x00, 0x32d75); // PAD all on.
+ rtw_usleep_os(100);
+ } else {
+ write_rfreg(pAdapter, rfPath, 0x21, 0x54000);
+ rtw_usleep_os(100);
+ write_rfreg(pAdapter, rfPath, 0x00, 0x30000); // PAD all on.
+ rtw_usleep_os(100);
+ }
+
+ //Stop for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
+
+ }
+
+}
+
+
+
+void Hal_SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart)
+{
+ pAdapter->mppriv.MptCtx.bCarrierSuppression = bStart;
+ if (bStart) // Start Carrier Suppression.
+ {
+ RT_TRACE(_module_mp_,_drv_alert_, ("SetCarrierSuppressionTx: test start\n"));
+ //if(pMgntInfo->dot11CurrentWirelessMode == WIRELESS_MODE_B)
+ if (pAdapter->mppriv.rateidx <= MPT_RATE_11M)
+ {
+ // 1. if CCK block on?
+ if(!read_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn))
+ write_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn, bEnable);//set CCK block on
+
+ //Turn Off All Test Mode
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
+
+ write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, 0x2); //transmit mode
+ write_bbreg(pAdapter, rCCK0_System, bCCKScramble, 0x0); //turn off scramble setting
+
+ //Set CCK Tx Test Rate
+ //PHY_SetBBReg(pAdapter, rCCK0_System, bCCKTxRate, pMgntInfo->ForcedDataRate);
+ write_bbreg(pAdapter, rCCK0_System, bCCKTxRate, 0x0); //Set FTxRate to 1Mbps
+ }
+
+ //for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
+
+ }
+ else// Stop Carrier Suppression.
+ {
+ RT_TRACE(_module_mp_,_drv_alert_, ("SetCarrierSuppressionTx: test stop\n"));
+ //if(pMgntInfo->dot11CurrentWirelessMode == WIRELESS_MODE_B)
+ if (pAdapter->mppriv.rateidx <= MPT_RATE_11M ) {
+ write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, 0x0); //normal mode
+ write_bbreg(pAdapter, rCCK0_System, bCCKScramble, 0x1); //turn on scramble setting
+
+ //BB Reset
+ write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
+ write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
+ }
+
+ //Stop for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
+
+ }
+ //DbgPrint("\n MPT_ProSetCarrierSupp() is finished. \n");
+}
+
+void Hal_SetCCKContinuousTx(PADAPTER pAdapter, u8 bStart)
+{
+ u32 cckrate;
+
+ if (bStart)
+ {
+ RT_TRACE(_module_mp_, _drv_alert_,
+ ("SetCCKContinuousTx: test start\n"));
+
+ // 1. if CCK block on?
+ if(!read_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn))
+ write_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn, bEnable);//set CCK block on
+
+ //Turn Off All Test Mode
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
+ //Set CCK Tx Test Rate
+ #if 0
+ switch(pAdapter->mppriv.rateidx)
+ {
+ case 2:
+ cckrate = 0;
+ break;
+ case 4:
+ cckrate = 1;
+ break;
+ case 11:
+ cckrate = 2;
+ break;
+ case 22:
+ cckrate = 3;
+ break;
+ default:
+ cckrate = 0;
+ break;
+ }
+ #else
+ cckrate = pAdapter->mppriv.rateidx;
+ #endif
+ write_bbreg(pAdapter, rCCK0_System, bCCKTxRate, cckrate);
+ write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, 0x2); //transmit mode
+ write_bbreg(pAdapter, rCCK0_System, bCCKScramble, bEnable); //turn on scramble setting
+
+#ifdef CONFIG_RTL8192C
+ // Patch for CCK 11M waveform
+ if (cckrate == MPT_RATE_1M)
+ write_bbreg(pAdapter, 0xA71, BIT(6), bDisable);
+ else
+ write_bbreg(pAdapter, 0xA71, BIT(6), bEnable);
+#endif
+ //for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
+
+ }
+ else {
+ RT_TRACE(_module_mp_, _drv_info_,
+ ("SetCCKContinuousTx: test stop\n"));
+
+ write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, 0x0); //normal mode
+ write_bbreg(pAdapter, rCCK0_System, bCCKScramble, bEnable); //turn on scramble setting
+
+ //BB Reset
+ write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
+ write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
+
+ //Stop for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
+ }
+
+ pAdapter->mppriv.MptCtx.bCckContTx = bStart;
+ pAdapter->mppriv.MptCtx.bOfdmContTx = _FALSE;
+}/* mpt_StartCckContTx */
+
+void Hal_SetOFDMContinuousTx(PADAPTER pAdapter, u8 bStart)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+
+ if (bStart) {
+ RT_TRACE(_module_mp_, _drv_info_, ("SetOFDMContinuousTx: test start\n"));
+ // 1. if OFDM block on?
+ if(!read_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn))
+ write_bbreg(pAdapter, rFPGA0_RFMOD, bOFDMEn, bEnable);//set OFDM block on
+ {
+
+ // 2. set CCK test mode off, set to CCK normal mode
+ write_bbreg(pAdapter, rCCK0_System, bCCKBBMode, bDisable);
+
+ // 3. turn on scramble setting
+ write_bbreg(pAdapter, rCCK0_System, bCCKScramble, bEnable);
+ }
+ // 4. Turn On Continue Tx and turn off the other test modes.
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bEnable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
+
+ //for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
+
+ } else {
+ RT_TRACE(_module_mp_,_drv_info_, ("SetOFDMContinuousTx: test stop\n"));
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMContinueTx, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleCarrier, bDisable);
+ write_bbreg(pAdapter, rOFDM1_LSTF, bOFDMSingleTone, bDisable);
+ //Delay 10 ms
+ rtw_msleep_os(10);
+ //BB Reset
+ write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
+ write_bbreg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
+
+ //Stop for dynamic set Power index.
+ write_bbreg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
+ write_bbreg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
+ }
+
+ pAdapter->mppriv.MptCtx.bCckContTx = _FALSE;
+ pAdapter->mppriv.MptCtx.bOfdmContTx = bStart;
+}/* mpt_StartOfdmContTx */
+
+void Hal_SetContinuousTx(PADAPTER pAdapter, u8 bStart)
+{
+#if 0
+ // ADC turn off [bit24-21] adc port0 ~ port1
+ if (bStart) {
+ write_bbreg(pAdapter, rRx_Wait_CCCA, read_bbreg(pAdapter, rRx_Wait_CCCA) & 0xFE1FFFFF);
+ rtw_usleep_os(100);
+ }
+#endif
+ RT_TRACE(_module_mp_, _drv_info_,
+ ("SetContinuousTx: rate:%d\n", pAdapter->mppriv.rateidx));
+
+ pAdapter->mppriv.MptCtx.bStartContTx = bStart;
+ if (pAdapter->mppriv.rateidx <= MPT_RATE_11M)
+ {
+ Hal_SetCCKContinuousTx(pAdapter, bStart);
+ }
+ else if ((pAdapter->mppriv.rateidx >= MPT_RATE_6M) &&
+ (pAdapter->mppriv.rateidx <= MPT_RATE_MCS15))
+ {
+ Hal_SetOFDMContinuousTx(pAdapter, bStart);
+ }
+#if 0
+ // ADC turn on [bit24-21] adc port0 ~ port1
+ if (!bStart) {
+ write_bbreg(pAdapter, rRx_Wait_CCCA, read_bbreg(pAdapter, rRx_Wait_CCCA) | 0x01E00000);
+ }
+#endif
+}
+
+#endif // CONFIG_MP_INCLUDE
+
diff --git a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_phycfg.c b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_phycfg.c
index b4445d2..714aacb 100755
--- a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_phycfg.c
+++ b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_phycfg.c
@@ -1,2302 +1,2243 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#define _RTL8188E_PHYCFG_C_
-
-#include <drv_types.h>
-#include <rtl8188e_hal.h>
-
-
-/*---------------------------Define Local Constant---------------------------*/
-/* Channel switch:The size of command tables for switch channel*/
-#define MAX_PRECMD_CNT 16
-#define MAX_RFDEPENDCMD_CNT 16
-#define MAX_POSTCMD_CNT 16
-
-#define MAX_DOZE_WAITING_TIMES_9x 64
-
-/*---------------------------Define Local Constant---------------------------*/
-
-
-/*------------------------Define global variable-----------------------------*/
-
-/*------------------------Define local variable------------------------------*/
-
-
-/*--------------------Define export function prototype-----------------------*/
-// Please refer to header file
-/*--------------------Define export function prototype-----------------------*/
-
-/*----------------------------Function Body----------------------------------*/
-//
-// 1. BB register R/W API
-//
-
-#if(SIC_ENABLE == 1)
-static BOOLEAN
-sic_IsSICReady(
- IN PADAPTER Adapter
- )
-{
- BOOLEAN bRet=_FALSE;
- u32 retryCnt=0;
- u8 sic_cmd=0xff;
-
- while(1)
- {
- if(retryCnt++ >= SIC_MAX_POLL_CNT)
- {
- //RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady() return FALSE\n"));
- return _FALSE;
- }
-
- //if(RT_SDIO_CANNOT_IO(Adapter))
- // return _FALSE;
-
- sic_cmd = rtw_read8(Adapter, SIC_CMD_REG);
- //sic_cmd = PlatformEFIORead1Byte(Adapter, SIC_CMD_REG);
-#if(SIC_HW_SUPPORT == 1)
- sic_cmd &= 0xf0; // [7:4]
-#endif
- //RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady(), readback 0x%x=0x%x\n", SIC_CMD_REG, sic_cmd));
- if(sic_cmd == SIC_CMD_READY)
- return _TRUE;
- else
- {
- rtw_msleep_os(1);
- //delay_ms(1);
- }
- }
-
- return bRet;
-}
-
-/*
-u32
-sic_CalculateBitShift(
- u32 BitMask
- )
-{
- u32 i;
-
- for(i=0; i<=31; i++)
- {
- if ( ((BitMask>>i) & 0x1 ) == 1)
- break;
- }
-
- return (i);
-}
-*/
-
-static u32
-sic_Read4Byte(
- PVOID Adapter,
- u32 offset
- )
-{
- u32 u4ret=0xffffffff;
-#if RTL8188E_SUPPORT == 1
- u8 retry = 0;
-#endif
-
- //RTPRINT(FPHY, PHY_SICR, ("[SIC], sic_Read4Byte(): read offset(%#x)\n", offset));
-
- if(sic_IsSICReady(Adapter))
- {
-#if(SIC_HW_SUPPORT == 1)
- rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD);
- //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD);
- //RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREREAD));
-#endif
- rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff));
- //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG, (u1Byte)(offset&0xff));
- //RTPRINT(FPHY, PHY_SICR, ("write 0x%x = 0x%x\n", SIC_ADDR_REG, (u1Byte)(offset&0xff)));
- rtw_write8(Adapter, SIC_ADDR_REG+1, (u8)((offset&0xff00)>>8));
- //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8));
- //RTPRINT(FPHY, PHY_SICR, ("write 0x%x = 0x%x\n", SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8)));
- rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_READ);
- //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_READ);
- //RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_READ));
-
-#if RTL8188E_SUPPORT == 1
- retry = 4;
- while(retry--){
- rtw_udelay_os(50);
- //PlatformStallExecution(50);
- }
-#else
- rtw_udelay_os(200);
- //PlatformStallExecution(200);
-#endif
-
- if(sic_IsSICReady(Adapter))
- {
- u4ret = rtw_read32(Adapter, SIC_DATA_REG);
- //u4ret = PlatformEFIORead4Byte(Adapter, SIC_DATA_REG);
- //RTPRINT(FPHY, PHY_SICR, ("read 0x%x = 0x%x\n", SIC_DATA_REG, u4ret));
- //DbgPrint("<===Read 0x%x = 0x%x\n", offset, u4ret);
- }
- }
-
- return u4ret;
-}
-
-static VOID
-sic_Write4Byte(
- PVOID Adapter,
- u32 offset,
- u32 data
- )
-{
-#if RTL8188E_SUPPORT == 1
- u8 retry = 6;
-#endif
- //DbgPrint("=>Write 0x%x = 0x%x\n", offset, data);
- //RTPRINT(FPHY, PHY_SICW, ("[SIC], sic_Write4Byte(): write offset(%#x)=0x%x\n", offset, data));
- if(sic_IsSICReady(Adapter))
- {
-#if(SIC_HW_SUPPORT == 1)
- rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE);
- //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE);
- //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREWRITE));
-#endif
- rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff));
- //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG, (u1Byte)(offset&0xff));
- //RTPRINT(FPHY, PHY_SICW, ("write 0x%x=0x%x\n", SIC_ADDR_REG, (u1Byte)(offset&0xff)));
- rtw_write8(Adapter, SIC_ADDR_REG+1, (u8)((offset&0xff00)>>8));
- //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8));
- //RTPRINT(FPHY, PHY_SICW, ("write 0x%x=0x%x\n", (SIC_ADDR_REG+1), (u1Byte)((offset&0xff00)>>8)));
- rtw_write32(Adapter, SIC_DATA_REG, (u32)data);
- //PlatformEFIOWrite4Byte(Adapter, SIC_DATA_REG, (u4Byte)data);
- //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_DATA_REG, data));
- rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_WRITE);
- //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_WRITE);
- //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_WRITE));
-#if RTL8188E_SUPPORT == 1
- while(retry--){
- rtw_udelay_os(50);
- //PlatformStallExecution(50);
- }
-#else
- rtw_udelay_os(150);
- //PlatformStallExecution(150);
-#endif
-
- }
-}
-//============================================================
-// extern function
-//============================================================
-static VOID
-SIC_SetBBReg(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data
- )
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- u32 OriginalValue, BitShift;
- u16 BBWaitCounter = 0;
-
- //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg() start\n"));
-/*
- while(PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _TRUE) == _TRUE)
- {
- BBWaitCounter ++;
- delay_ms(10); // 1 ms
-
- if((BBWaitCounter > 100) || RT_CANNOT_IO(Adapter))
- {// Wait too long, return FALSE to avoid to be stuck here.
- RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), Fail to set BB offset(%#x)!!, WaitCnt(%d)\n", RegAddr, BBWaitCounter));
- return;
- }
- }
-*/
- //
- // Critical section start
- //
-
- //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), mask=0x%x, addr[0x%x]=0x%x\n", BitMask, RegAddr, Data));
-
- if(BitMask!= bMaskDWord){//if not "double word" write
- OriginalValue = sic_Read4Byte(Adapter, RegAddr);
- //BitShift = sic_CalculateBitShift(BitMask);
- BitShift = PHY_CalculateBitShift(BitMask);
- Data = (((OriginalValue) & (~BitMask)) | (Data << BitShift));
- }
-
- sic_Write4Byte(Adapter, RegAddr, Data);
-
- //PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _FALSE);
- //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg() end\n"));
-}
-
-static u32
-SIC_QueryBBReg(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask
- )
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- u32 ReturnValue = 0, OriginalValue, BitShift;
- u16 BBWaitCounter = 0;
-
- //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg() start\n"));
-
-/*
- while(PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _TRUE) == _TRUE)
- {
- BBWaitCounter ++;
- delay_ms(10); // 10 ms
-
- if((BBWaitCounter > 100) || RT_CANNOT_IO(Adapter))
- {// Wait too long, return FALSE to avoid to be stuck here.
- RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_QueryBBReg(), Fail to query BB offset(%#x)!!, WaitCnt(%d)\n", RegAddr, BBWaitCounter));
- return ReturnValue;
- }
- }
-*/
- OriginalValue = sic_Read4Byte(Adapter, RegAddr);
- //BitShift = sic_CalculateBitShift(BitMask);
- BitShift = PHY_CalculateBitShift(BitMask);
- ReturnValue = (OriginalValue & BitMask) >> BitShift;
-
- //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg(), 0x%x=0x%x\n", RegAddr, OriginalValue));
- //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg() end\n"));
-
- //PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _FALSE);
- return (ReturnValue);
-}
-
-VOID
-SIC_Init(
- IN PADAPTER Adapter
- )
-{
- // Here we need to write 0x1b8~0x1bf = 0 after fw is downloaded
- // because for 8723E at beginning 0x1b8=0x1e, that will cause
- // sic always not be ready
-#if(SIC_HW_SUPPORT == 1)
- //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n",
- // SIC_INIT_REG, SIC_INIT_VAL));
- rtw_write8(Adapter, SIC_INIT_REG, SIC_INIT_VAL);
- //PlatformEFIOWrite1Byte(Adapter, SIC_INIT_REG, SIC_INIT_VAL);
- //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n",
- // SIC_CMD_REG, SIC_CMD_INIT));
- rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_INIT);
- //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_INIT);
-#else
- //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x1b8~0x1bf = 0x0\n"));
- rtw_write32(Adapter, SIC_CMD_REG, 0);
- //PlatformEFIOWrite4Byte(Adapter, SIC_CMD_REG, 0);
- rtw_write32(Adapter, SIC_CMD_REG+4, 0);
- //PlatformEFIOWrite4Byte(Adapter, SIC_CMD_REG+4, 0);
-#endif
-}
-
-static BOOLEAN
-SIC_LedOff(
- IN PADAPTER Adapter
- )
-{
- // When SIC is enabled, led pin will be used as debug pin,
- // so don't execute led function when SIC is enabled.
- return _TRUE;
-}
-#endif
-
-/**
-* Function: PHY_QueryBBReg
-*
-* OverView: Read "sepcific bits" from BB register
-*
-* Input:
-* PADAPTER Adapter,
-* u4Byte RegAddr, //The target address to be readback
-* u4Byte BitMask //The target bit position in the target address
-* //to be readback
-* Output: None
-* Return: u4Byte Data //The readback register value
-* Note: This function is equal to "GetRegSetting" in PHY programming guide
-*/
-u32
-PHY_QueryBBReg8188E(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask
- )
-{
- u32 ReturnValue = 0, OriginalValue, BitShift;
- u16 BBWaitCounter = 0;
-
-#if (DISABLE_BB_RF == 1)
- return 0;
-#endif
-
-#if(SIC_ENABLE == 1)
- return SIC_QueryBBReg(Adapter, RegAddr, BitMask);
-#endif
-
- //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_QueryBBReg(): RegAddr(%#lx), BitMask(%#lx)\n", RegAddr, BitMask));
-
- OriginalValue = rtw_read32(Adapter, RegAddr);
- BitShift = PHY_CalculateBitShift(BitMask);
- ReturnValue = (OriginalValue & BitMask) >> BitShift;
-
- //RTPRINT(FPHY, PHY_BBR, ("BBR MASK=0x%lx Addr[0x%lx]=0x%lx\n", BitMask, RegAddr, OriginalValue));
- //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_QueryBBReg(): RegAddr(%#lx), BitMask(%#lx), OriginalValue(%#lx)\n", RegAddr, BitMask, OriginalValue));
-
- return (ReturnValue);
-
-}
-
-
-/**
-* Function: PHY_SetBBReg
-*
-* OverView: Write "Specific bits" to BB register (page 8~)
-*
-* Input:
-* PADAPTER Adapter,
-* u4Byte RegAddr, //The target address to be modified
-* u4Byte BitMask //The target bit position in the target address
-* //to be modified
-* u4Byte Data //The new register value in the target bit position
-* //of the target address
-*
-* Output: None
-* Return: None
-* Note: This function is equal to "PutRegSetting" in PHY programming guide
-*/
-
-VOID
-PHY_SetBBReg8188E(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data
- )
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- //u16 BBWaitCounter = 0;
- u32 OriginalValue, BitShift;
-
-#if (DISABLE_BB_RF == 1)
- return;
-#endif
-
-#if(SIC_ENABLE == 1)
- SIC_SetBBReg(Adapter, RegAddr, BitMask, Data);
- return;
-#endif
-
- //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data));
-
- if(BitMask!= bMaskDWord){//if not "double word" write
- OriginalValue = rtw_read32(Adapter, RegAddr);
- BitShift = PHY_CalculateBitShift(BitMask);
- Data = ((OriginalValue & (~BitMask)) | ((Data << BitShift) & BitMask));
- }
-
- rtw_write32(Adapter, RegAddr, Data);
-
- //RTPRINT(FPHY, PHY_BBW, ("BBW MASK=0x%lx Addr[0x%lx]=0x%lx\n", BitMask, RegAddr, Data));
- //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data));
-
-}
-
-
-//
-// 2. RF register R/W API
-//
-/**
-* Function: phy_RFSerialRead
-*
-* OverView: Read regster from RF chips
-*
-* Input:
-* PADAPTER Adapter,
-* u8 eRFPath, //Radio path of A/B/C/D
-* u4Byte Offset, //The target address to be read
-*
-* Output: None
-* Return: u4Byte reback value
-* Note: Threre are three types of serial operations:
-* 1. Software serial write
-* 2. Hardware LSSI-Low Speed Serial Interface
-* 3. Hardware HSSI-High speed
-* serial write. Driver need to implement (1) and (2).
-* This function is equal to the combination of RF_ReadReg() and RFLSSIRead()
-*/
-static u32
-phy_RFSerialRead(
- IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 Offset
- )
-{
- u32 retValue = 0;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
- u32 NewOffset;
- u32 tmplong,tmplong2;
- u8 RfPiEnable=0;
-#if 0
- if(pHalData->RFChipID == RF_8225 && Offset > 0x24) //36 valid regs
- return retValue;
- if(pHalData->RFChipID == RF_8256 && Offset > 0x2D) //45 valid regs
- return retValue;
-#endif
- //
- // Make sure RF register offset is correct
- //
- Offset &= 0xff;
-
- //
- // Switch page for 8256 RF IC
- //
- NewOffset = Offset;
-
- // 2009/06/17 MH We can not execute IO for power save or other accident mode.
- //if(RT_CANNOT_IO(Adapter))
- //{
- // RTPRINT(FPHY, PHY_RFR, ("phy_RFSerialRead return all one\n"));
- // return 0xFFFFFFFF;
- //}
-
- // For 92S LSSI Read RFLSSIRead
- // For RF A/B write 0x824/82c(does not work in the future)
- // We must use 0x824 for RF A and B to execute read trigger
- tmplong = PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord);
- if(eRFPath == RF_PATH_A)
- tmplong2 = tmplong;
- else
- tmplong2 = PHY_QueryBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord);
-
- tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | (NewOffset<<23) | bLSSIReadEdge; //T65 RF
-
- PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong&(~bLSSIReadEdge));
- rtw_udelay_os(10);// PlatformStallExecution(10);
-
- PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord, tmplong2);
- rtw_udelay_os(100);//PlatformStallExecution(100);
-
- //PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong|bLSSIReadEdge);
- rtw_udelay_os(10);//PlatformStallExecution(10);
-
- if(eRFPath == RF_PATH_A)
- RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter1, BIT8);
- else if(eRFPath == RF_PATH_B)
- RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XB_HSSIParameter1, BIT8);
-
- if(RfPiEnable)
- { // Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF
- retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBackPi, bLSSIReadBackData);
- //DBG_8192C("Readback from RF-PI : 0x%x\n", retValue);
- }
- else
- { //Read from BBreg8a0, 12 bits for 8190, 20 bits for T65 RF
- retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBack, bLSSIReadBackData);
- //DBG_8192C("Readback from RF-SI : 0x%x\n", retValue);
- }
- //DBG_8192C("RFR-%d Addr[0x%x]=0x%x\n", eRFPath, pPhyReg->rfLSSIReadBack, retValue);
-
- return retValue;
-
-}
-
-
-
-/**
-* Function: phy_RFSerialWrite
-*
-* OverView: Write data to RF register (page 8~)
-*
-* Input:
-* PADAPTER Adapter,
-* u8 eRFPath, //Radio path of A/B/C/D
-* u4Byte Offset, //The target address to be read
-* u4Byte Data //The new register Data in the target bit position
-* //of the target to be read
-*
-* Output: None
-* Return: None
-* Note: Threre are three types of serial operations:
-* 1. Software serial write
-* 2. Hardware LSSI-Low Speed Serial Interface
-* 3. Hardware HSSI-High speed
-* serial write. Driver need to implement (1) and (2).
-* This function is equal to the combination of RF_ReadReg() and RFLSSIRead()
- *
- * Note: For RF8256 only
- * The total count of RTL8256(Zebra4) register is around 36 bit it only employs
- * 4-bit RF address. RTL8256 uses "register mode control bit" (Reg00[12], Reg00[10])
- * to access register address bigger than 0xf. See "Appendix-4 in PHY Configuration
- * programming guide" for more details.
- * Thus, we define a sub-finction for RTL8526 register address conversion
- * ===========================================================
- * Register Mode RegCTL[1] RegCTL[0] Note
- * (Reg00[12]) (Reg00[10])
- * ===========================================================
- * Reg_Mode0 0 x Reg 0 ~15(0x0 ~ 0xf)
- * ------------------------------------------------------------------
- * Reg_Mode1 1 0 Reg 16 ~30(0x1 ~ 0xf)
- * ------------------------------------------------------------------
- * Reg_Mode2 1 1 Reg 31 ~ 45(0x1 ~ 0xf)
- * ------------------------------------------------------------------
- *
- * 2008/09/02 MH Add 92S RF definition
- *
- *
- *
-*/
-static VOID
-phy_RFSerialWrite(
- IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 Offset,
- IN u32 Data
- )
-{
- u32 DataAndAddr = 0;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
- u32 NewOffset;
-
-#if 0
- //<Roger_TODO> We should check valid regs for RF_6052 case.
- if(pHalData->RFChipID == RF_8225 && Offset > 0x24) //36 valid regs
- return;
- if(pHalData->RFChipID == RF_8256 && Offset > 0x2D) //45 valid regs
- return;
-#endif
-
- // 2009/06/17 MH We can not execute IO for power save or other accident mode.
- //if(RT_CANNOT_IO(Adapter))
- //{
- // RTPRINT(FPHY, PHY_RFW, ("phy_RFSerialWrite stop\n"));
- // return;
- //}
-
- Offset &= 0xff;
-
- //
- // Shadow Update
- //
- //PHY_RFShadowWrite(Adapter, eRFPath, Offset, Data);
-
- //
- // Switch page for 8256 RF IC
- //
- NewOffset = Offset;
-
- //
- // Put write addr in [5:0] and write data in [31:16]
- //
- //DataAndAddr = (Data<<16) | (NewOffset&0x3f);
- DataAndAddr = ((NewOffset<<20) | (Data&0x000fffff)) & 0x0fffffff; // T65 RF
-
- //
- // Write Operation
- //
- PHY_SetBBReg(Adapter, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr);
- //RTPRINT(FPHY, PHY_RFW, ("RFW-%d Addr[0x%lx]=0x%lx\n", eRFPath, pPhyReg->rf3wireOffset, DataAndAddr));
-
-}
-
-
-/**
-* Function: PHY_QueryRFReg
-*
-* OverView: Query "Specific bits" to RF register (page 8~)
-*
-* Input:
-* PADAPTER Adapter,
-* u8 eRFPath, //Radio path of A/B/C/D
-* u4Byte RegAddr, //The target address to be read
-* u4Byte BitMask //The target bit position in the target address
-* //to be read
-*
-* Output: None
-* Return: u4Byte Readback value
-* Note: This function is equal to "GetRFRegSetting" in PHY programming guide
-*/
-u32
-PHY_QueryRFReg8188E(
- IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask
- )
-{
- u32 Original_Value, Readback_Value, BitShift;
- //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- //u8 RFWaitCounter = 0;
- //_irqL irqL;
-
-#if (DISABLE_BB_RF == 1)
- return 0;
-#endif
-
- //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_QueryRFReg(): RegAddr(%#lx), eRFPath(%#x), BitMask(%#lx)\n", RegAddr, eRFPath,BitMask));
-
-#ifdef CONFIG_USB_HCI
- //PlatformAcquireMutex(&pHalData->mxRFOperate);
-#else
- //_enter_critical(&pHalData->rf_lock, &irqL);
-#endif
-
-
- Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
-
- BitShift = PHY_CalculateBitShift(BitMask);
- Readback_Value = (Original_Value & BitMask) >> BitShift;
-
-#ifdef CONFIG_USB_HCI
- //PlatformReleaseMutex(&pHalData->mxRFOperate);
-#else
- //_exit_critical(&pHalData->rf_lock, &irqL);
-#endif
-
-
- //RTPRINT(FPHY, PHY_RFR, ("RFR-%d MASK=0x%lx Addr[0x%lx]=0x%lx\n", eRFPath, BitMask, RegAddr, Original_Value));//BitMask(%#lx),BitMask,
- //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_QueryRFReg(): RegAddr(%#lx), eRFPath(%#x), Original_Value(%#lx)\n",
- // RegAddr, eRFPath, Original_Value));
-
- return (Readback_Value);
-}
-
-/**
-* Function: PHY_SetRFReg
-*
-* OverView: Write "Specific bits" to RF register (page 8~)
-*
-* Input:
-* PADAPTER Adapter,
-* u8 eRFPath, //Radio path of A/B/C/D
-* u4Byte RegAddr, //The target address to be modified
-* u4Byte BitMask //The target bit position in the target address
-* //to be modified
-* u4Byte Data //The new register Data in the target bit position
-* //of the target address
-*
-* Output: None
-* Return: None
-* Note: This function is equal to "PutRFRegSetting" in PHY programming guide
-*/
-VOID
-PHY_SetRFReg8188E(
- IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data
- )
-{
-
- //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- //u1Byte RFWaitCounter = 0;
- u32 Original_Value, BitShift;
- //_irqL irqL;
-
-#if (DISABLE_BB_RF == 1)
- return;
-#endif
-
- //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n",
- // RegAddr, BitMask, Data, eRFPath));
- //RTPRINT(FINIT, INIT_RF, ("PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n",
- // RegAddr, BitMask, Data, eRFPath));
-
-
-#ifdef CONFIG_USB_HCI
- //PlatformAcquireMutex(&pHalData->mxRFOperate);
-#else
- //_enter_critical(&pHalData->rf_lock, &irqL);
-#endif
-
-
- // RF data is 12 bits only
- if (BitMask != bRFRegOffsetMask)
- {
- Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
- BitShift = PHY_CalculateBitShift(BitMask);
- Data = ((Original_Value & (~BitMask)) | (Data<< BitShift));
- }
-
- phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data);
-
-
-#ifdef CONFIG_USB_HCI
- //PlatformReleaseMutex(&pHalData->mxRFOperate);
-#else
- //_exit_critical(&pHalData->rf_lock, &irqL);
-#endif
-
- //PHY_QueryRFReg(Adapter,eRFPath,RegAddr,BitMask);
- //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n",
- // RegAddr, BitMask, Data, eRFPath));
-
-}
-
-
-//
-// 3. Initial MAC/BB/RF config by reading MAC/BB/RF txt.
-//
-
-/*-----------------------------------------------------------------------------
- * Function: PHY_MACConfig8192C
- *
- * Overview: Condig MAC by header file or parameter file.
- *
- * Input: NONE
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Revised History:
- * When Who Remark
- * 08/12/2008 MHC Create Version 0.
- *
- *---------------------------------------------------------------------------*/
-s32 PHY_MACConfig8188E(PADAPTER Adapter)
-{
- int rtStatus = _SUCCESS;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- s8 *pszMACRegFile;
- s8 sz8188EMACRegFile[] = RTL8188E_PHY_MACREG;
-
- pszMACRegFile = sz8188EMACRegFile;
-
- //
- // Config MAC
- //
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- rtStatus = phy_ConfigMACWithParaFile(Adapter, pszMACRegFile);
- if (rtStatus == _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- if(HAL_STATUS_FAILURE == ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv))
- rtStatus = _FAIL;
- else
- rtStatus = _SUCCESS;
-#endif//CONFIG_EMBEDDED_FWIMG
- }
-
- // 2010.07.13 AMPDU aggregation number B
- rtw_write8(Adapter, REG_MAX_AGGR_NUM, MAX_AGGR_NUM);
- //rtw_write8(Adapter, REG_MAX_AGGR_NUM, 0x0B);
-
- return rtStatus;
-
-}
-
-/*-----------------------------------------------------------------------------
-* Function: phy_InitBBRFRegisterDefinition
-*
-* OverView: Initialize Register definition offset for Radio Path A/B/C/D
-*
-* Input:
-* PADAPTER Adapter,
-*
-* Output: None
-* Return: None
-* Note: The initialization value is constant and it should never be changes
------------------------------------------------------------------------------*/
-static VOID
-phy_InitBBRFRegisterDefinition(
- IN PADAPTER Adapter
-)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
- // RF Interface Sowrtware Control
- pHalData->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 LSBs if read 32-bit from 0x870
- pHalData->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872)
- pHalData->PHYRegDef[RF_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 LSBs if read 32-bit from 0x874
- pHalData->PHYRegDef[RF_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 MSBs if read 32-bit from 0x874 (16-bit for 0x876)
-
- // RF Interface Output (and Enable)
- pHalData->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x860
- pHalData->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x864
-
- // RF Interface (Output and) Enable
- pHalData->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862)
- pHalData->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866)
-
- //Addr of LSSI. Wirte RF register by driver
- pHalData->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; //LSSI Parameter
- pHalData->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter;
-
- // Tranceiver A~D HSSI Parameter-2
- pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; //wire control parameter2
- pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; //wire control parameter2
-
- // Tranceiver LSSI Readback SI mode
- pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack;
- pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack;
- pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack;
- pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack;
-
- // Tranceiver LSSI Readback PI mode
- pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback;
- pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback;
- //pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBackPi = rFPGA0_XC_LSSIReadBack;
- //pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBackPi = rFPGA0_XD_LSSIReadBack;
-
-}
-
-//****************************************
-// The following is for High Power PA
-//****************************************
-VOID
-phy_ConfigBBExternalPA(
- IN PADAPTER Adapter
-)
-{
-#ifdef CONFIG_USB_HCI
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- u16 i=0;
- u32 temp=0;
-
- if(!pHalData->ExternalPA)
- {
- return;
- }
-
- // 2010/10/19 MH According to Jenyu/EEChou 's opinion, we need not to execute the
- // same code as SU. It is already updated in PHY_REG_1T_HP.txt.
-#if 0
- PHY_SetBBReg(Adapter, 0xee8, BIT28, 1);
- temp = PHY_QueryBBReg(Adapter, 0x860, bMaskDWord);
- temp |= (BIT26|BIT21|BIT10|BIT5);
- PHY_SetBBReg(Adapter, 0x860, bMaskDWord, temp);
- PHY_SetBBReg(Adapter, 0x870, BIT10, 0);
- PHY_SetBBReg(Adapter, 0xc80, bMaskDWord, 0x20000080);
- PHY_SetBBReg(Adapter, 0xc88, bMaskDWord, 0x40000100);
-#endif
-
-#endif
-}
-
-
-VOID
-storePwrIndexDiffRateOffset(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data
- )
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
- if(RegAddr == rTxAGC_A_Rate18_06)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][0]-TxAGC_A_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0]);
- }
- if(RegAddr == rTxAGC_A_Rate54_24)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][1]-TxAGC_A_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1]);
- }
- if(RegAddr == rTxAGC_A_CCK1_Mcs32)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][6]-TxAGC_A_CCK1_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6]);
- }
- if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][7]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7]);
- }
- if(RegAddr == rTxAGC_A_Mcs03_Mcs00)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][2]-TxAGC_A_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2]);
- }
- if(RegAddr == rTxAGC_A_Mcs07_Mcs04)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][3]-TxAGC_A_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3]);
- }
- if(RegAddr == rTxAGC_A_Mcs11_Mcs08)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][4]-TxAGC_A_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4]);
- }
- if(RegAddr == rTxAGC_A_Mcs15_Mcs12)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][5]-TxAGC_A_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt,pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5]);
- if(pHalData->rf_type== RF_1T1R)
- {
- //printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt);
- pHalData->pwrGroupCnt++;
- }
- }
- if(RegAddr == rTxAGC_B_Rate18_06)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][8]-TxAGC_B_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8]);
- }
- if(RegAddr == rTxAGC_B_Rate54_24)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][9]-TxAGC_B_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9]);
- }
- if(RegAddr == rTxAGC_B_CCK1_55_Mcs32)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][14]-TxAGC_B_CCK1_55_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14]);
- }
- if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][15]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15]);
- }
- if(RegAddr == rTxAGC_B_Mcs03_Mcs00)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][10]-TxAGC_B_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10]);
- }
- if(RegAddr == rTxAGC_B_Mcs07_Mcs04)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][11]-TxAGC_B_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11]);
- }
- if(RegAddr == rTxAGC_B_Mcs11_Mcs08)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][12]-TxAGC_B_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12]);
- }
- if(RegAddr == rTxAGC_B_Mcs15_Mcs12)
- {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13] = Data;
- //printk("MCSTxPowerLevelOriginalOffset[%d][13]-TxAGC_B_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt,
- // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13]);
-
- if(pHalData->rf_type != RF_1T1R)
- {
- //printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt);
- pHalData->pwrGroupCnt++;
- }
- }
-}
-
-
-static VOID
-phy_BB8192C_Config_1T(
- IN PADAPTER Adapter
- )
-{
-#if 0
- //for path - A
- PHY_SetBBReg(Adapter, rFPGA0_TxInfo, 0x3, 0x1);
- PHY_SetBBReg(Adapter, rFPGA1_TxInfo, 0x0303, 0x0101);
- PHY_SetBBReg(Adapter, 0xe74, 0x0c000000, 0x1);
- PHY_SetBBReg(Adapter, 0xe78, 0x0c000000, 0x1);
- PHY_SetBBReg(Adapter, 0xe7c, 0x0c000000, 0x1);
- PHY_SetBBReg(Adapter, 0xe80, 0x0c000000, 0x1);
- PHY_SetBBReg(Adapter, 0xe88, 0x0c000000, 0x1);
-#endif
- //for path - B
- PHY_SetBBReg(Adapter, rFPGA0_TxInfo, 0x3, 0x2);
- PHY_SetBBReg(Adapter, rFPGA1_TxInfo, 0x300033, 0x200022);
-
- // 20100519 Joseph: Add for 1T2R config. Suggested by Kevin, Jenyu and Yunan.
- PHY_SetBBReg(Adapter, rCCK0_AFESetting, bMaskByte3, 0x45);
- PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, bMaskByte0, 0x23);
- PHY_SetBBReg(Adapter, rOFDM0_AGCParameter1, 0x30, 0x1); // B path first AGC
-
- PHY_SetBBReg(Adapter, 0xe74, 0x0c000000, 0x2);
- PHY_SetBBReg(Adapter, 0xe78, 0x0c000000, 0x2);
- PHY_SetBBReg(Adapter, 0xe7c, 0x0c000000, 0x2);
- PHY_SetBBReg(Adapter, 0xe80, 0x0c000000, 0x2);
- PHY_SetBBReg(Adapter, 0xe88, 0x0c000000, 0x2);
-
-
-}
-
-// Joseph test: new initialize order!!
-// Test only!! This part need to be re-organized.
-// Now it is just for 8256.
-static int
-phy_BB8190_Config_HardCode(
- IN PADAPTER Adapter
- )
-{
- //RT_ASSERT(FALSE, ("This function is not implement yet!! \n"));
- return _SUCCESS;
-}
-
-static int
-phy_BB8188E_Config_ParaFile(
- IN PADAPTER Adapter
- )
-{
- EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter);
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- int rtStatus = _SUCCESS;
-
- u8 sz8188EBBRegFile[] = RTL8188E_PHY_REG;
- u8 sz8188EAGCTableFile[] = RTL8188E_AGC_TAB;
- u8 sz8188EBBRegPgFile[] = RTL8188E_PHY_REG_PG;
- u8 sz8188EBBRegMpFile[] = RTL8188E_PHY_REG_MP;
- u8 sz8188EBBRegLimitFile[] = RTL8188E_TXPWR_LMT;
-
- u8 *pszBBRegFile = NULL, *pszAGCTableFile = NULL, *pszBBRegPgFile = NULL, *pszBBRegMpFile=NULL,
- *pszRFTxPwrLmtFile = NULL;
-
-
- //RT_TRACE(COMP_INIT, DBG_TRACE, ("==>phy_BB8192S_Config_ParaFile\n"));
-
- pszBBRegFile = sz8188EBBRegFile ;
- pszAGCTableFile = sz8188EAGCTableFile;
- pszBBRegPgFile = sz8188EBBRegPgFile;
- pszBBRegMpFile = sz8188EBBRegMpFile;
- pszRFTxPwrLmtFile = sz8188EBBRegLimitFile;
-
- PHY_InitTxPowerLimit( Adapter );
-
- if ( Adapter->registrypriv.RegEnableTxPowerLimit == 1 ||
- ( Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1 ) )
- {
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- if (PHY_ConfigRFWithPowerLimitTableParaFile( Adapter, pszRFTxPwrLmtFile )== _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- if (HAL_STATUS_SUCCESS != ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_TXPWR_LMT, (ODM_RF_RADIO_PATH_E)0))
- rtStatus = _FAIL;
-#endif
- }
-
- if(rtStatus != _SUCCESS){
- DBG_871X("phy_BB8188E_Config_ParaFile():Read Tx power limit fail!!\n");
- goto phy_BB8190_Config_ParaFile_Fail;
- }
- }
-
- //
- // 1. Read PHY_REG.TXT BB INIT!!
- //
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- if (phy_ConfigBBWithParaFile(Adapter, pszBBRegFile, CONFIG_BB_PHY_REG) == _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG))
- rtStatus = _FAIL;
-#endif
- }
-
- if(rtStatus != _SUCCESS){
- //RT_TRACE(COMP_INIT, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():Write BB Reg Fail!!"));
- goto phy_BB8190_Config_ParaFile_Fail;
- }
-
-#if (MP_DRIVER == 1)
- //
- // 1.1 Read PHY_REG_MP.TXT BB INIT!!
- //
- if (Adapter->registrypriv.mp_mode == 1) {
- //3 Read PHY_REG.TXT BB INIT!!
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- if (phy_ConfigBBWithMpParaFile(Adapter, pszBBRegMpFile) == _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- if (HAL_STATUS_SUCCESS != ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_MP))
- rtStatus = _FAIL;
-#endif
- }
-
- if(rtStatus != _SUCCESS){
- DBG_871X("phy_BB8188E_Config_ParaFile():Write BB Reg MP Fail!!");
- goto phy_BB8190_Config_ParaFile_Fail;
- }
- }
-#endif // #if (MP_DRIVER == 1)
-
- //
- // 2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt
- //
- PHY_InitTxPowerByRate( Adapter );
- if ( ( Adapter->registrypriv.RegEnableTxPowerByRate == 1 ||
- ( Adapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory != 2 ) ) )
- {
- pHalData->pwrGroupCnt = 0;
-
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- if (phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile) == _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG))
- rtStatus = _FAIL;
-#endif
- }
-
- if ( pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE )
- PHY_TxPowerByRateConfiguration(Adapter);
-
- if ( Adapter->registrypriv.RegEnableTxPowerLimit == 1 ||
- ( Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1 ) )
- PHY_ConvertTxPowerLimitToPowerIndex( Adapter );
-
- if(rtStatus != _SUCCESS){
- DBG_871X("%s(): CONFIG_BB_PHY_REG_PG Fail!!\n",__FUNCTION__ );
- goto phy_BB8190_Config_ParaFile_Fail;
- }
- }
-
- //
- // 3. BB AGC table Initialization
- //
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- if (phy_ConfigBBWithParaFile(Adapter, pszAGCTableFile, CONFIG_BB_AGC_TAB) == _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB))
- rtStatus = _FAIL;
-#endif
- }
-
- if(rtStatus != _SUCCESS){
- //RT_TRACE(COMP_FPGA, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():AGC Table Fail\n"));
- goto phy_BB8190_Config_ParaFile_Fail;
- }
-
-
-phy_BB8190_Config_ParaFile_Fail:
-
- return rtStatus;
-}
-
-
-int
-PHY_BBConfig8188E(
- IN PADAPTER Adapter
- )
-{
- int rtStatus = _SUCCESS;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- u32 RegVal;
- u8 TmpU1B=0;
- u8 value8,CrystalCap;
-
- phy_InitBBRFRegisterDefinition(Adapter);
-
-
- // Enable BB and RF
- RegVal = rtw_read16(Adapter, REG_SYS_FUNC_EN);
- rtw_write16(Adapter, REG_SYS_FUNC_EN, (u16)(RegVal|BIT13|BIT0|BIT1));
-
- // 20090923 Joseph: Advised by Steven and Jenyu. Power sequence before init RF.
- //rtw_write8(Adapter, REG_AFE_PLL_CTRL, 0x83);
- //rtw_write8(Adapter, REG_AFE_PLL_CTRL+1, 0xdb);
-
- rtw_write8(Adapter, REG_RF_CTRL, RF_EN|RF_RSTB|RF_SDMRSTB);
-
-#ifdef CONFIG_USB_HCI
- rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | FEN_BB_GLB_RSTn | FEN_BBRSTB);
-#else
- rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_PPLL|FEN_PCIEA|FEN_DIO_PCIE|FEN_BB_GLB_RSTn|FEN_BBRSTB);
-#endif
-
-#if 0
-#ifdef CONFIG_USB_HCI
- //To Fix MAC loopback mode fail. Suggested by SD4 Johnny. 2010.03.23.
- rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x0f);
- rtw_write8(Adapter, 0x15, 0xe9);
-#endif
-
- rtw_write8(Adapter, REG_AFE_XTAL_CTRL+1, 0x80);
-#endif
-
-#ifdef CONFIG_USB_HCI
- //rtw_write8(Adapter, 0x15, 0xe9);
-#endif
-
-
-#ifdef CONFIG_PCI_HCI
- // Force use left antenna by default for 88C.
- // if(!IS_92C_SERIAL(pHalData->VersionID) || IS_92C_1T2R(pHalData->VersionID))
- if(Adapter->ledpriv.LedStrategy != SW_LED_MODE10)
- {
- RegVal = rtw_read32(Adapter, REG_LEDCFG0);
- rtw_write32(Adapter, REG_LEDCFG0, RegVal|BIT23);
- }
-#endif
-
- //
- // Config BB and AGC
- //
- rtStatus = phy_BB8188E_Config_ParaFile(Adapter);
-
- // write 0x24[16:11] = 0x24[22:17] = CrystalCap
- CrystalCap = pHalData->CrystalCap & 0x3F;
- PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, 0x7ff800, (CrystalCap | (CrystalCap << 6)));
-
- return rtStatus;
-
-}
-
-
-int
-PHY_RFConfig8188E(
- IN PADAPTER Adapter
- )
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- int rtStatus = _SUCCESS;
-
- //
- // RF config
- //
- rtStatus = PHY_RF6052_Config8188E(Adapter);
-#if 0
- switch(pHalData->rf_chip)
- {
- case RF_6052:
- rtStatus = PHY_RF6052_Config(Adapter);
- break;
- case RF_8225:
- rtStatus = PHY_RF8225_Config(Adapter);
- break;
- case RF_8256:
- rtStatus = PHY_RF8256_Config(Adapter);
- break;
- case RF_8258:
- break;
- case RF_PSEUDO_11N:
- rtStatus = PHY_RF8225_Config(Adapter);
- break;
- default: //for MacOs Warning: "RF_TYPE_MIN" not handled in switch
- break;
- }
-#endif
- return rtStatus;
-}
-
-
-/*-----------------------------------------------------------------------------
- * Function: PHY_ConfigRFWithParaFile()
- *
- * Overview: This function read RF parameters from general file format, and do RF 3-wire
- *
- * Input: PADAPTER Adapter
- * ps1Byte pFileName
- * u8 eRFPath
- *
- * Output: NONE
- *
- * Return: RT_STATUS_SUCCESS: configuration file exist
- *
- * Note: Delay may be required for RF configuration
- *---------------------------------------------------------------------------*/
-int
-rtl8188e_PHY_ConfigRFWithParaFile(
- IN PADAPTER Adapter,
- IN u8* pFileName,
- IN u8 eRFPath
-)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
- int rtStatus = _SUCCESS;
-
-
- return rtStatus;
-
-}
-
-//****************************************
-// The following is for High Power PA
-//****************************************
-#define HighPowerRadioAArrayLen 22
-//This is for High power PA
-u32 Rtl8192S_HighPower_RadioA_Array[HighPowerRadioAArrayLen] = {
-0x013,0x00029ea4,
-0x013,0x00025e74,
-0x013,0x00020ea4,
-0x013,0x0001ced0,
-0x013,0x00019f40,
-0x013,0x00014e70,
-0x013,0x000106a0,
-0x013,0x0000c670,
-0x013,0x000082a0,
-0x013,0x00004270,
-0x013,0x00000240,
-};
-
-int
-PHY_ConfigRFExternalPA(
- IN PADAPTER Adapter,
- IN u8 eRFPath
-)
-{
- int rtStatus = _SUCCESS;
-#ifdef CONFIG_USB_HCI
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- u16 i=0;
-
- if(!pHalData->ExternalPA)
- {
- return rtStatus;
- }
-
- // 2010/10/19 MH According to Jenyu/EEChou 's opinion, we need not to execute the
- // same code as SU. It is already updated in radio_a_1T_HP.txt.
-#if 0
- //add for SU High Power PA
- for(i = 0;i<HighPowerRadioAArrayLen; i=i+2)
- {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("External PA, write RF 0x%lx=0x%lx\n", Rtl8192S_HighPower_RadioA_Array[i], Rtl8192S_HighPower_RadioA_Array[i+1]));
- PHY_SetRFReg(Adapter, eRFPath, Rtl8192S_HighPower_RadioA_Array[i], bRFRegOffsetMask, Rtl8192S_HighPower_RadioA_Array[i+1]);
- }
-#endif
-
-#endif
- return rtStatus;
-}
-//****************************************
-/*-----------------------------------------------------------------------------
- * Function: GetTxPowerLevel8190()
- *
- * Overview: This function is export to "common" moudule
- *
- * Input: PADAPTER Adapter
- * psByte Power Level
- *
- * Output: NONE
- *
- * Return: NONE
- *
- *---------------------------------------------------------------------------*/
-VOID
-PHY_GetTxPowerLevel8188E(
- IN PADAPTER Adapter,
- OUT s32* powerlevel
- )
-{
-#if 0
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
- s4Byte TxPwrDbm = 13;
- RT_TRACE(COMP_TXAGC, DBG_LOUD, ("PHY_GetTxPowerLevel8188E(): TxPowerLevel: %#x\n", TxPwrDbm));
-
- if ( pMgntInfo->ClientConfigPwrInDbm != UNSPECIFIED_PWR_DBM )
- *powerlevel = pMgntInfo->ClientConfigPwrInDbm;
- else
- *powerlevel = TxPwrDbm;
-#endif
-}
-
-/*-----------------------------------------------------------------------------
- * Function: SetTxPowerLevel8190()
- *
- * Overview: This function is export to "HalCommon" moudule
- * We must consider RF path later!!!!!!!
- *
- * Input: PADAPTER Adapter
- * u1Byte channel
- *
- * Output: NONE
- *
- * Return: NONE
- * 2008/11/04 MHC We remove EEPROM_93C56.
- * We need to move CCX relative code to independet file.
- * 2009/01/21 MHC Support new EEPROM format from SD3 requirement.
- *
- *---------------------------------------------------------------------------*/
-VOID
-PHY_SetTxPowerLevel8188E(
- IN PADAPTER Adapter,
- IN u8 Channel
- )
-{
- //DBG_871X("==>PHY_SetTxPowerLevel8188E()\n");
-
- PHY_SetTxPowerLevelByPath(Adapter, Channel, ODM_RF_PATH_A);
-
- //DBG_871X("<==PHY_SetTxPowerLevel8188E()\n");
-}
-
-VOID
-PHY_SetTxPowerIndex_8188E(
- IN PADAPTER Adapter,
- IN u32 PowerIndex,
- IN u8 RFPath,
- IN u8 Rate
- )
-{
- if (RFPath == ODM_RF_PATH_A)
- {
- switch (Rate)
- {
- case MGN_1M: PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, PowerIndex); break;
- case MGN_2M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte1, PowerIndex); break;
- case MGN_5_5M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte2, PowerIndex); break;
- case MGN_11M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte3, PowerIndex); break;
-
- case MGN_6M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte0, PowerIndex); break;
- case MGN_9M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte1, PowerIndex); break;
- case MGN_12M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte2, PowerIndex); break;
- case MGN_18M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte3, PowerIndex); break;
-
- case MGN_24M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte0, PowerIndex); break;
- case MGN_36M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte1, PowerIndex); break;
- case MGN_48M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte2, PowerIndex); break;
- case MGN_54M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte3, PowerIndex); break;
-
- case MGN_MCS0: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte0, PowerIndex); break;
- case MGN_MCS1: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte1, PowerIndex); break;
- case MGN_MCS2: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte2, PowerIndex); break;
- case MGN_MCS3: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte3, PowerIndex); break;
-
- case MGN_MCS4: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte0, PowerIndex); break;
- case MGN_MCS5: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte1, PowerIndex); break;
- case MGN_MCS6: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte2, PowerIndex); break;
- case MGN_MCS7: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte3, PowerIndex); break;
-
- case MGN_MCS8: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskByte0, PowerIndex); break;
- case MGN_MCS9: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskByte1, PowerIndex); break;
- case MGN_MCS10: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskByte2, PowerIndex); break;
- case MGN_MCS11: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskByte3, PowerIndex); break;
-
- case MGN_MCS12: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskByte0, PowerIndex); break;
- case MGN_MCS13: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskByte1, PowerIndex); break;
- case MGN_MCS14: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskByte2, PowerIndex); break;
- case MGN_MCS15: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskByte3, PowerIndex); break;
-
- default:
- DBG_871X("Invalid Rate!!\n");
- break;
- }
- }
- else if (RFPath == ODM_RF_PATH_B)
- {
- switch (Rate)
- {
- case MGN_1M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, bMaskByte1, PowerIndex); break;
- case MGN_2M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, bMaskByte2, PowerIndex); break;
- case MGN_5_5M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, bMaskByte3, PowerIndex); break;
- case MGN_11M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte0, PowerIndex); break;
-
- case MGN_6M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate18_06, bMaskByte0, PowerIndex); break;
- case MGN_9M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate18_06, bMaskByte1, PowerIndex); break;
- case MGN_12M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate18_06, bMaskByte2, PowerIndex); break;
- case MGN_18M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate18_06, bMaskByte3, PowerIndex); break;
-
- case MGN_24M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate54_24, bMaskByte0, PowerIndex); break;
- case MGN_36M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate54_24, bMaskByte1, PowerIndex); break;
- case MGN_48M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate54_24, bMaskByte2, PowerIndex); break;
- case MGN_54M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate54_24, bMaskByte3, PowerIndex); break;
-
- case MGN_MCS0: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs03_Mcs00, bMaskByte0, PowerIndex); break;
- case MGN_MCS1: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs03_Mcs00, bMaskByte1, PowerIndex); break;
- case MGN_MCS2: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs03_Mcs00, bMaskByte2, PowerIndex); break;
- case MGN_MCS3: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs03_Mcs00, bMaskByte3, PowerIndex); break;
-
- case MGN_MCS4: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs07_Mcs04, bMaskByte0, PowerIndex); break;
- case MGN_MCS5: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs07_Mcs04, bMaskByte1, PowerIndex); break;
- case MGN_MCS6: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs07_Mcs04, bMaskByte2, PowerIndex); break;
- case MGN_MCS7: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs07_Mcs04, bMaskByte3, PowerIndex); break;
-
- case MGN_MCS8: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs11_Mcs08, bMaskByte0, PowerIndex); break;
- case MGN_MCS9: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs11_Mcs08, bMaskByte1, PowerIndex); break;
- case MGN_MCS10: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs11_Mcs08, bMaskByte2, PowerIndex); break;
- case MGN_MCS11: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs11_Mcs08, bMaskByte3, PowerIndex); break;
-
- case MGN_MCS12: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs15_Mcs12, bMaskByte0, PowerIndex); break;
- case MGN_MCS13: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs15_Mcs12, bMaskByte1, PowerIndex); break;
- case MGN_MCS14: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs15_Mcs12, bMaskByte2, PowerIndex); break;
- case MGN_MCS15: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs15_Mcs12, bMaskByte3, PowerIndex); break;
-
- default:
- DBG_871X("Invalid Rate!!\n");
- break;
- }
- }
- else
- {
- DBG_871X("Invalid RFPath!!\n");
- }
-}
-
-u8
-phy_GetCurrentTxNum_8188E(
- IN PADAPTER pAdapter,
- IN u8 Rate
- )
-{
- u8 tmpByte = 0;
- u32 tmpDWord = 0;
- u8 TxNum = RF_TX_NUM_NONIMPLEMENT;
-
- if ( ( Rate >= MGN_MCS8 && Rate <= MGN_MCS15 ) )
- TxNum = RF_2TX;
- else
- TxNum = RF_1TX;
-
- return TxNum;
-}
-
-s8 tx_power_extra_bias(
- IN u8 RFPath,
- IN u8 Rate,
- IN CHANNEL_WIDTH BandWidth,
- IN u8 Channel
- )
-{
- s8 bias = 0;
-
- if (Rate == MGN_2M)
- bias = -9;
-
- return bias;
-}
-
-u8
-PHY_GetTxPowerIndex_8188E(
- IN PADAPTER pAdapter,
- IN u8 RFPath,
- IN u8 Rate,
- IN CHANNEL_WIDTH BandWidth,
- IN u8 Channel
- )
-{
- PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
- u8 base_index = 0;
- s8 by_rate_diff = 0, txPower = 0, limit = 0, track_diff = 0, extra_bias = 0;
- u8 txNum = phy_GetCurrentTxNum_8188E(pAdapter, Rate);
- BOOLEAN bIn24G = _FALSE;
-
- base_index = PHY_GetTxPowerIndexBase(pAdapter,RFPath, Rate, BandWidth, Channel, &bIn24G);
-
- by_rate_diff = PHY_GetTxPowerByRate(pAdapter, BAND_ON_2_4G, RFPath, txNum, Rate);
- limit = PHY_GetTxPowerLimit(pAdapter, pAdapter->registrypriv.RegPwrTblSel, (u8)(!bIn24G), pHalData->CurrentChannelBW, RFPath, Rate, pHalData->CurrentChannel);
- by_rate_diff = by_rate_diff > limit ? limit : by_rate_diff;
-
- track_diff = PHY_GetTxPowerTrackingOffset(pAdapter, RFPath, Rate);
-
- extra_bias = tx_power_extra_bias(RFPath, Rate, BandWidth, Channel);
-
- txPower = base_index + by_rate_diff + track_diff + extra_bias;
-
- if(txPower > MAX_POWER_INDEX)
- txPower = MAX_POWER_INDEX;
-
- if (0)
- DBG_871X("RF-%c ch%d TxPwrIdx = %d(0x%X) [%2u %2d %2d %2d]\n"
- , ((RFPath==0)?'A':'B'), Channel, txPower, txPower, base_index, by_rate_diff, track_diff, extra_bias);
-
- return (u8)txPower;
-}
-
-//
-// Description:
-// Update transmit power level of all channel supported.
-//
-// TODO:
-// A mode.
-// By Bruce, 2008-02-04.
-//
-BOOLEAN
-PHY_UpdateTxPowerDbm8188E(
- IN PADAPTER Adapter,
- IN int powerInDbm
- )
-{
- return _TRUE;
-}
-
-VOID
-PHY_ScanOperationBackup8188E(
- IN PADAPTER Adapter,
- IN u8 Operation
- )
-{
-#if 0
- IO_TYPE IoType;
-
- if(!Adapter->bDriverStopped)
- {
- switch(Operation)
- {
- case SCAN_OPT_BACKUP:
- IoType = IO_CMD_PAUSE_DM_BY_SCAN;
- rtw_hal_set_hwreg(Adapter,HW_VAR_IO_CMD, (pu1Byte)&IoType);
-
- break;
-
- case SCAN_OPT_RESTORE:
- IoType = IO_CMD_RESUME_DM_BY_SCAN;
- rtw_hal_set_hwreg(Adapter,HW_VAR_IO_CMD, (pu1Byte)&IoType);
- break;
-
- default:
- RT_TRACE(COMP_SCAN, DBG_LOUD, ("Unknown Scan Backup Operation. \n"));
- break;
- }
- }
-#endif
-}
-void
-phy_SpurCalibration_8188E(
- IN PADAPTER Adapter
- )
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
- if(pHalData->CurrentChannelBW == CHANNEL_WIDTH_20 && pHalData->CurrentChannel == 13){
- PHY_SetBBReg(Adapter, rOFDM1_CFOTracking, BIT(28), 0x1); //enable CSI Mask
- PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask1, BIT(26)|BIT(25), 0x3); //Fix CSI Mask Tone
- PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask2, BIT(26)|BIT(25), 0x0);
- }
- else if(pHalData->CurrentChannelBW == CHANNEL_WIDTH_40 && pHalData->CurrentChannel == 11){
- PHY_SetBBReg(Adapter, rOFDM1_CFOTracking, BIT(28), 0x1); //enable CSI Mask
- PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask1, BIT(26)|BIT(25), 0x0);
- PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask2, BIT(26)|BIT(25), 0x3); //Fix CSI Mask Tone
- }
- else{
- PHY_SetBBReg(Adapter, rOFDM1_CFOTracking, BIT(28), 0x0); //disable CSI Mask
- PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask1, BIT(26)|BIT(25), 0x0);
- PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask2, BIT(26)|BIT(25), 0x0);
- }
-
-}
-
-/*-----------------------------------------------------------------------------
- * Function: PHY_SetBWModeCallback8192C()
- *
- * Overview: Timer callback function for SetSetBWMode
- *
- * Input: PRT_TIMER pTimer
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Note: (1) We do not take j mode into consideration now
- * (2) Will two workitem of "switch channel" and "switch channel bandwidth" run
- * concurrently?
- *---------------------------------------------------------------------------*/
-static VOID
-_PHY_SetBWMode88E(
- IN PADAPTER Adapter
-)
-{
-// PADAPTER Adapter = (PADAPTER)pTimer->Adapter;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- u8 regBwOpMode;
- u8 regRRSR_RSC;
-
- //return;
-
- // Added it for 20/40 mhz switch time evaluation by guangan 070531
- //u4Byte NowL, NowH;
- //u8Byte BeginTime, EndTime;
-
- /*RT_TRACE(COMP_SCAN, DBG_LOUD, ("==>PHY_SetBWModeCallback8192C() Switch to %s bandwidth\n", \
- pHalData->CurrentChannelBW == CHANNEL_WIDTH_20?"20MHz":"40MHz"))*/
-
- if(pHalData->rf_chip == RF_PSEUDO_11N)
- {
- //pHalData->SetBWModeInProgress= _FALSE;
- return;
- }
-
- // There is no 40MHz mode in RF_8225.
- if(pHalData->rf_chip==RF_8225)
- return;
-
- if(Adapter->bDriverStopped)
- return;
-
- // Added it for 20/40 mhz switch time evaluation by guangan 070531
- //NowL = PlatformEFIORead4Byte(Adapter, TSFR);
- //NowH = PlatformEFIORead4Byte(Adapter, TSFR+4);
- //BeginTime = ((u8Byte)NowH << 32) + NowL;
-
- //3//
- //3//<1>Set MAC register
- //3//
- //Adapter->HalFunc.SetBWModeHandler();
-
- regBwOpMode = rtw_read8(Adapter, REG_BWOPMODE);
- regRRSR_RSC = rtw_read8(Adapter, REG_RRSR+2);
- //regBwOpMode = rtw_hal_get_hwreg(Adapter,HW_VAR_BWMODE,(pu1Byte)&regBwOpMode);
-
- switch(pHalData->CurrentChannelBW)
- {
- case CHANNEL_WIDTH_20:
- regBwOpMode |= BW_OPMODE_20MHZ;
- // 2007/02/07 Mark by Emily becasue we have not verify whether this register works
- rtw_write8(Adapter, REG_BWOPMODE, regBwOpMode);
- break;
-
- case CHANNEL_WIDTH_40:
- regBwOpMode &= ~BW_OPMODE_20MHZ;
- // 2007/02/07 Mark by Emily becasue we have not verify whether this register works
- rtw_write8(Adapter, REG_BWOPMODE, regBwOpMode);
-
- regRRSR_RSC = (regRRSR_RSC&0x90) |(pHalData->nCur40MhzPrimeSC<<5);
- rtw_write8(Adapter, REG_RRSR+2, regRRSR_RSC);
- break;
-
- default:
- /*RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetBWModeCallback8192C():
- unknown Bandwidth: %#X\n",pHalData->CurrentChannelBW));*/
- break;
- }
-
- //3//
- //3//<2>Set PHY related register
- //3//
- switch(pHalData->CurrentChannelBW)
- {
- /* 20 MHz channel*/
- case CHANNEL_WIDTH_20:
- PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x0);
- PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x0);
- //PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 1);
-
- break;
-
-
- /* 40 MHz channel*/
- case CHANNEL_WIDTH_40:
- PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x1);
- PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x1);
-
- // Set Control channel to upper or lower. These settings are required only for 40MHz
- PHY_SetBBReg(Adapter, rCCK0_System, bCCKSideBand, (pHalData->nCur40MhzPrimeSC>>1));
- PHY_SetBBReg(Adapter, rOFDM1_LSTF, 0xC00, pHalData->nCur40MhzPrimeSC);
- //PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 0);
-
- PHY_SetBBReg(Adapter, 0x818, (BIT26|BIT27), (pHalData->nCur40MhzPrimeSC==HAL_PRIME_CHNL_OFFSET_LOWER)?2:1);
-
- break;
-
-
-
- default:
- /*RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetBWModeCallback8192C(): unknown Bandwidth: %#X\n"\
- ,pHalData->CurrentChannelBW));*/
- break;
-
- }
- //Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315
-
- // Added it for 20/40 mhz switch time evaluation by guangan 070531
- //NowL = PlatformEFIORead4Byte(Adapter, TSFR);
- //NowH = PlatformEFIORead4Byte(Adapter, TSFR+4);
- //EndTime = ((u8Byte)NowH << 32) + NowL;
- //RT_TRACE(COMP_SCAN, DBG_LOUD, ("SetBWModeCallback8190Pci: time of SetBWMode = %I64d us!\n", (EndTime - BeginTime)));
-
- //3<3>Set RF related register
- switch(pHalData->rf_chip)
- {
- case RF_8225:
- //PHY_SetRF8225Bandwidth(Adapter, pHalData->CurrentChannelBW);
- break;
-
- case RF_8256:
- // Please implement this function in Hal8190PciPhy8256.c
- //PHY_SetRF8256Bandwidth(Adapter, pHalData->CurrentChannelBW);
- break;
-
- case RF_8258:
- // Please implement this function in Hal8190PciPhy8258.c
- // PHY_SetRF8258Bandwidth();
- break;
-
- case RF_PSEUDO_11N:
- // Do Nothing
- break;
-
- case RF_6052:
- rtl8188e_PHY_RF6052SetBandwidth(Adapter, pHalData->CurrentChannelBW);
- break;
-
- default:
- //RT_ASSERT(FALSE, ("Unknown RFChipID: %d\n", pHalData->RFChipID));
- break;
- }
-
- //pHalData->SetBWModeInProgress= FALSE;
-
- //RT_TRACE(COMP_SCAN, DBG_LOUD, ("<==PHY_SetBWModeCallback8192C() \n" ));
-}
-
-
- /*-----------------------------------------------------------------------------
- * Function: SetBWMode8190Pci()
- *
- * Overview: This function is export to "HalCommon" moudule
- *
- * Input: PADAPTER Adapter
- * CHANNEL_WIDTH Bandwidth //20M or 40M
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Note: We do not take j mode into consideration now
- *---------------------------------------------------------------------------*/
-VOID
-PHY_SetBWMode8188E(
- IN PADAPTER Adapter,
- IN CHANNEL_WIDTH Bandwidth, // 20M or 40M
- IN unsigned char Offset // Upper, Lower, or Don't care
-)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- CHANNEL_WIDTH tmpBW= pHalData->CurrentChannelBW;
- // Modified it for 20/40 mhz switch by guangan 070531
- //PMGNT_INFO pMgntInfo=&Adapter->MgntInfo;
-
- //return;
-
- //if(pHalData->SwChnlInProgress)
-// if(pMgntInfo->bScanInProgress)
-// {
-// RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() %s Exit because bScanInProgress!\n",
-// Bandwidth == CHANNEL_WIDTH_20?"20MHz":"40MHz"));
-// return;
-// }
-
-// if(pHalData->SetBWModeInProgress)
-// {
-// // Modified it for 20/40 mhz switch by guangan 070531
-// RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() %s cancel last timer because SetBWModeInProgress!\n",
-// Bandwidth == CHANNEL_WIDTH_20?"20MHz":"40MHz"));
-// PlatformCancelTimer(Adapter, &pHalData->SetBWModeTimer);
-// //return;
-// }
-
- //if(pHalData->SetBWModeInProgress)
- // return;
-
- //pHalData->SetBWModeInProgress= TRUE;
-
- pHalData->CurrentChannelBW = Bandwidth;
-
-#if 0
- if(Offset==EXTCHNL_OFFSET_LOWER)
- pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER;
- else if(Offset==EXTCHNL_OFFSET_UPPER)
- pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER;
- else
- pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-#else
- pHalData->nCur40MhzPrimeSC = Offset;
-#endif
-
- if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved))
- {
- #if 0
- //PlatformSetTimer(Adapter, &(pHalData->SetBWModeTimer), 0);
- #else
- _PHY_SetBWMode88E(Adapter);
- #endif
- if (IS_VENDOR_8188E_I_CUT_SERIES(Adapter)&& IS_HARDWARE_TYPE_8188ES(Adapter))
- phy_SpurCalibration_8188E( Adapter);
- }
- else
- {
- //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() SetBWModeInProgress FALSE driver sleep or unload\n"));
- //pHalData->SetBWModeInProgress= FALSE;
- pHalData->CurrentChannelBW = tmpBW;
- }
-
-}
-
-
-static void _PHY_SwChnl8188E(PADAPTER Adapter, u8 channel)
-{
- u8 eRFPath;
- u32 param1, param2;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
- if ( Adapter->bNotifyChannelChange )
- {
- DBG_871X( "[%s] ch = %d\n", __FUNCTION__, channel );
- }
-
- //s1. pre common command - CmdID_SetTxPowerLevel
- PHY_SetTxPowerLevel8188E(Adapter, channel);
-
- //s2. RF dependent command - CmdID_RF_WriteReg, param1=RF_CHNLBW, param2=channel
- param1 = RF_CHNLBW;
- param2 = channel;
- for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
- {
- pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2);
- PHY_SetRFReg(Adapter, eRFPath, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]);
- }
-
-
- //s3. post common command - CmdID_End, None
-
-}
-VOID
-PHY_SwChnl8188E( // Call after initialization
- IN PADAPTER Adapter,
- IN u8 channel
- )
-{
- //PADAPTER Adapter = ADJUST_TO_ADAPTIVE_ADAPTER(pAdapter, _TRUE);
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- u8 tmpchannel = pHalData->CurrentChannel;
- BOOLEAN bResult = _TRUE;
-
- if(pHalData->rf_chip == RF_PSEUDO_11N)
- {
- //pHalData->SwChnlInProgress=FALSE;
- return; //return immediately if it is peudo-phy
- }
-
- //if(pHalData->SwChnlInProgress)
- // return;
-
- //if(pHalData->SetBWModeInProgress)
- // return;
-
- //--------------------------------------------
- switch(pHalData->CurrentWirelessMode)
- {
- case WIRELESS_MODE_A:
- case WIRELESS_MODE_N_5G:
- //RT_ASSERT((channel>14), ("WIRELESS_MODE_A but channel<=14"));
- break;
-
- case WIRELESS_MODE_B:
- //RT_ASSERT((channel<=14), ("WIRELESS_MODE_B but channel>14"));
- break;
-
- case WIRELESS_MODE_G:
- case WIRELESS_MODE_N_24G:
- //RT_ASSERT((channel<=14), ("WIRELESS_MODE_G but channel>14"));
- break;
-
- default:
- //RT_ASSERT(FALSE, ("Invalid WirelessMode(%#x)!!\n", pHalData->CurrentWirelessMode));
- break;
- }
- //--------------------------------------------
-
- //pHalData->SwChnlInProgress = TRUE;
- if(channel == 0)
- channel = 1;
-
- pHalData->CurrentChannel=channel;
-
- //pHalData->SwChnlStage=0;
- //pHalData->SwChnlStep=0;
-
- if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved))
- {
- #if 0
- //PlatformSetTimer(Adapter, &(pHalData->SwChnlTimer), 0);
- #else
- _PHY_SwChnl8188E(Adapter, channel);
- #endif
-
- if (IS_VENDOR_8188E_I_CUT_SERIES(Adapter)&& IS_HARDWARE_TYPE_8188ES(Adapter))
- phy_SpurCalibration_8188E( Adapter);
-
-
- if(bResult)
- {
- //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress TRUE schdule workitem done\n"));
- }
- else
- {
- //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress FALSE schdule workitem error\n"));
- //if(IS_HARDWARE_TYPE_8192SU(Adapter))
- //{
- // pHalData->SwChnlInProgress = FALSE;
- pHalData->CurrentChannel = tmpchannel;
- //}
- }
-
- }
- else
- {
- //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress FALSE driver sleep or unload\n"));
- //if(IS_HARDWARE_TYPE_8192SU(Adapter))
- //{
- // pHalData->SwChnlInProgress = FALSE;
- pHalData->CurrentChannel = tmpchannel;
- //}
- }
-}
-
-VOID
-PHY_SetSwChnlBWMode8188E(
- IN PADAPTER Adapter,
- IN u8 channel,
- IN CHANNEL_WIDTH Bandwidth,
- IN u8 Offset40,
- IN u8 Offset80
-)
-{
- //DBG_871X("%s()===>\n",__FUNCTION__);
-
- PHY_SwChnl8188E(Adapter, channel);
- PHY_SetBWMode8188E(Adapter, Bandwidth, Offset40);
-
- //DBG_871X("<==%s()\n",__FUNCTION__);
-}
-
-
-//
-// Description:
-// Configure H/W functionality to enable/disable Monitor mode.
-// Note, because we possibly need to configure BB and RF in this function,
-// so caller should in PASSIVE_LEVEL. 080118, by rcnjko.
-//
-VOID
-PHY_SetMonitorMode8192C(
- IN PADAPTER pAdapter,
- IN BOOLEAN bEnableMonitorMode
- )
-{
-#if 0
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- BOOLEAN bFilterOutNonAssociatedBSSID = FALSE;
-
- //2 Note: we may need to stop antenna diversity.
- if(bEnableMonitorMode)
- {
- bFilterOutNonAssociatedBSSID = FALSE;
- RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8192S(): enable monitor mode\n"));
-
- pHalData->bInMonitorMode = TRUE;
- pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, TRUE, TRUE);
- rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (pu1Byte)&bFilterOutNonAssociatedBSSID);
- }
- else
- {
- bFilterOutNonAssociatedBSSID = TRUE;
- RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8192S(): disable monitor mode\n"));
-
- pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, FALSE, TRUE);
- pHalData->bInMonitorMode = FALSE;
- rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (pu1Byte)&bFilterOutNonAssociatedBSSID);
- }
-#endif
-}
-
-
-/*-----------------------------------------------------------------------------
- * Function: PHYCheckIsLegalRfPath8190Pci()
- *
- * Overview: Check different RF type to execute legal judgement. If RF Path is illegal
- * We will return false.
- *
- * Input: NONE
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Revised History:
- * When Who Remark
- * 11/15/2007 MHC Create Version 0.
- *
- *---------------------------------------------------------------------------*/
-BOOLEAN
-PHY_CheckIsLegalRfPath8192C(
- IN PADAPTER pAdapter,
- IN u32 eRFPath)
-{
-// HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
- BOOLEAN rtValue = _TRUE;
-
- // NOt check RF Path now.!
-#if 0
- if (pHalData->RF_Type == RF_1T2R && eRFPath != RF_PATH_A)
- {
- rtValue = FALSE;
- }
- if (pHalData->RF_Type == RF_1T2R && eRFPath != RF_PATH_A)
- {
-
- }
-#endif
- return rtValue;
-
-} /* PHY_CheckIsLegalRfPath8192C */
-
-static VOID _PHY_SetRFPathSwitch(
- IN PADAPTER pAdapter,
- IN BOOLEAN bMain,
- IN BOOLEAN is2T
- )
-{
- u8 u1bTmp;
-
- if(!pAdapter->hw_init_completed)
- {
- u1bTmp = rtw_read8(pAdapter, REG_LEDCFG2) | BIT7;
- rtw_write8(pAdapter, REG_LEDCFG2, u1bTmp);
- //PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01);
- }
-
- if(is2T)
- {
- if(bMain)
- PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); //92C_Path_A
- else
- PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); //BT
- }
- else
- {
-
- if(bMain)
- PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x2); //Main
- else
- PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x1); //Aux
- }
-
-}
-
-//return value TRUE => Main; FALSE => Aux
-
-static BOOLEAN _PHY_QueryRFPathSwitch(
- IN PADAPTER pAdapter,
- IN BOOLEAN is2T
- )
-{
-// if(is2T)
-// return _TRUE;
-
- if(!pAdapter->hw_init_completed)
- {
- PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01);
- PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01);
- }
-
- if(is2T)
- {
- if(PHY_QueryBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01)
- return _TRUE;
- else
- return _FALSE;
- }
- else
- {
- if(PHY_QueryBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300) == 0x02)
- return _TRUE;
- else
- return _FALSE;
- }
-}
-
-
-static VOID
-_PHY_DumpRFReg(IN PADAPTER pAdapter)
-{
- u32 rfRegValue,rfRegOffset;
-
- //RTPRINT(FINIT, INIT_RF, ("PHY_DumpRFReg()====>\n"));
-
- for(rfRegOffset = 0x00;rfRegOffset<=0x30;rfRegOffset++){
- rfRegValue = PHY_QueryRFReg(pAdapter,RF_PATH_A, rfRegOffset, bMaskDWord);
- //RTPRINT(FINIT, INIT_RF, (" 0x%02x = 0x%08x\n",rfRegOffset,rfRegValue));
- }
- //RTPRINT(FINIT, INIT_RF, ("<===== PHY_DumpRFReg()\n"));
-}
-
-
-//
-// Move from phycfg.c to gen.c to be code independent later
-//
-//-------------------------Move to other DIR later----------------------------*/
-#ifdef CONFIG_USB_HCI
-
-//
-// Description:
-// To dump all Tx FIFO LLT related link-list table.
-// Added by Roger, 2009.03.10.
-//
-VOID
-DumpBBDbgPort_92CU(
- IN PADAPTER Adapter
- )
-{
-
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("BaseBand Debug Ports:\n"));
-
- PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0000);
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
-
- PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0803);
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
-
- PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0a06);
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
-
- PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0007);
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
-
- PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0100);
- PHY_SetBBReg(Adapter, 0x0a28, 0x00ff0000, 0x000f0000);
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
-
- PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0100);
- PHY_SetBBReg(Adapter, 0x0a28, 0x00ff0000, 0x00150000);
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
-
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0x800, PHY_QueryBBReg(Adapter, 0x0800, bMaskDWord)));
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0x900, PHY_QueryBBReg(Adapter, 0x0900, bMaskDWord)));
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa00, PHY_QueryBBReg(Adapter, 0x0a00, bMaskDWord)));
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa54, PHY_QueryBBReg(Adapter, 0x0a54, bMaskDWord)));
- //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa58, PHY_QueryBBReg(Adapter, 0x0a58, bMaskDWord)));
-
-}
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTL8188E_PHYCFG_C_
+
+#include <drv_types.h>
+#include <rtl8188e_hal.h>
+
+
+/*---------------------------Define Local Constant---------------------------*/
+/* Channel switch:The size of command tables for switch channel*/
+#define MAX_PRECMD_CNT 16
+#define MAX_RFDEPENDCMD_CNT 16
+#define MAX_POSTCMD_CNT 16
+
+#define MAX_DOZE_WAITING_TIMES_9x 64
+
+/*---------------------------Define Local Constant---------------------------*/
+
+
+/*------------------------Define global variable-----------------------------*/
+
+/*------------------------Define local variable------------------------------*/
+
+
+/*--------------------Define export function prototype-----------------------*/
+// Please refer to header file
+/*--------------------Define export function prototype-----------------------*/
+
+/*----------------------------Function Body----------------------------------*/
+//
+// 1. BB register R/W API
+//
+
+#if(SIC_ENABLE == 1)
+static BOOLEAN
+sic_IsSICReady(
+ IN PADAPTER Adapter
+ )
+{
+ BOOLEAN bRet=_FALSE;
+ u32 retryCnt=0;
+ u8 sic_cmd=0xff;
+
+ while(1)
+ {
+ if(retryCnt++ >= SIC_MAX_POLL_CNT)
+ {
+ //RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady() return FALSE\n"));
+ return _FALSE;
+ }
+
+ //if(RT_SDIO_CANNOT_IO(Adapter))
+ // return _FALSE;
+
+ sic_cmd = rtw_read8(Adapter, SIC_CMD_REG);
+ //sic_cmd = PlatformEFIORead1Byte(Adapter, SIC_CMD_REG);
+#if(SIC_HW_SUPPORT == 1)
+ sic_cmd &= 0xf0; // [7:4]
+#endif
+ //RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady(), readback 0x%x=0x%x\n", SIC_CMD_REG, sic_cmd));
+ if(sic_cmd == SIC_CMD_READY)
+ return _TRUE;
+ else
+ {
+ rtw_msleep_os(1);
+ //delay_ms(1);
+ }
+ }
+
+ return bRet;
+}
+
+/*
+u32
+sic_CalculateBitShift(
+ u32 BitMask
+ )
+{
+ u32 i;
+
+ for(i=0; i<=31; i++)
+ {
+ if ( ((BitMask>>i) & 0x1 ) == 1)
+ break;
+ }
+
+ return (i);
+}
+*/
+
+static u32
+sic_Read4Byte(
+ PVOID Adapter,
+ u32 offset
+ )
+{
+ u32 u4ret=0xffffffff;
+#if RTL8188E_SUPPORT == 1
+ u8 retry = 0;
+#endif
+
+ //RTPRINT(FPHY, PHY_SICR, ("[SIC], sic_Read4Byte(): read offset(%#x)\n", offset));
+
+ if(sic_IsSICReady(Adapter))
+ {
+#if(SIC_HW_SUPPORT == 1)
+ rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD);
+ //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD);
+ //RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREREAD));
+#endif
+ rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff));
+ //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG, (u1Byte)(offset&0xff));
+ //RTPRINT(FPHY, PHY_SICR, ("write 0x%x = 0x%x\n", SIC_ADDR_REG, (u1Byte)(offset&0xff)));
+ rtw_write8(Adapter, SIC_ADDR_REG+1, (u8)((offset&0xff00)>>8));
+ //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8));
+ //RTPRINT(FPHY, PHY_SICR, ("write 0x%x = 0x%x\n", SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8)));
+ rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_READ);
+ //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_READ);
+ //RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_READ));
+
+#if RTL8188E_SUPPORT == 1
+ retry = 4;
+ while(retry--){
+ rtw_udelay_os(50);
+ //PlatformStallExecution(50);
+ }
+#else
+ rtw_udelay_os(200);
+ //PlatformStallExecution(200);
+#endif
+
+ if(sic_IsSICReady(Adapter))
+ {
+ u4ret = rtw_read32(Adapter, SIC_DATA_REG);
+ //u4ret = PlatformEFIORead4Byte(Adapter, SIC_DATA_REG);
+ //RTPRINT(FPHY, PHY_SICR, ("read 0x%x = 0x%x\n", SIC_DATA_REG, u4ret));
+ //DbgPrint("<===Read 0x%x = 0x%x\n", offset, u4ret);
+ }
+ }
+
+ return u4ret;
+}
+
+static VOID
+sic_Write4Byte(
+ PVOID Adapter,
+ u32 offset,
+ u32 data
+ )
+{
+#if RTL8188E_SUPPORT == 1
+ u8 retry = 6;
+#endif
+ //DbgPrint("=>Write 0x%x = 0x%x\n", offset, data);
+ //RTPRINT(FPHY, PHY_SICW, ("[SIC], sic_Write4Byte(): write offset(%#x)=0x%x\n", offset, data));
+ if(sic_IsSICReady(Adapter))
+ {
+#if(SIC_HW_SUPPORT == 1)
+ rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE);
+ //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE);
+ //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREWRITE));
+#endif
+ rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff));
+ //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG, (u1Byte)(offset&0xff));
+ //RTPRINT(FPHY, PHY_SICW, ("write 0x%x=0x%x\n", SIC_ADDR_REG, (u1Byte)(offset&0xff)));
+ rtw_write8(Adapter, SIC_ADDR_REG+1, (u8)((offset&0xff00)>>8));
+ //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8));
+ //RTPRINT(FPHY, PHY_SICW, ("write 0x%x=0x%x\n", (SIC_ADDR_REG+1), (u1Byte)((offset&0xff00)>>8)));
+ rtw_write32(Adapter, SIC_DATA_REG, (u32)data);
+ //PlatformEFIOWrite4Byte(Adapter, SIC_DATA_REG, (u4Byte)data);
+ //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_DATA_REG, data));
+ rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_WRITE);
+ //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_WRITE);
+ //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_WRITE));
+#if RTL8188E_SUPPORT == 1
+ while(retry--){
+ rtw_udelay_os(50);
+ //PlatformStallExecution(50);
+ }
+#else
+ rtw_udelay_os(150);
+ //PlatformStallExecution(150);
+#endif
+
+ }
+}
+//============================================================
+// extern function
+//============================================================
+static VOID
+SIC_SetBBReg(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ u32 OriginalValue, BitShift;
+ u16 BBWaitCounter = 0;
+
+ //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg() start\n"));
+/*
+ while(PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _TRUE) == _TRUE)
+ {
+ BBWaitCounter ++;
+ delay_ms(10); // 1 ms
+
+ if((BBWaitCounter > 100) || RT_CANNOT_IO(Adapter))
+ {// Wait too long, return FALSE to avoid to be stuck here.
+ RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), Fail to set BB offset(%#x)!!, WaitCnt(%d)\n", RegAddr, BBWaitCounter));
+ return;
+ }
+ }
+*/
+ //
+ // Critical section start
+ //
+
+ //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), mask=0x%x, addr[0x%x]=0x%x\n", BitMask, RegAddr, Data));
+
+ if(BitMask!= bMaskDWord){//if not "double word" write
+ OriginalValue = sic_Read4Byte(Adapter, RegAddr);
+ //BitShift = sic_CalculateBitShift(BitMask);
+ BitShift = PHY_CalculateBitShift(BitMask);
+ Data = (((OriginalValue) & (~BitMask)) | (Data << BitShift));
+ }
+
+ sic_Write4Byte(Adapter, RegAddr, Data);
+
+ //PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _FALSE);
+ //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg() end\n"));
+}
+
+static u32
+SIC_QueryBBReg(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ u32 ReturnValue = 0, OriginalValue, BitShift;
+ u16 BBWaitCounter = 0;
+
+ //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg() start\n"));
+
+/*
+ while(PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _TRUE) == _TRUE)
+ {
+ BBWaitCounter ++;
+ delay_ms(10); // 10 ms
+
+ if((BBWaitCounter > 100) || RT_CANNOT_IO(Adapter))
+ {// Wait too long, return FALSE to avoid to be stuck here.
+ RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_QueryBBReg(), Fail to query BB offset(%#x)!!, WaitCnt(%d)\n", RegAddr, BBWaitCounter));
+ return ReturnValue;
+ }
+ }
+*/
+ OriginalValue = sic_Read4Byte(Adapter, RegAddr);
+ //BitShift = sic_CalculateBitShift(BitMask);
+ BitShift = PHY_CalculateBitShift(BitMask);
+ ReturnValue = (OriginalValue & BitMask) >> BitShift;
+
+ //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg(), 0x%x=0x%x\n", RegAddr, OriginalValue));
+ //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg() end\n"));
+
+ //PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _FALSE);
+ return (ReturnValue);
+}
+
+VOID
+SIC_Init(
+ IN PADAPTER Adapter
+ )
+{
+ // Here we need to write 0x1b8~0x1bf = 0 after fw is downloaded
+ // because for 8723E at beginning 0x1b8=0x1e, that will cause
+ // sic always not be ready
+#if(SIC_HW_SUPPORT == 1)
+ //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n",
+ // SIC_INIT_REG, SIC_INIT_VAL));
+ rtw_write8(Adapter, SIC_INIT_REG, SIC_INIT_VAL);
+ //PlatformEFIOWrite1Byte(Adapter, SIC_INIT_REG, SIC_INIT_VAL);
+ //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n",
+ // SIC_CMD_REG, SIC_CMD_INIT));
+ rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_INIT);
+ //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_INIT);
+#else
+ //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x1b8~0x1bf = 0x0\n"));
+ rtw_write32(Adapter, SIC_CMD_REG, 0);
+ //PlatformEFIOWrite4Byte(Adapter, SIC_CMD_REG, 0);
+ rtw_write32(Adapter, SIC_CMD_REG+4, 0);
+ //PlatformEFIOWrite4Byte(Adapter, SIC_CMD_REG+4, 0);
+#endif
+}
+
+static BOOLEAN
+SIC_LedOff(
+ IN PADAPTER Adapter
+ )
+{
+ // When SIC is enabled, led pin will be used as debug pin,
+ // so don't execute led function when SIC is enabled.
+ return _TRUE;
+}
+#endif
+
+/**
+* Function: PHY_QueryBBReg
+*
+* OverView: Read "sepcific bits" from BB register
+*
+* Input:
+* PADAPTER Adapter,
+* u4Byte RegAddr, //The target address to be readback
+* u4Byte BitMask //The target bit position in the target address
+* //to be readback
+* Output: None
+* Return: u4Byte Data //The readback register value
+* Note: This function is equal to "GetRegSetting" in PHY programming guide
+*/
+u32
+PHY_QueryBBReg8188E(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask
+ )
+{
+ u32 ReturnValue = 0, OriginalValue, BitShift;
+ u16 BBWaitCounter = 0;
+
+#if (DISABLE_BB_RF == 1)
+ return 0;
+#endif
+
+#if(SIC_ENABLE == 1)
+ return SIC_QueryBBReg(Adapter, RegAddr, BitMask);
+#endif
+
+ //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_QueryBBReg(): RegAddr(%#lx), BitMask(%#lx)\n", RegAddr, BitMask));
+
+ OriginalValue = rtw_read32(Adapter, RegAddr);
+ BitShift = PHY_CalculateBitShift(BitMask);
+ ReturnValue = (OriginalValue & BitMask) >> BitShift;
+
+ //RTPRINT(FPHY, PHY_BBR, ("BBR MASK=0x%lx Addr[0x%lx]=0x%lx\n", BitMask, RegAddr, OriginalValue));
+ //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_QueryBBReg(): RegAddr(%#lx), BitMask(%#lx), OriginalValue(%#lx)\n", RegAddr, BitMask, OriginalValue));
+
+ return (ReturnValue);
+
+}
+
+
+/**
+* Function: PHY_SetBBReg
+*
+* OverView: Write "Specific bits" to BB register (page 8~)
+*
+* Input:
+* PADAPTER Adapter,
+* u4Byte RegAddr, //The target address to be modified
+* u4Byte BitMask //The target bit position in the target address
+* //to be modified
+* u4Byte Data //The new register value in the target bit position
+* //of the target address
+*
+* Output: None
+* Return: None
+* Note: This function is equal to "PutRegSetting" in PHY programming guide
+*/
+
+VOID
+PHY_SetBBReg8188E(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ //u16 BBWaitCounter = 0;
+ u32 OriginalValue, BitShift;
+
+#if (DISABLE_BB_RF == 1)
+ return;
+#endif
+
+#if(SIC_ENABLE == 1)
+ SIC_SetBBReg(Adapter, RegAddr, BitMask, Data);
+ return;
+#endif
+
+ //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data));
+
+ if(BitMask!= bMaskDWord){//if not "double word" write
+ OriginalValue = rtw_read32(Adapter, RegAddr);
+ BitShift = PHY_CalculateBitShift(BitMask);
+ Data = ((OriginalValue & (~BitMask)) | ((Data << BitShift) & BitMask));
+ }
+
+ rtw_write32(Adapter, RegAddr, Data);
+
+ //RTPRINT(FPHY, PHY_BBW, ("BBW MASK=0x%lx Addr[0x%lx]=0x%lx\n", BitMask, RegAddr, Data));
+ //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data));
+
+}
+
+
+//
+// 2. RF register R/W API
+//
+/**
+* Function: phy_RFSerialRead
+*
+* OverView: Read regster from RF chips
+*
+* Input:
+* PADAPTER Adapter,
+* u8 eRFPath, //Radio path of A/B/C/D
+* u4Byte Offset, //The target address to be read
+*
+* Output: None
+* Return: u4Byte reback value
+* Note: Threre are three types of serial operations:
+* 1. Software serial write
+* 2. Hardware LSSI-Low Speed Serial Interface
+* 3. Hardware HSSI-High speed
+* serial write. Driver need to implement (1) and (2).
+* This function is equal to the combination of RF_ReadReg() and RFLSSIRead()
+*/
+static u32
+phy_RFSerialRead(
+ IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 Offset
+ )
+{
+ u32 retValue = 0;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
+ u32 NewOffset;
+ u32 tmplong,tmplong2;
+ u8 RfPiEnable=0;
+#if 0
+ if(pHalData->RFChipID == RF_8225 && Offset > 0x24) //36 valid regs
+ return retValue;
+ if(pHalData->RFChipID == RF_8256 && Offset > 0x2D) //45 valid regs
+ return retValue;
+#endif
+ //
+ // Make sure RF register offset is correct
+ //
+ Offset &= 0xff;
+
+ //
+ // Switch page for 8256 RF IC
+ //
+ NewOffset = Offset;
+
+ // 2009/06/17 MH We can not execute IO for power save or other accident mode.
+ //if(RT_CANNOT_IO(Adapter))
+ //{
+ // RTPRINT(FPHY, PHY_RFR, ("phy_RFSerialRead return all one\n"));
+ // return 0xFFFFFFFF;
+ //}
+
+ // For 92S LSSI Read RFLSSIRead
+ // For RF A/B write 0x824/82c(does not work in the future)
+ // We must use 0x824 for RF A and B to execute read trigger
+ tmplong = PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord);
+ if(eRFPath == RF_PATH_A)
+ tmplong2 = tmplong;
+ else
+ tmplong2 = PHY_QueryBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord);
+
+ tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | (NewOffset<<23) | bLSSIReadEdge; //T65 RF
+
+ PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong&(~bLSSIReadEdge));
+ rtw_udelay_os(10);// PlatformStallExecution(10);
+
+ PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord, tmplong2);
+ rtw_udelay_os(100);//PlatformStallExecution(100);
+
+ //PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong|bLSSIReadEdge);
+ rtw_udelay_os(10);//PlatformStallExecution(10);
+
+ if(eRFPath == RF_PATH_A)
+ RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter1, BIT8);
+ else if(eRFPath == RF_PATH_B)
+ RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XB_HSSIParameter1, BIT8);
+
+ if(RfPiEnable)
+ { // Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF
+ retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBackPi, bLSSIReadBackData);
+ //DBG_8192C("Readback from RF-PI : 0x%x\n", retValue);
+ }
+ else
+ { //Read from BBreg8a0, 12 bits for 8190, 20 bits for T65 RF
+ retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBack, bLSSIReadBackData);
+ //DBG_8192C("Readback from RF-SI : 0x%x\n", retValue);
+ }
+ //DBG_8192C("RFR-%d Addr[0x%x]=0x%x\n", eRFPath, pPhyReg->rfLSSIReadBack, retValue);
+
+ return retValue;
+
+}
+
+
+
+/**
+* Function: phy_RFSerialWrite
+*
+* OverView: Write data to RF register (page 8~)
+*
+* Input:
+* PADAPTER Adapter,
+* u8 eRFPath, //Radio path of A/B/C/D
+* u4Byte Offset, //The target address to be read
+* u4Byte Data //The new register Data in the target bit position
+* //of the target to be read
+*
+* Output: None
+* Return: None
+* Note: Threre are three types of serial operations:
+* 1. Software serial write
+* 2. Hardware LSSI-Low Speed Serial Interface
+* 3. Hardware HSSI-High speed
+* serial write. Driver need to implement (1) and (2).
+* This function is equal to the combination of RF_ReadReg() and RFLSSIRead()
+ *
+ * Note: For RF8256 only
+ * The total count of RTL8256(Zebra4) register is around 36 bit it only employs
+ * 4-bit RF address. RTL8256 uses "register mode control bit" (Reg00[12], Reg00[10])
+ * to access register address bigger than 0xf. See "Appendix-4 in PHY Configuration
+ * programming guide" for more details.
+ * Thus, we define a sub-finction for RTL8526 register address conversion
+ * ===========================================================
+ * Register Mode RegCTL[1] RegCTL[0] Note
+ * (Reg00[12]) (Reg00[10])
+ * ===========================================================
+ * Reg_Mode0 0 x Reg 0 ~15(0x0 ~ 0xf)
+ * ------------------------------------------------------------------
+ * Reg_Mode1 1 0 Reg 16 ~30(0x1 ~ 0xf)
+ * ------------------------------------------------------------------
+ * Reg_Mode2 1 1 Reg 31 ~ 45(0x1 ~ 0xf)
+ * ------------------------------------------------------------------
+ *
+ * 2008/09/02 MH Add 92S RF definition
+ *
+ *
+ *
+*/
+static VOID
+phy_RFSerialWrite(
+ IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 Offset,
+ IN u32 Data
+ )
+{
+ u32 DataAndAddr = 0;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
+ u32 NewOffset;
+
+#if 0
+ //<Roger_TODO> We should check valid regs for RF_6052 case.
+ if(pHalData->RFChipID == RF_8225 && Offset > 0x24) //36 valid regs
+ return;
+ if(pHalData->RFChipID == RF_8256 && Offset > 0x2D) //45 valid regs
+ return;
+#endif
+
+ // 2009/06/17 MH We can not execute IO for power save or other accident mode.
+ //if(RT_CANNOT_IO(Adapter))
+ //{
+ // RTPRINT(FPHY, PHY_RFW, ("phy_RFSerialWrite stop\n"));
+ // return;
+ //}
+
+ Offset &= 0xff;
+
+ //
+ // Shadow Update
+ //
+ //PHY_RFShadowWrite(Adapter, eRFPath, Offset, Data);
+
+ //
+ // Switch page for 8256 RF IC
+ //
+ NewOffset = Offset;
+
+ //
+ // Put write addr in [5:0] and write data in [31:16]
+ //
+ //DataAndAddr = (Data<<16) | (NewOffset&0x3f);
+ DataAndAddr = ((NewOffset<<20) | (Data&0x000fffff)) & 0x0fffffff; // T65 RF
+
+ //
+ // Write Operation
+ //
+ PHY_SetBBReg(Adapter, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr);
+ //RTPRINT(FPHY, PHY_RFW, ("RFW-%d Addr[0x%lx]=0x%lx\n", eRFPath, pPhyReg->rf3wireOffset, DataAndAddr));
+
+}
+
+
+/**
+* Function: PHY_QueryRFReg
+*
+* OverView: Query "Specific bits" to RF register (page 8~)
+*
+* Input:
+* PADAPTER Adapter,
+* u8 eRFPath, //Radio path of A/B/C/D
+* u4Byte RegAddr, //The target address to be read
+* u4Byte BitMask //The target bit position in the target address
+* //to be read
+*
+* Output: None
+* Return: u4Byte Readback value
+* Note: This function is equal to "GetRFRegSetting" in PHY programming guide
+*/
+u32
+PHY_QueryRFReg8188E(
+ IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask
+ )
+{
+ u32 Original_Value, Readback_Value, BitShift;
+ //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ //u8 RFWaitCounter = 0;
+ //_irqL irqL;
+
+#if (DISABLE_BB_RF == 1)
+ return 0;
+#endif
+
+ //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_QueryRFReg(): RegAddr(%#lx), eRFPath(%#x), BitMask(%#lx)\n", RegAddr, eRFPath,BitMask));
+
+#ifdef CONFIG_USB_HCI
+ //PlatformAcquireMutex(&pHalData->mxRFOperate);
+#else
+ //_enter_critical(&pHalData->rf_lock, &irqL);
+#endif
+
+
+ Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
+
+ BitShift = PHY_CalculateBitShift(BitMask);
+ Readback_Value = (Original_Value & BitMask) >> BitShift;
+
+#ifdef CONFIG_USB_HCI
+ //PlatformReleaseMutex(&pHalData->mxRFOperate);
+#else
+ //_exit_critical(&pHalData->rf_lock, &irqL);
+#endif
+
+
+ //RTPRINT(FPHY, PHY_RFR, ("RFR-%d MASK=0x%lx Addr[0x%lx]=0x%lx\n", eRFPath, BitMask, RegAddr, Original_Value));//BitMask(%#lx),BitMask,
+ //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_QueryRFReg(): RegAddr(%#lx), eRFPath(%#x), Original_Value(%#lx)\n",
+ // RegAddr, eRFPath, Original_Value));
+
+ return (Readback_Value);
+}
+
+/**
+* Function: PHY_SetRFReg
+*
+* OverView: Write "Specific bits" to RF register (page 8~)
+*
+* Input:
+* PADAPTER Adapter,
+* u8 eRFPath, //Radio path of A/B/C/D
+* u4Byte RegAddr, //The target address to be modified
+* u4Byte BitMask //The target bit position in the target address
+* //to be modified
+* u4Byte Data //The new register Data in the target bit position
+* //of the target address
+*
+* Output: None
+* Return: None
+* Note: This function is equal to "PutRFRegSetting" in PHY programming guide
+*/
+VOID
+PHY_SetRFReg8188E(
+ IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data
+ )
+{
+
+ //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ //u1Byte RFWaitCounter = 0;
+ u32 Original_Value, BitShift;
+ //_irqL irqL;
+
+#if (DISABLE_BB_RF == 1)
+ return;
+#endif
+
+ //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n",
+ // RegAddr, BitMask, Data, eRFPath));
+ //RTPRINT(FINIT, INIT_RF, ("PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n",
+ // RegAddr, BitMask, Data, eRFPath));
+
+
+#ifdef CONFIG_USB_HCI
+ //PlatformAcquireMutex(&pHalData->mxRFOperate);
+#else
+ //_enter_critical(&pHalData->rf_lock, &irqL);
+#endif
+
+
+ // RF data is 12 bits only
+ if (BitMask != bRFRegOffsetMask)
+ {
+ Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
+ BitShift = PHY_CalculateBitShift(BitMask);
+ Data = ((Original_Value & (~BitMask)) | (Data<< BitShift));
+ }
+
+ phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data);
+
+
+#ifdef CONFIG_USB_HCI
+ //PlatformReleaseMutex(&pHalData->mxRFOperate);
+#else
+ //_exit_critical(&pHalData->rf_lock, &irqL);
+#endif
+
+ //PHY_QueryRFReg(Adapter,eRFPath,RegAddr,BitMask);
+ //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n",
+ // RegAddr, BitMask, Data, eRFPath));
+
+}
+
+
+//
+// 3. Initial MAC/BB/RF config by reading MAC/BB/RF txt.
+//
+
+/*-----------------------------------------------------------------------------
+ * Function: PHY_MACConfig8192C
+ *
+ * Overview: Condig MAC by header file or parameter file.
+ *
+ * Input: NONE
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ * Revised History:
+ * When Who Remark
+ * 08/12/2008 MHC Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+s32 PHY_MACConfig8188E(PADAPTER Adapter)
+{
+ int rtStatus = _SUCCESS;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ s8 *pszMACRegFile;
+ s8 sz8188EMACRegFile[] = RTL8188E_PHY_MACREG;
+
+ pszMACRegFile = sz8188EMACRegFile;
+
+ //
+ // Config MAC
+ //
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ rtStatus = phy_ConfigMACWithParaFile(Adapter, pszMACRegFile);
+ if (rtStatus == _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ if(HAL_STATUS_FAILURE == ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv))
+ rtStatus = _FAIL;
+ else
+ rtStatus = _SUCCESS;
+#endif//CONFIG_EMBEDDED_FWIMG
+ }
+
+ // 2010.07.13 AMPDU aggregation number B
+ rtw_write8(Adapter, REG_MAX_AGGR_NUM, MAX_AGGR_NUM);
+ //rtw_write8(Adapter, REG_MAX_AGGR_NUM, 0x0B);
+
+ return rtStatus;
+
+}
+
+/*-----------------------------------------------------------------------------
+* Function: phy_InitBBRFRegisterDefinition
+*
+* OverView: Initialize Register definition offset for Radio Path A/B/C/D
+*
+* Input:
+* PADAPTER Adapter,
+*
+* Output: None
+* Return: None
+* Note: The initialization value is constant and it should never be changes
+-----------------------------------------------------------------------------*/
+static VOID
+phy_InitBBRFRegisterDefinition(
+ IN PADAPTER Adapter
+)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+ // RF Interface Sowrtware Control
+ pHalData->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 LSBs if read 32-bit from 0x870
+ pHalData->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872)
+ pHalData->PHYRegDef[RF_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 LSBs if read 32-bit from 0x874
+ pHalData->PHYRegDef[RF_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 MSBs if read 32-bit from 0x874 (16-bit for 0x876)
+
+ // RF Interface Output (and Enable)
+ pHalData->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x860
+ pHalData->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x864
+
+ // RF Interface (Output and) Enable
+ pHalData->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862)
+ pHalData->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866)
+
+ //Addr of LSSI. Wirte RF register by driver
+ pHalData->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; //LSSI Parameter
+ pHalData->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter;
+
+ // Tranceiver A~D HSSI Parameter-2
+ pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; //wire control parameter2
+ pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; //wire control parameter2
+
+ // Tranceiver LSSI Readback SI mode
+ pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack;
+ pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack;
+ pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack;
+ pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack;
+
+ // Tranceiver LSSI Readback PI mode
+ pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback;
+ pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback;
+ //pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBackPi = rFPGA0_XC_LSSIReadBack;
+ //pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBackPi = rFPGA0_XD_LSSIReadBack;
+
+}
+
+VOID
+storePwrIndexDiffRateOffset(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+ if(RegAddr == rTxAGC_A_Rate18_06)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][0]-TxAGC_A_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0]);
+ }
+ if(RegAddr == rTxAGC_A_Rate54_24)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][1]-TxAGC_A_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1]);
+ }
+ if(RegAddr == rTxAGC_A_CCK1_Mcs32)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][6]-TxAGC_A_CCK1_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6]);
+ }
+ if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][7]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7]);
+ }
+ if(RegAddr == rTxAGC_A_Mcs03_Mcs00)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][2]-TxAGC_A_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2]);
+ }
+ if(RegAddr == rTxAGC_A_Mcs07_Mcs04)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][3]-TxAGC_A_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3]);
+ }
+ if(RegAddr == rTxAGC_A_Mcs11_Mcs08)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][4]-TxAGC_A_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4]);
+ }
+ if(RegAddr == rTxAGC_A_Mcs15_Mcs12)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][5]-TxAGC_A_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt,pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5]);
+ if(pHalData->rf_type== RF_1T1R)
+ {
+ //printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt);
+ pHalData->pwrGroupCnt++;
+ }
+ }
+ if(RegAddr == rTxAGC_B_Rate18_06)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][8]-TxAGC_B_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8]);
+ }
+ if(RegAddr == rTxAGC_B_Rate54_24)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][9]-TxAGC_B_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9]);
+ }
+ if(RegAddr == rTxAGC_B_CCK1_55_Mcs32)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][14]-TxAGC_B_CCK1_55_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14]);
+ }
+ if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][15]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15]);
+ }
+ if(RegAddr == rTxAGC_B_Mcs03_Mcs00)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][10]-TxAGC_B_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10]);
+ }
+ if(RegAddr == rTxAGC_B_Mcs07_Mcs04)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][11]-TxAGC_B_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11]);
+ }
+ if(RegAddr == rTxAGC_B_Mcs11_Mcs08)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][12]-TxAGC_B_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12]);
+ }
+ if(RegAddr == rTxAGC_B_Mcs15_Mcs12)
+ {
+ pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13] = Data;
+ //printk("MCSTxPowerLevelOriginalOffset[%d][13]-TxAGC_B_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt,
+ // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13]);
+
+ if(pHalData->rf_type != RF_1T1R)
+ {
+ //printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt);
+ pHalData->pwrGroupCnt++;
+ }
+ }
+}
+
+
+static VOID
+phy_BB8192C_Config_1T(
+ IN PADAPTER Adapter
+ )
+{
+#if 0
+ //for path - A
+ PHY_SetBBReg(Adapter, rFPGA0_TxInfo, 0x3, 0x1);
+ PHY_SetBBReg(Adapter, rFPGA1_TxInfo, 0x0303, 0x0101);
+ PHY_SetBBReg(Adapter, 0xe74, 0x0c000000, 0x1);
+ PHY_SetBBReg(Adapter, 0xe78, 0x0c000000, 0x1);
+ PHY_SetBBReg(Adapter, 0xe7c, 0x0c000000, 0x1);
+ PHY_SetBBReg(Adapter, 0xe80, 0x0c000000, 0x1);
+ PHY_SetBBReg(Adapter, 0xe88, 0x0c000000, 0x1);
+#endif
+ //for path - B
+ PHY_SetBBReg(Adapter, rFPGA0_TxInfo, 0x3, 0x2);
+ PHY_SetBBReg(Adapter, rFPGA1_TxInfo, 0x300033, 0x200022);
+
+ // 20100519 Joseph: Add for 1T2R config. Suggested by Kevin, Jenyu and Yunan.
+ PHY_SetBBReg(Adapter, rCCK0_AFESetting, bMaskByte3, 0x45);
+ PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, bMaskByte0, 0x23);
+ PHY_SetBBReg(Adapter, rOFDM0_AGCParameter1, 0x30, 0x1); // B path first AGC
+
+ PHY_SetBBReg(Adapter, 0xe74, 0x0c000000, 0x2);
+ PHY_SetBBReg(Adapter, 0xe78, 0x0c000000, 0x2);
+ PHY_SetBBReg(Adapter, 0xe7c, 0x0c000000, 0x2);
+ PHY_SetBBReg(Adapter, 0xe80, 0x0c000000, 0x2);
+ PHY_SetBBReg(Adapter, 0xe88, 0x0c000000, 0x2);
+
+
+}
+
+// Joseph test: new initialize order!!
+// Test only!! This part need to be re-organized.
+// Now it is just for 8256.
+static int
+phy_BB8190_Config_HardCode(
+ IN PADAPTER Adapter
+ )
+{
+ //RT_ASSERT(FALSE, ("This function is not implement yet!! \n"));
+ return _SUCCESS;
+}
+
+static int
+phy_BB8188E_Config_ParaFile(
+ IN PADAPTER Adapter
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ int rtStatus = _SUCCESS;
+
+ u8 sz8188EBBRegFile[] = RTL8188E_PHY_REG;
+ u8 sz8188EAGCTableFile[] = RTL8188E_AGC_TAB;
+ u8 sz8188EBBRegPgFile[] = RTL8188E_PHY_REG_PG;
+ u8 sz8188EBBRegMpFile[] = RTL8188E_PHY_REG_MP;
+ u8 sz8188EBBRegLimitFile[] = RTL8188E_TXPWR_LMT;
+
+ u8 *pszBBRegFile = NULL, *pszAGCTableFile = NULL, *pszBBRegPgFile = NULL, *pszBBRegMpFile=NULL,
+ *pszRFTxPwrLmtFile = NULL;
+
+
+ //RT_TRACE(COMP_INIT, DBG_TRACE, ("==>phy_BB8192S_Config_ParaFile\n"));
+
+ pszBBRegFile = sz8188EBBRegFile ;
+ pszAGCTableFile = sz8188EAGCTableFile;
+ pszBBRegPgFile = sz8188EBBRegPgFile;
+ pszBBRegMpFile = sz8188EBBRegMpFile;
+ pszRFTxPwrLmtFile = sz8188EBBRegLimitFile;
+
+ PHY_InitTxPowerLimit( Adapter );
+
+ if ( Adapter->registrypriv.RegEnableTxPowerLimit == 1 ||
+ ( Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1 ) )
+ {
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ if (PHY_ConfigRFWithPowerLimitTableParaFile( Adapter, pszRFTxPwrLmtFile )== _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ if (HAL_STATUS_SUCCESS != ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_TXPWR_LMT, (ODM_RF_RADIO_PATH_E)0))
+ rtStatus = _FAIL;
+#endif
+ }
+
+ if(rtStatus != _SUCCESS){
+ DBG_871X("phy_BB8188E_Config_ParaFile():Read Tx power limit fail!!\n");
+ goto phy_BB8190_Config_ParaFile_Fail;
+ }
+ }
+
+ //
+ // 1. Read PHY_REG.TXT BB INIT!!
+ //
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ if (phy_ConfigBBWithParaFile(Adapter, pszBBRegFile, CONFIG_BB_PHY_REG) == _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG))
+ rtStatus = _FAIL;
+#endif
+ }
+
+ if(rtStatus != _SUCCESS){
+ //RT_TRACE(COMP_INIT, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():Write BB Reg Fail!!"));
+ goto phy_BB8190_Config_ParaFile_Fail;
+ }
+
+#if (MP_DRIVER == 1)
+ //
+ // 1.1 Read PHY_REG_MP.TXT BB INIT!!
+ //
+ if (Adapter->registrypriv.mp_mode == 1) {
+ //3 Read PHY_REG.TXT BB INIT!!
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ if (phy_ConfigBBWithMpParaFile(Adapter, pszBBRegMpFile) == _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ if (HAL_STATUS_SUCCESS != ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_MP))
+ rtStatus = _FAIL;
+#endif
+ }
+
+ if(rtStatus != _SUCCESS){
+ DBG_871X("phy_BB8188E_Config_ParaFile():Write BB Reg MP Fail!!");
+ goto phy_BB8190_Config_ParaFile_Fail;
+ }
+ }
+#endif // #if (MP_DRIVER == 1)
+
+ //
+ // 2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt
+ //
+ PHY_InitTxPowerByRate( Adapter );
+ if ( ( Adapter->registrypriv.RegEnableTxPowerByRate == 1 ||
+ ( Adapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory != 2 ) ) )
+ {
+ pHalData->pwrGroupCnt = 0;
+
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ if (phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile) == _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG))
+ rtStatus = _FAIL;
+#endif
+ }
+
+ if ( pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE )
+ PHY_TxPowerByRateConfiguration(Adapter);
+
+ if ( Adapter->registrypriv.RegEnableTxPowerLimit == 1 ||
+ ( Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1 ) )
+ PHY_ConvertTxPowerLimitToPowerIndex( Adapter );
+
+ if(rtStatus != _SUCCESS){
+ DBG_871X("%s(): CONFIG_BB_PHY_REG_PG Fail!!\n",__FUNCTION__ );
+ goto phy_BB8190_Config_ParaFile_Fail;
+ }
+ }
+
+ //
+ // 3. BB AGC table Initialization
+ //
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ if (phy_ConfigBBWithParaFile(Adapter, pszAGCTableFile, CONFIG_BB_AGC_TAB) == _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB))
+ rtStatus = _FAIL;
+#endif
+ }
+
+ if(rtStatus != _SUCCESS){
+ //RT_TRACE(COMP_FPGA, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():AGC Table Fail\n"));
+ goto phy_BB8190_Config_ParaFile_Fail;
+ }
+
+
+phy_BB8190_Config_ParaFile_Fail:
+
+ return rtStatus;
+}
+
+
+int
+PHY_BBConfig8188E(
+ IN PADAPTER Adapter
+ )
+{
+ int rtStatus = _SUCCESS;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ u32 RegVal;
+ u8 TmpU1B=0;
+ u8 value8,CrystalCap;
+
+ phy_InitBBRFRegisterDefinition(Adapter);
+
+
+ // Enable BB and RF
+ RegVal = rtw_read16(Adapter, REG_SYS_FUNC_EN);
+ rtw_write16(Adapter, REG_SYS_FUNC_EN, (u16)(RegVal|BIT13|BIT0|BIT1));
+
+ // 20090923 Joseph: Advised by Steven and Jenyu. Power sequence before init RF.
+ //rtw_write8(Adapter, REG_AFE_PLL_CTRL, 0x83);
+ //rtw_write8(Adapter, REG_AFE_PLL_CTRL+1, 0xdb);
+
+ rtw_write8(Adapter, REG_RF_CTRL, RF_EN|RF_RSTB|RF_SDMRSTB);
+
+#ifdef CONFIG_USB_HCI
+ rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | FEN_BB_GLB_RSTn | FEN_BBRSTB);
+#else
+ rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_PPLL|FEN_PCIEA|FEN_DIO_PCIE|FEN_BB_GLB_RSTn|FEN_BBRSTB);
+#endif
+
+#if 0
+#ifdef CONFIG_USB_HCI
+ //To Fix MAC loopback mode fail. Suggested by SD4 Johnny. 2010.03.23.
+ rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x0f);
+ rtw_write8(Adapter, 0x15, 0xe9);
+#endif
+
+ rtw_write8(Adapter, REG_AFE_XTAL_CTRL+1, 0x80);
+#endif
+
+#ifdef CONFIG_USB_HCI
+ //rtw_write8(Adapter, 0x15, 0xe9);
+#endif
+
+
+#ifdef CONFIG_PCI_HCI
+ // Force use left antenna by default for 88C.
+ if(Adapter->ledpriv.LedStrategy != SW_LED_MODE10)
+ {
+ RegVal = rtw_read32(Adapter, REG_LEDCFG0);
+ rtw_write32(Adapter, REG_LEDCFG0, RegVal|BIT23);
+ }
+#endif
+
+ //
+ // Config BB and AGC
+ //
+ rtStatus = phy_BB8188E_Config_ParaFile(Adapter);
+
+ // write 0x24[16:11] = 0x24[22:17] = CrystalCap
+ CrystalCap = pHalData->CrystalCap & 0x3F;
+ PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, 0x7ff800, (CrystalCap | (CrystalCap << 6)));
+
+ return rtStatus;
+
+}
+
+
+int
+PHY_RFConfig8188E(
+ IN PADAPTER Adapter
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ int rtStatus = _SUCCESS;
+
+ //
+ // RF config
+ //
+ rtStatus = PHY_RF6052_Config8188E(Adapter);
+#if 0
+ switch(pHalData->rf_chip)
+ {
+ case RF_6052:
+ rtStatus = PHY_RF6052_Config(Adapter);
+ break;
+ case RF_8225:
+ rtStatus = PHY_RF8225_Config(Adapter);
+ break;
+ case RF_8256:
+ rtStatus = PHY_RF8256_Config(Adapter);
+ break;
+ case RF_8258:
+ break;
+ case RF_PSEUDO_11N:
+ rtStatus = PHY_RF8225_Config(Adapter);
+ break;
+ default: //for MacOs Warning: "RF_TYPE_MIN" not handled in switch
+ break;
+ }
+#endif
+ return rtStatus;
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Function: PHY_ConfigRFWithParaFile()
+ *
+ * Overview: This function read RF parameters from general file format, and do RF 3-wire
+ *
+ * Input: PADAPTER Adapter
+ * ps1Byte pFileName
+ * u8 eRFPath
+ *
+ * Output: NONE
+ *
+ * Return: RT_STATUS_SUCCESS: configuration file exist
+ *
+ * Note: Delay may be required for RF configuration
+ *---------------------------------------------------------------------------*/
+int
+rtl8188e_PHY_ConfigRFWithParaFile(
+ IN PADAPTER Adapter,
+ IN u8* pFileName,
+ IN u8 eRFPath
+)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+ int rtStatus = _SUCCESS;
+
+
+ return rtStatus;
+
+}
+
+//****************************************
+// The following is for High Power PA
+//****************************************
+#define HighPowerRadioAArrayLen 22
+//This is for High power PA
+u32 Rtl8192S_HighPower_RadioA_Array[HighPowerRadioAArrayLen] = {
+0x013,0x00029ea4,
+0x013,0x00025e74,
+0x013,0x00020ea4,
+0x013,0x0001ced0,
+0x013,0x00019f40,
+0x013,0x00014e70,
+0x013,0x000106a0,
+0x013,0x0000c670,
+0x013,0x000082a0,
+0x013,0x00004270,
+0x013,0x00000240,
+};
+
+//****************************************
+/*-----------------------------------------------------------------------------
+ * Function: GetTxPowerLevel8190()
+ *
+ * Overview: This function is export to "common" moudule
+ *
+ * Input: PADAPTER Adapter
+ * psByte Power Level
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ *---------------------------------------------------------------------------*/
+VOID
+PHY_GetTxPowerLevel8188E(
+ IN PADAPTER Adapter,
+ OUT s32* powerlevel
+ )
+{
+#if 0
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
+ s4Byte TxPwrDbm = 13;
+ RT_TRACE(COMP_TXAGC, DBG_LOUD, ("PHY_GetTxPowerLevel8188E(): TxPowerLevel: %#x\n", TxPwrDbm));
+
+ if ( pMgntInfo->ClientConfigPwrInDbm != UNSPECIFIED_PWR_DBM )
+ *powerlevel = pMgntInfo->ClientConfigPwrInDbm;
+ else
+ *powerlevel = TxPwrDbm;
+#endif
+}
+
+/*-----------------------------------------------------------------------------
+ * Function: SetTxPowerLevel8190()
+ *
+ * Overview: This function is export to "HalCommon" moudule
+ * We must consider RF path later!!!!!!!
+ *
+ * Input: PADAPTER Adapter
+ * u1Byte channel
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ * 2008/11/04 MHC We remove EEPROM_93C56.
+ * We need to move CCX relative code to independet file.
+ * 2009/01/21 MHC Support new EEPROM format from SD3 requirement.
+ *
+ *---------------------------------------------------------------------------*/
+VOID
+PHY_SetTxPowerLevel8188E(
+ IN PADAPTER Adapter,
+ IN u8 Channel
+ )
+{
+ //DBG_871X("==>PHY_SetTxPowerLevel8188E()\n");
+
+ PHY_SetTxPowerLevelByPath(Adapter, Channel, ODM_RF_PATH_A);
+
+ //DBG_871X("<==PHY_SetTxPowerLevel8188E()\n");
+}
+
+VOID
+PHY_SetTxPowerIndex_8188E(
+ IN PADAPTER Adapter,
+ IN u32 PowerIndex,
+ IN u8 RFPath,
+ IN u8 Rate
+ )
+{
+ if (RFPath == ODM_RF_PATH_A)
+ {
+ switch (Rate)
+ {
+ case MGN_1M: PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, PowerIndex); break;
+ case MGN_2M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte1, PowerIndex); break;
+ case MGN_5_5M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte2, PowerIndex); break;
+ case MGN_11M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte3, PowerIndex); break;
+
+ case MGN_6M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte0, PowerIndex); break;
+ case MGN_9M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte1, PowerIndex); break;
+ case MGN_12M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte2, PowerIndex); break;
+ case MGN_18M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte3, PowerIndex); break;
+
+ case MGN_24M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte0, PowerIndex); break;
+ case MGN_36M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte1, PowerIndex); break;
+ case MGN_48M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte2, PowerIndex); break;
+ case MGN_54M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte3, PowerIndex); break;
+
+ case MGN_MCS0: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte0, PowerIndex); break;
+ case MGN_MCS1: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte1, PowerIndex); break;
+ case MGN_MCS2: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte2, PowerIndex); break;
+ case MGN_MCS3: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte3, PowerIndex); break;
+
+ case MGN_MCS4: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte0, PowerIndex); break;
+ case MGN_MCS5: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte1, PowerIndex); break;
+ case MGN_MCS6: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte2, PowerIndex); break;
+ case MGN_MCS7: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte3, PowerIndex); break;
+
+ case MGN_MCS8: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskByte0, PowerIndex); break;
+ case MGN_MCS9: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskByte1, PowerIndex); break;
+ case MGN_MCS10: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskByte2, PowerIndex); break;
+ case MGN_MCS11: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskByte3, PowerIndex); break;
+
+ case MGN_MCS12: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskByte0, PowerIndex); break;
+ case MGN_MCS13: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskByte1, PowerIndex); break;
+ case MGN_MCS14: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskByte2, PowerIndex); break;
+ case MGN_MCS15: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskByte3, PowerIndex); break;
+
+ default:
+ DBG_871X("Invalid Rate!!\n");
+ break;
+ }
+ }
+ else if (RFPath == ODM_RF_PATH_B)
+ {
+ switch (Rate)
+ {
+ case MGN_1M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, bMaskByte1, PowerIndex); break;
+ case MGN_2M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, bMaskByte2, PowerIndex); break;
+ case MGN_5_5M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, bMaskByte3, PowerIndex); break;
+ case MGN_11M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte0, PowerIndex); break;
+
+ case MGN_6M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate18_06, bMaskByte0, PowerIndex); break;
+ case MGN_9M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate18_06, bMaskByte1, PowerIndex); break;
+ case MGN_12M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate18_06, bMaskByte2, PowerIndex); break;
+ case MGN_18M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate18_06, bMaskByte3, PowerIndex); break;
+
+ case MGN_24M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate54_24, bMaskByte0, PowerIndex); break;
+ case MGN_36M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate54_24, bMaskByte1, PowerIndex); break;
+ case MGN_48M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate54_24, bMaskByte2, PowerIndex); break;
+ case MGN_54M: PHY_SetBBReg(Adapter, rTxAGC_B_Rate54_24, bMaskByte3, PowerIndex); break;
+
+ case MGN_MCS0: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs03_Mcs00, bMaskByte0, PowerIndex); break;
+ case MGN_MCS1: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs03_Mcs00, bMaskByte1, PowerIndex); break;
+ case MGN_MCS2: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs03_Mcs00, bMaskByte2, PowerIndex); break;
+ case MGN_MCS3: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs03_Mcs00, bMaskByte3, PowerIndex); break;
+
+ case MGN_MCS4: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs07_Mcs04, bMaskByte0, PowerIndex); break;
+ case MGN_MCS5: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs07_Mcs04, bMaskByte1, PowerIndex); break;
+ case MGN_MCS6: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs07_Mcs04, bMaskByte2, PowerIndex); break;
+ case MGN_MCS7: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs07_Mcs04, bMaskByte3, PowerIndex); break;
+
+ case MGN_MCS8: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs11_Mcs08, bMaskByte0, PowerIndex); break;
+ case MGN_MCS9: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs11_Mcs08, bMaskByte1, PowerIndex); break;
+ case MGN_MCS10: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs11_Mcs08, bMaskByte2, PowerIndex); break;
+ case MGN_MCS11: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs11_Mcs08, bMaskByte3, PowerIndex); break;
+
+ case MGN_MCS12: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs15_Mcs12, bMaskByte0, PowerIndex); break;
+ case MGN_MCS13: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs15_Mcs12, bMaskByte1, PowerIndex); break;
+ case MGN_MCS14: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs15_Mcs12, bMaskByte2, PowerIndex); break;
+ case MGN_MCS15: PHY_SetBBReg(Adapter, rTxAGC_B_Mcs15_Mcs12, bMaskByte3, PowerIndex); break;
+
+ default:
+ DBG_871X("Invalid Rate!!\n");
+ break;
+ }
+ }
+ else
+ {
+ DBG_871X("Invalid RFPath!!\n");
+ }
+}
+
+u8
+phy_GetCurrentTxNum_8188E(
+ IN PADAPTER pAdapter,
+ IN u8 Rate
+ )
+{
+ u8 tmpByte = 0;
+ u32 tmpDWord = 0;
+ u8 TxNum = RF_TX_NUM_NONIMPLEMENT;
+
+ if ( ( Rate >= MGN_MCS8 && Rate <= MGN_MCS15 ) )
+ TxNum = RF_2TX;
+ else
+ TxNum = RF_1TX;
+
+ return TxNum;
+}
+
+s8 tx_power_extra_bias(
+ IN u8 RFPath,
+ IN u8 Rate,
+ IN CHANNEL_WIDTH BandWidth,
+ IN u8 Channel
+ )
+{
+ s8 bias = 0;
+
+ if (Rate == MGN_2M)
+ bias = -9;
+
+ return bias;
+}
+
+u8
+PHY_GetTxPowerIndex_8188E(
+ IN PADAPTER pAdapter,
+ IN u8 RFPath,
+ IN u8 Rate,
+ IN CHANNEL_WIDTH BandWidth,
+ IN u8 Channel
+ )
+{
+ PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+ u8 base_index = 0;
+ s8 by_rate_diff = 0, txPower = 0, limit = 0, track_diff = 0, extra_bias = 0;
+ u8 txNum = phy_GetCurrentTxNum_8188E(pAdapter, Rate);
+ BOOLEAN bIn24G = _FALSE;
+
+ base_index = PHY_GetTxPowerIndexBase(pAdapter,RFPath, Rate, BandWidth, Channel, &bIn24G);
+
+ by_rate_diff = PHY_GetTxPowerByRate(pAdapter, BAND_ON_2_4G, RFPath, txNum, Rate);
+ limit = PHY_GetTxPowerLimit(pAdapter, pAdapter->registrypriv.RegPwrTblSel, (u8)(!bIn24G), pHalData->CurrentChannelBW, RFPath, Rate, pHalData->CurrentChannel);
+ by_rate_diff = by_rate_diff > limit ? limit : by_rate_diff;
+
+ track_diff = PHY_GetTxPowerTrackingOffset(pAdapter, RFPath, Rate);
+
+ extra_bias = tx_power_extra_bias(RFPath, Rate, BandWidth, Channel);
+
+ txPower = base_index + by_rate_diff + track_diff + extra_bias;
+
+ if(txPower > MAX_POWER_INDEX)
+ txPower = MAX_POWER_INDEX;
+
+ if (0)
+ DBG_871X("RF-%c ch%d TxPwrIdx = %d(0x%X) [%2u %2d %2d %2d]\n"
+ , ((RFPath==0)?'A':'B'), Channel, txPower, txPower, base_index, by_rate_diff, track_diff, extra_bias);
+
+ return (u8)txPower;
+}
+
+//
+// Description:
+// Update transmit power level of all channel supported.
+//
+// TODO:
+// A mode.
+// By Bruce, 2008-02-04.
+//
+BOOLEAN
+PHY_UpdateTxPowerDbm8188E(
+ IN PADAPTER Adapter,
+ IN int powerInDbm
+ )
+{
+ return _TRUE;
+}
+
+VOID
+PHY_ScanOperationBackup8188E(
+ IN PADAPTER Adapter,
+ IN u8 Operation
+ )
+{
+#if 0
+ IO_TYPE IoType;
+
+ if(!Adapter->bDriverStopped)
+ {
+ switch(Operation)
+ {
+ case SCAN_OPT_BACKUP:
+ IoType = IO_CMD_PAUSE_DM_BY_SCAN;
+ rtw_hal_set_hwreg(Adapter,HW_VAR_IO_CMD, (pu1Byte)&IoType);
+
+ break;
+
+ case SCAN_OPT_RESTORE:
+ IoType = IO_CMD_RESUME_DM_BY_SCAN;
+ rtw_hal_set_hwreg(Adapter,HW_VAR_IO_CMD, (pu1Byte)&IoType);
+ break;
+
+ default:
+ RT_TRACE(COMP_SCAN, DBG_LOUD, ("Unknown Scan Backup Operation. \n"));
+ break;
+ }
+ }
+#endif
+}
+void
+phy_SpurCalibration_8188E(
+ IN PADAPTER Adapter
+ )
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+ //DbgPrint("===> phy_SpurCalibration_8188E CurrentChannelBW = %d, CurrentChannel = %d\n", 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), 0x2); //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), 0x2); //intf_TH
+ }
+ else{
+ if(Adapter->registrypriv.notch_filter == 0)
+ PHY_SetBBReg(Adapter, rOFDM0_RxDSP, BIT(9), 0x0); //disable notch filter
+ }
+}
+
+/*-----------------------------------------------------------------------------
+ * Function: PHY_SetBWModeCallback8192C()
+ *
+ * Overview: Timer callback function for SetSetBWMode
+ *
+ * Input: PRT_TIMER pTimer
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ * Note: (1) We do not take j mode into consideration now
+ * (2) Will two workitem of "switch channel" and "switch channel bandwidth" run
+ * concurrently?
+ *---------------------------------------------------------------------------*/
+static VOID
+_PHY_SetBWMode88E(
+ IN PADAPTER Adapter
+)
+{
+// PADAPTER Adapter = (PADAPTER)pTimer->Adapter;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ u8 regBwOpMode;
+ u8 regRRSR_RSC;
+
+ //return;
+
+ // Added it for 20/40 mhz switch time evaluation by guangan 070531
+ //u4Byte NowL, NowH;
+ //u8Byte BeginTime, EndTime;
+
+ /*RT_TRACE(COMP_SCAN, DBG_LOUD, ("==>PHY_SetBWModeCallback8192C() Switch to %s bandwidth\n", \
+ pHalData->CurrentChannelBW == CHANNEL_WIDTH_20?"20MHz":"40MHz"))*/
+
+ if(pHalData->rf_chip == RF_PSEUDO_11N)
+ {
+ //pHalData->SetBWModeInProgress= _FALSE;
+ return;
+ }
+
+ // There is no 40MHz mode in RF_8225.
+ if(pHalData->rf_chip==RF_8225)
+ return;
+
+ if(Adapter->bDriverStopped)
+ return;
+
+ // Added it for 20/40 mhz switch time evaluation by guangan 070531
+ //NowL = PlatformEFIORead4Byte(Adapter, TSFR);
+ //NowH = PlatformEFIORead4Byte(Adapter, TSFR+4);
+ //BeginTime = ((u8Byte)NowH << 32) + NowL;
+
+ //3//
+ //3//<1>Set MAC register
+ //3//
+ //Adapter->HalFunc.SetBWModeHandler();
+
+ regBwOpMode = rtw_read8(Adapter, REG_BWOPMODE);
+ regRRSR_RSC = rtw_read8(Adapter, REG_RRSR+2);
+ //regBwOpMode = rtw_hal_get_hwreg(Adapter,HW_VAR_BWMODE,(pu1Byte)&regBwOpMode);
+
+ switch(pHalData->CurrentChannelBW)
+ {
+ case CHANNEL_WIDTH_20:
+ regBwOpMode |= BW_OPMODE_20MHZ;
+ // 2007/02/07 Mark by Emily becasue we have not verify whether this register works
+ rtw_write8(Adapter, REG_BWOPMODE, regBwOpMode);
+ break;
+
+ case CHANNEL_WIDTH_40:
+ regBwOpMode &= ~BW_OPMODE_20MHZ;
+ // 2007/02/07 Mark by Emily becasue we have not verify whether this register works
+ rtw_write8(Adapter, REG_BWOPMODE, regBwOpMode);
+
+ regRRSR_RSC = (regRRSR_RSC&0x90) |(pHalData->nCur40MhzPrimeSC<<5);
+ rtw_write8(Adapter, REG_RRSR+2, regRRSR_RSC);
+ break;
+
+ default:
+ /*RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetBWModeCallback8192C():
+ unknown Bandwidth: %#X\n",pHalData->CurrentChannelBW));*/
+ break;
+ }
+
+ //3//
+ //3//<2>Set PHY related register
+ //3//
+ switch(pHalData->CurrentChannelBW)
+ {
+ /* 20 MHz channel*/
+ case CHANNEL_WIDTH_20:
+ PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x0);
+ PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x0);
+ //PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 1);
+
+ break;
+
+
+ /* 40 MHz channel*/
+ case CHANNEL_WIDTH_40:
+ PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x1);
+ PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x1);
+
+ // Set Control channel to upper or lower. These settings are required only for 40MHz
+ PHY_SetBBReg(Adapter, rCCK0_System, bCCKSideBand, (pHalData->nCur40MhzPrimeSC>>1));
+ PHY_SetBBReg(Adapter, rOFDM1_LSTF, 0xC00, pHalData->nCur40MhzPrimeSC);
+ //PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 0);
+
+ PHY_SetBBReg(Adapter, 0x818, (BIT26|BIT27), (pHalData->nCur40MhzPrimeSC==HAL_PRIME_CHNL_OFFSET_LOWER)?2:1);
+
+ break;
+
+
+
+ default:
+ /*RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetBWModeCallback8192C(): unknown Bandwidth: %#X\n"\
+ ,pHalData->CurrentChannelBW));*/
+ break;
+
+ }
+ //Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315
+
+ // Added it for 20/40 mhz switch time evaluation by guangan 070531
+ //NowL = PlatformEFIORead4Byte(Adapter, TSFR);
+ //NowH = PlatformEFIORead4Byte(Adapter, TSFR+4);
+ //EndTime = ((u8Byte)NowH << 32) + NowL;
+ //RT_TRACE(COMP_SCAN, DBG_LOUD, ("SetBWModeCallback8190Pci: time of SetBWMode = %I64d us!\n", (EndTime - BeginTime)));
+
+ //3<3>Set RF related register
+ switch(pHalData->rf_chip)
+ {
+ case RF_8225:
+ //PHY_SetRF8225Bandwidth(Adapter, pHalData->CurrentChannelBW);
+ break;
+
+ case RF_8256:
+ // Please implement this function in Hal8190PciPhy8256.c
+ //PHY_SetRF8256Bandwidth(Adapter, pHalData->CurrentChannelBW);
+ break;
+
+ case RF_8258:
+ // Please implement this function in Hal8190PciPhy8258.c
+ // PHY_SetRF8258Bandwidth();
+ break;
+
+ case RF_PSEUDO_11N:
+ // Do Nothing
+ break;
+
+ case RF_6052:
+ rtl8188e_PHY_RF6052SetBandwidth(Adapter, pHalData->CurrentChannelBW);
+ break;
+
+ default:
+ //RT_ASSERT(FALSE, ("Unknown RFChipID: %d\n", pHalData->RFChipID));
+ break;
+ }
+
+ //pHalData->SetBWModeInProgress= FALSE;
+
+ //RT_TRACE(COMP_SCAN, DBG_LOUD, ("<==PHY_SetBWModeCallback8192C() \n" ));
+}
+
+
+ /*-----------------------------------------------------------------------------
+ * Function: SetBWMode8190Pci()
+ *
+ * Overview: This function is export to "HalCommon" moudule
+ *
+ * Input: PADAPTER Adapter
+ * CHANNEL_WIDTH Bandwidth //20M or 40M
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ * Note: We do not take j mode into consideration now
+ *---------------------------------------------------------------------------*/
+VOID
+PHY_SetBWMode8188E(
+ IN PADAPTER Adapter,
+ IN CHANNEL_WIDTH Bandwidth, // 20M or 40M
+ IN unsigned char Offset // Upper, Lower, or Don't care
+)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ CHANNEL_WIDTH tmpBW= pHalData->CurrentChannelBW;
+ // Modified it for 20/40 mhz switch by guangan 070531
+ //PMGNT_INFO pMgntInfo=&Adapter->MgntInfo;
+
+ //return;
+
+ //if(pHalData->SwChnlInProgress)
+// if(pMgntInfo->bScanInProgress)
+// {
+// RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() %s Exit because bScanInProgress!\n",
+// Bandwidth == CHANNEL_WIDTH_20?"20MHz":"40MHz"));
+// return;
+// }
+
+// if(pHalData->SetBWModeInProgress)
+// {
+// // Modified it for 20/40 mhz switch by guangan 070531
+// RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() %s cancel last timer because SetBWModeInProgress!\n",
+// Bandwidth == CHANNEL_WIDTH_20?"20MHz":"40MHz"));
+// PlatformCancelTimer(Adapter, &pHalData->SetBWModeTimer);
+// //return;
+// }
+
+ //if(pHalData->SetBWModeInProgress)
+ // return;
+
+ //pHalData->SetBWModeInProgress= TRUE;
+
+ pHalData->CurrentChannelBW = Bandwidth;
+
+#if 0
+ if(Offset==EXTCHNL_OFFSET_LOWER)
+ pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER;
+ else if(Offset==EXTCHNL_OFFSET_UPPER)
+ pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER;
+ else
+ pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+#else
+ pHalData->nCur40MhzPrimeSC = Offset;
+#endif
+
+ if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved))
+ {
+ #if 0
+ //PlatformSetTimer(Adapter, &(pHalData->SetBWModeTimer), 0);
+ #else
+ _PHY_SetBWMode88E(Adapter);
+ #endif
+ #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)
+ if(IS_VENDOR_8188E_I_CUT_SERIES(Adapter))
+ phy_SpurCalibration_8188E( Adapter);
+ #endif
+ }
+ else
+ {
+ //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() SetBWModeInProgress FALSE driver sleep or unload\n"));
+ //pHalData->SetBWModeInProgress= FALSE;
+ pHalData->CurrentChannelBW = tmpBW;
+ }
+
+}
+
+
+static void _PHY_SwChnl8188E(PADAPTER Adapter, u8 channel)
+{
+ u8 eRFPath;
+ u32 param1, param2;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+ if ( Adapter->bNotifyChannelChange )
+ {
+ DBG_871X( "[%s] ch = %d\n", __FUNCTION__, channel );
+ }
+
+ //s1. pre common command - CmdID_SetTxPowerLevel
+ PHY_SetTxPowerLevel8188E(Adapter, channel);
+
+ //s2. RF dependent command - CmdID_RF_WriteReg, param1=RF_CHNLBW, param2=channel
+ param1 = RF_CHNLBW;
+ param2 = channel;
+ for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
+ {
+ pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2);
+ PHY_SetRFReg(Adapter, eRFPath, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]);
+ }
+
+
+ //s3. post common command - CmdID_End, None
+
+}
+VOID
+PHY_SwChnl8188E( // Call after initialization
+ IN PADAPTER Adapter,
+ IN u8 channel
+ )
+{
+ //PADAPTER Adapter = ADJUST_TO_ADAPTIVE_ADAPTER(pAdapter, _TRUE);
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ u8 tmpchannel = pHalData->CurrentChannel;
+ BOOLEAN bResult = _TRUE;
+
+ if(pHalData->rf_chip == RF_PSEUDO_11N)
+ {
+ //pHalData->SwChnlInProgress=FALSE;
+ return; //return immediately if it is peudo-phy
+ }
+
+ //if(pHalData->SwChnlInProgress)
+ // return;
+
+ //if(pHalData->SetBWModeInProgress)
+ // return;
+
+ while(pHalData->odmpriv.RFCalibrateInfo.bLCKInProgress) {
+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" bLCKInProgress\n", FUNC_ADPT_ARG(Adapter));
+ rtw_msleep_os(50);
+ }
+
+ //--------------------------------------------
+ switch(pHalData->CurrentWirelessMode)
+ {
+ case WIRELESS_MODE_A:
+ case WIRELESS_MODE_N_5G:
+ //RT_ASSERT((channel>14), ("WIRELESS_MODE_A but channel<=14"));
+ break;
+
+ case WIRELESS_MODE_B:
+ //RT_ASSERT((channel<=14), ("WIRELESS_MODE_B but channel>14"));
+ break;
+
+ case WIRELESS_MODE_G:
+ case WIRELESS_MODE_N_24G:
+ //RT_ASSERT((channel<=14), ("WIRELESS_MODE_G but channel>14"));
+ break;
+
+ default:
+ //RT_ASSERT(FALSE, ("Invalid WirelessMode(%#x)!!\n", pHalData->CurrentWirelessMode));
+ break;
+ }
+ //--------------------------------------------
+
+ //pHalData->SwChnlInProgress = TRUE;
+ if(channel == 0)
+ channel = 1;
+
+ pHalData->CurrentChannel=channel;
+
+ //pHalData->SwChnlStage=0;
+ //pHalData->SwChnlStep=0;
+
+ if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved))
+ {
+ #if 0
+ //PlatformSetTimer(Adapter, &(pHalData->SwChnlTimer), 0);
+ #else
+ _PHY_SwChnl8188E(Adapter, channel);
+ #endif
+
+ #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)
+ if(IS_VENDOR_8188E_I_CUT_SERIES(Adapter))
+ phy_SpurCalibration_8188E( Adapter);
+ #endif
+
+
+
+ if(bResult)
+ {
+ //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress TRUE schdule workitem done\n"));
+ }
+ else
+ {
+ //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress FALSE schdule workitem error\n"));
+ //if(IS_HARDWARE_TYPE_8192SU(Adapter))
+ //{
+ // pHalData->SwChnlInProgress = FALSE;
+ pHalData->CurrentChannel = tmpchannel;
+ //}
+ }
+
+ }
+ else
+ {
+ //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress FALSE driver sleep or unload\n"));
+ //if(IS_HARDWARE_TYPE_8192SU(Adapter))
+ //{
+ // pHalData->SwChnlInProgress = FALSE;
+ pHalData->CurrentChannel = tmpchannel;
+ //}
+ }
+}
+
+VOID
+PHY_SetSwChnlBWMode8188E(
+ IN PADAPTER Adapter,
+ IN u8 channel,
+ IN CHANNEL_WIDTH Bandwidth,
+ IN u8 Offset40,
+ IN u8 Offset80
+)
+{
+ //DBG_871X("%s()===>\n",__FUNCTION__);
+
+ PHY_SwChnl8188E(Adapter, channel);
+ PHY_SetBWMode8188E(Adapter, Bandwidth, Offset40);
+
+ //DBG_871X("<==%s()\n",__FUNCTION__);
+}
+
+
+//
+// Description:
+// Configure H/W functionality to enable/disable Monitor mode.
+// Note, because we possibly need to configure BB and RF in this function,
+// so caller should in PASSIVE_LEVEL. 080118, by rcnjko.
+//
+VOID
+PHY_SetMonitorMode8192C(
+ IN PADAPTER pAdapter,
+ IN BOOLEAN bEnableMonitorMode
+ )
+{
+#if 0
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ BOOLEAN bFilterOutNonAssociatedBSSID = FALSE;
+
+ //2 Note: we may need to stop antenna diversity.
+ if(bEnableMonitorMode)
+ {
+ bFilterOutNonAssociatedBSSID = FALSE;
+ RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8192S(): enable monitor mode\n"));
+
+ pHalData->bInMonitorMode = TRUE;
+ pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, TRUE, TRUE);
+ rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (pu1Byte)&bFilterOutNonAssociatedBSSID);
+ }
+ else
+ {
+ bFilterOutNonAssociatedBSSID = TRUE;
+ RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8192S(): disable monitor mode\n"));
+
+ pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, FALSE, TRUE);
+ pHalData->bInMonitorMode = FALSE;
+ rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (pu1Byte)&bFilterOutNonAssociatedBSSID);
+ }
+#endif
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Function: PHYCheckIsLegalRfPath8190Pci()
+ *
+ * Overview: Check different RF type to execute legal judgement. If RF Path is illegal
+ * We will return false.
+ *
+ * Input: NONE
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ * Revised History:
+ * When Who Remark
+ * 11/15/2007 MHC Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+BOOLEAN
+PHY_CheckIsLegalRfPath8192C(
+ IN PADAPTER pAdapter,
+ IN u32 eRFPath)
+{
+// HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
+ BOOLEAN rtValue = _TRUE;
+
+ // NOt check RF Path now.!
+#if 0
+ if (pHalData->RF_Type == RF_1T2R && eRFPath != RF_PATH_A)
+ {
+ rtValue = FALSE;
+ }
+ if (pHalData->RF_Type == RF_1T2R && eRFPath != RF_PATH_A)
+ {
+
+ }
+#endif
+ return rtValue;
+
+} /* PHY_CheckIsLegalRfPath8192C */
+
+static VOID _PHY_SetRFPathSwitch(
+ IN PADAPTER pAdapter,
+ IN BOOLEAN bMain,
+ IN BOOLEAN is2T
+ )
+{
+ u8 u1bTmp;
+
+ if(!pAdapter->hw_init_completed)
+ {
+ u1bTmp = rtw_read8(pAdapter, REG_LEDCFG2) | BIT7;
+ rtw_write8(pAdapter, REG_LEDCFG2, u1bTmp);
+ //PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01);
+ }
+
+ if(is2T)
+ {
+ if(bMain)
+ PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); //92C_Path_A
+ else
+ PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); //BT
+ }
+ else
+ {
+
+ if(bMain)
+ PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x2); //Main
+ else
+ PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x1); //Aux
+ }
+
+}
+
+//return value TRUE => Main; FALSE => Aux
+
+static BOOLEAN _PHY_QueryRFPathSwitch(
+ IN PADAPTER pAdapter,
+ IN BOOLEAN is2T
+ )
+{
+// if(is2T)
+// return _TRUE;
+
+ if(!pAdapter->hw_init_completed)
+ {
+ PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01);
+ PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01);
+ }
+
+ if(is2T)
+ {
+ if(PHY_QueryBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01)
+ return _TRUE;
+ else
+ return _FALSE;
+ }
+ else
+ {
+ if(PHY_QueryBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300) == 0x02)
+ return _TRUE;
+ else
+ return _FALSE;
+ }
+}
+
+
+static VOID
+_PHY_DumpRFReg(IN PADAPTER pAdapter)
+{
+ u32 rfRegValue,rfRegOffset;
+
+ //RTPRINT(FINIT, INIT_RF, ("PHY_DumpRFReg()====>\n"));
+
+ for(rfRegOffset = 0x00;rfRegOffset<=0x30;rfRegOffset++){
+ rfRegValue = PHY_QueryRFReg(pAdapter,RF_PATH_A, rfRegOffset, bMaskDWord);
+ //RTPRINT(FINIT, INIT_RF, (" 0x%02x = 0x%08x\n",rfRegOffset,rfRegValue));
+ }
+ //RTPRINT(FINIT, INIT_RF, ("<===== PHY_DumpRFReg()\n"));
+}
+
+
+//
+// Move from phycfg.c to gen.c to be code independent later
+//
+//-------------------------Move to other DIR later----------------------------*/
+#ifdef CONFIG_USB_HCI
+
+//
+// Description:
+// To dump all Tx FIFO LLT related link-list table.
+// Added by Roger, 2009.03.10.
+//
+VOID
+DumpBBDbgPort_92CU(
+ IN PADAPTER Adapter
+ )
+{
+
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("BaseBand Debug Ports:\n"));
+
+ PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0000);
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
+
+ PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0803);
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
+
+ PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0a06);
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
+
+ PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0007);
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
+
+ PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0100);
+ PHY_SetBBReg(Adapter, 0x0a28, 0x00ff0000, 0x000f0000);
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
+
+ PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0100);
+ PHY_SetBBReg(Adapter, 0x0a28, 0x00ff0000, 0x00150000);
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord)));
+
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0x800, PHY_QueryBBReg(Adapter, 0x0800, bMaskDWord)));
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0x900, PHY_QueryBBReg(Adapter, 0x0900, bMaskDWord)));
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa00, PHY_QueryBBReg(Adapter, 0x0a00, bMaskDWord)));
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa54, PHY_QueryBBReg(Adapter, 0x0a54, bMaskDWord)));
+ //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa58, PHY_QueryBBReg(Adapter, 0x0a58, bMaskDWord)));
+
+}
+#endif
+
diff --git a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_rf6052.c b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_rf6052.c
index 21897f5..aacb440 100755
--- a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_rf6052.c
+++ b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_rf6052.c
@@ -1,348 +1,348 @@
-/******************************************************************************
- *
- * 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
- *
- *
- ******************************************************************************/
-/******************************************************************************
- *
- *
- * Module: rtl8192c_rf6052.c ( Source C File)
- *
- * Note: Provide RF 6052 series relative API.
- *
- * Function:
- *
- * Export:
- *
- * Abbrev:
- *
- * History:
- * Data Who Remark
- *
- * 09/25/2008 MHC Create initial version.
- * 11/05/2008 MHC Add API for tw power setting.
- *
- *
-******************************************************************************/
-
-#define _RTL8188E_RF6052_C_
-
-#include <drv_types.h>
-#include <rtl8188e_hal.h>
-
-/*---------------------------Define Local Constant---------------------------*/
-
-/*---------------------------Define Local Constant---------------------------*/
-
-
-/*------------------------Define global variable-----------------------------*/
-/*------------------------Define global variable-----------------------------*/
-
-
-/*------------------------Define local variable------------------------------*/
-
-/*------------------------Define local variable------------------------------*/
-
-
-/*-----------------------------------------------------------------------------
- * Function: RF_ChangeTxPath
- *
- * Overview: For RL6052, we must change some RF settign for 1T or 2T.
- *
- * Input: u2Byte DataRate // 0x80-8f, 0x90-9f
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Revised History:
- * When Who Remark
- * 09/25/2008 MHC Create Version 0.
- * Firmwaer support the utility later.
- *
- *---------------------------------------------------------------------------*/
-void rtl8188e_RF_ChangeTxPath( IN PADAPTER Adapter,
- IN u16 DataRate)
-{
-// We do not support gain table change inACUT now !!!! Delete later !!!
-#if 0//(RTL92SE_FPGA_VERIFY == 0)
- static u1Byte RF_Path_Type = 2; // 1 = 1T 2= 2T
- static u4Byte tx_gain_tbl1[6]
- = {0x17f50, 0x11f40, 0x0cf30, 0x08720, 0x04310, 0x00100};
- static u4Byte tx_gain_tbl2[6]
- = {0x15ea0, 0x10e90, 0x0c680, 0x08250, 0x04040, 0x00030};
- u1Byte i;
-
- if (RF_Path_Type == 2 && (DataRate&0xF) <= 0x7)
- {
- // Set TX SYNC power G2G3 loop filter
- PHY_SetRFReg(Adapter, RF_PATH_A,
- RF_TXPA_G2, bRFRegOffsetMask, 0x0f000);
- PHY_SetRFReg(Adapter, RF_PATH_A,
- RF_TXPA_G3, bRFRegOffsetMask, 0xeacf1);
-
- // Change TX AGC gain table
- for (i = 0; i < 6; i++)
- PHY_SetRFReg(Adapter, RF_PATH_A,
- RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl1[i]);
-
- // Set PA to high value
- PHY_SetRFReg(Adapter, RF_PATH_A,
- RF_TXPA_G2, bRFRegOffsetMask, 0x01e39);
- }
- else if (RF_Path_Type == 1 && (DataRate&0xF) >= 0x8)
- {
- // Set TX SYNC power G2G3 loop filter
- PHY_SetRFReg(Adapter, RF_PATH_A,
- RF_TXPA_G2, bRFRegOffsetMask, 0x04440);
- PHY_SetRFReg(Adapter, RF_PATH_A,
- RF_TXPA_G3, bRFRegOffsetMask, 0xea4f1);
-
- // Change TX AGC gain table
- for (i = 0; i < 6; i++)
- PHY_SetRFReg(Adapter, RF_PATH_A,
- RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl2[i]);
-
- // Set PA low gain
- PHY_SetRFReg(Adapter, RF_PATH_A,
- RF_TXPA_G2, bRFRegOffsetMask, 0x01e19);
- }
-#endif
-
-} /* RF_ChangeTxPath */
-
-
-/*-----------------------------------------------------------------------------
- * Function: PHY_RF6052SetBandwidth()
- *
- * Overview: This function is called by SetBWModeCallback8190Pci() only
- *
- * Input: PADAPTER Adapter
- * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Note: For RF type 0222D
- *---------------------------------------------------------------------------*/
-VOID
-rtl8188e_PHY_RF6052SetBandwidth(
- IN PADAPTER Adapter,
- IN CHANNEL_WIDTH Bandwidth) //20M or 40M
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
- switch(Bandwidth)
- {
- case CHANNEL_WIDTH_20:
- pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT(10) | BIT(11));
- PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]);
- break;
-
- case CHANNEL_WIDTH_40:
- pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff)| BIT(10));
- PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]);
- break;
-
- default:
- //RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth ));
- break;
- }
-
-}
-
-static int
-phy_RF6052_Config_ParaFile(
- IN PADAPTER Adapter
- )
-{
- u32 u4RegValue=0;
- u8 eRFPath;
- BB_REGISTER_DEFINITION_T *pPhyReg;
-
- int rtStatus = _SUCCESS;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
- static char sz88eRadioAFile[] = RTL8188E_PHY_RADIO_A;
- static char sz88eRadioBFile[] = RTL8188E_PHY_RADIO_B;
- static char sz8188ETxPwrTrack[] = RTL8188E_TXPWR_TRACK;
- char *pszRadioAFile, *pszRadioBFile, *pszTxPwrTrack;
-
-
- pszRadioAFile = sz88eRadioAFile;
- pszRadioBFile = sz88eRadioBFile;
- pszTxPwrTrack = sz8188ETxPwrTrack;
-
- //3//-----------------------------------------------------------------
- //3// <2> Initialize RF
- //3//-----------------------------------------------------------------
- //for(eRFPath = RF_PATH_A; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
- for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
- {
-
- pPhyReg = &pHalData->PHYRegDef[eRFPath];
-
- /*----Store original RFENV control type----*/
- switch(eRFPath)
- {
- case RF_PATH_A:
- case RF_PATH_C:
- u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV);
- break;
- case RF_PATH_B :
- case RF_PATH_D:
- u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16);
- break;
- }
-
- /*----Set RF_ENV enable----*/
- PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1);
- rtw_udelay_os(1);//PlatformStallExecution(1);
-
- /*----Set RF_ENV output high----*/
- PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1);
- rtw_udelay_os(1);//PlatformStallExecution(1);
-
- /* Set bit number of Address and Data for RF register */
- PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); // Set 1 to 4 bits for 8255
- rtw_udelay_os(1);//PlatformStallExecution(1);
-
- PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); // Set 0 to 12 bits for 8255
- rtw_udelay_os(1);//PlatformStallExecution(1);
-
- /*----Initialize RF fom connfiguration file----*/
- switch(eRFPath)
- {
- case RF_PATH_A:
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- if (PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, eRFPath) == _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath))
- rtStatus= _FAIL;
-#endif
- }
- break;
- case RF_PATH_B:
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- if (PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, eRFPath) == _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath))
- rtStatus= _FAIL;
-#endif
- }
- break;
- case RF_PATH_C:
- break;
- case RF_PATH_D:
- break;
- }
-
- /*----Restore RFENV control type----*/;
- switch(eRFPath)
- {
- case RF_PATH_A:
- case RF_PATH_C:
- PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue);
- break;
- case RF_PATH_B :
- case RF_PATH_D:
- PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue);
- break;
- }
-
- if(rtStatus != _SUCCESS){
- //RT_TRACE(COMP_FPGA, DBG_LOUD, ("phy_RF6052_Config_ParaFile():Radio[%d] Fail!!", eRFPath));
- goto phy_RF6052_Config_ParaFile_Fail;
- }
-
- }
-
-
- //3 -----------------------------------------------------------------
- //3 Configuration of Tx Power Tracking
- //3 -----------------------------------------------------------------
-
-#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
- if (PHY_ConfigRFWithTxPwrTrackParaFile(Adapter, pszTxPwrTrack) == _FAIL)
-#endif
- {
-#ifdef CONFIG_EMBEDDED_FWIMG
- ODM_ConfigRFWithTxPwrTrackHeaderFile(&pHalData->odmpriv);
-#endif
- }
-
- //RT_TRACE(COMP_INIT, DBG_LOUD, ("<---phy_RF6052_Config_ParaFile()\n"));
- return rtStatus;
-
-phy_RF6052_Config_ParaFile_Fail:
- return rtStatus;
-}
-
-
-int
-PHY_RF6052_Config8188E(
- IN PADAPTER Adapter)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- int rtStatus = _SUCCESS;
-
- //
- // Initialize general global value
- //
- // TODO: Extend RF_PATH_C and RF_PATH_D in the future
- if(pHalData->rf_type == RF_1T1R)
- pHalData->NumTotalRFPath = 1;
- else
- pHalData->NumTotalRFPath = 2;
-
- //
- // Config BB and RF
- //
- rtStatus = phy_RF6052_Config_ParaFile(Adapter);
-#if 0
- switch( Adapter->MgntInfo.bRegHwParaFile )
- {
- case 0:
- phy_RF6052_Config_HardCode(Adapter);
- break;
-
- case 1:
- rtStatus = phy_RF6052_Config_ParaFile(Adapter);
- break;
-
- case 2:
- // Partial Modify.
- phy_RF6052_Config_HardCode(Adapter);
- phy_RF6052_Config_ParaFile(Adapter);
- break;
-
- default:
- phy_RF6052_Config_HardCode(Adapter);
- break;
- }
-#endif
- return rtStatus;
-
-}
-
-/* End of HalRf6052.c */
-
+/******************************************************************************
+ *
+ * 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
+ *
+ *
+ ******************************************************************************/
+/******************************************************************************
+ *
+ *
+ * Module: rtl8192c_rf6052.c ( Source C File)
+ *
+ * Note: Provide RF 6052 series relative API.
+ *
+ * Function:
+ *
+ * Export:
+ *
+ * Abbrev:
+ *
+ * History:
+ * Data Who Remark
+ *
+ * 09/25/2008 MHC Create initial version.
+ * 11/05/2008 MHC Add API for tw power setting.
+ *
+ *
+******************************************************************************/
+
+#define _RTL8188E_RF6052_C_
+
+#include <drv_types.h>
+#include <rtl8188e_hal.h>
+
+/*---------------------------Define Local Constant---------------------------*/
+
+/*---------------------------Define Local Constant---------------------------*/
+
+
+/*------------------------Define global variable-----------------------------*/
+/*------------------------Define global variable-----------------------------*/
+
+
+/*------------------------Define local variable------------------------------*/
+
+/*------------------------Define local variable------------------------------*/
+
+
+/*-----------------------------------------------------------------------------
+ * Function: RF_ChangeTxPath
+ *
+ * Overview: For RL6052, we must change some RF settign for 1T or 2T.
+ *
+ * Input: u2Byte DataRate // 0x80-8f, 0x90-9f
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ * Revised History:
+ * When Who Remark
+ * 09/25/2008 MHC Create Version 0.
+ * Firmwaer support the utility later.
+ *
+ *---------------------------------------------------------------------------*/
+void rtl8188e_RF_ChangeTxPath( IN PADAPTER Adapter,
+ IN u16 DataRate)
+{
+// We do not support gain table change inACUT now !!!! Delete later !!!
+#if 0//(RTL92SE_FPGA_VERIFY == 0)
+ static u1Byte RF_Path_Type = 2; // 1 = 1T 2= 2T
+ static u4Byte tx_gain_tbl1[6]
+ = {0x17f50, 0x11f40, 0x0cf30, 0x08720, 0x04310, 0x00100};
+ static u4Byte tx_gain_tbl2[6]
+ = {0x15ea0, 0x10e90, 0x0c680, 0x08250, 0x04040, 0x00030};
+ u1Byte i;
+
+ if (RF_Path_Type == 2 && (DataRate&0xF) <= 0x7)
+ {
+ // Set TX SYNC power G2G3 loop filter
+ PHY_SetRFReg(Adapter, RF_PATH_A,
+ RF_TXPA_G2, bRFRegOffsetMask, 0x0f000);
+ PHY_SetRFReg(Adapter, RF_PATH_A,
+ RF_TXPA_G3, bRFRegOffsetMask, 0xeacf1);
+
+ // Change TX AGC gain table
+ for (i = 0; i < 6; i++)
+ PHY_SetRFReg(Adapter, RF_PATH_A,
+ RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl1[i]);
+
+ // Set PA to high value
+ PHY_SetRFReg(Adapter, RF_PATH_A,
+ RF_TXPA_G2, bRFRegOffsetMask, 0x01e39);
+ }
+ else if (RF_Path_Type == 1 && (DataRate&0xF) >= 0x8)
+ {
+ // Set TX SYNC power G2G3 loop filter
+ PHY_SetRFReg(Adapter, RF_PATH_A,
+ RF_TXPA_G2, bRFRegOffsetMask, 0x04440);
+ PHY_SetRFReg(Adapter, RF_PATH_A,
+ RF_TXPA_G3, bRFRegOffsetMask, 0xea4f1);
+
+ // Change TX AGC gain table
+ for (i = 0; i < 6; i++)
+ PHY_SetRFReg(Adapter, RF_PATH_A,
+ RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl2[i]);
+
+ // Set PA low gain
+ PHY_SetRFReg(Adapter, RF_PATH_A,
+ RF_TXPA_G2, bRFRegOffsetMask, 0x01e19);
+ }
+#endif
+
+} /* RF_ChangeTxPath */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: PHY_RF6052SetBandwidth()
+ *
+ * Overview: This function is called by SetBWModeCallback8190Pci() only
+ *
+ * Input: PADAPTER Adapter
+ * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M
+ *
+ * Output: NONE
+ *
+ * Return: NONE
+ *
+ * Note: For RF type 0222D
+ *---------------------------------------------------------------------------*/
+VOID
+rtl8188e_PHY_RF6052SetBandwidth(
+ IN PADAPTER Adapter,
+ IN CHANNEL_WIDTH Bandwidth) //20M or 40M
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+ switch(Bandwidth)
+ {
+ case CHANNEL_WIDTH_20:
+ pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT(10) | BIT(11));
+ PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]);
+ break;
+
+ case CHANNEL_WIDTH_40:
+ pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff)| BIT(10));
+ PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]);
+ break;
+
+ default:
+ //RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth ));
+ break;
+ }
+
+}
+
+static int
+phy_RF6052_Config_ParaFile(
+ IN PADAPTER Adapter
+ )
+{
+ u32 u4RegValue=0;
+ u8 eRFPath;
+ BB_REGISTER_DEFINITION_T *pPhyReg;
+
+ int rtStatus = _SUCCESS;
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+
+ static char sz88eRadioAFile[] = RTL8188E_PHY_RADIO_A;
+ static char sz88eRadioBFile[] = RTL8188E_PHY_RADIO_B;
+ static char sz8188ETxPwrTrack[] = RTL8188E_TXPWR_TRACK;
+ char *pszRadioAFile, *pszRadioBFile, *pszTxPwrTrack;
+
+
+ pszRadioAFile = sz88eRadioAFile;
+ pszRadioBFile = sz88eRadioBFile;
+ pszTxPwrTrack = sz8188ETxPwrTrack;
+
+ //3//-----------------------------------------------------------------
+ //3// <2> Initialize RF
+ //3//-----------------------------------------------------------------
+ //for(eRFPath = RF_PATH_A; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
+ for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
+ {
+
+ pPhyReg = &pHalData->PHYRegDef[eRFPath];
+
+ /*----Store original RFENV control type----*/
+ switch(eRFPath)
+ {
+ case RF_PATH_A:
+ case RF_PATH_C:
+ u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV);
+ break;
+ case RF_PATH_B :
+ case RF_PATH_D:
+ u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16);
+ break;
+ }
+
+ /*----Set RF_ENV enable----*/
+ PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1);
+ rtw_udelay_os(1);//PlatformStallExecution(1);
+
+ /*----Set RF_ENV output high----*/
+ PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1);
+ rtw_udelay_os(1);//PlatformStallExecution(1);
+
+ /* Set bit number of Address and Data for RF register */
+ PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); // Set 1 to 4 bits for 8255
+ rtw_udelay_os(1);//PlatformStallExecution(1);
+
+ PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); // Set 0 to 12 bits for 8255
+ rtw_udelay_os(1);//PlatformStallExecution(1);
+
+ /*----Initialize RF fom connfiguration file----*/
+ switch(eRFPath)
+ {
+ case RF_PATH_A:
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ if (PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, eRFPath) == _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath))
+ rtStatus= _FAIL;
+#endif
+ }
+ break;
+ case RF_PATH_B:
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ if (PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, eRFPath) == _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath))
+ rtStatus= _FAIL;
+#endif
+ }
+ break;
+ case RF_PATH_C:
+ break;
+ case RF_PATH_D:
+ break;
+ }
+
+ /*----Restore RFENV control type----*/;
+ switch(eRFPath)
+ {
+ case RF_PATH_A:
+ case RF_PATH_C:
+ PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue);
+ break;
+ case RF_PATH_B :
+ case RF_PATH_D:
+ PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue);
+ break;
+ }
+
+ if(rtStatus != _SUCCESS){
+ //RT_TRACE(COMP_FPGA, DBG_LOUD, ("phy_RF6052_Config_ParaFile():Radio[%d] Fail!!", eRFPath));
+ goto phy_RF6052_Config_ParaFile_Fail;
+ }
+
+ }
+
+
+ //3 -----------------------------------------------------------------
+ //3 Configuration of Tx Power Tracking
+ //3 -----------------------------------------------------------------
+
+#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
+ if (PHY_ConfigRFWithTxPwrTrackParaFile(Adapter, pszTxPwrTrack) == _FAIL)
+#endif
+ {
+#ifdef CONFIG_EMBEDDED_FWIMG
+ ODM_ConfigRFWithTxPwrTrackHeaderFile(&pHalData->odmpriv);
+#endif
+ }
+
+ //RT_TRACE(COMP_INIT, DBG_LOUD, ("<---phy_RF6052_Config_ParaFile()\n"));
+ return rtStatus;
+
+phy_RF6052_Config_ParaFile_Fail:
+ return rtStatus;
+}
+
+
+int
+PHY_RF6052_Config8188E(
+ IN PADAPTER Adapter)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
+ int rtStatus = _SUCCESS;
+
+ //
+ // Initialize general global value
+ //
+ // TODO: Extend RF_PATH_C and RF_PATH_D in the future
+ if(pHalData->rf_type == RF_1T1R)
+ pHalData->NumTotalRFPath = 1;
+ else
+ pHalData->NumTotalRFPath = 2;
+
+ //
+ // Config BB and RF
+ //
+ rtStatus = phy_RF6052_Config_ParaFile(Adapter);
+#if 0
+ switch( Adapter->MgntInfo.bRegHwParaFile )
+ {
+ case 0:
+ phy_RF6052_Config_HardCode(Adapter);
+ break;
+
+ case 1:
+ rtStatus = phy_RF6052_Config_ParaFile(Adapter);
+ break;
+
+ case 2:
+ // Partial Modify.
+ phy_RF6052_Config_HardCode(Adapter);
+ phy_RF6052_Config_ParaFile(Adapter);
+ break;
+
+ default:
+ phy_RF6052_Config_HardCode(Adapter);
+ break;
+ }
+#endif
+ return rtStatus;
+
+}
+
+/* End of HalRf6052.c */
+
diff --git a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_rxdesc.c b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_rxdesc.c
index 0039b76..98305e2 100755
--- a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_rxdesc.c
+++ b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_rxdesc.c
@@ -22,19 +22,6 @@
#include <drv_types.h>
#include <rtl8188e_hal.h>
-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;
@@ -77,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));
@@ -276,7 +263,7 @@ void update_recvframe_phyinfo_88e(
ODM_PACKET_INFO_T pkt_info;
u8 *sa = NULL;
struct sta_priv *pstapriv;
- struct sta_info *psta;
+ struct sta_info *psta = NULL;
//_irqL irqL;
pkt_info.bPacketMatchBSSID =_FALSE;
@@ -315,15 +302,23 @@ void update_recvframe_phyinfo_88e(
}
*/
sa = get_ta(wlanhdr);
-
- pstapriv = &padapter->stapriv;
+
pkt_info.StationID = 0xFF;
- psta = rtw_get_stainfo(pstapriv, sa);
- if (psta)
- {
- pkt_info.StationID = psta->mac_id;
- //DBG_8192C("%s ==> StationID(%d)\n",__FUNCTION__,pkt_info.StationID);
- }
+
+ if (_rtw_memcmp(myid(&padapter->eeprompriv), sa, ETH_ALEN) == _TRUE) {
+ static u32 start_time = 0;
+
+ if ((start_time == 0) || (rtw_get_passing_time_ms(start_time) > 5000)) {
+ DBG_871X_LEVEL(_drv_always_, "Warning!!! %s: Confilc mac addr!!\n", __func__);
+ start_time = rtw_get_current_time();
+ }
+ } else {
+ pstapriv = &padapter->stapriv;
+ psta = rtw_get_stainfo(pstapriv, sa);
+ if (psta)
+ pkt_info.StationID = psta->mac_id;
+ }
+
pkt_info.DataRate = pattrib->data_rate;
//rtl8188e_query_rx_phy_status(precvframe, pphy_status);
diff --git a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_sreset.c b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_sreset.c
index a76668d..bbf5984 100755
--- a/rtl8xxx_EU/hal/rtl8188e/rtl8188e_sreset.c
+++ b/rtl8xxx_EU/hal/rtl8188e/rtl8188e_sreset.c
@@ -1,125 +1,125 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#define _RTL8188E_SRESET_C_
-
-//#include <rtl8188e_sreset.h>
-#include <rtl8188e_hal.h>
-
-#ifdef DBG_CONFIG_ERROR_DETECT
-
-void rtl8188e_sreset_xmit_status_check(_adapter *padapter)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- struct sreset_priv *psrtpriv = &pHalData->srestpriv;
-
- unsigned long current_time;
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- unsigned int diff_time;
- u32 txdma_status;
-
- if( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){
- DBG_871X("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status);
- rtw_hal_sreset_reset(padapter);
- }
-#ifdef CONFIG_USB_HCI
- //total xmit irp = 4
- //DBG_8192C("==>%s free_xmitbuf_cnt(%d),txirp_cnt(%d)\n",__FUNCTION__,pxmitpriv->free_xmitbuf_cnt,pxmitpriv->txirp_cnt);
- //if(pxmitpriv->txirp_cnt == NR_XMITBUFF+1)
- current_time = rtw_get_current_time();
-
- if(0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {
-
- diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_time);
-
- if (diff_time > 2000) {
- if (psrtpriv->last_tx_complete_time == 0) {
- psrtpriv->last_tx_complete_time = current_time;
- }
- else{
- diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_complete_time);
- if (diff_time > 4000) {
- u32 ability;
-
- //padapter->Wifi_Error_Status = WIFI_TX_HANG;
- rtw_hal_get_hwreg(padapter, HW_VAR_DM_FLAG, (u8*)&ability);
-
- DBG_871X("%s tx hang %s\n", __FUNCTION__,
- (ability & ODM_BB_ADAPTIVITY)? "ODM_BB_ADAPTIVITY" : "");
-
- if (!(ability & ODM_BB_ADAPTIVITY))
- rtw_hal_sreset_reset(padapter);
- }
- }
- }
- }
-#endif //CONFIG_USB_HCI
-
- if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) {
- psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
- rtw_hal_sreset_reset(padapter);
- return;
- }
-}
-
-void rtl8188e_sreset_linked_status_check(_adapter *padapter)
-{
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- struct sreset_priv *psrtpriv = &pHalData->srestpriv;
-
- u32 rx_dma_status = 0;
- u8 fw_status=0;
- rx_dma_status = rtw_read32(padapter,REG_RXDMA_STATUS);
- if(rx_dma_status!= 0x00){
- DBG_8192C("%s REG_RXDMA_STATUS:0x%08x \n",__FUNCTION__,rx_dma_status);
- rtw_write32(padapter,REG_RXDMA_STATUS,rx_dma_status);
- }
- fw_status = rtw_read8(padapter,REG_FMETHR);
- if(fw_status != 0x00)
- {
- if(fw_status == 1)
- DBG_8192C("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !! \n",__FUNCTION__,fw_status);
- else if(fw_status == 2)
- DBG_8192C("%s REG_FW_STATUS (0x%02x), Condition_No_Match !! \n",__FUNCTION__,fw_status);
- }
-#if 0
- u32 regc50,regc58,reg824,reg800;
- regc50 = rtw_read32(padapter,0xc50);
- regc58 = rtw_read32(padapter,0xc58);
- reg824 = rtw_read32(padapter,0x824);
- reg800 = rtw_read32(padapter,0x800);
- if( ((regc50&0xFFFFFF00)!= 0x69543400)||
- ((regc58&0xFFFFFF00)!= 0x69543400)||
- (((reg824&0xFFFFFF00)!= 0x00390000)&&(((reg824&0xFFFFFF00)!= 0x80390000)))||
- ( ((reg800&0xFFFFFF00)!= 0x03040000)&&((reg800&0xFFFFFF00)!= 0x83040000)))
- {
- DBG_8192C("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__,
- regc50, regc58, reg824, reg800);
- rtw_hal_sreset_reset(padapter);
- }
-#endif
-
- if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) {
- psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
- rtw_hal_sreset_reset(padapter);
- return;
- }
-}
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTL8188E_SRESET_C_
+
+//#include <rtl8188e_sreset.h>
+#include <rtl8188e_hal.h>
+
+#ifdef DBG_CONFIG_ERROR_DETECT
+
+void rtl8188e_sreset_xmit_status_check(_adapter *padapter)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ struct sreset_priv *psrtpriv = &pHalData->srestpriv;
+
+ unsigned long current_time;
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+ unsigned int diff_time;
+ u32 txdma_status;
+
+ if( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){
+ DBG_871X("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status);
+ rtw_hal_sreset_reset(padapter);
+ }
+#ifdef CONFIG_USB_HCI
+ //total xmit irp = 4
+ //DBG_8192C("==>%s free_xmitbuf_cnt(%d),txirp_cnt(%d)\n",__FUNCTION__,pxmitpriv->free_xmitbuf_cnt,pxmitpriv->txirp_cnt);
+ //if(pxmitpriv->txirp_cnt == NR_XMITBUFF+1)
+ current_time = rtw_get_current_time();
+
+ if(0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {
+
+ diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_time);
+
+ if (diff_time > 2000) {
+ if (psrtpriv->last_tx_complete_time == 0) {
+ psrtpriv->last_tx_complete_time = current_time;
+ }
+ else{
+ diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_complete_time);
+ if (diff_time > 4000) {
+ u32 ability;
+
+ //padapter->Wifi_Error_Status = WIFI_TX_HANG;
+ rtw_hal_get_hwreg(padapter, HW_VAR_DM_FLAG, (u8*)&ability);
+
+ DBG_871X("%s tx hang %s\n", __FUNCTION__,
+ (ability & ODM_BB_ADAPTIVITY)? "ODM_BB_ADAPTIVITY" : "");
+
+ if (!(ability & ODM_BB_ADAPTIVITY))
+ rtw_hal_sreset_reset(padapter);
+ }
+ }
+ }
+ }
+#endif //CONFIG_USB_HCI
+
+ if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) {
+ psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
+ rtw_hal_sreset_reset(padapter);
+ return;
+ }
+}
+
+void rtl8188e_sreset_linked_status_check(_adapter *padapter)
+{
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ struct sreset_priv *psrtpriv = &pHalData->srestpriv;
+
+ u32 rx_dma_status = 0;
+ u8 fw_status=0;
+ rx_dma_status = rtw_read32(padapter,REG_RXDMA_STATUS);
+ if(rx_dma_status!= 0x00){
+ DBG_8192C("%s REG_RXDMA_STATUS:0x%08x \n",__FUNCTION__,rx_dma_status);
+ rtw_write32(padapter,REG_RXDMA_STATUS,rx_dma_status);
+ }
+ fw_status = rtw_read8(padapter,REG_FMETHR);
+ if(fw_status != 0x00)
+ {
+ if(fw_status == 1)
+ DBG_8192C("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !! \n",__FUNCTION__,fw_status);
+ else if(fw_status == 2)
+ DBG_8192C("%s REG_FW_STATUS (0x%02x), Condition_No_Match !! \n",__FUNCTION__,fw_status);
+ }
+#if 0
+ u32 regc50,regc58,reg824,reg800;
+ regc50 = rtw_read32(padapter,0xc50);
+ regc58 = rtw_read32(padapter,0xc58);
+ reg824 = rtw_read32(padapter,0x824);
+ reg800 = rtw_read32(padapter,0x800);
+ if( ((regc50&0xFFFFFF00)!= 0x69543400)||
+ ((regc58&0xFFFFFF00)!= 0x69543400)||
+ (((reg824&0xFFFFFF00)!= 0x00390000)&&(((reg824&0xFFFFFF00)!= 0x80390000)))||
+ ( ((reg800&0xFFFFFF00)!= 0x03040000)&&((reg800&0xFFFFFF00)!= 0x83040000)))
+ {
+ DBG_8192C("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__,
+ regc50, regc58, reg824, reg800);
+ rtw_hal_sreset_reset(padapter);
+ }
+#endif
+
+ if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) {
+ psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
+ rtw_hal_sreset_reset(padapter);
+ return;
+ }
+}
+#endif
+
diff --git a/rtl8xxx_EU/hal/rtl8188e/usb/usb_halinit.c b/rtl8xxx_EU/hal/rtl8188e/usb/usb_halinit.c
index cae9318..366b4bd 100644..100755
--- a/rtl8xxx_EU/hal/rtl8188e/usb/usb_halinit.c
+++ b/rtl8xxx_EU/hal/rtl8188e/usb/usb_halinit.c
@@ -367,27 +367,27 @@ _InitQueueReservedPage(
if(bWiFiConfig || pregistrypriv->qos_opt_enable)
{
- if (pHalData->OutEpQueueSel & TX_SELE_HQ)
- numHQ = WMM_NORMAL_PAGE_NUM_HPQ_88E;
+ if (pHalData->OutEpQueueSel & TX_SELE_HQ)
+ numHQ = WMM_NORMAL_PAGE_NUM_HPQ_88E;
- if (pHalData->OutEpQueueSel & TX_SELE_LQ)
- numLQ = WMM_NORMAL_PAGE_NUM_LPQ_88E;
+ if (pHalData->OutEpQueueSel & TX_SELE_LQ)
+ numLQ = WMM_NORMAL_PAGE_NUM_LPQ_88E;
// NOTE: This step shall be proceed before writting REG_RQPN.
- if (pHalData->OutEpQueueSel & TX_SELE_NQ)
- numNQ = WMM_NORMAL_PAGE_NUM_NPQ_88E;
+ if (pHalData->OutEpQueueSel & TX_SELE_NQ)
+ numNQ = WMM_NORMAL_PAGE_NUM_NPQ_88E;
}
else
- {
- if(pHalData->OutEpQueueSel & TX_SELE_HQ)
- numHQ = NORMAL_PAGE_NUM_HPQ_88E;
-
+ {
+ if(pHalData->OutEpQueueSel & TX_SELE_HQ)
+ numHQ = NORMAL_PAGE_NUM_HPQ_88E;
+
if(pHalData->OutEpQueueSel & TX_SELE_LQ)
numLQ = NORMAL_PAGE_NUM_LPQ_88E;
-
- // NOTE: This step shall be proceed before writting REG_RQPN.
+
+ // NOTE: This step shall be proceed before writting REG_RQPN.
if(pHalData->OutEpQueueSel & TX_SELE_NQ)
- numNQ = NORMAL_PAGE_NUM_NPQ_88E;
+ numNQ = NORMAL_PAGE_NUM_NPQ_88E;
}
value8 = (u8)_NPQ(numNQ);
@@ -2751,19 +2751,6 @@ static void rtl8192cu_trigger_gpio_0(_adapter *padapter)
#endif
}
-static void ResumeTxBeacon(_adapter *padapter)
-{
- HAL_DATA_TYPE* pHalData = GET_HAL_DATA(padapter);
-
- // 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value
- // which should be read from register to a global variable.
-
- rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl) | BIT6);
- pHalData->RegFwHwTxQCtrl |= BIT6;
- rtw_write8(padapter, REG_TBTT_PROHIBIT+1, 0xff);
- pHalData->RegReg542 |= BIT0;
- rtw_write8(padapter, REG_TBTT_PROHIBIT+2, pHalData->RegReg542);
-}
void UpdateInterruptMask8188EU(PADAPTER padapter,u8 bHIMR0 ,u32 AddMSR, u32 RemoveMSR)
{
HAL_DATA_TYPE *pHalData;
@@ -2789,256 +2776,6 @@ void UpdateInterruptMask8188EU(PADAPTER padapter,u8 bHIMR0 ,u32 AddMSR, u32 Remo
}
-static void StopTxBeacon(_adapter *padapter)
-{
- HAL_DATA_TYPE* pHalData = GET_HAL_DATA(padapter);
-
- // 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value
- // which should be read from register to a global variable.
-
- rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl) & (~BIT6));
- pHalData->RegFwHwTxQCtrl &= (~BIT6);
- rtw_write8(padapter, REG_TBTT_PROHIBIT+1, 0x64);
- pHalData->RegReg542 &= ~(BIT0);
- rtw_write8(padapter, REG_TBTT_PROHIBIT+2, pHalData->RegReg542);
-
- //todo: CheckFwRsvdPageContent(Adapter); // 2010.06.23. Added by tynli.
-
-}
-
-
-static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val)
-{
- u8 val8;
- u8 mode = *((u8 *)val);
- //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-
-#ifdef CONFIG_CONCURRENT_MODE
- if(Adapter->iface_type == IFACE_PORT1)
- {
- // disable Port1 TSF update
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(4));
-
- // set net_type
- val8 = rtw_read8(Adapter, MSR)&0x03;
- val8 |= (mode<<2);
- rtw_write8(Adapter, MSR, val8);
-
- DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode);
-
- if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_))
- {
- if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
- {
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN
-
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
- rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms
- UpdateInterruptMask8188EU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_88E);
- #endif // CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
-
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
- UpdateInterruptMask8188EU(Adapter,_TRUE ,0, (IMR_TBDER_88E|IMR_TBDOK_88E));
- #endif// CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
-
- #endif //CONFIG_INTERRUPT_BASED_TXBCN
-
-
- StopTxBeacon(Adapter);
- }
-
- rtw_write8(Adapter,REG_BCN_CTRL_1, 0x11);//disable atim wnd and disable beacon function
- //rtw_write8(Adapter,REG_BCN_CTRL_1, 0x18);
- }
- else if((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/)
- {
- ResumeTxBeacon(Adapter);
- rtw_write8(Adapter,REG_BCN_CTRL_1, 0x1a);
- //BIT4 - If set 0, hw will clr bcnq when tx becon ok/fail or port 1
- rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
- }
- else if(mode == _HW_STATE_AP_)
- {
-#ifdef CONFIG_INTERRUPT_BASED_TXBCN
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
- UpdateInterruptMask8188EU(Adapter,_TRUE ,IMR_BCNDMAINT0_88E, 0);
- #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
-
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
- UpdateInterruptMask8188EU(Adapter,_TRUE ,(IMR_TBDER_88E|IMR_TBDOK_88E), 0);
- #endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
-
-#endif //CONFIG_INTERRUPT_BASED_TXBCN
-
- ResumeTxBeacon(Adapter);
-
- rtw_write8(Adapter, REG_BCN_CTRL_1, 0x12);
-
- //Set RCR
- //rtw_write32(padapter, REG_RCR, 0x70002a8e);//CBSSID_DATA must set to 0
- //rtw_write32(Adapter, REG_RCR, 0x7000228e);//CBSSID_DATA must set to 0
- rtw_write32(Adapter, REG_RCR, 0x7000208e);//CBSSID_DATA must set to 0,reject ICV_ERR packet
- //enable to rx data frame
- rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF);
- //enable to rx ps-poll
- rtw_write16(Adapter, REG_RXFLTMAP1, 0x0400);
-
- //Beacon Control related register for first time
- rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms
-
- //rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF);
- rtw_write8(Adapter, REG_ATIMWND_1, 0x0a); // 10ms for port1
- rtw_write16(Adapter, REG_BCNTCFG, 0x00);
- rtw_write16(Adapter, REG_TBTT_PROHIBIT, 0xff04);
- rtw_write16(Adapter, REG_TSFTR_SYN_OFFSET, 0x7fff);// +32767 (~32ms)
-
- //reset TSF2
- rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1));
-
-
- //BIT4 - If set 0, hw will clr bcnq when tx becon ok/fail or port 1
- rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
- //enable BCN1 Function for if2
- //don't enable update TSF1 for if2 (due to TSF update when beacon/probe rsp are received)
- rtw_write8(Adapter, REG_BCN_CTRL_1, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION | EN_TXBCN_RPT|BIT(1)));
-
-#ifdef CONFIG_CONCURRENT_MODE
- if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE))
- rtw_write8(Adapter, REG_BCN_CTRL,
- rtw_read8(Adapter, REG_BCN_CTRL) & ~EN_BCN_FUNCTION);
-#endif
- //BCN1 TSF will sync to BCN0 TSF with offset(0x518) if if1_sta linked
- //rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(5));
- //rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(3));
-
- //dis BCN0 ATIM WND if if1 is station
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(0));
-
-#ifdef CONFIG_TSF_RESET_OFFLOAD
- // Reset TSF for STA+AP concurrent mode
- if ( check_buddy_fwstate(Adapter, (WIFI_STATION_STATE|WIFI_ASOC_STATE)) ) {
- if (reset_tsf(Adapter, IFACE_PORT1) == _FALSE)
- DBG_871X("ERROR! %s()-%d: Reset port1 TSF fail\n",
- __FUNCTION__, __LINE__);
- }
-#endif // CONFIG_TSF_RESET_OFFLOAD
- }
- }
- else
-#endif //CONFIG_CONCURRENT_MODE
- {
- // disable Port0 TSF update
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
-
- // set net_type
- val8 = rtw_read8(Adapter, MSR)&0x0c;
- val8 |= mode;
- rtw_write8(Adapter, MSR, val8);
-
- DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode);
-
- if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_))
- {
-#ifdef CONFIG_CONCURRENT_MODE
- if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
-#endif //CONFIG_CONCURRENT_MODE
- {
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
- rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms
- UpdateInterruptMask8188EU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_88E);
- #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
-
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
- UpdateInterruptMask8188EU(Adapter,_TRUE ,0, (IMR_TBDER_88E|IMR_TBDOK_88E));
- #endif //CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
-
- #endif //CONFIG_INTERRUPT_BASED_TXBCN
- StopTxBeacon(Adapter);
- }
-
- rtw_write8(Adapter,REG_BCN_CTRL, 0x19);//disable atim wnd
- //rtw_write8(Adapter,REG_BCN_CTRL, 0x18);
- }
- else if((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/)
- {
- ResumeTxBeacon(Adapter);
- rtw_write8(Adapter,REG_BCN_CTRL, 0x1a);
- //BIT3 - If set 0, hw will clr bcnq when tx becon ok/fail or port 0
- rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
- }
- else if(mode == _HW_STATE_AP_)
- {
-
-#ifdef CONFIG_INTERRUPT_BASED_TXBCN
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
- UpdateInterruptMask8188EU(Adapter,_TRUE ,IMR_BCNDMAINT0_88E, 0);
- #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
-
- #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
- UpdateInterruptMask8188EU(Adapter,_TRUE ,(IMR_TBDER_88E|IMR_TBDOK_88E), 0);
- #endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
-
-#endif //CONFIG_INTERRUPT_BASED_TXBCN
-
-
- ResumeTxBeacon(Adapter);
-
- rtw_write8(Adapter, REG_BCN_CTRL, 0x12);
-
- //Set RCR
- //rtw_write32(padapter, REG_RCR, 0x70002a8e);//CBSSID_DATA must set to 0
- //rtw_write32(Adapter, REG_RCR, 0x7000228e);//CBSSID_DATA must set to 0
- rtw_write32(Adapter, REG_RCR, 0x7000208e);//CBSSID_DATA must set to 0,reject ICV_ERR packet
- //enable to rx data frame
- rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF);
- //enable to rx ps-poll
- rtw_write16(Adapter, REG_RXFLTMAP1, 0x0400);
-
- //Beacon Control related register for first time
- rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms
-
- //rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF);
- rtw_write8(Adapter, REG_ATIMWND, 0x0a); // 10ms
- rtw_write16(Adapter, REG_BCNTCFG, 0x00);
- rtw_write16(Adapter, REG_TBTT_PROHIBIT, 0xff04);
- rtw_write16(Adapter, REG_TSFTR_SYN_OFFSET, 0x7fff);// +32767 (~32ms)
-
- //reset TSF
- rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(0));
-
- //BIT3 - If set 0, hw will clr bcnq when tx becon ok/fail or port 0
- rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
-
- //enable BCN0 Function for if1
- //don't enable update TSF0 for if1 (due to TSF update when beacon/probe rsp are received)
- #if defined(CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR)
- rtw_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION | EN_TXBCN_RPT|BIT(1)));
- #else
- rtw_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION |BIT(1)));
- #endif
-
-#ifdef CONFIG_CONCURRENT_MODE
- if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE))
- rtw_write8(Adapter, REG_BCN_CTRL_1,
- rtw_read8(Adapter, REG_BCN_CTRL_1) & ~EN_BCN_FUNCTION);
-#endif
-
- //dis BCN1 ATIM WND if if2 is station
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(0));
-#ifdef CONFIG_TSF_RESET_OFFLOAD
- // Reset TSF for STA+AP concurrent mode
- if ( check_buddy_fwstate(Adapter, (WIFI_STATION_STATE|WIFI_ASOC_STATE)) ) {
- if (reset_tsf(Adapter, IFACE_PORT0) == _FALSE)
- DBG_871X("ERROR! %s()-%d: Reset port0 TSF fail\n",
- __FUNCTION__, __LINE__);
- }
-#endif // CONFIG_TSF_RESET_OFFLOAD
- }
- }
-
-}
-
static void hw_var_set_macaddr(PADAPTER Adapter, u8 variable, u8* val)
{
u8 idx = 0;
@@ -3112,102 +2849,6 @@ static void hw_var_set_bcn_func(PADAPTER Adapter, u8 variable, u8* val)
}
-static void hw_var_set_correct_tsf(PADAPTER Adapter, u8 variable, u8* val)
-{
-#ifdef CONFIG_CONCURRENT_MODE
- u64 tsf;
- struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- PADAPTER pbuddy_adapter = Adapter->pbuddy_adapter;
-
- //tsf = pmlmeext->TSFValue - ((u32)pmlmeext->TSFValue % (pmlmeinfo->bcn_interval*1024)) -1024; //us
- tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us
-
- if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
- {
- //pHalData->RegTxPause |= STOP_BCNQ;BIT(6)
- //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6)));
- StopTxBeacon(Adapter);
- }
-
- if(Adapter->iface_type == IFACE_PORT1)
- {
- //disable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3)));
-
- rtw_write32(Adapter, REG_TSFTR1, tsf);
- rtw_write32(Adapter, REG_TSFTR1+4, tsf>>32);
-
-
- //enable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3));
-
- // Update buddy port's TSF if it is SoftAP for beacon TX issue!
- if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE
- && check_buddy_fwstate(Adapter, WIFI_AP_STATE)
- ) {
- //disable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3)));
-
- rtw_write32(Adapter, REG_TSFTR, tsf);
- rtw_write32(Adapter, REG_TSFTR+4, tsf>>32);
-
- //enable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3));
-#ifdef CONFIG_TSF_RESET_OFFLOAD
- // Update buddy port's TSF(TBTT) if it is SoftAP for beacon TX issue!
- if (reset_tsf(Adapter, IFACE_PORT0) == _FALSE)
- DBG_871X("ERROR! %s()-%d: Reset port0 TSF fail\n",
- __FUNCTION__, __LINE__);
-
-#endif // CONFIG_TSF_RESET_OFFLOAD
- }
-
-
- }
- else
- {
- //disable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3)));
-
- rtw_write32(Adapter, REG_TSFTR, tsf);
- rtw_write32(Adapter, REG_TSFTR+4, tsf>>32);
-
- //enable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3));
-
- // Update buddy port's TSF if it is SoftAP for beacon TX issue!
- if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE
- && check_buddy_fwstate(Adapter, WIFI_AP_STATE)
- ) {
- //disable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3)));
-
- rtw_write32(Adapter, REG_TSFTR1, tsf);
- rtw_write32(Adapter, REG_TSFTR1+4, tsf>>32);
-
- //enable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3));
-#ifdef CONFIG_TSF_RESET_OFFLOAD
- // Update buddy port's TSF if it is SoftAP for beacon TX issue!
- if (reset_tsf(Adapter, IFACE_PORT1) == _FALSE)
- DBG_871X("ERROR! %s()-%d: Reset port1 TSF fail\n",
- __FUNCTION__, __LINE__);
-#endif // CONFIG_TSF_RESET_OFFLOAD
- }
-
- }
-
-
- if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
- {
- //pHalData->RegTxPause &= (~STOP_BCNQ);
- //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)&(~BIT(6))));
- ResumeTxBeacon(Adapter);
- }
-#endif
-}
-
static void hw_var_set_mlme_disconnect(PADAPTER Adapter, u8 variable, u8* val)
{
#ifdef CONFIG_CONCURRENT_MODE
@@ -3241,175 +2882,6 @@ static void hw_var_set_mlme_disconnect(PADAPTER Adapter, u8 variable, u8* val)
#endif
}
-static void hw_var_set_mlme_sitesurvey(PADAPTER Adapter, u8 variable, u8* val)
-{
-#ifdef CONFIG_CONCURRENT_MODE
- struct mlme_priv *pmlmepriv=&(Adapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- u32 value_rcr, rcr_clear_bit, value_rxfltmap2;
-
-#ifdef CONFIG_FIND_BEST_CHANNEL
- rcr_clear_bit = (RCR_CBSSID_BCN | RCR_CBSSID_DATA);
- // Recieve all data frames
- value_rxfltmap2 = 0xFFFF;
-#else /* CONFIG_FIND_BEST_CHANNEL */
- rcr_clear_bit = RCR_CBSSID_BCN;
- //config RCR to receive different BSSID & not to receive data frame
- value_rxfltmap2 = 0;
-#endif /* CONFIG_FIND_BEST_CHANNEL */
-
- if( (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
- #ifdef CONFIG_CONCURRENT_MODE
- || (check_buddy_fwstate(Adapter, WIFI_AP_STATE) == _TRUE)
- #endif
- ){
- rcr_clear_bit = RCR_CBSSID_BCN;
- }
-#ifdef CONFIG_TDLS
- // TDLS will clear RCR_CBSSID_DATA bit for connection.
- else if (Adapter->tdlsinfo.link_established == _TRUE)
- {
- rcr_clear_bit = RCR_CBSSID_BCN;
- }
-#endif // CONFIG_TDLS
-
- value_rcr = rtw_read32(Adapter, REG_RCR);
- if(*((u8 *)val))//under sitesurvey
- {
- value_rcr &= ~(rcr_clear_bit);
- rtw_write32(Adapter, REG_RCR, value_rcr);
- rtw_write16(Adapter, REG_RXFLTMAP2, value_rxfltmap2);
-
- //disable update TSF
- if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
- {
- if(Adapter->iface_type == IFACE_PORT1)
- {
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(4));
- }
- else
- {
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
- }
- }
-
- if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
- check_buddy_fwstate(Adapter, _FW_LINKED))
- {
- StopTxBeacon(Adapter);
- }
- }
- else//sitesurvey done
- {
- //enable to rx data frame
- //write32(Adapter, REG_RCR, read32(padapter, REG_RCR)|RCR_ADF);
- if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE))
- || check_buddy_fwstate(Adapter, (_FW_LINKED|WIFI_AP_STATE)))
- rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
-
- //enable update TSF
- if(Adapter->iface_type == IFACE_PORT1)
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4)));
- else
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
-
- value_rcr |= rcr_clear_bit;
- rtw_write32(Adapter, REG_RCR, value_rcr);
-
- if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
- check_buddy_fwstate(Adapter, _FW_LINKED))
- {
- ResumeTxBeacon(Adapter);
- }
- }
-#endif
-}
-
-static void hw_var_set_mlme_join(PADAPTER Adapter, u8 variable, u8* val)
-{
-#ifdef CONFIG_CONCURRENT_MODE
- u8 RetryLimit = 0x30;
- u8 type = *((u8 *)val);
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter);
-
- if(type == 0) // prepare to join
- {
- if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
- check_buddy_fwstate(Adapter, _FW_LINKED))
- {
- StopTxBeacon(Adapter);
- }
-
- //enable to rx data frame.Accept all data frame
- //rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
- rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
-
- if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
- rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN);
- else
- rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
-
- if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
- {
- RetryLimit = (pEEPROM->CustomerID == RT_CID_CCX) ? 7 : 48;
- }
- else // Ad-hoc Mode
- {
- RetryLimit = 0x7;
- }
- }
- else if(type == 1) //joinbss_event call back when join res < 0
- {
- if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_))
- rtw_write16(Adapter, REG_RXFLTMAP2,0x00);
-
- if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
- check_buddy_fwstate(Adapter, _FW_LINKED))
- {
- ResumeTxBeacon(Adapter);
-
- //reset TSF 1/2 after ResumeTxBeacon
- rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0));
-
- }
- }
- else if(type == 2) //sta add event call back
- {
-
- //enable update TSF
- if(Adapter->iface_type == IFACE_PORT1)
- rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4)));
- else
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
-
-
- if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE))
- {
- //fixed beacon issue for 8191su...........
- rtw_write8(Adapter,0x542 ,0x02);
- RetryLimit = 0x7;
- }
-
-
- if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
- check_buddy_fwstate(Adapter, _FW_LINKED))
- {
- ResumeTxBeacon(Adapter);
-
- //reset TSF 1/2 after ResumeTxBeacon
- rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0));
- }
-
- }
-
- rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT);
-
-#endif
-}
-
void SetHwReg8188EU(PADAPTER Adapter, u8 variable, u8* val)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
@@ -3437,9 +2909,6 @@ _func_enter_;
rtw_write8(Adapter, MSR, val8);
}
break;
- case HW_VAR_SET_OPMODE:
- hw_var_set_opmode(Adapter, variable, val);
- break;
case HW_VAR_MAC_ADDR:
hw_var_set_macaddr(Adapter, variable, val);
break;
@@ -3452,44 +2921,6 @@ _func_enter_;
case HW_VAR_BCN_FUNC:
hw_var_set_bcn_func(Adapter, variable, val);
break;
- case HW_VAR_CORRECT_TSF:
-#ifdef CONFIG_CONCURRENT_MODE
- hw_var_set_correct_tsf(Adapter, variable, val);
-#else
- {
- u64 tsf;
- struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- //tsf = pmlmeext->TSFValue - ((u32)pmlmeext->TSFValue % (pmlmeinfo->bcn_interval*1024)) -1024; //us
- tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us
-
- if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
- {
- //pHalData->RegTxPause |= STOP_BCNQ;BIT(6)
- //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6)));
- StopTxBeacon(Adapter);
- }
-
- //disable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3)));
-
- rtw_write32(Adapter, REG_TSFTR, tsf);
- rtw_write32(Adapter, REG_TSFTR+4, tsf>>32);
-
- //enable related TSF function
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3));
-
-
- if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
- {
- //pHalData->RegTxPause &= (~STOP_BCNQ);
- //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)&(~BIT(6))));
- ResumeTxBeacon(Adapter);
- }
- }
-#endif
- break;
case HW_VAR_CHECK_BSSID:
if(*((u8 *)val))
{
@@ -3524,140 +2955,6 @@ _func_enter_;
}
#endif
break;
- case HW_VAR_MLME_SITESURVEY:
-#ifdef CONFIG_CONCURRENT_MODE
- hw_var_set_mlme_sitesurvey(Adapter, variable, val);
-#else
- {
- u32 value_rcr, rcr_clear_bit, value_rxfltmap2;
-#ifdef CONFIG_FIND_BEST_CHANNEL
-
- rcr_clear_bit = (RCR_CBSSID_BCN | RCR_CBSSID_DATA);
-
- // Recieve all data frames
- value_rxfltmap2 = 0xFFFF;
-
-#else /* CONFIG_FIND_BEST_CHANNEL */
-
- rcr_clear_bit = RCR_CBSSID_BCN;
-
- //config RCR to receive different BSSID & not to receive data frame
- value_rxfltmap2 = 0;
-
-#endif /* CONFIG_FIND_BEST_CHANNEL */
-
- if (check_fwstate(&Adapter->mlmepriv, WIFI_AP_STATE) == _TRUE) {
- rcr_clear_bit = RCR_CBSSID_BCN;
- }
- #ifdef CONFIG_TDLS
- // TDLS will clear RCR_CBSSID_DATA bit for connection.
- else if (Adapter->tdlsinfo.link_established == _TRUE) {
- rcr_clear_bit = RCR_CBSSID_BCN;
- }
- #endif // CONFIG_TDLS
-
- value_rcr = rtw_read32(Adapter, REG_RCR);
- if(*((u8 *)val))//under sitesurvey
- {
- //config RCR to receive different BSSID & not to receive data frame
- value_rcr &= ~(rcr_clear_bit);
- rtw_write32(Adapter, REG_RCR, value_rcr);
- rtw_write16(Adapter, REG_RXFLTMAP2, value_rxfltmap2);
-
- //disable update TSF
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
- }
- else//sitesurvey done
- {
- struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- if ((is_client_associated_to_ap(Adapter) == _TRUE) ||
- ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) )
- {
- //enable to rx data frame
- //rtw_write32(Adapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
- rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
-
- //enable update TSF
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
- }
- else if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
- {
- //rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_ADF);
- rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
-
- //enable update TSF
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
- }
-
- value_rcr |= rcr_clear_bit;
- if(((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) && (Adapter->in_cta_test)) {
- u32 v = rtw_read32(Adapter, REG_RCR);
- v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );//| RCR_ADF
- rtw_write32(Adapter, REG_RCR, v);
- } else {
- rtw_write32(Adapter, REG_RCR, value_rcr);
- }
- }
- }
-#endif
- break;
- case HW_VAR_MLME_JOIN:
-#ifdef CONFIG_CONCURRENT_MODE
- hw_var_set_mlme_join(Adapter, variable, val);
-#else
- {
- u8 RetryLimit = 0x30;
- u8 type = *((u8 *)val);
- struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
- EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter);
-
- if(type == 0) // prepare to join
- {
- //enable to rx data frame.Accept all data frame
- //rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
- rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
-
- if(Adapter->in_cta_test)
- {
- u32 v = rtw_read32(Adapter, REG_RCR);
- v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );//| RCR_ADF
- rtw_write32(Adapter, REG_RCR, v);
- }
- else
- {
- rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
- }
-
- if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
- {
- RetryLimit = (pEEPROM->CustomerID == RT_CID_CCX) ? 7 : 48;
- }
- else // Ad-hoc Mode
- {
- RetryLimit = 0x7;
- }
- }
- else if(type == 1) //joinbss_event call back when join res < 0
- {
- rtw_write16(Adapter, REG_RXFLTMAP2,0x00);
- }
- else if(type == 2) //sta add event call back
- {
- //enable update TSF
- rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
-
- if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE))
- {
- RetryLimit = 0x7;
- }
- }
-
- rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT);
- }
-#endif
- break;
case HW_VAR_ON_RCR_AM:
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_AM);
DBG_871X("%s, %d, RCR= %x \n", __FUNCTION__,__LINE__, rtw_read32(Adapter, REG_RCR));
diff --git a/rtl8xxx_EU/hal/rtl8188e/usb/usb_ops_linux.c b/rtl8xxx_EU/hal/rtl8188e/usb/usb_ops_linux.c
index 51d33c0..bdc468b 100644..100755
--- a/rtl8xxx_EU/hal/rtl8188e/usb/usb_ops_linux.c
+++ b/rtl8xxx_EU/hal/rtl8188e/usb/usb_ops_linux.c
@@ -950,31 +950,19 @@ void rtl8188eu_recv_tasklet(void *priv)
rtw_skb_free(pskb);
break;
}
-
- recvbuf2recvframe(padapter, pskb);
-
-#ifdef CONFIG_PREALLOC_RECV_SKB
+ recvbuf2recvframe(padapter, pskb);
skb_reset_tail_pointer(pskb);
-
pskb->len = 0;
skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
-
-#else
- rtw_skb_free(pskb);
-#endif
-
- }
- while (NULL != (precvbuf = rtw_dequeue_recvbuf(&precvpriv->recv_buf_pending_queue)))
- {
- DBG_871X("dequeue_recvbuf %p\n", precvbuf);
- precvbuf->pskb = NULL;
- precvbuf->reuse = _FALSE;
- rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
+ 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);
+ }
}
-
}
@@ -1133,12 +1121,14 @@ _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! precvbuf=%p #####\n", precvbuf);
+ if (0)
+ DBG_871X("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;
diff --git a/rtl8xxx_EU/include/Hal8188EPhyCfg.h b/rtl8xxx_EU/include/Hal8188EPhyCfg.h
index 17b87de..ebe54d2 100755
--- a/rtl8xxx_EU/include/Hal8188EPhyCfg.h
+++ b/rtl8xxx_EU/include/Hal8188EPhyCfg.h
@@ -1,279 +1,279 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __INC_HAL8188EPHYCFG_H__
-#define __INC_HAL8188EPHYCFG_H__
-
-
-/*--------------------------Define Parameters-------------------------------*/
-#define LOOP_LIMIT 5
-#define MAX_STALL_TIME 50 //us
-#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
-#define MAX_TXPWR_IDX_NMODE_92S 63
-#define Reset_Cnt_Limit 3
-
-#ifdef CONFIG_PCI_HCI
-#define MAX_AGGR_NUM 0x0B
-#else
-#define MAX_AGGR_NUM 0x07
-#endif // CONFIG_PCI_HCI
-
-
-/*--------------------------Define Parameters-------------------------------*/
-
-
-/*------------------------------Define structure----------------------------*/
-
-#define MAX_PG_GROUP 13
-
-#define MAX_TX_COUNT_8188E 1
-
-/* BB/RF related */
-
-
-/*------------------------------Define structure----------------------------*/
-
-
-/*------------------------Export global variable----------------------------*/
-/*------------------------Export global variable----------------------------*/
-
-
-/*------------------------Export Marco Definition---------------------------*/
-/*------------------------Export Marco Definition---------------------------*/
-
-
-/*--------------------------Exported Function prototype---------------------*/
-//
-// BB and RF register read/write
-//
-u32 PHY_QueryBBReg8188E( IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask );
-void PHY_SetBBReg8188E( IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data );
-u32 PHY_QueryRFReg8188E( IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask );
-void PHY_SetRFReg8188E( IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data );
-
-//
-// Initialization related function
-//
-/* MAC/BB/RF HAL config */
-int PHY_MACConfig8188E(IN PADAPTER Adapter );
-int PHY_BBConfig8188E(IN PADAPTER Adapter );
-int PHY_RFConfig8188E(IN PADAPTER Adapter );
-
-/* RF config */
-int rtl8188e_PHY_ConfigRFWithParaFile(IN PADAPTER Adapter, IN u8 * pFileName, u8 eRFPath);
-
-/* Read initi reg value for tx power setting. */
-void rtl8192c_PHY_GetHWRegOriginalValue( IN PADAPTER Adapter );
-
-//
-// RF Power setting
-//
-//extern BOOLEAN PHY_SetRFPowerState(IN PADAPTER Adapter,
-// IN RT_RF_POWER_STATE eRFPowerState);
-
-//
-// BB TX Power R/W
-//
-void PHY_GetTxPowerLevel8188E( IN PADAPTER Adapter,
- OUT s32* powerlevel );
-void PHY_SetTxPowerLevel8188E( IN PADAPTER Adapter,
- IN u8 channel );
-BOOLEAN PHY_UpdateTxPowerDbm8188E( IN PADAPTER Adapter,
- IN int powerInDbm );
-
-VOID
-PHY_SetTxPowerIndex_8188E(
- IN PADAPTER Adapter,
- IN u32 PowerIndex,
- IN u8 RFPath,
- IN u8 Rate
- );
-
-u8
-PHY_GetTxPowerIndex_8188E(
- IN PADAPTER pAdapter,
- IN u8 RFPath,
- IN u8 Rate,
- IN CHANNEL_WIDTH BandWidth,
- IN u8 Channel
- );
-
-//
-// Switch bandwidth for 8192S
-//
-//extern void PHY_SetBWModeCallback8192C( IN PRT_TIMER pTimer );
-void PHY_SetBWMode8188E( IN PADAPTER pAdapter,
- IN CHANNEL_WIDTH ChnlWidth,
- IN unsigned char Offset );
-
-//
-// Set FW CMD IO for 8192S.
-//
-//extern BOOLEAN HalSetIO8192C( IN PADAPTER Adapter,
-// IN IO_TYPE IOType);
-
-//
-// Set A2 entry to fw for 8192S
-//
-extern void FillA2Entry8192C( IN PADAPTER Adapter,
- IN u8 index,
- IN u8* val);
-
-
-//
-// channel switch related funciton
-//
-//extern void PHY_SwChnlCallback8192C( IN PRT_TIMER pTimer );
-void PHY_SwChnl8188E( IN PADAPTER pAdapter,
- IN u8 channel );
-
-VOID
-PHY_SetSwChnlBWMode8188E(
- IN PADAPTER Adapter,
- IN u8 channel,
- IN CHANNEL_WIDTH Bandwidth,
- IN u8 Offset40,
- IN u8 Offset80
-);
-
-//
-// BB/MAC/RF other monitor API
-//
-void PHY_SetMonitorMode8192C(IN PADAPTER pAdapter,
- IN BOOLEAN bEnableMonitorMode );
-
-BOOLEAN PHY_CheckIsLegalRfPath8192C(IN PADAPTER pAdapter,
- IN u32 eRFPath );
-
-VOID PHY_SetRFPathSwitch_8188E(IN PADAPTER pAdapter, IN BOOLEAN bMain);
-
-extern VOID
-PHY_SwitchEphyParameter(
- IN PADAPTER Adapter
- );
-
-extern VOID
-PHY_EnableHostClkReq(
- IN PADAPTER Adapter
- );
-
-BOOLEAN
-SetAntennaConfig92C(
- IN PADAPTER Adapter,
- IN u8 DefaultAnt
- );
-
-VOID
-storePwrIndexDiffRateOffset(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data
- );
-/*--------------------------Exported Function prototype---------------------*/
-
-//
-// Initialization related function
-//
-/* MAC/BB/RF HAL config */
-//extern s32 PHY_MACConfig8723(PADAPTER padapter);
-//s32 PHY_BBConfig8723(PADAPTER padapter);
-//s32 PHY_RFConfig8723(PADAPTER padapter);
-
-
-
-//==================================================================
-// Note: If SIC_ENABLE under PCIE, because of the slow operation
-// you should
-// 2) "#define RTL8723_FPGA_VERIFICATION 1" in Precomp.h.WlanE.Windows
-// 3) "#define RTL8190_Download_Firmware_From_Header 0" in Precomp.h.WlanE.Windows if needed.
-//
-#if (RTL8188E_SUPPORT == 1) && (RTL8188E_FPGA_TRUE_PHY_VERIFICATION == 1)
-#define SIC_ENABLE 1
-#define SIC_HW_SUPPORT 1
-#else
-#define SIC_ENABLE 0
-#define SIC_HW_SUPPORT 0
-#endif
-//==================================================================
-
-
-#define SIC_MAX_POLL_CNT 5
-
-#if(SIC_HW_SUPPORT == 1)
-#define SIC_CMD_READY 0
-#define SIC_CMD_PREWRITE 0x1
-#if(RTL8188E_SUPPORT == 1)
-#define SIC_CMD_WRITE 0x40
-#define SIC_CMD_PREREAD 0x2
-#define SIC_CMD_READ 0x80
-#define SIC_CMD_INIT 0xf0
-#define SIC_INIT_VAL 0xff
-
-#define SIC_INIT_REG 0x1b7
-#define SIC_CMD_REG 0x1EB // 1byte
-#define SIC_ADDR_REG 0x1E8 // 1b4~1b5, 2 bytes
-#define SIC_DATA_REG 0x1EC // 1b0~1b3
-#else
-#define SIC_CMD_WRITE 0x11
-#define SIC_CMD_PREREAD 0x2
-#define SIC_CMD_READ 0x12
-#define SIC_CMD_INIT 0x1f
-#define SIC_INIT_VAL 0xff
-
-#define SIC_INIT_REG 0x1b7
-#define SIC_CMD_REG 0x1b6 // 1byte
-#define SIC_ADDR_REG 0x1b4 // 1b4~1b5, 2 bytes
-#define SIC_DATA_REG 0x1b0 // 1b0~1b3
-#endif
-#else
-#define SIC_CMD_READY 0
-#define SIC_CMD_WRITE 1
-#define SIC_CMD_READ 2
-
-#if(RTL8188E_SUPPORT == 1)
-#define SIC_CMD_REG 0x1EB // 1byte
-#define SIC_ADDR_REG 0x1E8 // 1b9~1ba, 2 bytes
-#define SIC_DATA_REG 0x1EC // 1bc~1bf
-#else
-#define SIC_CMD_REG 0x1b8 // 1byte
-#define SIC_ADDR_REG 0x1b9 // 1b9~1ba, 2 bytes
-#define SIC_DATA_REG 0x1bc // 1bc~1bf
-#endif
-#endif
-
-#if(SIC_ENABLE == 1)
-VOID SIC_Init(IN PADAPTER Adapter);
-#endif
-
-
-#endif // __INC_HAL8192CPHYCFG_H
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8188EPHYCFG_H__
+#define __INC_HAL8188EPHYCFG_H__
+
+
+/*--------------------------Define Parameters-------------------------------*/
+#define LOOP_LIMIT 5
+#define MAX_STALL_TIME 50 //us
+#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
+#define MAX_TXPWR_IDX_NMODE_92S 63
+#define Reset_Cnt_Limit 3
+
+#ifdef CONFIG_PCI_HCI
+#define MAX_AGGR_NUM 0x0B
+#else
+#define MAX_AGGR_NUM 0x07
+#endif // CONFIG_PCI_HCI
+
+
+/*--------------------------Define Parameters-------------------------------*/
+
+
+/*------------------------------Define structure----------------------------*/
+
+#define MAX_PG_GROUP 13
+
+#define MAX_TX_COUNT_8188E 1
+
+/* BB/RF related */
+
+
+/*------------------------------Define structure----------------------------*/
+
+
+/*------------------------Export global variable----------------------------*/
+/*------------------------Export global variable----------------------------*/
+
+
+/*------------------------Export Marco Definition---------------------------*/
+/*------------------------Export Marco Definition---------------------------*/
+
+
+/*--------------------------Exported Function prototype---------------------*/
+//
+// BB and RF register read/write
+//
+u32 PHY_QueryBBReg8188E( IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask );
+void PHY_SetBBReg8188E( IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data );
+u32 PHY_QueryRFReg8188E( IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask );
+void PHY_SetRFReg8188E( IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data );
+
+//
+// Initialization related function
+//
+/* MAC/BB/RF HAL config */
+int PHY_MACConfig8188E(IN PADAPTER Adapter );
+int PHY_BBConfig8188E(IN PADAPTER Adapter );
+int PHY_RFConfig8188E(IN PADAPTER Adapter );
+
+/* RF config */
+int rtl8188e_PHY_ConfigRFWithParaFile(IN PADAPTER Adapter, IN u8 * pFileName, u8 eRFPath);
+
+/* Read initi reg value for tx power setting. */
+void rtl8192c_PHY_GetHWRegOriginalValue( IN PADAPTER Adapter );
+
+//
+// RF Power setting
+//
+//extern BOOLEAN PHY_SetRFPowerState(IN PADAPTER Adapter,
+// IN RT_RF_POWER_STATE eRFPowerState);
+
+//
+// BB TX Power R/W
+//
+void PHY_GetTxPowerLevel8188E( IN PADAPTER Adapter,
+ OUT s32* powerlevel );
+void PHY_SetTxPowerLevel8188E( IN PADAPTER Adapter,
+ IN u8 channel );
+BOOLEAN PHY_UpdateTxPowerDbm8188E( IN PADAPTER Adapter,
+ IN int powerInDbm );
+
+VOID
+PHY_SetTxPowerIndex_8188E(
+ IN PADAPTER Adapter,
+ IN u32 PowerIndex,
+ IN u8 RFPath,
+ IN u8 Rate
+ );
+
+u8
+PHY_GetTxPowerIndex_8188E(
+ IN PADAPTER pAdapter,
+ IN u8 RFPath,
+ IN u8 Rate,
+ IN CHANNEL_WIDTH BandWidth,
+ IN u8 Channel
+ );
+
+//
+// Switch bandwidth for 8192S
+//
+//extern void PHY_SetBWModeCallback8192C( IN PRT_TIMER pTimer );
+void PHY_SetBWMode8188E( IN PADAPTER pAdapter,
+ IN CHANNEL_WIDTH ChnlWidth,
+ IN unsigned char Offset );
+
+//
+// Set FW CMD IO for 8192S.
+//
+//extern BOOLEAN HalSetIO8192C( IN PADAPTER Adapter,
+// IN IO_TYPE IOType);
+
+//
+// Set A2 entry to fw for 8192S
+//
+extern void FillA2Entry8192C( IN PADAPTER Adapter,
+ IN u8 index,
+ IN u8* val);
+
+
+//
+// channel switch related funciton
+//
+//extern void PHY_SwChnlCallback8192C( IN PRT_TIMER pTimer );
+void PHY_SwChnl8188E( IN PADAPTER pAdapter,
+ IN u8 channel );
+
+VOID
+PHY_SetSwChnlBWMode8188E(
+ IN PADAPTER Adapter,
+ IN u8 channel,
+ IN CHANNEL_WIDTH Bandwidth,
+ IN u8 Offset40,
+ IN u8 Offset80
+);
+
+//
+// BB/MAC/RF other monitor API
+//
+void PHY_SetMonitorMode8192C(IN PADAPTER pAdapter,
+ IN BOOLEAN bEnableMonitorMode );
+
+BOOLEAN PHY_CheckIsLegalRfPath8192C(IN PADAPTER pAdapter,
+ IN u32 eRFPath );
+
+VOID PHY_SetRFPathSwitch_8188E(IN PADAPTER pAdapter, IN BOOLEAN bMain);
+
+extern VOID
+PHY_SwitchEphyParameter(
+ IN PADAPTER Adapter
+ );
+
+extern VOID
+PHY_EnableHostClkReq(
+ IN PADAPTER Adapter
+ );
+
+BOOLEAN
+SetAntennaConfig92C(
+ IN PADAPTER Adapter,
+ IN u8 DefaultAnt
+ );
+
+VOID
+storePwrIndexDiffRateOffset(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data
+ );
+/*--------------------------Exported Function prototype---------------------*/
+
+//
+// Initialization related function
+//
+/* MAC/BB/RF HAL config */
+//extern s32 PHY_MACConfig8723(PADAPTER padapter);
+//s32 PHY_BBConfig8723(PADAPTER padapter);
+//s32 PHY_RFConfig8723(PADAPTER padapter);
+
+
+
+//==================================================================
+// Note: If SIC_ENABLE under PCIE, because of the slow operation
+// you should
+// 2) "#define RTL8723_FPGA_VERIFICATION 1" in Precomp.h.WlanE.Windows
+// 3) "#define RTL8190_Download_Firmware_From_Header 0" in Precomp.h.WlanE.Windows if needed.
+//
+#if (RTL8188E_SUPPORT == 1) && (RTL8188E_FPGA_TRUE_PHY_VERIFICATION == 1)
+#define SIC_ENABLE 1
+#define SIC_HW_SUPPORT 1
+#else
+#define SIC_ENABLE 0
+#define SIC_HW_SUPPORT 0
+#endif
+//==================================================================
+
+
+#define SIC_MAX_POLL_CNT 5
+
+#if(SIC_HW_SUPPORT == 1)
+#define SIC_CMD_READY 0
+#define SIC_CMD_PREWRITE 0x1
+#if(RTL8188E_SUPPORT == 1)
+#define SIC_CMD_WRITE 0x40
+#define SIC_CMD_PREREAD 0x2
+#define SIC_CMD_READ 0x80
+#define SIC_CMD_INIT 0xf0
+#define SIC_INIT_VAL 0xff
+
+#define SIC_INIT_REG 0x1b7
+#define SIC_CMD_REG 0x1EB // 1byte
+#define SIC_ADDR_REG 0x1E8 // 1b4~1b5, 2 bytes
+#define SIC_DATA_REG 0x1EC // 1b0~1b3
+#else
+#define SIC_CMD_WRITE 0x11
+#define SIC_CMD_PREREAD 0x2
+#define SIC_CMD_READ 0x12
+#define SIC_CMD_INIT 0x1f
+#define SIC_INIT_VAL 0xff
+
+#define SIC_INIT_REG 0x1b7
+#define SIC_CMD_REG 0x1b6 // 1byte
+#define SIC_ADDR_REG 0x1b4 // 1b4~1b5, 2 bytes
+#define SIC_DATA_REG 0x1b0 // 1b0~1b3
+#endif
+#else
+#define SIC_CMD_READY 0
+#define SIC_CMD_WRITE 1
+#define SIC_CMD_READ 2
+
+#if(RTL8188E_SUPPORT == 1)
+#define SIC_CMD_REG 0x1EB // 1byte
+#define SIC_ADDR_REG 0x1E8 // 1b9~1ba, 2 bytes
+#define SIC_DATA_REG 0x1EC // 1bc~1bf
+#else
+#define SIC_CMD_REG 0x1b8 // 1byte
+#define SIC_ADDR_REG 0x1b9 // 1b9~1ba, 2 bytes
+#define SIC_DATA_REG 0x1bc // 1bc~1bf
+#endif
+#endif
+
+#if(SIC_ENABLE == 1)
+VOID SIC_Init(IN PADAPTER Adapter);
+#endif
+
+
+#endif // __INC_HAL8192CPHYCFG_H
+
diff --git a/rtl8xxx_EU/include/Hal8188EPhyReg.h b/rtl8xxx_EU/include/Hal8188EPhyReg.h
index 763ccea..3cd7ee5 100755
--- a/rtl8xxx_EU/include/Hal8188EPhyReg.h
+++ b/rtl8xxx_EU/include/Hal8188EPhyReg.h
@@ -1,1110 +1,1110 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __INC_HAL8188EPHYREG_H__
-#define __INC_HAL8188EPHYREG_H__
-/*--------------------------Define Parameters-------------------------------*/
-//
-// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF
-// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
-// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00
-// 3. RF register 0x00-2E
-// 4. Bit Mask for BB/RF register
-// 5. Other defintion for BB/RF R/W
-//
-
-
-//
-// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
-// 1. Page1(0x100)
-//
-#define rPMAC_Reset 0x100
-#define rPMAC_TxStart 0x104
-#define rPMAC_TxLegacySIG 0x108
-#define rPMAC_TxHTSIG1 0x10c
-#define rPMAC_TxHTSIG2 0x110
-#define rPMAC_PHYDebug 0x114
-#define rPMAC_TxPacketNum 0x118
-#define rPMAC_TxIdle 0x11c
-#define rPMAC_TxMACHeader0 0x120
-#define rPMAC_TxMACHeader1 0x124
-#define rPMAC_TxMACHeader2 0x128
-#define rPMAC_TxMACHeader3 0x12c
-#define rPMAC_TxMACHeader4 0x130
-#define rPMAC_TxMACHeader5 0x134
-#define rPMAC_TxDataType 0x138
-#define rPMAC_TxRandomSeed 0x13c
-#define rPMAC_CCKPLCPPreamble 0x140
-#define rPMAC_CCKPLCPHeader 0x144
-#define rPMAC_CCKCRC16 0x148
-#define rPMAC_OFDMRxCRC32OK 0x170
-#define rPMAC_OFDMRxCRC32Er 0x174
-#define rPMAC_OFDMRxParityEr 0x178
-#define rPMAC_OFDMRxCRC8Er 0x17c
-#define rPMAC_CCKCRxRC16Er 0x180
-#define rPMAC_CCKCRxRC32Er 0x184
-#define rPMAC_CCKCRxRC32OK 0x188
-#define rPMAC_TxStatus 0x18c
-
-//
-// 2. Page2(0x200)
-//
-// The following two definition are only used for USB interface.
-#define RF_BB_CMD_ADDR 0x02c0 // RF/BB read/write command address.
-#define RF_BB_CMD_DATA 0x02c4 // RF/BB read/write command data.
-
-//
-// 3. Page8(0x800)
-//
-#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting??
-
-#define rFPGA0_TxInfo 0x804 // Status report??
-#define rFPGA0_PSDFunction 0x808
-
-#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain?
-
-#define rFPGA0_RFTiming1 0x810 // Useless now
-#define rFPGA0_RFTiming2 0x814
-
-#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register
-#define rFPGA0_XA_HSSIParameter2 0x824
-#define rFPGA0_XB_HSSIParameter1 0x828
-#define rFPGA0_XB_HSSIParameter2 0x82c
-
-#define rFPGA0_XA_LSSIParameter 0x840
-#define rFPGA0_XB_LSSIParameter 0x844
-
-#define rFPGA0_RFWakeUpParameter 0x850 // Useless now
-#define rFPGA0_RFSleepUpParameter 0x854
-
-#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch
-#define rFPGA0_XCD_SwitchControl 0x85c
-
-#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch
-#define rFPGA0_XB_RFInterfaceOE 0x864
-#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control
-#define rFPGA0_XCD_RFInterfaceSW 0x874
-
-#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter
-#define rFPGA0_XCD_RFParameter 0x87c
-
-#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4??
-#define rFPGA0_AnalogParameter2 0x884
-#define rFPGA0_AnalogParameter3 0x888
-#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy
-#define rFPGA0_AnalogParameter4 0x88c
-
-#define rFPGA0_XA_LSSIReadBack 0x8a0 // Tranceiver LSSI Readback
-#define rFPGA0_XB_LSSIReadBack 0x8a4
-#define rFPGA0_XC_LSSIReadBack 0x8a8
-#define rFPGA0_XD_LSSIReadBack 0x8ac
-
-#define rFPGA0_PSDReport 0x8b4 // Useless now
-#define TransceiverA_HSPI_Readback 0x8b8 // Transceiver A HSPI Readback
-#define TransceiverB_HSPI_Readback 0x8bc // Transceiver B HSPI Readback
-#define rFPGA0_XAB_RFInterfaceRB 0x8e0 // Useless now // RF Interface Readback Value
-#define rFPGA0_XCD_RFInterfaceRB 0x8e4 // Useless now
-
-//
-// 4. Page9(0x900)
-//
-#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting??
-
-#define rFPGA1_TxBlock 0x904 // Useless now
-#define rFPGA1_DebugSelect 0x908 // Useless now
-#define rFPGA1_TxInfo 0x90c // Useless now // Status report??
-
-//
-// 5. PageA(0xA00)
-//
-// Set Control channel to upper or lower. These settings are required only for 40MHz
-#define rCCK0_System 0xa00
-
-#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI
-#define rCCK0_CCA 0xa08 // Disable init gain now // Init gain
-
-#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series
-#define rCCK0_RxAGC2 0xa10 //AGC & DAGC
-
-#define rCCK0_RxHP 0xa14
-
-#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold
-#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
-#define rCCK0_TRSSIReport 0xa50
-#define rCCK0_RxReport 0xa54 //0xa57
-#define rCCK0_FACounterLower 0xa5c //0xa5b
-#define rCCK0_FACounterUpper 0xa58 //0xa5c
-
-//
-// PageB(0xB00)
-//
-#define rPdp_AntA 0xb00
-#define rPdp_AntA_4 0xb04
-#define rConfig_Pmpd_AntA 0xb28
-#define rConfig_ram64x16 0xb2c
-#define rConfig_AntA 0xb68
-#define rConfig_AntB 0xb6c
-#define rPdp_AntB 0xb70
-#define rPdp_AntB_4 0xb74
-#define rConfig_Pmpd_AntB 0xb98
-#define rAPK 0xbd8
-
-
-
-//
-// 6. PageC(0xC00)
-//
-#define rOFDM0_LSTF 0xc00
-
-#define rOFDM0_TRxPathEnable 0xc04
-#define rOFDM0_TRMuxPar 0xc08
-#define rOFDM0_TRSWIsolation 0xc0c
-
-#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter
-#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix
-#define rOFDM0_XBRxAFE 0xc18
-#define rOFDM0_XBRxIQImbalance 0xc1c
-#define rOFDM0_XCRxAFE 0xc20
-#define rOFDM0_XCRxIQImbalance 0xc24
-#define rOFDM0_XDRxAFE 0xc28
-#define rOFDM0_XDRxIQImbalance 0xc2c
-
-#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain
-#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync.
-#define rOFDM0_RxDetector3 0xc38 //Frame Sync.
-#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI
-
-#define rOFDM0_RxDSP 0xc40 //Rx Sync Path
-#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC
-#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold
-#define rOFDM0_ECCAThreshold 0xc4c // energy CCA
-
-#define rOFDM0_XAAGCCore1 0xc50 // DIG
-#define rOFDM0_XAAGCCore2 0xc54
-#define rOFDM0_XBAGCCore1 0xc58
-#define rOFDM0_XBAGCCore2 0xc5c
-#define rOFDM0_XCAGCCore1 0xc60
-#define rOFDM0_XCAGCCore2 0xc64
-#define rOFDM0_XDAGCCore1 0xc68
-#define rOFDM0_XDAGCCore2 0xc6c
-
-#define rOFDM0_AGCParameter1 0xc70
-#define rOFDM0_AGCParameter2 0xc74
-#define rOFDM0_AGCRSSITable 0xc78
-#define rOFDM0_HTSTFAGC 0xc7c
-
-#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG
-#define rOFDM0_XATxAFE 0xc84
-#define rOFDM0_XBTxIQImbalance 0xc88
-#define rOFDM0_XBTxAFE 0xc8c
-#define rOFDM0_XCTxIQImbalance 0xc90
-#define rOFDM0_XCTxAFE 0xc94
-#define rOFDM0_XDTxIQImbalance 0xc98
-#define rOFDM0_XDTxAFE 0xc9c
-
-#define rOFDM0_RxIQExtAnta 0xca0
-#define rOFDM0_TxCoeff1 0xca4
-#define rOFDM0_TxCoeff2 0xca8
-#define rOFDM0_TxCoeff3 0xcac
-#define rOFDM0_TxCoeff4 0xcb0
-#define rOFDM0_TxCoeff5 0xcb4
-#define rOFDM0_TxCoeff6 0xcb8
-#define rOFDM0_RxHPParameter 0xce0
-#define rOFDM0_TxPseudoNoiseWgt 0xce4
-#define rOFDM0_FrameSync 0xcf0
-#define rOFDM0_DFSReport 0xcf4
-
-
-//
-// 7. PageD(0xD00)
-//
-#define rOFDM1_LSTF 0xd00
-#define rOFDM1_TRxPathEnable 0xd04
-
-#define rOFDM1_CFO 0xd08 // No setting now
-#define rOFDM1_CSI1 0xd10
-#define rOFDM1_SBD 0xd14
-#define rOFDM1_CSI2 0xd18
-#define rOFDM1_CFOTracking 0xd2c
-#define rOFDM1_TRxMesaure1 0xd34
-#define rOFDM1_IntfDet 0xd3c
-#define rOFDM1_csi_fix_mask1 0xd40
-#define rOFDM1_csi_fix_mask2 0xd44
-#define rOFDM1_PseudoNoiseStateAB 0xd50
-#define rOFDM1_PseudoNoiseStateCD 0xd54
-#define rOFDM1_RxPseudoNoiseWgt 0xd58
-
-#define rOFDM_PHYCounter1 0xda0 //cca, parity fail
-#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail
-#define rOFDM_PHYCounter3 0xda8 //MCS not support
-
-#define rOFDM_ShortCFOAB 0xdac // No setting now
-#define rOFDM_ShortCFOCD 0xdb0
-#define rOFDM_LongCFOAB 0xdb4
-#define rOFDM_LongCFOCD 0xdb8
-#define rOFDM_TailCFOAB 0xdbc
-#define rOFDM_TailCFOCD 0xdc0
-#define rOFDM_PWMeasure1 0xdc4
-#define rOFDM_PWMeasure2 0xdc8
-#define rOFDM_BWReport 0xdcc
-#define rOFDM_AGCReport 0xdd0
-#define rOFDM_RxSNR 0xdd4
-#define rOFDM_RxEVMCSI 0xdd8
-#define rOFDM_SIGReport 0xddc
-
-
-//
-// 8. PageE(0xE00)
-//
-#define rTxAGC_A_Rate18_06 0xe00
-#define rTxAGC_A_Rate54_24 0xe04
-#define rTxAGC_A_CCK1_Mcs32 0xe08
-#define rTxAGC_A_Mcs03_Mcs00 0xe10
-#define rTxAGC_A_Mcs07_Mcs04 0xe14
-#define rTxAGC_A_Mcs11_Mcs08 0xe18
-#define rTxAGC_A_Mcs15_Mcs12 0xe1c
-
-#define rTxAGC_B_Rate18_06 0x830
-#define rTxAGC_B_Rate54_24 0x834
-#define rTxAGC_B_CCK1_55_Mcs32 0x838
-#define rTxAGC_B_Mcs03_Mcs00 0x83c
-#define rTxAGC_B_Mcs07_Mcs04 0x848
-#define rTxAGC_B_Mcs11_Mcs08 0x84c
-#define rTxAGC_B_Mcs15_Mcs12 0x868
-#define rTxAGC_B_CCK11_A_CCK2_11 0x86c
-
-#define rFPGA0_IQK 0xe28
-#define rTx_IQK_Tone_A 0xe30
-#define rRx_IQK_Tone_A 0xe34
-#define rTx_IQK_PI_A 0xe38
-#define rRx_IQK_PI_A 0xe3c
-
-#define rTx_IQK 0xe40
-#define rRx_IQK 0xe44
-#define rIQK_AGC_Pts 0xe48
-#define rIQK_AGC_Rsp 0xe4c
-#define rTx_IQK_Tone_B 0xe50
-#define rRx_IQK_Tone_B 0xe54
-#define rTx_IQK_PI_B 0xe58
-#define rRx_IQK_PI_B 0xe5c
-#define rIQK_AGC_Cont 0xe60
-
-#define rBlue_Tooth 0xe6c
-#define rRx_Wait_CCA 0xe70
-#define rTx_CCK_RFON 0xe74
-#define rTx_CCK_BBON 0xe78
-#define rTx_OFDM_RFON 0xe7c
-#define rTx_OFDM_BBON 0xe80
-#define rTx_To_Rx 0xe84
-#define rTx_To_Tx 0xe88
-#define rRx_CCK 0xe8c
-
-#define rTx_Power_Before_IQK_A 0xe94
-#define rTx_Power_After_IQK_A 0xe9c
-
-#define rRx_Power_Before_IQK_A 0xea0
-#define rRx_Power_Before_IQK_A_2 0xea4
-#define rRx_Power_After_IQK_A 0xea8
-#define rRx_Power_After_IQK_A_2 0xeac
-
-#define rTx_Power_Before_IQK_B 0xeb4
-#define rTx_Power_After_IQK_B 0xebc
-
-#define rRx_Power_Before_IQK_B 0xec0
-#define rRx_Power_Before_IQK_B_2 0xec4
-#define rRx_Power_After_IQK_B 0xec8
-#define rRx_Power_After_IQK_B_2 0xecc
-
-#define rRx_OFDM 0xed0
-#define rRx_Wait_RIFS 0xed4
-#define rRx_TO_Rx 0xed8
-#define rStandby 0xedc
-#define rSleep 0xee0
-#define rPMPD_ANAEN 0xeec
-
-//
-// 7. RF Register 0x00-0x2E (RF 8256)
-// RF-0222D 0x00-3F
-//
-//Zebra1
-#define rZebra1_HSSIEnable 0x0 // Useless now
-#define rZebra1_TRxEnable1 0x1
-#define rZebra1_TRxEnable2 0x2
-#define rZebra1_AGC 0x4
-#define rZebra1_ChargePump 0x5
-#define rZebra1_Channel 0x7 // RF channel switch
-
-//#endif
-#define rZebra1_TxGain 0x8 // Useless now
-#define rZebra1_TxLPF 0x9
-#define rZebra1_RxLPF 0xb
-#define rZebra1_RxHPFCorner 0xc
-
-//Zebra4
-#define rGlobalCtrl 0 // Useless now
-#define rRTL8256_TxLPF 19
-#define rRTL8256_RxLPF 11
-
-//RTL8258
-#define rRTL8258_TxLPF 0x11 // Useless now
-#define rRTL8258_RxLPF 0x13
-#define rRTL8258_RSSILPF 0xa
-
-//
-// RL6052 Register definition
-//
-#define RF_AC 0x00 //
-
-#define RF_IQADJ_G1 0x01 //
-#define RF_IQADJ_G2 0x02 //
-
-#define RF_POW_TRSW 0x05 //
-
-#define RF_GAIN_RX 0x06 //
-#define RF_GAIN_TX 0x07 //
-
-#define RF_TXM_IDAC 0x08 //
-#define RF_IPA_G 0x09 //
-#define RF_TXBIAS_G 0x0A
-#define RF_TXPA_AG 0x0B
-#define RF_IPA_A 0x0C //
-#define RF_TXBIAS_A 0x0D
-#define RF_BS_PA_APSET_G9_G11 0x0E
-#define RF_BS_IQGEN 0x0F //
-
-#define RF_MODE1 0x10 //
-#define RF_MODE2 0x11 //
-
-#define RF_RX_AGC_HP 0x12 //
-#define RF_TX_AGC 0x13 //
-#define RF_BIAS 0x14 //
-#define RF_IPA 0x15 //
-#define RF_TXBIAS 0x16
-#define RF_POW_ABILITY 0x17 //
-#define RF_CHNLBW 0x18 // RF channel and BW switch
-#define RF_TOP 0x19 //
-
-#define RF_RX_G1 0x1A //
-#define RF_RX_G2 0x1B //
-
-#define RF_RX_BB2 0x1C //
-#define RF_RX_BB1 0x1D //
-
-#define RF_RCK1 0x1E //
-#define RF_RCK2 0x1F //
-
-#define RF_TX_G1 0x20 //
-#define RF_TX_G2 0x21 //
-#define RF_TX_G3 0x22 //
-
-#define RF_TX_BB1 0x23 //
-
-//#if HARDWARE_TYPE_IS_RTL8192D == 1
-#define RF_T_METER_92D 0x42 //
-//#else
-#define RF_T_METER_88E 0x42 //
-#define RF_T_METER 0x24 //
-
-//#endif
-
-#define RF_SYN_G1 0x25 // RF TX Power control
-#define RF_SYN_G2 0x26 // RF TX Power control
-#define RF_SYN_G3 0x27 // RF TX Power control
-#define RF_SYN_G4 0x28 // RF TX Power control
-#define RF_SYN_G5 0x29 // RF TX Power control
-#define RF_SYN_G6 0x2A // RF TX Power control
-#define RF_SYN_G7 0x2B // RF TX Power control
-#define RF_SYN_G8 0x2C // RF TX Power control
-
-#define RF_RCK_OS 0x30 // RF TX PA control
-#define RF_TXPA_G1 0x31 // RF TX PA control
-#define RF_TXPA_G2 0x32 // RF TX PA control
-#define RF_TXPA_G3 0x33 // RF TX PA control
-#define RF_TX_BIAS_A 0x35
-#define RF_TX_BIAS_D 0x36
-#define RF_LOBF_9 0x38
-#define RF_RXRF_A3 0x3C //
-#define RF_TRSW 0x3F
-
-#define RF_TXRF_A2 0x41
-#define RF_TXPA_G4 0x46
-#define RF_TXPA_A4 0x4B
-#define RF_0x52 0x52
-#define RF_WE_LUT 0xEF
-
-
-//
-//Bit Mask
-//
-// 1. Page1(0x100)
-#define bBBResetB 0x100 // Useless now?
-#define bGlobalResetB 0x200
-#define bOFDMTxStart 0x4
-#define bCCKTxStart 0x8
-#define bCRC32Debug 0x100
-#define bPMACLoopback 0x10
-#define bTxLSIG 0xffffff
-#define bOFDMTxRate 0xf
-#define bOFDMTxReserved 0x10
-#define bOFDMTxLength 0x1ffe0
-#define bOFDMTxParity 0x20000
-#define bTxHTSIG1 0xffffff
-#define bTxHTMCSRate 0x7f
-#define bTxHTBW 0x80
-#define bTxHTLength 0xffff00
-#define bTxHTSIG2 0xffffff
-#define bTxHTSmoothing 0x1
-#define bTxHTSounding 0x2
-#define bTxHTReserved 0x4
-#define bTxHTAggreation 0x8
-#define bTxHTSTBC 0x30
-#define bTxHTAdvanceCoding 0x40
-#define bTxHTShortGI 0x80
-#define bTxHTNumberHT_LTF 0x300
-#define bTxHTCRC8 0x3fc00
-#define bCounterReset 0x10000
-#define bNumOfOFDMTx 0xffff
-#define bNumOfCCKTx 0xffff0000
-#define bTxIdleInterval 0xffff
-#define bOFDMService 0xffff0000
-#define bTxMACHeader 0xffffffff
-#define bTxDataInit 0xff
-#define bTxHTMode 0x100
-#define bTxDataType 0x30000
-#define bTxRandomSeed 0xffffffff
-#define bCCKTxPreamble 0x1
-#define bCCKTxSFD 0xffff0000
-#define bCCKTxSIG 0xff
-#define bCCKTxService 0xff00
-#define bCCKLengthExt 0x8000
-#define bCCKTxLength 0xffff0000
-#define bCCKTxCRC16 0xffff
-#define bCCKTxStatus 0x1
-#define bOFDMTxStatus 0x2
-
-#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff))
-
-// 2. Page8(0x800)
-#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD
-#define bJapanMode 0x2
-#define bCCKTxSC 0x30
-#define bCCKEn 0x1000000
-#define bOFDMEn 0x2000000
-
-#define bOFDMRxADCPhase 0x10000 // Useless now
-#define bOFDMTxDACPhase 0x40000
-#define bXATxAGC 0x3f
-
-#define bAntennaSelect 0x0300
-
-#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage
-#define bXCTxAGC 0xf000
-#define bXDTxAGC 0xf0000
-
-#define bPAStart 0xf0000000 // Useless now
-#define bTRStart 0x00f00000
-#define bRFStart 0x0000f000
-#define bBBStart 0x000000f0
-#define bBBCCKStart 0x0000000f
-#define bPAEnd 0xf //Reg0x814
-#define bTREnd 0x0f000000
-#define bRFEnd 0x000f0000
-#define bCCAMask 0x000000f0 //T2R
-#define bR2RCCAMask 0x00000f00
-#define bHSSI_R2TDelay 0xf8000000
-#define bHSSI_T2RDelay 0xf80000
-#define bContTxHSSI 0x400 //chane gain at continue Tx
-#define bIGFromCCK 0x200
-#define bAGCAddress 0x3f
-#define bRxHPTx 0x7000
-#define bRxHPT2R 0x38000
-#define bRxHPCCKIni 0xc0000
-#define bAGCTxCode 0xc00000
-#define bAGCRxCode 0x300000
-
-#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1
-#define b3WireAddressLength 0x400
-
-#define b3WireRFPowerDown 0x1 // Useless now
-//#define bHWSISelect 0x8
-#define b5GPAPEPolarity 0x40000000
-#define b2GPAPEPolarity 0x80000000
-#define bRFSW_TxDefaultAnt 0x3
-#define bRFSW_TxOptionAnt 0x30
-#define bRFSW_RxDefaultAnt 0x300
-#define bRFSW_RxOptionAnt 0x3000
-#define bRFSI_3WireData 0x1
-#define bRFSI_3WireClock 0x2
-#define bRFSI_3WireLoad 0x4
-#define bRFSI_3WireRW 0x8
-#define bRFSI_3Wire 0xf
-
-#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW
-
-#define bRFSI_TRSW 0x20 // Useless now
-#define bRFSI_TRSWB 0x40
-#define bRFSI_ANTSW 0x100
-#define bRFSI_ANTSWB 0x200
-#define bRFSI_PAPE 0x400
-#define bRFSI_PAPE5G 0x800
-#define bBandSelect 0x1
-#define bHTSIG2_GI 0x80
-#define bHTSIG2_Smoothing 0x01
-#define bHTSIG2_Sounding 0x02
-#define bHTSIG2_Aggreaton 0x08
-#define bHTSIG2_STBC 0x30
-#define bHTSIG2_AdvCoding 0x40
-#define bHTSIG2_NumOfHTLTF 0x300
-#define bHTSIG2_CRC8 0x3fc
-#define bHTSIG1_MCS 0x7f
-#define bHTSIG1_BandWidth 0x80
-#define bHTSIG1_HTLength 0xffff
-#define bLSIG_Rate 0xf
-#define bLSIG_Reserved 0x10
-#define bLSIG_Length 0x1fffe
-#define bLSIG_Parity 0x20
-#define bCCKRxPhase 0x4
-
-#define bLSSIReadAddress 0x7f800000 // T65 RF
-
-#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal
-
-#define bLSSIReadBackData 0xfffff // T65 RF
-
-#define bLSSIReadOKFlag 0x1000 // Useless now
-#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz
-#define bRegulator0Standby 0x1
-#define bRegulatorPLLStandby 0x2
-#define bRegulator1Standby 0x4
-#define bPLLPowerUp 0x8
-#define bDPLLPowerUp 0x10
-#define bDA10PowerUp 0x20
-#define bAD7PowerUp 0x200
-#define bDA6PowerUp 0x2000
-#define bXtalPowerUp 0x4000
-#define b40MDClkPowerUP 0x8000
-#define bDA6DebugMode 0x20000
-#define bDA6Swing 0x380000
-
-#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ
-
-#define b80MClkDelay 0x18000000 // Useless
-#define bAFEWatchDogEnable 0x20000000
-
-#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap
-#define bXtalCap23 0x3
-#define bXtalCap92x 0x0f000000
-#define bXtalCap 0x0f000000
-
-#define bIntDifClkEnable 0x400 // Useless
-#define bExtSigClkEnable 0x800
-#define bBandgapMbiasPowerUp 0x10000
-#define bAD11SHGain 0xc0000
-#define bAD11InputRange 0x700000
-#define bAD11OPCurrent 0x3800000
-#define bIPathLoopback 0x4000000
-#define bQPathLoopback 0x8000000
-#define bAFELoopback 0x10000000
-#define bDA10Swing 0x7e0
-#define bDA10Reverse 0x800
-#define bDAClkSource 0x1000
-#define bAD7InputRange 0x6000
-#define bAD7Gain 0x38000
-#define bAD7OutputCMMode 0x40000
-#define bAD7InputCMMode 0x380000
-#define bAD7Current 0xc00000
-#define bRegulatorAdjust 0x7000000
-#define bAD11PowerUpAtTx 0x1
-#define bDA10PSAtTx 0x10
-#define bAD11PowerUpAtRx 0x100
-#define bDA10PSAtRx 0x1000
-#define bCCKRxAGCFormat 0x200
-#define bPSDFFTSamplepPoint 0xc000
-#define bPSDAverageNum 0x3000
-#define bIQPathControl 0xc00
-#define bPSDFreq 0x3ff
-#define bPSDAntennaPath 0x30
-#define bPSDIQSwitch 0x40
-#define bPSDRxTrigger 0x400000
-#define bPSDTxTrigger 0x80000000
-#define bPSDSineToneScale 0x7f000000
-#define bPSDReport 0xffff
-
-// 3. Page9(0x900)
-#define bOFDMTxSC 0x30000000 // Useless
-#define bCCKTxOn 0x1
-#define bOFDMTxOn 0x2
-#define bDebugPage 0xfff //reset debug page and also HWord, LWord
-#define bDebugItem 0xff //reset debug page and LWord
-#define bAntL 0x10
-#define bAntNonHT 0x100
-#define bAntHT1 0x1000
-#define bAntHT2 0x10000
-#define bAntHT1S1 0x100000
-#define bAntNonHTS1 0x1000000
-
-// 4. PageA(0xA00)
-#define bCCKBBMode 0x3 // Useless
-#define bCCKTxPowerSaving 0x80
-#define bCCKRxPowerSaving 0x40
-
-#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch
-
-#define bCCKScramble 0x8 // Useless
-#define bCCKAntDiversity 0x8000
-#define bCCKCarrierRecovery 0x4000
-#define bCCKTxRate 0x3000
-#define bCCKDCCancel 0x0800
-#define bCCKISICancel 0x0400
-#define bCCKMatchFilter 0x0200
-#define bCCKEqualizer 0x0100
-#define bCCKPreambleDetect 0x800000
-#define bCCKFastFalseCCA 0x400000
-#define bCCKChEstStart 0x300000
-#define bCCKCCACount 0x080000
-#define bCCKcs_lim 0x070000
-#define bCCKBistMode 0x80000000
-#define bCCKCCAMask 0x40000000
-#define bCCKTxDACPhase 0x4
-#define bCCKRxADCPhase 0x20000000 //r_rx_clk
-#define bCCKr_cp_mode0 0x0100
-#define bCCKTxDCOffset 0xf0
-#define bCCKRxDCOffset 0xf
-#define bCCKCCAMode 0xc000
-#define bCCKFalseCS_lim 0x3f00
-#define bCCKCS_ratio 0xc00000
-#define bCCKCorgBit_sel 0x300000
-#define bCCKPD_lim 0x0f0000
-#define bCCKNewCCA 0x80000000
-#define bCCKRxHPofIG 0x8000
-#define bCCKRxIG 0x7f00
-#define bCCKLNAPolarity 0x800000
-#define bCCKRx1stGain 0x7f0000
-#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity
-#define bCCKRxAGCSatLevel 0x1f000000
-#define bCCKRxAGCSatCount 0xe0
-#define bCCKRxRFSettle 0x1f //AGCsamp_dly
-#define bCCKFixedRxAGC 0x8000
-//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824
-#define bCCKAntennaPolarity 0x2000
-#define bCCKTxFilterType 0x0c00
-#define bCCKRxAGCReportType 0x0300
-#define bCCKRxDAGCEn 0x80000000
-#define bCCKRxDAGCPeriod 0x20000000
-#define bCCKRxDAGCSatLevel 0x1f000000
-#define bCCKTimingRecovery 0x800000
-#define bCCKTxC0 0x3f0000
-#define bCCKTxC1 0x3f000000
-#define bCCKTxC2 0x3f
-#define bCCKTxC3 0x3f00
-#define bCCKTxC4 0x3f0000
-#define bCCKTxC5 0x3f000000
-#define bCCKTxC6 0x3f
-#define bCCKTxC7 0x3f00
-#define bCCKDebugPort 0xff0000
-#define bCCKDACDebug 0x0f000000
-#define bCCKFalseAlarmEnable 0x8000
-#define bCCKFalseAlarmRead 0x4000
-#define bCCKTRSSI 0x7f
-#define bCCKRxAGCReport 0xfe
-#define bCCKRxReport_AntSel 0x80000000
-#define bCCKRxReport_MFOff 0x40000000
-#define bCCKRxRxReport_SQLoss 0x20000000
-#define bCCKRxReport_Pktloss 0x10000000
-#define bCCKRxReport_Lockedbit 0x08000000
-#define bCCKRxReport_RateError 0x04000000
-#define bCCKRxReport_RxRate 0x03000000
-#define bCCKRxFACounterLower 0xff
-#define bCCKRxFACounterUpper 0xff000000
-#define bCCKRxHPAGCStart 0xe000
-#define bCCKRxHPAGCFinal 0x1c00
-#define bCCKRxFalseAlarmEnable 0x8000
-#define bCCKFACounterFreeze 0x4000
-#define bCCKTxPathSel 0x10000000
-#define bCCKDefaultRxPath 0xc000000
-#define bCCKOptionRxPath 0x3000000
-
-// 5. PageC(0xC00)
-#define bNumOfSTF 0x3 // Useless
-#define bShift_L 0xc0
-#define bGI_TH 0xc
-#define bRxPathA 0x1
-#define bRxPathB 0x2
-#define bRxPathC 0x4
-#define bRxPathD 0x8
-#define bTxPathA 0x1
-#define bTxPathB 0x2
-#define bTxPathC 0x4
-#define bTxPathD 0x8
-#define bTRSSIFreq 0x200
-#define bADCBackoff 0x3000
-#define bDFIRBackoff 0xc000
-#define bTRSSILatchPhase 0x10000
-#define bRxIDCOffset 0xff
-#define bRxQDCOffset 0xff00
-#define bRxDFIRMode 0x1800000
-#define bRxDCNFType 0xe000000
-#define bRXIQImb_A 0x3ff
-#define bRXIQImb_B 0xfc00
-#define bRXIQImb_C 0x3f0000
-#define bRXIQImb_D 0xffc00000
-#define bDC_dc_Notch 0x60000
-#define bRxNBINotch 0x1f000000
-#define bPD_TH 0xf
-#define bPD_TH_Opt2 0xc000
-#define bPWED_TH 0x700
-#define bIfMF_Win_L 0x800
-#define bPD_Option 0x1000
-#define bMF_Win_L 0xe000
-#define bBW_Search_L 0x30000
-#define bwin_enh_L 0xc0000
-#define bBW_TH 0x700000
-#define bED_TH2 0x3800000
-#define bBW_option 0x4000000
-#define bRatio_TH 0x18000000
-#define bWindow_L 0xe0000000
-#define bSBD_Option 0x1
-#define bFrame_TH 0x1c
-#define bFS_Option 0x60
-#define bDC_Slope_check 0x80
-#define bFGuard_Counter_DC_L 0xe00
-#define bFrame_Weight_Short 0x7000
-#define bSub_Tune 0xe00000
-#define bFrame_DC_Length 0xe000000
-#define bSBD_start_offset 0x30000000
-#define bFrame_TH_2 0x7
-#define bFrame_GI2_TH 0x38
-#define bGI2_Sync_en 0x40
-#define bSarch_Short_Early 0x300
-#define bSarch_Short_Late 0xc00
-#define bSarch_GI2_Late 0x70000
-#define bCFOAntSum 0x1
-#define bCFOAcc 0x2
-#define bCFOStartOffset 0xc
-#define bCFOLookBack 0x70
-#define bCFOSumWeight 0x80
-#define bDAGCEnable 0x10000
-#define bTXIQImb_A 0x3ff
-#define bTXIQImb_B 0xfc00
-#define bTXIQImb_C 0x3f0000
-#define bTXIQImb_D 0xffc00000
-#define bTxIDCOffset 0xff
-#define bTxQDCOffset 0xff00
-#define bTxDFIRMode 0x10000
-#define bTxPesudoNoiseOn 0x4000000
-#define bTxPesudoNoise_A 0xff
-#define bTxPesudoNoise_B 0xff00
-#define bTxPesudoNoise_C 0xff0000
-#define bTxPesudoNoise_D 0xff000000
-#define bCCADropOption 0x20000
-#define bCCADropThres 0xfff00000
-#define bEDCCA_H 0xf
-#define bEDCCA_L 0xf0
-#define bLambda_ED 0x300
-#define bRxInitialGain 0x7f
-#define bRxAntDivEn 0x80
-#define bRxAGCAddressForLNA 0x7f00
-#define bRxHighPowerFlow 0x8000
-#define bRxAGCFreezeThres 0xc0000
-#define bRxFreezeStep_AGC1 0x300000
-#define bRxFreezeStep_AGC2 0xc00000
-#define bRxFreezeStep_AGC3 0x3000000
-#define bRxFreezeStep_AGC0 0xc000000
-#define bRxRssi_Cmp_En 0x10000000
-#define bRxQuickAGCEn 0x20000000
-#define bRxAGCFreezeThresMode 0x40000000
-#define bRxOverFlowCheckType 0x80000000
-#define bRxAGCShift 0x7f
-#define bTRSW_Tri_Only 0x80
-#define bPowerThres 0x300
-#define bRxAGCEn 0x1
-#define bRxAGCTogetherEn 0x2
-#define bRxAGCMin 0x4
-#define bRxHP_Ini 0x7
-#define bRxHP_TRLNA 0x70
-#define bRxHP_RSSI 0x700
-#define bRxHP_BBP1 0x7000
-#define bRxHP_BBP2 0x70000
-#define bRxHP_BBP3 0x700000
-#define bRSSI_H 0x7f0000 //the threshold for high power
-#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity
-#define bRxSettle_TRSW 0x7
-#define bRxSettle_LNA 0x38
-#define bRxSettle_RSSI 0x1c0
-#define bRxSettle_BBP 0xe00
-#define bRxSettle_RxHP 0x7000
-#define bRxSettle_AntSW_RSSI 0x38000
-#define bRxSettle_AntSW 0xc0000
-#define bRxProcessTime_DAGC 0x300000
-#define bRxSettle_HSSI 0x400000
-#define bRxProcessTime_BBPPW 0x800000
-#define bRxAntennaPowerShift 0x3000000
-#define bRSSITableSelect 0xc000000
-#define bRxHP_Final 0x7000000
-#define bRxHTSettle_BBP 0x7
-#define bRxHTSettle_HSSI 0x8
-#define bRxHTSettle_RxHP 0x70
-#define bRxHTSettle_BBPPW 0x80
-#define bRxHTSettle_Idle 0x300
-#define bRxHTSettle_Reserved 0x1c00
-#define bRxHTRxHPEn 0x8000
-#define bRxHTAGCFreezeThres 0x30000
-#define bRxHTAGCTogetherEn 0x40000
-#define bRxHTAGCMin 0x80000
-#define bRxHTAGCEn 0x100000
-#define bRxHTDAGCEn 0x200000
-#define bRxHTRxHP_BBP 0x1c00000
-#define bRxHTRxHP_Final 0xe0000000
-#define bRxPWRatioTH 0x3
-#define bRxPWRatioEn 0x4
-#define bRxMFHold 0x3800
-#define bRxPD_Delay_TH1 0x38
-#define bRxPD_Delay_TH2 0x1c0
-#define bRxPD_DC_COUNT_MAX 0x600
-//#define bRxMF_Hold 0x3800
-#define bRxPD_Delay_TH 0x8000
-#define bRxProcess_Delay 0xf0000
-#define bRxSearchrange_GI2_Early 0x700000
-#define bRxFrame_Guard_Counter_L 0x3800000
-#define bRxSGI_Guard_L 0xc000000
-#define bRxSGI_Search_L 0x30000000
-#define bRxSGI_TH 0xc0000000
-#define bDFSCnt0 0xff
-#define bDFSCnt1 0xff00
-#define bDFSFlag 0xf0000
-#define bMFWeightSum 0x300000
-#define bMinIdxTH 0x7f000000
-#define bDAFormat 0x40000
-#define bTxChEmuEnable 0x01000000
-#define bTRSWIsolation_A 0x7f
-#define bTRSWIsolation_B 0x7f00
-#define bTRSWIsolation_C 0x7f0000
-#define bTRSWIsolation_D 0x7f000000
-#define bExtLNAGain 0x7c00
-
-// 6. PageE(0xE00)
-#define bSTBCEn 0x4 // Useless
-#define bAntennaMapping 0x10
-#define bNss 0x20
-#define bCFOAntSumD 0x200
-#define bPHYCounterReset 0x8000000
-#define bCFOReportGet 0x4000000
-#define bOFDMContinueTx 0x10000000
-#define bOFDMSingleCarrier 0x20000000
-#define bOFDMSingleTone 0x40000000
-//#define bRxPath1 0x01
-//#define bRxPath2 0x02
-//#define bRxPath3 0x04
-//#define bRxPath4 0x08
-//#define bTxPath1 0x10
-//#define bTxPath2 0x20
-#define bHTDetect 0x100
-#define bCFOEn 0x10000
-#define bCFOValue 0xfff00000
-#define bSigTone_Re 0x3f
-#define bSigTone_Im 0x7f00
-#define bCounter_CCA 0xffff
-#define bCounter_ParityFail 0xffff0000
-#define bCounter_RateIllegal 0xffff
-#define bCounter_CRC8Fail 0xffff0000
-#define bCounter_MCSNoSupport 0xffff
-#define bCounter_FastSync 0xffff
-#define bShortCFO 0xfff
-#define bShortCFOTLength 12 //total
-#define bShortCFOFLength 11 //fraction
-#define bLongCFO 0x7ff
-#define bLongCFOTLength 11
-#define bLongCFOFLength 11
-#define bTailCFO 0x1fff
-#define bTailCFOTLength 13
-#define bTailCFOFLength 12
-#define bmax_en_pwdB 0xffff
-#define bCC_power_dB 0xffff0000
-#define bnoise_pwdB 0xffff
-#define bPowerMeasTLength 10
-#define bPowerMeasFLength 3
-#define bRx_HT_BW 0x1
-#define bRxSC 0x6
-#define bRx_HT 0x8
-#define bNB_intf_det_on 0x1
-#define bIntf_win_len_cfg 0x30
-#define bNB_Intf_TH_cfg 0x1c0
-#define bRFGain 0x3f
-#define bTableSel 0x40
-#define bTRSW 0x80
-#define bRxSNR_A 0xff
-#define bRxSNR_B 0xff00
-#define bRxSNR_C 0xff0000
-#define bRxSNR_D 0xff000000
-#define bSNREVMTLength 8
-#define bSNREVMFLength 1
-#define bCSI1st 0xff
-#define bCSI2nd 0xff00
-#define bRxEVM1st 0xff0000
-#define bRxEVM2nd 0xff000000
-#define bSIGEVM 0xff
-#define bPWDB 0xff00
-#define bSGIEN 0x10000
-
-#define bSFactorQAM1 0xf // Useless
-#define bSFactorQAM2 0xf0
-#define bSFactorQAM3 0xf00
-#define bSFactorQAM4 0xf000
-#define bSFactorQAM5 0xf0000
-#define bSFactorQAM6 0xf0000
-#define bSFactorQAM7 0xf00000
-#define bSFactorQAM8 0xf000000
-#define bSFactorQAM9 0xf0000000
-#define bCSIScheme 0x100000
-
-#define bNoiseLvlTopSet 0x3 // Useless
-#define bChSmooth 0x4
-#define bChSmoothCfg1 0x38
-#define bChSmoothCfg2 0x1c0
-#define bChSmoothCfg3 0xe00
-#define bChSmoothCfg4 0x7000
-#define bMRCMode 0x800000
-#define bTHEVMCfg 0x7000000
-
-#define bLoopFitType 0x1 // Useless
-#define bUpdCFO 0x40
-#define bUpdCFOOffData 0x80
-#define bAdvUpdCFO 0x100
-#define bAdvTimeCtrl 0x800
-#define bUpdClko 0x1000
-#define bFC 0x6000
-#define bTrackingMode 0x8000
-#define bPhCmpEnable 0x10000
-#define bUpdClkoLTF 0x20000
-#define bComChCFO 0x40000
-#define bCSIEstiMode 0x80000
-#define bAdvUpdEqz 0x100000
-#define bUChCfg 0x7000000
-#define bUpdEqz 0x8000000
-
-//Rx Pseduo noise
-#define bRxPesudoNoiseOn 0x20000000 // Useless
-#define bRxPesudoNoise_A 0xff
-#define bRxPesudoNoise_B 0xff00
-#define bRxPesudoNoise_C 0xff0000
-#define bRxPesudoNoise_D 0xff000000
-#define bPesudoNoiseState_A 0xffff
-#define bPesudoNoiseState_B 0xffff0000
-#define bPesudoNoiseState_C 0xffff
-#define bPesudoNoiseState_D 0xffff0000
-
-//7. RF Register
-//Zebra1
-#define bZebra1_HSSIEnable 0x8 // Useless
-#define bZebra1_TRxControl 0xc00
-#define bZebra1_TRxGainSetting 0x07f
-#define bZebra1_RxCorner 0xc00
-#define bZebra1_TxChargePump 0x38
-#define bZebra1_RxChargePump 0x7
-#define bZebra1_ChannelNum 0xf80
-#define bZebra1_TxLPFBW 0x400
-#define bZebra1_RxLPFBW 0x600
-
-//Zebra4
-#define bRTL8256RegModeCtrl1 0x100 // Useless
-#define bRTL8256RegModeCtrl0 0x40
-#define bRTL8256_TxLPFBW 0x18
-#define bRTL8256_RxLPFBW 0x600
-
-//RTL8258
-#define bRTL8258_TxLPFBW 0xc // Useless
-#define bRTL8258_RxLPFBW 0xc00
-#define bRTL8258_RSSILPFBW 0xc0
-
-
-//
-// Other Definition
-//
-
-//byte endable for sb_write
-#define bByte0 0x1 // Useless
-#define bByte1 0x2
-#define bByte2 0x4
-#define bByte3 0x8
-#define bWord0 0x3
-#define bWord1 0xc
-#define bDWord 0xf
-
-//for PutRegsetting & GetRegSetting BitMask
-#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f
-#define bMaskByte1 0xff00
-#define bMaskByte2 0xff0000
-#define bMaskByte3 0xff000000
-#define bMaskHWord 0xffff0000
-#define bMaskLWord 0x0000ffff
-#define bMaskDWord 0xffffffff
-#define bMask12Bits 0xfff
-#define bMaskH4Bits 0xf0000000
-#define bMaskOFDM_D 0xffc00000
-#define bMaskCCK 0x3f3f3f3f
-
-
-
-#define bEnable 0x1 // Useless
-#define bDisable 0x0
-
-#define LeftAntenna 0x0 // Useless
-#define RightAntenna 0x1
-
-#define tCheckTxStatus 500 //500ms // Useless
-#define tUpdateRxCounter 100 //100ms
-
-#define rateCCK 0 // Useless
-#define rateOFDM 1
-#define rateHT 2
-
-//define Register-End
-#define bPMAC_End 0x1ff // Useless
-#define bFPGAPHY0_End 0x8ff
-#define bFPGAPHY1_End 0x9ff
-#define bCCKPHY0_End 0xaff
-#define bOFDMPHY0_End 0xcff
-#define bOFDMPHY1_End 0xdff
-
-//define max debug item in each debug page
-//#define bMaxItem_FPGA_PHY0 0x9
-//#define bMaxItem_FPGA_PHY1 0x3
-//#define bMaxItem_PHY_11B 0x16
-//#define bMaxItem_OFDM_PHY0 0x29
-//#define bMaxItem_OFDM_PHY1 0x0
-
-#define bPMACControl 0x0 // Useless
-#define bWMACControl 0x1
-#define bWNICControl 0x2
-
-#define PathA 0x0 // Useless
-#define PathB 0x1
-#define PathC 0x2
-#define PathD 0x3
-
-/*--------------------------Define Parameters-------------------------------*/
-
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8188EPHYREG_H__
+#define __INC_HAL8188EPHYREG_H__
+/*--------------------------Define Parameters-------------------------------*/
+//
+// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF
+// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
+// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00
+// 3. RF register 0x00-2E
+// 4. Bit Mask for BB/RF register
+// 5. Other defintion for BB/RF R/W
+//
+
+
+//
+// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
+// 1. Page1(0x100)
+//
+#define rPMAC_Reset 0x100
+#define rPMAC_TxStart 0x104
+#define rPMAC_TxLegacySIG 0x108
+#define rPMAC_TxHTSIG1 0x10c
+#define rPMAC_TxHTSIG2 0x110
+#define rPMAC_PHYDebug 0x114
+#define rPMAC_TxPacketNum 0x118
+#define rPMAC_TxIdle 0x11c
+#define rPMAC_TxMACHeader0 0x120
+#define rPMAC_TxMACHeader1 0x124
+#define rPMAC_TxMACHeader2 0x128
+#define rPMAC_TxMACHeader3 0x12c
+#define rPMAC_TxMACHeader4 0x130
+#define rPMAC_TxMACHeader5 0x134
+#define rPMAC_TxDataType 0x138
+#define rPMAC_TxRandomSeed 0x13c
+#define rPMAC_CCKPLCPPreamble 0x140
+#define rPMAC_CCKPLCPHeader 0x144
+#define rPMAC_CCKCRC16 0x148
+#define rPMAC_OFDMRxCRC32OK 0x170
+#define rPMAC_OFDMRxCRC32Er 0x174
+#define rPMAC_OFDMRxParityEr 0x178
+#define rPMAC_OFDMRxCRC8Er 0x17c
+#define rPMAC_CCKCRxRC16Er 0x180
+#define rPMAC_CCKCRxRC32Er 0x184
+#define rPMAC_CCKCRxRC32OK 0x188
+#define rPMAC_TxStatus 0x18c
+
+//
+// 2. Page2(0x200)
+//
+// The following two definition are only used for USB interface.
+#define RF_BB_CMD_ADDR 0x02c0 // RF/BB read/write command address.
+#define RF_BB_CMD_DATA 0x02c4 // RF/BB read/write command data.
+
+//
+// 3. Page8(0x800)
+//
+#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting??
+
+#define rFPGA0_TxInfo 0x804 // Status report??
+#define rFPGA0_PSDFunction 0x808
+
+#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain?
+
+#define rFPGA0_RFTiming1 0x810 // Useless now
+#define rFPGA0_RFTiming2 0x814
+
+#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register
+#define rFPGA0_XA_HSSIParameter2 0x824
+#define rFPGA0_XB_HSSIParameter1 0x828
+#define rFPGA0_XB_HSSIParameter2 0x82c
+
+#define rFPGA0_XA_LSSIParameter 0x840
+#define rFPGA0_XB_LSSIParameter 0x844
+
+#define rFPGA0_RFWakeUpParameter 0x850 // Useless now
+#define rFPGA0_RFSleepUpParameter 0x854
+
+#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch
+#define rFPGA0_XCD_SwitchControl 0x85c
+
+#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch
+#define rFPGA0_XB_RFInterfaceOE 0x864
+#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control
+#define rFPGA0_XCD_RFInterfaceSW 0x874
+
+#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter
+#define rFPGA0_XCD_RFParameter 0x87c
+
+#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4??
+#define rFPGA0_AnalogParameter2 0x884
+#define rFPGA0_AnalogParameter3 0x888
+#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy
+#define rFPGA0_AnalogParameter4 0x88c
+
+#define rFPGA0_XA_LSSIReadBack 0x8a0 // Tranceiver LSSI Readback
+#define rFPGA0_XB_LSSIReadBack 0x8a4
+#define rFPGA0_XC_LSSIReadBack 0x8a8
+#define rFPGA0_XD_LSSIReadBack 0x8ac
+
+#define rFPGA0_PSDReport 0x8b4 // Useless now
+#define TransceiverA_HSPI_Readback 0x8b8 // Transceiver A HSPI Readback
+#define TransceiverB_HSPI_Readback 0x8bc // Transceiver B HSPI Readback
+#define rFPGA0_XAB_RFInterfaceRB 0x8e0 // Useless now // RF Interface Readback Value
+#define rFPGA0_XCD_RFInterfaceRB 0x8e4 // Useless now
+
+//
+// 4. Page9(0x900)
+//
+#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting??
+
+#define rFPGA1_TxBlock 0x904 // Useless now
+#define rFPGA1_DebugSelect 0x908 // Useless now
+#define rFPGA1_TxInfo 0x90c // Useless now // Status report??
+
+//
+// 5. PageA(0xA00)
+//
+// Set Control channel to upper or lower. These settings are required only for 40MHz
+#define rCCK0_System 0xa00
+
+#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI
+#define rCCK0_CCA 0xa08 // Disable init gain now // Init gain
+
+#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series
+#define rCCK0_RxAGC2 0xa10 //AGC & DAGC
+
+#define rCCK0_RxHP 0xa14
+
+#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold
+#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
+#define rCCK0_TRSSIReport 0xa50
+#define rCCK0_RxReport 0xa54 //0xa57
+#define rCCK0_FACounterLower 0xa5c //0xa5b
+#define rCCK0_FACounterUpper 0xa58 //0xa5c
+
+//
+// PageB(0xB00)
+//
+#define rPdp_AntA 0xb00
+#define rPdp_AntA_4 0xb04
+#define rConfig_Pmpd_AntA 0xb28
+#define rConfig_ram64x16 0xb2c
+#define rConfig_AntA 0xb68
+#define rConfig_AntB 0xb6c
+#define rPdp_AntB 0xb70
+#define rPdp_AntB_4 0xb74
+#define rConfig_Pmpd_AntB 0xb98
+#define rAPK 0xbd8
+
+
+
+//
+// 6. PageC(0xC00)
+//
+#define rOFDM0_LSTF 0xc00
+
+#define rOFDM0_TRxPathEnable 0xc04
+#define rOFDM0_TRMuxPar 0xc08
+#define rOFDM0_TRSWIsolation 0xc0c
+
+#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter
+#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix
+#define rOFDM0_XBRxAFE 0xc18
+#define rOFDM0_XBRxIQImbalance 0xc1c
+#define rOFDM0_XCRxAFE 0xc20
+#define rOFDM0_XCRxIQImbalance 0xc24
+#define rOFDM0_XDRxAFE 0xc28
+#define rOFDM0_XDRxIQImbalance 0xc2c
+
+#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain
+#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync.
+#define rOFDM0_RxDetector3 0xc38 //Frame Sync.
+#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI
+
+#define rOFDM0_RxDSP 0xc40 //Rx Sync Path
+#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC
+#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold
+#define rOFDM0_ECCAThreshold 0xc4c // energy CCA
+
+#define rOFDM0_XAAGCCore1 0xc50 // DIG
+#define rOFDM0_XAAGCCore2 0xc54
+#define rOFDM0_XBAGCCore1 0xc58
+#define rOFDM0_XBAGCCore2 0xc5c
+#define rOFDM0_XCAGCCore1 0xc60
+#define rOFDM0_XCAGCCore2 0xc64
+#define rOFDM0_XDAGCCore1 0xc68
+#define rOFDM0_XDAGCCore2 0xc6c
+
+#define rOFDM0_AGCParameter1 0xc70
+#define rOFDM0_AGCParameter2 0xc74
+#define rOFDM0_AGCRSSITable 0xc78
+#define rOFDM0_HTSTFAGC 0xc7c
+
+#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG
+#define rOFDM0_XATxAFE 0xc84
+#define rOFDM0_XBTxIQImbalance 0xc88
+#define rOFDM0_XBTxAFE 0xc8c
+#define rOFDM0_XCTxIQImbalance 0xc90
+#define rOFDM0_XCTxAFE 0xc94
+#define rOFDM0_XDTxIQImbalance 0xc98
+#define rOFDM0_XDTxAFE 0xc9c
+
+#define rOFDM0_RxIQExtAnta 0xca0
+#define rOFDM0_TxCoeff1 0xca4
+#define rOFDM0_TxCoeff2 0xca8
+#define rOFDM0_TxCoeff3 0xcac
+#define rOFDM0_TxCoeff4 0xcb0
+#define rOFDM0_TxCoeff5 0xcb4
+#define rOFDM0_TxCoeff6 0xcb8
+#define rOFDM0_RxHPParameter 0xce0
+#define rOFDM0_TxPseudoNoiseWgt 0xce4
+#define rOFDM0_FrameSync 0xcf0
+#define rOFDM0_DFSReport 0xcf4
+
+
+//
+// 7. PageD(0xD00)
+//
+#define rOFDM1_LSTF 0xd00
+#define rOFDM1_TRxPathEnable 0xd04
+
+#define rOFDM1_CFO 0xd08 // No setting now
+#define rOFDM1_CSI1 0xd10
+#define rOFDM1_SBD 0xd14
+#define rOFDM1_CSI2 0xd18
+#define rOFDM1_CFOTracking 0xd2c
+#define rOFDM1_TRxMesaure1 0xd34
+#define rOFDM1_IntfDet 0xd3c
+#define rOFDM1_csi_fix_mask1 0xd40
+#define rOFDM1_csi_fix_mask2 0xd44
+#define rOFDM1_PseudoNoiseStateAB 0xd50
+#define rOFDM1_PseudoNoiseStateCD 0xd54
+#define rOFDM1_RxPseudoNoiseWgt 0xd58
+
+#define rOFDM_PHYCounter1 0xda0 //cca, parity fail
+#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail
+#define rOFDM_PHYCounter3 0xda8 //MCS not support
+
+#define rOFDM_ShortCFOAB 0xdac // No setting now
+#define rOFDM_ShortCFOCD 0xdb0
+#define rOFDM_LongCFOAB 0xdb4
+#define rOFDM_LongCFOCD 0xdb8
+#define rOFDM_TailCFOAB 0xdbc
+#define rOFDM_TailCFOCD 0xdc0
+#define rOFDM_PWMeasure1 0xdc4
+#define rOFDM_PWMeasure2 0xdc8
+#define rOFDM_BWReport 0xdcc
+#define rOFDM_AGCReport 0xdd0
+#define rOFDM_RxSNR 0xdd4
+#define rOFDM_RxEVMCSI 0xdd8
+#define rOFDM_SIGReport 0xddc
+
+
+//
+// 8. PageE(0xE00)
+//
+#define rTxAGC_A_Rate18_06 0xe00
+#define rTxAGC_A_Rate54_24 0xe04
+#define rTxAGC_A_CCK1_Mcs32 0xe08
+#define rTxAGC_A_Mcs03_Mcs00 0xe10
+#define rTxAGC_A_Mcs07_Mcs04 0xe14
+#define rTxAGC_A_Mcs11_Mcs08 0xe18
+#define rTxAGC_A_Mcs15_Mcs12 0xe1c
+
+#define rTxAGC_B_Rate18_06 0x830
+#define rTxAGC_B_Rate54_24 0x834
+#define rTxAGC_B_CCK1_55_Mcs32 0x838
+#define rTxAGC_B_Mcs03_Mcs00 0x83c
+#define rTxAGC_B_Mcs07_Mcs04 0x848
+#define rTxAGC_B_Mcs11_Mcs08 0x84c
+#define rTxAGC_B_Mcs15_Mcs12 0x868
+#define rTxAGC_B_CCK11_A_CCK2_11 0x86c
+
+#define rFPGA0_IQK 0xe28
+#define rTx_IQK_Tone_A 0xe30
+#define rRx_IQK_Tone_A 0xe34
+#define rTx_IQK_PI_A 0xe38
+#define rRx_IQK_PI_A 0xe3c
+
+#define rTx_IQK 0xe40
+#define rRx_IQK 0xe44
+#define rIQK_AGC_Pts 0xe48
+#define rIQK_AGC_Rsp 0xe4c
+#define rTx_IQK_Tone_B 0xe50
+#define rRx_IQK_Tone_B 0xe54
+#define rTx_IQK_PI_B 0xe58
+#define rRx_IQK_PI_B 0xe5c
+#define rIQK_AGC_Cont 0xe60
+
+#define rBlue_Tooth 0xe6c
+#define rRx_Wait_CCA 0xe70
+#define rTx_CCK_RFON 0xe74
+#define rTx_CCK_BBON 0xe78
+#define rTx_OFDM_RFON 0xe7c
+#define rTx_OFDM_BBON 0xe80
+#define rTx_To_Rx 0xe84
+#define rTx_To_Tx 0xe88
+#define rRx_CCK 0xe8c
+
+#define rTx_Power_Before_IQK_A 0xe94
+#define rTx_Power_After_IQK_A 0xe9c
+
+#define rRx_Power_Before_IQK_A 0xea0
+#define rRx_Power_Before_IQK_A_2 0xea4
+#define rRx_Power_After_IQK_A 0xea8
+#define rRx_Power_After_IQK_A_2 0xeac
+
+#define rTx_Power_Before_IQK_B 0xeb4
+#define rTx_Power_After_IQK_B 0xebc
+
+#define rRx_Power_Before_IQK_B 0xec0
+#define rRx_Power_Before_IQK_B_2 0xec4
+#define rRx_Power_After_IQK_B 0xec8
+#define rRx_Power_After_IQK_B_2 0xecc
+
+#define rRx_OFDM 0xed0
+#define rRx_Wait_RIFS 0xed4
+#define rRx_TO_Rx 0xed8
+#define rStandby 0xedc
+#define rSleep 0xee0
+#define rPMPD_ANAEN 0xeec
+
+//
+// 7. RF Register 0x00-0x2E (RF 8256)
+// RF-0222D 0x00-3F
+//
+//Zebra1
+#define rZebra1_HSSIEnable 0x0 // Useless now
+#define rZebra1_TRxEnable1 0x1
+#define rZebra1_TRxEnable2 0x2
+#define rZebra1_AGC 0x4
+#define rZebra1_ChargePump 0x5
+#define rZebra1_Channel 0x7 // RF channel switch
+
+//#endif
+#define rZebra1_TxGain 0x8 // Useless now
+#define rZebra1_TxLPF 0x9
+#define rZebra1_RxLPF 0xb
+#define rZebra1_RxHPFCorner 0xc
+
+//Zebra4
+#define rGlobalCtrl 0 // Useless now
+#define rRTL8256_TxLPF 19
+#define rRTL8256_RxLPF 11
+
+//RTL8258
+#define rRTL8258_TxLPF 0x11 // Useless now
+#define rRTL8258_RxLPF 0x13
+#define rRTL8258_RSSILPF 0xa
+
+//
+// RL6052 Register definition
+//
+#define RF_AC 0x00 //
+
+#define RF_IQADJ_G1 0x01 //
+#define RF_IQADJ_G2 0x02 //
+
+#define RF_POW_TRSW 0x05 //
+
+#define RF_GAIN_RX 0x06 //
+#define RF_GAIN_TX 0x07 //
+
+#define RF_TXM_IDAC 0x08 //
+#define RF_IPA_G 0x09 //
+#define RF_TXBIAS_G 0x0A
+#define RF_TXPA_AG 0x0B
+#define RF_IPA_A 0x0C //
+#define RF_TXBIAS_A 0x0D
+#define RF_BS_PA_APSET_G9_G11 0x0E
+#define RF_BS_IQGEN 0x0F //
+
+#define RF_MODE1 0x10 //
+#define RF_MODE2 0x11 //
+
+#define RF_RX_AGC_HP 0x12 //
+#define RF_TX_AGC 0x13 //
+#define RF_BIAS 0x14 //
+#define RF_IPA 0x15 //
+#define RF_TXBIAS 0x16
+#define RF_POW_ABILITY 0x17 //
+#define RF_CHNLBW 0x18 // RF channel and BW switch
+#define RF_TOP 0x19 //
+
+#define RF_RX_G1 0x1A //
+#define RF_RX_G2 0x1B //
+
+#define RF_RX_BB2 0x1C //
+#define RF_RX_BB1 0x1D //
+
+#define RF_RCK1 0x1E //
+#define RF_RCK2 0x1F //
+
+#define RF_TX_G1 0x20 //
+#define RF_TX_G2 0x21 //
+#define RF_TX_G3 0x22 //
+
+#define RF_TX_BB1 0x23 //
+
+//#if HARDWARE_TYPE_IS_RTL8192D == 1
+#define RF_T_METER_92D 0x42 //
+//#else
+#define RF_T_METER_88E 0x42 //
+#define RF_T_METER 0x24 //
+
+//#endif
+
+#define RF_SYN_G1 0x25 // RF TX Power control
+#define RF_SYN_G2 0x26 // RF TX Power control
+#define RF_SYN_G3 0x27 // RF TX Power control
+#define RF_SYN_G4 0x28 // RF TX Power control
+#define RF_SYN_G5 0x29 // RF TX Power control
+#define RF_SYN_G6 0x2A // RF TX Power control
+#define RF_SYN_G7 0x2B // RF TX Power control
+#define RF_SYN_G8 0x2C // RF TX Power control
+
+#define RF_RCK_OS 0x30 // RF TX PA control
+#define RF_TXPA_G1 0x31 // RF TX PA control
+#define RF_TXPA_G2 0x32 // RF TX PA control
+#define RF_TXPA_G3 0x33 // RF TX PA control
+#define RF_TX_BIAS_A 0x35
+#define RF_TX_BIAS_D 0x36
+#define RF_LOBF_9 0x38
+#define RF_RXRF_A3 0x3C //
+#define RF_TRSW 0x3F
+
+#define RF_TXRF_A2 0x41
+#define RF_TXPA_G4 0x46
+#define RF_TXPA_A4 0x4B
+#define RF_0x52 0x52
+#define RF_WE_LUT 0xEF
+
+
+//
+//Bit Mask
+//
+// 1. Page1(0x100)
+#define bBBResetB 0x100 // Useless now?
+#define bGlobalResetB 0x200
+#define bOFDMTxStart 0x4
+#define bCCKTxStart 0x8
+#define bCRC32Debug 0x100
+#define bPMACLoopback 0x10
+#define bTxLSIG 0xffffff
+#define bOFDMTxRate 0xf
+#define bOFDMTxReserved 0x10
+#define bOFDMTxLength 0x1ffe0
+#define bOFDMTxParity 0x20000
+#define bTxHTSIG1 0xffffff
+#define bTxHTMCSRate 0x7f
+#define bTxHTBW 0x80
+#define bTxHTLength 0xffff00
+#define bTxHTSIG2 0xffffff
+#define bTxHTSmoothing 0x1
+#define bTxHTSounding 0x2
+#define bTxHTReserved 0x4
+#define bTxHTAggreation 0x8
+#define bTxHTSTBC 0x30
+#define bTxHTAdvanceCoding 0x40
+#define bTxHTShortGI 0x80
+#define bTxHTNumberHT_LTF 0x300
+#define bTxHTCRC8 0x3fc00
+#define bCounterReset 0x10000
+#define bNumOfOFDMTx 0xffff
+#define bNumOfCCKTx 0xffff0000
+#define bTxIdleInterval 0xffff
+#define bOFDMService 0xffff0000
+#define bTxMACHeader 0xffffffff
+#define bTxDataInit 0xff
+#define bTxHTMode 0x100
+#define bTxDataType 0x30000
+#define bTxRandomSeed 0xffffffff
+#define bCCKTxPreamble 0x1
+#define bCCKTxSFD 0xffff0000
+#define bCCKTxSIG 0xff
+#define bCCKTxService 0xff00
+#define bCCKLengthExt 0x8000
+#define bCCKTxLength 0xffff0000
+#define bCCKTxCRC16 0xffff
+#define bCCKTxStatus 0x1
+#define bOFDMTxStatus 0x2
+
+#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff))
+
+// 2. Page8(0x800)
+#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD
+#define bJapanMode 0x2
+#define bCCKTxSC 0x30
+#define bCCKEn 0x1000000
+#define bOFDMEn 0x2000000
+
+#define bOFDMRxADCPhase 0x10000 // Useless now
+#define bOFDMTxDACPhase 0x40000
+#define bXATxAGC 0x3f
+
+#define bAntennaSelect 0x0300
+
+#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage
+#define bXCTxAGC 0xf000
+#define bXDTxAGC 0xf0000
+
+#define bPAStart 0xf0000000 // Useless now
+#define bTRStart 0x00f00000
+#define bRFStart 0x0000f000
+#define bBBStart 0x000000f0
+#define bBBCCKStart 0x0000000f
+#define bPAEnd 0xf //Reg0x814
+#define bTREnd 0x0f000000
+#define bRFEnd 0x000f0000
+#define bCCAMask 0x000000f0 //T2R
+#define bR2RCCAMask 0x00000f00
+#define bHSSI_R2TDelay 0xf8000000
+#define bHSSI_T2RDelay 0xf80000
+#define bContTxHSSI 0x400 //chane gain at continue Tx
+#define bIGFromCCK 0x200
+#define bAGCAddress 0x3f
+#define bRxHPTx 0x7000
+#define bRxHPT2R 0x38000
+#define bRxHPCCKIni 0xc0000
+#define bAGCTxCode 0xc00000
+#define bAGCRxCode 0x300000
+
+#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1
+#define b3WireAddressLength 0x400
+
+#define b3WireRFPowerDown 0x1 // Useless now
+//#define bHWSISelect 0x8
+#define b5GPAPEPolarity 0x40000000
+#define b2GPAPEPolarity 0x80000000
+#define bRFSW_TxDefaultAnt 0x3
+#define bRFSW_TxOptionAnt 0x30
+#define bRFSW_RxDefaultAnt 0x300
+#define bRFSW_RxOptionAnt 0x3000
+#define bRFSI_3WireData 0x1
+#define bRFSI_3WireClock 0x2
+#define bRFSI_3WireLoad 0x4
+#define bRFSI_3WireRW 0x8
+#define bRFSI_3Wire 0xf
+
+#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW
+
+#define bRFSI_TRSW 0x20 // Useless now
+#define bRFSI_TRSWB 0x40
+#define bRFSI_ANTSW 0x100
+#define bRFSI_ANTSWB 0x200
+#define bRFSI_PAPE 0x400
+#define bRFSI_PAPE5G 0x800
+#define bBandSelect 0x1
+#define bHTSIG2_GI 0x80
+#define bHTSIG2_Smoothing 0x01
+#define bHTSIG2_Sounding 0x02
+#define bHTSIG2_Aggreaton 0x08
+#define bHTSIG2_STBC 0x30
+#define bHTSIG2_AdvCoding 0x40
+#define bHTSIG2_NumOfHTLTF 0x300
+#define bHTSIG2_CRC8 0x3fc
+#define bHTSIG1_MCS 0x7f
+#define bHTSIG1_BandWidth 0x80
+#define bHTSIG1_HTLength 0xffff
+#define bLSIG_Rate 0xf
+#define bLSIG_Reserved 0x10
+#define bLSIG_Length 0x1fffe
+#define bLSIG_Parity 0x20
+#define bCCKRxPhase 0x4
+
+#define bLSSIReadAddress 0x7f800000 // T65 RF
+
+#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal
+
+#define bLSSIReadBackData 0xfffff // T65 RF
+
+#define bLSSIReadOKFlag 0x1000 // Useless now
+#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz
+#define bRegulator0Standby 0x1
+#define bRegulatorPLLStandby 0x2
+#define bRegulator1Standby 0x4
+#define bPLLPowerUp 0x8
+#define bDPLLPowerUp 0x10
+#define bDA10PowerUp 0x20
+#define bAD7PowerUp 0x200
+#define bDA6PowerUp 0x2000
+#define bXtalPowerUp 0x4000
+#define b40MDClkPowerUP 0x8000
+#define bDA6DebugMode 0x20000
+#define bDA6Swing 0x380000
+
+#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ
+
+#define b80MClkDelay 0x18000000 // Useless
+#define bAFEWatchDogEnable 0x20000000
+
+#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap
+#define bXtalCap23 0x3
+#define bXtalCap92x 0x0f000000
+#define bXtalCap 0x0f000000
+
+#define bIntDifClkEnable 0x400 // Useless
+#define bExtSigClkEnable 0x800
+#define bBandgapMbiasPowerUp 0x10000
+#define bAD11SHGain 0xc0000
+#define bAD11InputRange 0x700000
+#define bAD11OPCurrent 0x3800000
+#define bIPathLoopback 0x4000000
+#define bQPathLoopback 0x8000000
+#define bAFELoopback 0x10000000
+#define bDA10Swing 0x7e0
+#define bDA10Reverse 0x800
+#define bDAClkSource 0x1000
+#define bAD7InputRange 0x6000
+#define bAD7Gain 0x38000
+#define bAD7OutputCMMode 0x40000
+#define bAD7InputCMMode 0x380000
+#define bAD7Current 0xc00000
+#define bRegulatorAdjust 0x7000000
+#define bAD11PowerUpAtTx 0x1
+#define bDA10PSAtTx 0x10
+#define bAD11PowerUpAtRx 0x100
+#define bDA10PSAtRx 0x1000
+#define bCCKRxAGCFormat 0x200
+#define bPSDFFTSamplepPoint 0xc000
+#define bPSDAverageNum 0x3000
+#define bIQPathControl 0xc00
+#define bPSDFreq 0x3ff
+#define bPSDAntennaPath 0x30
+#define bPSDIQSwitch 0x40
+#define bPSDRxTrigger 0x400000
+#define bPSDTxTrigger 0x80000000
+#define bPSDSineToneScale 0x7f000000
+#define bPSDReport 0xffff
+
+// 3. Page9(0x900)
+#define bOFDMTxSC 0x30000000 // Useless
+#define bCCKTxOn 0x1
+#define bOFDMTxOn 0x2
+#define bDebugPage 0xfff //reset debug page and also HWord, LWord
+#define bDebugItem 0xff //reset debug page and LWord
+#define bAntL 0x10
+#define bAntNonHT 0x100
+#define bAntHT1 0x1000
+#define bAntHT2 0x10000
+#define bAntHT1S1 0x100000
+#define bAntNonHTS1 0x1000000
+
+// 4. PageA(0xA00)
+#define bCCKBBMode 0x3 // Useless
+#define bCCKTxPowerSaving 0x80
+#define bCCKRxPowerSaving 0x40
+
+#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch
+
+#define bCCKScramble 0x8 // Useless
+#define bCCKAntDiversity 0x8000
+#define bCCKCarrierRecovery 0x4000
+#define bCCKTxRate 0x3000
+#define bCCKDCCancel 0x0800
+#define bCCKISICancel 0x0400
+#define bCCKMatchFilter 0x0200
+#define bCCKEqualizer 0x0100
+#define bCCKPreambleDetect 0x800000
+#define bCCKFastFalseCCA 0x400000
+#define bCCKChEstStart 0x300000
+#define bCCKCCACount 0x080000
+#define bCCKcs_lim 0x070000
+#define bCCKBistMode 0x80000000
+#define bCCKCCAMask 0x40000000
+#define bCCKTxDACPhase 0x4
+#define bCCKRxADCPhase 0x20000000 //r_rx_clk
+#define bCCKr_cp_mode0 0x0100
+#define bCCKTxDCOffset 0xf0
+#define bCCKRxDCOffset 0xf
+#define bCCKCCAMode 0xc000
+#define bCCKFalseCS_lim 0x3f00
+#define bCCKCS_ratio 0xc00000
+#define bCCKCorgBit_sel 0x300000
+#define bCCKPD_lim 0x0f0000
+#define bCCKNewCCA 0x80000000
+#define bCCKRxHPofIG 0x8000
+#define bCCKRxIG 0x7f00
+#define bCCKLNAPolarity 0x800000
+#define bCCKRx1stGain 0x7f0000
+#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity
+#define bCCKRxAGCSatLevel 0x1f000000
+#define bCCKRxAGCSatCount 0xe0
+#define bCCKRxRFSettle 0x1f //AGCsamp_dly
+#define bCCKFixedRxAGC 0x8000
+//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824
+#define bCCKAntennaPolarity 0x2000
+#define bCCKTxFilterType 0x0c00
+#define bCCKRxAGCReportType 0x0300
+#define bCCKRxDAGCEn 0x80000000
+#define bCCKRxDAGCPeriod 0x20000000
+#define bCCKRxDAGCSatLevel 0x1f000000
+#define bCCKTimingRecovery 0x800000
+#define bCCKTxC0 0x3f0000
+#define bCCKTxC1 0x3f000000
+#define bCCKTxC2 0x3f
+#define bCCKTxC3 0x3f00
+#define bCCKTxC4 0x3f0000
+#define bCCKTxC5 0x3f000000
+#define bCCKTxC6 0x3f
+#define bCCKTxC7 0x3f00
+#define bCCKDebugPort 0xff0000
+#define bCCKDACDebug 0x0f000000
+#define bCCKFalseAlarmEnable 0x8000
+#define bCCKFalseAlarmRead 0x4000
+#define bCCKTRSSI 0x7f
+#define bCCKRxAGCReport 0xfe
+#define bCCKRxReport_AntSel 0x80000000
+#define bCCKRxReport_MFOff 0x40000000
+#define bCCKRxRxReport_SQLoss 0x20000000
+#define bCCKRxReport_Pktloss 0x10000000
+#define bCCKRxReport_Lockedbit 0x08000000
+#define bCCKRxReport_RateError 0x04000000
+#define bCCKRxReport_RxRate 0x03000000
+#define bCCKRxFACounterLower 0xff
+#define bCCKRxFACounterUpper 0xff000000
+#define bCCKRxHPAGCStart 0xe000
+#define bCCKRxHPAGCFinal 0x1c00
+#define bCCKRxFalseAlarmEnable 0x8000
+#define bCCKFACounterFreeze 0x4000
+#define bCCKTxPathSel 0x10000000
+#define bCCKDefaultRxPath 0xc000000
+#define bCCKOptionRxPath 0x3000000
+
+// 5. PageC(0xC00)
+#define bNumOfSTF 0x3 // Useless
+#define bShift_L 0xc0
+#define bGI_TH 0xc
+#define bRxPathA 0x1
+#define bRxPathB 0x2
+#define bRxPathC 0x4
+#define bRxPathD 0x8
+#define bTxPathA 0x1
+#define bTxPathB 0x2
+#define bTxPathC 0x4
+#define bTxPathD 0x8
+#define bTRSSIFreq 0x200
+#define bADCBackoff 0x3000
+#define bDFIRBackoff 0xc000
+#define bTRSSILatchPhase 0x10000
+#define bRxIDCOffset 0xff
+#define bRxQDCOffset 0xff00
+#define bRxDFIRMode 0x1800000
+#define bRxDCNFType 0xe000000
+#define bRXIQImb_A 0x3ff
+#define bRXIQImb_B 0xfc00
+#define bRXIQImb_C 0x3f0000
+#define bRXIQImb_D 0xffc00000
+#define bDC_dc_Notch 0x60000
+#define bRxNBINotch 0x1f000000
+#define bPD_TH 0xf
+#define bPD_TH_Opt2 0xc000
+#define bPWED_TH 0x700
+#define bIfMF_Win_L 0x800
+#define bPD_Option 0x1000
+#define bMF_Win_L 0xe000
+#define bBW_Search_L 0x30000
+#define bwin_enh_L 0xc0000
+#define bBW_TH 0x700000
+#define bED_TH2 0x3800000
+#define bBW_option 0x4000000
+#define bRatio_TH 0x18000000
+#define bWindow_L 0xe0000000
+#define bSBD_Option 0x1
+#define bFrame_TH 0x1c
+#define bFS_Option 0x60
+#define bDC_Slope_check 0x80
+#define bFGuard_Counter_DC_L 0xe00
+#define bFrame_Weight_Short 0x7000
+#define bSub_Tune 0xe00000
+#define bFrame_DC_Length 0xe000000
+#define bSBD_start_offset 0x30000000
+#define bFrame_TH_2 0x7
+#define bFrame_GI2_TH 0x38
+#define bGI2_Sync_en 0x40
+#define bSarch_Short_Early 0x300
+#define bSarch_Short_Late 0xc00
+#define bSarch_GI2_Late 0x70000
+#define bCFOAntSum 0x1
+#define bCFOAcc 0x2
+#define bCFOStartOffset 0xc
+#define bCFOLookBack 0x70
+#define bCFOSumWeight 0x80
+#define bDAGCEnable 0x10000
+#define bTXIQImb_A 0x3ff
+#define bTXIQImb_B 0xfc00
+#define bTXIQImb_C 0x3f0000
+#define bTXIQImb_D 0xffc00000
+#define bTxIDCOffset 0xff
+#define bTxQDCOffset 0xff00
+#define bTxDFIRMode 0x10000
+#define bTxPesudoNoiseOn 0x4000000
+#define bTxPesudoNoise_A 0xff
+#define bTxPesudoNoise_B 0xff00
+#define bTxPesudoNoise_C 0xff0000
+#define bTxPesudoNoise_D 0xff000000
+#define bCCADropOption 0x20000
+#define bCCADropThres 0xfff00000
+#define bEDCCA_H 0xf
+#define bEDCCA_L 0xf0
+#define bLambda_ED 0x300
+#define bRxInitialGain 0x7f
+#define bRxAntDivEn 0x80
+#define bRxAGCAddressForLNA 0x7f00
+#define bRxHighPowerFlow 0x8000
+#define bRxAGCFreezeThres 0xc0000
+#define bRxFreezeStep_AGC1 0x300000
+#define bRxFreezeStep_AGC2 0xc00000
+#define bRxFreezeStep_AGC3 0x3000000
+#define bRxFreezeStep_AGC0 0xc000000
+#define bRxRssi_Cmp_En 0x10000000
+#define bRxQuickAGCEn 0x20000000
+#define bRxAGCFreezeThresMode 0x40000000
+#define bRxOverFlowCheckType 0x80000000
+#define bRxAGCShift 0x7f
+#define bTRSW_Tri_Only 0x80
+#define bPowerThres 0x300
+#define bRxAGCEn 0x1
+#define bRxAGCTogetherEn 0x2
+#define bRxAGCMin 0x4
+#define bRxHP_Ini 0x7
+#define bRxHP_TRLNA 0x70
+#define bRxHP_RSSI 0x700
+#define bRxHP_BBP1 0x7000
+#define bRxHP_BBP2 0x70000
+#define bRxHP_BBP3 0x700000
+#define bRSSI_H 0x7f0000 //the threshold for high power
+#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity
+#define bRxSettle_TRSW 0x7
+#define bRxSettle_LNA 0x38
+#define bRxSettle_RSSI 0x1c0
+#define bRxSettle_BBP 0xe00
+#define bRxSettle_RxHP 0x7000
+#define bRxSettle_AntSW_RSSI 0x38000
+#define bRxSettle_AntSW 0xc0000
+#define bRxProcessTime_DAGC 0x300000
+#define bRxSettle_HSSI 0x400000
+#define bRxProcessTime_BBPPW 0x800000
+#define bRxAntennaPowerShift 0x3000000
+#define bRSSITableSelect 0xc000000
+#define bRxHP_Final 0x7000000
+#define bRxHTSettle_BBP 0x7
+#define bRxHTSettle_HSSI 0x8
+#define bRxHTSettle_RxHP 0x70
+#define bRxHTSettle_BBPPW 0x80
+#define bRxHTSettle_Idle 0x300
+#define bRxHTSettle_Reserved 0x1c00
+#define bRxHTRxHPEn 0x8000
+#define bRxHTAGCFreezeThres 0x30000
+#define bRxHTAGCTogetherEn 0x40000
+#define bRxHTAGCMin 0x80000
+#define bRxHTAGCEn 0x100000
+#define bRxHTDAGCEn 0x200000
+#define bRxHTRxHP_BBP 0x1c00000
+#define bRxHTRxHP_Final 0xe0000000
+#define bRxPWRatioTH 0x3
+#define bRxPWRatioEn 0x4
+#define bRxMFHold 0x3800
+#define bRxPD_Delay_TH1 0x38
+#define bRxPD_Delay_TH2 0x1c0
+#define bRxPD_DC_COUNT_MAX 0x600
+//#define bRxMF_Hold 0x3800
+#define bRxPD_Delay_TH 0x8000
+#define bRxProcess_Delay 0xf0000
+#define bRxSearchrange_GI2_Early 0x700000
+#define bRxFrame_Guard_Counter_L 0x3800000
+#define bRxSGI_Guard_L 0xc000000
+#define bRxSGI_Search_L 0x30000000
+#define bRxSGI_TH 0xc0000000
+#define bDFSCnt0 0xff
+#define bDFSCnt1 0xff00
+#define bDFSFlag 0xf0000
+#define bMFWeightSum 0x300000
+#define bMinIdxTH 0x7f000000
+#define bDAFormat 0x40000
+#define bTxChEmuEnable 0x01000000
+#define bTRSWIsolation_A 0x7f
+#define bTRSWIsolation_B 0x7f00
+#define bTRSWIsolation_C 0x7f0000
+#define bTRSWIsolation_D 0x7f000000
+#define bExtLNAGain 0x7c00
+
+// 6. PageE(0xE00)
+#define bSTBCEn 0x4 // Useless
+#define bAntennaMapping 0x10
+#define bNss 0x20
+#define bCFOAntSumD 0x200
+#define bPHYCounterReset 0x8000000
+#define bCFOReportGet 0x4000000
+#define bOFDMContinueTx 0x10000000
+#define bOFDMSingleCarrier 0x20000000
+#define bOFDMSingleTone 0x40000000
+//#define bRxPath1 0x01
+//#define bRxPath2 0x02
+//#define bRxPath3 0x04
+//#define bRxPath4 0x08
+//#define bTxPath1 0x10
+//#define bTxPath2 0x20
+#define bHTDetect 0x100
+#define bCFOEn 0x10000
+#define bCFOValue 0xfff00000
+#define bSigTone_Re 0x3f
+#define bSigTone_Im 0x7f00
+#define bCounter_CCA 0xffff
+#define bCounter_ParityFail 0xffff0000
+#define bCounter_RateIllegal 0xffff
+#define bCounter_CRC8Fail 0xffff0000
+#define bCounter_MCSNoSupport 0xffff
+#define bCounter_FastSync 0xffff
+#define bShortCFO 0xfff
+#define bShortCFOTLength 12 //total
+#define bShortCFOFLength 11 //fraction
+#define bLongCFO 0x7ff
+#define bLongCFOTLength 11
+#define bLongCFOFLength 11
+#define bTailCFO 0x1fff
+#define bTailCFOTLength 13
+#define bTailCFOFLength 12
+#define bmax_en_pwdB 0xffff
+#define bCC_power_dB 0xffff0000
+#define bnoise_pwdB 0xffff
+#define bPowerMeasTLength 10
+#define bPowerMeasFLength 3
+#define bRx_HT_BW 0x1
+#define bRxSC 0x6
+#define bRx_HT 0x8
+#define bNB_intf_det_on 0x1
+#define bIntf_win_len_cfg 0x30
+#define bNB_Intf_TH_cfg 0x1c0
+#define bRFGain 0x3f
+#define bTableSel 0x40
+#define bTRSW 0x80
+#define bRxSNR_A 0xff
+#define bRxSNR_B 0xff00
+#define bRxSNR_C 0xff0000
+#define bRxSNR_D 0xff000000
+#define bSNREVMTLength 8
+#define bSNREVMFLength 1
+#define bCSI1st 0xff
+#define bCSI2nd 0xff00
+#define bRxEVM1st 0xff0000
+#define bRxEVM2nd 0xff000000
+#define bSIGEVM 0xff
+#define bPWDB 0xff00
+#define bSGIEN 0x10000
+
+#define bSFactorQAM1 0xf // Useless
+#define bSFactorQAM2 0xf0
+#define bSFactorQAM3 0xf00
+#define bSFactorQAM4 0xf000
+#define bSFactorQAM5 0xf0000
+#define bSFactorQAM6 0xf0000
+#define bSFactorQAM7 0xf00000
+#define bSFactorQAM8 0xf000000
+#define bSFactorQAM9 0xf0000000
+#define bCSIScheme 0x100000
+
+#define bNoiseLvlTopSet 0x3 // Useless
+#define bChSmooth 0x4
+#define bChSmoothCfg1 0x38
+#define bChSmoothCfg2 0x1c0
+#define bChSmoothCfg3 0xe00
+#define bChSmoothCfg4 0x7000
+#define bMRCMode 0x800000
+#define bTHEVMCfg 0x7000000
+
+#define bLoopFitType 0x1 // Useless
+#define bUpdCFO 0x40
+#define bUpdCFOOffData 0x80
+#define bAdvUpdCFO 0x100
+#define bAdvTimeCtrl 0x800
+#define bUpdClko 0x1000
+#define bFC 0x6000
+#define bTrackingMode 0x8000
+#define bPhCmpEnable 0x10000
+#define bUpdClkoLTF 0x20000
+#define bComChCFO 0x40000
+#define bCSIEstiMode 0x80000
+#define bAdvUpdEqz 0x100000
+#define bUChCfg 0x7000000
+#define bUpdEqz 0x8000000
+
+//Rx Pseduo noise
+#define bRxPesudoNoiseOn 0x20000000 // Useless
+#define bRxPesudoNoise_A 0xff
+#define bRxPesudoNoise_B 0xff00
+#define bRxPesudoNoise_C 0xff0000
+#define bRxPesudoNoise_D 0xff000000
+#define bPesudoNoiseState_A 0xffff
+#define bPesudoNoiseState_B 0xffff0000
+#define bPesudoNoiseState_C 0xffff
+#define bPesudoNoiseState_D 0xffff0000
+
+//7. RF Register
+//Zebra1
+#define bZebra1_HSSIEnable 0x8 // Useless
+#define bZebra1_TRxControl 0xc00
+#define bZebra1_TRxGainSetting 0x07f
+#define bZebra1_RxCorner 0xc00
+#define bZebra1_TxChargePump 0x38
+#define bZebra1_RxChargePump 0x7
+#define bZebra1_ChannelNum 0xf80
+#define bZebra1_TxLPFBW 0x400
+#define bZebra1_RxLPFBW 0x600
+
+//Zebra4
+#define bRTL8256RegModeCtrl1 0x100 // Useless
+#define bRTL8256RegModeCtrl0 0x40
+#define bRTL8256_TxLPFBW 0x18
+#define bRTL8256_RxLPFBW 0x600
+
+//RTL8258
+#define bRTL8258_TxLPFBW 0xc // Useless
+#define bRTL8258_RxLPFBW 0xc00
+#define bRTL8258_RSSILPFBW 0xc0
+
+
+//
+// Other Definition
+//
+
+//byte endable for sb_write
+#define bByte0 0x1 // Useless
+#define bByte1 0x2
+#define bByte2 0x4
+#define bByte3 0x8
+#define bWord0 0x3
+#define bWord1 0xc
+#define bDWord 0xf
+
+//for PutRegsetting & GetRegSetting BitMask
+#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f
+#define bMaskByte1 0xff00
+#define bMaskByte2 0xff0000
+#define bMaskByte3 0xff000000
+#define bMaskHWord 0xffff0000
+#define bMaskLWord 0x0000ffff
+#define bMaskDWord 0xffffffff
+#define bMask12Bits 0xfff
+#define bMaskH4Bits 0xf0000000
+#define bMaskOFDM_D 0xffc00000
+#define bMaskCCK 0x3f3f3f3f
+
+
+
+#define bEnable 0x1 // Useless
+#define bDisable 0x0
+
+#define LeftAntenna 0x0 // Useless
+#define RightAntenna 0x1
+
+#define tCheckTxStatus 500 //500ms // Useless
+#define tUpdateRxCounter 100 //100ms
+
+#define rateCCK 0 // Useless
+#define rateOFDM 1
+#define rateHT 2
+
+//define Register-End
+#define bPMAC_End 0x1ff // Useless
+#define bFPGAPHY0_End 0x8ff
+#define bFPGAPHY1_End 0x9ff
+#define bCCKPHY0_End 0xaff
+#define bOFDMPHY0_End 0xcff
+#define bOFDMPHY1_End 0xdff
+
+//define max debug item in each debug page
+//#define bMaxItem_FPGA_PHY0 0x9
+//#define bMaxItem_FPGA_PHY1 0x3
+//#define bMaxItem_PHY_11B 0x16
+//#define bMaxItem_OFDM_PHY0 0x29
+//#define bMaxItem_OFDM_PHY1 0x0
+
+#define bPMACControl 0x0 // Useless
+#define bWMACControl 0x1
+#define bWNICControl 0x2
+
+#define PathA 0x0 // Useless
+#define PathB 0x1
+#define PathC 0x2
+#define PathD 0x3
+
+/*--------------------------Define Parameters-------------------------------*/
+
+
+#endif
+
diff --git a/rtl8xxx_EU/include/Hal8188EPwrSeq.h b/rtl8xxx_EU/include/Hal8188EPwrSeq.h
index 41f852f..1c0f3a3 100755
--- a/rtl8xxx_EU/include/Hal8188EPwrSeq.h
+++ b/rtl8xxx_EU/include/Hal8188EPwrSeq.h
@@ -1,176 +1,176 @@
-
-/******************************************************************************
- *
- * 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 __HAL8188EPWRSEQ_H__
-#define __HAL8188EPWRSEQ_H__
-
-#include "HalPwrSeqCmd.h"
-
-/*
- Check document WM-20110607-Paul-RTL8188E_Power_Architecture-R02.vsd
- There are 6 HW Power States:
- 0: POFF--Power Off
- 1: PDN--Power Down
- 2: CARDEMU--Card Emulation
- 3: ACT--Active Mode
- 4: LPS--Low Power State
- 5: SUS--Suspend
-
- The transision from different states are defined below
- TRANS_CARDEMU_TO_ACT
- TRANS_ACT_TO_CARDEMU
- TRANS_CARDEMU_TO_SUS
- TRANS_SUS_TO_CARDEMU
- TRANS_CARDEMU_TO_PDN
- TRANS_ACT_TO_LPS
- TRANS_LPS_TO_ACT
-
- TRANS_END
-
- PWR SEQ Version: rtl8188E_PwrSeq_V09.h
-*/
-#define RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS 10
-#define RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS 10
-#define RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS 10
-#define RTL8188E_TRANS_SUS_TO_CARDEMU_STEPS 10
-#define RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS 10
-#define RTL8188E_TRANS_PDN_TO_CARDEMU_STEPS 10
-#define RTL8188E_TRANS_ACT_TO_LPS_STEPS 15
-#define RTL8188E_TRANS_LPS_TO_ACT_STEPS 15
-#define RTL8188E_TRANS_END_STEPS 1
-
-
-#define RTL8188E_TRANS_CARDEMU_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0|BIT1, 0}, /* 0x02[1:0] = 0 reset BB*/ \
- {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7}, /*0x24[23] = 2b'01 schmit trigger */ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0}, /* 0x04[15] = 0 disable HWPDN (control by DRV)*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, 0}, /*0x04[12:11] = 2b'00 disable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x04[8] = 1 polling until return 0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0}, /*wait till 0x04[8] = 0*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*LDO normal mode*/ \
-
-#define RTL8188E_TRANS_ACT_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*LDO Sleep mode*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
-
-#define RTL8188E_TRANS_CARDEMU_TO_SUS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01enable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11enable WL suspend for PCIe*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, BIT7}, /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */ \
- {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*Clear SIC_EN register 0x40[12] = 1'b0 */ \
- {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*Set USB suspend enable local register 0xfe10[4]=1 */ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8188E_TRANS_SUS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
-
-#define RTL8188E_TRANS_CARDEMU_TO_CARDDIS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7}, /*0x24[23] = 2b'01 schmit trigger */ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */ \
- {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*Clear SIC_EN register 0x40[12] = 1'b0 */ \
- {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*Set USB suspend enable local register 0xfe10[4]=1 */ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8188E_TRANS_CARDDIS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
-
-#define RTL8188E_TRANS_CARDEMU_TO_PDN \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
-
-#define RTL8188E_TRANS_PDN_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
-
-//This is used by driver for LPSRadioOff Procedure, not for FW LPS Step
-#define RTL8188E_TRANS_ACT_TO_LPS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \
- {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
- {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
-
-
-#define RTL8188E_TRANS_LPS_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
- {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
- {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
- {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
- {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
-
-#define RTL8188E_TRANS_END \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
-
-
-extern WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS+RTL8188E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS];
-
-#endif //__HAL8188EPWRSEQ_H__
-
+
+/******************************************************************************
+ *
+ * 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 __HAL8188EPWRSEQ_H__
+#define __HAL8188EPWRSEQ_H__
+
+#include "HalPwrSeqCmd.h"
+
+/*
+ Check document WM-20110607-Paul-RTL8188E_Power_Architecture-R02.vsd
+ There are 6 HW Power States:
+ 0: POFF--Power Off
+ 1: PDN--Power Down
+ 2: CARDEMU--Card Emulation
+ 3: ACT--Active Mode
+ 4: LPS--Low Power State
+ 5: SUS--Suspend
+
+ The transision from different states are defined below
+ TRANS_CARDEMU_TO_ACT
+ TRANS_ACT_TO_CARDEMU
+ TRANS_CARDEMU_TO_SUS
+ TRANS_SUS_TO_CARDEMU
+ TRANS_CARDEMU_TO_PDN
+ TRANS_ACT_TO_LPS
+ TRANS_LPS_TO_ACT
+
+ TRANS_END
+
+ PWR SEQ Version: rtl8188E_PwrSeq_V09.h
+*/
+#define RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS 10
+#define RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS 10
+#define RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS 10
+#define RTL8188E_TRANS_SUS_TO_CARDEMU_STEPS 10
+#define RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS 10
+#define RTL8188E_TRANS_PDN_TO_CARDEMU_STEPS 10
+#define RTL8188E_TRANS_ACT_TO_LPS_STEPS 15
+#define RTL8188E_TRANS_LPS_TO_ACT_STEPS 15
+#define RTL8188E_TRANS_END_STEPS 1
+
+
+#define RTL8188E_TRANS_CARDEMU_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0|BIT1, 0}, /* 0x02[1:0] = 0 reset BB*/ \
+ {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7}, /*0x24[23] = 2b'01 schmit trigger */ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0}, /* 0x04[15] = 0 disable HWPDN (control by DRV)*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, 0}, /*0x04[12:11] = 2b'00 disable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x04[8] = 1 polling until return 0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0}, /*wait till 0x04[8] = 0*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*LDO normal mode*/ \
+
+#define RTL8188E_TRANS_ACT_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*LDO Sleep mode*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
+
+#define RTL8188E_TRANS_CARDEMU_TO_SUS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01enable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11enable WL suspend for PCIe*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, BIT7}, /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */ \
+ {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*Clear SIC_EN register 0x40[12] = 1'b0 */ \
+ {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*Set USB suspend enable local register 0xfe10[4]=1 */ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8188E_TRANS_SUS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
+
+#define RTL8188E_TRANS_CARDEMU_TO_CARDDIS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7}, /*0x24[23] = 2b'01 schmit trigger */ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */ \
+ {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*Clear SIC_EN register 0x40[12] = 1'b0 */ \
+ {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*Set USB suspend enable local register 0xfe10[4]=1 */ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8188E_TRANS_CARDDIS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
+
+#define RTL8188E_TRANS_CARDEMU_TO_PDN \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
+
+#define RTL8188E_TRANS_PDN_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
+
+//This is used by driver for LPSRadioOff Procedure, not for FW LPS Step
+#define RTL8188E_TRANS_ACT_TO_LPS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \
+ {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
+ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
+
+
+#define RTL8188E_TRANS_LPS_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
+ {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
+ {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
+ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
+ {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
+
+#define RTL8188E_TRANS_END \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
+
+
+extern WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS+RTL8188E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS];
+
+#endif //__HAL8188EPWRSEQ_H__
+
diff --git a/rtl8xxx_EU/include/Hal8192EPhyCfg.h b/rtl8xxx_EU/include/Hal8192EPhyCfg.h
index d76863b..0bbf6bd 100755
--- a/rtl8xxx_EU/include/Hal8192EPhyCfg.h
+++ b/rtl8xxx_EU/include/Hal8192EPhyCfg.h
@@ -1,165 +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 __INC_HAL8192EPHYCFG_H__
-#define __INC_HAL8192EPHYCFG_H__
-
-
-/*--------------------------Define Parameters-------------------------------*/
-#define LOOP_LIMIT 5
-#define MAX_STALL_TIME 50 //us
-#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
-#define MAX_TXPWR_IDX_NMODE_92S 63
-#define Reset_Cnt_Limit 3
-
-#ifdef CONFIG_PCI_HCI
-#define MAX_AGGR_NUM 0x0B
-#else
-#define MAX_AGGR_NUM 0x07
-#endif // CONFIG_PCI_HCI
-
-
-/*--------------------------Define Parameters-------------------------------*/
-
-/*------------------------------Define structure----------------------------*/
-
-/* BB/RF related */
-
-/*------------------------------Define structure----------------------------*/
-
-
-/*------------------------Export global variable----------------------------*/
-/*------------------------Export global variable----------------------------*/
-
-
-/*------------------------Export Marco Definition---------------------------*/
-/*------------------------Export Marco Definition---------------------------*/
-
-
-/*--------------------------Exported Function prototype---------------------*/
-//
-// BB and RF register read/write
-//
-u32 PHY_QueryBBReg8192E( IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask );
-void PHY_SetBBReg8192E( IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data );
-u32 PHY_QueryRFReg8192E( IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask );
-void PHY_SetRFReg8192E( IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data );
-
-//
-// Initialization related function
-//
-/* MAC/BB/RF HAL config */
-int PHY_MACConfig8192E(IN PADAPTER Adapter );
-int PHY_BBConfig8192E(IN PADAPTER Adapter );
-int PHY_RFConfig8192E(IN PADAPTER Adapter );
-
-/* RF config */
-
-
-//
-// BB TX Power R/W
-//
-void PHY_GetTxPowerLevel8192E( IN PADAPTER Adapter, OUT s32* powerlevel );
-void PHY_SetTxPowerLevel8192E( IN PADAPTER Adapter, IN u8 channel );
-BOOLEAN PHY_UpdateTxPowerDbm8192E( IN PADAPTER Adapter, IN int powerInDbm );
-
-VOID
-PHY_SetTxPowerIndex_8192E(
- IN PADAPTER Adapter,
- IN u32 PowerIndex,
- IN u8 RFPath,
- IN u8 Rate
- );
-
-u8
-PHY_GetTxPowerIndex_8192E(
- IN PADAPTER pAdapter,
- IN u8 RFPath,
- IN u8 Rate,
- IN CHANNEL_WIDTH BandWidth,
- IN u8 Channel
- );
-
-//
-// Switch bandwidth for 8192S
-//
-VOID
-PHY_SetBWMode8192E(
- IN PADAPTER pAdapter,
- IN CHANNEL_WIDTH Bandwidth,
- IN u8 Offset
-);
-
-//
-// channel switch related funciton
-//
-VOID
-PHY_SwChnl8192E(
- IN PADAPTER Adapter,
- IN u8 channel
-);
-
-
-VOID
-PHY_SetSwChnlBWMode8192E(
- IN PADAPTER Adapter,
- IN u8 channel,
- IN CHANNEL_WIDTH Bandwidth,
- IN u8 Offset40,
- IN u8 Offset80
-);
-
-void
-phy_SpurCalibration_8192E(
- IN PADAPTER Adapter,
- IN SPUR_CAL_METHOD Method
-);
-//
-// BB/MAC/RF other monitor API
-//
-
-VOID
-PHY_SetRFPathSwitch_8192E(
- IN PADAPTER pAdapter,
- IN BOOLEAN bMain
-);
-
-VOID
-storePwrIndexDiffRateOffset(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data
- );
-
-/*--------------------------Exported Function prototype---------------------*/
-#endif // __INC_HAL8192CPHYCFG_H
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8192EPHYCFG_H__
+#define __INC_HAL8192EPHYCFG_H__
+
+
+/*--------------------------Define Parameters-------------------------------*/
+#define LOOP_LIMIT 5
+#define MAX_STALL_TIME 50 //us
+#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
+#define MAX_TXPWR_IDX_NMODE_92S 63
+#define Reset_Cnt_Limit 3
+
+#ifdef CONFIG_PCI_HCI
+#define MAX_AGGR_NUM 0x0B
+#else
+#define MAX_AGGR_NUM 0x07
+#endif // CONFIG_PCI_HCI
+
+
+/*--------------------------Define Parameters-------------------------------*/
+
+/*------------------------------Define structure----------------------------*/
+
+/* BB/RF related */
+
+/*------------------------------Define structure----------------------------*/
+
+
+/*------------------------Export global variable----------------------------*/
+/*------------------------Export global variable----------------------------*/
+
+
+/*------------------------Export Marco Definition---------------------------*/
+/*------------------------Export Marco Definition---------------------------*/
+
+
+/*--------------------------Exported Function prototype---------------------*/
+//
+// BB and RF register read/write
+//
+u32 PHY_QueryBBReg8192E( IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask );
+void PHY_SetBBReg8192E( IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data );
+u32 PHY_QueryRFReg8192E( IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask );
+void PHY_SetRFReg8192E( IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data );
+
+//
+// Initialization related function
+//
+/* MAC/BB/RF HAL config */
+int PHY_MACConfig8192E(IN PADAPTER Adapter );
+int PHY_BBConfig8192E(IN PADAPTER Adapter );
+int PHY_RFConfig8192E(IN PADAPTER Adapter );
+
+/* RF config */
+
+
+//
+// BB TX Power R/W
+//
+void PHY_GetTxPowerLevel8192E( IN PADAPTER Adapter, OUT s32* powerlevel );
+void PHY_SetTxPowerLevel8192E( IN PADAPTER Adapter, IN u8 channel );
+BOOLEAN PHY_UpdateTxPowerDbm8192E( IN PADAPTER Adapter, IN int powerInDbm );
+
+VOID
+PHY_SetTxPowerIndex_8192E(
+ IN PADAPTER Adapter,
+ IN u32 PowerIndex,
+ IN u8 RFPath,
+ IN u8 Rate
+ );
+
+u8
+PHY_GetTxPowerIndex_8192E(
+ IN PADAPTER pAdapter,
+ IN u8 RFPath,
+ IN u8 Rate,
+ IN CHANNEL_WIDTH BandWidth,
+ IN u8 Channel
+ );
+
+//
+// Switch bandwidth for 8192S
+//
+VOID
+PHY_SetBWMode8192E(
+ IN PADAPTER pAdapter,
+ IN CHANNEL_WIDTH Bandwidth,
+ IN u8 Offset
+);
+
+//
+// channel switch related funciton
+//
+VOID
+PHY_SwChnl8192E(
+ IN PADAPTER Adapter,
+ IN u8 channel
+);
+
+
+VOID
+PHY_SetSwChnlBWMode8192E(
+ IN PADAPTER Adapter,
+ IN u8 channel,
+ IN CHANNEL_WIDTH Bandwidth,
+ IN u8 Offset40,
+ IN u8 Offset80
+);
+
+void
+phy_SpurCalibration_8192E(
+ IN PADAPTER Adapter,
+ IN SPUR_CAL_METHOD Method
+);
+//
+// BB/MAC/RF other monitor API
+//
+
+VOID
+PHY_SetRFPathSwitch_8192E(
+ IN PADAPTER pAdapter,
+ IN BOOLEAN bMain
+);
+
+VOID
+storePwrIndexDiffRateOffset(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data
+ );
+
+/*--------------------------Exported Function prototype---------------------*/
+#endif // __INC_HAL8192CPHYCFG_H
+
diff --git a/rtl8xxx_EU/include/Hal8192EPhyReg.h b/rtl8xxx_EU/include/Hal8192EPhyReg.h
index 0621fb9..bd909c8 100755
--- a/rtl8xxx_EU/include/Hal8192EPhyReg.h
+++ b/rtl8xxx_EU/include/Hal8192EPhyReg.h
@@ -1,1132 +1,1132 @@
-/*****************************************************************************
- * Copyright(c) 2008, RealTEK Technology Inc. All Right Reserved.
- *
- * Module: __INC_HAL8192SPHYREG_H
- *
- *
- * Note: 1. Define PMAC/BB register map
- * 2. Define RF register map
- * 3. PMAC/BB register bit mask.
- * 4. RF reg bit mask.
- * 5. Other BB/RF relative definition.
- *
- *
- * Export: Constants, macro, functions(API), global variables(None).
- *
- * Abbrev:
- *
- * History:
- * Data Who Remark
- * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h.
- * 2. Reorganize code architecture.
- * 09/25/2008 MH 1. Add RL6052 register definition
- *
- *****************************************************************************/
-#ifndef __INC_HAL8192EPHYREG_H
-#define __INC_HAL8192EPHYREG_H
-
-
-/*--------------------------Define Parameters-------------------------------*/
-
-//============================================================
-// 8192S Regsiter offset definition
-//============================================================
-
-//
-// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF
-// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
-// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00
-// 3. RF register 0x00-2E
-// 4. Bit Mask for BB/RF register
-// 5. Other defintion for BB/RF R/W
-//
-
-
-//
-// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
-// 1. Page1(0x100)
-//
-#define rPMAC_Reset 0x100
-#define rPMAC_TxStart 0x104
-#define rPMAC_TxLegacySIG 0x108
-#define rPMAC_TxHTSIG1 0x10c
-#define rPMAC_TxHTSIG2 0x110
-#define rPMAC_PHYDebug 0x114
-#define rPMAC_TxPacketNum 0x118
-#define rPMAC_TxIdle 0x11c
-#define rPMAC_TxMACHeader0 0x120
-#define rPMAC_TxMACHeader1 0x124
-#define rPMAC_TxMACHeader2 0x128
-#define rPMAC_TxMACHeader3 0x12c
-#define rPMAC_TxMACHeader4 0x130
-#define rPMAC_TxMACHeader5 0x134
-#define rPMAC_TxDataType 0x138
-#define rPMAC_TxRandomSeed 0x13c
-#define rPMAC_CCKPLCPPreamble 0x140
-#define rPMAC_CCKPLCPHeader 0x144
-#define rPMAC_CCKCRC16 0x148
-#define rPMAC_OFDMRxCRC32OK 0x170
-#define rPMAC_OFDMRxCRC32Er 0x174
-#define rPMAC_OFDMRxParityEr 0x178
-#define rPMAC_OFDMRxCRC8Er 0x17c
-#define rPMAC_CCKCRxRC16Er 0x180
-#define rPMAC_CCKCRxRC32Er 0x184
-#define rPMAC_CCKCRxRC32OK 0x188
-#define rPMAC_TxStatus 0x18c
-
-
-//
-// 3. Page8(0x800)
-//
-#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting??
-
-#define rFPGA0_TxInfo 0x804 // Status report??
-#define rFPGA0_PSDFunction 0x808
-
-#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain?
-
-#define rFPGA0_RFTiming1 0x810 // Useless now
-#define rFPGA0_RFTiming2 0x814
-
-#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register
-#define rFPGA0_XA_HSSIParameter2 0x824
-#define rFPGA0_XB_HSSIParameter1 0x828
-#define rFPGA0_XB_HSSIParameter2 0x82c
-
-#define rFPGA0_XA_LSSIParameter 0x840
-#define rFPGA0_XB_LSSIParameter 0x844
-
-#define rFPGA0_RFWakeUpParameter 0x850 // Useless now
-#define rFPGA0_RFSleepUpParameter 0x854
-
-#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch
-#define rFPGA0_XCD_SwitchControl 0x85c
-
-#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch
-#define rFPGA0_XB_RFInterfaceOE 0x864
-
-#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control
-#define rFPGA0_XCD_RFInterfaceSW 0x874
-
-#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter
-#define rFPGA0_XCD_RFParameter 0x87c
-
-#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4??
-#define rFPGA0_AnalogParameter2 0x884
-#define rFPGA0_AnalogParameter3 0x888
-#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy
-#define rFPGA0_AnalogParameter4 0x88c
-
-#define rFPGA0_XA_LSSIReadBack 0x8a0 // Tranceiver LSSI Readback
-#define rFPGA0_XB_LSSIReadBack 0x8a4
-#define rFPGA0_XC_LSSIReadBack 0x8a8
-#define rFPGA0_XD_LSSIReadBack 0x8ac
-
-#define rFPGA0_PSDReport 0x8b4 // Useless now
-#define TransceiverA_HSPI_Readback 0x8b8 // Transceiver A HSPI Readback
-#define TransceiverB_HSPI_Readback 0x8bc // Transceiver B HSPI Readback
-#define rFPGA0_XAB_RFInterfaceRB 0x8e0 // Useless now // RF Interface Readback Value
-#define rFPGA0_XCD_RFInterfaceRB 0x8e4 // Useless now
-
-//
-// 4. Page9(0x900)
-//
-#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting??
-
-#define rFPGA1_TxBlock 0x904 // Useless now
-#define rFPGA1_DebugSelect 0x908 // Useless now
-#define rFPGA1_TxInfo 0x90c // Useless now // Status report??
-
-//
-// 5. PageA(0xA00)
-//
-// Set Control channel to upper or lower. These settings are required only for 40MHz
-#define rCCK0_System 0xa00
-
-#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI
-#define rCCK0_CCA 0xa08 // Disable init gain now // Init gain
-
-#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series
-#define rCCK0_RxAGC2 0xa10 //AGC & DAGC
-
-#define rCCK0_RxHP 0xa14
-
-#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold
-#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
-#define rCCK0_TRSSIReport 0xa50
-#define rCCK0_RxReport 0xa54 //0xa57
-#define rCCK0_FACounterLower 0xa5c //0xa5b
-#define rCCK0_FACounterUpper 0xa58 //0xa5c
-
-//
-// PageB(0xB00)
-//
-#define rPdp_AntA 0xb00
-#define rPdp_AntA_4 0xb04
-#define rConfig_Pmpd_AntA 0xb28
-#define rConfig_ram64x16 0xb2c
-
-#define rConfig_AntA 0xb68
-#define rConfig_AntB 0xb6c
-#define rPdp_AntB 0xb70
-#define rPdp_AntB_4 0xb74
-#define rConfig_Pmpd_AntB 0xb98
-#define rAPK 0xbd8
-
-
-
-//
-// 6. PageC(0xC00)
-//
-#define rOFDM0_LSTF 0xc00
-
-#define rOFDM0_TRxPathEnable 0xc04
-#define rOFDM0_TRMuxPar 0xc08
-#define rOFDM0_TRSWIsolation 0xc0c
-
-#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter
-#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix
-#define rOFDM0_XBRxAFE 0xc18
-#define rOFDM0_XBRxIQImbalance 0xc1c
-#define rOFDM0_XCRxAFE 0xc20
-#define rOFDM0_XCRxIQImbalance 0xc24
-#define rOFDM0_XDRxAFE 0xc28
-#define rOFDM0_XDRxIQImbalance 0xc2c
-
-#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain
-#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync.
-#define rOFDM0_RxDetector3 0xc38 //Frame Sync.
-#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI
-
-#define rOFDM0_RxDSP 0xc40 //Rx Sync Path
-#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC
-#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold
-#define rOFDM0_ECCAThreshold 0xc4c // energy CCA
-
-#define rOFDM0_XAAGCCore1 0xc50 // DIG
-#define rOFDM0_XAAGCCore2 0xc54
-#define rOFDM0_XBAGCCore1 0xc58
-#define rOFDM0_XBAGCCore2 0xc5c
-#define rOFDM0_XCAGCCore1 0xc60
-#define rOFDM0_XCAGCCore2 0xc64
-#define rOFDM0_XDAGCCore1 0xc68
-#define rOFDM0_XDAGCCore2 0xc6c
-
-#define rOFDM0_AGCParameter1 0xc70
-#define rOFDM0_AGCParameter2 0xc74
-#define rOFDM0_AGCRSSITable 0xc78
-#define rOFDM0_HTSTFAGC 0xc7c
-
-#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG
-#define rOFDM0_XATxAFE 0xc84
-#define rOFDM0_XBTxIQImbalance 0xc88
-#define rOFDM0_XBTxAFE 0xc8c
-#define rOFDM0_XCTxIQImbalance 0xc90
-#define rOFDM0_XCTxAFE 0xc94
-#define rOFDM0_XDTxIQImbalance 0xc98
-#define rOFDM0_XDTxAFE 0xc9c
-
-#define rOFDM0_RxIQExtAnta 0xca0
-#define rOFDM0_TxCoeff1 0xca4
-#define rOFDM0_TxCoeff2 0xca8
-#define rOFDM0_TxCoeff3 0xcac
-#define rOFDM0_TxCoeff4 0xcb0
-#define rOFDM0_TxCoeff5 0xcb4
-#define rOFDM0_RxHPParameter 0xce0
-#define rOFDM0_TxPseudoNoiseWgt 0xce4
-#define rOFDM0_FrameSync 0xcf0
-#define rOFDM0_DFSReport 0xcf4
-
-
-//
-// 7. PageD(0xD00)
-//
-#define rOFDM1_LSTF 0xd00
-#define rOFDM1_TRxPathEnable 0xd04
-
-#define rOFDM1_CFO 0xd08 // No setting now
-#define rOFDM1_CSI1 0xd10
-#define rOFDM1_SBD 0xd14
-#define rOFDM1_CSI2 0xd18
-#define rOFDM1_CFOTracking 0xd2c
-#define rOFDM1_TRxMesaure1 0xd34
-#define rOFDM1_IntfDet 0xd3c
-#define rOFDM1_PseudoNoiseStateAB 0xd50
-#define rOFDM1_PseudoNoiseStateCD 0xd54
-#define rOFDM1_RxPseudoNoiseWgt 0xd58
-
-#define rOFDM_PHYCounter1 0xda0 //cca, parity fail
-#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail
-#define rOFDM_PHYCounter3 0xda8 //MCS not support
-
-#define rOFDM_ShortCFOAB 0xdac // No setting now
-#define rOFDM_ShortCFOCD 0xdb0
-#define rOFDM_LongCFOAB 0xdb4
-#define rOFDM_LongCFOCD 0xdb8
-#define rOFDM_TailCFOAB 0xdbc
-#define rOFDM_TailCFOCD 0xdc0
-#define rOFDM_PWMeasure1 0xdc4
-#define rOFDM_PWMeasure2 0xdc8
-#define rOFDM_BWReport 0xdcc
-#define rOFDM_AGCReport 0xdd0
-#define rOFDM_RxSNR 0xdd4
-#define rOFDM_RxEVMCSI 0xdd8
-#define rOFDM_SIGReport 0xddc
-
-
-//
-// 8. PageE(0xE00)
-//
-#define rTxAGC_A_Rate18_06 0xe00
-#define rTxAGC_A_Rate54_24 0xe04
-#define rTxAGC_A_CCK1_Mcs32 0xe08
-#define rTxAGC_A_Mcs03_Mcs00 0xe10
-#define rTxAGC_A_Mcs07_Mcs04 0xe14
-#define rTxAGC_A_Mcs11_Mcs08 0xe18
-#define rTxAGC_A_Mcs15_Mcs12 0xe1c
-
-#define rTxAGC_B_Rate18_06 0x830
-#define rTxAGC_B_Rate54_24 0x834
-#define rTxAGC_B_CCK1_55_Mcs32 0x838
-#define rTxAGC_B_Mcs03_Mcs00 0x83c
-#define rTxAGC_B_Mcs07_Mcs04 0x848
-#define rTxAGC_B_Mcs11_Mcs08 0x84c
-#define rTxAGC_B_Mcs15_Mcs12 0x868
-#define rTxAGC_B_CCK11_A_CCK2_11 0x86c
-
-#define rFPGA0_IQK 0xe28
-#define rTx_IQK_Tone_A 0xe30
-#define rRx_IQK_Tone_A 0xe34
-#define rTx_IQK_PI_A 0xe38
-#define rRx_IQK_PI_A 0xe3c
-
-#define rTx_IQK 0xe40
-#define rRx_IQK 0xe44
-#define rIQK_AGC_Pts 0xe48
-#define rIQK_AGC_Rsp 0xe4c
-#define rTx_IQK_Tone_B 0xe50
-#define rRx_IQK_Tone_B 0xe54
-#define rTx_IQK_PI_B 0xe58
-#define rRx_IQK_PI_B 0xe5c
-#define rIQK_AGC_Cont 0xe60
-
-#define rBlue_Tooth 0xe6c
-#define rRx_Wait_CCA 0xe70
-#define rTx_CCK_RFON 0xe74
-#define rTx_CCK_BBON 0xe78
-#define rTx_OFDM_RFON 0xe7c
-#define rTx_OFDM_BBON 0xe80
-#define rTx_To_Rx 0xe84
-#define rTx_To_Tx 0xe88
-#define rRx_CCK 0xe8c
-
-#define rTx_Power_Before_IQK_A 0xe94
-#define rTx_Power_After_IQK_A 0xe9c
-
-#define rRx_Power_Before_IQK_A 0xea0
-#define rRx_Power_Before_IQK_A_2 0xea4
-#define rRx_Power_After_IQK_A 0xea8
-#define rRx_Power_After_IQK_A_2 0xeac
-
-#define rTx_Power_Before_IQK_B 0xeb4
-#define rTx_Power_After_IQK_B 0xebc
-
-#define rRx_Power_Before_IQK_B 0xec0
-#define rRx_Power_Before_IQK_B_2 0xec4
-#define rRx_Power_After_IQK_B 0xec8
-#define rRx_Power_After_IQK_B_2 0xecc
-
-#define rRx_OFDM 0xed0
-#define rRx_Wait_RIFS 0xed4
-#define rRx_TO_Rx 0xed8
-#define rStandby 0xedc
-#define rSleep 0xee0
-#define rPMPD_ANAEN 0xeec
-
-//
-// 7. RF Register 0x00-0x2E (RF 8256)
-// RF-0222D 0x00-3F
-//
-//Zebra1
-#define rZebra1_HSSIEnable 0x0 // Useless now
-#define rZebra1_TRxEnable1 0x1
-#define rZebra1_TRxEnable2 0x2
-#define rZebra1_AGC 0x4
-#define rZebra1_ChargePump 0x5
-#define rZebra1_Channel 0x7 // RF channel switch
-
-//#endif
-#define rZebra1_TxGain 0x8 // Useless now
-#define rZebra1_TxLPF 0x9
-#define rZebra1_RxLPF 0xb
-#define rZebra1_RxHPFCorner 0xc
-
-//Zebra4
-#define rGlobalCtrl 0 // Useless now
-#define rRTL8256_TxLPF 19
-#define rRTL8256_RxLPF 11
-
-//RTL8258
-#define rRTL8258_TxLPF 0x11 // Useless now
-#define rRTL8258_RxLPF 0x13
-#define rRTL8258_RSSILPF 0xa
-
-//
-// RL6052 Register definition
-//
-#define RF_AC 0x00 //
-
-#define RF_IQADJ_G1 0x01 //
-#define RF_IQADJ_G2 0x02 //
-
-#define RF_POW_TRSW 0x05 //
-
-#define RF_GAIN_RX 0x06 //
-#define RF_GAIN_TX 0x07 //
-
-#define RF_TXM_IDAC 0x08 //
-#define RF_IPA_G 0x09 //
-#define RF_TXBIAS_G 0x0A
-#define RF_TXPA_AG 0x0B
-#define RF_IPA_A 0x0C //
-#define RF_TXBIAS_A 0x0D
-#define RF_BS_PA_APSET_G9_G11 0x0E
-#define RF_BS_IQGEN 0x0F //
-
-#define RF_MODE1 0x10 //
-#define RF_MODE2 0x11 //
-
-#define RF_RX_AGC_HP 0x12 //
-#define RF_TX_AGC 0x13 //
-#define RF_BIAS 0x14 //
-#define RF_IPA 0x15 //
-#define RF_TXBIAS 0x16
-#define RF_POW_ABILITY 0x17 //
-#define RF_CHNLBW 0x18 // RF channel and BW switch
-#define RF_TOP 0x19 //
-
-#define RF_RX_G1 0x1A //
-#define RF_RX_G2 0x1B //
-
-#define RF_RX_BB2 0x1C //
-#define RF_RX_BB1 0x1D //
-
-#define RF_RCK1 0x1E //
-#define RF_RCK2 0x1F //
-
-#define RF_TX_G1 0x20 //
-#define RF_TX_G2 0x21 //
-#define RF_TX_G3 0x22 //
-
-#define RF_TX_BB1 0x23 //
-
-//#if HARDWARE_TYPE_IS_RTL8192D == 1
-#define RF_T_METER_92D 0x42 //
-//#else
-#define RF_T_METER_88E 0x42 //
-#define RF_T_METER 0x24 //
-
-//#endif
-
-#define RF_SYN_G1 0x25 // RF TX Power control
-#define RF_SYN_G2 0x26 // RF TX Power control
-#define RF_SYN_G3 0x27 // RF TX Power control
-#define RF_SYN_G4 0x28 // RF TX Power control
-#define RF_SYN_G5 0x29 // RF TX Power control
-#define RF_SYN_G6 0x2A // RF TX Power control
-#define RF_SYN_G7 0x2B // RF TX Power control
-#define RF_SYN_G8 0x2C // RF TX Power control
-
-#define RF_RCK_OS 0x30 // RF TX PA control
-#define RF_TXPA_G1 0x31 // RF TX PA control
-#define RF_TXPA_G2 0x32 // RF TX PA control
-#define RF_TXPA_G3 0x33 // RF TX PA control
-#define RF_TX_BIAS_A 0x35
-#define RF_TX_BIAS_D 0x36
-#define RF_LOBF_9 0x38
-#define RF_RXRF_A3 0x3C //
-#define RF_TRSW 0x3F
-
-#define RF_TXRF_A2 0x41
-#define RF_TXPA_G4 0x46
-#define RF_TXPA_A4 0x4B
-#define RF_0x52 0x52
-#define RF_LDO 0xB1
-#define RF_WE_LUT 0xEF
-
-
-//
-//Bit Mask
-//
-// 1. Page1(0x100)
-#define bBBResetB 0x100 // Useless now?
-#define bGlobalResetB 0x200
-#define bOFDMTxStart 0x4
-#define bCCKTxStart 0x8
-#define bCRC32Debug 0x100
-#define bPMACLoopback 0x10
-#define bTxLSIG 0xffffff
-#define bOFDMTxRate 0xf
-#define bOFDMTxReserved 0x10
-#define bOFDMTxLength 0x1ffe0
-#define bOFDMTxParity 0x20000
-#define bTxHTSIG1 0xffffff
-#define bTxHTMCSRate 0x7f
-#define bTxHTBW 0x80
-#define bTxHTLength 0xffff00
-#define bTxHTSIG2 0xffffff
-#define bTxHTSmoothing 0x1
-#define bTxHTSounding 0x2
-#define bTxHTReserved 0x4
-#define bTxHTAggreation 0x8
-#define bTxHTSTBC 0x30
-#define bTxHTAdvanceCoding 0x40
-#define bTxHTShortGI 0x80
-#define bTxHTNumberHT_LTF 0x300
-#define bTxHTCRC8 0x3fc00
-#define bCounterReset 0x10000
-#define bNumOfOFDMTx 0xffff
-#define bNumOfCCKTx 0xffff0000
-#define bTxIdleInterval 0xffff
-#define bOFDMService 0xffff0000
-#define bTxMACHeader 0xffffffff
-#define bTxDataInit 0xff
-#define bTxHTMode 0x100
-#define bTxDataType 0x30000
-#define bTxRandomSeed 0xffffffff
-#define bCCKTxPreamble 0x1
-#define bCCKTxSFD 0xffff0000
-#define bCCKTxSIG 0xff
-#define bCCKTxService 0xff00
-#define bCCKLengthExt 0x8000
-#define bCCKTxLength 0xffff0000
-#define bCCKTxCRC16 0xffff
-#define bCCKTxStatus 0x1
-#define bOFDMTxStatus 0x2
-
-#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff))
-
-// 2. Page8(0x800)
-#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD
-#define bJapanMode 0x2
-#define bCCKTxSC 0x30
-#define bCCKEn 0x1000000
-#define bOFDMEn 0x2000000
-
-#define bOFDMRxADCPhase 0x10000 // Useless now
-#define bOFDMTxDACPhase 0x40000
-#define bXATxAGC 0x3f
-
-#define bAntennaSelect 0x0300
-
-#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage
-#define bXCTxAGC 0xf000
-#define bXDTxAGC 0xf0000
-
-#define bPAStart 0xf0000000 // Useless now
-#define bTRStart 0x00f00000
-#define bRFStart 0x0000f000
-#define bBBStart 0x000000f0
-#define bBBCCKStart 0x0000000f
-#define bPAEnd 0xf //Reg0x814
-#define bTREnd 0x0f000000
-#define bRFEnd 0x000f0000
-#define bCCAMask 0x000000f0 //T2R
-#define bR2RCCAMask 0x00000f00
-#define bHSSI_R2TDelay 0xf8000000
-#define bHSSI_T2RDelay 0xf80000
-#define bContTxHSSI 0x400 //chane gain at continue Tx
-#define bIGFromCCK 0x200
-#define bAGCAddress 0x3f
-#define bRxHPTx 0x7000
-#define bRxHPT2R 0x38000
-#define bRxHPCCKIni 0xc0000
-#define bAGCTxCode 0xc00000
-#define bAGCRxCode 0x300000
-
-#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1
-#define b3WireAddressLength 0x400
-
-#define b3WireRFPowerDown 0x1 // Useless now
-//#define bHWSISelect 0x8
-#define b5GPAPEPolarity 0x40000000
-#define b2GPAPEPolarity 0x80000000
-#define bRFSW_TxDefaultAnt 0x3
-#define bRFSW_TxOptionAnt 0x30
-#define bRFSW_RxDefaultAnt 0x300
-#define bRFSW_RxOptionAnt 0x3000
-#define bRFSI_3WireData 0x1
-#define bRFSI_3WireClock 0x2
-#define bRFSI_3WireLoad 0x4
-#define bRFSI_3WireRW 0x8
-#define bRFSI_3Wire 0xf
-
-#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW
-
-#define bRFSI_TRSW 0x20 // Useless now
-#define bRFSI_TRSWB 0x40
-#define bRFSI_ANTSW 0x100
-#define bRFSI_ANTSWB 0x200
-#define bRFSI_PAPE 0x400
-#define bRFSI_PAPE5G 0x800
-#define bBandSelect 0x1
-#define bHTSIG2_GI 0x80
-#define bHTSIG2_Smoothing 0x01
-#define bHTSIG2_Sounding 0x02
-#define bHTSIG2_Aggreaton 0x08
-#define bHTSIG2_STBC 0x30
-#define bHTSIG2_AdvCoding 0x40
-#define bHTSIG2_NumOfHTLTF 0x300
-#define bHTSIG2_CRC8 0x3fc
-#define bHTSIG1_MCS 0x7f
-#define bHTSIG1_BandWidth 0x80
-#define bHTSIG1_HTLength 0xffff
-#define bLSIG_Rate 0xf
-#define bLSIG_Reserved 0x10
-#define bLSIG_Length 0x1fffe
-#define bLSIG_Parity 0x20
-#define bCCKRxPhase 0x4
-
-#define bLSSIReadAddress 0x7f800000 // T65 RF
-
-#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal
-
-#define bLSSIReadBackData 0xfffff // T65 RF
-
-#define bLSSIReadOKFlag 0x1000 // Useless now
-#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz
-#define bRegulator0Standby 0x1
-#define bRegulatorPLLStandby 0x2
-#define bRegulator1Standby 0x4
-#define bPLLPowerUp 0x8
-#define bDPLLPowerUp 0x10
-#define bDA10PowerUp 0x20
-#define bAD7PowerUp 0x200
-#define bDA6PowerUp 0x2000
-#define bXtalPowerUp 0x4000
-#define b40MDClkPowerUP 0x8000
-#define bDA6DebugMode 0x20000
-#define bDA6Swing 0x380000
-
-#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ
-
-#define b80MClkDelay 0x18000000 // Useless
-#define bAFEWatchDogEnable 0x20000000
-
-#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap
-#define bXtalCap23 0x3
-#define bXtalCap92x 0x0f000000
-#define bXtalCap 0x0f000000
-
-#define bIntDifClkEnable 0x400 // Useless
-#define bExtSigClkEnable 0x800
-#define bBandgapMbiasPowerUp 0x10000
-#define bAD11SHGain 0xc0000
-#define bAD11InputRange 0x700000
-#define bAD11OPCurrent 0x3800000
-#define bIPathLoopback 0x4000000
-#define bQPathLoopback 0x8000000
-#define bAFELoopback 0x10000000
-#define bDA10Swing 0x7e0
-#define bDA10Reverse 0x800
-#define bDAClkSource 0x1000
-#define bAD7InputRange 0x6000
-#define bAD7Gain 0x38000
-#define bAD7OutputCMMode 0x40000
-#define bAD7InputCMMode 0x380000
-#define bAD7Current 0xc00000
-#define bRegulatorAdjust 0x7000000
-#define bAD11PowerUpAtTx 0x1
-#define bDA10PSAtTx 0x10
-#define bAD11PowerUpAtRx 0x100
-#define bDA10PSAtRx 0x1000
-#define bCCKRxAGCFormat 0x200
-#define bPSDFFTSamplepPoint 0xc000
-#define bPSDAverageNum 0x3000
-#define bIQPathControl 0xc00
-#define bPSDFreq 0x3ff
-#define bPSDAntennaPath 0x30
-#define bPSDIQSwitch 0x40
-#define bPSDRxTrigger 0x400000
-#define bPSDTxTrigger 0x80000000
-#define bPSDSineToneScale 0x7f000000
-#define bPSDReport 0xffff
-
-// 3. Page9(0x900)
-#define bOFDMTxSC 0x30000000 // Useless
-#define bCCKTxOn 0x1
-#define bOFDMTxOn 0x2
-#define bDebugPage 0xfff //reset debug page and also HWord, LWord
-#define bDebugItem 0xff //reset debug page and LWord
-#define bAntL 0x10
-#define bAntNonHT 0x100
-#define bAntHT1 0x1000
-#define bAntHT2 0x10000
-#define bAntHT1S1 0x100000
-#define bAntNonHTS1 0x1000000
-
-// 4. PageA(0xA00)
-#define bCCKBBMode 0x3 // Useless
-#define bCCKTxPowerSaving 0x80
-#define bCCKRxPowerSaving 0x40
-
-#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch
-
-#define bCCKScramble 0x8 // Useless
-#define bCCKAntDiversity 0x8000
-#define bCCKCarrierRecovery 0x4000
-#define bCCKTxRate 0x3000
-#define bCCKDCCancel 0x0800
-#define bCCKISICancel 0x0400
-#define bCCKMatchFilter 0x0200
-#define bCCKEqualizer 0x0100
-#define bCCKPreambleDetect 0x800000
-#define bCCKFastFalseCCA 0x400000
-#define bCCKChEstStart 0x300000
-#define bCCKCCACount 0x080000
-#define bCCKcs_lim 0x070000
-#define bCCKBistMode 0x80000000
-#define bCCKCCAMask 0x40000000
-#define bCCKTxDACPhase 0x4
-#define bCCKRxADCPhase 0x20000000 //r_rx_clk
-#define bCCKr_cp_mode0 0x0100
-#define bCCKTxDCOffset 0xf0
-#define bCCKRxDCOffset 0xf
-#define bCCKCCAMode 0xc000
-#define bCCKFalseCS_lim 0x3f00
-#define bCCKCS_ratio 0xc00000
-#define bCCKCorgBit_sel 0x300000
-#define bCCKPD_lim 0x0f0000
-#define bCCKNewCCA 0x80000000
-#define bCCKRxHPofIG 0x8000
-#define bCCKRxIG 0x7f00
-#define bCCKLNAPolarity 0x800000
-#define bCCKRx1stGain 0x7f0000
-#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity
-#define bCCKRxAGCSatLevel 0x1f000000
-#define bCCKRxAGCSatCount 0xe0
-#define bCCKRxRFSettle 0x1f //AGCsamp_dly
-#define bCCKFixedRxAGC 0x8000
-//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824
-#define bCCKAntennaPolarity 0x2000
-#define bCCKTxFilterType 0x0c00
-#define bCCKRxAGCReportType 0x0300
-#define bCCKRxDAGCEn 0x80000000
-#define bCCKRxDAGCPeriod 0x20000000
-#define bCCKRxDAGCSatLevel 0x1f000000
-#define bCCKTimingRecovery 0x800000
-#define bCCKTxC0 0x3f0000
-#define bCCKTxC1 0x3f000000
-#define bCCKTxC2 0x3f
-#define bCCKTxC3 0x3f00
-#define bCCKTxC4 0x3f0000
-#define bCCKTxC5 0x3f000000
-#define bCCKTxC6 0x3f
-#define bCCKTxC7 0x3f00
-#define bCCKDebugPort 0xff0000
-#define bCCKDACDebug 0x0f000000
-#define bCCKFalseAlarmEnable 0x8000
-#define bCCKFalseAlarmRead 0x4000
-#define bCCKTRSSI 0x7f
-#define bCCKRxAGCReport 0xfe
-#define bCCKRxReport_AntSel 0x80000000
-#define bCCKRxReport_MFOff 0x40000000
-#define bCCKRxRxReport_SQLoss 0x20000000
-#define bCCKRxReport_Pktloss 0x10000000
-#define bCCKRxReport_Lockedbit 0x08000000
-#define bCCKRxReport_RateError 0x04000000
-#define bCCKRxReport_RxRate 0x03000000
-#define bCCKRxFACounterLower 0xff
-#define bCCKRxFACounterUpper 0xff000000
-#define bCCKRxHPAGCStart 0xe000
-#define bCCKRxHPAGCFinal 0x1c00
-#define bCCKRxFalseAlarmEnable 0x8000
-#define bCCKFACounterFreeze 0x4000
-#define bCCKTxPathSel 0x10000000
-#define bCCKDefaultRxPath 0xc000000
-#define bCCKOptionRxPath 0x3000000
-
-// 5. PageC(0xC00)
-#define bNumOfSTF 0x3 // Useless
-#define bShift_L 0xc0
-#define bGI_TH 0xc
-#define bRxPathA 0x1
-#define bRxPathB 0x2
-#define bRxPathC 0x4
-#define bRxPathD 0x8
-#define bTxPathA 0x1
-#define bTxPathB 0x2
-#define bTxPathC 0x4
-#define bTxPathD 0x8
-#define bTRSSIFreq 0x200
-#define bADCBackoff 0x3000
-#define bDFIRBackoff 0xc000
-#define bTRSSILatchPhase 0x10000
-#define bRxIDCOffset 0xff
-#define bRxQDCOffset 0xff00
-#define bRxDFIRMode 0x1800000
-#define bRxDCNFType 0xe000000
-#define bRXIQImb_A 0x3ff
-#define bRXIQImb_B 0xfc00
-#define bRXIQImb_C 0x3f0000
-#define bRXIQImb_D 0xffc00000
-#define bDC_dc_Notch 0x60000
-#define bRxNBINotch 0x1f000000
-#define bPD_TH 0xf
-#define bPD_TH_Opt2 0xc000
-#define bPWED_TH 0x700
-#define bIfMF_Win_L 0x800
-#define bPD_Option 0x1000
-#define bMF_Win_L 0xe000
-#define bBW_Search_L 0x30000
-#define bwin_enh_L 0xc0000
-#define bBW_TH 0x700000
-#define bED_TH2 0x3800000
-#define bBW_option 0x4000000
-#define bRatio_TH 0x18000000
-#define bWindow_L 0xe0000000
-#define bSBD_Option 0x1
-#define bFrame_TH 0x1c
-#define bFS_Option 0x60
-#define bDC_Slope_check 0x80
-#define bFGuard_Counter_DC_L 0xe00
-#define bFrame_Weight_Short 0x7000
-#define bSub_Tune 0xe00000
-#define bFrame_DC_Length 0xe000000
-#define bSBD_start_offset 0x30000000
-#define bFrame_TH_2 0x7
-#define bFrame_GI2_TH 0x38
-#define bGI2_Sync_en 0x40
-#define bSarch_Short_Early 0x300
-#define bSarch_Short_Late 0xc00
-#define bSarch_GI2_Late 0x70000
-#define bCFOAntSum 0x1
-#define bCFOAcc 0x2
-#define bCFOStartOffset 0xc
-#define bCFOLookBack 0x70
-#define bCFOSumWeight 0x80
-#define bDAGCEnable 0x10000
-#define bTXIQImb_A 0x3ff
-#define bTXIQImb_B 0xfc00
-#define bTXIQImb_C 0x3f0000
-#define bTXIQImb_D 0xffc00000
-#define bTxIDCOffset 0xff
-#define bTxQDCOffset 0xff00
-#define bTxDFIRMode 0x10000
-#define bTxPesudoNoiseOn 0x4000000
-#define bTxPesudoNoise_A 0xff
-#define bTxPesudoNoise_B 0xff00
-#define bTxPesudoNoise_C 0xff0000
-#define bTxPesudoNoise_D 0xff000000
-#define bCCADropOption 0x20000
-#define bCCADropThres 0xfff00000
-#define bEDCCA_H 0xf
-#define bEDCCA_L 0xf0
-#define bLambda_ED 0x300
-#define bRxInitialGain 0x7f
-#define bRxAntDivEn 0x80
-#define bRxAGCAddressForLNA 0x7f00
-#define bRxHighPowerFlow 0x8000
-#define bRxAGCFreezeThres 0xc0000
-#define bRxFreezeStep_AGC1 0x300000
-#define bRxFreezeStep_AGC2 0xc00000
-#define bRxFreezeStep_AGC3 0x3000000
-#define bRxFreezeStep_AGC0 0xc000000
-#define bRxRssi_Cmp_En 0x10000000
-#define bRxQuickAGCEn 0x20000000
-#define bRxAGCFreezeThresMode 0x40000000
-#define bRxOverFlowCheckType 0x80000000
-#define bRxAGCShift 0x7f
-#define bTRSW_Tri_Only 0x80
-#define bPowerThres 0x300
-#define bRxAGCEn 0x1
-#define bRxAGCTogetherEn 0x2
-#define bRxAGCMin 0x4
-#define bRxHP_Ini 0x7
-#define bRxHP_TRLNA 0x70
-#define bRxHP_RSSI 0x700
-#define bRxHP_BBP1 0x7000
-#define bRxHP_BBP2 0x70000
-#define bRxHP_BBP3 0x700000
-#define bRSSI_H 0x7f0000 //the threshold for high power
-#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity
-#define bRxSettle_TRSW 0x7
-#define bRxSettle_LNA 0x38
-#define bRxSettle_RSSI 0x1c0
-#define bRxSettle_BBP 0xe00
-#define bRxSettle_RxHP 0x7000
-#define bRxSettle_AntSW_RSSI 0x38000
-#define bRxSettle_AntSW 0xc0000
-#define bRxProcessTime_DAGC 0x300000
-#define bRxSettle_HSSI 0x400000
-#define bRxProcessTime_BBPPW 0x800000
-#define bRxAntennaPowerShift 0x3000000
-#define bRSSITableSelect 0xc000000
-#define bRxHP_Final 0x7000000
-#define bRxHTSettle_BBP 0x7
-#define bRxHTSettle_HSSI 0x8
-#define bRxHTSettle_RxHP 0x70
-#define bRxHTSettle_BBPPW 0x80
-#define bRxHTSettle_Idle 0x300
-#define bRxHTSettle_Reserved 0x1c00
-#define bRxHTRxHPEn 0x8000
-#define bRxHTAGCFreezeThres 0x30000
-#define bRxHTAGCTogetherEn 0x40000
-#define bRxHTAGCMin 0x80000
-#define bRxHTAGCEn 0x100000
-#define bRxHTDAGCEn 0x200000
-#define bRxHTRxHP_BBP 0x1c00000
-#define bRxHTRxHP_Final 0xe0000000
-#define bRxPWRatioTH 0x3
-#define bRxPWRatioEn 0x4
-#define bRxMFHold 0x3800
-#define bRxPD_Delay_TH1 0x38
-#define bRxPD_Delay_TH2 0x1c0
-#define bRxPD_DC_COUNT_MAX 0x600
-//#define bRxMF_Hold 0x3800
-#define bRxPD_Delay_TH 0x8000
-#define bRxProcess_Delay 0xf0000
-#define bRxSearchrange_GI2_Early 0x700000
-#define bRxFrame_Guard_Counter_L 0x3800000
-#define bRxSGI_Guard_L 0xc000000
-#define bRxSGI_Search_L 0x30000000
-#define bRxSGI_TH 0xc0000000
-#define bDFSCnt0 0xff
-#define bDFSCnt1 0xff00
-#define bDFSFlag 0xf0000
-#define bMFWeightSum 0x300000
-#define bMinIdxTH 0x7f000000
-#define bDAFormat 0x40000
-#define bTxChEmuEnable 0x01000000
-#define bTRSWIsolation_A 0x7f
-#define bTRSWIsolation_B 0x7f00
-#define bTRSWIsolation_C 0x7f0000
-#define bTRSWIsolation_D 0x7f000000
-#define bExtLNAGain 0x7c00
-
-// 6. PageE(0xE00)
-#define bSTBCEn 0x4 // Useless
-#define bAntennaMapping 0x10
-#define bNss 0x20
-#define bCFOAntSumD 0x200
-#define bPHYCounterReset 0x8000000
-#define bCFOReportGet 0x4000000
-#define bOFDMContinueTx 0x10000000
-#define bOFDMSingleCarrier 0x20000000
-#define bOFDMSingleTone 0x40000000
-//#define bRxPath1 0x01
-//#define bRxPath2 0x02
-//#define bRxPath3 0x04
-//#define bRxPath4 0x08
-//#define bTxPath1 0x10
-//#define bTxPath2 0x20
-#define bHTDetect 0x100
-#define bCFOEn 0x10000
-#define bCFOValue 0xfff00000
-#define bSigTone_Re 0x3f
-#define bSigTone_Im 0x7f00
-#define bCounter_CCA 0xffff
-#define bCounter_ParityFail 0xffff0000
-#define bCounter_RateIllegal 0xffff
-#define bCounter_CRC8Fail 0xffff0000
-#define bCounter_MCSNoSupport 0xffff
-#define bCounter_FastSync 0xffff
-#define bShortCFO 0xfff
-#define bShortCFOTLength 12 //total
-#define bShortCFOFLength 11 //fraction
-#define bLongCFO 0x7ff
-#define bLongCFOTLength 11
-#define bLongCFOFLength 11
-#define bTailCFO 0x1fff
-#define bTailCFOTLength 13
-#define bTailCFOFLength 12
-#define bmax_en_pwdB 0xffff
-#define bCC_power_dB 0xffff0000
-#define bnoise_pwdB 0xffff
-#define bPowerMeasTLength 10
-#define bPowerMeasFLength 3
-#define bRx_HT_BW 0x1
-#define bRxSC 0x6
-#define bRx_HT 0x8
-#define bNB_intf_det_on 0x1
-#define bIntf_win_len_cfg 0x30
-#define bNB_Intf_TH_cfg 0x1c0
-#define bRFGain 0x3f
-#define bTableSel 0x40
-#define bTRSW 0x80
-#define bRxSNR_A 0xff
-#define bRxSNR_B 0xff00
-#define bRxSNR_C 0xff0000
-#define bRxSNR_D 0xff000000
-#define bSNREVMTLength 8
-#define bSNREVMFLength 1
-#define bCSI1st 0xff
-#define bCSI2nd 0xff00
-#define bRxEVM1st 0xff0000
-#define bRxEVM2nd 0xff000000
-#define bSIGEVM 0xff
-#define bPWDB 0xff00
-#define bSGIEN 0x10000
-
-#define bSFactorQAM1 0xf // Useless
-#define bSFactorQAM2 0xf0
-#define bSFactorQAM3 0xf00
-#define bSFactorQAM4 0xf000
-#define bSFactorQAM5 0xf0000
-#define bSFactorQAM6 0xf0000
-#define bSFactorQAM7 0xf00000
-#define bSFactorQAM8 0xf000000
-#define bSFactorQAM9 0xf0000000
-#define bCSIScheme 0x100000
-
-#define bNoiseLvlTopSet 0x3 // Useless
-#define bChSmooth 0x4
-#define bChSmoothCfg1 0x38
-#define bChSmoothCfg2 0x1c0
-#define bChSmoothCfg3 0xe00
-#define bChSmoothCfg4 0x7000
-#define bMRCMode 0x800000
-#define bTHEVMCfg 0x7000000
-
-#define bLoopFitType 0x1 // Useless
-#define bUpdCFO 0x40
-#define bUpdCFOOffData 0x80
-#define bAdvUpdCFO 0x100
-#define bAdvTimeCtrl 0x800
-#define bUpdClko 0x1000
-#define bFC 0x6000
-#define bTrackingMode 0x8000
-#define bPhCmpEnable 0x10000
-#define bUpdClkoLTF 0x20000
-#define bComChCFO 0x40000
-#define bCSIEstiMode 0x80000
-#define bAdvUpdEqz 0x100000
-#define bUChCfg 0x7000000
-#define bUpdEqz 0x8000000
-
-//Rx Pseduo noise
-#define bRxPesudoNoiseOn 0x20000000 // Useless
-#define bRxPesudoNoise_A 0xff
-#define bRxPesudoNoise_B 0xff00
-#define bRxPesudoNoise_C 0xff0000
-#define bRxPesudoNoise_D 0xff000000
-#define bPesudoNoiseState_A 0xffff
-#define bPesudoNoiseState_B 0xffff0000
-#define bPesudoNoiseState_C 0xffff
-#define bPesudoNoiseState_D 0xffff0000
-
-//7. RF Register
-//Zebra1
-#define bZebra1_HSSIEnable 0x8 // Useless
-#define bZebra1_TRxControl 0xc00
-#define bZebra1_TRxGainSetting 0x07f
-#define bZebra1_RxCorner 0xc00
-#define bZebra1_TxChargePump 0x38
-#define bZebra1_RxChargePump 0x7
-#define bZebra1_ChannelNum 0xf80
-#define bZebra1_TxLPFBW 0x400
-#define bZebra1_RxLPFBW 0x600
-
-//Zebra4
-#define bRTL8256RegModeCtrl1 0x100 // Useless
-#define bRTL8256RegModeCtrl0 0x40
-#define bRTL8256_TxLPFBW 0x18
-#define bRTL8256_RxLPFBW 0x600
-
-//RTL8258
-#define bRTL8258_TxLPFBW 0xc // Useless
-#define bRTL8258_RxLPFBW 0xc00
-#define bRTL8258_RSSILPFBW 0xc0
-
-
-//
-// Other Definition
-//
-
-//byte endable for sb_write
-#define bByte0 0x1 // Useless
-#define bByte1 0x2
-#define bByte2 0x4
-#define bByte3 0x8
-#define bWord0 0x3
-#define bWord1 0xc
-#define bDWord 0xf
-
-//for PutRegsetting & GetRegSetting BitMask
-#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f
-#define bMaskByte1 0xff00
-#define bMaskByte2 0xff0000
-#define bMaskByte3 0xff000000
-#define bMaskHWord 0xffff0000
-#define bMaskLWord 0x0000ffff
-#define bMaskDWord 0xffffffff
-#define bMask12Bits 0xfff
-#define bMaskH4Bits 0xf0000000
-#define bMaskOFDM_D 0xffc00000
-#define bMaskCCK 0x3f3f3f3f
-
-//for PutRFRegsetting & GetRFRegSetting BitMask
-//#define bMask12Bits 0xfffff // RF Reg mask bits
-//#define bMask20Bits 0xfffff // RF Reg mask bits T65 RF
-#define bRFRegOffsetMask 0xfffff
-
-#define bEnable 0x1 // Useless
-#define bDisable 0x0
-
-#define LeftAntenna 0x0 // Useless
-#define RightAntenna 0x1
-
-#define tCheckTxStatus 500 //500ms // Useless
-#define tUpdateRxCounter 100 //100ms
-
-#define rateCCK 0 // Useless
-#define rateOFDM 1
-#define rateHT 2
-
-//define Register-End
-#define bPMAC_End 0x1ff // Useless
-#define bFPGAPHY0_End 0x8ff
-#define bFPGAPHY1_End 0x9ff
-#define bCCKPHY0_End 0xaff
-#define bOFDMPHY0_End 0xcff
-#define bOFDMPHY1_End 0xdff
-
-//define max debug item in each debug page
-//#define bMaxItem_FPGA_PHY0 0x9
-//#define bMaxItem_FPGA_PHY1 0x3
-//#define bMaxItem_PHY_11B 0x16
-//#define bMaxItem_OFDM_PHY0 0x29
-//#define bMaxItem_OFDM_PHY1 0x0
-
-#define bPMACControl 0x0 // Useless
-#define bWMACControl 0x1
-#define bWNICControl 0x2
-
-#define PathA 0x0 // Useless
-#define PathB 0x1
-#define PathC 0x2
-#define PathD 0x3
-
-
-// RSSI Dump Message
-#define rA_RSSIDump_92E 0xcb0
-#define rB_RSSIDump_92E 0xcb1
-#define rS1_RXevmDump_92E 0xcb2
-#define rS2_RXevmDump_92E 0xcb3
-#define rA_RXsnrDump_92E 0xcb4
-#define rB_RXsnrDump_92E 0xcb5
-#define rA_CfoShortDump_92E 0xcb6
-#define rB_CfoShortDump_92E 0xcb8
-#define rA_CfoLongDump_92E 0xcba
-#define rB_CfoLongDump_92E 0xcbc
-
-/*--------------------------Define Parameters-------------------------------*/
-
-
-#endif //__INC_HAL8188EPHYREG_H
-
+/*****************************************************************************
+ * Copyright(c) 2008, RealTEK Technology Inc. All Right Reserved.
+ *
+ * Module: __INC_HAL8192SPHYREG_H
+ *
+ *
+ * Note: 1. Define PMAC/BB register map
+ * 2. Define RF register map
+ * 3. PMAC/BB register bit mask.
+ * 4. RF reg bit mask.
+ * 5. Other BB/RF relative definition.
+ *
+ *
+ * Export: Constants, macro, functions(API), global variables(None).
+ *
+ * Abbrev:
+ *
+ * History:
+ * Data Who Remark
+ * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h.
+ * 2. Reorganize code architecture.
+ * 09/25/2008 MH 1. Add RL6052 register definition
+ *
+ *****************************************************************************/
+#ifndef __INC_HAL8192EPHYREG_H
+#define __INC_HAL8192EPHYREG_H
+
+
+/*--------------------------Define Parameters-------------------------------*/
+
+//============================================================
+// 8192S Regsiter offset definition
+//============================================================
+
+//
+// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF
+// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
+// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00
+// 3. RF register 0x00-2E
+// 4. Bit Mask for BB/RF register
+// 5. Other defintion for BB/RF R/W
+//
+
+
+//
+// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
+// 1. Page1(0x100)
+//
+#define rPMAC_Reset 0x100
+#define rPMAC_TxStart 0x104
+#define rPMAC_TxLegacySIG 0x108
+#define rPMAC_TxHTSIG1 0x10c
+#define rPMAC_TxHTSIG2 0x110
+#define rPMAC_PHYDebug 0x114
+#define rPMAC_TxPacketNum 0x118
+#define rPMAC_TxIdle 0x11c
+#define rPMAC_TxMACHeader0 0x120
+#define rPMAC_TxMACHeader1 0x124
+#define rPMAC_TxMACHeader2 0x128
+#define rPMAC_TxMACHeader3 0x12c
+#define rPMAC_TxMACHeader4 0x130
+#define rPMAC_TxMACHeader5 0x134
+#define rPMAC_TxDataType 0x138
+#define rPMAC_TxRandomSeed 0x13c
+#define rPMAC_CCKPLCPPreamble 0x140
+#define rPMAC_CCKPLCPHeader 0x144
+#define rPMAC_CCKCRC16 0x148
+#define rPMAC_OFDMRxCRC32OK 0x170
+#define rPMAC_OFDMRxCRC32Er 0x174
+#define rPMAC_OFDMRxParityEr 0x178
+#define rPMAC_OFDMRxCRC8Er 0x17c
+#define rPMAC_CCKCRxRC16Er 0x180
+#define rPMAC_CCKCRxRC32Er 0x184
+#define rPMAC_CCKCRxRC32OK 0x188
+#define rPMAC_TxStatus 0x18c
+
+
+//
+// 3. Page8(0x800)
+//
+#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting??
+
+#define rFPGA0_TxInfo 0x804 // Status report??
+#define rFPGA0_PSDFunction 0x808
+
+#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain?
+
+#define rFPGA0_RFTiming1 0x810 // Useless now
+#define rFPGA0_RFTiming2 0x814
+
+#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register
+#define rFPGA0_XA_HSSIParameter2 0x824
+#define rFPGA0_XB_HSSIParameter1 0x828
+#define rFPGA0_XB_HSSIParameter2 0x82c
+
+#define rFPGA0_XA_LSSIParameter 0x840
+#define rFPGA0_XB_LSSIParameter 0x844
+
+#define rFPGA0_RFWakeUpParameter 0x850 // Useless now
+#define rFPGA0_RFSleepUpParameter 0x854
+
+#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch
+#define rFPGA0_XCD_SwitchControl 0x85c
+
+#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch
+#define rFPGA0_XB_RFInterfaceOE 0x864
+
+#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control
+#define rFPGA0_XCD_RFInterfaceSW 0x874
+
+#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter
+#define rFPGA0_XCD_RFParameter 0x87c
+
+#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4??
+#define rFPGA0_AnalogParameter2 0x884
+#define rFPGA0_AnalogParameter3 0x888
+#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy
+#define rFPGA0_AnalogParameter4 0x88c
+
+#define rFPGA0_XA_LSSIReadBack 0x8a0 // Tranceiver LSSI Readback
+#define rFPGA0_XB_LSSIReadBack 0x8a4
+#define rFPGA0_XC_LSSIReadBack 0x8a8
+#define rFPGA0_XD_LSSIReadBack 0x8ac
+
+#define rFPGA0_PSDReport 0x8b4 // Useless now
+#define TransceiverA_HSPI_Readback 0x8b8 // Transceiver A HSPI Readback
+#define TransceiverB_HSPI_Readback 0x8bc // Transceiver B HSPI Readback
+#define rFPGA0_XAB_RFInterfaceRB 0x8e0 // Useless now // RF Interface Readback Value
+#define rFPGA0_XCD_RFInterfaceRB 0x8e4 // Useless now
+
+//
+// 4. Page9(0x900)
+//
+#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting??
+
+#define rFPGA1_TxBlock 0x904 // Useless now
+#define rFPGA1_DebugSelect 0x908 // Useless now
+#define rFPGA1_TxInfo 0x90c // Useless now // Status report??
+
+//
+// 5. PageA(0xA00)
+//
+// Set Control channel to upper or lower. These settings are required only for 40MHz
+#define rCCK0_System 0xa00
+
+#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI
+#define rCCK0_CCA 0xa08 // Disable init gain now // Init gain
+
+#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series
+#define rCCK0_RxAGC2 0xa10 //AGC & DAGC
+
+#define rCCK0_RxHP 0xa14
+
+#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold
+#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
+#define rCCK0_TRSSIReport 0xa50
+#define rCCK0_RxReport 0xa54 //0xa57
+#define rCCK0_FACounterLower 0xa5c //0xa5b
+#define rCCK0_FACounterUpper 0xa58 //0xa5c
+
+//
+// PageB(0xB00)
+//
+#define rPdp_AntA 0xb00
+#define rPdp_AntA_4 0xb04
+#define rConfig_Pmpd_AntA 0xb28
+#define rConfig_ram64x16 0xb2c
+
+#define rConfig_AntA 0xb68
+#define rConfig_AntB 0xb6c
+#define rPdp_AntB 0xb70
+#define rPdp_AntB_4 0xb74
+#define rConfig_Pmpd_AntB 0xb98
+#define rAPK 0xbd8
+
+
+
+//
+// 6. PageC(0xC00)
+//
+#define rOFDM0_LSTF 0xc00
+
+#define rOFDM0_TRxPathEnable 0xc04
+#define rOFDM0_TRMuxPar 0xc08
+#define rOFDM0_TRSWIsolation 0xc0c
+
+#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter
+#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix
+#define rOFDM0_XBRxAFE 0xc18
+#define rOFDM0_XBRxIQImbalance 0xc1c
+#define rOFDM0_XCRxAFE 0xc20
+#define rOFDM0_XCRxIQImbalance 0xc24
+#define rOFDM0_XDRxAFE 0xc28
+#define rOFDM0_XDRxIQImbalance 0xc2c
+
+#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain
+#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync.
+#define rOFDM0_RxDetector3 0xc38 //Frame Sync.
+#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI
+
+#define rOFDM0_RxDSP 0xc40 //Rx Sync Path
+#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC
+#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold
+#define rOFDM0_ECCAThreshold 0xc4c // energy CCA
+
+#define rOFDM0_XAAGCCore1 0xc50 // DIG
+#define rOFDM0_XAAGCCore2 0xc54
+#define rOFDM0_XBAGCCore1 0xc58
+#define rOFDM0_XBAGCCore2 0xc5c
+#define rOFDM0_XCAGCCore1 0xc60
+#define rOFDM0_XCAGCCore2 0xc64
+#define rOFDM0_XDAGCCore1 0xc68
+#define rOFDM0_XDAGCCore2 0xc6c
+
+#define rOFDM0_AGCParameter1 0xc70
+#define rOFDM0_AGCParameter2 0xc74
+#define rOFDM0_AGCRSSITable 0xc78
+#define rOFDM0_HTSTFAGC 0xc7c
+
+#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG
+#define rOFDM0_XATxAFE 0xc84
+#define rOFDM0_XBTxIQImbalance 0xc88
+#define rOFDM0_XBTxAFE 0xc8c
+#define rOFDM0_XCTxIQImbalance 0xc90
+#define rOFDM0_XCTxAFE 0xc94
+#define rOFDM0_XDTxIQImbalance 0xc98
+#define rOFDM0_XDTxAFE 0xc9c
+
+#define rOFDM0_RxIQExtAnta 0xca0
+#define rOFDM0_TxCoeff1 0xca4
+#define rOFDM0_TxCoeff2 0xca8
+#define rOFDM0_TxCoeff3 0xcac
+#define rOFDM0_TxCoeff4 0xcb0
+#define rOFDM0_TxCoeff5 0xcb4
+#define rOFDM0_RxHPParameter 0xce0
+#define rOFDM0_TxPseudoNoiseWgt 0xce4
+#define rOFDM0_FrameSync 0xcf0
+#define rOFDM0_DFSReport 0xcf4
+
+
+//
+// 7. PageD(0xD00)
+//
+#define rOFDM1_LSTF 0xd00
+#define rOFDM1_TRxPathEnable 0xd04
+
+#define rOFDM1_CFO 0xd08 // No setting now
+#define rOFDM1_CSI1 0xd10
+#define rOFDM1_SBD 0xd14
+#define rOFDM1_CSI2 0xd18
+#define rOFDM1_CFOTracking 0xd2c
+#define rOFDM1_TRxMesaure1 0xd34
+#define rOFDM1_IntfDet 0xd3c
+#define rOFDM1_PseudoNoiseStateAB 0xd50
+#define rOFDM1_PseudoNoiseStateCD 0xd54
+#define rOFDM1_RxPseudoNoiseWgt 0xd58
+
+#define rOFDM_PHYCounter1 0xda0 //cca, parity fail
+#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail
+#define rOFDM_PHYCounter3 0xda8 //MCS not support
+
+#define rOFDM_ShortCFOAB 0xdac // No setting now
+#define rOFDM_ShortCFOCD 0xdb0
+#define rOFDM_LongCFOAB 0xdb4
+#define rOFDM_LongCFOCD 0xdb8
+#define rOFDM_TailCFOAB 0xdbc
+#define rOFDM_TailCFOCD 0xdc0
+#define rOFDM_PWMeasure1 0xdc4
+#define rOFDM_PWMeasure2 0xdc8
+#define rOFDM_BWReport 0xdcc
+#define rOFDM_AGCReport 0xdd0
+#define rOFDM_RxSNR 0xdd4
+#define rOFDM_RxEVMCSI 0xdd8
+#define rOFDM_SIGReport 0xddc
+
+
+//
+// 8. PageE(0xE00)
+//
+#define rTxAGC_A_Rate18_06 0xe00
+#define rTxAGC_A_Rate54_24 0xe04
+#define rTxAGC_A_CCK1_Mcs32 0xe08
+#define rTxAGC_A_Mcs03_Mcs00 0xe10
+#define rTxAGC_A_Mcs07_Mcs04 0xe14
+#define rTxAGC_A_Mcs11_Mcs08 0xe18
+#define rTxAGC_A_Mcs15_Mcs12 0xe1c
+
+#define rTxAGC_B_Rate18_06 0x830
+#define rTxAGC_B_Rate54_24 0x834
+#define rTxAGC_B_CCK1_55_Mcs32 0x838
+#define rTxAGC_B_Mcs03_Mcs00 0x83c
+#define rTxAGC_B_Mcs07_Mcs04 0x848
+#define rTxAGC_B_Mcs11_Mcs08 0x84c
+#define rTxAGC_B_Mcs15_Mcs12 0x868
+#define rTxAGC_B_CCK11_A_CCK2_11 0x86c
+
+#define rFPGA0_IQK 0xe28
+#define rTx_IQK_Tone_A 0xe30
+#define rRx_IQK_Tone_A 0xe34
+#define rTx_IQK_PI_A 0xe38
+#define rRx_IQK_PI_A 0xe3c
+
+#define rTx_IQK 0xe40
+#define rRx_IQK 0xe44
+#define rIQK_AGC_Pts 0xe48
+#define rIQK_AGC_Rsp 0xe4c
+#define rTx_IQK_Tone_B 0xe50
+#define rRx_IQK_Tone_B 0xe54
+#define rTx_IQK_PI_B 0xe58
+#define rRx_IQK_PI_B 0xe5c
+#define rIQK_AGC_Cont 0xe60
+
+#define rBlue_Tooth 0xe6c
+#define rRx_Wait_CCA 0xe70
+#define rTx_CCK_RFON 0xe74
+#define rTx_CCK_BBON 0xe78
+#define rTx_OFDM_RFON 0xe7c
+#define rTx_OFDM_BBON 0xe80
+#define rTx_To_Rx 0xe84
+#define rTx_To_Tx 0xe88
+#define rRx_CCK 0xe8c
+
+#define rTx_Power_Before_IQK_A 0xe94
+#define rTx_Power_After_IQK_A 0xe9c
+
+#define rRx_Power_Before_IQK_A 0xea0
+#define rRx_Power_Before_IQK_A_2 0xea4
+#define rRx_Power_After_IQK_A 0xea8
+#define rRx_Power_After_IQK_A_2 0xeac
+
+#define rTx_Power_Before_IQK_B 0xeb4
+#define rTx_Power_After_IQK_B 0xebc
+
+#define rRx_Power_Before_IQK_B 0xec0
+#define rRx_Power_Before_IQK_B_2 0xec4
+#define rRx_Power_After_IQK_B 0xec8
+#define rRx_Power_After_IQK_B_2 0xecc
+
+#define rRx_OFDM 0xed0
+#define rRx_Wait_RIFS 0xed4
+#define rRx_TO_Rx 0xed8
+#define rStandby 0xedc
+#define rSleep 0xee0
+#define rPMPD_ANAEN 0xeec
+
+//
+// 7. RF Register 0x00-0x2E (RF 8256)
+// RF-0222D 0x00-3F
+//
+//Zebra1
+#define rZebra1_HSSIEnable 0x0 // Useless now
+#define rZebra1_TRxEnable1 0x1
+#define rZebra1_TRxEnable2 0x2
+#define rZebra1_AGC 0x4
+#define rZebra1_ChargePump 0x5
+#define rZebra1_Channel 0x7 // RF channel switch
+
+//#endif
+#define rZebra1_TxGain 0x8 // Useless now
+#define rZebra1_TxLPF 0x9
+#define rZebra1_RxLPF 0xb
+#define rZebra1_RxHPFCorner 0xc
+
+//Zebra4
+#define rGlobalCtrl 0 // Useless now
+#define rRTL8256_TxLPF 19
+#define rRTL8256_RxLPF 11
+
+//RTL8258
+#define rRTL8258_TxLPF 0x11 // Useless now
+#define rRTL8258_RxLPF 0x13
+#define rRTL8258_RSSILPF 0xa
+
+//
+// RL6052 Register definition
+//
+#define RF_AC 0x00 //
+
+#define RF_IQADJ_G1 0x01 //
+#define RF_IQADJ_G2 0x02 //
+
+#define RF_POW_TRSW 0x05 //
+
+#define RF_GAIN_RX 0x06 //
+#define RF_GAIN_TX 0x07 //
+
+#define RF_TXM_IDAC 0x08 //
+#define RF_IPA_G 0x09 //
+#define RF_TXBIAS_G 0x0A
+#define RF_TXPA_AG 0x0B
+#define RF_IPA_A 0x0C //
+#define RF_TXBIAS_A 0x0D
+#define RF_BS_PA_APSET_G9_G11 0x0E
+#define RF_BS_IQGEN 0x0F //
+
+#define RF_MODE1 0x10 //
+#define RF_MODE2 0x11 //
+
+#define RF_RX_AGC_HP 0x12 //
+#define RF_TX_AGC 0x13 //
+#define RF_BIAS 0x14 //
+#define RF_IPA 0x15 //
+#define RF_TXBIAS 0x16
+#define RF_POW_ABILITY 0x17 //
+#define RF_CHNLBW 0x18 // RF channel and BW switch
+#define RF_TOP 0x19 //
+
+#define RF_RX_G1 0x1A //
+#define RF_RX_G2 0x1B //
+
+#define RF_RX_BB2 0x1C //
+#define RF_RX_BB1 0x1D //
+
+#define RF_RCK1 0x1E //
+#define RF_RCK2 0x1F //
+
+#define RF_TX_G1 0x20 //
+#define RF_TX_G2 0x21 //
+#define RF_TX_G3 0x22 //
+
+#define RF_TX_BB1 0x23 //
+
+//#if HARDWARE_TYPE_IS_RTL8192D == 1
+#define RF_T_METER_92D 0x42 //
+//#else
+#define RF_T_METER_88E 0x42 //
+#define RF_T_METER 0x24 //
+
+//#endif
+
+#define RF_SYN_G1 0x25 // RF TX Power control
+#define RF_SYN_G2 0x26 // RF TX Power control
+#define RF_SYN_G3 0x27 // RF TX Power control
+#define RF_SYN_G4 0x28 // RF TX Power control
+#define RF_SYN_G5 0x29 // RF TX Power control
+#define RF_SYN_G6 0x2A // RF TX Power control
+#define RF_SYN_G7 0x2B // RF TX Power control
+#define RF_SYN_G8 0x2C // RF TX Power control
+
+#define RF_RCK_OS 0x30 // RF TX PA control
+#define RF_TXPA_G1 0x31 // RF TX PA control
+#define RF_TXPA_G2 0x32 // RF TX PA control
+#define RF_TXPA_G3 0x33 // RF TX PA control
+#define RF_TX_BIAS_A 0x35
+#define RF_TX_BIAS_D 0x36
+#define RF_LOBF_9 0x38
+#define RF_RXRF_A3 0x3C //
+#define RF_TRSW 0x3F
+
+#define RF_TXRF_A2 0x41
+#define RF_TXPA_G4 0x46
+#define RF_TXPA_A4 0x4B
+#define RF_0x52 0x52
+#define RF_LDO 0xB1
+#define RF_WE_LUT 0xEF
+
+
+//
+//Bit Mask
+//
+// 1. Page1(0x100)
+#define bBBResetB 0x100 // Useless now?
+#define bGlobalResetB 0x200
+#define bOFDMTxStart 0x4
+#define bCCKTxStart 0x8
+#define bCRC32Debug 0x100
+#define bPMACLoopback 0x10
+#define bTxLSIG 0xffffff
+#define bOFDMTxRate 0xf
+#define bOFDMTxReserved 0x10
+#define bOFDMTxLength 0x1ffe0
+#define bOFDMTxParity 0x20000
+#define bTxHTSIG1 0xffffff
+#define bTxHTMCSRate 0x7f
+#define bTxHTBW 0x80
+#define bTxHTLength 0xffff00
+#define bTxHTSIG2 0xffffff
+#define bTxHTSmoothing 0x1
+#define bTxHTSounding 0x2
+#define bTxHTReserved 0x4
+#define bTxHTAggreation 0x8
+#define bTxHTSTBC 0x30
+#define bTxHTAdvanceCoding 0x40
+#define bTxHTShortGI 0x80
+#define bTxHTNumberHT_LTF 0x300
+#define bTxHTCRC8 0x3fc00
+#define bCounterReset 0x10000
+#define bNumOfOFDMTx 0xffff
+#define bNumOfCCKTx 0xffff0000
+#define bTxIdleInterval 0xffff
+#define bOFDMService 0xffff0000
+#define bTxMACHeader 0xffffffff
+#define bTxDataInit 0xff
+#define bTxHTMode 0x100
+#define bTxDataType 0x30000
+#define bTxRandomSeed 0xffffffff
+#define bCCKTxPreamble 0x1
+#define bCCKTxSFD 0xffff0000
+#define bCCKTxSIG 0xff
+#define bCCKTxService 0xff00
+#define bCCKLengthExt 0x8000
+#define bCCKTxLength 0xffff0000
+#define bCCKTxCRC16 0xffff
+#define bCCKTxStatus 0x1
+#define bOFDMTxStatus 0x2
+
+#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff))
+
+// 2. Page8(0x800)
+#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD
+#define bJapanMode 0x2
+#define bCCKTxSC 0x30
+#define bCCKEn 0x1000000
+#define bOFDMEn 0x2000000
+
+#define bOFDMRxADCPhase 0x10000 // Useless now
+#define bOFDMTxDACPhase 0x40000
+#define bXATxAGC 0x3f
+
+#define bAntennaSelect 0x0300
+
+#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage
+#define bXCTxAGC 0xf000
+#define bXDTxAGC 0xf0000
+
+#define bPAStart 0xf0000000 // Useless now
+#define bTRStart 0x00f00000
+#define bRFStart 0x0000f000
+#define bBBStart 0x000000f0
+#define bBBCCKStart 0x0000000f
+#define bPAEnd 0xf //Reg0x814
+#define bTREnd 0x0f000000
+#define bRFEnd 0x000f0000
+#define bCCAMask 0x000000f0 //T2R
+#define bR2RCCAMask 0x00000f00
+#define bHSSI_R2TDelay 0xf8000000
+#define bHSSI_T2RDelay 0xf80000
+#define bContTxHSSI 0x400 //chane gain at continue Tx
+#define bIGFromCCK 0x200
+#define bAGCAddress 0x3f
+#define bRxHPTx 0x7000
+#define bRxHPT2R 0x38000
+#define bRxHPCCKIni 0xc0000
+#define bAGCTxCode 0xc00000
+#define bAGCRxCode 0x300000
+
+#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1
+#define b3WireAddressLength 0x400
+
+#define b3WireRFPowerDown 0x1 // Useless now
+//#define bHWSISelect 0x8
+#define b5GPAPEPolarity 0x40000000
+#define b2GPAPEPolarity 0x80000000
+#define bRFSW_TxDefaultAnt 0x3
+#define bRFSW_TxOptionAnt 0x30
+#define bRFSW_RxDefaultAnt 0x300
+#define bRFSW_RxOptionAnt 0x3000
+#define bRFSI_3WireData 0x1
+#define bRFSI_3WireClock 0x2
+#define bRFSI_3WireLoad 0x4
+#define bRFSI_3WireRW 0x8
+#define bRFSI_3Wire 0xf
+
+#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW
+
+#define bRFSI_TRSW 0x20 // Useless now
+#define bRFSI_TRSWB 0x40
+#define bRFSI_ANTSW 0x100
+#define bRFSI_ANTSWB 0x200
+#define bRFSI_PAPE 0x400
+#define bRFSI_PAPE5G 0x800
+#define bBandSelect 0x1
+#define bHTSIG2_GI 0x80
+#define bHTSIG2_Smoothing 0x01
+#define bHTSIG2_Sounding 0x02
+#define bHTSIG2_Aggreaton 0x08
+#define bHTSIG2_STBC 0x30
+#define bHTSIG2_AdvCoding 0x40
+#define bHTSIG2_NumOfHTLTF 0x300
+#define bHTSIG2_CRC8 0x3fc
+#define bHTSIG1_MCS 0x7f
+#define bHTSIG1_BandWidth 0x80
+#define bHTSIG1_HTLength 0xffff
+#define bLSIG_Rate 0xf
+#define bLSIG_Reserved 0x10
+#define bLSIG_Length 0x1fffe
+#define bLSIG_Parity 0x20
+#define bCCKRxPhase 0x4
+
+#define bLSSIReadAddress 0x7f800000 // T65 RF
+
+#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal
+
+#define bLSSIReadBackData 0xfffff // T65 RF
+
+#define bLSSIReadOKFlag 0x1000 // Useless now
+#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz
+#define bRegulator0Standby 0x1
+#define bRegulatorPLLStandby 0x2
+#define bRegulator1Standby 0x4
+#define bPLLPowerUp 0x8
+#define bDPLLPowerUp 0x10
+#define bDA10PowerUp 0x20
+#define bAD7PowerUp 0x200
+#define bDA6PowerUp 0x2000
+#define bXtalPowerUp 0x4000
+#define b40MDClkPowerUP 0x8000
+#define bDA6DebugMode 0x20000
+#define bDA6Swing 0x380000
+
+#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ
+
+#define b80MClkDelay 0x18000000 // Useless
+#define bAFEWatchDogEnable 0x20000000
+
+#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap
+#define bXtalCap23 0x3
+#define bXtalCap92x 0x0f000000
+#define bXtalCap 0x0f000000
+
+#define bIntDifClkEnable 0x400 // Useless
+#define bExtSigClkEnable 0x800
+#define bBandgapMbiasPowerUp 0x10000
+#define bAD11SHGain 0xc0000
+#define bAD11InputRange 0x700000
+#define bAD11OPCurrent 0x3800000
+#define bIPathLoopback 0x4000000
+#define bQPathLoopback 0x8000000
+#define bAFELoopback 0x10000000
+#define bDA10Swing 0x7e0
+#define bDA10Reverse 0x800
+#define bDAClkSource 0x1000
+#define bAD7InputRange 0x6000
+#define bAD7Gain 0x38000
+#define bAD7OutputCMMode 0x40000
+#define bAD7InputCMMode 0x380000
+#define bAD7Current 0xc00000
+#define bRegulatorAdjust 0x7000000
+#define bAD11PowerUpAtTx 0x1
+#define bDA10PSAtTx 0x10
+#define bAD11PowerUpAtRx 0x100
+#define bDA10PSAtRx 0x1000
+#define bCCKRxAGCFormat 0x200
+#define bPSDFFTSamplepPoint 0xc000
+#define bPSDAverageNum 0x3000
+#define bIQPathControl 0xc00
+#define bPSDFreq 0x3ff
+#define bPSDAntennaPath 0x30
+#define bPSDIQSwitch 0x40
+#define bPSDRxTrigger 0x400000
+#define bPSDTxTrigger 0x80000000
+#define bPSDSineToneScale 0x7f000000
+#define bPSDReport 0xffff
+
+// 3. Page9(0x900)
+#define bOFDMTxSC 0x30000000 // Useless
+#define bCCKTxOn 0x1
+#define bOFDMTxOn 0x2
+#define bDebugPage 0xfff //reset debug page and also HWord, LWord
+#define bDebugItem 0xff //reset debug page and LWord
+#define bAntL 0x10
+#define bAntNonHT 0x100
+#define bAntHT1 0x1000
+#define bAntHT2 0x10000
+#define bAntHT1S1 0x100000
+#define bAntNonHTS1 0x1000000
+
+// 4. PageA(0xA00)
+#define bCCKBBMode 0x3 // Useless
+#define bCCKTxPowerSaving 0x80
+#define bCCKRxPowerSaving 0x40
+
+#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch
+
+#define bCCKScramble 0x8 // Useless
+#define bCCKAntDiversity 0x8000
+#define bCCKCarrierRecovery 0x4000
+#define bCCKTxRate 0x3000
+#define bCCKDCCancel 0x0800
+#define bCCKISICancel 0x0400
+#define bCCKMatchFilter 0x0200
+#define bCCKEqualizer 0x0100
+#define bCCKPreambleDetect 0x800000
+#define bCCKFastFalseCCA 0x400000
+#define bCCKChEstStart 0x300000
+#define bCCKCCACount 0x080000
+#define bCCKcs_lim 0x070000
+#define bCCKBistMode 0x80000000
+#define bCCKCCAMask 0x40000000
+#define bCCKTxDACPhase 0x4
+#define bCCKRxADCPhase 0x20000000 //r_rx_clk
+#define bCCKr_cp_mode0 0x0100
+#define bCCKTxDCOffset 0xf0
+#define bCCKRxDCOffset 0xf
+#define bCCKCCAMode 0xc000
+#define bCCKFalseCS_lim 0x3f00
+#define bCCKCS_ratio 0xc00000
+#define bCCKCorgBit_sel 0x300000
+#define bCCKPD_lim 0x0f0000
+#define bCCKNewCCA 0x80000000
+#define bCCKRxHPofIG 0x8000
+#define bCCKRxIG 0x7f00
+#define bCCKLNAPolarity 0x800000
+#define bCCKRx1stGain 0x7f0000
+#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity
+#define bCCKRxAGCSatLevel 0x1f000000
+#define bCCKRxAGCSatCount 0xe0
+#define bCCKRxRFSettle 0x1f //AGCsamp_dly
+#define bCCKFixedRxAGC 0x8000
+//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824
+#define bCCKAntennaPolarity 0x2000
+#define bCCKTxFilterType 0x0c00
+#define bCCKRxAGCReportType 0x0300
+#define bCCKRxDAGCEn 0x80000000
+#define bCCKRxDAGCPeriod 0x20000000
+#define bCCKRxDAGCSatLevel 0x1f000000
+#define bCCKTimingRecovery 0x800000
+#define bCCKTxC0 0x3f0000
+#define bCCKTxC1 0x3f000000
+#define bCCKTxC2 0x3f
+#define bCCKTxC3 0x3f00
+#define bCCKTxC4 0x3f0000
+#define bCCKTxC5 0x3f000000
+#define bCCKTxC6 0x3f
+#define bCCKTxC7 0x3f00
+#define bCCKDebugPort 0xff0000
+#define bCCKDACDebug 0x0f000000
+#define bCCKFalseAlarmEnable 0x8000
+#define bCCKFalseAlarmRead 0x4000
+#define bCCKTRSSI 0x7f
+#define bCCKRxAGCReport 0xfe
+#define bCCKRxReport_AntSel 0x80000000
+#define bCCKRxReport_MFOff 0x40000000
+#define bCCKRxRxReport_SQLoss 0x20000000
+#define bCCKRxReport_Pktloss 0x10000000
+#define bCCKRxReport_Lockedbit 0x08000000
+#define bCCKRxReport_RateError 0x04000000
+#define bCCKRxReport_RxRate 0x03000000
+#define bCCKRxFACounterLower 0xff
+#define bCCKRxFACounterUpper 0xff000000
+#define bCCKRxHPAGCStart 0xe000
+#define bCCKRxHPAGCFinal 0x1c00
+#define bCCKRxFalseAlarmEnable 0x8000
+#define bCCKFACounterFreeze 0x4000
+#define bCCKTxPathSel 0x10000000
+#define bCCKDefaultRxPath 0xc000000
+#define bCCKOptionRxPath 0x3000000
+
+// 5. PageC(0xC00)
+#define bNumOfSTF 0x3 // Useless
+#define bShift_L 0xc0
+#define bGI_TH 0xc
+#define bRxPathA 0x1
+#define bRxPathB 0x2
+#define bRxPathC 0x4
+#define bRxPathD 0x8
+#define bTxPathA 0x1
+#define bTxPathB 0x2
+#define bTxPathC 0x4
+#define bTxPathD 0x8
+#define bTRSSIFreq 0x200
+#define bADCBackoff 0x3000
+#define bDFIRBackoff 0xc000
+#define bTRSSILatchPhase 0x10000
+#define bRxIDCOffset 0xff
+#define bRxQDCOffset 0xff00
+#define bRxDFIRMode 0x1800000
+#define bRxDCNFType 0xe000000
+#define bRXIQImb_A 0x3ff
+#define bRXIQImb_B 0xfc00
+#define bRXIQImb_C 0x3f0000
+#define bRXIQImb_D 0xffc00000
+#define bDC_dc_Notch 0x60000
+#define bRxNBINotch 0x1f000000
+#define bPD_TH 0xf
+#define bPD_TH_Opt2 0xc000
+#define bPWED_TH 0x700
+#define bIfMF_Win_L 0x800
+#define bPD_Option 0x1000
+#define bMF_Win_L 0xe000
+#define bBW_Search_L 0x30000
+#define bwin_enh_L 0xc0000
+#define bBW_TH 0x700000
+#define bED_TH2 0x3800000
+#define bBW_option 0x4000000
+#define bRatio_TH 0x18000000
+#define bWindow_L 0xe0000000
+#define bSBD_Option 0x1
+#define bFrame_TH 0x1c
+#define bFS_Option 0x60
+#define bDC_Slope_check 0x80
+#define bFGuard_Counter_DC_L 0xe00
+#define bFrame_Weight_Short 0x7000
+#define bSub_Tune 0xe00000
+#define bFrame_DC_Length 0xe000000
+#define bSBD_start_offset 0x30000000
+#define bFrame_TH_2 0x7
+#define bFrame_GI2_TH 0x38
+#define bGI2_Sync_en 0x40
+#define bSarch_Short_Early 0x300
+#define bSarch_Short_Late 0xc00
+#define bSarch_GI2_Late 0x70000
+#define bCFOAntSum 0x1
+#define bCFOAcc 0x2
+#define bCFOStartOffset 0xc
+#define bCFOLookBack 0x70
+#define bCFOSumWeight 0x80
+#define bDAGCEnable 0x10000
+#define bTXIQImb_A 0x3ff
+#define bTXIQImb_B 0xfc00
+#define bTXIQImb_C 0x3f0000
+#define bTXIQImb_D 0xffc00000
+#define bTxIDCOffset 0xff
+#define bTxQDCOffset 0xff00
+#define bTxDFIRMode 0x10000
+#define bTxPesudoNoiseOn 0x4000000
+#define bTxPesudoNoise_A 0xff
+#define bTxPesudoNoise_B 0xff00
+#define bTxPesudoNoise_C 0xff0000
+#define bTxPesudoNoise_D 0xff000000
+#define bCCADropOption 0x20000
+#define bCCADropThres 0xfff00000
+#define bEDCCA_H 0xf
+#define bEDCCA_L 0xf0
+#define bLambda_ED 0x300
+#define bRxInitialGain 0x7f
+#define bRxAntDivEn 0x80
+#define bRxAGCAddressForLNA 0x7f00
+#define bRxHighPowerFlow 0x8000
+#define bRxAGCFreezeThres 0xc0000
+#define bRxFreezeStep_AGC1 0x300000
+#define bRxFreezeStep_AGC2 0xc00000
+#define bRxFreezeStep_AGC3 0x3000000
+#define bRxFreezeStep_AGC0 0xc000000
+#define bRxRssi_Cmp_En 0x10000000
+#define bRxQuickAGCEn 0x20000000
+#define bRxAGCFreezeThresMode 0x40000000
+#define bRxOverFlowCheckType 0x80000000
+#define bRxAGCShift 0x7f
+#define bTRSW_Tri_Only 0x80
+#define bPowerThres 0x300
+#define bRxAGCEn 0x1
+#define bRxAGCTogetherEn 0x2
+#define bRxAGCMin 0x4
+#define bRxHP_Ini 0x7
+#define bRxHP_TRLNA 0x70
+#define bRxHP_RSSI 0x700
+#define bRxHP_BBP1 0x7000
+#define bRxHP_BBP2 0x70000
+#define bRxHP_BBP3 0x700000
+#define bRSSI_H 0x7f0000 //the threshold for high power
+#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity
+#define bRxSettle_TRSW 0x7
+#define bRxSettle_LNA 0x38
+#define bRxSettle_RSSI 0x1c0
+#define bRxSettle_BBP 0xe00
+#define bRxSettle_RxHP 0x7000
+#define bRxSettle_AntSW_RSSI 0x38000
+#define bRxSettle_AntSW 0xc0000
+#define bRxProcessTime_DAGC 0x300000
+#define bRxSettle_HSSI 0x400000
+#define bRxProcessTime_BBPPW 0x800000
+#define bRxAntennaPowerShift 0x3000000
+#define bRSSITableSelect 0xc000000
+#define bRxHP_Final 0x7000000
+#define bRxHTSettle_BBP 0x7
+#define bRxHTSettle_HSSI 0x8
+#define bRxHTSettle_RxHP 0x70
+#define bRxHTSettle_BBPPW 0x80
+#define bRxHTSettle_Idle 0x300
+#define bRxHTSettle_Reserved 0x1c00
+#define bRxHTRxHPEn 0x8000
+#define bRxHTAGCFreezeThres 0x30000
+#define bRxHTAGCTogetherEn 0x40000
+#define bRxHTAGCMin 0x80000
+#define bRxHTAGCEn 0x100000
+#define bRxHTDAGCEn 0x200000
+#define bRxHTRxHP_BBP 0x1c00000
+#define bRxHTRxHP_Final 0xe0000000
+#define bRxPWRatioTH 0x3
+#define bRxPWRatioEn 0x4
+#define bRxMFHold 0x3800
+#define bRxPD_Delay_TH1 0x38
+#define bRxPD_Delay_TH2 0x1c0
+#define bRxPD_DC_COUNT_MAX 0x600
+//#define bRxMF_Hold 0x3800
+#define bRxPD_Delay_TH 0x8000
+#define bRxProcess_Delay 0xf0000
+#define bRxSearchrange_GI2_Early 0x700000
+#define bRxFrame_Guard_Counter_L 0x3800000
+#define bRxSGI_Guard_L 0xc000000
+#define bRxSGI_Search_L 0x30000000
+#define bRxSGI_TH 0xc0000000
+#define bDFSCnt0 0xff
+#define bDFSCnt1 0xff00
+#define bDFSFlag 0xf0000
+#define bMFWeightSum 0x300000
+#define bMinIdxTH 0x7f000000
+#define bDAFormat 0x40000
+#define bTxChEmuEnable 0x01000000
+#define bTRSWIsolation_A 0x7f
+#define bTRSWIsolation_B 0x7f00
+#define bTRSWIsolation_C 0x7f0000
+#define bTRSWIsolation_D 0x7f000000
+#define bExtLNAGain 0x7c00
+
+// 6. PageE(0xE00)
+#define bSTBCEn 0x4 // Useless
+#define bAntennaMapping 0x10
+#define bNss 0x20
+#define bCFOAntSumD 0x200
+#define bPHYCounterReset 0x8000000
+#define bCFOReportGet 0x4000000
+#define bOFDMContinueTx 0x10000000
+#define bOFDMSingleCarrier 0x20000000
+#define bOFDMSingleTone 0x40000000
+//#define bRxPath1 0x01
+//#define bRxPath2 0x02
+//#define bRxPath3 0x04
+//#define bRxPath4 0x08
+//#define bTxPath1 0x10
+//#define bTxPath2 0x20
+#define bHTDetect 0x100
+#define bCFOEn 0x10000
+#define bCFOValue 0xfff00000
+#define bSigTone_Re 0x3f
+#define bSigTone_Im 0x7f00
+#define bCounter_CCA 0xffff
+#define bCounter_ParityFail 0xffff0000
+#define bCounter_RateIllegal 0xffff
+#define bCounter_CRC8Fail 0xffff0000
+#define bCounter_MCSNoSupport 0xffff
+#define bCounter_FastSync 0xffff
+#define bShortCFO 0xfff
+#define bShortCFOTLength 12 //total
+#define bShortCFOFLength 11 //fraction
+#define bLongCFO 0x7ff
+#define bLongCFOTLength 11
+#define bLongCFOFLength 11
+#define bTailCFO 0x1fff
+#define bTailCFOTLength 13
+#define bTailCFOFLength 12
+#define bmax_en_pwdB 0xffff
+#define bCC_power_dB 0xffff0000
+#define bnoise_pwdB 0xffff
+#define bPowerMeasTLength 10
+#define bPowerMeasFLength 3
+#define bRx_HT_BW 0x1
+#define bRxSC 0x6
+#define bRx_HT 0x8
+#define bNB_intf_det_on 0x1
+#define bIntf_win_len_cfg 0x30
+#define bNB_Intf_TH_cfg 0x1c0
+#define bRFGain 0x3f
+#define bTableSel 0x40
+#define bTRSW 0x80
+#define bRxSNR_A 0xff
+#define bRxSNR_B 0xff00
+#define bRxSNR_C 0xff0000
+#define bRxSNR_D 0xff000000
+#define bSNREVMTLength 8
+#define bSNREVMFLength 1
+#define bCSI1st 0xff
+#define bCSI2nd 0xff00
+#define bRxEVM1st 0xff0000
+#define bRxEVM2nd 0xff000000
+#define bSIGEVM 0xff
+#define bPWDB 0xff00
+#define bSGIEN 0x10000
+
+#define bSFactorQAM1 0xf // Useless
+#define bSFactorQAM2 0xf0
+#define bSFactorQAM3 0xf00
+#define bSFactorQAM4 0xf000
+#define bSFactorQAM5 0xf0000
+#define bSFactorQAM6 0xf0000
+#define bSFactorQAM7 0xf00000
+#define bSFactorQAM8 0xf000000
+#define bSFactorQAM9 0xf0000000
+#define bCSIScheme 0x100000
+
+#define bNoiseLvlTopSet 0x3 // Useless
+#define bChSmooth 0x4
+#define bChSmoothCfg1 0x38
+#define bChSmoothCfg2 0x1c0
+#define bChSmoothCfg3 0xe00
+#define bChSmoothCfg4 0x7000
+#define bMRCMode 0x800000
+#define bTHEVMCfg 0x7000000
+
+#define bLoopFitType 0x1 // Useless
+#define bUpdCFO 0x40
+#define bUpdCFOOffData 0x80
+#define bAdvUpdCFO 0x100
+#define bAdvTimeCtrl 0x800
+#define bUpdClko 0x1000
+#define bFC 0x6000
+#define bTrackingMode 0x8000
+#define bPhCmpEnable 0x10000
+#define bUpdClkoLTF 0x20000
+#define bComChCFO 0x40000
+#define bCSIEstiMode 0x80000
+#define bAdvUpdEqz 0x100000
+#define bUChCfg 0x7000000
+#define bUpdEqz 0x8000000
+
+//Rx Pseduo noise
+#define bRxPesudoNoiseOn 0x20000000 // Useless
+#define bRxPesudoNoise_A 0xff
+#define bRxPesudoNoise_B 0xff00
+#define bRxPesudoNoise_C 0xff0000
+#define bRxPesudoNoise_D 0xff000000
+#define bPesudoNoiseState_A 0xffff
+#define bPesudoNoiseState_B 0xffff0000
+#define bPesudoNoiseState_C 0xffff
+#define bPesudoNoiseState_D 0xffff0000
+
+//7. RF Register
+//Zebra1
+#define bZebra1_HSSIEnable 0x8 // Useless
+#define bZebra1_TRxControl 0xc00
+#define bZebra1_TRxGainSetting 0x07f
+#define bZebra1_RxCorner 0xc00
+#define bZebra1_TxChargePump 0x38
+#define bZebra1_RxChargePump 0x7
+#define bZebra1_ChannelNum 0xf80
+#define bZebra1_TxLPFBW 0x400
+#define bZebra1_RxLPFBW 0x600
+
+//Zebra4
+#define bRTL8256RegModeCtrl1 0x100 // Useless
+#define bRTL8256RegModeCtrl0 0x40
+#define bRTL8256_TxLPFBW 0x18
+#define bRTL8256_RxLPFBW 0x600
+
+//RTL8258
+#define bRTL8258_TxLPFBW 0xc // Useless
+#define bRTL8258_RxLPFBW 0xc00
+#define bRTL8258_RSSILPFBW 0xc0
+
+
+//
+// Other Definition
+//
+
+//byte endable for sb_write
+#define bByte0 0x1 // Useless
+#define bByte1 0x2
+#define bByte2 0x4
+#define bByte3 0x8
+#define bWord0 0x3
+#define bWord1 0xc
+#define bDWord 0xf
+
+//for PutRegsetting & GetRegSetting BitMask
+#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f
+#define bMaskByte1 0xff00
+#define bMaskByte2 0xff0000
+#define bMaskByte3 0xff000000
+#define bMaskHWord 0xffff0000
+#define bMaskLWord 0x0000ffff
+#define bMaskDWord 0xffffffff
+#define bMask12Bits 0xfff
+#define bMaskH4Bits 0xf0000000
+#define bMaskOFDM_D 0xffc00000
+#define bMaskCCK 0x3f3f3f3f
+
+//for PutRFRegsetting & GetRFRegSetting BitMask
+//#define bMask12Bits 0xfffff // RF Reg mask bits
+//#define bMask20Bits 0xfffff // RF Reg mask bits T65 RF
+#define bRFRegOffsetMask 0xfffff
+
+#define bEnable 0x1 // Useless
+#define bDisable 0x0
+
+#define LeftAntenna 0x0 // Useless
+#define RightAntenna 0x1
+
+#define tCheckTxStatus 500 //500ms // Useless
+#define tUpdateRxCounter 100 //100ms
+
+#define rateCCK 0 // Useless
+#define rateOFDM 1
+#define rateHT 2
+
+//define Register-End
+#define bPMAC_End 0x1ff // Useless
+#define bFPGAPHY0_End 0x8ff
+#define bFPGAPHY1_End 0x9ff
+#define bCCKPHY0_End 0xaff
+#define bOFDMPHY0_End 0xcff
+#define bOFDMPHY1_End 0xdff
+
+//define max debug item in each debug page
+//#define bMaxItem_FPGA_PHY0 0x9
+//#define bMaxItem_FPGA_PHY1 0x3
+//#define bMaxItem_PHY_11B 0x16
+//#define bMaxItem_OFDM_PHY0 0x29
+//#define bMaxItem_OFDM_PHY1 0x0
+
+#define bPMACControl 0x0 // Useless
+#define bWMACControl 0x1
+#define bWNICControl 0x2
+
+#define PathA 0x0 // Useless
+#define PathB 0x1
+#define PathC 0x2
+#define PathD 0x3
+
+
+// RSSI Dump Message
+#define rA_RSSIDump_92E 0xcb0
+#define rB_RSSIDump_92E 0xcb1
+#define rS1_RXevmDump_92E 0xcb2
+#define rS2_RXevmDump_92E 0xcb3
+#define rA_RXsnrDump_92E 0xcb4
+#define rB_RXsnrDump_92E 0xcb5
+#define rA_CfoShortDump_92E 0xcb6
+#define rB_CfoShortDump_92E 0xcb8
+#define rA_CfoLongDump_92E 0xcba
+#define rB_CfoLongDump_92E 0xcbc
+
+/*--------------------------Define Parameters-------------------------------*/
+
+
+#endif //__INC_HAL8188EPHYREG_H
+
diff --git a/rtl8xxx_EU/include/Hal8192EPwrSeq.h b/rtl8xxx_EU/include/Hal8192EPwrSeq.h
index 7acc0d1..dfad445 100755
--- a/rtl8xxx_EU/include/Hal8192EPwrSeq.h
+++ b/rtl8xxx_EU/include/Hal8192EPwrSeq.h
@@ -1,155 +1,155 @@
-#ifndef REALTEK_POWER_SEQUENCE_8192E
-#define REALTEK_POWER_SEQUENCE_8192E
-
-#include "HalPwrSeqCmd.h"
-/*
- Check document WM-20110607-Paul-RTL8192E_Power_Architecture-R02.vsd
- There are 6 HW Power States:
- 0: POFF--Power Off
- 1: PDN--Power Down
- 2: CARDEMU--Card Emulation
- 3: ACT--Active Mode
- 4: LPS--Low Power State
- 5: SUS--Suspend
-
- The transision from different states are defined below
- TRANS_CARDEMU_TO_ACT
- TRANS_ACT_TO_CARDEMU
- TRANS_CARDEMU_TO_SUS
- TRANS_SUS_TO_CARDEMU
- TRANS_CARDEMU_TO_PDN
- TRANS_ACT_TO_LPS
- TRANS_LPS_TO_ACT
-
- TRANS_END
-*/
-#define RTL8192E_TRANS_CARDEMU_TO_ACT_STEPS 18
-#define RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS 18
-#define RTL8192E_TRANS_CARDEMU_TO_SUS_STEPS 18
-#define RTL8192E_TRANS_SUS_TO_CARDEMU_STEPS 18
-#define RTL8192E_TRANS_CARDEMU_TO_PDN_STEPS 18
-#define RTL8192E_TRANS_PDN_TO_CARDEMU_STEPS 18
-#define RTL8192E_TRANS_ACT_TO_LPS_STEPS 23
-#define RTL8192E_TRANS_LPS_TO_ACT_STEPS 23
-#define RTL8192E_TRANS_END_STEPS 1
-
-
-#define RTL8192E_TRANS_CARDEMU_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \
-
-
-#define RTL8192E_TRANS_ACT_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
- {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/*0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
-
-
-#define RTL8192E_TRANS_CARDEMU_TO_SUS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8192E_TRANS_SUS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
-
-#define RTL8192E_TRANS_CARDEMU_TO_CARDDIS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
- {0x00CC, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*Unlock small LDO Register*/ \
- {0x0011, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*Disable small LDO*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8192E_TRANS_CARDDIS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x0011, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*Enable small LDO*/ \
- {0x00CC, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0}, /*Lock small LDO Register*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\
-
-
-#define RTL8192E_TRANS_CARDEMU_TO_PDN \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
-
-#define RTL8192E_TRANS_PDN_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
-
-#define RTL8192E_TRANS_ACT_TO_LPS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
- {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
- {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
- {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
-
-
-#define RTL8192E_TRANS_LPS_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM, For Repeatly In and out, Taggle bit should be changed*/\
- {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
- {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
- {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/\
- {0x013D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*Clear ISR*/
-
-#define RTL8192E_TRANS_END \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
-
-
-extern WLAN_PWR_CFG rtl8192E_power_on_flow[RTL8192E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8192E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8192E_radio_off_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8192E_card_disable_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8192E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8192E_card_enable_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8192E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8192E_suspend_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8192E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8192E_resume_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8192E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8192E_hwpdn_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8192E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8192E_enter_lps_flow[RTL8192E_TRANS_ACT_TO_LPS_STEPS+RTL8192E_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8192E_leave_lps_flow[RTL8192E_TRANS_LPS_TO_ACT_STEPS+RTL8192E_TRANS_END_STEPS];
-
-#endif
+#ifndef REALTEK_POWER_SEQUENCE_8192E
+#define REALTEK_POWER_SEQUENCE_8192E
+
+#include "HalPwrSeqCmd.h"
+/*
+ Check document WM-20110607-Paul-RTL8192E_Power_Architecture-R02.vsd
+ There are 6 HW Power States:
+ 0: POFF--Power Off
+ 1: PDN--Power Down
+ 2: CARDEMU--Card Emulation
+ 3: ACT--Active Mode
+ 4: LPS--Low Power State
+ 5: SUS--Suspend
+
+ The transision from different states are defined below
+ TRANS_CARDEMU_TO_ACT
+ TRANS_ACT_TO_CARDEMU
+ TRANS_CARDEMU_TO_SUS
+ TRANS_SUS_TO_CARDEMU
+ TRANS_CARDEMU_TO_PDN
+ TRANS_ACT_TO_LPS
+ TRANS_LPS_TO_ACT
+
+ TRANS_END
+*/
+#define RTL8192E_TRANS_CARDEMU_TO_ACT_STEPS 18
+#define RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS 18
+#define RTL8192E_TRANS_CARDEMU_TO_SUS_STEPS 18
+#define RTL8192E_TRANS_SUS_TO_CARDEMU_STEPS 18
+#define RTL8192E_TRANS_CARDEMU_TO_PDN_STEPS 18
+#define RTL8192E_TRANS_PDN_TO_CARDEMU_STEPS 18
+#define RTL8192E_TRANS_ACT_TO_LPS_STEPS 23
+#define RTL8192E_TRANS_LPS_TO_ACT_STEPS 23
+#define RTL8192E_TRANS_END_STEPS 1
+
+
+#define RTL8192E_TRANS_CARDEMU_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \
+
+
+#define RTL8192E_TRANS_ACT_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
+ {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/*0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
+
+
+#define RTL8192E_TRANS_CARDEMU_TO_SUS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8192E_TRANS_SUS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
+
+#define RTL8192E_TRANS_CARDEMU_TO_CARDDIS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
+ {0x00CC, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*Unlock small LDO Register*/ \
+ {0x0011, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*Disable small LDO*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8192E_TRANS_CARDDIS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x0011, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*Enable small LDO*/ \
+ {0x00CC, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0}, /*Lock small LDO Register*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\
+
+
+#define RTL8192E_TRANS_CARDEMU_TO_PDN \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
+
+#define RTL8192E_TRANS_PDN_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
+
+#define RTL8192E_TRANS_ACT_TO_LPS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
+ {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
+ {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
+ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
+
+
+#define RTL8192E_TRANS_LPS_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM, For Repeatly In and out, Taggle bit should be changed*/\
+ {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
+ {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
+ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/\
+ {0x013D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*Clear ISR*/
+
+#define RTL8192E_TRANS_END \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
+
+
+extern WLAN_PWR_CFG rtl8192E_power_on_flow[RTL8192E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8192E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8192E_radio_off_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8192E_card_disable_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8192E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8192E_card_enable_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8192E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8192E_suspend_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8192E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8192E_resume_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8192E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8192E_hwpdn_flow[RTL8192E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8192E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8192E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8192E_enter_lps_flow[RTL8192E_TRANS_ACT_TO_LPS_STEPS+RTL8192E_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8192E_leave_lps_flow[RTL8192E_TRANS_LPS_TO_ACT_STEPS+RTL8192E_TRANS_END_STEPS];
+
+#endif
diff --git a/rtl8xxx_EU/include/Hal8723APhyCfg.h b/rtl8xxx_EU/include/Hal8723APhyCfg.h
index cdf2600..082463a 100755
--- a/rtl8xxx_EU/include/Hal8723APhyCfg.h
+++ b/rtl8xxx_EU/include/Hal8723APhyCfg.h
@@ -1,39 +1,39 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __INC_HAL8723PHYCFG_H__
-#define __INC_HAL8723PHYCFG_H__
-
-#include <Hal8192CPhyCfg.h>
-/* MAC/BB/RF HAL config */
-int PHY_BBConfig8723A( IN PADAPTER Adapter );
-int PHY_RFConfig8723A( IN PADAPTER Adapter );
-s32 PHY_MACConfig8723A(PADAPTER padapter);
-
-VOID
-PHY_SetSwChnlBWMode8723A(
- IN PADAPTER Adapter,
- IN u8 channel,
- IN CHANNEL_WIDTH Bandwidth,
- IN u8 Offset40,
- IN u8 Offset80
-);
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8723PHYCFG_H__
+#define __INC_HAL8723PHYCFG_H__
+
+#include <Hal8192CPhyCfg.h>
+/* MAC/BB/RF HAL config */
+int PHY_BBConfig8723A( IN PADAPTER Adapter );
+int PHY_RFConfig8723A( IN PADAPTER Adapter );
+s32 PHY_MACConfig8723A(PADAPTER padapter);
+
+VOID
+PHY_SetSwChnlBWMode8723A(
+ IN PADAPTER Adapter,
+ IN u8 channel,
+ IN CHANNEL_WIDTH Bandwidth,
+ IN u8 Offset40,
+ IN u8 Offset80
+);
+
+#endif
+
diff --git a/rtl8xxx_EU/include/Hal8723APhyReg.h b/rtl8xxx_EU/include/Hal8723APhyReg.h
index 7b244b4..fdd3422 100755
--- a/rtl8xxx_EU/include/Hal8723APhyReg.h
+++ b/rtl8xxx_EU/include/Hal8723APhyReg.h
@@ -1,74 +1,74 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __INC_HAL8723APHYREG_H__
-#define __INC_HAL8723APHYREG_H__
-
-#include <Hal8192CPhyReg.h>
-
-//
-// PageB(0xB00)
-//
-#define rPdp_AntA 0xb00
-#define rPdp_AntA_4 0xb04
-#define rPdp_AntA_8 0xb08
-#define rPdp_AntA_C 0xb0c
-#define rPdp_AntA_10 0xb10
-#define rPdp_AntA_14 0xb14
-#define rPdp_AntA_18 0xb18
-#define rPdp_AntA_1C 0xb1c
-#define rPdp_AntA_20 0xb20
-#define rPdp_AntA_24 0xb24
-
-#define rConfig_Pmpd_AntA 0xb28
-#define rConfig_ram64x16 0xb2c
-
-#define rBndA 0xb30
-#define rHssiPar 0xb34
-
-#define rConfig_AntA 0xb68
-#define rConfig_AntB 0xb6c
-
-#define rPdp_AntB 0xb70
-#define rPdp_AntB_4 0xb74
-#define rPdp_AntB_8 0xb78
-#define rPdp_AntB_C 0xb7c
-#define rPdp_AntB_10 0xb80
-#define rPdp_AntB_14 0xb84
-#define rPdp_AntB_18 0xb88
-#define rPdp_AntB_1C 0xb8c
-#define rPdp_AntB_20 0xb90
-#define rPdp_AntB_24 0xb94
-
-#define rConfig_Pmpd_AntB 0xb98
-
-#define rBndB 0xba0
-
-#define rAPK 0xbd8
-#define rPm_Rx0_AntA 0xbdc
-#define rPm_Rx1_AntA 0xbe0
-#define rPm_Rx2_AntA 0xbe4
-#define rPm_Rx3_AntA 0xbe8
-#define rPm_Rx0_AntB 0xbec
-#define rPm_Rx1_AntB 0xbf0
-#define rPm_Rx2_AntB 0xbf4
-#define rPm_Rx3_AntB 0xbf8
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8723APHYREG_H__
+#define __INC_HAL8723APHYREG_H__
+
+#include <Hal8192CPhyReg.h>
+
+//
+// PageB(0xB00)
+//
+#define rPdp_AntA 0xb00
+#define rPdp_AntA_4 0xb04
+#define rPdp_AntA_8 0xb08
+#define rPdp_AntA_C 0xb0c
+#define rPdp_AntA_10 0xb10
+#define rPdp_AntA_14 0xb14
+#define rPdp_AntA_18 0xb18
+#define rPdp_AntA_1C 0xb1c
+#define rPdp_AntA_20 0xb20
+#define rPdp_AntA_24 0xb24
+
+#define rConfig_Pmpd_AntA 0xb28
+#define rConfig_ram64x16 0xb2c
+
+#define rBndA 0xb30
+#define rHssiPar 0xb34
+
+#define rConfig_AntA 0xb68
+#define rConfig_AntB 0xb6c
+
+#define rPdp_AntB 0xb70
+#define rPdp_AntB_4 0xb74
+#define rPdp_AntB_8 0xb78
+#define rPdp_AntB_C 0xb7c
+#define rPdp_AntB_10 0xb80
+#define rPdp_AntB_14 0xb84
+#define rPdp_AntB_18 0xb88
+#define rPdp_AntB_1C 0xb8c
+#define rPdp_AntB_20 0xb90
+#define rPdp_AntB_24 0xb94
+
+#define rConfig_Pmpd_AntB 0xb98
+
+#define rBndB 0xba0
+
+#define rAPK 0xbd8
+#define rPm_Rx0_AntA 0xbdc
+#define rPm_Rx1_AntA 0xbe0
+#define rPm_Rx2_AntA 0xbe4
+#define rPm_Rx3_AntA 0xbe8
+#define rPm_Rx0_AntB 0xbec
+#define rPm_Rx1_AntB 0xbf0
+#define rPm_Rx2_AntB 0xbf4
+#define rPm_Rx3_AntB 0xbf8
+
+#endif
+
diff --git a/rtl8xxx_EU/include/Hal8723BPhyCfg.h b/rtl8xxx_EU/include/Hal8723BPhyCfg.h
index 534e1be..da47597 100755
--- a/rtl8xxx_EU/include/Hal8723BPhyCfg.h
+++ b/rtl8xxx_EU/include/Hal8723BPhyCfg.h
@@ -1,149 +1,149 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __INC_HAL8723BPHYCFG_H__
-#define __INC_HAL8723BPHYCFG_H__
-
-/*--------------------------Define Parameters-------------------------------*/
-#define LOOP_LIMIT 5
-#define MAX_STALL_TIME 50 //us
-#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
-#define MAX_TXPWR_IDX_NMODE_92S 63
-#define Reset_Cnt_Limit 3
-
-#ifdef CONFIG_PCI_HCI
-#define MAX_AGGR_NUM 0x0B
-#else
-#define MAX_AGGR_NUM 0x07
-#endif // CONFIG_PCI_HCI
-
-
-/*--------------------------Define Parameters End-------------------------------*/
-
-
-/*------------------------------Define structure----------------------------*/
-
-/*------------------------------Define structure End----------------------------*/
-
-/*--------------------------Exported Function prototype---------------------*/
-u32
-PHY_QueryBBReg_8723B(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask
- );
-
-VOID
-PHY_SetBBReg_8723B(
- IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data
- );
-
-u32
-PHY_QueryRFReg_8723B(
- IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask
- );
-
-VOID
-PHY_SetRFReg_8723B(
- IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data
- );
-
-/* MAC/BB/RF HAL config */
-int PHY_BBConfig8723B(PADAPTER Adapter );
-
-int PHY_RFConfig8723B(PADAPTER Adapter );
-
-s32 PHY_MACConfig8723B(PADAPTER padapter);
-
-int
-PHY_ConfigRFWithParaFile_8723B(
- IN PADAPTER Adapter,
- IN u8* pFileName,
- RF_PATH eRFPath
-);
-
-VOID
-PHY_SetTxPowerIndex_8723B(
- IN PADAPTER Adapter,
- IN u32 PowerIndex,
- IN u8 RFPath,
- IN u8 Rate
- );
-
-u8
-PHY_GetTxPowerIndex_8723B(
- IN PADAPTER pAdapter,
- IN u8 RFPath,
- IN u8 Rate,
- IN CHANNEL_WIDTH BandWidth,
- IN u8 Channel
- );
-
-VOID
-PHY_GetTxPowerLevel8723B(
- IN PADAPTER Adapter,
- OUT s32* powerlevel
- );
-
-VOID
-PHY_SetTxPowerLevel8723B(
- IN PADAPTER Adapter,
- IN u8 channel
- );
-
-VOID
-PHY_SetBWMode8723B(
- IN PADAPTER Adapter,
- IN CHANNEL_WIDTH Bandwidth, // 20M or 40M
- IN unsigned char Offset // Upper, Lower, or Don't care
-);
-
-VOID
-PHY_SwChnl8723B( // Call after initialization
- IN PADAPTER Adapter,
- IN u8 channel
- );
-
-VOID
-PHY_SetSwChnlBWMode8723B(
- IN PADAPTER Adapter,
- IN u8 channel,
- IN CHANNEL_WIDTH Bandwidth,
- IN u8 Offset40,
- IN u8 Offset80
-);
-
-VOID PHY_SetRFPathSwitch_8723B(
- IN PADAPTER pAdapter,
- IN BOOLEAN bMain
- );
-/*--------------------------Exported Function prototype End---------------------*/
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8723BPHYCFG_H__
+#define __INC_HAL8723BPHYCFG_H__
+
+/*--------------------------Define Parameters-------------------------------*/
+#define LOOP_LIMIT 5
+#define MAX_STALL_TIME 50 //us
+#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
+#define MAX_TXPWR_IDX_NMODE_92S 63
+#define Reset_Cnt_Limit 3
+
+#ifdef CONFIG_PCI_HCI
+#define MAX_AGGR_NUM 0x0B
+#else
+#define MAX_AGGR_NUM 0x07
+#endif // CONFIG_PCI_HCI
+
+
+/*--------------------------Define Parameters End-------------------------------*/
+
+
+/*------------------------------Define structure----------------------------*/
+
+/*------------------------------Define structure End----------------------------*/
+
+/*--------------------------Exported Function prototype---------------------*/
+u32
+PHY_QueryBBReg_8723B(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask
+ );
+
+VOID
+PHY_SetBBReg_8723B(
+ IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data
+ );
+
+u32
+PHY_QueryRFReg_8723B(
+ IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask
+ );
+
+VOID
+PHY_SetRFReg_8723B(
+ IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data
+ );
+
+/* MAC/BB/RF HAL config */
+int PHY_BBConfig8723B(PADAPTER Adapter );
+
+int PHY_RFConfig8723B(PADAPTER Adapter );
+
+s32 PHY_MACConfig8723B(PADAPTER padapter);
+
+int
+PHY_ConfigRFWithParaFile_8723B(
+ IN PADAPTER Adapter,
+ IN u8* pFileName,
+ RF_PATH eRFPath
+);
+
+VOID
+PHY_SetTxPowerIndex_8723B(
+ IN PADAPTER Adapter,
+ IN u32 PowerIndex,
+ IN u8 RFPath,
+ IN u8 Rate
+ );
+
+u8
+PHY_GetTxPowerIndex_8723B(
+ IN PADAPTER pAdapter,
+ IN u8 RFPath,
+ IN u8 Rate,
+ IN CHANNEL_WIDTH BandWidth,
+ IN u8 Channel
+ );
+
+VOID
+PHY_GetTxPowerLevel8723B(
+ IN PADAPTER Adapter,
+ OUT s32* powerlevel
+ );
+
+VOID
+PHY_SetTxPowerLevel8723B(
+ IN PADAPTER Adapter,
+ IN u8 channel
+ );
+
+VOID
+PHY_SetBWMode8723B(
+ IN PADAPTER Adapter,
+ IN CHANNEL_WIDTH Bandwidth, // 20M or 40M
+ IN unsigned char Offset // Upper, Lower, or Don't care
+);
+
+VOID
+PHY_SwChnl8723B( // Call after initialization
+ IN PADAPTER Adapter,
+ IN u8 channel
+ );
+
+VOID
+PHY_SetSwChnlBWMode8723B(
+ IN PADAPTER Adapter,
+ IN u8 channel,
+ IN CHANNEL_WIDTH Bandwidth,
+ IN u8 Offset40,
+ IN u8 Offset80
+);
+
+VOID PHY_SetRFPathSwitch_8723B(
+ IN PADAPTER pAdapter,
+ IN BOOLEAN bMain
+ );
+/*--------------------------Exported Function prototype End---------------------*/
+
+#endif
+
diff --git a/rtl8xxx_EU/include/Hal8723BPhyReg.h b/rtl8xxx_EU/include/Hal8723BPhyReg.h
index a9b006e..60b755a 100755
--- a/rtl8xxx_EU/include/Hal8723BPhyReg.h
+++ b/rtl8xxx_EU/include/Hal8723BPhyReg.h
@@ -1,83 +1,83 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __INC_HAL8723BPHYREG_H__
-#define __INC_HAL8723BPHYREG_H__
-
-#include <Hal8192CPhyReg.h>
-
-// BB Register Definition
-//
-// 4. Page9(0x900)
-//
-#define rDPDT_control 0x92c
-#define rfe_ctrl_anta_src 0x930
-#define rS0S1_PathSwitch 0x948
-#define AGC_table_select 0xb2c
-
-//
-// PageB(0xB00)
-//
-#define rPdp_AntA 0xb00
-#define rPdp_AntA_4 0xb04
-#define rPdp_AntA_8 0xb08
-#define rPdp_AntA_C 0xb0c
-#define rPdp_AntA_10 0xb10
-#define rPdp_AntA_14 0xb14
-#define rPdp_AntA_18 0xb18
-#define rPdp_AntA_1C 0xb1c
-#define rPdp_AntA_20 0xb20
-#define rPdp_AntA_24 0xb24
-
-#define rConfig_Pmpd_AntA 0xb28
-#define rConfig_ram64x16 0xb2c
-
-#define rBndA 0xb30
-#define rHssiPar 0xb34
-
-#define rConfig_AntA 0xb68
-#define rConfig_AntB 0xb6c
-
-#define rPdp_AntB 0xb70
-#define rPdp_AntB_4 0xb74
-#define rPdp_AntB_8 0xb78
-#define rPdp_AntB_C 0xb7c
-#define rPdp_AntB_10 0xb80
-#define rPdp_AntB_14 0xb84
-#define rPdp_AntB_18 0xb88
-#define rPdp_AntB_1C 0xb8c
-#define rPdp_AntB_20 0xb90
-#define rPdp_AntB_24 0xb94
-
-#define rConfig_Pmpd_AntB 0xb98
-
-#define rBndB 0xba0
-
-#define rAPK 0xbd8
-#define rPm_Rx0_AntA 0xbdc
-#define rPm_Rx1_AntA 0xbe0
-#define rPm_Rx2_AntA 0xbe4
-#define rPm_Rx3_AntA 0xbe8
-#define rPm_Rx0_AntB 0xbec
-#define rPm_Rx1_AntB 0xbf0
-#define rPm_Rx2_AntB 0xbf4
-#define rPm_Rx3_AntB 0xbf8
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8723BPHYREG_H__
+#define __INC_HAL8723BPHYREG_H__
+
+#include <Hal8192CPhyReg.h>
+
+// BB Register Definition
+//
+// 4. Page9(0x900)
+//
+#define rDPDT_control 0x92c
+#define rfe_ctrl_anta_src 0x930
+#define rS0S1_PathSwitch 0x948
+#define AGC_table_select 0xb2c
+
+//
+// PageB(0xB00)
+//
+#define rPdp_AntA 0xb00
+#define rPdp_AntA_4 0xb04
+#define rPdp_AntA_8 0xb08
+#define rPdp_AntA_C 0xb0c
+#define rPdp_AntA_10 0xb10
+#define rPdp_AntA_14 0xb14
+#define rPdp_AntA_18 0xb18
+#define rPdp_AntA_1C 0xb1c
+#define rPdp_AntA_20 0xb20
+#define rPdp_AntA_24 0xb24
+
+#define rConfig_Pmpd_AntA 0xb28
+#define rConfig_ram64x16 0xb2c
+
+#define rBndA 0xb30
+#define rHssiPar 0xb34
+
+#define rConfig_AntA 0xb68
+#define rConfig_AntB 0xb6c
+
+#define rPdp_AntB 0xb70
+#define rPdp_AntB_4 0xb74
+#define rPdp_AntB_8 0xb78
+#define rPdp_AntB_C 0xb7c
+#define rPdp_AntB_10 0xb80
+#define rPdp_AntB_14 0xb84
+#define rPdp_AntB_18 0xb88
+#define rPdp_AntB_1C 0xb8c
+#define rPdp_AntB_20 0xb90
+#define rPdp_AntB_24 0xb94
+
+#define rConfig_Pmpd_AntB 0xb98
+
+#define rBndB 0xba0
+
+#define rAPK 0xbd8
+#define rPm_Rx0_AntA 0xbdc
+#define rPm_Rx1_AntA 0xbe0
+#define rPm_Rx2_AntA 0xbe4
+#define rPm_Rx3_AntA 0xbe8
+#define rPm_Rx0_AntB 0xbec
+#define rPm_Rx1_AntB 0xbf0
+#define rPm_Rx2_AntB 0xbf4
+#define rPm_Rx3_AntB 0xbf8
+
+#endif
+
diff --git a/rtl8xxx_EU/include/Hal8723BPwrSeq.h b/rtl8xxx_EU/include/Hal8723BPwrSeq.h
index d212445..2bbd976 100755
--- a/rtl8xxx_EU/include/Hal8723BPwrSeq.h
+++ b/rtl8xxx_EU/include/Hal8723BPwrSeq.h
@@ -1,233 +1,233 @@
-#ifndef REALTEK_POWER_SEQUENCE_8723B
-#define REALTEK_POWER_SEQUENCE_8723B
-
-#include "HalPwrSeqCmd.h"
-
-/*
- Check document WM-20130815-JackieLau-RTL8723B_Power_Architecture v08.vsd
- There are 6 HW Power States:
- 0: POFF--Power Off
- 1: PDN--Power Down
- 2: CARDEMU--Card Emulation
- 3: ACT--Active Mode
- 4: LPS--Low Power State
- 5: SUS--Suspend
-
- The transision from different states are defined below
- TRANS_CARDEMU_TO_ACT
- TRANS_ACT_TO_CARDEMU
- TRANS_CARDEMU_TO_SUS
- TRANS_SUS_TO_CARDEMU
- TRANS_CARDEMU_TO_PDN
- TRANS_ACT_TO_LPS
- TRANS_LPS_TO_ACT
-
- TRANS_END
-*/
-#define RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS 26
-#define RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS 15
-#define RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS 15
-#define RTL8723B_TRANS_SUS_TO_CARDEMU_STEPS 15
-#define RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS 15
-#define RTL8723B_TRANS_PDN_TO_CARDEMU_STEPS 15
-#define RTL8723B_TRANS_ACT_TO_LPS_STEPS 15
-#define RTL8723B_TRANS_LPS_TO_ACT_STEPS 15
-#define RTL8723B_TRANS_ACT_TO_SWLPS_STEPS 22
-#define RTL8723B_TRANS_SWLPS_TO_ACT_STEPS 15
-#define RTL8723B_TRANS_END_STEPS 1
-
-
-#define RTL8723B_TRANS_CARDEMU_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \
- {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \
- {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \
- {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, 0}, /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3|BIT2), 0},/* disable SW LPS 0x04[10]=0 and WLSUS_EN 0x04[11]=0*/ \
- {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0 , BIT0},/* Disable USB suspend */ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
- {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0 , 0},/* Enable USB suspend */ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \
- {0x0010, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6, BIT6},/* Enable WL control XTAL setting*/ \
- {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable falling edge triggering interrupt*/\
- {0x0063, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable GPIO9 interrupt mode*/\
- {0x0062, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Enable GPIO9 input mode*/\
- {0x0058, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Enable HSISR GPIO[C:0] interrupt*/\
- {0x005A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable HSISR GPIO9 interrupt*/\
- {0x0068, PWR_CUT_TESTCHIP_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, BIT3},/*For GPIO9 internal pull high setting by test chip*/\
- {0x0069, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6, BIT6},/*For GPIO9 internal pull high setting*/\
-
-
-#define RTL8723B_TRANS_ACT_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
- {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Enable rising edge triggering interrupt*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
- {0x0010, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6, 0},/* Enable BT control XTAL setting*/\
- {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5}, /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \
- {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/\
-
-
-#define RTL8723B_TRANS_CARDEMU_TO_SUS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8723B_TRANS_SUS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
-
-#define RTL8723B_TRANS_CARDEMU_TO_CARDDIS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
- {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8723B_TRANS_CARDDIS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/
-
-
-#define RTL8723B_TRANS_CARDEMU_TO_PDN \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
-
-#define RTL8723B_TRANS_PDN_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
-
-#define RTL8723B_TRANS_ACT_TO_LPS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
- {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
- {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
- {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
-
-
-#define RTL8723B_TRANS_LPS_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
- {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
- {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
- {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
- {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
-
-
- #define RTL8723B_TRANS_ACT_TO_SWLPS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0194, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*enable 32 K source*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1},/*CCK and OFDM are enable*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1},/*CCK and OFDM are enable*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*disable security engine*/ \
- {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x40},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
- {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*reset dual TSF*/ \
- {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/*Reset CPU*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*Reset MCUFWDL register*/ \
- {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*Reset CPU IO Wrapper*/ \
- {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1},/*Reset CPU IO Wrapper*/ \
- {0x0287, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*polling RXFF packet number = 0 */ \
- {0x0286, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/*polling RXDMA idle */ \
- {0x013D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Clear FW RPWM interrupt */\
- {0x0139, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Set FW RPWM interrupt source*/\
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4},/*switch TSF to 32K*/\
- {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/*polling TSF stable*/\
- {0x0090, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Set FW LPS*/ \
- {0x0090, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/*polling FW LPS ready */
-
-
-#define RTL8723B_TRANS_SWLPS_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0},/*switch TSF to 32K*/\
- {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/*polling TSF stable*/\
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1, enable security engine*/\
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
- {0x06B7, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x09}, /*. reset MAC rx state machine*/\
- {0x06B4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x86}, /*. reset MAC rx state machine*/\
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/* set CPU RAM code ready*/ \
- {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*Reset CPU IO Wrapper*/ \
- {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* Enable CPU*/ \
- {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*enable CPU IO Wrapper*/ \
- {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2},/* Enable CPU*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, BIT7},/*polling FW init ready */ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT6, BIT6},/*polling FW init ready */ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
-
-#define RTL8723B_TRANS_END \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
-
-
-extern WLAN_PWR_CFG rtl8723B_power_on_flow[RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_radio_off_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_card_disable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_card_enable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_suspend_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_resume_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_hwpdn_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_enter_lps_flow[RTL8723B_TRANS_ACT_TO_LPS_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_leave_lps_flow[RTL8723B_TRANS_LPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_enter_swlps_flow[RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723B_leave_swlps_flow[RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS];
-#endif
-
+#ifndef REALTEK_POWER_SEQUENCE_8723B
+#define REALTEK_POWER_SEQUENCE_8723B
+
+#include "HalPwrSeqCmd.h"
+
+/*
+ Check document WM-20130815-JackieLau-RTL8723B_Power_Architecture v08.vsd
+ There are 6 HW Power States:
+ 0: POFF--Power Off
+ 1: PDN--Power Down
+ 2: CARDEMU--Card Emulation
+ 3: ACT--Active Mode
+ 4: LPS--Low Power State
+ 5: SUS--Suspend
+
+ The transision from different states are defined below
+ TRANS_CARDEMU_TO_ACT
+ TRANS_ACT_TO_CARDEMU
+ TRANS_CARDEMU_TO_SUS
+ TRANS_SUS_TO_CARDEMU
+ TRANS_CARDEMU_TO_PDN
+ TRANS_ACT_TO_LPS
+ TRANS_LPS_TO_ACT
+
+ TRANS_END
+*/
+#define RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS 26
+#define RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS 15
+#define RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS 15
+#define RTL8723B_TRANS_SUS_TO_CARDEMU_STEPS 15
+#define RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS 15
+#define RTL8723B_TRANS_PDN_TO_CARDEMU_STEPS 15
+#define RTL8723B_TRANS_ACT_TO_LPS_STEPS 15
+#define RTL8723B_TRANS_LPS_TO_ACT_STEPS 15
+#define RTL8723B_TRANS_ACT_TO_SWLPS_STEPS 22
+#define RTL8723B_TRANS_SWLPS_TO_ACT_STEPS 15
+#define RTL8723B_TRANS_END_STEPS 1
+
+
+#define RTL8723B_TRANS_CARDEMU_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \
+ {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \
+ {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \
+ {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, 0}, /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3|BIT2), 0},/* disable SW LPS 0x04[10]=0 and WLSUS_EN 0x04[11]=0*/ \
+ {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0 , BIT0},/* Disable USB suspend */ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
+ {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0 , 0},/* Enable USB suspend */ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \
+ {0x0010, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6, BIT6},/* Enable WL control XTAL setting*/ \
+ {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable falling edge triggering interrupt*/\
+ {0x0063, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable GPIO9 interrupt mode*/\
+ {0x0062, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Enable GPIO9 input mode*/\
+ {0x0058, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Enable HSISR GPIO[C:0] interrupt*/\
+ {0x005A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable HSISR GPIO9 interrupt*/\
+ {0x0068, PWR_CUT_TESTCHIP_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, BIT3},/*For GPIO9 internal pull high setting by test chip*/\
+ {0x0069, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6, BIT6},/*For GPIO9 internal pull high setting*/\
+
+
+#define RTL8723B_TRANS_ACT_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
+ {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Enable rising edge triggering interrupt*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
+ {0x0010, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6, 0},/* Enable BT control XTAL setting*/\
+ {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5}, /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \
+ {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/\
+
+
+#define RTL8723B_TRANS_CARDEMU_TO_SUS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8723B_TRANS_SUS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
+
+#define RTL8723B_TRANS_CARDEMU_TO_CARDDIS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
+ {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8723B_TRANS_CARDDIS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/
+
+
+#define RTL8723B_TRANS_CARDEMU_TO_PDN \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
+
+#define RTL8723B_TRANS_PDN_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
+
+#define RTL8723B_TRANS_ACT_TO_LPS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
+ {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
+ {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
+ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
+
+
+#define RTL8723B_TRANS_LPS_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
+ {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
+ {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
+ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
+ {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
+
+
+ #define RTL8723B_TRANS_ACT_TO_SWLPS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0194, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*enable 32 K source*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1},/*CCK and OFDM are enable*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1},/*CCK and OFDM are enable*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*disable security engine*/ \
+ {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x40},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
+ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*reset dual TSF*/ \
+ {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/*Reset CPU*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*Reset MCUFWDL register*/ \
+ {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*Reset CPU IO Wrapper*/ \
+ {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1},/*Reset CPU IO Wrapper*/ \
+ {0x0287, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*polling RXFF packet number = 0 */ \
+ {0x0286, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/*polling RXDMA idle */ \
+ {0x013D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Clear FW RPWM interrupt */\
+ {0x0139, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Set FW RPWM interrupt source*/\
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4},/*switch TSF to 32K*/\
+ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/*polling TSF stable*/\
+ {0x0090, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Set FW LPS*/ \
+ {0x0090, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/*polling FW LPS ready */
+
+
+#define RTL8723B_TRANS_SWLPS_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0},/*switch TSF to 32K*/\
+ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/*polling TSF stable*/\
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1, enable security engine*/\
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
+ {0x06B7, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x09}, /*. reset MAC rx state machine*/\
+ {0x06B4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x86}, /*. reset MAC rx state machine*/\
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/* set CPU RAM code ready*/ \
+ {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*Reset CPU IO Wrapper*/ \
+ {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* Enable CPU*/ \
+ {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*enable CPU IO Wrapper*/ \
+ {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2},/* Enable CPU*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, BIT7},/*polling FW init ready */ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT6, BIT6},/*polling FW init ready */ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
+
+#define RTL8723B_TRANS_END \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
+
+
+extern WLAN_PWR_CFG rtl8723B_power_on_flow[RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_radio_off_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_card_disable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_card_enable_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_suspend_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_resume_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_hwpdn_flow[RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_enter_lps_flow[RTL8723B_TRANS_ACT_TO_LPS_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_leave_lps_flow[RTL8723B_TRANS_LPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_enter_swlps_flow[RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723B_leave_swlps_flow[RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS];
+#endif
+
diff --git a/rtl8xxx_EU/include/Hal8723PwrSeq.h b/rtl8xxx_EU/include/Hal8723PwrSeq.h
index 307ac90..ab31a7a 100755
--- a/rtl8xxx_EU/include/Hal8723PwrSeq.h
+++ b/rtl8xxx_EU/include/Hal8723PwrSeq.h
@@ -1,170 +1,170 @@
-#ifndef __HAL8723PWRSEQ_H__
-#define __HAL8723PWRSEQ_H__
-/*
- Check document WM-20110607-Paul-RTL8723A_Power_Architecture-R02.vsd
- There are 6 HW Power States:
- 0: POFF--Power Off
- 1: PDN--Power Down
- 2: CARDEMU--Card Emulation
- 3: ACT--Active Mode
- 4: LPS--Low Power State
- 5: SUS--Suspend
-
- The transision from different states are defined below
- TRANS_CARDEMU_TO_ACT
- TRANS_ACT_TO_CARDEMU
- TRANS_CARDEMU_TO_SUS
- TRANS_SUS_TO_CARDEMU
- TRANS_CARDEMU_TO_PDN
- TRANS_ACT_TO_LPS
- TRANS_LPS_TO_ACT
-
- TRANS_END
-*/
-#include "HalPwrSeqCmd.h"
-
-#define RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS 15
-#define RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS 15
-#define RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS 15
-#define RTL8723A_TRANS_SUS_TO_CARDEMU_STEPS 15
-#define RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS 15
-#define RTL8723A_TRANS_PDN_TO_CARDEMU_STEPS 15
-#define RTL8723A_TRANS_ACT_TO_LPS_STEPS 15
-#define RTL8723A_TRANS_LPS_TO_ACT_STEPS 15
-#define RTL8723A_TRANS_END_STEPS 1
-
-
-#define RTL8723A_TRANS_CARDEMU_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \
- {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \
- {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \
- {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, 0}, /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \
- {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 1},/*0x4C[23] = 0x4E[7] = 1, switch DPDT_SEL_P output from WL BB */\
-
-#define RTL8723A_TRANS_ACT_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
- {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/*0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
- {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5}, /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \
- {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/ \
-
-
-#define RTL8723A_TRANS_CARDEMU_TO_SUS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8723A_TRANS_SUS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
-
-#define RTL8723A_TRANS_CARDEMU_TO_CARDDIS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
- {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8723A_TRANS_CARDDIS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/
-
-
-#define RTL8723A_TRANS_CARDEMU_TO_PDN \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
-
-#define RTL8723A_TRANS_PDN_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
-
-#define RTL8723A_TRANS_ACT_TO_LPS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
- {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
- {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
- {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
-
-
-#define RTL8723A_TRANS_LPS_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
- {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
- {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
- {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
- {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
-
-#define RTL8723A_TRANS_END \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
-
-
-extern WLAN_PWR_CFG rtl8723A_power_on_flow[RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723A_radio_off_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723A_card_disable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723A_card_enable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723A_suspend_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723A_resume_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723A_hwpdn_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723A_enter_lps_flow[RTL8723A_TRANS_ACT_TO_LPS_STEPS+RTL8723A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8723A_leave_lps_flow[RTL8723A_TRANS_LPS_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS];
-
-#endif
-
+#ifndef __HAL8723PWRSEQ_H__
+#define __HAL8723PWRSEQ_H__
+/*
+ Check document WM-20110607-Paul-RTL8723A_Power_Architecture-R02.vsd
+ There are 6 HW Power States:
+ 0: POFF--Power Off
+ 1: PDN--Power Down
+ 2: CARDEMU--Card Emulation
+ 3: ACT--Active Mode
+ 4: LPS--Low Power State
+ 5: SUS--Suspend
+
+ The transision from different states are defined below
+ TRANS_CARDEMU_TO_ACT
+ TRANS_ACT_TO_CARDEMU
+ TRANS_CARDEMU_TO_SUS
+ TRANS_SUS_TO_CARDEMU
+ TRANS_CARDEMU_TO_PDN
+ TRANS_ACT_TO_LPS
+ TRANS_LPS_TO_ACT
+
+ TRANS_END
+*/
+#include "HalPwrSeqCmd.h"
+
+#define RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS 15
+#define RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS 15
+#define RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS 15
+#define RTL8723A_TRANS_SUS_TO_CARDEMU_STEPS 15
+#define RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS 15
+#define RTL8723A_TRANS_PDN_TO_CARDEMU_STEPS 15
+#define RTL8723A_TRANS_ACT_TO_LPS_STEPS 15
+#define RTL8723A_TRANS_LPS_TO_ACT_STEPS 15
+#define RTL8723A_TRANS_END_STEPS 1
+
+
+#define RTL8723A_TRANS_CARDEMU_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \
+ {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \
+ {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \
+ {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, 0}, /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \
+ {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 1},/*0x4C[23] = 0x4E[7] = 1, switch DPDT_SEL_P output from WL BB */\
+
+#define RTL8723A_TRANS_ACT_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
+ {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/*0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
+ {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5}, /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \
+ {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/ \
+
+
+#define RTL8723A_TRANS_CARDEMU_TO_SUS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8723A_TRANS_SUS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
+
+#define RTL8723A_TRANS_CARDEMU_TO_CARDDIS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
+ {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8723A_TRANS_CARDDIS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/
+
+
+#define RTL8723A_TRANS_CARDEMU_TO_PDN \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
+
+#define RTL8723A_TRANS_PDN_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
+
+#define RTL8723A_TRANS_ACT_TO_LPS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
+ {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
+ {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
+ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
+
+
+#define RTL8723A_TRANS_LPS_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
+ {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
+ {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
+ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
+ {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
+
+#define RTL8723A_TRANS_END \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
+
+
+extern WLAN_PWR_CFG rtl8723A_power_on_flow[RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723A_radio_off_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723A_card_disable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723A_card_enable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723A_suspend_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723A_resume_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723A_hwpdn_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723A_enter_lps_flow[RTL8723A_TRANS_ACT_TO_LPS_STEPS+RTL8723A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8723A_leave_lps_flow[RTL8723A_TRANS_LPS_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS];
+
+#endif
+
diff --git a/rtl8xxx_EU/include/Hal8812PhyCfg.h b/rtl8xxx_EU/include/Hal8812PhyCfg.h
index f8c83e1..b5241d6 100755
--- a/rtl8xxx_EU/include/Hal8812PhyCfg.h
+++ b/rtl8xxx_EU/include/Hal8812PhyCfg.h
@@ -1,165 +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 __INC_HAL8812PHYCFG_H__
-#define __INC_HAL8812PHYCFG_H__
-
-
-/*--------------------------Define Parameters-------------------------------*/
-#define LOOP_LIMIT 5
-#define MAX_STALL_TIME 50 //us
-#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
-#define MAX_TXPWR_IDX_NMODE_92S 63
-#define Reset_Cnt_Limit 3
-
-
-#ifdef CONFIG_PCI_HCI
-#define MAX_AGGR_NUM 0x0B
-#else
-#define MAX_AGGR_NUM 0x07
-#endif // CONFIG_PCI_HCI
-
-
-/*--------------------------Define Parameters-------------------------------*/
-
-/*------------------------------Define structure----------------------------*/
-
-
-/* BB/RF related */
-
-/*------------------------------Define structure----------------------------*/
-
-
-/*------------------------Export global variable----------------------------*/
-/*------------------------Export global variable----------------------------*/
-
-
-/*------------------------Export Marco Definition---------------------------*/
-/*------------------------Export Marco Definition---------------------------*/
-
-
-/*--------------------------Exported Function prototype---------------------*/
-//
-// BB and RF register read/write
-//
-u32 PHY_QueryBBReg8812( IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask );
-void PHY_SetBBReg8812( IN PADAPTER Adapter,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data );
-u32 PHY_QueryRFReg8812( IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask );
-void PHY_SetRFReg8812( IN PADAPTER Adapter,
- IN u8 eRFPath,
- IN u32 RegAddr,
- IN u32 BitMask,
- IN u32 Data );
-
-//
-// Initialization related function
-//
-/* MAC/BB/RF HAL config */
-int PHY_MACConfig8812(IN PADAPTER Adapter );
-int PHY_BBConfig8812(IN PADAPTER Adapter );
-void PHY_BB8812_Config_1T(IN PADAPTER Adapter );
-int PHY_RFConfig8812(IN PADAPTER Adapter );
-
-/* RF config */
-
-s32
-PHY_SwitchWirelessBand8812(
- IN PADAPTER Adapter,
- IN u8 Band
-);
-
-//
-// BB TX Power R/W
-//
-void PHY_GetTxPowerLevel8812( IN PADAPTER Adapter, OUT s32* powerlevel );
-void PHY_SetTxPowerLevel8812( IN PADAPTER Adapter, IN u8 Channel );
-
-BOOLEAN PHY_UpdateTxPowerDbm8812( IN PADAPTER Adapter, IN int powerInDbm );
-u8 PHY_GetTxPowerIndex_8812A(
- IN PADAPTER pAdapter,
- IN u8 RFPath,
- IN u8 Rate,
- IN CHANNEL_WIDTH BandWidth,
- IN u8 Channel
- );
-
-u32 PHY_GetTxBBSwing_8812A(
- IN PADAPTER Adapter,
- IN BAND_TYPE Band,
- IN u8 RFPath
- );
-
-VOID
-PHY_SetTxPowerIndex_8812A(
- IN PADAPTER Adapter,
- IN u4Byte PowerIndex,
- IN u1Byte RFPath,
- IN u1Byte Rate
- );
-
-//
-// Switch bandwidth for 8192S
-//
-VOID
-PHY_SetBWMode8812(
- IN PADAPTER pAdapter,
- IN CHANNEL_WIDTH Bandwidth,
- IN u8 Offset
-);
-
-//
-// channel switch related funciton
-//
-VOID
-PHY_SwChnl8812(
- IN PADAPTER Adapter,
- IN u8 channel
-);
-
-
-VOID
-PHY_SetSwChnlBWMode8812(
- IN PADAPTER Adapter,
- IN u8 channel,
- IN CHANNEL_WIDTH Bandwidth,
- IN u8 Offset40,
- IN u8 Offset80
-);
-
-//
-// BB/MAC/RF other monitor API
-//
-
-VOID
-PHY_SetRFPathSwitch_8812A(
- IN PADAPTER pAdapter,
- IN BOOLEAN bMain
-);
-
-/*--------------------------Exported Function prototype---------------------*/
-#endif // __INC_HAL8192CPHYCFG_H
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8812PHYCFG_H__
+#define __INC_HAL8812PHYCFG_H__
+
+
+/*--------------------------Define Parameters-------------------------------*/
+#define LOOP_LIMIT 5
+#define MAX_STALL_TIME 50 //us
+#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
+#define MAX_TXPWR_IDX_NMODE_92S 63
+#define Reset_Cnt_Limit 3
+
+
+#ifdef CONFIG_PCI_HCI
+#define MAX_AGGR_NUM 0x0B
+#else
+#define MAX_AGGR_NUM 0x07
+#endif // CONFIG_PCI_HCI
+
+
+/*--------------------------Define Parameters-------------------------------*/
+
+/*------------------------------Define structure----------------------------*/
+
+
+/* BB/RF related */
+
+/*------------------------------Define structure----------------------------*/
+
+
+/*------------------------Export global variable----------------------------*/
+/*------------------------Export global variable----------------------------*/
+
+
+/*------------------------Export Marco Definition---------------------------*/
+/*------------------------Export Marco Definition---------------------------*/
+
+
+/*--------------------------Exported Function prototype---------------------*/
+//
+// BB and RF register read/write
+//
+u32 PHY_QueryBBReg8812( IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask );
+void PHY_SetBBReg8812( IN PADAPTER Adapter,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data );
+u32 PHY_QueryRFReg8812( IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask );
+void PHY_SetRFReg8812( IN PADAPTER Adapter,
+ IN u8 eRFPath,
+ IN u32 RegAddr,
+ IN u32 BitMask,
+ IN u32 Data );
+
+//
+// Initialization related function
+//
+/* MAC/BB/RF HAL config */
+int PHY_MACConfig8812(IN PADAPTER Adapter );
+int PHY_BBConfig8812(IN PADAPTER Adapter );
+void PHY_BB8812_Config_1T(IN PADAPTER Adapter );
+int PHY_RFConfig8812(IN PADAPTER Adapter );
+
+/* RF config */
+
+s32
+PHY_SwitchWirelessBand8812(
+ IN PADAPTER Adapter,
+ IN u8 Band
+);
+
+//
+// BB TX Power R/W
+//
+void PHY_GetTxPowerLevel8812( IN PADAPTER Adapter, OUT s32* powerlevel );
+void PHY_SetTxPowerLevel8812( IN PADAPTER Adapter, IN u8 Channel );
+
+BOOLEAN PHY_UpdateTxPowerDbm8812( IN PADAPTER Adapter, IN int powerInDbm );
+u8 PHY_GetTxPowerIndex_8812A(
+ IN PADAPTER pAdapter,
+ IN u8 RFPath,
+ IN u8 Rate,
+ IN CHANNEL_WIDTH BandWidth,
+ IN u8 Channel
+ );
+
+u32 PHY_GetTxBBSwing_8812A(
+ IN PADAPTER Adapter,
+ IN BAND_TYPE Band,
+ IN u8 RFPath
+ );
+
+VOID
+PHY_SetTxPowerIndex_8812A(
+ IN PADAPTER Adapter,
+ IN u4Byte PowerIndex,
+ IN u1Byte RFPath,
+ IN u1Byte Rate
+ );
+
+//
+// Switch bandwidth for 8192S
+//
+VOID
+PHY_SetBWMode8812(
+ IN PADAPTER pAdapter,
+ IN CHANNEL_WIDTH Bandwidth,
+ IN u8 Offset
+);
+
+//
+// channel switch related funciton
+//
+VOID
+PHY_SwChnl8812(
+ IN PADAPTER Adapter,
+ IN u8 channel
+);
+
+
+VOID
+PHY_SetSwChnlBWMode8812(
+ IN PADAPTER Adapter,
+ IN u8 channel,
+ IN CHANNEL_WIDTH Bandwidth,
+ IN u8 Offset40,
+ IN u8 Offset80
+);
+
+//
+// BB/MAC/RF other monitor API
+//
+
+VOID
+PHY_SetRFPathSwitch_8812A(
+ IN PADAPTER pAdapter,
+ IN BOOLEAN bMain
+);
+
+/*--------------------------Exported Function prototype---------------------*/
+#endif // __INC_HAL8192CPHYCFG_H
+
diff --git a/rtl8xxx_EU/include/Hal8812PhyReg.h b/rtl8xxx_EU/include/Hal8812PhyReg.h
index 5125e22..7b53383 100755
--- a/rtl8xxx_EU/include/Hal8812PhyReg.h
+++ b/rtl8xxx_EU/include/Hal8812PhyReg.h
@@ -1,730 +1,730 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __INC_HAL8812PHYREG_H__
-#define __INC_HAL8812PHYREG_H__
-/*--------------------------Define Parameters-------------------------------*/
-//
-// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF
-// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
-// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00
-// 3. RF register 0x00-2E
-// 4. Bit Mask for BB/RF register
-// 5. Other defintion for BB/RF R/W
-//
-
-
-// BB Register Definition
-
-#define rCCAonSec_Jaguar 0x838
-#define rPwed_TH_Jaguar 0x830
-
-// BW and sideband setting
-#define rBWIndication_Jaguar 0x834
-#define rL1PeakTH_Jaguar 0x848
-#define rRFMOD_Jaguar 0x8ac //RF mode
-#define rADC_Buf_Clk_Jaguar 0x8c4
-#define rRFECTRL_Jaguar 0x900
-#define bRFMOD_Jaguar 0xc3
-#define rCCK_System_Jaguar 0xa00 // for cck sideband
-#define bCCK_System_Jaguar 0x10
-
-// Block & Path enable
-#define rOFDMCCKEN_Jaguar 0x808 // OFDM/CCK block enable
-#define bOFDMEN_Jaguar 0x20000000
-#define bCCKEN_Jaguar 0x10000000
-#define rRxPath_Jaguar 0x808 // Rx antenna
-#define bRxPath_Jaguar 0xff
-#define rTxPath_Jaguar 0x80c // Tx antenna
-#define bTxPath_Jaguar 0x0fffffff
-#define rCCK_RX_Jaguar 0xa04 // for cck rx path selection
-#define bCCK_RX_Jaguar 0x0c000000
-#define rVhtlen_Use_Lsig_Jaguar 0x8c3 // Use LSIG for VHT length
-
-// RF read/write-related
-#define rHSSIRead_Jaguar 0x8b0 // RF read addr
-#define bHSSIRead_addr_Jaguar 0xff
-#define bHSSIRead_trigger_Jaguar 0x100
-#define rA_PIRead_Jaguar 0xd04 // RF readback with PI
-#define rB_PIRead_Jaguar 0xd44 // RF readback with PI
-#define rA_SIRead_Jaguar 0xd08 // RF readback with SI
-#define rB_SIRead_Jaguar 0xd48 // RF readback with SI
-#define rRead_data_Jaguar 0xfffff
-#define rA_LSSIWrite_Jaguar 0xc90 // RF write addr
-#define rB_LSSIWrite_Jaguar 0xe90 // RF write addr
-#define bLSSIWrite_data_Jaguar 0x000fffff
-#define bLSSIWrite_addr_Jaguar 0x0ff00000
-
-
-
-// YN: mask the following register definition temporarily
-#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch
-#define rFPGA0_XB_RFInterfaceOE 0x864
-
-#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control
-#define rFPGA0_XCD_RFInterfaceSW 0x874
-
-//#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter
-//#define rFPGA0_XCD_RFParameter 0x87c
-
-//#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4??
-//#define rFPGA0_AnalogParameter2 0x884
-//#define rFPGA0_AnalogParameter3 0x888
-//#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy
-//#define rFPGA0_AnalogParameter4 0x88c
-
-
-// CCK TX scaling
-#define rCCK_TxFilter1_Jaguar 0xa20
-#define bCCK_TxFilter1_C0_Jaguar 0x00ff0000
-#define bCCK_TxFilter1_C1_Jaguar 0xff000000
-#define rCCK_TxFilter2_Jaguar 0xa24
-#define bCCK_TxFilter2_C2_Jaguar 0x000000ff
-#define bCCK_TxFilter2_C3_Jaguar 0x0000ff00
-#define bCCK_TxFilter2_C4_Jaguar 0x00ff0000
-#define bCCK_TxFilter2_C5_Jaguar 0xff000000
-#define rCCK_TxFilter3_Jaguar 0xa28
-#define bCCK_TxFilter3_C6_Jaguar 0x000000ff
-#define bCCK_TxFilter3_C7_Jaguar 0x0000ff00
-
-
-// YN: mask the following register definition temporarily
-//#define rPdp_AntA 0xb00
-//#define rPdp_AntA_4 0xb04
-//#define rConfig_Pmpd_AntA 0xb28
-//#define rConfig_AntA 0xb68
-//#define rConfig_AntB 0xb6c
-//#define rPdp_AntB 0xb70
-//#define rPdp_AntB_4 0xb74
-//#define rConfig_Pmpd_AntB 0xb98
-//#define rAPK 0xbd8
-
-// RXIQC
-#define rA_RxIQC_AB_Jaguar 0xc10 //RxIQ imblance matrix coeff. A & B
-#define rA_RxIQC_CD_Jaguar 0xc14 //RxIQ imblance matrix coeff. C & D
-#define rA_TxScale_Jaguar 0xc1c // Pah_A TX scaling factor
-#define rB_TxScale_Jaguar 0xe1c // Path_B TX scaling factor
-#define rB_RxIQC_AB_Jaguar 0xe10 //RxIQ imblance matrix coeff. A & B
-#define rB_RxIQC_CD_Jaguar 0xe14 //RxIQ imblance matrix coeff. C & D
-#define b_RxIQC_AC_Jaguar 0x02ff // bit mask for IQC matrix element A & C
-#define b_RxIQC_BD_Jaguar 0x02ff0000 // bit mask for IQC matrix element A & C
-
-
-// DIG-related
-#define rA_IGI_Jaguar 0xc50 // Initial Gain for path-A
-#define rB_IGI_Jaguar 0xe50 // Initial Gain for path-B
-#define rOFDM_FalseAlarm1_Jaguar 0xf48 // counter for break
-#define rOFDM_FalseAlarm2_Jaguar 0xf4c // counter for spoofing
-#define rCCK_FalseAlarm_Jaguar 0xa5c // counter for cck false alarm
-#define b_FalseAlarm_Jaguar 0xffff
-#define rCCK_CCA_Jaguar 0xa08 // cca threshold
-#define bCCK_CCA_Jaguar 0x00ff0000
-
-// Tx Power Ttraining-related
-#define rA_TxPwrTraing_Jaguar 0xc54
-#define rB_TxPwrTraing_Jaguar 0xe54
-
-// Report-related
-#define rOFDM_ShortCFOAB_Jaguar 0xf60
-#define rOFDM_LongCFOAB_Jaguar 0xf64
-#define rOFDM_EndCFOAB_Jaguar 0xf70
-#define rOFDM_AGCReport_Jaguar 0xf84
-#define rOFDM_RxSNR_Jaguar 0xf88
-#define rOFDM_RxEVMCSI_Jaguar 0xf8c
-#define rOFDM_SIGReport_Jaguar 0xf90
-
-// Misc functions
-#define rEDCCA_Jaguar 0x8a4 // EDCCA
-#define bEDCCA_Jaguar 0xffff
-#define rAGC_table_Jaguar 0x82c // AGC tabel select
-#define bAGC_table_Jaguar 0x3
-#define b_sel5g_Jaguar 0x1000 // sel5g
-#define b_LNA_sw_Jaguar 0x8000 // HW/WS control for LNA
-#define rFc_area_Jaguar 0x860 // fc_area
-#define bFc_area_Jaguar 0x1ffe000
-#define rSingleTone_ContTx_Jaguar 0x914
-
-// RFE
-#define rA_RFE_Pinmux_Jaguar 0xcb0 // Path_A RFE cotrol pinmux
-#define rB_RFE_Pinmux_Jaguar 0xeb0 // Path_B RFE control pinmux
-#define rA_RFE_Inv_Jaguar 0xcb4 // Path_A RFE cotrol
-#define rB_RFE_Inv_Jaguar 0xeb4 // Path_B RFE control
-#define rA_RFE_Jaguar 0xcb8 // Path_A RFE cotrol
-#define rB_RFE_Jaguar 0xeb8 // Path_B RFE control
-#define r_ANTSEL_SW_Jaguar 0x900 // ANTSEL SW Control
-#define bMask_RFEInv_Jaguar 0x3ff00000
-#define bMask_AntselPathFollow_Jaguar 0x00030000
-
-// 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
-#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
-#define bTxAGC_byte0_Jaguar 0xff
-#define bTxAGC_byte1_Jaguar 0xff00
-#define bTxAGC_byte2_Jaguar 0xff0000
-#define bTxAGC_byte3_Jaguar 0xff000000
-
-// IQK YN: temporaily mask this part
-//#define rFPGA0_IQK 0xe28
-//#define rTx_IQK_Tone_A 0xe30
-//#define rRx_IQK_Tone_A 0xe34
-//#define rTx_IQK_PI_A 0xe38
-//#define rRx_IQK_PI_A 0xe3c
-
-//#define rTx_IQK 0xe40
-//#define rRx_IQK 0xe44
-//#define rIQK_AGC_Pts 0xe48
-//#define rIQK_AGC_Rsp 0xe4c
-//#define rTx_IQK_Tone_B 0xe50
-//#define rRx_IQK_Tone_B 0xe54
-//#define rTx_IQK_PI_B 0xe58
-//#define rRx_IQK_PI_B 0xe5c
-//#define rIQK_AGC_Cont 0xe60
-
-
-// AFE-related
-#define rA_AFEPwr1_Jaguar 0xc60 // dynamic AFE power control
-#define rA_AFEPwr2_Jaguar 0xc64 // dynamic AFE power control
-#define rA_Rx_WaitCCA_Tx_CCKRFON_Jaguar 0xc68
-#define rA_Tx_CCKBBON_OFDMRFON_Jaguar 0xc6c
-#define rA_Tx_OFDMBBON_Tx2Rx_Jaguar 0xc70
-#define rA_Tx2Tx_RXCCK_Jaguar 0xc74
-#define rA_Rx_OFDM_WaitRIFS_Jaguar 0xc78
-#define rA_Rx2Rx_BT_Jaguar 0xc7c
-#define rA_sleep_nav_Jaguar 0xc80
-#define rA_pmpd_Jaguar 0xc84
-#define rB_AFEPwr1_Jaguar 0xe60 // dynamic AFE power control
-#define rB_AFEPwr2_Jaguar 0xe64 // dynamic AFE power control
-#define rB_Rx_WaitCCA_Tx_CCKRFON_Jaguar 0xe68
-#define rB_Tx_CCKBBON_OFDMRFON_Jaguar 0xe6c
-#define rB_Tx_OFDMBBON_Tx2Rx_Jaguar 0xe70
-#define rB_Tx2Tx_RXCCK_Jaguar 0xe74
-#define rB_Rx_OFDM_WaitRIFS_Jaguar 0xe78
-#define rB_Rx2Rx_BT_Jaguar 0xe7c
-#define rB_sleep_nav_Jaguar 0xe80
-#define rB_pmpd_Jaguar 0xe84
-
-
-// YN: mask these registers temporaily
-//#define rTx_Power_Before_IQK_A 0xe94
-//#define rTx_Power_After_IQK_A 0xe9c
-
-//#define rRx_Power_Before_IQK_A 0xea0
-//#define rRx_Power_Before_IQK_A_2 0xea4
-//#define rRx_Power_After_IQK_A 0xea8
-//#define rRx_Power_After_IQK_A_2 0xeac
-
-//#define rTx_Power_Before_IQK_B 0xeb4
-//#define rTx_Power_After_IQK_B 0xebc
-
-//#define rRx_Power_Before_IQK_B 0xec0
-//#define rRx_Power_Before_IQK_B_2 0xec4
-//#define rRx_Power_After_IQK_B 0xec8
-//#define rRx_Power_After_IQK_B_2 0xecc
-
-
-// RSSI Dump
-#define rA_RSSIDump_Jaguar 0xBF0
-#define rB_RSSIDump_Jaguar 0xBF1
-#define rS1_RXevmDump_Jaguar 0xBF4
-#define rS2_RXevmDump_Jaguar 0xBF5
-#define rA_RXsnrDump_Jaguar 0xBF6
-#define rB_RXsnrDump_Jaguar 0xBF7
-#define rA_CfoShortDump_Jaguar 0xBF8
-#define rB_CfoShortDump_Jaguar 0xBFA
-#define rA_CfoLongDump_Jaguar 0xBEC
-#define rB_CfoLongDump_Jaguar 0xBEE
-
-
-// RF Register
-//
-#define RF_AC_Jaguar 0x00 //
-#define RF_RF_Top_Jaguar 0x07 //
-#define RF_TXLOK_Jaguar 0x08 //
-#define RF_TXAPK_Jaguar 0x0B
-#define RF_CHNLBW_Jaguar 0x18 // RF channel and BW switch
-#define RF_RCK1_Jaguar 0x1c //
-#define RF_RCK2_Jaguar 0x1d
-#define RF_RCK3_Jaguar 0x1e
-#define RF_ModeTableAddr 0x30
-#define RF_ModeTableData0 0x31
-#define RF_ModeTableData1 0x32
-#define RF_TxLCTank_Jaguar 0x54
-#define RF_APK_Jaguar 0x63
-#define RF_LCK 0xB4
-#define RF_WeLut_Jaguar 0xEF
-
-#define bRF_CHNLBW_MOD_AG_Jaguar 0x70300
-#define bRF_CHNLBW_BW 0xc00
-
-
-//
-// RL6052 Register definition
-//
-#define RF_AC 0x00 //
-#define RF_IPA_A 0x0C //
-#define RF_TXBIAS_A 0x0D
-#define RF_BS_PA_APSET_G9_G11 0x0E
-#define RF_MODE1 0x10 //
-#define RF_MODE2 0x11 //
-#define RF_CHNLBW 0x18 // RF channel and BW switch
-#define RF_RCK_OS 0x30 // RF TX PA control
-#define RF_TXPA_G1 0x31 // RF TX PA control
-#define RF_TXPA_G2 0x32 // RF TX PA control
-#define RF_TXPA_G3 0x33 // RF TX PA control
-#define RF_0x52 0x52
-#define RF_WE_LUT 0xEF
-
-//
-//Bit Mask
-//
-// 1. Page1(0x100)
-#define bBBResetB 0x100 // Useless now?
-#define bGlobalResetB 0x200
-#define bOFDMTxStart 0x4
-#define bCCKTxStart 0x8
-#define bCRC32Debug 0x100
-#define bPMACLoopback 0x10
-#define bTxLSIG 0xffffff
-#define bOFDMTxRate 0xf
-#define bOFDMTxReserved 0x10
-#define bOFDMTxLength 0x1ffe0
-#define bOFDMTxParity 0x20000
-#define bTxHTSIG1 0xffffff
-#define bTxHTMCSRate 0x7f
-#define bTxHTBW 0x80
-#define bTxHTLength 0xffff00
-#define bTxHTSIG2 0xffffff
-#define bTxHTSmoothing 0x1
-#define bTxHTSounding 0x2
-#define bTxHTReserved 0x4
-#define bTxHTAggreation 0x8
-#define bTxHTSTBC 0x30
-#define bTxHTAdvanceCoding 0x40
-#define bTxHTShortGI 0x80
-#define bTxHTNumberHT_LTF 0x300
-#define bTxHTCRC8 0x3fc00
-#define bCounterReset 0x10000
-#define bNumOfOFDMTx 0xffff
-#define bNumOfCCKTx 0xffff0000
-#define bTxIdleInterval 0xffff
-#define bOFDMService 0xffff0000
-#define bTxMACHeader 0xffffffff
-#define bTxDataInit 0xff
-#define bTxHTMode 0x100
-#define bTxDataType 0x30000
-#define bTxRandomSeed 0xffffffff
-#define bCCKTxPreamble 0x1
-#define bCCKTxSFD 0xffff0000
-#define bCCKTxSIG 0xff
-#define bCCKTxService 0xff00
-#define bCCKLengthExt 0x8000
-#define bCCKTxLength 0xffff0000
-#define bCCKTxCRC16 0xffff
-#define bCCKTxStatus 0x1
-#define bOFDMTxStatus 0x2
-
-
-//
-// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
-// 1. Page1(0x100)
-//
-#define rPMAC_Reset 0x100
-#define rPMAC_TxStart 0x104
-#define rPMAC_TxLegacySIG 0x108
-#define rPMAC_TxHTSIG1 0x10c
-#define rPMAC_TxHTSIG2 0x110
-#define rPMAC_PHYDebug 0x114
-#define rPMAC_TxPacketNum 0x118
-#define rPMAC_TxIdle 0x11c
-#define rPMAC_TxMACHeader0 0x120
-#define rPMAC_TxMACHeader1 0x124
-#define rPMAC_TxMACHeader2 0x128
-#define rPMAC_TxMACHeader3 0x12c
-#define rPMAC_TxMACHeader4 0x130
-#define rPMAC_TxMACHeader5 0x134
-#define rPMAC_TxDataType 0x138
-#define rPMAC_TxRandomSeed 0x13c
-#define rPMAC_CCKPLCPPreamble 0x140
-#define rPMAC_CCKPLCPHeader 0x144
-#define rPMAC_CCKCRC16 0x148
-#define rPMAC_OFDMRxCRC32OK 0x170
-#define rPMAC_OFDMRxCRC32Er 0x174
-#define rPMAC_OFDMRxParityEr 0x178
-#define rPMAC_OFDMRxCRC8Er 0x17c
-#define rPMAC_CCKCRxRC16Er 0x180
-#define rPMAC_CCKCRxRC32Er 0x184
-#define rPMAC_CCKCRxRC32OK 0x188
-#define rPMAC_TxStatus 0x18c
-
-//
-// 3. Page8(0x800)
-//
-#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting??
-
-#define rFPGA0_TxInfo 0x804 // Status report??
-#define rFPGA0_PSDFunction 0x808
-#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain?
-
-#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register
-#define rFPGA0_XA_HSSIParameter2 0x824
-#define rFPGA0_XB_HSSIParameter1 0x828
-#define rFPGA0_XB_HSSIParameter2 0x82c
-
-#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch
-#define rFPGA0_XCD_SwitchControl 0x85c
-
-#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter
-#define rFPGA0_XCD_RFParameter 0x87c
-
-#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4??
-#define rFPGA0_AnalogParameter2 0x884
-#define rFPGA0_AnalogParameter3 0x888
-#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy
-#define rFPGA0_AnalogParameter4 0x88c
-#define rFPGA0_XB_LSSIReadBack 0x8a4
-//
-// 4. Page9(0x900)
-//
-#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting??
-
-#define rFPGA1_TxBlock 0x904 // Useless now
-#define rFPGA1_DebugSelect 0x908 // Useless now
-#define rFPGA1_TxInfo 0x90c // Useless now // Status report??
-
-//
-// PageA(0xA00)
-//
-#define rCCK0_System 0xa00
-#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI
-#define rCCK0_TxFilter1 0xa20
-#define rCCK0_TxFilter2 0xa24
-#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3
-
-//
-// PageB(0xB00)
-//
-#define rPdp_AntA 0xb00
-#define rPdp_AntA_4 0xb04
-#define rConfig_Pmpd_AntA 0xb28
-#define rConfig_AntA 0xb68
-#define rConfig_AntB 0xb6c
-#define rPdp_AntB 0xb70
-#define rPdp_AntB_4 0xb74
-#define rConfig_Pmpd_AntB 0xb98
-#define rAPK 0xbd8
-
-//
-// 6. PageC(0xC00)
-//
-#define rOFDM0_LSTF 0xc00
-
-#define rOFDM0_TRxPathEnable 0xc04
-#define rOFDM0_TRMuxPar 0xc08
-#define rOFDM0_TRSWIsolation 0xc0c
-
-#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter
-#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix
-#define rOFDM0_XBRxAFE 0xc18
-#define rOFDM0_XBRxIQImbalance 0xc1c
-#define rOFDM0_XCRxAFE 0xc20
-#define rOFDM0_XCRxIQImbalance 0xc24
-#define rOFDM0_XDRxAFE 0xc28
-#define rOFDM0_XDRxIQImbalance 0xc2c
-
-#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain
-#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync.
-#define rOFDM0_RxDetector3 0xc38 //Frame Sync.
-#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI
-
-#define rOFDM0_RxDSP 0xc40 //Rx Sync Path
-#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC
-#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold
-#define rOFDM0_ECCAThreshold 0xc4c // energy CCA
-
-#define rOFDM0_XAAGCCore1 0xc50 // DIG
-#define rOFDM0_XAAGCCore2 0xc54
-#define rOFDM0_XBAGCCore1 0xc58
-#define rOFDM0_XBAGCCore2 0xc5c
-#define rOFDM0_XCAGCCore1 0xc60
-#define rOFDM0_XCAGCCore2 0xc64
-#define rOFDM0_XDAGCCore1 0xc68
-#define rOFDM0_XDAGCCore2 0xc6c
-
-#define rOFDM0_AGCParameter1 0xc70
-#define rOFDM0_AGCParameter2 0xc74
-#define rOFDM0_AGCRSSITable 0xc78
-#define rOFDM0_HTSTFAGC 0xc7c
-
-#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG
-#define rOFDM0_XATxAFE 0xc84
-#define rOFDM0_XBTxIQImbalance 0xc88
-#define rOFDM0_XBTxAFE 0xc8c
-#define rOFDM0_XCTxIQImbalance 0xc90
-#define rOFDM0_XCTxAFE 0xc94
-#define rOFDM0_XDTxIQImbalance 0xc98
-#define rOFDM0_XDTxAFE 0xc9c
-
-#define rOFDM0_RxIQExtAnta 0xca0
-#define rOFDM0_TxCoeff1 0xca4
-#define rOFDM0_TxCoeff2 0xca8
-#define rOFDM0_TxCoeff3 0xcac
-#define rOFDM0_TxCoeff4 0xcb0
-#define rOFDM0_TxCoeff5 0xcb4
-#define rOFDM0_TxCoeff6 0xcb8
-#define rOFDM0_RxHPParameter 0xce0
-#define rOFDM0_TxPseudoNoiseWgt 0xce4
-#define rOFDM0_FrameSync 0xcf0
-#define rOFDM0_DFSReport 0xcf4
-
-//
-// 7. PageD(0xD00)
-//
-#define rOFDM1_LSTF 0xd00
-#define rOFDM1_TRxPathEnable 0xd04
-
-//
-// 8. PageE(0xE00)
-//
-#define rTxAGC_A_Rate18_06 0xe00
-#define rTxAGC_A_Rate54_24 0xe04
-#define rTxAGC_A_CCK1_Mcs32 0xe08
-#define rTxAGC_A_Mcs03_Mcs00 0xe10
-#define rTxAGC_A_Mcs07_Mcs04 0xe14
-#define rTxAGC_A_Mcs11_Mcs08 0xe18
-#define rTxAGC_A_Mcs15_Mcs12 0xe1c
-
-#define rTxAGC_B_Rate18_06 0x830
-#define rTxAGC_B_Rate54_24 0x834
-#define rTxAGC_B_CCK1_55_Mcs32 0x838
-#define rTxAGC_B_Mcs03_Mcs00 0x83c
-#define rTxAGC_B_Mcs07_Mcs04 0x848
-#define rTxAGC_B_Mcs11_Mcs08 0x84c
-#define rTxAGC_B_Mcs15_Mcs12 0x868
-#define rTxAGC_B_CCK11_A_CCK2_11 0x86c
-
-#define rFPGA0_IQK 0xe28
-#define rTx_IQK_Tone_A 0xe30
-#define rRx_IQK_Tone_A 0xe34
-#define rTx_IQK_PI_A 0xe38
-#define rRx_IQK_PI_A 0xe3c
-
-#define rTx_IQK 0xe40
-#define rRx_IQK 0xe44
-#define rIQK_AGC_Pts 0xe48
-#define rIQK_AGC_Rsp 0xe4c
-#define rTx_IQK_Tone_B 0xe50
-#define rRx_IQK_Tone_B 0xe54
-#define rTx_IQK_PI_B 0xe58
-#define rRx_IQK_PI_B 0xe5c
-#define rIQK_AGC_Cont 0xe60
-
-#define rBlue_Tooth 0xe6c
-#define rRx_Wait_CCA 0xe70
-#define rTx_CCK_RFON 0xe74
-#define rTx_CCK_BBON 0xe78
-#define rTx_OFDM_RFON 0xe7c
-#define rTx_OFDM_BBON 0xe80
-#define rTx_To_Rx 0xe84
-#define rTx_To_Tx 0xe88
-#define rRx_CCK 0xe8c
-
-#define rTx_Power_Before_IQK_A 0xe94
-#define rTx_Power_After_IQK_A 0xe9c
-
-#define rRx_Power_Before_IQK_A 0xea0
-#define rRx_Power_Before_IQK_A_2 0xea4
-#define rRx_Power_After_IQK_A 0xea8
-#define rRx_Power_After_IQK_A_2 0xeac
-
-#define rTx_Power_Before_IQK_B 0xeb4
-#define rTx_Power_After_IQK_B 0xebc
-
-#define rRx_Power_Before_IQK_B 0xec0
-#define rRx_Power_Before_IQK_B_2 0xec4
-#define rRx_Power_After_IQK_B 0xec8
-#define rRx_Power_After_IQK_B_2 0xecc
-
-#define rRx_OFDM 0xed0
-#define rRx_Wait_RIFS 0xed4
-#define rRx_TO_Rx 0xed8
-#define rStandby 0xedc
-#define rSleep 0xee0
-#define rPMPD_ANAEN 0xeec
-
-
-// 2. Page8(0x800)
-#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD
-#define bJapanMode 0x2
-#define bCCKTxSC 0x30
-#define bCCKEn 0x1000000
-#define bOFDMEn 0x2000000
-#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage
-#define bXCTxAGC 0xf000
-#define bXDTxAGC 0xf0000
-
-// 4. PageA(0xA00)
-#define bCCKBBMode 0x3 // Useless
-#define bCCKTxPowerSaving 0x80
-#define bCCKRxPowerSaving 0x40
-
-#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch
-
-#define bCCKScramble 0x8 // Useless
-#define bCCKAntDiversity 0x8000
-#define bCCKCarrierRecovery 0x4000
-#define bCCKTxRate 0x3000
-#define bCCKDCCancel 0x0800
-#define bCCKISICancel 0x0400
-#define bCCKMatchFilter 0x0200
-#define bCCKEqualizer 0x0100
-#define bCCKPreambleDetect 0x800000
-#define bCCKFastFalseCCA 0x400000
-#define bCCKChEstStart 0x300000
-#define bCCKCCACount 0x080000
-#define bCCKcs_lim 0x070000
-#define bCCKBistMode 0x80000000
-#define bCCKCCAMask 0x40000000
-#define bCCKTxDACPhase 0x4
-#define bCCKRxADCPhase 0x20000000 //r_rx_clk
-#define bCCKr_cp_mode0 0x0100
-#define bCCKTxDCOffset 0xf0
-#define bCCKRxDCOffset 0xf
-#define bCCKCCAMode 0xc000
-#define bCCKFalseCS_lim 0x3f00
-#define bCCKCS_ratio 0xc00000
-#define bCCKCorgBit_sel 0x300000
-#define bCCKPD_lim 0x0f0000
-#define bCCKNewCCA 0x80000000
-#define bCCKRxHPofIG 0x8000
-#define bCCKRxIG 0x7f00
-#define bCCKLNAPolarity 0x800000
-#define bCCKRx1stGain 0x7f0000
-#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity
-#define bCCKRxAGCSatLevel 0x1f000000
-#define bCCKRxAGCSatCount 0xe0
-#define bCCKRxRFSettle 0x1f //AGCsamp_dly
-#define bCCKFixedRxAGC 0x8000
-//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824
-#define bCCKAntennaPolarity 0x2000
-#define bCCKTxFilterType 0x0c00
-#define bCCKRxAGCReportType 0x0300
-#define bCCKRxDAGCEn 0x80000000
-#define bCCKRxDAGCPeriod 0x20000000
-#define bCCKRxDAGCSatLevel 0x1f000000
-#define bCCKTimingRecovery 0x800000
-#define bCCKTxC0 0x3f0000
-#define bCCKTxC1 0x3f000000
-#define bCCKTxC2 0x3f
-#define bCCKTxC3 0x3f00
-#define bCCKTxC4 0x3f0000
-#define bCCKTxC5 0x3f000000
-#define bCCKTxC6 0x3f
-#define bCCKTxC7 0x3f00
-#define bCCKDebugPort 0xff0000
-#define bCCKDACDebug 0x0f000000
-#define bCCKFalseAlarmEnable 0x8000
-#define bCCKFalseAlarmRead 0x4000
-#define bCCKTRSSI 0x7f
-#define bCCKRxAGCReport 0xfe
-#define bCCKRxReport_AntSel 0x80000000
-#define bCCKRxReport_MFOff 0x40000000
-#define bCCKRxRxReport_SQLoss 0x20000000
-#define bCCKRxReport_Pktloss 0x10000000
-#define bCCKRxReport_Lockedbit 0x08000000
-#define bCCKRxReport_RateError 0x04000000
-#define bCCKRxReport_RxRate 0x03000000
-#define bCCKRxFACounterLower 0xff
-#define bCCKRxFACounterUpper 0xff000000
-#define bCCKRxHPAGCStart 0xe000
-#define bCCKRxHPAGCFinal 0x1c00
-#define bCCKRxFalseAlarmEnable 0x8000
-#define bCCKFACounterFreeze 0x4000
-#define bCCKTxPathSel 0x10000000
-#define bCCKDefaultRxPath 0xc000000
-#define bCCKOptionRxPath 0x3000000
-
-// 6. PageE(0xE00)
-#define bSTBCEn 0x4 // Useless
-#define bAntennaMapping 0x10
-#define bNss 0x20
-#define bCFOAntSumD 0x200
-#define bPHYCounterReset 0x8000000
-#define bCFOReportGet 0x4000000
-#define bOFDMContinueTx 0x10000000
-#define bOFDMSingleCarrier 0x20000000
-#define bOFDMSingleTone 0x40000000
-
-
-//
-// Other Definition
-//
-
-#define bEnable 0x1 // Useless
-#define bDisable 0x0
-
-//byte endable for srwrite
-#define bByte0 0x1 // Useless
-#define bByte1 0x2
-#define bByte2 0x4
-#define bByte3 0x8
-#define bWord0 0x3
-#define bWord1 0xc
-#define bDWord 0xf
-
-//for PutRegsetting & GetRegSetting BitMask
-#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f
-#define bMaskByte1 0xff00
-#define bMaskByte2 0xff0000
-#define bMaskByte3 0xff000000
-#define bMaskHWord 0xffff0000
-#define bMaskLWord 0x0000ffff
-#define bMaskDWord 0xffffffff
-#define bMask12Bits 0xfff
-#define bMaskH4Bits 0xf0000000
-#define bMaskOFDM_D 0xffc00000
-#define bMaskCCK 0x3f3f3f3f
-
-
-/*--------------------------Define Parameters-------------------------------*/
-
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __INC_HAL8812PHYREG_H__
+#define __INC_HAL8812PHYREG_H__
+/*--------------------------Define Parameters-------------------------------*/
+//
+// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF
+// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
+// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00
+// 3. RF register 0x00-2E
+// 4. Bit Mask for BB/RF register
+// 5. Other defintion for BB/RF R/W
+//
+
+
+// BB Register Definition
+
+#define rCCAonSec_Jaguar 0x838
+#define rPwed_TH_Jaguar 0x830
+
+// BW and sideband setting
+#define rBWIndication_Jaguar 0x834
+#define rL1PeakTH_Jaguar 0x848
+#define rRFMOD_Jaguar 0x8ac //RF mode
+#define rADC_Buf_Clk_Jaguar 0x8c4
+#define rRFECTRL_Jaguar 0x900
+#define bRFMOD_Jaguar 0xc3
+#define rCCK_System_Jaguar 0xa00 // for cck sideband
+#define bCCK_System_Jaguar 0x10
+
+// Block & Path enable
+#define rOFDMCCKEN_Jaguar 0x808 // OFDM/CCK block enable
+#define bOFDMEN_Jaguar 0x20000000
+#define bCCKEN_Jaguar 0x10000000
+#define rRxPath_Jaguar 0x808 // Rx antenna
+#define bRxPath_Jaguar 0xff
+#define rTxPath_Jaguar 0x80c // Tx antenna
+#define bTxPath_Jaguar 0x0fffffff
+#define rCCK_RX_Jaguar 0xa04 // for cck rx path selection
+#define bCCK_RX_Jaguar 0x0c000000
+#define rVhtlen_Use_Lsig_Jaguar 0x8c3 // Use LSIG for VHT length
+
+// RF read/write-related
+#define rHSSIRead_Jaguar 0x8b0 // RF read addr
+#define bHSSIRead_addr_Jaguar 0xff
+#define bHSSIRead_trigger_Jaguar 0x100
+#define rA_PIRead_Jaguar 0xd04 // RF readback with PI
+#define rB_PIRead_Jaguar 0xd44 // RF readback with PI
+#define rA_SIRead_Jaguar 0xd08 // RF readback with SI
+#define rB_SIRead_Jaguar 0xd48 // RF readback with SI
+#define rRead_data_Jaguar 0xfffff
+#define rA_LSSIWrite_Jaguar 0xc90 // RF write addr
+#define rB_LSSIWrite_Jaguar 0xe90 // RF write addr
+#define bLSSIWrite_data_Jaguar 0x000fffff
+#define bLSSIWrite_addr_Jaguar 0x0ff00000
+
+
+
+// YN: mask the following register definition temporarily
+#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch
+#define rFPGA0_XB_RFInterfaceOE 0x864
+
+#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control
+#define rFPGA0_XCD_RFInterfaceSW 0x874
+
+//#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter
+//#define rFPGA0_XCD_RFParameter 0x87c
+
+//#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4??
+//#define rFPGA0_AnalogParameter2 0x884
+//#define rFPGA0_AnalogParameter3 0x888
+//#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy
+//#define rFPGA0_AnalogParameter4 0x88c
+
+
+// CCK TX scaling
+#define rCCK_TxFilter1_Jaguar 0xa20
+#define bCCK_TxFilter1_C0_Jaguar 0x00ff0000
+#define bCCK_TxFilter1_C1_Jaguar 0xff000000
+#define rCCK_TxFilter2_Jaguar 0xa24
+#define bCCK_TxFilter2_C2_Jaguar 0x000000ff
+#define bCCK_TxFilter2_C3_Jaguar 0x0000ff00
+#define bCCK_TxFilter2_C4_Jaguar 0x00ff0000
+#define bCCK_TxFilter2_C5_Jaguar 0xff000000
+#define rCCK_TxFilter3_Jaguar 0xa28
+#define bCCK_TxFilter3_C6_Jaguar 0x000000ff
+#define bCCK_TxFilter3_C7_Jaguar 0x0000ff00
+
+
+// YN: mask the following register definition temporarily
+//#define rPdp_AntA 0xb00
+//#define rPdp_AntA_4 0xb04
+//#define rConfig_Pmpd_AntA 0xb28
+//#define rConfig_AntA 0xb68
+//#define rConfig_AntB 0xb6c
+//#define rPdp_AntB 0xb70
+//#define rPdp_AntB_4 0xb74
+//#define rConfig_Pmpd_AntB 0xb98
+//#define rAPK 0xbd8
+
+// RXIQC
+#define rA_RxIQC_AB_Jaguar 0xc10 //RxIQ imblance matrix coeff. A & B
+#define rA_RxIQC_CD_Jaguar 0xc14 //RxIQ imblance matrix coeff. C & D
+#define rA_TxScale_Jaguar 0xc1c // Pah_A TX scaling factor
+#define rB_TxScale_Jaguar 0xe1c // Path_B TX scaling factor
+#define rB_RxIQC_AB_Jaguar 0xe10 //RxIQ imblance matrix coeff. A & B
+#define rB_RxIQC_CD_Jaguar 0xe14 //RxIQ imblance matrix coeff. C & D
+#define b_RxIQC_AC_Jaguar 0x02ff // bit mask for IQC matrix element A & C
+#define b_RxIQC_BD_Jaguar 0x02ff0000 // bit mask for IQC matrix element A & C
+
+
+// DIG-related
+#define rA_IGI_Jaguar 0xc50 // Initial Gain for path-A
+#define rB_IGI_Jaguar 0xe50 // Initial Gain for path-B
+#define rOFDM_FalseAlarm1_Jaguar 0xf48 // counter for break
+#define rOFDM_FalseAlarm2_Jaguar 0xf4c // counter for spoofing
+#define rCCK_FalseAlarm_Jaguar 0xa5c // counter for cck false alarm
+#define b_FalseAlarm_Jaguar 0xffff
+#define rCCK_CCA_Jaguar 0xa08 // cca threshold
+#define bCCK_CCA_Jaguar 0x00ff0000
+
+// Tx Power Ttraining-related
+#define rA_TxPwrTraing_Jaguar 0xc54
+#define rB_TxPwrTraing_Jaguar 0xe54
+
+// Report-related
+#define rOFDM_ShortCFOAB_Jaguar 0xf60
+#define rOFDM_LongCFOAB_Jaguar 0xf64
+#define rOFDM_EndCFOAB_Jaguar 0xf70
+#define rOFDM_AGCReport_Jaguar 0xf84
+#define rOFDM_RxSNR_Jaguar 0xf88
+#define rOFDM_RxEVMCSI_Jaguar 0xf8c
+#define rOFDM_SIGReport_Jaguar 0xf90
+
+// Misc functions
+#define rEDCCA_Jaguar 0x8a4 // EDCCA
+#define bEDCCA_Jaguar 0xffff
+#define rAGC_table_Jaguar 0x82c // AGC tabel select
+#define bAGC_table_Jaguar 0x3
+#define b_sel5g_Jaguar 0x1000 // sel5g
+#define b_LNA_sw_Jaguar 0x8000 // HW/WS control for LNA
+#define rFc_area_Jaguar 0x860 // fc_area
+#define bFc_area_Jaguar 0x1ffe000
+#define rSingleTone_ContTx_Jaguar 0x914
+
+// RFE
+#define rA_RFE_Pinmux_Jaguar 0xcb0 // Path_A RFE cotrol pinmux
+#define rB_RFE_Pinmux_Jaguar 0xeb0 // Path_B RFE control pinmux
+#define rA_RFE_Inv_Jaguar 0xcb4 // Path_A RFE cotrol
+#define rB_RFE_Inv_Jaguar 0xeb4 // Path_B RFE control
+#define rA_RFE_Jaguar 0xcb8 // Path_A RFE cotrol
+#define rB_RFE_Jaguar 0xeb8 // Path_B RFE control
+#define r_ANTSEL_SW_Jaguar 0x900 // ANTSEL SW Control
+#define bMask_RFEInv_Jaguar 0x3ff00000
+#define bMask_AntselPathFollow_Jaguar 0x00030000
+
+// 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
+#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
+#define bTxAGC_byte0_Jaguar 0xff
+#define bTxAGC_byte1_Jaguar 0xff00
+#define bTxAGC_byte2_Jaguar 0xff0000
+#define bTxAGC_byte3_Jaguar 0xff000000
+
+// IQK YN: temporaily mask this part
+//#define rFPGA0_IQK 0xe28
+//#define rTx_IQK_Tone_A 0xe30
+//#define rRx_IQK_Tone_A 0xe34
+//#define rTx_IQK_PI_A 0xe38
+//#define rRx_IQK_PI_A 0xe3c
+
+//#define rTx_IQK 0xe40
+//#define rRx_IQK 0xe44
+//#define rIQK_AGC_Pts 0xe48
+//#define rIQK_AGC_Rsp 0xe4c
+//#define rTx_IQK_Tone_B 0xe50
+//#define rRx_IQK_Tone_B 0xe54
+//#define rTx_IQK_PI_B 0xe58
+//#define rRx_IQK_PI_B 0xe5c
+//#define rIQK_AGC_Cont 0xe60
+
+
+// AFE-related
+#define rA_AFEPwr1_Jaguar 0xc60 // dynamic AFE power control
+#define rA_AFEPwr2_Jaguar 0xc64 // dynamic AFE power control
+#define rA_Rx_WaitCCA_Tx_CCKRFON_Jaguar 0xc68
+#define rA_Tx_CCKBBON_OFDMRFON_Jaguar 0xc6c
+#define rA_Tx_OFDMBBON_Tx2Rx_Jaguar 0xc70
+#define rA_Tx2Tx_RXCCK_Jaguar 0xc74
+#define rA_Rx_OFDM_WaitRIFS_Jaguar 0xc78
+#define rA_Rx2Rx_BT_Jaguar 0xc7c
+#define rA_sleep_nav_Jaguar 0xc80
+#define rA_pmpd_Jaguar 0xc84
+#define rB_AFEPwr1_Jaguar 0xe60 // dynamic AFE power control
+#define rB_AFEPwr2_Jaguar 0xe64 // dynamic AFE power control
+#define rB_Rx_WaitCCA_Tx_CCKRFON_Jaguar 0xe68
+#define rB_Tx_CCKBBON_OFDMRFON_Jaguar 0xe6c
+#define rB_Tx_OFDMBBON_Tx2Rx_Jaguar 0xe70
+#define rB_Tx2Tx_RXCCK_Jaguar 0xe74
+#define rB_Rx_OFDM_WaitRIFS_Jaguar 0xe78
+#define rB_Rx2Rx_BT_Jaguar 0xe7c
+#define rB_sleep_nav_Jaguar 0xe80
+#define rB_pmpd_Jaguar 0xe84
+
+
+// YN: mask these registers temporaily
+//#define rTx_Power_Before_IQK_A 0xe94
+//#define rTx_Power_After_IQK_A 0xe9c
+
+//#define rRx_Power_Before_IQK_A 0xea0
+//#define rRx_Power_Before_IQK_A_2 0xea4
+//#define rRx_Power_After_IQK_A 0xea8
+//#define rRx_Power_After_IQK_A_2 0xeac
+
+//#define rTx_Power_Before_IQK_B 0xeb4
+//#define rTx_Power_After_IQK_B 0xebc
+
+//#define rRx_Power_Before_IQK_B 0xec0
+//#define rRx_Power_Before_IQK_B_2 0xec4
+//#define rRx_Power_After_IQK_B 0xec8
+//#define rRx_Power_After_IQK_B_2 0xecc
+
+
+// RSSI Dump
+#define rA_RSSIDump_Jaguar 0xBF0
+#define rB_RSSIDump_Jaguar 0xBF1
+#define rS1_RXevmDump_Jaguar 0xBF4
+#define rS2_RXevmDump_Jaguar 0xBF5
+#define rA_RXsnrDump_Jaguar 0xBF6
+#define rB_RXsnrDump_Jaguar 0xBF7
+#define rA_CfoShortDump_Jaguar 0xBF8
+#define rB_CfoShortDump_Jaguar 0xBFA
+#define rA_CfoLongDump_Jaguar 0xBEC
+#define rB_CfoLongDump_Jaguar 0xBEE
+
+
+// RF Register
+//
+#define RF_AC_Jaguar 0x00 //
+#define RF_RF_Top_Jaguar 0x07 //
+#define RF_TXLOK_Jaguar 0x08 //
+#define RF_TXAPK_Jaguar 0x0B
+#define RF_CHNLBW_Jaguar 0x18 // RF channel and BW switch
+#define RF_RCK1_Jaguar 0x1c //
+#define RF_RCK2_Jaguar 0x1d
+#define RF_RCK3_Jaguar 0x1e
+#define RF_ModeTableAddr 0x30
+#define RF_ModeTableData0 0x31
+#define RF_ModeTableData1 0x32
+#define RF_TxLCTank_Jaguar 0x54
+#define RF_APK_Jaguar 0x63
+#define RF_LCK 0xB4
+#define RF_WeLut_Jaguar 0xEF
+
+#define bRF_CHNLBW_MOD_AG_Jaguar 0x70300
+#define bRF_CHNLBW_BW 0xc00
+
+
+//
+// RL6052 Register definition
+//
+#define RF_AC 0x00 //
+#define RF_IPA_A 0x0C //
+#define RF_TXBIAS_A 0x0D
+#define RF_BS_PA_APSET_G9_G11 0x0E
+#define RF_MODE1 0x10 //
+#define RF_MODE2 0x11 //
+#define RF_CHNLBW 0x18 // RF channel and BW switch
+#define RF_RCK_OS 0x30 // RF TX PA control
+#define RF_TXPA_G1 0x31 // RF TX PA control
+#define RF_TXPA_G2 0x32 // RF TX PA control
+#define RF_TXPA_G3 0x33 // RF TX PA control
+#define RF_0x52 0x52
+#define RF_WE_LUT 0xEF
+
+//
+//Bit Mask
+//
+// 1. Page1(0x100)
+#define bBBResetB 0x100 // Useless now?
+#define bGlobalResetB 0x200
+#define bOFDMTxStart 0x4
+#define bCCKTxStart 0x8
+#define bCRC32Debug 0x100
+#define bPMACLoopback 0x10
+#define bTxLSIG 0xffffff
+#define bOFDMTxRate 0xf
+#define bOFDMTxReserved 0x10
+#define bOFDMTxLength 0x1ffe0
+#define bOFDMTxParity 0x20000
+#define bTxHTSIG1 0xffffff
+#define bTxHTMCSRate 0x7f
+#define bTxHTBW 0x80
+#define bTxHTLength 0xffff00
+#define bTxHTSIG2 0xffffff
+#define bTxHTSmoothing 0x1
+#define bTxHTSounding 0x2
+#define bTxHTReserved 0x4
+#define bTxHTAggreation 0x8
+#define bTxHTSTBC 0x30
+#define bTxHTAdvanceCoding 0x40
+#define bTxHTShortGI 0x80
+#define bTxHTNumberHT_LTF 0x300
+#define bTxHTCRC8 0x3fc00
+#define bCounterReset 0x10000
+#define bNumOfOFDMTx 0xffff
+#define bNumOfCCKTx 0xffff0000
+#define bTxIdleInterval 0xffff
+#define bOFDMService 0xffff0000
+#define bTxMACHeader 0xffffffff
+#define bTxDataInit 0xff
+#define bTxHTMode 0x100
+#define bTxDataType 0x30000
+#define bTxRandomSeed 0xffffffff
+#define bCCKTxPreamble 0x1
+#define bCCKTxSFD 0xffff0000
+#define bCCKTxSIG 0xff
+#define bCCKTxService 0xff00
+#define bCCKLengthExt 0x8000
+#define bCCKTxLength 0xffff0000
+#define bCCKTxCRC16 0xffff
+#define bCCKTxStatus 0x1
+#define bOFDMTxStatus 0x2
+
+
+//
+// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
+// 1. Page1(0x100)
+//
+#define rPMAC_Reset 0x100
+#define rPMAC_TxStart 0x104
+#define rPMAC_TxLegacySIG 0x108
+#define rPMAC_TxHTSIG1 0x10c
+#define rPMAC_TxHTSIG2 0x110
+#define rPMAC_PHYDebug 0x114
+#define rPMAC_TxPacketNum 0x118
+#define rPMAC_TxIdle 0x11c
+#define rPMAC_TxMACHeader0 0x120
+#define rPMAC_TxMACHeader1 0x124
+#define rPMAC_TxMACHeader2 0x128
+#define rPMAC_TxMACHeader3 0x12c
+#define rPMAC_TxMACHeader4 0x130
+#define rPMAC_TxMACHeader5 0x134
+#define rPMAC_TxDataType 0x138
+#define rPMAC_TxRandomSeed 0x13c
+#define rPMAC_CCKPLCPPreamble 0x140
+#define rPMAC_CCKPLCPHeader 0x144
+#define rPMAC_CCKCRC16 0x148
+#define rPMAC_OFDMRxCRC32OK 0x170
+#define rPMAC_OFDMRxCRC32Er 0x174
+#define rPMAC_OFDMRxParityEr 0x178
+#define rPMAC_OFDMRxCRC8Er 0x17c
+#define rPMAC_CCKCRxRC16Er 0x180
+#define rPMAC_CCKCRxRC32Er 0x184
+#define rPMAC_CCKCRxRC32OK 0x188
+#define rPMAC_TxStatus 0x18c
+
+//
+// 3. Page8(0x800)
+//
+#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting??
+
+#define rFPGA0_TxInfo 0x804 // Status report??
+#define rFPGA0_PSDFunction 0x808
+#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain?
+
+#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register
+#define rFPGA0_XA_HSSIParameter2 0x824
+#define rFPGA0_XB_HSSIParameter1 0x828
+#define rFPGA0_XB_HSSIParameter2 0x82c
+
+#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch
+#define rFPGA0_XCD_SwitchControl 0x85c
+
+#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter
+#define rFPGA0_XCD_RFParameter 0x87c
+
+#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4??
+#define rFPGA0_AnalogParameter2 0x884
+#define rFPGA0_AnalogParameter3 0x888
+#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy
+#define rFPGA0_AnalogParameter4 0x88c
+#define rFPGA0_XB_LSSIReadBack 0x8a4
+//
+// 4. Page9(0x900)
+//
+#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting??
+
+#define rFPGA1_TxBlock 0x904 // Useless now
+#define rFPGA1_DebugSelect 0x908 // Useless now
+#define rFPGA1_TxInfo 0x90c // Useless now // Status report??
+
+//
+// PageA(0xA00)
+//
+#define rCCK0_System 0xa00
+#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI
+#define rCCK0_TxFilter1 0xa20
+#define rCCK0_TxFilter2 0xa24
+#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3
+
+//
+// PageB(0xB00)
+//
+#define rPdp_AntA 0xb00
+#define rPdp_AntA_4 0xb04
+#define rConfig_Pmpd_AntA 0xb28
+#define rConfig_AntA 0xb68
+#define rConfig_AntB 0xb6c
+#define rPdp_AntB 0xb70
+#define rPdp_AntB_4 0xb74
+#define rConfig_Pmpd_AntB 0xb98
+#define rAPK 0xbd8
+
+//
+// 6. PageC(0xC00)
+//
+#define rOFDM0_LSTF 0xc00
+
+#define rOFDM0_TRxPathEnable 0xc04
+#define rOFDM0_TRMuxPar 0xc08
+#define rOFDM0_TRSWIsolation 0xc0c
+
+#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter
+#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix
+#define rOFDM0_XBRxAFE 0xc18
+#define rOFDM0_XBRxIQImbalance 0xc1c
+#define rOFDM0_XCRxAFE 0xc20
+#define rOFDM0_XCRxIQImbalance 0xc24
+#define rOFDM0_XDRxAFE 0xc28
+#define rOFDM0_XDRxIQImbalance 0xc2c
+
+#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain
+#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync.
+#define rOFDM0_RxDetector3 0xc38 //Frame Sync.
+#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI
+
+#define rOFDM0_RxDSP 0xc40 //Rx Sync Path
+#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC
+#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold
+#define rOFDM0_ECCAThreshold 0xc4c // energy CCA
+
+#define rOFDM0_XAAGCCore1 0xc50 // DIG
+#define rOFDM0_XAAGCCore2 0xc54
+#define rOFDM0_XBAGCCore1 0xc58
+#define rOFDM0_XBAGCCore2 0xc5c
+#define rOFDM0_XCAGCCore1 0xc60
+#define rOFDM0_XCAGCCore2 0xc64
+#define rOFDM0_XDAGCCore1 0xc68
+#define rOFDM0_XDAGCCore2 0xc6c
+
+#define rOFDM0_AGCParameter1 0xc70
+#define rOFDM0_AGCParameter2 0xc74
+#define rOFDM0_AGCRSSITable 0xc78
+#define rOFDM0_HTSTFAGC 0xc7c
+
+#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG
+#define rOFDM0_XATxAFE 0xc84
+#define rOFDM0_XBTxIQImbalance 0xc88
+#define rOFDM0_XBTxAFE 0xc8c
+#define rOFDM0_XCTxIQImbalance 0xc90
+#define rOFDM0_XCTxAFE 0xc94
+#define rOFDM0_XDTxIQImbalance 0xc98
+#define rOFDM0_XDTxAFE 0xc9c
+
+#define rOFDM0_RxIQExtAnta 0xca0
+#define rOFDM0_TxCoeff1 0xca4
+#define rOFDM0_TxCoeff2 0xca8
+#define rOFDM0_TxCoeff3 0xcac
+#define rOFDM0_TxCoeff4 0xcb0
+#define rOFDM0_TxCoeff5 0xcb4
+#define rOFDM0_TxCoeff6 0xcb8
+#define rOFDM0_RxHPParameter 0xce0
+#define rOFDM0_TxPseudoNoiseWgt 0xce4
+#define rOFDM0_FrameSync 0xcf0
+#define rOFDM0_DFSReport 0xcf4
+
+//
+// 7. PageD(0xD00)
+//
+#define rOFDM1_LSTF 0xd00
+#define rOFDM1_TRxPathEnable 0xd04
+
+//
+// 8. PageE(0xE00)
+//
+#define rTxAGC_A_Rate18_06 0xe00
+#define rTxAGC_A_Rate54_24 0xe04
+#define rTxAGC_A_CCK1_Mcs32 0xe08
+#define rTxAGC_A_Mcs03_Mcs00 0xe10
+#define rTxAGC_A_Mcs07_Mcs04 0xe14
+#define rTxAGC_A_Mcs11_Mcs08 0xe18
+#define rTxAGC_A_Mcs15_Mcs12 0xe1c
+
+#define rTxAGC_B_Rate18_06 0x830
+#define rTxAGC_B_Rate54_24 0x834
+#define rTxAGC_B_CCK1_55_Mcs32 0x838
+#define rTxAGC_B_Mcs03_Mcs00 0x83c
+#define rTxAGC_B_Mcs07_Mcs04 0x848
+#define rTxAGC_B_Mcs11_Mcs08 0x84c
+#define rTxAGC_B_Mcs15_Mcs12 0x868
+#define rTxAGC_B_CCK11_A_CCK2_11 0x86c
+
+#define rFPGA0_IQK 0xe28
+#define rTx_IQK_Tone_A 0xe30
+#define rRx_IQK_Tone_A 0xe34
+#define rTx_IQK_PI_A 0xe38
+#define rRx_IQK_PI_A 0xe3c
+
+#define rTx_IQK 0xe40
+#define rRx_IQK 0xe44
+#define rIQK_AGC_Pts 0xe48
+#define rIQK_AGC_Rsp 0xe4c
+#define rTx_IQK_Tone_B 0xe50
+#define rRx_IQK_Tone_B 0xe54
+#define rTx_IQK_PI_B 0xe58
+#define rRx_IQK_PI_B 0xe5c
+#define rIQK_AGC_Cont 0xe60
+
+#define rBlue_Tooth 0xe6c
+#define rRx_Wait_CCA 0xe70
+#define rTx_CCK_RFON 0xe74
+#define rTx_CCK_BBON 0xe78
+#define rTx_OFDM_RFON 0xe7c
+#define rTx_OFDM_BBON 0xe80
+#define rTx_To_Rx 0xe84
+#define rTx_To_Tx 0xe88
+#define rRx_CCK 0xe8c
+
+#define rTx_Power_Before_IQK_A 0xe94
+#define rTx_Power_After_IQK_A 0xe9c
+
+#define rRx_Power_Before_IQK_A 0xea0
+#define rRx_Power_Before_IQK_A_2 0xea4
+#define rRx_Power_After_IQK_A 0xea8
+#define rRx_Power_After_IQK_A_2 0xeac
+
+#define rTx_Power_Before_IQK_B 0xeb4
+#define rTx_Power_After_IQK_B 0xebc
+
+#define rRx_Power_Before_IQK_B 0xec0
+#define rRx_Power_Before_IQK_B_2 0xec4
+#define rRx_Power_After_IQK_B 0xec8
+#define rRx_Power_After_IQK_B_2 0xecc
+
+#define rRx_OFDM 0xed0
+#define rRx_Wait_RIFS 0xed4
+#define rRx_TO_Rx 0xed8
+#define rStandby 0xedc
+#define rSleep 0xee0
+#define rPMPD_ANAEN 0xeec
+
+
+// 2. Page8(0x800)
+#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD
+#define bJapanMode 0x2
+#define bCCKTxSC 0x30
+#define bCCKEn 0x1000000
+#define bOFDMEn 0x2000000
+#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage
+#define bXCTxAGC 0xf000
+#define bXDTxAGC 0xf0000
+
+// 4. PageA(0xA00)
+#define bCCKBBMode 0x3 // Useless
+#define bCCKTxPowerSaving 0x80
+#define bCCKRxPowerSaving 0x40
+
+#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch
+
+#define bCCKScramble 0x8 // Useless
+#define bCCKAntDiversity 0x8000
+#define bCCKCarrierRecovery 0x4000
+#define bCCKTxRate 0x3000
+#define bCCKDCCancel 0x0800
+#define bCCKISICancel 0x0400
+#define bCCKMatchFilter 0x0200
+#define bCCKEqualizer 0x0100
+#define bCCKPreambleDetect 0x800000
+#define bCCKFastFalseCCA 0x400000
+#define bCCKChEstStart 0x300000
+#define bCCKCCACount 0x080000
+#define bCCKcs_lim 0x070000
+#define bCCKBistMode 0x80000000
+#define bCCKCCAMask 0x40000000
+#define bCCKTxDACPhase 0x4
+#define bCCKRxADCPhase 0x20000000 //r_rx_clk
+#define bCCKr_cp_mode0 0x0100
+#define bCCKTxDCOffset 0xf0
+#define bCCKRxDCOffset 0xf
+#define bCCKCCAMode 0xc000
+#define bCCKFalseCS_lim 0x3f00
+#define bCCKCS_ratio 0xc00000
+#define bCCKCorgBit_sel 0x300000
+#define bCCKPD_lim 0x0f0000
+#define bCCKNewCCA 0x80000000
+#define bCCKRxHPofIG 0x8000
+#define bCCKRxIG 0x7f00
+#define bCCKLNAPolarity 0x800000
+#define bCCKRx1stGain 0x7f0000
+#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity
+#define bCCKRxAGCSatLevel 0x1f000000
+#define bCCKRxAGCSatCount 0xe0
+#define bCCKRxRFSettle 0x1f //AGCsamp_dly
+#define bCCKFixedRxAGC 0x8000
+//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824
+#define bCCKAntennaPolarity 0x2000
+#define bCCKTxFilterType 0x0c00
+#define bCCKRxAGCReportType 0x0300
+#define bCCKRxDAGCEn 0x80000000
+#define bCCKRxDAGCPeriod 0x20000000
+#define bCCKRxDAGCSatLevel 0x1f000000
+#define bCCKTimingRecovery 0x800000
+#define bCCKTxC0 0x3f0000
+#define bCCKTxC1 0x3f000000
+#define bCCKTxC2 0x3f
+#define bCCKTxC3 0x3f00
+#define bCCKTxC4 0x3f0000
+#define bCCKTxC5 0x3f000000
+#define bCCKTxC6 0x3f
+#define bCCKTxC7 0x3f00
+#define bCCKDebugPort 0xff0000
+#define bCCKDACDebug 0x0f000000
+#define bCCKFalseAlarmEnable 0x8000
+#define bCCKFalseAlarmRead 0x4000
+#define bCCKTRSSI 0x7f
+#define bCCKRxAGCReport 0xfe
+#define bCCKRxReport_AntSel 0x80000000
+#define bCCKRxReport_MFOff 0x40000000
+#define bCCKRxRxReport_SQLoss 0x20000000
+#define bCCKRxReport_Pktloss 0x10000000
+#define bCCKRxReport_Lockedbit 0x08000000
+#define bCCKRxReport_RateError 0x04000000
+#define bCCKRxReport_RxRate 0x03000000
+#define bCCKRxFACounterLower 0xff
+#define bCCKRxFACounterUpper 0xff000000
+#define bCCKRxHPAGCStart 0xe000
+#define bCCKRxHPAGCFinal 0x1c00
+#define bCCKRxFalseAlarmEnable 0x8000
+#define bCCKFACounterFreeze 0x4000
+#define bCCKTxPathSel 0x10000000
+#define bCCKDefaultRxPath 0xc000000
+#define bCCKOptionRxPath 0x3000000
+
+// 6. PageE(0xE00)
+#define bSTBCEn 0x4 // Useless
+#define bAntennaMapping 0x10
+#define bNss 0x20
+#define bCFOAntSumD 0x200
+#define bPHYCounterReset 0x8000000
+#define bCFOReportGet 0x4000000
+#define bOFDMContinueTx 0x10000000
+#define bOFDMSingleCarrier 0x20000000
+#define bOFDMSingleTone 0x40000000
+
+
+//
+// Other Definition
+//
+
+#define bEnable 0x1 // Useless
+#define bDisable 0x0
+
+//byte endable for srwrite
+#define bByte0 0x1 // Useless
+#define bByte1 0x2
+#define bByte2 0x4
+#define bByte3 0x8
+#define bWord0 0x3
+#define bWord1 0xc
+#define bDWord 0xf
+
+//for PutRegsetting & GetRegSetting BitMask
+#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f
+#define bMaskByte1 0xff00
+#define bMaskByte2 0xff0000
+#define bMaskByte3 0xff000000
+#define bMaskHWord 0xffff0000
+#define bMaskLWord 0x0000ffff
+#define bMaskDWord 0xffffffff
+#define bMask12Bits 0xfff
+#define bMaskH4Bits 0xf0000000
+#define bMaskOFDM_D 0xffc00000
+#define bMaskCCK 0x3f3f3f3f
+
+
+/*--------------------------Define Parameters-------------------------------*/
+
+
+#endif
+
diff --git a/rtl8xxx_EU/include/Hal8812PwrSeq.h b/rtl8xxx_EU/include/Hal8812PwrSeq.h
index 0d0c2f7..7cc5e00 100755
--- a/rtl8xxx_EU/include/Hal8812PwrSeq.h
+++ b/rtl8xxx_EU/include/Hal8812PwrSeq.h
@@ -1,210 +1,210 @@
-
-/******************************************************************************
- *
- * 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 __HAL8812PWRSEQ_H__
-#define __HAL8812PWRSEQ_H__
-
-#include "HalPwrSeqCmd.h"
-
-/*
- Check document WB-110628-DZ-RTL8195 (Jaguar) Power Architecture-R04.pdf
- There are 6 HW Power States:
- 0: POFF--Power Off
- 1: PDN--Power Down
- 2: CARDEMU--Card Emulation
- 3: ACT--Active Mode
- 4: LPS--Low Power State
- 5: SUS--Suspend
-
- The transision from different states are defined below
- TRANS_CARDEMU_TO_ACT
- TRANS_ACT_TO_CARDEMU
- TRANS_CARDEMU_TO_SUS
- TRANS_SUS_TO_CARDEMU
- TRANS_CARDEMU_TO_PDN
- TRANS_ACT_TO_LPS
- TRANS_LPS_TO_ACT
-
- TRANS_END
-*/
-#define RTL8812_TRANS_CARDEMU_TO_ACT_STEPS 15
-#define RTL8812_TRANS_ACT_TO_CARDEMU_STEPS 15
-#define RTL8812_TRANS_CARDEMU_TO_SUS_STEPS 15
-#define RTL8812_TRANS_SUS_TO_CARDEMU_STEPS 15
-#define RTL8812_TRANS_CARDEMU_TO_PDN_STEPS 15
-#define RTL8812_TRANS_PDN_TO_CARDEMU_STEPS 15
-#define RTL8812_TRANS_ACT_TO_LPS_STEPS 15
-#define RTL8812_TRANS_LPS_TO_ACT_STEPS 15
-#define RTL8812_TRANS_END_STEPS 1
-
-
-#define RTL8812_TRANS_CARDEMU_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, 0},/* disable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/
-
-#define RTL8812_TRANS_ACT_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0c00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x04}, /* 0xc00[7:0] = 4 turn off 3-wire */ \
- {0x0e00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x04}, /* 0xe00[7:0] = 4 turn off 3-wire */ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /* 0x2[0] = 0 RESET BB, CLOSE RF */ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0}, /* Whole BB is reset*/ \
- /*{0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},//0x1F[7:0] = 0 turn off RF*/ \
- /*{0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},//0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x28}, /* 0x07[7:0] = 0x28 sps pwm mode */ \
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x02, 0},/*0x8[1] = 0 ANA clk =500k */ \
- /*{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0|BIT1, 0}, // 0x02[1:0] = 0 reset BB */ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/
-
-#define RTL8812_TRANS_CARDEMU_TO_SUS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xF0, 0xcc},\
- {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xF0, 0xEC},\
- {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x07},/* gpio11 input mode, gpio10~8 output mode */ \
- {0x0045, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio 0~7 output same value as input ?? */ \
- {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xff},/* gpio0~7 output mode */ \
- {0x0047, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* 0x47[7:0] = 00 gpio mode */ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* suspend option all off */ \
- {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, BIT7},/*0x14[7] = 1 turn on ZCD */ \
- {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, BIT0},/* 0x15[0] =1 trun on ZCD */ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, BIT4},/*0x23[4] = 1 hpon LDO sleep mode */ \
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x02, 0},/*0x8[1] = 0 ANA clk =500k */ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, BIT3}, /*0x04[11] = 2b'11 enable WL suspend for PCIe*/
-
-#define RTL8812_TRANS_SUS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, 0}, /*0x04[11] = 2b'01enable WL suspend*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, 0},/*0x23[4] = 0 hpon LDO sleep mode leave */ \
- {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/* 0x15[0] =0 trun off ZCD */ \
- {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, 0},/*0x14[7] = 0 turn off ZCD */ \
- {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio0~7 input mode */ \
- {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio11 input mode, gpio10~8 input mode */
-
-#define RTL8812_TRANS_CARDEMU_TO_CARDDIS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- /**{0x0194, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, //0x194[0]=0 , disable 32K clock*/ \
- /**{0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x94}, //0x93=0x94 , 90[30] =0 enable 500k ANA clock .switch clock from 12M to 500K , 90 [26] =0 disable EEprom loader clock*/ \
- {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0}, /*0x03[2] = 0, reset 8051*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x05}, /*0x80=05h if reload fw, fill the default value of host_CPU handshake field*/ \
- {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xF0, 0xcc},\
- {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xF0, 0xEC},\
- {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x07},/* gpio11 input mode, gpio10~8 output mode */ \
- {0x0045, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio 0~7 output same value as input ?? */ \
- {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xff},/* gpio0~7 output mode */ \
- {0x0047, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* 0x47[7:0] = 00 gpio mode */ \
- {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, BIT7},/*0x14[7] = 1 turn on ZCD */ \
- {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, BIT0},/* 0x15[0] =1 trun on ZCD */ \
- {0x0012, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/*0x12[0] = 0 force PFM mode */ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, BIT4},/*0x23[4] = 1 hpon LDO sleep mode */ \
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x02, 0},/*0x8[1] = 0 ANA clk =500k */ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
- {0x001f, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0}, /*0x01f[1]=0 , disable RFC_0 control REG_RF_CTRL_8812 */ \
- {0x0076, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0}, /*0x076[1]=0 , disable RFC_1 control REG_OPT_CTRL_8812 +2 */ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, BIT3}, /*0x04[11] = 2b'01 enable WL suspend*/
-
-#define RTL8812_TRANS_CARDDIS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0012, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*0x12[0] = 1 force PWM mode */ \
- {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, 0},/*0x14[7] = 0 turn off ZCD */ \
- {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/* 0x15[0] =0 trun off ZCD */ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, 0},/*0x23[4] = 0 hpon LDO leave sleep mode */ \
- {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio0~7 input mode */ \
- {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio11 input mode, gpio10~8 input mode */ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0}, /*0x04[10] = 0, enable SW LPS PCIE only*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, 0}, /*0x04[11] = 2b'01enable WL suspend*/ \
- {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x03[2] = 1, enable 8051*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/
-
-
-#define RTL8812_TRANS_CARDEMU_TO_PDN \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
-
-#define RTL8812_TRANS_PDN_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
-
-#define RTL8812_TRANS_ACT_TO_LPS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \
- {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x0c00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x04}, /* 0xc00[7:0] = 4 turn off 3-wire */ \
- {0x0e00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x04}, /* 0xe00[7:0] = 4 turn off 3-wire */ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated,and RF closed*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0}, /* Whole BB is reset*/ \
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
- {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/
-
-
-#define RTL8812_TRANS_LPS_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/ \
- {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/ \
- {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/ \
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/ \
- {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/ \
- {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/ \
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/ \
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/ \
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
-
-#define RTL8812_TRANS_END \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
-
-
-extern WLAN_PWR_CFG rtl8812_power_on_flow[RTL8812_TRANS_CARDEMU_TO_ACT_STEPS+RTL8812_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8812_radio_off_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8812_card_disable_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_PDN_STEPS+RTL8812_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8812_card_enable_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_PDN_STEPS+RTL8812_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8812_suspend_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_SUS_STEPS+RTL8812_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8812_resume_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_SUS_STEPS+RTL8812_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8812_hwpdn_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_PDN_STEPS+RTL8812_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8812_enter_lps_flow[RTL8812_TRANS_ACT_TO_LPS_STEPS+RTL8812_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8812_leave_lps_flow[RTL8812_TRANS_LPS_TO_ACT_STEPS+RTL8812_TRANS_END_STEPS];
-
-#endif //__HAL8812PWRSEQ_H__
-
+
+/******************************************************************************
+ *
+ * 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 __HAL8812PWRSEQ_H__
+#define __HAL8812PWRSEQ_H__
+
+#include "HalPwrSeqCmd.h"
+
+/*
+ Check document WB-110628-DZ-RTL8195 (Jaguar) Power Architecture-R04.pdf
+ There are 6 HW Power States:
+ 0: POFF--Power Off
+ 1: PDN--Power Down
+ 2: CARDEMU--Card Emulation
+ 3: ACT--Active Mode
+ 4: LPS--Low Power State
+ 5: SUS--Suspend
+
+ The transision from different states are defined below
+ TRANS_CARDEMU_TO_ACT
+ TRANS_ACT_TO_CARDEMU
+ TRANS_CARDEMU_TO_SUS
+ TRANS_SUS_TO_CARDEMU
+ TRANS_CARDEMU_TO_PDN
+ TRANS_ACT_TO_LPS
+ TRANS_LPS_TO_ACT
+
+ TRANS_END
+*/
+#define RTL8812_TRANS_CARDEMU_TO_ACT_STEPS 15
+#define RTL8812_TRANS_ACT_TO_CARDEMU_STEPS 15
+#define RTL8812_TRANS_CARDEMU_TO_SUS_STEPS 15
+#define RTL8812_TRANS_SUS_TO_CARDEMU_STEPS 15
+#define RTL8812_TRANS_CARDEMU_TO_PDN_STEPS 15
+#define RTL8812_TRANS_PDN_TO_CARDEMU_STEPS 15
+#define RTL8812_TRANS_ACT_TO_LPS_STEPS 15
+#define RTL8812_TRANS_LPS_TO_ACT_STEPS 15
+#define RTL8812_TRANS_END_STEPS 1
+
+
+#define RTL8812_TRANS_CARDEMU_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, 0},/* disable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/
+
+#define RTL8812_TRANS_ACT_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0c00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x04}, /* 0xc00[7:0] = 4 turn off 3-wire */ \
+ {0x0e00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x04}, /* 0xe00[7:0] = 4 turn off 3-wire */ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /* 0x2[0] = 0 RESET BB, CLOSE RF */ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0}, /* Whole BB is reset*/ \
+ /*{0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},//0x1F[7:0] = 0 turn off RF*/ \
+ /*{0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},//0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x28}, /* 0x07[7:0] = 0x28 sps pwm mode */ \
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x02, 0},/*0x8[1] = 0 ANA clk =500k */ \
+ /*{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0|BIT1, 0}, // 0x02[1:0] = 0 reset BB */ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/
+
+#define RTL8812_TRANS_CARDEMU_TO_SUS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xF0, 0xcc},\
+ {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xF0, 0xEC},\
+ {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x07},/* gpio11 input mode, gpio10~8 output mode */ \
+ {0x0045, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio 0~7 output same value as input ?? */ \
+ {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xff},/* gpio0~7 output mode */ \
+ {0x0047, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* 0x47[7:0] = 00 gpio mode */ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* suspend option all off */ \
+ {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, BIT7},/*0x14[7] = 1 turn on ZCD */ \
+ {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, BIT0},/* 0x15[0] =1 trun on ZCD */ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, BIT4},/*0x23[4] = 1 hpon LDO sleep mode */ \
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x02, 0},/*0x8[1] = 0 ANA clk =500k */ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, BIT3}, /*0x04[11] = 2b'11 enable WL suspend for PCIe*/
+
+#define RTL8812_TRANS_SUS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, 0}, /*0x04[11] = 2b'01enable WL suspend*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, 0},/*0x23[4] = 0 hpon LDO sleep mode leave */ \
+ {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/* 0x15[0] =0 trun off ZCD */ \
+ {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, 0},/*0x14[7] = 0 turn off ZCD */ \
+ {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio0~7 input mode */ \
+ {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio11 input mode, gpio10~8 input mode */
+
+#define RTL8812_TRANS_CARDEMU_TO_CARDDIS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ /**{0x0194, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, //0x194[0]=0 , disable 32K clock*/ \
+ /**{0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x94}, //0x93=0x94 , 90[30] =0 enable 500k ANA clock .switch clock from 12M to 500K , 90 [26] =0 disable EEprom loader clock*/ \
+ {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0}, /*0x03[2] = 0, reset 8051*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x05}, /*0x80=05h if reload fw, fill the default value of host_CPU handshake field*/ \
+ {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xF0, 0xcc},\
+ {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xF0, 0xEC},\
+ {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x07},/* gpio11 input mode, gpio10~8 output mode */ \
+ {0x0045, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio 0~7 output same value as input ?? */ \
+ {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xff},/* gpio0~7 output mode */ \
+ {0x0047, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* 0x47[7:0] = 00 gpio mode */ \
+ {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, BIT7},/*0x14[7] = 1 turn on ZCD */ \
+ {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, BIT0},/* 0x15[0] =1 trun on ZCD */ \
+ {0x0012, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/*0x12[0] = 0 force PFM mode */ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, BIT4},/*0x23[4] = 1 hpon LDO sleep mode */ \
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x02, 0},/*0x8[1] = 0 ANA clk =500k */ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
+ {0x001f, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0}, /*0x01f[1]=0 , disable RFC_0 control REG_RF_CTRL_8812 */ \
+ {0x0076, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0}, /*0x076[1]=0 , disable RFC_1 control REG_OPT_CTRL_8812 +2 */ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, BIT3}, /*0x04[11] = 2b'01 enable WL suspend*/
+
+#define RTL8812_TRANS_CARDDIS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0012, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*0x12[0] = 1 force PWM mode */ \
+ {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, 0},/*0x14[7] = 0 turn off ZCD */ \
+ {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/* 0x15[0] =0 trun off ZCD */ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, 0},/*0x23[4] = 0 hpon LDO leave sleep mode */ \
+ {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio0~7 input mode */ \
+ {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio11 input mode, gpio10~8 input mode */ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0}, /*0x04[10] = 0, enable SW LPS PCIE only*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, 0}, /*0x04[11] = 2b'01enable WL suspend*/ \
+ {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x03[2] = 1, enable 8051*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/
+
+
+#define RTL8812_TRANS_CARDEMU_TO_PDN \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
+
+#define RTL8812_TRANS_PDN_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
+
+#define RTL8812_TRANS_ACT_TO_LPS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \
+ {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x0c00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x04}, /* 0xc00[7:0] = 4 turn off 3-wire */ \
+ {0x0e00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x04}, /* 0xe00[7:0] = 4 turn off 3-wire */ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated,and RF closed*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0}, /* Whole BB is reset*/ \
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
+ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/
+
+
+#define RTL8812_TRANS_LPS_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/ \
+ {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/ \
+ {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/ \
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/ \
+ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/ \
+ {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/ \
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/ \
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/ \
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
+
+#define RTL8812_TRANS_END \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
+
+
+extern WLAN_PWR_CFG rtl8812_power_on_flow[RTL8812_TRANS_CARDEMU_TO_ACT_STEPS+RTL8812_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8812_radio_off_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8812_card_disable_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_PDN_STEPS+RTL8812_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8812_card_enable_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_PDN_STEPS+RTL8812_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8812_suspend_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_SUS_STEPS+RTL8812_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8812_resume_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_SUS_STEPS+RTL8812_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8812_hwpdn_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_PDN_STEPS+RTL8812_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8812_enter_lps_flow[RTL8812_TRANS_ACT_TO_LPS_STEPS+RTL8812_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8812_leave_lps_flow[RTL8812_TRANS_LPS_TO_ACT_STEPS+RTL8812_TRANS_END_STEPS];
+
+#endif //__HAL8812PWRSEQ_H__
+
diff --git a/rtl8xxx_EU/include/Hal8821APwrSeq.h b/rtl8xxx_EU/include/Hal8821APwrSeq.h
index 840dd74..208ad61 100755
--- a/rtl8xxx_EU/include/Hal8821APwrSeq.h
+++ b/rtl8xxx_EU/include/Hal8821APwrSeq.h
@@ -1,186 +1,186 @@
-#ifndef REALTEK_POWER_SEQUENCE_8821
-#define REALTEK_POWER_SEQUENCE_8821
-
-#include "HalPwrSeqCmd.h"
-
-/*
- Check document WM-20130516-JackieLau-RTL8821A_Power_Architecture-R10.vsd
- There are 6 HW Power States:
- 0: POFF--Power Off
- 1: PDN--Power Down
- 2: CARDEMU--Card Emulation
- 3: ACT--Active Mode
- 4: LPS--Low Power State
- 5: SUS--Suspend
-
- The transision from different states are defined below
- TRANS_CARDEMU_TO_ACT
- TRANS_ACT_TO_CARDEMU
- TRANS_CARDEMU_TO_SUS
- TRANS_SUS_TO_CARDEMU
- TRANS_CARDEMU_TO_PDN
- TRANS_ACT_TO_LPS
- TRANS_LPS_TO_ACT
-
- TRANS_END
-*/
-#define RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS 25
-#define RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS 15
-#define RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS 15
-#define RTL8821A_TRANS_SUS_TO_CARDEMU_STEPS 15
-#define RTL8821A_TRANS_CARDDIS_TO_CARDEMU_STEPS 15
-#define RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS 15
-#define RTL8821A_TRANS_PDN_TO_CARDEMU_STEPS 15
-#define RTL8821A_TRANS_ACT_TO_LPS_STEPS 15
-#define RTL8821A_TRANS_LPS_TO_ACT_STEPS 15
-#define RTL8821A_TRANS_END_STEPS 1
-
-
-#define RTL8821A_TRANS_CARDEMU_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \
- {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \
- {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \
- {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, 0}, /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3|BIT2), 0},/* disable SW LPS 0x04[10]=0 and WLSUS_EN 0x04[12:11]=0*/ \
- {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0 , BIT0},/* Disable USB suspend */ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
- {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0 , 0},/* Enable USB suspend */ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \
- {0x004F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*0x4C[24] = 0x4F[0] = 1, switch DPDT_SEL_P output from WL BB */\
- {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT5|BIT4), (BIT5|BIT4)},/*0x66[13] = 0x67[5] = 1, switch for PAPE_G/PAPE_A from WL BB ; 0x66[12] = 0x67[4] = 1, switch LNAON from WL BB */\
- {0x0025, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6, 0},/*anapar_mac<118> , 0x25[6]=0 by wlan single function*/\
- {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable falling edge triggering interrupt*/\
- {0x0063, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable GPIO9 interrupt mode*/\
- {0x0062, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Enable GPIO9 input mode*/\
- {0x0058, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Enable HSISR GPIO[C:0] interrupt*/\
- {0x005A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable HSISR GPIO9 interrupt*/\
- {0x007A, PWR_CUT_TESTCHIP_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x3A},/*0x7A = 0x3A start BT*/\
- {0x002E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF , 0x82 },/* 0x2C[23:12]=0x820 ; XTAL trim */ \
- {0x0010, PWR_CUT_A_MSK , PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6 , BIT6 },/* 0x10[6]=1 ; MP·s¼W¹ï©ó0x2Cªº±±¨îÅv¡A¶·§â0x10[6]³]¬°1¤~¯àÅýWLAN±±¨î */ \
-
-
-#define RTL8821A_TRANS_ACT_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
- {0x004F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*0x4C[24] = 0x4F[0] = 0, switch DPDT_SEL_P output from register 0x65[2] */\
- {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Enable rising edge triggering interrupt*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
- {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5}, /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \
- {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/ \
-
-
-#define RTL8821A_TRANS_CARDEMU_TO_SUS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8821A_TRANS_SUS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
-
-#define RTL8821A_TRANS_CARDEMU_TO_CARDDIS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
- {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
-
-#define RTL8821A_TRANS_CARDDIS_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
- {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
- {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/
-
-
-#define RTL8821A_TRANS_CARDEMU_TO_PDN \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
- {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \
- {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
-
-#define RTL8821A_TRANS_PDN_TO_CARDEMU \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
-
-#define RTL8821A_TRANS_ACT_TO_LPS \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
- {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
- {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
- {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
-
-
-#define RTL8821A_TRANS_LPS_TO_ACT \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
- {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
- {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
- {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
- {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
- {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
- {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
- {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
- {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
- {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
-
-#define RTL8821A_TRANS_END \
- /* format */ \
- /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
- {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
-
-
-extern WLAN_PWR_CFG rtl8821A_power_on_flow[RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8821A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8821A_radio_off_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8821A_card_disable_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8821A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8821A_card_enable_flow[RTL8821A_TRANS_CARDDIS_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8821A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8821A_suspend_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8821A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8821A_resume_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8821A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8821A_hwpdn_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8821A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8821A_enter_lps_flow[RTL8821A_TRANS_ACT_TO_LPS_STEPS+RTL8821A_TRANS_END_STEPS];
-extern WLAN_PWR_CFG rtl8821A_leave_lps_flow[RTL8821A_TRANS_LPS_TO_ACT_STEPS+RTL8821A_TRANS_END_STEPS];
-
-#endif
+#ifndef REALTEK_POWER_SEQUENCE_8821
+#define REALTEK_POWER_SEQUENCE_8821
+
+#include "HalPwrSeqCmd.h"
+
+/*
+ Check document WM-20130516-JackieLau-RTL8821A_Power_Architecture-R10.vsd
+ There are 6 HW Power States:
+ 0: POFF--Power Off
+ 1: PDN--Power Down
+ 2: CARDEMU--Card Emulation
+ 3: ACT--Active Mode
+ 4: LPS--Low Power State
+ 5: SUS--Suspend
+
+ The transision from different states are defined below
+ TRANS_CARDEMU_TO_ACT
+ TRANS_ACT_TO_CARDEMU
+ TRANS_CARDEMU_TO_SUS
+ TRANS_SUS_TO_CARDEMU
+ TRANS_CARDEMU_TO_PDN
+ TRANS_ACT_TO_LPS
+ TRANS_LPS_TO_ACT
+
+ TRANS_END
+*/
+#define RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS 25
+#define RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS 15
+#define RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS 15
+#define RTL8821A_TRANS_SUS_TO_CARDEMU_STEPS 15
+#define RTL8821A_TRANS_CARDDIS_TO_CARDEMU_STEPS 15
+#define RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS 15
+#define RTL8821A_TRANS_PDN_TO_CARDEMU_STEPS 15
+#define RTL8821A_TRANS_ACT_TO_LPS_STEPS 15
+#define RTL8821A_TRANS_LPS_TO_ACT_STEPS 15
+#define RTL8821A_TRANS_END_STEPS 1
+
+
+#define RTL8821A_TRANS_CARDEMU_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \
+ {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \
+ {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \
+ {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, 0}, /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3|BIT2), 0},/* disable SW LPS 0x04[10]=0 and WLSUS_EN 0x04[12:11]=0*/ \
+ {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0 , BIT0},/* Disable USB suspend */ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \
+ {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0 , 0},/* Enable USB suspend */ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \
+ {0x004F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*0x4C[24] = 0x4F[0] = 1, switch DPDT_SEL_P output from WL BB */\
+ {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT5|BIT4), (BIT5|BIT4)},/*0x66[13] = 0x67[5] = 1, switch for PAPE_G/PAPE_A from WL BB ; 0x66[12] = 0x67[4] = 1, switch LNAON from WL BB */\
+ {0x0025, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6, 0},/*anapar_mac<118> , 0x25[6]=0 by wlan single function*/\
+ {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable falling edge triggering interrupt*/\
+ {0x0063, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable GPIO9 interrupt mode*/\
+ {0x0062, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Enable GPIO9 input mode*/\
+ {0x0058, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*Enable HSISR GPIO[C:0] interrupt*/\
+ {0x005A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1},/*Enable HSISR GPIO9 interrupt*/\
+ {0x007A, PWR_CUT_TESTCHIP_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x3A},/*0x7A = 0x3A start BT*/\
+ {0x002E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF , 0x82 },/* 0x2C[23:12]=0x820 ; XTAL trim */ \
+ {0x0010, PWR_CUT_A_MSK , PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6 , BIT6 },/* 0x10[6]=1 ; MP·s¼W¹ï©ó0x2Cªº±±¨îÅv¡A¶·§â0x10[6]³]¬°1¤~¯àÅýWLAN±±¨î */ \
+
+
+#define RTL8821A_TRANS_ACT_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
+ {0x004F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*0x4C[24] = 0x4F[0] = 0, switch DPDT_SEL_P output from register 0x65[2] */\
+ {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Enable rising edge triggering interrupt*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
+ {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5}, /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \
+ {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/ \
+
+
+#define RTL8821A_TRANS_CARDEMU_TO_SUS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8821A_TRANS_SUS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
+
+#define RTL8821A_TRANS_CARDEMU_TO_CARDDIS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
+ {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+
+#define RTL8821A_TRANS_CARDDIS_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \
+ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\
+ {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/
+
+
+#define RTL8821A_TRANS_CARDEMU_TO_PDN \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
+ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \
+ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/
+
+#define RTL8821A_TRANS_PDN_TO_CARDEMU \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/
+
+#define RTL8821A_TRANS_ACT_TO_LPS \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
+ {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \
+ {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \
+ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \
+
+
+#define RTL8821A_TRANS_LPS_TO_ACT \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
+ {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
+ {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
+ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
+ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\
+ {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
+ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\
+ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
+ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
+ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
+
+#define RTL8821A_TRANS_END \
+ /* format */ \
+ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \
+ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, //
+
+
+extern WLAN_PWR_CFG rtl8821A_power_on_flow[RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8821A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8821A_radio_off_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8821A_card_disable_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8821A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8821A_card_enable_flow[RTL8821A_TRANS_CARDDIS_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8821A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8821A_suspend_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8821A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8821A_resume_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8821A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8821A_hwpdn_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8821A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8821A_enter_lps_flow[RTL8821A_TRANS_ACT_TO_LPS_STEPS+RTL8821A_TRANS_END_STEPS];
+extern WLAN_PWR_CFG rtl8821A_leave_lps_flow[RTL8821A_TRANS_LPS_TO_ACT_STEPS+RTL8821A_TRANS_END_STEPS];
+
+#endif
diff --git a/rtl8xxx_EU/include/HalPwrSeqCmd.h b/rtl8xxx_EU/include/HalPwrSeqCmd.h
index 5cf122f..24e4a54 100755
--- a/rtl8xxx_EU/include/HalPwrSeqCmd.h
+++ b/rtl8xxx_EU/include/HalPwrSeqCmd.h
@@ -1,138 +1,138 @@
-/******************************************************************************
- *
- * 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 __HALPWRSEQCMD_H__
-#define __HALPWRSEQCMD_H__
-
-#include <drv_types.h>
-
-/*---------------------------------------------*/
-//3 The value of cmd: 4 bits
-/*---------------------------------------------*/
-#define PWR_CMD_READ 0x00
- // offset: the read register offset
- // msk: the mask of the read value
- // value: N/A, left by 0
- // note: dirver shall implement this function by read & msk
-
-#define PWR_CMD_WRITE 0x01
- // offset: the read register offset
- // msk: the mask of the write bits
- // value: write value
- // note: driver shall implement this cmd by read & msk after write
-
-#define PWR_CMD_POLLING 0x02
- // offset: the read register offset
- // msk: the mask of the polled value
- // value: the value to be polled, masked by the msd field.
- // note: driver shall implement this cmd by
- // do{
- // if( (Read(offset) & msk) == (value & msk) )
- // break;
- // } while(not timeout);
-
-#define PWR_CMD_DELAY 0x03
- // offset: the value to delay
- // msk: N/A
- // value: the unit of delay, 0: us, 1: ms
-
-#define PWR_CMD_END 0x04
- // offset: N/A
- // msk: N/A
- // value: N/A
-
-/*---------------------------------------------*/
-//3 The value of base: 4 bits
-/*---------------------------------------------*/
- // define the base address of each block
-#define PWR_BASEADDR_MAC 0x00
-#define PWR_BASEADDR_USB 0x01
-#define PWR_BASEADDR_PCIE 0x02
-#define PWR_BASEADDR_SDIO 0x03
-
-/*---------------------------------------------*/
-//3 The value of interface_msk: 4 bits
-/*---------------------------------------------*/
-#define PWR_INTF_SDIO_MSK BIT(0)
-#define PWR_INTF_USB_MSK BIT(1)
-#define PWR_INTF_PCI_MSK BIT(2)
-#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
-
-/*---------------------------------------------*/
-//3 The value of fab_msk: 4 bits
-/*---------------------------------------------*/
-#define PWR_FAB_TSMC_MSK BIT(0)
-#define PWR_FAB_UMC_MSK BIT(1)
-#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
-
-/*---------------------------------------------*/
-//3 The value of cut_msk: 8 bits
-/*---------------------------------------------*/
-#define PWR_CUT_TESTCHIP_MSK BIT(0)
-#define PWR_CUT_A_MSK BIT(1)
-#define PWR_CUT_B_MSK BIT(2)
-#define PWR_CUT_C_MSK BIT(3)
-#define PWR_CUT_D_MSK BIT(4)
-#define PWR_CUT_E_MSK BIT(5)
-#define PWR_CUT_F_MSK BIT(6)
-#define PWR_CUT_G_MSK BIT(7)
-#define PWR_CUT_ALL_MSK 0xFF
-
-
-typedef enum _PWRSEQ_CMD_DELAY_UNIT_
-{
- PWRSEQ_DELAY_US,
- PWRSEQ_DELAY_MS,
-} PWRSEQ_DELAY_UNIT;
-
-typedef struct _WL_PWR_CFG_
-{
- u16 offset;
- u8 cut_msk;
- u8 fab_msk:4;
- u8 interface_msk:4;
- u8 base:4;
- u8 cmd:4;
- u8 msk;
- u8 value;
-} WLAN_PWR_CFG, *PWLAN_PWR_CFG;
-
-
-#define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset
-#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) __PWR_CMD.cut_msk
-#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) __PWR_CMD.fab_msk
-#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) __PWR_CMD.interface_msk
-#define GET_PWR_CFG_BASE(__PWR_CMD) __PWR_CMD.base
-#define GET_PWR_CFG_CMD(__PWR_CMD) __PWR_CMD.cmd
-#define GET_PWR_CFG_MASK(__PWR_CMD) __PWR_CMD.msk
-#define GET_PWR_CFG_VALUE(__PWR_CMD) __PWR_CMD.value
-
-
-//================================================================================
-// Prototype of protected function.
-//================================================================================
-u8 HalPwrSeqCmdParsing(
- PADAPTER padapter,
- u8 CutVersion,
- u8 FabVersion,
- u8 InterfaceType,
- WLAN_PWR_CFG PwrCfgCmd[]);
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __HALPWRSEQCMD_H__
+#define __HALPWRSEQCMD_H__
+
+#include <drv_types.h>
+
+/*---------------------------------------------*/
+//3 The value of cmd: 4 bits
+/*---------------------------------------------*/
+#define PWR_CMD_READ 0x00
+ // offset: the read register offset
+ // msk: the mask of the read value
+ // value: N/A, left by 0
+ // note: dirver shall implement this function by read & msk
+
+#define PWR_CMD_WRITE 0x01
+ // offset: the read register offset
+ // msk: the mask of the write bits
+ // value: write value
+ // note: driver shall implement this cmd by read & msk after write
+
+#define PWR_CMD_POLLING 0x02
+ // offset: the read register offset
+ // msk: the mask of the polled value
+ // value: the value to be polled, masked by the msd field.
+ // note: driver shall implement this cmd by
+ // do{
+ // if( (Read(offset) & msk) == (value & msk) )
+ // break;
+ // } while(not timeout);
+
+#define PWR_CMD_DELAY 0x03
+ // offset: the value to delay
+ // msk: N/A
+ // value: the unit of delay, 0: us, 1: ms
+
+#define PWR_CMD_END 0x04
+ // offset: N/A
+ // msk: N/A
+ // value: N/A
+
+/*---------------------------------------------*/
+//3 The value of base: 4 bits
+/*---------------------------------------------*/
+ // define the base address of each block
+#define PWR_BASEADDR_MAC 0x00
+#define PWR_BASEADDR_USB 0x01
+#define PWR_BASEADDR_PCIE 0x02
+#define PWR_BASEADDR_SDIO 0x03
+
+/*---------------------------------------------*/
+//3 The value of interface_msk: 4 bits
+/*---------------------------------------------*/
+#define PWR_INTF_SDIO_MSK BIT(0)
+#define PWR_INTF_USB_MSK BIT(1)
+#define PWR_INTF_PCI_MSK BIT(2)
+#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
+
+/*---------------------------------------------*/
+//3 The value of fab_msk: 4 bits
+/*---------------------------------------------*/
+#define PWR_FAB_TSMC_MSK BIT(0)
+#define PWR_FAB_UMC_MSK BIT(1)
+#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
+
+/*---------------------------------------------*/
+//3 The value of cut_msk: 8 bits
+/*---------------------------------------------*/
+#define PWR_CUT_TESTCHIP_MSK BIT(0)
+#define PWR_CUT_A_MSK BIT(1)
+#define PWR_CUT_B_MSK BIT(2)
+#define PWR_CUT_C_MSK BIT(3)
+#define PWR_CUT_D_MSK BIT(4)
+#define PWR_CUT_E_MSK BIT(5)
+#define PWR_CUT_F_MSK BIT(6)
+#define PWR_CUT_G_MSK BIT(7)
+#define PWR_CUT_ALL_MSK 0xFF
+
+
+typedef enum _PWRSEQ_CMD_DELAY_UNIT_
+{
+ PWRSEQ_DELAY_US,
+ PWRSEQ_DELAY_MS,
+} PWRSEQ_DELAY_UNIT;
+
+typedef struct _WL_PWR_CFG_
+{
+ u16 offset;
+ u8 cut_msk;
+ u8 fab_msk:4;
+ u8 interface_msk:4;
+ u8 base:4;
+ u8 cmd:4;
+ u8 msk;
+ u8 value;
+} WLAN_PWR_CFG, *PWLAN_PWR_CFG;
+
+
+#define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset
+#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) __PWR_CMD.cut_msk
+#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) __PWR_CMD.fab_msk
+#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) __PWR_CMD.interface_msk
+#define GET_PWR_CFG_BASE(__PWR_CMD) __PWR_CMD.base
+#define GET_PWR_CFG_CMD(__PWR_CMD) __PWR_CMD.cmd
+#define GET_PWR_CFG_MASK(__PWR_CMD) __PWR_CMD.msk
+#define GET_PWR_CFG_VALUE(__PWR_CMD) __PWR_CMD.value
+
+
+//================================================================================
+// Prototype of protected function.
+//================================================================================
+u8 HalPwrSeqCmdParsing(
+ PADAPTER padapter,
+ u8 CutVersion,
+ u8 FabVersion,
+ u8 InterfaceType,
+ WLAN_PWR_CFG PwrCfgCmd[]);
+
+#endif
+
diff --git a/rtl8xxx_EU/include/autoconf.h b/rtl8xxx_EU/include/autoconf.h
index 08e43b3..91f3eec 100644..100755
--- a/rtl8xxx_EU/include/autoconf.h
+++ b/rtl8xxx_EU/include/autoconf.h
@@ -20,10 +20,6 @@
//***** temporarily flag *******
#define CONFIG_SINGLE_IMG
-
-//p2p connection fix for android L
-#define CONFIG_RADIO_WORK
-
//#define CONFIG_DISABLE_ODM
//for FPGA VERIFICATION config
#define RTL8188E_FPGA_TRUE_PHY_VERIFICATION 0
@@ -40,7 +36,7 @@
#define PLATFORM_LINUX
-#define CONFIG_IOCTL_CFG80211
+//#define CONFIG_IOCTL_CFG80211
//#define CONFIG_IEEE80211W
#if defined(CONFIG_PLATFORM_ACTIONS_ATM702X)
@@ -50,7 +46,7 @@
#endif
#ifdef CONFIG_IOCTL_CFG80211
- #define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */
+ //#define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */
#define CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
//#define CONFIG_DEBUG_CFG80211
//#define CONFIG_DRV_ISSUE_PROV_REQ // IOT FOR S2
@@ -111,7 +107,7 @@
#endif
- #define CONFIG_CONCURRENT_MODE
+ //#define CONFIG_CONCURRENT_MODE
#ifdef CONFIG_CONCURRENT_MODE
//#define CONFIG_HWPORT_SWAP //Port0->Sec , Port1 -> Pri
#define CONFIG_RUNTIME_PORT_SWITCH
@@ -155,7 +151,7 @@
//#define CONFIG_DBG_P2P
#define CONFIG_P2P_PS
- #define CONFIG_P2P_IPS
+ //#define CONFIG_P2P_IPS
#define CONFIG_P2P_OP_CHK_SOCIAL_CH
#define CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT //replace CONFIG_P2P_CHK_INVITE_CH_LIST flag
#define CONFIG_P2P_INVITE_IOT
@@ -224,7 +220,6 @@
#define CONFIG_USB_RX_AGGREGATION
#endif
-#define CONFIG_PREALLOC_RECV_SKB
//#define CONFIG_REDUCE_USB_TX_INT // Trade-off: Improve performance, but may cause TX URBs blocked by USB Host/Bus driver on few platforms.
//#define CONFIG_EASY_REPLACEMENT
@@ -234,7 +229,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
+ #define CONFIG_PREALLOC_RECV_SKB
+ #ifdef CONFIG_PREALLOC_RECV_SKB
+ #define CONFIG_FIX_NR_BULKIN_BUFFER /* only use PREALLOC_RECV_SKB buffer, don't alloc skb at runtime */
+ #endif
#endif
/*
@@ -356,6 +356,8 @@
#define RTL8192E_SUPPORT 0
#define RTL8813A_SUPPORT 0
+#define RTL8195A_SUPPORT 0
+
//#if (RTL8188E_SUPPORT==1)
#define RATE_ADAPTIVE_SUPPORT 1
@@ -378,9 +380,9 @@
/*
* Debug Related Config
*/
-#define DBG 0
+#define DBG 1
-//#define CONFIG_DEBUG /* DBG_871X, etc... */
+#define CONFIG_DEBUG /* DBG_871X, etc... */
//#define CONFIG_DEBUG_RTL871X /* RT_TRACE, RT_PRINT_DATA, _func_enter_, _func_exit_ */
#define CONFIG_PROC_DEBUG
diff --git a/rtl8xxx_EU/include/drv_conf.h b/rtl8xxx_EU/include/drv_conf.h
index 5b0c3ca..d8fe59a 100755
--- a/rtl8xxx_EU/include/drv_conf.h
+++ b/rtl8xxx_EU/include/drv_conf.h
@@ -75,10 +75,30 @@
#define DYNAMIC_CAMID_ALLOC
+#define RTW_SCAN_SPARSE_MIRACAST 1
+#define RTW_SCAN_SPARSE_BG 0
+
#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_ADAPTIVITY_DML
+ #define CONFIG_RTW_ADAPTIVITY_DML 0
+#endif
+
+#ifndef CONFIG_RTW_ADAPTIVITY_DC_BACKOFF
+ #define CONFIG_RTW_ADAPTIVITY_DC_BACKOFF 2
+#endif
+
+/*#define CONFIG_WEXT_DONT_JOIN_BYSSID */
//#include <rtl871x_byteorder.h>
#endif // __DRV_CONF_H__
diff --git a/rtl8xxx_EU/include/drv_types.h b/rtl8xxx_EU/include/drv_types.h
index b2294c3..7573a97 100755
--- a/rtl8xxx_EU/include/drv_types.h
+++ b/rtl8xxx_EU/include/drv_types.h
@@ -322,6 +322,12 @@ struct registry_priv
u8 qos_opt_enable;
u8 hiq_filter;
+
+ u8 adaptivity_en;
+ u8 adaptivity_mode;
+ u8 adaptivity_dml;
+ u8 adaptivity_dc_backoff;
+
};
@@ -595,6 +601,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_regsty(dvobj) (&(dvobj->if1->registrypriv))
#ifdef PLATFORM_LINUX
static struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
diff --git a/rtl8xxx_EU/include/drv_types_gspi.h b/rtl8xxx_EU/include/drv_types_gspi.h
index 27b3cb0..545776b 100755
--- a/rtl8xxx_EU/include/drv_types_gspi.h
+++ b/rtl8xxx_EU/include/drv_types_gspi.h
@@ -1,56 +1,56 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __DRV_TYPES_GSPI_H__
-#define __DRV_TYPES_GSPI_H__
-
-// SPI Header Files
-#ifdef PLATFORM_LINUX
- #include <linux/platform_device.h>
- #include <linux/spi/spi.h>
- #include <linux/gpio.h>
- //#include <mach/ldo.h>
- #include <asm/mach-types.h>
- #include <asm/gpio.h>
- #include <asm/io.h>
- #include <mach/board.h>
- #include <mach/hardware.h>
- #include <mach/irqs.h>
- #include <custom_gpio.h>
-#endif
-
-
-typedef struct gspi_data
-{
- u8 func_number;
-
- u8 tx_block_mode;
- u8 rx_block_mode;
- u32 block_transfer_len;
-
-#ifdef PLATFORM_LINUX
- struct spi_device *func;
-
- struct workqueue_struct *priv_wq;
- struct delayed_work irq_work;
-#endif
-} GSPI_DATA, *PGSPI_DATA;
-
-#endif // #ifndef __DRV_TYPES_GSPI_H__
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __DRV_TYPES_GSPI_H__
+#define __DRV_TYPES_GSPI_H__
+
+// SPI Header Files
+#ifdef PLATFORM_LINUX
+ #include <linux/platform_device.h>
+ #include <linux/spi/spi.h>
+ #include <linux/gpio.h>
+ //#include <mach/ldo.h>
+ #include <asm/mach-types.h>
+ #include <asm/gpio.h>
+ #include <asm/io.h>
+ #include <mach/board.h>
+ #include <mach/hardware.h>
+ #include <mach/irqs.h>
+ #include <custom_gpio.h>
+#endif
+
+
+typedef struct gspi_data
+{
+ u8 func_number;
+
+ u8 tx_block_mode;
+ u8 rx_block_mode;
+ u32 block_transfer_len;
+
+#ifdef PLATFORM_LINUX
+ struct spi_device *func;
+
+ struct workqueue_struct *priv_wq;
+ struct delayed_work irq_work;
+#endif
+} GSPI_DATA, *PGSPI_DATA;
+
+#endif // #ifndef __DRV_TYPES_GSPI_H__
+
diff --git a/rtl8xxx_EU/include/drv_types_pci.h b/rtl8xxx_EU/include/drv_types_pci.h
index 6ba8f92..62a657c 100755
--- a/rtl8xxx_EU/include/drv_types_pci.h
+++ b/rtl8xxx_EU/include/drv_types_pci.h
@@ -1,280 +1,280 @@
-/******************************************************************************
- *
- * 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 __DRV_TYPES_PCI_H__
-#define __DRV_TYPES_PCI_H__
-
-
-#ifdef PLATFORM_LINUX
-#include <linux/pci.h>
-#endif
-
-
-#define INTEL_VENDOR_ID 0x8086
-#define SIS_VENDOR_ID 0x1039
-#define ATI_VENDOR_ID 0x1002
-#define ATI_DEVICE_ID 0x7914
-#define AMD_VENDOR_ID 0x1022
-
-#define PCI_MAX_BRIDGE_NUMBER 255
-#define PCI_MAX_DEVICES 32
-#define PCI_MAX_FUNCTION 8
-
-#define PCI_CONF_ADDRESS 0x0CF8 // PCI Configuration Space Address
-#define PCI_CONF_DATA 0x0CFC // PCI Configuration Space Data
-
-#define PCI_CLASS_BRIDGE_DEV 0x06
-#define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04
-
-#define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
-
-#define U1DONTCARE 0xFF
-#define U2DONTCARE 0xFFFF
-#define U4DONTCARE 0xFFFFFFFF
-
-#define PCI_VENDER_ID_REALTEK 0x10ec
-
-#define HAL_HW_PCI_8180_DEVICE_ID 0x8180
-#define HAL_HW_PCI_8185_DEVICE_ID 0x8185 //8185 or 8185b
-#define HAL_HW_PCI_8188_DEVICE_ID 0x8188 //8185b
-#define HAL_HW_PCI_8198_DEVICE_ID 0x8198 //8185b
-#define HAL_HW_PCI_8190_DEVICE_ID 0x8190 //8190
-#define HAL_HW_PCI_8723E_DEVICE_ID 0x8723 //8723E
-#define HAL_HW_PCI_8192_DEVICE_ID 0x8192 //8192 PCI-E
-#define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192 //8192 SE
-#define HAL_HW_PCI_8174_DEVICE_ID 0x8174 //8192 SE
-#define HAL_HW_PCI_8173_DEVICE_ID 0x8173 //8191 SE Crab
-#define HAL_HW_PCI_8172_DEVICE_ID 0x8172 //8191 SE RE
-#define HAL_HW_PCI_8171_DEVICE_ID 0x8171 //8191 SE Unicron
-#define HAL_HW_PCI_0045_DEVICE_ID 0x0045 //8190 PCI for Ceraga
-#define HAL_HW_PCI_0046_DEVICE_ID 0x0046 //8190 Cardbus for Ceraga
-#define HAL_HW_PCI_0044_DEVICE_ID 0x0044 //8192e PCIE for Ceraga
-#define HAL_HW_PCI_0047_DEVICE_ID 0x0047 //8192e Express Card for Ceraga
-#define HAL_HW_PCI_700F_DEVICE_ID 0x700F
-#define HAL_HW_PCI_701F_DEVICE_ID 0x701F
-#define HAL_HW_PCI_DLINK_DEVICE_ID 0x3304
-#define HAL_HW_PCI_8192CET_DEVICE_ID 0x8191 //8192ce
-#define HAL_HW_PCI_8192CE_DEVICE_ID 0x8178 //8192ce
-#define HAL_HW_PCI_8191CE_DEVICE_ID 0x8177 //8192ce
-#define HAL_HW_PCI_8188CE_DEVICE_ID 0x8176 //8192ce
-#define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191 //8192ce
-#define HAL_HW_PCI_8192DE_DEVICE_ID 0x8193 //8192de
-#define HAL_HW_PCI_002B_DEVICE_ID 0x002B //8192de, provided by HW SD
-#define HAL_HW_PCI_8188EE_DEVICE_ID 0x8179
-
-#define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000 //8190 support 16 pages of IO registers
-#define HAL_HW_PCI_REVISION_ID_8190PCI 0x00
-#define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000 //8192 support 16 pages of IO registers
-#define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01
-#define HAL_MEMORY_MAPPED_IO_RANGE_8192SE 0x4000 //8192 support 16 pages of IO registers
-#define HAL_HW_PCI_REVISION_ID_8192SE 0x10
-#define HAL_HW_PCI_REVISION_ID_8192CE 0x1
-#define HAL_MEMORY_MAPPED_IO_RANGE_8192CE 0x4000 //8192 support 16 pages of IO registers
-#define HAL_HW_PCI_REVISION_ID_8192DE 0x0
-#define HAL_MEMORY_MAPPED_IO_RANGE_8192DE 0x4000 //8192 support 16 pages of IO registers
-
-enum pci_bridge_vendor {
- PCI_BRIDGE_VENDOR_INTEL = 0x0,//0b'0000,0001
- PCI_BRIDGE_VENDOR_ATI, //= 0x02,//0b'0000,0010
- PCI_BRIDGE_VENDOR_AMD, //= 0x04,//0b'0000,0100
- PCI_BRIDGE_VENDOR_SIS ,//= 0x08,//0b'0000,1000
- PCI_BRIDGE_VENDOR_UNKNOWN, //= 0x40,//0b'0100,0000
- PCI_BRIDGE_VENDOR_MAX ,//= 0x80
-} ;
-
-// copy this data structor defination from MSDN SDK
-typedef struct _PCI_COMMON_CONFIG {
- u16 VendorID;
- u16 DeviceID;
- u16 Command;
- u16 Status;
- u8 RevisionID;
- u8 ProgIf;
- u8 SubClass;
- u8 BaseClass;
- u8 CacheLineSize;
- u8 LatencyTimer;
- u8 HeaderType;
- u8 BIST;
-
- union {
- struct _PCI_HEADER_TYPE_0 {
- u32 BaseAddresses[6];
- u32 CIS;
- u16 SubVendorID;
- u16 SubSystemID;
- u32 ROMBaseAddress;
- u8 CapabilitiesPtr;
- u8 Reserved1[3];
- u32 Reserved2;
-
- u8 InterruptLine;
- u8 InterruptPin;
- u8 MinimumGrant;
- u8 MaximumLatency;
- } type0;
-#if 0
- struct _PCI_HEADER_TYPE_1 {
- ULONG BaseAddresses[PCI_TYPE1_ADDRESSES];
- UCHAR PrimaryBusNumber;
- UCHAR SecondaryBusNumber;
- UCHAR SubordinateBusNumber;
- UCHAR SecondaryLatencyTimer;
- UCHAR IOBase;
- UCHAR IOLimit;
- USHORT SecondaryStatus;
- USHORT MemoryBase;
- USHORT MemoryLimit;
- USHORT PrefetchableMemoryBase;
- USHORT PrefetchableMemoryLimit;
- ULONG PrefetchableMemoryBaseUpper32;
- ULONG PrefetchableMemoryLimitUpper32;
- USHORT IOBaseUpper;
- USHORT IOLimitUpper;
- ULONG Reserved2;
- ULONG ExpansionROMBase;
- UCHAR InterruptLine;
- UCHAR InterruptPin;
- USHORT BridgeControl;
- } type1;
-
- struct _PCI_HEADER_TYPE_2 {
- ULONG BaseAddress;
- UCHAR CapabilitiesPtr;
- UCHAR Reserved2;
- USHORT SecondaryStatus;
- UCHAR PrimaryBusNumber;
- UCHAR CardbusBusNumber;
- UCHAR SubordinateBusNumber;
- UCHAR CardbusLatencyTimer;
- ULONG MemoryBase0;
- ULONG MemoryLimit0;
- ULONG MemoryBase1;
- ULONG MemoryLimit1;
- USHORT IOBase0_LO;
- USHORT IOBase0_HI;
- USHORT IOLimit0_LO;
- USHORT IOLimit0_HI;
- USHORT IOBase1_LO;
- USHORT IOBase1_HI;
- USHORT IOLimit1_LO;
- USHORT IOLimit1_HI;
- UCHAR InterruptLine;
- UCHAR InterruptPin;
- USHORT BridgeControl;
- USHORT SubVendorID;
- USHORT SubSystemID;
- ULONG LegacyBaseAddress;
- UCHAR Reserved3[56];
- ULONG SystemControl;
- UCHAR MultiMediaControl;
- UCHAR GeneralStatus;
- UCHAR Reserved4[2];
- UCHAR GPIO0Control;
- UCHAR GPIO1Control;
- UCHAR GPIO2Control;
- UCHAR GPIO3Control;
- ULONG IRQMuxRouting;
- UCHAR RetryStatus;
- UCHAR CardControl;
- UCHAR DeviceControl;
- UCHAR Diagnostic;
- } type2;
-#endif
- } u;
-
- u8 DeviceSpecific[108];
-} PCI_COMMON_CONFIG , *PPCI_COMMON_CONFIG;
-
-typedef struct _RT_PCI_CAPABILITIES_HEADER {
- u8 CapabilityID;
- u8 Next;
-} RT_PCI_CAPABILITIES_HEADER, *PRT_PCI_CAPABILITIES_HEADER;
-
-struct pci_priv{
- BOOLEAN pci_clk_req;
-
- u8 pciehdr_offset;
- // PCIeCap is only differece between B-cut and C-cut.
- // Configuration Space offset 72[7:4]
- // 0: A/B cut
- // 1: C cut and later.
- u8 pcie_cap;
- u8 linkctrl_reg;
-
- u8 busnumber;
- u8 devnumber;
- u8 funcnumber;
-
- u8 pcibridge_busnum;
- u8 pcibridge_devnum;
- u8 pcibridge_funcnum;
- u8 pcibridge_vendor;
- u16 pcibridge_vendorid;
- u16 pcibridge_deviceid;
- u8 pcibridge_pciehdr_offset;
- u8 pcibridge_linkctrlreg;
-
- u8 amd_l1_patch;
-};
-
-typedef struct _RT_ISR_CONTENT
-{
- union{
- u32 IntArray[2];
- u32 IntReg4Byte;
- u16 IntReg2Byte;
- };
-}RT_ISR_CONTENT, *PRT_ISR_CONTENT;
-
-//#define RegAddr(addr) (addr + 0xB2000000UL)
-//some platform macros will def here
-static inline void NdisRawWritePortUlong(u32 port, u32 val)
-{
- outl(val, port);
- //writel(val, (u8 *)RegAddr(port));
-}
-
-static inline void NdisRawWritePortUchar(u32 port, u8 val)
-{
- outb(val, port);
- //writeb(val, (u8 *)RegAddr(port));
-}
-
-static inline void NdisRawReadPortUchar(u32 port, u8 *pval)
-{
- *pval = inb(port);
- //*pval = readb((u8 *)RegAddr(port));
-}
-
-static inline void NdisRawReadPortUshort(u32 port, u16 *pval)
-{
- *pval = inw(port);
- //*pval = readw((u8 *)RegAddr(port));
-}
-
-static inline void NdisRawReadPortUlong(u32 port, u32 *pval)
-{
- *pval = inl(port);
- //*pval = readl((u8 *)RegAddr(port));
-}
-
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __DRV_TYPES_PCI_H__
+#define __DRV_TYPES_PCI_H__
+
+
+#ifdef PLATFORM_LINUX
+#include <linux/pci.h>
+#endif
+
+
+#define INTEL_VENDOR_ID 0x8086
+#define SIS_VENDOR_ID 0x1039
+#define ATI_VENDOR_ID 0x1002
+#define ATI_DEVICE_ID 0x7914
+#define AMD_VENDOR_ID 0x1022
+
+#define PCI_MAX_BRIDGE_NUMBER 255
+#define PCI_MAX_DEVICES 32
+#define PCI_MAX_FUNCTION 8
+
+#define PCI_CONF_ADDRESS 0x0CF8 // PCI Configuration Space Address
+#define PCI_CONF_DATA 0x0CFC // PCI Configuration Space Data
+
+#define PCI_CLASS_BRIDGE_DEV 0x06
+#define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04
+
+#define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
+
+#define U1DONTCARE 0xFF
+#define U2DONTCARE 0xFFFF
+#define U4DONTCARE 0xFFFFFFFF
+
+#define PCI_VENDER_ID_REALTEK 0x10ec
+
+#define HAL_HW_PCI_8180_DEVICE_ID 0x8180
+#define HAL_HW_PCI_8185_DEVICE_ID 0x8185 //8185 or 8185b
+#define HAL_HW_PCI_8188_DEVICE_ID 0x8188 //8185b
+#define HAL_HW_PCI_8198_DEVICE_ID 0x8198 //8185b
+#define HAL_HW_PCI_8190_DEVICE_ID 0x8190 //8190
+#define HAL_HW_PCI_8723E_DEVICE_ID 0x8723 //8723E
+#define HAL_HW_PCI_8192_DEVICE_ID 0x8192 //8192 PCI-E
+#define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192 //8192 SE
+#define HAL_HW_PCI_8174_DEVICE_ID 0x8174 //8192 SE
+#define HAL_HW_PCI_8173_DEVICE_ID 0x8173 //8191 SE Crab
+#define HAL_HW_PCI_8172_DEVICE_ID 0x8172 //8191 SE RE
+#define HAL_HW_PCI_8171_DEVICE_ID 0x8171 //8191 SE Unicron
+#define HAL_HW_PCI_0045_DEVICE_ID 0x0045 //8190 PCI for Ceraga
+#define HAL_HW_PCI_0046_DEVICE_ID 0x0046 //8190 Cardbus for Ceraga
+#define HAL_HW_PCI_0044_DEVICE_ID 0x0044 //8192e PCIE for Ceraga
+#define HAL_HW_PCI_0047_DEVICE_ID 0x0047 //8192e Express Card for Ceraga
+#define HAL_HW_PCI_700F_DEVICE_ID 0x700F
+#define HAL_HW_PCI_701F_DEVICE_ID 0x701F
+#define HAL_HW_PCI_DLINK_DEVICE_ID 0x3304
+#define HAL_HW_PCI_8192CET_DEVICE_ID 0x8191 //8192ce
+#define HAL_HW_PCI_8192CE_DEVICE_ID 0x8178 //8192ce
+#define HAL_HW_PCI_8191CE_DEVICE_ID 0x8177 //8192ce
+#define HAL_HW_PCI_8188CE_DEVICE_ID 0x8176 //8192ce
+#define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191 //8192ce
+#define HAL_HW_PCI_8192DE_DEVICE_ID 0x8193 //8192de
+#define HAL_HW_PCI_002B_DEVICE_ID 0x002B //8192de, provided by HW SD
+#define HAL_HW_PCI_8188EE_DEVICE_ID 0x8179
+
+#define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000 //8190 support 16 pages of IO registers
+#define HAL_HW_PCI_REVISION_ID_8190PCI 0x00
+#define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000 //8192 support 16 pages of IO registers
+#define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01
+#define HAL_MEMORY_MAPPED_IO_RANGE_8192SE 0x4000 //8192 support 16 pages of IO registers
+#define HAL_HW_PCI_REVISION_ID_8192SE 0x10
+#define HAL_HW_PCI_REVISION_ID_8192CE 0x1
+#define HAL_MEMORY_MAPPED_IO_RANGE_8192CE 0x4000 //8192 support 16 pages of IO registers
+#define HAL_HW_PCI_REVISION_ID_8192DE 0x0
+#define HAL_MEMORY_MAPPED_IO_RANGE_8192DE 0x4000 //8192 support 16 pages of IO registers
+
+enum pci_bridge_vendor {
+ PCI_BRIDGE_VENDOR_INTEL = 0x0,//0b'0000,0001
+ PCI_BRIDGE_VENDOR_ATI, //= 0x02,//0b'0000,0010
+ PCI_BRIDGE_VENDOR_AMD, //= 0x04,//0b'0000,0100
+ PCI_BRIDGE_VENDOR_SIS ,//= 0x08,//0b'0000,1000
+ PCI_BRIDGE_VENDOR_UNKNOWN, //= 0x40,//0b'0100,0000
+ PCI_BRIDGE_VENDOR_MAX ,//= 0x80
+} ;
+
+// copy this data structor defination from MSDN SDK
+typedef struct _PCI_COMMON_CONFIG {
+ u16 VendorID;
+ u16 DeviceID;
+ u16 Command;
+ u16 Status;
+ u8 RevisionID;
+ u8 ProgIf;
+ u8 SubClass;
+ u8 BaseClass;
+ u8 CacheLineSize;
+ u8 LatencyTimer;
+ u8 HeaderType;
+ u8 BIST;
+
+ union {
+ struct _PCI_HEADER_TYPE_0 {
+ u32 BaseAddresses[6];
+ u32 CIS;
+ u16 SubVendorID;
+ u16 SubSystemID;
+ u32 ROMBaseAddress;
+ u8 CapabilitiesPtr;
+ u8 Reserved1[3];
+ u32 Reserved2;
+
+ u8 InterruptLine;
+ u8 InterruptPin;
+ u8 MinimumGrant;
+ u8 MaximumLatency;
+ } type0;
+#if 0
+ struct _PCI_HEADER_TYPE_1 {
+ ULONG BaseAddresses[PCI_TYPE1_ADDRESSES];
+ UCHAR PrimaryBusNumber;
+ UCHAR SecondaryBusNumber;
+ UCHAR SubordinateBusNumber;
+ UCHAR SecondaryLatencyTimer;
+ UCHAR IOBase;
+ UCHAR IOLimit;
+ USHORT SecondaryStatus;
+ USHORT MemoryBase;
+ USHORT MemoryLimit;
+ USHORT PrefetchableMemoryBase;
+ USHORT PrefetchableMemoryLimit;
+ ULONG PrefetchableMemoryBaseUpper32;
+ ULONG PrefetchableMemoryLimitUpper32;
+ USHORT IOBaseUpper;
+ USHORT IOLimitUpper;
+ ULONG Reserved2;
+ ULONG ExpansionROMBase;
+ UCHAR InterruptLine;
+ UCHAR InterruptPin;
+ USHORT BridgeControl;
+ } type1;
+
+ struct _PCI_HEADER_TYPE_2 {
+ ULONG BaseAddress;
+ UCHAR CapabilitiesPtr;
+ UCHAR Reserved2;
+ USHORT SecondaryStatus;
+ UCHAR PrimaryBusNumber;
+ UCHAR CardbusBusNumber;
+ UCHAR SubordinateBusNumber;
+ UCHAR CardbusLatencyTimer;
+ ULONG MemoryBase0;
+ ULONG MemoryLimit0;
+ ULONG MemoryBase1;
+ ULONG MemoryLimit1;
+ USHORT IOBase0_LO;
+ USHORT IOBase0_HI;
+ USHORT IOLimit0_LO;
+ USHORT IOLimit0_HI;
+ USHORT IOBase1_LO;
+ USHORT IOBase1_HI;
+ USHORT IOLimit1_LO;
+ USHORT IOLimit1_HI;
+ UCHAR InterruptLine;
+ UCHAR InterruptPin;
+ USHORT BridgeControl;
+ USHORT SubVendorID;
+ USHORT SubSystemID;
+ ULONG LegacyBaseAddress;
+ UCHAR Reserved3[56];
+ ULONG SystemControl;
+ UCHAR MultiMediaControl;
+ UCHAR GeneralStatus;
+ UCHAR Reserved4[2];
+ UCHAR GPIO0Control;
+ UCHAR GPIO1Control;
+ UCHAR GPIO2Control;
+ UCHAR GPIO3Control;
+ ULONG IRQMuxRouting;
+ UCHAR RetryStatus;
+ UCHAR CardControl;
+ UCHAR DeviceControl;
+ UCHAR Diagnostic;
+ } type2;
+#endif
+ } u;
+
+ u8 DeviceSpecific[108];
+} PCI_COMMON_CONFIG , *PPCI_COMMON_CONFIG;
+
+typedef struct _RT_PCI_CAPABILITIES_HEADER {
+ u8 CapabilityID;
+ u8 Next;
+} RT_PCI_CAPABILITIES_HEADER, *PRT_PCI_CAPABILITIES_HEADER;
+
+struct pci_priv{
+ BOOLEAN pci_clk_req;
+
+ u8 pciehdr_offset;
+ // PCIeCap is only differece between B-cut and C-cut.
+ // Configuration Space offset 72[7:4]
+ // 0: A/B cut
+ // 1: C cut and later.
+ u8 pcie_cap;
+ u8 linkctrl_reg;
+
+ u8 busnumber;
+ u8 devnumber;
+ u8 funcnumber;
+
+ u8 pcibridge_busnum;
+ u8 pcibridge_devnum;
+ u8 pcibridge_funcnum;
+ u8 pcibridge_vendor;
+ u16 pcibridge_vendorid;
+ u16 pcibridge_deviceid;
+ u8 pcibridge_pciehdr_offset;
+ u8 pcibridge_linkctrlreg;
+
+ u8 amd_l1_patch;
+};
+
+typedef struct _RT_ISR_CONTENT
+{
+ union{
+ u32 IntArray[2];
+ u32 IntReg4Byte;
+ u16 IntReg2Byte;
+ };
+}RT_ISR_CONTENT, *PRT_ISR_CONTENT;
+
+//#define RegAddr(addr) (addr + 0xB2000000UL)
+//some platform macros will def here
+static inline void NdisRawWritePortUlong(u32 port, u32 val)
+{
+ outl(val, port);
+ //writel(val, (u8 *)RegAddr(port));
+}
+
+static inline void NdisRawWritePortUchar(u32 port, u8 val)
+{
+ outb(val, port);
+ //writeb(val, (u8 *)RegAddr(port));
+}
+
+static inline void NdisRawReadPortUchar(u32 port, u8 *pval)
+{
+ *pval = inb(port);
+ //*pval = readb((u8 *)RegAddr(port));
+}
+
+static inline void NdisRawReadPortUshort(u32 port, u16 *pval)
+{
+ *pval = inw(port);
+ //*pval = readw((u8 *)RegAddr(port));
+}
+
+static inline void NdisRawReadPortUlong(u32 port, u32 *pval)
+{
+ *pval = inl(port);
+ //*pval = readl((u8 *)RegAddr(port));
+}
+
+
+#endif
+
diff --git a/rtl8xxx_EU/include/drv_types_sdio.h b/rtl8xxx_EU/include/drv_types_sdio.h
index 044ef51..2fa9026 100755
--- a/rtl8xxx_EU/include/drv_types_sdio.h
+++ b/rtl8xxx_EU/include/drv_types_sdio.h
@@ -1,81 +1,81 @@
-/******************************************************************************
- *
- * 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 __DRV_TYPES_SDIO_H__
-#define __DRV_TYPES_SDIO_H__
-
-// SDIO Header Files
-#ifdef PLATFORM_LINUX
- #include <linux/mmc/sdio_func.h>
- #include <linux/mmc/sdio_ids.h>
-
-#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) || defined(CONFIG_PLATFORM_SPRD)
- #include <linux/mmc/host.h>
- #include <linux/mmc/card.h>
-#endif
-
-#ifdef CONFIG_PLATFORM_SPRD
- #include <linux/gpio.h>
- #include <custom_gpio.h>
-#endif // CONFIG_PLATFORM_SPRD
-#endif
-
-#ifdef PLATFORM_OS_XP
-#include <wdm.h>
-#include <ntddsd.h>
-#endif
-
-#ifdef PLATFORM_OS_CE
-#include <sdcardddk.h>
-#endif
-
-
-typedef struct sdio_data
-{
- u8 func_number;
-
- u8 tx_block_mode;
- u8 rx_block_mode;
- u32 block_transfer_len;
-
-#ifdef PLATFORM_LINUX
- struct sdio_func *func;
- _thread_hdl_ sys_sdio_irq_thd;
-#endif
-
-#ifdef PLATFORM_OS_XP
- PDEVICE_OBJECT pphysdevobj;
- PDEVICE_OBJECT pfuncdevobj;
- PDEVICE_OBJECT pnextdevobj;
- SDBUS_INTERFACE_STANDARD sdbusinft;
- u8 nextdevstacksz;
-#endif
-
-#ifdef PLATFORM_OS_CE
- SD_DEVICE_HANDLE hDevice;
- SD_CARD_RCA sd_rca;
- SD_CARD_INTERFACE card_intf;
- BOOLEAN enableIsarWithStatus;
- WCHAR active_path[MAX_ACTIVE_REG_PATH];
- SD_HOST_BLOCK_CAPABILITY sd_host_blk_cap;
-#endif
-} SDIO_DATA, *PSDIO_DATA;
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __DRV_TYPES_SDIO_H__
+#define __DRV_TYPES_SDIO_H__
+
+// SDIO Header Files
+#ifdef PLATFORM_LINUX
+ #include <linux/mmc/sdio_func.h>
+ #include <linux/mmc/sdio_ids.h>
+
+#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) || defined(CONFIG_PLATFORM_SPRD)
+ #include <linux/mmc/host.h>
+ #include <linux/mmc/card.h>
+#endif
+
+#ifdef CONFIG_PLATFORM_SPRD
+ #include <linux/gpio.h>
+ #include <custom_gpio.h>
+#endif // CONFIG_PLATFORM_SPRD
+#endif
+
+#ifdef PLATFORM_OS_XP
+#include <wdm.h>
+#include <ntddsd.h>
+#endif
+
+#ifdef PLATFORM_OS_CE
+#include <sdcardddk.h>
+#endif
+
+
+typedef struct sdio_data
+{
+ u8 func_number;
+
+ u8 tx_block_mode;
+ u8 rx_block_mode;
+ u32 block_transfer_len;
+
+#ifdef PLATFORM_LINUX
+ struct sdio_func *func;
+ _thread_hdl_ sys_sdio_irq_thd;
+#endif
+
+#ifdef PLATFORM_OS_XP
+ PDEVICE_OBJECT pphysdevobj;
+ PDEVICE_OBJECT pfuncdevobj;
+ PDEVICE_OBJECT pnextdevobj;
+ SDBUS_INTERFACE_STANDARD sdbusinft;
+ u8 nextdevstacksz;
+#endif
+
+#ifdef PLATFORM_OS_CE
+ SD_DEVICE_HANDLE hDevice;
+ SD_CARD_RCA sd_rca;
+ SD_CARD_INTERFACE card_intf;
+ BOOLEAN enableIsarWithStatus;
+ WCHAR active_path[MAX_ACTIVE_REG_PATH];
+ SD_HOST_BLOCK_CAPABILITY sd_host_blk_cap;
+#endif
+} SDIO_DATA, *PSDIO_DATA;
+
+#endif
+
diff --git a/rtl8xxx_EU/include/hal_com_reg.h b/rtl8xxx_EU/include/hal_com_reg.h
index b29fa34..b29fa34 100644..100755
--- a/rtl8xxx_EU/include/hal_com_reg.h
+++ b/rtl8xxx_EU/include/hal_com_reg.h
diff --git a/rtl8xxx_EU/include/hal_intf.h b/rtl8xxx_EU/include/hal_intf.h
index 4fd09fc..4fd09fc 100644..100755
--- a/rtl8xxx_EU/include/hal_intf.h
+++ b/rtl8xxx_EU/include/hal_intf.h
diff --git a/rtl8xxx_EU/include/hal_pg.h b/rtl8xxx_EU/include/hal_pg.h
index 2019214..bcc1a97 100755
--- a/rtl8xxx_EU/include/hal_pg.h
+++ b/rtl8xxx_EU/include/hal_pg.h
@@ -1,656 +1,656 @@
-/******************************************************************************
- *
- * 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_PG_H__
-#define __HAL_PG_H__
-
-//====================================================
-// EEPROM/Efuse PG Offset for 8192 CE/CU
-//====================================================
-#define EEPROM_VID_92C 0x0A
-#define EEPROM_PID_92C 0x0C
-#define EEPROM_DID_92C 0x0C
-#define EEPROM_SVID_92C 0x0E
-#define EEPROM_SMID_92C 0x10
-#define EEPROM_MAC_ADDR_92C 0x16
-
-#define EEPROM_MAC_ADDR 0x16
-#define EEPROM_TV_OPTION 0x50
-#define EEPROM_SUBCUSTOMER_ID_92C 0x59
-#define EEPROM_CCK_TX_PWR_INX 0x5A
-#define EEPROM_HT40_1S_TX_PWR_INX 0x60
-#define EEPROM_HT40_2S_TX_PWR_INX_DIFF 0x66
-#define EEPROM_HT20_TX_PWR_INX_DIFF 0x69
-#define EEPROM_OFDM_TX_PWR_INX_DIFF 0x6C
-#define EEPROM_HT40_MAX_PWR_OFFSET 0x6F
-#define EEPROM_HT20_MAX_PWR_OFFSET 0x72
-#define EEPROM_CHANNEL_PLAN_92C 0x75
-#define EEPROM_TSSI_A 0x76
-#define EEPROM_TSSI_B 0x77
-#define EEPROM_THERMAL_METER_92C 0x78
-#define EEPROM_RF_OPT1_92C 0x79
-#define EEPROM_RF_OPT2_92C 0x7A
-#define EEPROM_RF_OPT3_92C 0x7B
-#define EEPROM_RF_OPT4_92C 0x7C
-#define EEPROM_VERSION_92C 0x7E
-#define EEPROM_CUSTOMER_ID_92C 0x7F
-
-#define EEPROM_NORMAL_CHANNEL_PLAN 0x75
-#define EEPROM_NORMAL_BoardType_92C EEPROM_RF_OPT1_92C
-#define BOARD_TYPE_NORMAL_MASK 0xE0
-#define BOARD_TYPE_TEST_MASK 0xF
-#define EEPROM_TYPE_ID 0x7E
-
-// PCIe related
-#define EEPROM_PCIE_DEV_CAP_01 0xE0 // Express device capability in PCIe configuration space, i.e., map to offset 0x74
-#define EEPROM_PCIE_DEV_CAP_02 0xE1 // Express device capability in PCIe configuration space, i.e., map to offset 0x75
-
-// EEPROM address for Test chip
-#define EEPROM_TEST_USB_OPT 0x0E
-
-#define EEPROM_EASY_REPLACEMENT 0x50//BIT0 1 for build-in module, 0 for external dongle
-
-//====================================================
-// EEPROM/Efuse PG Offset for 8723AE/8723AU/8723AS
-//====================================================
-#define EEPROM_CCK_TX_PWR_INX_8723A 0x10
-#define EEPROM_HT40_1S_TX_PWR_INX_8723A 0x16
-#define EEPROM_HT20_TX_PWR_INX_DIFF_8723A 0x1C
-#define EEPROM_OFDM_TX_PWR_INX_DIFF_8723A 0x1F
-#define EEPROM_HT40_MAX_PWR_OFFSET_8723A 0x22
-#define EEPROM_HT20_MAX_PWR_OFFSET_8723A 0x25
-
-#define EEPROM_ChannelPlan_8723A 0x28
-#define EEPROM_TSSI_A_8723A 0x29
-#define EEPROM_THERMAL_METER_8723A 0x2A
-#define RF_OPTION1_8723A 0x2B
-#define RF_OPTION2_8723A 0x2C
-#define RF_OPTION3_8723A 0x2D
-#define RF_OPTION4_8723A 0x2E
-#define EEPROM_VERSION_8723A 0x30
-#define EEPROM_CustomID_8723A 0x31
-#define EEPROM_SubCustomID_8723A 0x32
-#define EEPROM_XTAL_K_8723A 0x33
-#define EEPROM_Chipset_8723A 0x34
-
-
-// RTL8723AE
-#define EEPROM_VID_8723AE 0x49
-#define EEPROM_DID_8723AE 0x4B
-#define EEPROM_SVID_8723AE 0x4D
-#define EEPROM_SMID_8723AE 0x4F
-#define EEPROM_MAC_ADDR_8723AE 0x67
-
-//RTL8723AU
-#define EEPROM_MAC_ADDR_8723AU 0xC6
-#define EEPROM_VID_8723AU 0xB7
-#define EEPROM_PID_8723AU 0xB9
-
-// RTL8723AS
-#define EEPROM_MAC_ADDR_8723AS 0xAA
-
-//====================================================
-// EEPROM/Efuse PG Offset for 8192 DE/DU
-//====================================================
-// pcie
-#define RTL8190_EEPROM_ID 0x8129 // 0-1
-#define EEPROM_HPON 0x02 // LDO settings.2-5
-#define EEPROM_CLK 0x06 // Clock settings.6-7
-#define EEPROM_MAC_FUNCTION 0x08 // SE Test mode.8
-
-#define EEPROM_MAC_ADDR_MAC0_92DE 0x55
-#define EEPROM_MAC_ADDR_MAC1_92DE 0x5B
-
-//usb
-#define EEPROM_ENDPOINT_SETTING 0x10
-#define EEPROM_CHIRP_K 0x12 // Changed
-#define EEPROM_USB_PHY 0x13 // Changed
-#define EEPROM_STRING 0x1F
-#define EEPROM_SUBCUSTOMER_ID_92D 0x59
-
-#define EEPROM_MAC_ADDR_MAC0_92DU 0x19
-#define EEPROM_MAC_ADDR_MAC1_92DU 0x5B
-//----------------------------------------------------------------
-// 2.4G band Tx power index setting
-#define EEPROM_CCK_TX_PWR_INX_2G_92D 0x61
-#define EEPROM_HT40_1S_TX_PWR_INX_2G_92D 0x67
-#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_2G_92D 0x6D
-#define EEPROM_HT20_TX_PWR_INX_DIFF_2G_92D 0x70
-#define EEPROM_OFDM_TX_PWR_INX_DIFF_2G_92D 0x73
-#define EEPROM_HT40_MAX_PWR_OFFSET_2G_92D 0x76
-#define EEPROM_HT20_MAX_PWR_OFFSET_2G_92D 0x79
-
-//5GL channel 32-64
-#define EEPROM_HT40_1S_TX_PWR_INX_5GL_92D 0x7C
-#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GL_92D 0x82
-#define EEPROM_HT20_TX_PWR_INX_DIFF_5GL_92D 0x85
-#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GL_92D 0x88
-#define EEPROM_HT40_MAX_PWR_OFFSET_5GL_92D 0x8B
-#define EEPROM_HT20_MAX_PWR_OFFSET_5GL_92D 0x8E
-
-//5GM channel 100-140
-#define EEPROM_HT40_1S_TX_PWR_INX_5GM_92D 0x91
-#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GM_92D 0x97
-#define EEPROM_HT20_TX_PWR_INX_DIFF_5GM_92D 0x9A
-#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GM_92D 0x9D
-#define EEPROM_HT40_MAX_PWR_OFFSET_5GM_92D 0xA0
-#define EEPROM_HT20_MAX_PWR_OFFSET_5GM_92D 0xA3
-
-//5GH channel 149-165
-#define EEPROM_HT40_1S_TX_PWR_INX_5GH_92D 0xA6
-#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GH_92D 0xAC
-#define EEPROM_HT20_TX_PWR_INX_DIFF_5GH_92D 0xAF
-#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GH_92D 0xB2
-#define EEPROM_HT40_MAX_PWR_OFFSET_5GH_92D 0xB5
-#define EEPROM_HT20_MAX_PWR_OFFSET_5GH_92D 0xB8
-
-
-#define EEPROM_CHANNEL_PLAN_92D 0xBB // Map of supported channels.
-#define EEPROM_TEST_CHANNEL_PLAN_92D 0xBB
-#define EEPROM_THERMAL_METER_92D 0xC3 //[4:0]
-#define EEPROM_IQK_DELTA_92D 0xBC
-#define EEPROM_LCK_DELTA_92D 0xBC
-#define EEPROM_XTAL_K_92D 0xBD //[7:5]
-#define EEPROM_TSSI_A_5G_92D 0xBE
-#define EEPROM_TSSI_B_5G_92D 0xBF
-#define EEPROM_TSSI_AB_5G_92D 0xC0
-
-#define EEPROM_RF_OPT1_92D 0xC4
-#define EEPROM_RF_OPT2_92D 0xC5
-#define EEPROM_RF_OPT3_92D 0xC6
-#define EEPROM_RF_OPT4_92D 0xC7
-#define EEPROM_RF_OPT5_92D 0xC8
-#define EEPROM_RF_OPT6_92D 0xC9
-#define EEPROM_RF_OPT7_92D 0xCC
-
-#define EEPROM_NORMAL_BoardType_92D EEPROM_RF_OPT1_92D //[7:5]
-
-#define EEPROM_WIDIPAIRING_ADDR 0xF0
-#define EEPROM_WIDIPAIRING_KEY 0xF6
-
-#define EEPROM_DEF_PART_NO 0x3FD //Byte
-#define EEPROME_CHIP_VERSION_L 0x3FF
-#define EEPROME_CHIP_VERSION_H 0x3FE
-
-//----------------------------------------------------------------
-
-#define EEPROM_VID_92DE 0x28
-#define EEPROM_PID_92DE 0x2A
-#define EEPROM_SVID_92DE 0x2C
-#define EEPROM_SMID_92DE 0x2E
-#define EEPROM_PATHDIV_92D 0xC4
-
-#define EEPROM_BOARD_OPTIONS_92D 0xC4
-#define EEPROM_5G_LNA_GAIN_92D 0xC6
-#define EEPROM_FEATURE_OPTIONS_92D 0xC7
-#define EEPROM_BT_SETTING_92D 0xC8
-
-#define EEPROM_VERSION_92D 0xCA
-#define EEPROM_CUSTOMER_ID_92D 0xCB
-
-#define EEPROM_VID_92DU 0xC
-#define EEPROM_PID_92DU 0xE
-
-//====================================================
-// EEPROM/Efuse PG Offset for 88EE/88EU/88ES
-//====================================================
-#define EEPROM_TX_PWR_INX_88E 0x10
-
-#define EEPROM_ChannelPlan_88E 0xB8
-#define EEPROM_XTAL_88E 0xB9
-#define EEPROM_THERMAL_METER_88E 0xBA
-#define EEPROM_IQK_LCK_88E 0xBB
-
-#define EEPROM_RF_BOARD_OPTION_88E 0xC1
-#define EEPROM_RF_FEATURE_OPTION_88E 0xC2
-#define EEPROM_RF_BT_SETTING_88E 0xC3
-#define EEPROM_VERSION_88E 0xC4
-#define EEPROM_CustomID_88E 0xC5
-#define EEPROM_RF_ANTENNA_OPT_88E 0xC9
-
-// RTL88EE
-#define EEPROM_MAC_ADDR_88EE 0xD0
-#define EEPROM_VID_88EE 0xD6
-#define EEPROM_DID_88EE 0xD8
-#define EEPROM_SVID_88EE 0xDA
-#define EEPROM_SMID_88EE 0xDC
-
-//RTL88EU
-#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_8811AU 0x104
-
-// RTL88ES
-#define EEPROM_MAC_ADDR_88ES 0x11A
-//====================================================
-// EEPROM/Efuse PG Offset for 8192EE/8192EU/8192ES
-//====================================================
-// 0x10 ~ 0x63 = TX power area.
-#define EEPROM_TX_PWR_INX_8192E 0x10
-
-#define EEPROM_ChannelPlan_8192E 0xB8
-#define EEPROM_XTAL_8192E 0xB9
-#define EEPROM_THERMAL_METER_8192E 0xBA
-#define EEPROM_IQK_LCK_8192E 0xBB
-#define EEPROM_2G_5G_PA_TYPE_8192E 0xBC
-#define EEPROM_2G_LNA_TYPE_GAIN_SEL_8192E 0xBD
-#define EEPROM_5G_LNA_TYPE_GAIN_SEL_8192E 0xBF
-
-#define EEPROM_RF_BOARD_OPTION_8192E 0xC1
-#define EEPROM_RF_FEATURE_OPTION_8192E 0xC2
-#define EEPROM_RF_BT_SETTING_8192E 0xC3
-#define EEPROM_VERSION_8192E 0xC4
-#define EEPROM_CustomID_8192E 0xC5
-#define EEPROM_TX_BBSWING_2G_8192E 0xC6
-#define EEPROM_TX_BBSWING_5G_8192E 0xC7
-#define EEPROM_TX_PWR_CALIBRATE_RATE_8192E 0xC8
-#define EEPROM_RF_ANTENNA_OPT_8192E 0xC9
-
-// RTL8192EE
-#define EEPROM_MAC_ADDR_8192EE 0xD0
-#define EEPROM_VID_8192EE 0xD6
-#define EEPROM_DID_8192EE 0xD8
-#define EEPROM_SVID_8192EE 0xDA
-#define EEPROM_SMID_8192EE 0xDC
-
-//RTL8192EU
-#define EEPROM_MAC_ADDR_8192EU 0xD7
-#define EEPROM_VID_8192EU 0xD0
-#define EEPROM_PID_8192EU 0xD2
-#define EEPROM_PA_TYPE_8192EU 0xBC
-#define EEPROM_LNA_TYPE_2G_8192EU 0xBD
-#define EEPROM_LNA_TYPE_5G_8192EU 0xBF
-
-// RTL8192ES
-#define EEPROM_MAC_ADDR_8192ES 0x11B
-//====================================================
-// EEPROM/Efuse PG Offset for 8812AE/8812AU/8812AS
-//====================================================
-// 0x10 ~ 0x63 = TX power area.
-#define EEPROM_USB_MODE_8812 0x08
-#define EEPROM_TX_PWR_INX_8812 0x10
-
-#define EEPROM_ChannelPlan_8812 0xB8
-#define EEPROM_XTAL_8812 0xB9
-#define EEPROM_THERMAL_METER_8812 0xBA
-#define EEPROM_IQK_LCK_8812 0xBB
-#define EEPROM_2G_5G_PA_TYPE_8812 0xBC
-#define EEPROM_2G_LNA_TYPE_GAIN_SEL_8812 0xBD
-#define EEPROM_5G_LNA_TYPE_GAIN_SEL_8812 0xBF
-
-#define EEPROM_RF_BOARD_OPTION_8812 0xC1
-#define EEPROM_RF_FEATURE_OPTION_8812 0xC2
-#define EEPROM_RF_BT_SETTING_8812 0xC3
-#define EEPROM_VERSION_8812 0xC4
-#define EEPROM_CustomID_8812 0xC5
-#define EEPROM_TX_BBSWING_2G_8812 0xC6
-#define EEPROM_TX_BBSWING_5G_8812 0xC7
-#define EEPROM_TX_PWR_CALIBRATE_RATE_8812 0xC8
-#define EEPROM_RF_ANTENNA_OPT_8812 0xC9
-#define EEPROM_RFE_OPTION_8812 0xCA
-
-// RTL8812AE
-#define EEPROM_MAC_ADDR_8812AE 0xD0
-#define EEPROM_VID_8812AE 0xD6
-#define EEPROM_DID_8812AE 0xD8
-#define EEPROM_SVID_8812AE 0xDA
-#define EEPROM_SMID_8812AE 0xDC
-
-//RTL8812AU
-#define EEPROM_MAC_ADDR_8812AU 0xD7
-#define EEPROM_VID_8812AU 0xD0
-#define EEPROM_PID_8812AU 0xD2
-#define EEPROM_PA_TYPE_8812AU 0xBC
-#define EEPROM_LNA_TYPE_2G_8812AU 0xBD
-#define EEPROM_LNA_TYPE_5G_8812AU 0xBF
-
-//====================================================
-// EEPROM/Efuse PG Offset for 8821AE/8821AU/8821AS
-//====================================================
-#define EEPROM_TX_PWR_INX_8821 0x10
-
-#define EEPROM_ChannelPlan_8821 0xB8
-#define EEPROM_XTAL_8821 0xB9
-#define EEPROM_THERMAL_METER_8821 0xBA
-#define EEPROM_IQK_LCK_8821 0xBB
-
-
-#define EEPROM_RF_BOARD_OPTION_8821 0xC1
-#define EEPROM_RF_FEATURE_OPTION_8821 0xC2
-#define EEPROM_RF_BT_SETTING_8821 0xC3
-#define EEPROM_VERSION_8821 0xC4
-#define EEPROM_CustomID_8821 0xC5
-#define EEPROM_RF_ANTENNA_OPT_8821 0xC9
-
-// RTL8821AE
-#define EEPROM_MAC_ADDR_8821AE 0xD0
-#define EEPROM_VID_8821AE 0xD6
-#define EEPROM_DID_8821AE 0xD8
-#define EEPROM_SVID_8821AE 0xDA
-#define EEPROM_SMID_8821AE 0xDC
-
-//RTL8821AU
-#define EEPROM_PA_TYPE_8821AU 0xBC
-#define EEPROM_LNA_TYPE_8821AU 0xBF
-
-// RTL8821AS
-#define EEPROM_MAC_ADDR_8821AS 0x11A
-
-//RTL8821AU
-#define EEPROM_MAC_ADDR_8821AU 0x107
-#define EEPROM_VID_8821AU 0x100
-#define EEPROM_PID_8821AU 0x102
-
-
-//====================================================
-// EEPROM/Efuse PG Offset for 8192 SE/SU
-//====================================================
-#define EEPROM_VID_92SE 0x0A
-#define EEPROM_DID_92SE 0x0C
-#define EEPROM_SVID_92SE 0x0E
-#define EEPROM_SMID_92SE 0x10
-
-#define EEPROM_MAC_ADDR_92S 0x12
-
-#define EEPROM_TSSI_A_92SE 0x74
-#define EEPROM_TSSI_B_92SE 0x75
-
-#define EEPROM_Version_92SE 0x7C
-
-
-#define EEPROM_VID_92SU 0x08
-#define EEPROM_PID_92SU 0x0A
-
-#define EEPROM_Version_92SU 0x50
-#define EEPROM_TSSI_A_92SU 0x6b
-#define EEPROM_TSSI_B_92SU 0x6c
-
-//====================================================
-// EEPROM/Efuse PG Offset for 8723BE/8723BU/8723BS
-//====================================================
-// 0x10 ~ 0x63 = TX power area.
-#define EEPROM_TX_PWR_INX_8723B 0x10
-
-#define EEPROM_ChannelPlan_8723B 0xB8
-#define EEPROM_XTAL_8723B 0xB9
-#define EEPROM_THERMAL_METER_8723B 0xBA
-#define EEPROM_IQK_LCK_8723B 0xBB
-#define EEPROM_2G_5G_PA_TYPE_8723B 0xBC
-#define EEPROM_2G_LNA_TYPE_GAIN_SEL_8723B 0xBD
-#define EEPROM_5G_LNA_TYPE_GAIN_SEL_8723B 0xBF
-
-#define EEPROM_RF_BOARD_OPTION_8723B 0xC1
-#define EEPROM_FEATURE_OPTION_8723B 0xC2
-#define EEPROM_RF_BT_SETTING_8723B 0xC3
-#define EEPROM_VERSION_8723B 0xC4
-#define EEPROM_CustomID_8723B 0xC5
-#define EEPROM_TX_BBSWING_2G_8723B 0xC6
-#define EEPROM_TX_PWR_CALIBRATE_RATE_8723B 0xC8
-#define EEPROM_RF_ANTENNA_OPT_8723B 0xC9
-#define EEPROM_RFE_OPTION_8723B 0xCA
-
-// RTL8723BE
-#define EEPROM_MAC_ADDR_8723BE 0xD0
-#define EEPROM_VID_8723BE 0xD6
-#define EEPROM_DID_8723BE 0xD8
-#define EEPROM_SVID_8723BE 0xDA
-#define EEPROM_SMID_8723BE 0xDC
-
-//RTL8723BU
-#define EEPROM_MAC_ADDR_8723BU 0x107
-#define EEPROM_VID_8723BU 0x100
-#define EEPROM_PID_8723BU 0x102
-#define EEPROM_PA_TYPE_8723BU 0xBC
-#define EEPROM_LNA_TYPE_2G_8723BU 0xBD
-
-//RTL8723BS
-#define EEPROM_MAC_ADDR_8723BS 0x11A
-#define EEPROM_Voltage_ADDR_8723B 0x8
-
-
-//====================================================
-// EEPROM/Efuse Value Type
-//====================================================
-#define EETYPE_TX_PWR 0x0
-//====================================================
-// EEPROM/Efuse Default Value
-//====================================================
-#define EEPROM_CID_DEFAULT 0x0
-#define EEPROM_CID_DEFAULT_EXT 0xFF // Reserved for Realtek
-#define EEPROM_CID_TOSHIBA 0x4
-#define EEPROM_CID_CCX 0x10
-#define EEPROM_CID_QMI 0x0D
-#define EEPROM_CID_WHQL 0xFE
-
-#define EEPROM_CHANNEL_PLAN_FCC 0x0
-#define EEPROM_CHANNEL_PLAN_IC 0x1
-#define EEPROM_CHANNEL_PLAN_ETSI 0x2
-#define EEPROM_CHANNEL_PLAN_SPAIN 0x3
-#define EEPROM_CHANNEL_PLAN_FRANCE 0x4
-#define EEPROM_CHANNEL_PLAN_MKK 0x5
-#define EEPROM_CHANNEL_PLAN_MKK1 0x6
-#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7
-#define EEPROM_CHANNEL_PLAN_TELEC 0x8
-#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9
-#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA
-#define EEPROM_CHANNEL_PLAN_NCC_TAIWAN 0xB
-#define EEPROM_CHANNEL_PLAN_CHIAN 0XC
-#define EEPROM_CHANNEL_PLAN_SINGAPORE_INDIA_MEXICO 0XD
-#define EEPROM_CHANNEL_PLAN_KOREA 0xE
-#define EEPROM_CHANNEL_PLAN_TURKEY 0xF
-#define EEPROM_CHANNEL_PLAN_JAPAN 0x10
-#define EEPROM_CHANNEL_PLAN_FCC_NO_DFS 0x11
-#define EEPROM_CHANNEL_PLAN_JAPAN_NO_DFS 0x12
-#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_5G 0x13
-#define EEPROM_CHANNEL_PLAN_TAIWAN_NO_DFS 0x14
-
-#define EEPROM_USB_OPTIONAL1 0xE
-#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80
-
-#define RTL_EEPROM_ID 0x8129
-#define EEPROM_Default_TSSI 0x0
-#define EEPROM_Default_BoardType 0x02
-#define EEPROM_Default_ThermalMeter 0x12
-#define EEPROM_Default_ThermalMeter_92SU 0x7
-#define EEPROM_Default_ThermalMeter_88E 0x18
-#define EEPROM_Default_ThermalMeter_8812 0x18
-#define EEPROM_Default_ThermalMeter_8192E 0x1A
-#define EEPROM_Default_ThermalMeter_8723B 0x18
-
-
-#define EEPROM_Default_CrystalCap 0x0
-#define EEPROM_Default_CrystalCap_8723A 0x20
-#define EEPROM_Default_CrystalCap_88E 0x20
-#define EEPROM_Default_CrystalCap_8812 0x20
-#define EEPROM_Default_CrystalCap_8192E 0x20
-#define EEPROM_Default_CrystalCap_8723B 0x20
-#define EEPROM_Default_CrystalFreq 0x0
-#define EEPROM_Default_TxPowerLevel_92C 0x22
-#define EEPROM_Default_TxPowerLevel_2G 0x2C
-#define EEPROM_Default_TxPowerLevel_5G 0x22
-#define EEPROM_Default_TxPowerLevel 0x22
-#define EEPROM_Default_HT40_2SDiff 0x0
-#define EEPROM_Default_HT20_Diff 2
-#define EEPROM_Default_LegacyHTTxPowerDiff 0x3
-#define EEPROM_Default_LegacyHTTxPowerDiff_92C 0x3
-#define EEPROM_Default_LegacyHTTxPowerDiff_92D 0x4
-#define EEPROM_Default_HT40_PwrMaxOffset 0
-#define EEPROM_Default_HT20_PwrMaxOffset 0
-
-#define EEPROM_Default_PID 0x1234
-#define EEPROM_Default_VID 0x5678
-#define EEPROM_Default_CustomerID 0xAB
-#define EEPROM_Default_CustomerID_8188E 0x00
-#define EEPROM_Default_SubCustomerID 0xCD
-#define EEPROM_Default_Version 0
-
-#define EEPROM_Default_externalPA_C9 0x00
-#define EEPROM_Default_externalPA_CC 0xFF
-#define EEPROM_Default_internalPA_SP3T_C9 0xAA
-#define EEPROM_Default_internalPA_SP3T_CC 0xAF
-#define EEPROM_Default_internalPA_SPDT_C9 0xAA
-#ifdef CONFIG_PCI_HCI
-#define EEPROM_Default_internalPA_SPDT_CC 0xA0
-#else
-#define EEPROM_Default_internalPA_SPDT_CC 0xFA
-#endif
-#define EEPROM_Default_PAType 0
-#define EEPROM_Default_LNAType 0
-
-//New EFUSE deafult value
-#define EEPROM_DEFAULT_24G_INDEX 0x2D
-#define EEPROM_DEFAULT_24G_HT20_DIFF 0X02
-#define EEPROM_DEFAULT_24G_OFDM_DIFF 0X04
-
-#define EEPROM_DEFAULT_5G_INDEX 0X2A
-#define EEPROM_DEFAULT_5G_HT20_DIFF 0X00
-#define EEPROM_DEFAULT_5G_OFDM_DIFF 0X04
-
-#define EEPROM_DEFAULT_DIFF 0XFE
-#define EEPROM_DEFAULT_CHANNEL_PLAN 0x7F
-#define EEPROM_DEFAULT_BOARD_OPTION 0x00
-#define EEPROM_DEFAULT_RFE_OPTION 0x04
-#define EEPROM_DEFAULT_FEATURE_OPTION 0x00
-#define EEPROM_DEFAULT_BT_OPTION 0x10
-
-
-#define EEPROM_DEFAULT_TX_CALIBRATE_RATE 0x00
-
-//
-// For VHT series TX power by rate table.
-// VHT TX power by rate off setArray =
-// Band:-2G&5G = 0 / 1
-// RF: at most 4*4 = ABCD=0/1/2/3
-// CCK=0 OFDM=1/2 HT-MCS 0-15=3/4/56 VHT=7/8/9/10/11
-//
-#define TX_PWR_BY_RATE_NUM_BAND 2
-#define TX_PWR_BY_RATE_NUM_RF 4
-#define TX_PWR_BY_RATE_NUM_RATE 84
-
-#define TXPWR_LMT_MAX_RF 4
-
-//----------------------------------------------------------------------------
-// EEPROM/EFUSE data structure definition.
-//----------------------------------------------------------------------------
-#define MAX_RF_PATH_NUM 2
-#define MAX_CHNL_GROUP 3+9
-typedef struct _TxPowerInfo{
- u8 CCKIndex[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
- u8 HT40_1SIndex[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
- u8 HT40_2SIndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
- s8 HT20IndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
- u8 OFDMIndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
- u8 HT40MaxOffset[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
- u8 HT20MaxOffset[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
- u8 TSSI_A[3];
- u8 TSSI_B[3];
- u8 TSSI_A_5G[3]; //5GL/5GM/5GH
- u8 TSSI_B_5G[3];
-}TxPowerInfo, *PTxPowerInfo;
-
-
-//For 88E new structure
-
-/*
-2.4G:
-{
-{1,2},
-{3,4,5},
-{6,7,8},
-{9,10,11},
-{12,13},
-{14}
-}
-
-5G:
-{
-{36,38,40},
-{44,46,48},
-{52,54,56},
-{60,62,64},
-{100,102,104},
-{108,110,112},
-{116,118,120},
-{124,126,128},
-{132,134,136},
-{140,142,144},
-{149,151,153},
-{157,159,161},
-{173,175,177},
-}
-*/
-#define MAX_RF_PATH 4
-#define RF_PATH_MAX MAX_RF_PATH
-#define MAX_CHNL_GROUP_24G 6
-#define MAX_CHNL_GROUP_5G 14
-
-//It must always set to 4, otherwise read efuse table secquence will be wrong.
-#define MAX_TX_COUNT 4
-
-typedef struct _TxPowerInfo24G{
- u8 IndexCCK_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G];
- u8 IndexBW40_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G];
- //If only one tx, only BW20 and OFDM are used.
- s8 CCK_Diff[MAX_RF_PATH][MAX_TX_COUNT];
- s8 OFDM_Diff[MAX_RF_PATH][MAX_TX_COUNT];
- s8 BW20_Diff[MAX_RF_PATH][MAX_TX_COUNT];
- s8 BW40_Diff[MAX_RF_PATH][MAX_TX_COUNT];
-}TxPowerInfo24G, *PTxPowerInfo24G;
-
-typedef struct _TxPowerInfo5G{
- u8 IndexBW40_Base[MAX_RF_PATH][MAX_CHNL_GROUP_5G];
- //If only one tx, only BW20, OFDM, BW80 and BW160 are used.
- s8 OFDM_Diff[MAX_RF_PATH][MAX_TX_COUNT];
- s8 BW20_Diff[MAX_RF_PATH][MAX_TX_COUNT];
- s8 BW40_Diff[MAX_RF_PATH][MAX_TX_COUNT];
- s8 BW80_Diff[MAX_RF_PATH][MAX_TX_COUNT];
- s8 BW160_Diff[MAX_RF_PATH][MAX_TX_COUNT];
-}TxPowerInfo5G, *PTxPowerInfo5G;
-
-
-typedef enum _BT_Ant_NUM{
- Ant_x2 = 0,
- Ant_x1 = 1
-} BT_Ant_NUM, *PBT_Ant_NUM;
-
-typedef enum _BT_CoType{
- BT_2WIRE = 0,
- BT_ISSC_3WIRE = 1,
- BT_ACCEL = 2,
- BT_CSR_BC4 = 3,
- BT_CSR_BC8 = 4,
- BT_RTL8756 = 5,
- BT_RTL8723A = 6,
- BT_RTL8821 = 7,
- BT_RTL8723B = 8,
- BT_RTL8192E = 9,
- BT_RTL8813A = 10,
- BT_RTL8812A = 11
-} BT_CoType, *PBT_CoType;
-
-typedef enum _BT_RadioShared{
- BT_Radio_Shared = 0,
- BT_Radio_Individual = 1,
-} BT_RadioShared, *PBT_RadioShared;
-
-
-#endif
+/******************************************************************************
+ *
+ * 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_PG_H__
+#define __HAL_PG_H__
+
+//====================================================
+// EEPROM/Efuse PG Offset for 8192 CE/CU
+//====================================================
+#define EEPROM_VID_92C 0x0A
+#define EEPROM_PID_92C 0x0C
+#define EEPROM_DID_92C 0x0C
+#define EEPROM_SVID_92C 0x0E
+#define EEPROM_SMID_92C 0x10
+#define EEPROM_MAC_ADDR_92C 0x16
+
+#define EEPROM_MAC_ADDR 0x16
+#define EEPROM_TV_OPTION 0x50
+#define EEPROM_SUBCUSTOMER_ID_92C 0x59
+#define EEPROM_CCK_TX_PWR_INX 0x5A
+#define EEPROM_HT40_1S_TX_PWR_INX 0x60
+#define EEPROM_HT40_2S_TX_PWR_INX_DIFF 0x66
+#define EEPROM_HT20_TX_PWR_INX_DIFF 0x69
+#define EEPROM_OFDM_TX_PWR_INX_DIFF 0x6C
+#define EEPROM_HT40_MAX_PWR_OFFSET 0x6F
+#define EEPROM_HT20_MAX_PWR_OFFSET 0x72
+#define EEPROM_CHANNEL_PLAN_92C 0x75
+#define EEPROM_TSSI_A 0x76
+#define EEPROM_TSSI_B 0x77
+#define EEPROM_THERMAL_METER_92C 0x78
+#define EEPROM_RF_OPT1_92C 0x79
+#define EEPROM_RF_OPT2_92C 0x7A
+#define EEPROM_RF_OPT3_92C 0x7B
+#define EEPROM_RF_OPT4_92C 0x7C
+#define EEPROM_VERSION_92C 0x7E
+#define EEPROM_CUSTOMER_ID_92C 0x7F
+
+#define EEPROM_NORMAL_CHANNEL_PLAN 0x75
+#define EEPROM_NORMAL_BoardType_92C EEPROM_RF_OPT1_92C
+#define BOARD_TYPE_NORMAL_MASK 0xE0
+#define BOARD_TYPE_TEST_MASK 0xF
+#define EEPROM_TYPE_ID 0x7E
+
+// PCIe related
+#define EEPROM_PCIE_DEV_CAP_01 0xE0 // Express device capability in PCIe configuration space, i.e., map to offset 0x74
+#define EEPROM_PCIE_DEV_CAP_02 0xE1 // Express device capability in PCIe configuration space, i.e., map to offset 0x75
+
+// EEPROM address for Test chip
+#define EEPROM_TEST_USB_OPT 0x0E
+
+#define EEPROM_EASY_REPLACEMENT 0x50//BIT0 1 for build-in module, 0 for external dongle
+
+//====================================================
+// EEPROM/Efuse PG Offset for 8723AE/8723AU/8723AS
+//====================================================
+#define EEPROM_CCK_TX_PWR_INX_8723A 0x10
+#define EEPROM_HT40_1S_TX_PWR_INX_8723A 0x16
+#define EEPROM_HT20_TX_PWR_INX_DIFF_8723A 0x1C
+#define EEPROM_OFDM_TX_PWR_INX_DIFF_8723A 0x1F
+#define EEPROM_HT40_MAX_PWR_OFFSET_8723A 0x22
+#define EEPROM_HT20_MAX_PWR_OFFSET_8723A 0x25
+
+#define EEPROM_ChannelPlan_8723A 0x28
+#define EEPROM_TSSI_A_8723A 0x29
+#define EEPROM_THERMAL_METER_8723A 0x2A
+#define RF_OPTION1_8723A 0x2B
+#define RF_OPTION2_8723A 0x2C
+#define RF_OPTION3_8723A 0x2D
+#define RF_OPTION4_8723A 0x2E
+#define EEPROM_VERSION_8723A 0x30
+#define EEPROM_CustomID_8723A 0x31
+#define EEPROM_SubCustomID_8723A 0x32
+#define EEPROM_XTAL_K_8723A 0x33
+#define EEPROM_Chipset_8723A 0x34
+
+
+// RTL8723AE
+#define EEPROM_VID_8723AE 0x49
+#define EEPROM_DID_8723AE 0x4B
+#define EEPROM_SVID_8723AE 0x4D
+#define EEPROM_SMID_8723AE 0x4F
+#define EEPROM_MAC_ADDR_8723AE 0x67
+
+//RTL8723AU
+#define EEPROM_MAC_ADDR_8723AU 0xC6
+#define EEPROM_VID_8723AU 0xB7
+#define EEPROM_PID_8723AU 0xB9
+
+// RTL8723AS
+#define EEPROM_MAC_ADDR_8723AS 0xAA
+
+//====================================================
+// EEPROM/Efuse PG Offset for 8192 DE/DU
+//====================================================
+// pcie
+#define RTL8190_EEPROM_ID 0x8129 // 0-1
+#define EEPROM_HPON 0x02 // LDO settings.2-5
+#define EEPROM_CLK 0x06 // Clock settings.6-7
+#define EEPROM_MAC_FUNCTION 0x08 // SE Test mode.8
+
+#define EEPROM_MAC_ADDR_MAC0_92DE 0x55
+#define EEPROM_MAC_ADDR_MAC1_92DE 0x5B
+
+//usb
+#define EEPROM_ENDPOINT_SETTING 0x10
+#define EEPROM_CHIRP_K 0x12 // Changed
+#define EEPROM_USB_PHY 0x13 // Changed
+#define EEPROM_STRING 0x1F
+#define EEPROM_SUBCUSTOMER_ID_92D 0x59
+
+#define EEPROM_MAC_ADDR_MAC0_92DU 0x19
+#define EEPROM_MAC_ADDR_MAC1_92DU 0x5B
+//----------------------------------------------------------------
+// 2.4G band Tx power index setting
+#define EEPROM_CCK_TX_PWR_INX_2G_92D 0x61
+#define EEPROM_HT40_1S_TX_PWR_INX_2G_92D 0x67
+#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_2G_92D 0x6D
+#define EEPROM_HT20_TX_PWR_INX_DIFF_2G_92D 0x70
+#define EEPROM_OFDM_TX_PWR_INX_DIFF_2G_92D 0x73
+#define EEPROM_HT40_MAX_PWR_OFFSET_2G_92D 0x76
+#define EEPROM_HT20_MAX_PWR_OFFSET_2G_92D 0x79
+
+//5GL channel 32-64
+#define EEPROM_HT40_1S_TX_PWR_INX_5GL_92D 0x7C
+#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GL_92D 0x82
+#define EEPROM_HT20_TX_PWR_INX_DIFF_5GL_92D 0x85
+#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GL_92D 0x88
+#define EEPROM_HT40_MAX_PWR_OFFSET_5GL_92D 0x8B
+#define EEPROM_HT20_MAX_PWR_OFFSET_5GL_92D 0x8E
+
+//5GM channel 100-140
+#define EEPROM_HT40_1S_TX_PWR_INX_5GM_92D 0x91
+#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GM_92D 0x97
+#define EEPROM_HT20_TX_PWR_INX_DIFF_5GM_92D 0x9A
+#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GM_92D 0x9D
+#define EEPROM_HT40_MAX_PWR_OFFSET_5GM_92D 0xA0
+#define EEPROM_HT20_MAX_PWR_OFFSET_5GM_92D 0xA3
+
+//5GH channel 149-165
+#define EEPROM_HT40_1S_TX_PWR_INX_5GH_92D 0xA6
+#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GH_92D 0xAC
+#define EEPROM_HT20_TX_PWR_INX_DIFF_5GH_92D 0xAF
+#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GH_92D 0xB2
+#define EEPROM_HT40_MAX_PWR_OFFSET_5GH_92D 0xB5
+#define EEPROM_HT20_MAX_PWR_OFFSET_5GH_92D 0xB8
+
+
+#define EEPROM_CHANNEL_PLAN_92D 0xBB // Map of supported channels.
+#define EEPROM_TEST_CHANNEL_PLAN_92D 0xBB
+#define EEPROM_THERMAL_METER_92D 0xC3 //[4:0]
+#define EEPROM_IQK_DELTA_92D 0xBC
+#define EEPROM_LCK_DELTA_92D 0xBC
+#define EEPROM_XTAL_K_92D 0xBD //[7:5]
+#define EEPROM_TSSI_A_5G_92D 0xBE
+#define EEPROM_TSSI_B_5G_92D 0xBF
+#define EEPROM_TSSI_AB_5G_92D 0xC0
+
+#define EEPROM_RF_OPT1_92D 0xC4
+#define EEPROM_RF_OPT2_92D 0xC5
+#define EEPROM_RF_OPT3_92D 0xC6
+#define EEPROM_RF_OPT4_92D 0xC7
+#define EEPROM_RF_OPT5_92D 0xC8
+#define EEPROM_RF_OPT6_92D 0xC9
+#define EEPROM_RF_OPT7_92D 0xCC
+
+#define EEPROM_NORMAL_BoardType_92D EEPROM_RF_OPT1_92D //[7:5]
+
+#define EEPROM_WIDIPAIRING_ADDR 0xF0
+#define EEPROM_WIDIPAIRING_KEY 0xF6
+
+#define EEPROM_DEF_PART_NO 0x3FD //Byte
+#define EEPROME_CHIP_VERSION_L 0x3FF
+#define EEPROME_CHIP_VERSION_H 0x3FE
+
+//----------------------------------------------------------------
+
+#define EEPROM_VID_92DE 0x28
+#define EEPROM_PID_92DE 0x2A
+#define EEPROM_SVID_92DE 0x2C
+#define EEPROM_SMID_92DE 0x2E
+#define EEPROM_PATHDIV_92D 0xC4
+
+#define EEPROM_BOARD_OPTIONS_92D 0xC4
+#define EEPROM_5G_LNA_GAIN_92D 0xC6
+#define EEPROM_FEATURE_OPTIONS_92D 0xC7
+#define EEPROM_BT_SETTING_92D 0xC8
+
+#define EEPROM_VERSION_92D 0xCA
+#define EEPROM_CUSTOMER_ID_92D 0xCB
+
+#define EEPROM_VID_92DU 0xC
+#define EEPROM_PID_92DU 0xE
+
+//====================================================
+// EEPROM/Efuse PG Offset for 88EE/88EU/88ES
+//====================================================
+#define EEPROM_TX_PWR_INX_88E 0x10
+
+#define EEPROM_ChannelPlan_88E 0xB8
+#define EEPROM_XTAL_88E 0xB9
+#define EEPROM_THERMAL_METER_88E 0xBA
+#define EEPROM_IQK_LCK_88E 0xBB
+
+#define EEPROM_RF_BOARD_OPTION_88E 0xC1
+#define EEPROM_RF_FEATURE_OPTION_88E 0xC2
+#define EEPROM_RF_BT_SETTING_88E 0xC3
+#define EEPROM_VERSION_88E 0xC4
+#define EEPROM_CustomID_88E 0xC5
+#define EEPROM_RF_ANTENNA_OPT_88E 0xC9
+
+// RTL88EE
+#define EEPROM_MAC_ADDR_88EE 0xD0
+#define EEPROM_VID_88EE 0xD6
+#define EEPROM_DID_88EE 0xD8
+#define EEPROM_SVID_88EE 0xDA
+#define EEPROM_SMID_88EE 0xDC
+
+//RTL88EU
+#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_8811AU 0x104
+
+// RTL88ES
+#define EEPROM_MAC_ADDR_88ES 0x11A
+//====================================================
+// EEPROM/Efuse PG Offset for 8192EE/8192EU/8192ES
+//====================================================
+// 0x10 ~ 0x63 = TX power area.
+#define EEPROM_TX_PWR_INX_8192E 0x10
+
+#define EEPROM_ChannelPlan_8192E 0xB8
+#define EEPROM_XTAL_8192E 0xB9
+#define EEPROM_THERMAL_METER_8192E 0xBA
+#define EEPROM_IQK_LCK_8192E 0xBB
+#define EEPROM_2G_5G_PA_TYPE_8192E 0xBC
+#define EEPROM_2G_LNA_TYPE_GAIN_SEL_8192E 0xBD
+#define EEPROM_5G_LNA_TYPE_GAIN_SEL_8192E 0xBF
+
+#define EEPROM_RF_BOARD_OPTION_8192E 0xC1
+#define EEPROM_RF_FEATURE_OPTION_8192E 0xC2
+#define EEPROM_RF_BT_SETTING_8192E 0xC3
+#define EEPROM_VERSION_8192E 0xC4
+#define EEPROM_CustomID_8192E 0xC5
+#define EEPROM_TX_BBSWING_2G_8192E 0xC6
+#define EEPROM_TX_BBSWING_5G_8192E 0xC7
+#define EEPROM_TX_PWR_CALIBRATE_RATE_8192E 0xC8
+#define EEPROM_RF_ANTENNA_OPT_8192E 0xC9
+
+// RTL8192EE
+#define EEPROM_MAC_ADDR_8192EE 0xD0
+#define EEPROM_VID_8192EE 0xD6
+#define EEPROM_DID_8192EE 0xD8
+#define EEPROM_SVID_8192EE 0xDA
+#define EEPROM_SMID_8192EE 0xDC
+
+//RTL8192EU
+#define EEPROM_MAC_ADDR_8192EU 0xD7
+#define EEPROM_VID_8192EU 0xD0
+#define EEPROM_PID_8192EU 0xD2
+#define EEPROM_PA_TYPE_8192EU 0xBC
+#define EEPROM_LNA_TYPE_2G_8192EU 0xBD
+#define EEPROM_LNA_TYPE_5G_8192EU 0xBF
+
+// RTL8192ES
+#define EEPROM_MAC_ADDR_8192ES 0x11B
+//====================================================
+// EEPROM/Efuse PG Offset for 8812AE/8812AU/8812AS
+//====================================================
+// 0x10 ~ 0x63 = TX power area.
+#define EEPROM_USB_MODE_8812 0x08
+#define EEPROM_TX_PWR_INX_8812 0x10
+
+#define EEPROM_ChannelPlan_8812 0xB8
+#define EEPROM_XTAL_8812 0xB9
+#define EEPROM_THERMAL_METER_8812 0xBA
+#define EEPROM_IQK_LCK_8812 0xBB
+#define EEPROM_2G_5G_PA_TYPE_8812 0xBC
+#define EEPROM_2G_LNA_TYPE_GAIN_SEL_8812 0xBD
+#define EEPROM_5G_LNA_TYPE_GAIN_SEL_8812 0xBF
+
+#define EEPROM_RF_BOARD_OPTION_8812 0xC1
+#define EEPROM_RF_FEATURE_OPTION_8812 0xC2
+#define EEPROM_RF_BT_SETTING_8812 0xC3
+#define EEPROM_VERSION_8812 0xC4
+#define EEPROM_CustomID_8812 0xC5
+#define EEPROM_TX_BBSWING_2G_8812 0xC6
+#define EEPROM_TX_BBSWING_5G_8812 0xC7
+#define EEPROM_TX_PWR_CALIBRATE_RATE_8812 0xC8
+#define EEPROM_RF_ANTENNA_OPT_8812 0xC9
+#define EEPROM_RFE_OPTION_8812 0xCA
+
+// RTL8812AE
+#define EEPROM_MAC_ADDR_8812AE 0xD0
+#define EEPROM_VID_8812AE 0xD6
+#define EEPROM_DID_8812AE 0xD8
+#define EEPROM_SVID_8812AE 0xDA
+#define EEPROM_SMID_8812AE 0xDC
+
+//RTL8812AU
+#define EEPROM_MAC_ADDR_8812AU 0xD7
+#define EEPROM_VID_8812AU 0xD0
+#define EEPROM_PID_8812AU 0xD2
+#define EEPROM_PA_TYPE_8812AU 0xBC
+#define EEPROM_LNA_TYPE_2G_8812AU 0xBD
+#define EEPROM_LNA_TYPE_5G_8812AU 0xBF
+
+//====================================================
+// EEPROM/Efuse PG Offset for 8821AE/8821AU/8821AS
+//====================================================
+#define EEPROM_TX_PWR_INX_8821 0x10
+
+#define EEPROM_ChannelPlan_8821 0xB8
+#define EEPROM_XTAL_8821 0xB9
+#define EEPROM_THERMAL_METER_8821 0xBA
+#define EEPROM_IQK_LCK_8821 0xBB
+
+
+#define EEPROM_RF_BOARD_OPTION_8821 0xC1
+#define EEPROM_RF_FEATURE_OPTION_8821 0xC2
+#define EEPROM_RF_BT_SETTING_8821 0xC3
+#define EEPROM_VERSION_8821 0xC4
+#define EEPROM_CustomID_8821 0xC5
+#define EEPROM_RF_ANTENNA_OPT_8821 0xC9
+
+// RTL8821AE
+#define EEPROM_MAC_ADDR_8821AE 0xD0
+#define EEPROM_VID_8821AE 0xD6
+#define EEPROM_DID_8821AE 0xD8
+#define EEPROM_SVID_8821AE 0xDA
+#define EEPROM_SMID_8821AE 0xDC
+
+//RTL8821AU
+#define EEPROM_PA_TYPE_8821AU 0xBC
+#define EEPROM_LNA_TYPE_8821AU 0xBF
+
+// RTL8821AS
+#define EEPROM_MAC_ADDR_8821AS 0x11A
+
+//RTL8821AU
+#define EEPROM_MAC_ADDR_8821AU 0x107
+#define EEPROM_VID_8821AU 0x100
+#define EEPROM_PID_8821AU 0x102
+
+
+//====================================================
+// EEPROM/Efuse PG Offset for 8192 SE/SU
+//====================================================
+#define EEPROM_VID_92SE 0x0A
+#define EEPROM_DID_92SE 0x0C
+#define EEPROM_SVID_92SE 0x0E
+#define EEPROM_SMID_92SE 0x10
+
+#define EEPROM_MAC_ADDR_92S 0x12
+
+#define EEPROM_TSSI_A_92SE 0x74
+#define EEPROM_TSSI_B_92SE 0x75
+
+#define EEPROM_Version_92SE 0x7C
+
+
+#define EEPROM_VID_92SU 0x08
+#define EEPROM_PID_92SU 0x0A
+
+#define EEPROM_Version_92SU 0x50
+#define EEPROM_TSSI_A_92SU 0x6b
+#define EEPROM_TSSI_B_92SU 0x6c
+
+//====================================================
+// EEPROM/Efuse PG Offset for 8723BE/8723BU/8723BS
+//====================================================
+// 0x10 ~ 0x63 = TX power area.
+#define EEPROM_TX_PWR_INX_8723B 0x10
+
+#define EEPROM_ChannelPlan_8723B 0xB8
+#define EEPROM_XTAL_8723B 0xB9
+#define EEPROM_THERMAL_METER_8723B 0xBA
+#define EEPROM_IQK_LCK_8723B 0xBB
+#define EEPROM_2G_5G_PA_TYPE_8723B 0xBC
+#define EEPROM_2G_LNA_TYPE_GAIN_SEL_8723B 0xBD
+#define EEPROM_5G_LNA_TYPE_GAIN_SEL_8723B 0xBF
+
+#define EEPROM_RF_BOARD_OPTION_8723B 0xC1
+#define EEPROM_FEATURE_OPTION_8723B 0xC2
+#define EEPROM_RF_BT_SETTING_8723B 0xC3
+#define EEPROM_VERSION_8723B 0xC4
+#define EEPROM_CustomID_8723B 0xC5
+#define EEPROM_TX_BBSWING_2G_8723B 0xC6
+#define EEPROM_TX_PWR_CALIBRATE_RATE_8723B 0xC8
+#define EEPROM_RF_ANTENNA_OPT_8723B 0xC9
+#define EEPROM_RFE_OPTION_8723B 0xCA
+
+// RTL8723BE
+#define EEPROM_MAC_ADDR_8723BE 0xD0
+#define EEPROM_VID_8723BE 0xD6
+#define EEPROM_DID_8723BE 0xD8
+#define EEPROM_SVID_8723BE 0xDA
+#define EEPROM_SMID_8723BE 0xDC
+
+//RTL8723BU
+#define EEPROM_MAC_ADDR_8723BU 0x107
+#define EEPROM_VID_8723BU 0x100
+#define EEPROM_PID_8723BU 0x102
+#define EEPROM_PA_TYPE_8723BU 0xBC
+#define EEPROM_LNA_TYPE_2G_8723BU 0xBD
+
+//RTL8723BS
+#define EEPROM_MAC_ADDR_8723BS 0x11A
+#define EEPROM_Voltage_ADDR_8723B 0x8
+
+
+//====================================================
+// EEPROM/Efuse Value Type
+//====================================================
+#define EETYPE_TX_PWR 0x0
+//====================================================
+// EEPROM/Efuse Default Value
+//====================================================
+#define EEPROM_CID_DEFAULT 0x0
+#define EEPROM_CID_DEFAULT_EXT 0xFF // Reserved for Realtek
+#define EEPROM_CID_TOSHIBA 0x4
+#define EEPROM_CID_CCX 0x10
+#define EEPROM_CID_QMI 0x0D
+#define EEPROM_CID_WHQL 0xFE
+
+#define EEPROM_CHANNEL_PLAN_FCC 0x0
+#define EEPROM_CHANNEL_PLAN_IC 0x1
+#define EEPROM_CHANNEL_PLAN_ETSI 0x2
+#define EEPROM_CHANNEL_PLAN_SPAIN 0x3
+#define EEPROM_CHANNEL_PLAN_FRANCE 0x4
+#define EEPROM_CHANNEL_PLAN_MKK 0x5
+#define EEPROM_CHANNEL_PLAN_MKK1 0x6
+#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7
+#define EEPROM_CHANNEL_PLAN_TELEC 0x8
+#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9
+#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA
+#define EEPROM_CHANNEL_PLAN_NCC_TAIWAN 0xB
+#define EEPROM_CHANNEL_PLAN_CHIAN 0XC
+#define EEPROM_CHANNEL_PLAN_SINGAPORE_INDIA_MEXICO 0XD
+#define EEPROM_CHANNEL_PLAN_KOREA 0xE
+#define EEPROM_CHANNEL_PLAN_TURKEY 0xF
+#define EEPROM_CHANNEL_PLAN_JAPAN 0x10
+#define EEPROM_CHANNEL_PLAN_FCC_NO_DFS 0x11
+#define EEPROM_CHANNEL_PLAN_JAPAN_NO_DFS 0x12
+#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_5G 0x13
+#define EEPROM_CHANNEL_PLAN_TAIWAN_NO_DFS 0x14
+
+#define EEPROM_USB_OPTIONAL1 0xE
+#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80
+
+#define RTL_EEPROM_ID 0x8129
+#define EEPROM_Default_TSSI 0x0
+#define EEPROM_Default_BoardType 0x02
+#define EEPROM_Default_ThermalMeter 0x12
+#define EEPROM_Default_ThermalMeter_92SU 0x7
+#define EEPROM_Default_ThermalMeter_88E 0x18
+#define EEPROM_Default_ThermalMeter_8812 0x18
+#define EEPROM_Default_ThermalMeter_8192E 0x1A
+#define EEPROM_Default_ThermalMeter_8723B 0x18
+
+
+#define EEPROM_Default_CrystalCap 0x0
+#define EEPROM_Default_CrystalCap_8723A 0x20
+#define EEPROM_Default_CrystalCap_88E 0x20
+#define EEPROM_Default_CrystalCap_8812 0x20
+#define EEPROM_Default_CrystalCap_8192E 0x20
+#define EEPROM_Default_CrystalCap_8723B 0x20
+#define EEPROM_Default_CrystalFreq 0x0
+#define EEPROM_Default_TxPowerLevel_92C 0x22
+#define EEPROM_Default_TxPowerLevel_2G 0x2C
+#define EEPROM_Default_TxPowerLevel_5G 0x22
+#define EEPROM_Default_TxPowerLevel 0x22
+#define EEPROM_Default_HT40_2SDiff 0x0
+#define EEPROM_Default_HT20_Diff 2
+#define EEPROM_Default_LegacyHTTxPowerDiff 0x3
+#define EEPROM_Default_LegacyHTTxPowerDiff_92C 0x3
+#define EEPROM_Default_LegacyHTTxPowerDiff_92D 0x4
+#define EEPROM_Default_HT40_PwrMaxOffset 0
+#define EEPROM_Default_HT20_PwrMaxOffset 0
+
+#define EEPROM_Default_PID 0x1234
+#define EEPROM_Default_VID 0x5678
+#define EEPROM_Default_CustomerID 0xAB
+#define EEPROM_Default_CustomerID_8188E 0x00
+#define EEPROM_Default_SubCustomerID 0xCD
+#define EEPROM_Default_Version 0
+
+#define EEPROM_Default_externalPA_C9 0x00
+#define EEPROM_Default_externalPA_CC 0xFF
+#define EEPROM_Default_internalPA_SP3T_C9 0xAA
+#define EEPROM_Default_internalPA_SP3T_CC 0xAF
+#define EEPROM_Default_internalPA_SPDT_C9 0xAA
+#ifdef CONFIG_PCI_HCI
+#define EEPROM_Default_internalPA_SPDT_CC 0xA0
+#else
+#define EEPROM_Default_internalPA_SPDT_CC 0xFA
+#endif
+#define EEPROM_Default_PAType 0
+#define EEPROM_Default_LNAType 0
+
+//New EFUSE deafult value
+#define EEPROM_DEFAULT_24G_INDEX 0x2D
+#define EEPROM_DEFAULT_24G_HT20_DIFF 0X02
+#define EEPROM_DEFAULT_24G_OFDM_DIFF 0X04
+
+#define EEPROM_DEFAULT_5G_INDEX 0X2A
+#define EEPROM_DEFAULT_5G_HT20_DIFF 0X00
+#define EEPROM_DEFAULT_5G_OFDM_DIFF 0X04
+
+#define EEPROM_DEFAULT_DIFF 0XFE
+#define EEPROM_DEFAULT_CHANNEL_PLAN 0x7F
+#define EEPROM_DEFAULT_BOARD_OPTION 0x00
+#define EEPROM_DEFAULT_RFE_OPTION 0x04
+#define EEPROM_DEFAULT_FEATURE_OPTION 0x00
+#define EEPROM_DEFAULT_BT_OPTION 0x10
+
+
+#define EEPROM_DEFAULT_TX_CALIBRATE_RATE 0x00
+
+//
+// For VHT series TX power by rate table.
+// VHT TX power by rate off setArray =
+// Band:-2G&5G = 0 / 1
+// RF: at most 4*4 = ABCD=0/1/2/3
+// CCK=0 OFDM=1/2 HT-MCS 0-15=3/4/56 VHT=7/8/9/10/11
+//
+#define TX_PWR_BY_RATE_NUM_BAND 2
+#define TX_PWR_BY_RATE_NUM_RF 4
+#define TX_PWR_BY_RATE_NUM_RATE 84
+
+#define TXPWR_LMT_MAX_RF 4
+
+//----------------------------------------------------------------------------
+// EEPROM/EFUSE data structure definition.
+//----------------------------------------------------------------------------
+#define MAX_RF_PATH_NUM 2
+#define MAX_CHNL_GROUP 3+9
+typedef struct _TxPowerInfo{
+ u8 CCKIndex[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
+ u8 HT40_1SIndex[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
+ u8 HT40_2SIndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
+ s8 HT20IndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
+ u8 OFDMIndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
+ u8 HT40MaxOffset[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
+ u8 HT20MaxOffset[MAX_RF_PATH_NUM][MAX_CHNL_GROUP];
+ u8 TSSI_A[3];
+ u8 TSSI_B[3];
+ u8 TSSI_A_5G[3]; //5GL/5GM/5GH
+ u8 TSSI_B_5G[3];
+}TxPowerInfo, *PTxPowerInfo;
+
+
+//For 88E new structure
+
+/*
+2.4G:
+{
+{1,2},
+{3,4,5},
+{6,7,8},
+{9,10,11},
+{12,13},
+{14}
+}
+
+5G:
+{
+{36,38,40},
+{44,46,48},
+{52,54,56},
+{60,62,64},
+{100,102,104},
+{108,110,112},
+{116,118,120},
+{124,126,128},
+{132,134,136},
+{140,142,144},
+{149,151,153},
+{157,159,161},
+{173,175,177},
+}
+*/
+#define MAX_RF_PATH 4
+#define RF_PATH_MAX MAX_RF_PATH
+#define MAX_CHNL_GROUP_24G 6
+#define MAX_CHNL_GROUP_5G 14
+
+//It must always set to 4, otherwise read efuse table secquence will be wrong.
+#define MAX_TX_COUNT 4
+
+typedef struct _TxPowerInfo24G{
+ u8 IndexCCK_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G];
+ u8 IndexBW40_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G];
+ //If only one tx, only BW20 and OFDM are used.
+ s8 CCK_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+ s8 OFDM_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+ s8 BW20_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+ s8 BW40_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+}TxPowerInfo24G, *PTxPowerInfo24G;
+
+typedef struct _TxPowerInfo5G{
+ u8 IndexBW40_Base[MAX_RF_PATH][MAX_CHNL_GROUP_5G];
+ //If only one tx, only BW20, OFDM, BW80 and BW160 are used.
+ s8 OFDM_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+ s8 BW20_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+ s8 BW40_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+ s8 BW80_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+ s8 BW160_Diff[MAX_RF_PATH][MAX_TX_COUNT];
+}TxPowerInfo5G, *PTxPowerInfo5G;
+
+
+typedef enum _BT_Ant_NUM{
+ Ant_x2 = 0,
+ Ant_x1 = 1
+} BT_Ant_NUM, *PBT_Ant_NUM;
+
+typedef enum _BT_CoType{
+ BT_2WIRE = 0,
+ BT_ISSC_3WIRE = 1,
+ BT_ACCEL = 2,
+ BT_CSR_BC4 = 3,
+ BT_CSR_BC8 = 4,
+ BT_RTL8756 = 5,
+ BT_RTL8723A = 6,
+ BT_RTL8821 = 7,
+ BT_RTL8723B = 8,
+ BT_RTL8192E = 9,
+ BT_RTL8813A = 10,
+ BT_RTL8812A = 11
+} BT_CoType, *PBT_CoType;
+
+typedef enum _BT_RadioShared{
+ BT_Radio_Shared = 0,
+ BT_Radio_Individual = 1,
+} BT_RadioShared, *PBT_RadioShared;
+
+
+#endif
diff --git a/rtl8xxx_EU/include/ieee80211_ext.h b/rtl8xxx_EU/include/ieee80211_ext.h
index 14f1b23..3e55305 100755
--- a/rtl8xxx_EU/include/ieee80211_ext.h
+++ b/rtl8xxx_EU/include/ieee80211_ext.h
@@ -16,462 +16,462 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
- ******************************************************************************/
-#ifndef __IEEE80211_EXT_H
-#define __IEEE80211_EXT_H
-
-#include <drv_conf.h>
-#include <osdep_service.h>
-#include <drv_types.h>
-
-#define WMM_OUI_TYPE 2
-#define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
-#define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
-#define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
-#define WMM_VERSION 1
-
-#define WPA_PROTO_WPA BIT(0)
-#define WPA_PROTO_RSN BIT(1)
-
-#define WPA_KEY_MGMT_IEEE8021X BIT(0)
-#define WPA_KEY_MGMT_PSK BIT(1)
-#define WPA_KEY_MGMT_NONE BIT(2)
-#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
-#define WPA_KEY_MGMT_WPA_NONE BIT(4)
-
-
-#define WPA_CAPABILITY_PREAUTH BIT(0)
-#define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6)
-#define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9)
-
-
-#define PMKID_LEN 16
-
-
-#ifdef PLATFORM_LINUX
-struct wpa_ie_hdr {
- u8 elem_id;
- u8 len;
- u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
- u8 version[2]; /* little endian */
-}__attribute__ ((packed));
-
-struct rsn_ie_hdr {
- u8 elem_id; /* WLAN_EID_RSN */
- u8 len;
- u8 version[2]; /* little endian */
-}__attribute__ ((packed));
-
-struct wme_ac_parameter {
-#if defined(CONFIG_LITTLE_ENDIAN)
- /* byte 1 */
- u8 aifsn:4,
- acm:1,
- aci:2,
- reserved:1;
-
- /* byte 2 */
- u8 eCWmin:4,
- eCWmax:4;
-#elif defined(CONFIG_BIG_ENDIAN)
- /* byte 1 */
- u8 reserved:1,
- aci:2,
- acm:1,
- aifsn:4;
-
- /* byte 2 */
- u8 eCWmax:4,
- eCWmin:4;
-#else
-#error "Please fix <endian.h>"
-#endif
-
- /* bytes 3 & 4 */
- u16 txopLimit;
-} __attribute__ ((packed));
-
-struct wme_parameter_element {
- /* required fields for WME version 1 */
- u8 oui[3];
- u8 oui_type;
- u8 oui_subtype;
- u8 version;
- u8 acInfo;
- u8 reserved;
- struct wme_ac_parameter ac[4];
-
-} __attribute__ ((packed));
-
-#endif
-
-#ifdef PLATFORM_WINDOWS
-
-#pragma pack(1)
-
-struct wpa_ie_hdr {
- u8 elem_id;
- u8 len;
- u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
- u8 version[2]; /* little endian */
-};
-
-struct rsn_ie_hdr {
- u8 elem_id; /* WLAN_EID_RSN */
- u8 len;
- u8 version[2]; /* little endian */
-};
-
-#pragma pack()
-
-#endif
-
-#define WPA_PUT_LE16(a, val) \
- do { \
- (a)[1] = ((u16) (val)) >> 8; \
- (a)[0] = ((u16) (val)) & 0xff; \
- } while (0)
-
-#define WPA_PUT_BE32(a, val) \
- do { \
- (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
- (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
- (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
- (a)[3] = (u8) (((u32) (val)) & 0xff); \
- } while (0)
-
-#define WPA_PUT_LE32(a, val) \
- do { \
- (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \
- (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \
- (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
- (a)[0] = (u8) (((u32) (val)) & 0xff); \
- } while (0)
-
-#define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val))
-//#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val))
-
-
-
-/* Action category code */
-enum ieee80211_category {
- WLAN_CATEGORY_SPECTRUM_MGMT = 0,
- WLAN_CATEGORY_QOS = 1,
- WLAN_CATEGORY_DLS = 2,
- WLAN_CATEGORY_BACK = 3,
- WLAN_CATEGORY_HT = 7,
- WLAN_CATEGORY_WMM = 17,
-};
-
-/* SPECTRUM_MGMT action code */
-enum ieee80211_spectrum_mgmt_actioncode {
- WLAN_ACTION_SPCT_MSR_REQ = 0,
- WLAN_ACTION_SPCT_MSR_RPRT = 1,
- WLAN_ACTION_SPCT_TPC_REQ = 2,
- WLAN_ACTION_SPCT_TPC_RPRT = 3,
- WLAN_ACTION_SPCT_CHL_SWITCH = 4,
- WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,
-};
-
-/* BACK action code */
-enum ieee80211_back_actioncode {
- WLAN_ACTION_ADDBA_REQ = 0,
- WLAN_ACTION_ADDBA_RESP = 1,
- WLAN_ACTION_DELBA = 2,
-};
-
-/* HT features action code */
-enum ieee80211_ht_actioncode {
- WLAN_ACTION_NOTIFY_CH_WIDTH = 0,
- WLAN_ACTION_SM_PS = 1,
- WLAN_ACTION_PSPM = 2,
- WLAN_ACTION_PCO_PHASE = 3,
- WLAN_ACTION_MIMO_CSI_MX = 4,
- WLAN_ACTION_MIMO_NONCP_BF = 5,
- WLAN_ACTION_MIMP_CP_BF = 6,
- WLAN_ACTION_ASEL_INDICATES_FB = 7,
- WLAN_ACTION_HI_INFO_EXCHG = 8,
-};
-
-/* BACK (block-ack) parties */
-enum ieee80211_back_parties {
- WLAN_BACK_RECIPIENT = 0,
- WLAN_BACK_INITIATOR = 1,
- WLAN_BACK_TIMER = 2,
-};
-
-#ifdef PLATFORM_LINUX
-
-struct ieee80211_mgmt {
- u16 frame_control;
- u16 duration;
- u8 da[6];
- u8 sa[6];
- u8 bssid[6];
- u16 seq_ctrl;
- union {
- struct {
- u16 auth_alg;
- u16 auth_transaction;
- u16 status_code;
- /* possibly followed by Challenge text */
- u8 variable[0];
- } __attribute__ ((packed)) auth;
- struct {
- u16 reason_code;
- } __attribute__ ((packed)) deauth;
- struct {
- u16 capab_info;
- u16 listen_interval;
- /* followed by SSID and Supported rates */
- u8 variable[0];
- } __attribute__ ((packed)) assoc_req;
- struct {
- u16 capab_info;
- u16 status_code;
- u16 aid;
- /* followed by Supported rates */
- u8 variable[0];
- } __attribute__ ((packed)) assoc_resp, reassoc_resp;
- struct {
- u16 capab_info;
- u16 listen_interval;
- u8 current_ap[6];
- /* followed by SSID and Supported rates */
- u8 variable[0];
- } __attribute__ ((packed)) reassoc_req;
- struct {
- u16 reason_code;
- } __attribute__ ((packed)) disassoc;
- struct {
- __le64 timestamp;
- u16 beacon_int;
- u16 capab_info;
- /* followed by some of SSID, Supported rates,
- * FH Params, DS Params, CF Params, IBSS Params, TIM */
- u8 variable[0];
- } __attribute__ ((packed)) beacon;
- struct {
- /* only variable items: SSID, Supported rates */
- u8 variable[0];
- } __attribute__ ((packed)) probe_req;
- struct {
- __le64 timestamp;
- u16 beacon_int;
- u16 capab_info;
- /* followed by some of SSID, Supported rates,
- * FH Params, DS Params, CF Params, IBSS Params */
- u8 variable[0];
- } __attribute__ ((packed)) probe_resp;
- struct {
- u8 category;
- union {
- struct {
- u8 action_code;
- u8 dialog_token;
- u8 status_code;
- u8 variable[0];
- } __attribute__ ((packed)) wme_action;
-#if 0
- struct{
- u8 action_code;
- u8 element_id;
- u8 length;
- struct ieee80211_channel_sw_ie sw_elem;
- } __attribute__ ((packed)) chan_switch;
- struct{
- u8 action_code;
- u8 dialog_token;
- u8 element_id;
- u8 length;
- struct ieee80211_msrment_ie msr_elem;
- } __attribute__ ((packed)) measurement;
-#endif
- struct{
- u8 action_code;
- u8 dialog_token;
- u16 capab;
- u16 timeout;
- u16 start_seq_num;
- } __attribute__ ((packed)) addba_req;
- struct{
- u8 action_code;
- u8 dialog_token;
- u16 status;
- u16 capab;
- u16 timeout;
- } __attribute__ ((packed)) addba_resp;
- struct{
- u8 action_code;
- u16 params;
- u16 reason_code;
- } __attribute__ ((packed)) delba;
- struct{
- u8 action_code;
- /* capab_info for open and confirm,
- * reason for close
- */
- u16 aux;
- /* Followed in plink_confirm by status
- * code, AID and supported rates,
- * and directly by supported rates in
- * plink_open and plink_close
- */
- u8 variable[0];
- } __attribute__ ((packed)) plink_action;
- struct{
- u8 action_code;
- u8 variable[0];
- } __attribute__ ((packed)) mesh_action;
- } __attribute__ ((packed)) u;
- } __attribute__ ((packed)) action;
- } __attribute__ ((packed)) u;
-}__attribute__ ((packed));
-
-#endif
-
-
-#ifdef PLATFORM_WINDOWS
-
-#pragma pack(1)
-
-struct ieee80211_mgmt {
- u16 frame_control;
- u16 duration;
- u8 da[6];
- u8 sa[6];
- u8 bssid[6];
- u16 seq_ctrl;
- union {
- struct {
- u16 auth_alg;
- u16 auth_transaction;
- u16 status_code;
- /* possibly followed by Challenge text */
- u8 variable[0];
- } auth;
- struct {
- u16 reason_code;
- } deauth;
- struct {
- u16 capab_info;
- u16 listen_interval;
- /* followed by SSID and Supported rates */
- u8 variable[0];
- } assoc_req;
- struct {
- u16 capab_info;
- u16 status_code;
- u16 aid;
- /* followed by Supported rates */
- u8 variable[0];
- } assoc_resp, reassoc_resp;
- struct {
- u16 capab_info;
- u16 listen_interval;
- u8 current_ap[6];
- /* followed by SSID and Supported rates */
- u8 variable[0];
- } reassoc_req;
- struct {
- u16 reason_code;
- } disassoc;
-#if 0
- struct {
- __le64 timestamp;
- u16 beacon_int;
- u16 capab_info;
- /* followed by some of SSID, Supported rates,
- * FH Params, DS Params, CF Params, IBSS Params, TIM */
- u8 variable[0];
- } beacon;
- struct {
- /* only variable items: SSID, Supported rates */
- u8 variable[0];
- } probe_req;
-
- struct {
- __le64 timestamp;
- u16 beacon_int;
- u16 capab_info;
- /* followed by some of SSID, Supported rates,
- * FH Params, DS Params, CF Params, IBSS Params */
- u8 variable[0];
- } probe_resp;
-#endif
- struct {
- u8 category;
- union {
- struct {
- u8 action_code;
- u8 dialog_token;
- u8 status_code;
- u8 variable[0];
- } wme_action;
-/*
- struct{
- u8 action_code;
- u8 element_id;
- u8 length;
- struct ieee80211_channel_sw_ie sw_elem;
- } chan_switch;
- struct{
- u8 action_code;
- u8 dialog_token;
- u8 element_id;
- u8 length;
- struct ieee80211_msrment_ie msr_elem;
- } measurement;
-*/
- struct{
- u8 action_code;
- u8 dialog_token;
- u16 capab;
- u16 timeout;
- u16 start_seq_num;
- } addba_req;
- struct{
- u8 action_code;
- u8 dialog_token;
- u16 status;
- u16 capab;
- u16 timeout;
- } addba_resp;
- struct{
- u8 action_code;
- u16 params;
- u16 reason_code;
- } delba;
- struct{
- u8 action_code;
- /* capab_info for open and confirm,
- * reason for close
- */
- u16 aux;
- /* Followed in plink_confirm by status
- * code, AID and supported rates,
- * and directly by supported rates in
- * plink_open and plink_close
- */
- u8 variable[0];
- } plink_action;
- struct{
- u8 action_code;
- u8 variable[0];
- } mesh_action;
- } u;
- } action;
- } u;
-} ;
-
-#pragma pack()
-
-#endif
-
-/* mgmt header + 1 byte category code */
-#define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u)
-
-
-
-#endif
-
+ ******************************************************************************/
+#ifndef __IEEE80211_EXT_H
+#define __IEEE80211_EXT_H
+
+#include <drv_conf.h>
+#include <osdep_service.h>
+#include <drv_types.h>
+
+#define WMM_OUI_TYPE 2
+#define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
+#define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
+#define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
+#define WMM_VERSION 1
+
+#define WPA_PROTO_WPA BIT(0)
+#define WPA_PROTO_RSN BIT(1)
+
+#define WPA_KEY_MGMT_IEEE8021X BIT(0)
+#define WPA_KEY_MGMT_PSK BIT(1)
+#define WPA_KEY_MGMT_NONE BIT(2)
+#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
+#define WPA_KEY_MGMT_WPA_NONE BIT(4)
+
+
+#define WPA_CAPABILITY_PREAUTH BIT(0)
+#define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6)
+#define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9)
+
+
+#define PMKID_LEN 16
+
+
+#ifdef PLATFORM_LINUX
+struct wpa_ie_hdr {
+ u8 elem_id;
+ u8 len;
+ u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
+ u8 version[2]; /* little endian */
+}__attribute__ ((packed));
+
+struct rsn_ie_hdr {
+ u8 elem_id; /* WLAN_EID_RSN */
+ u8 len;
+ u8 version[2]; /* little endian */
+}__attribute__ ((packed));
+
+struct wme_ac_parameter {
+#if defined(CONFIG_LITTLE_ENDIAN)
+ /* byte 1 */
+ u8 aifsn:4,
+ acm:1,
+ aci:2,
+ reserved:1;
+
+ /* byte 2 */
+ u8 eCWmin:4,
+ eCWmax:4;
+#elif defined(CONFIG_BIG_ENDIAN)
+ /* byte 1 */
+ u8 reserved:1,
+ aci:2,
+ acm:1,
+ aifsn:4;
+
+ /* byte 2 */
+ u8 eCWmax:4,
+ eCWmin:4;
+#else
+#error "Please fix <endian.h>"
+#endif
+
+ /* bytes 3 & 4 */
+ u16 txopLimit;
+} __attribute__ ((packed));
+
+struct wme_parameter_element {
+ /* required fields for WME version 1 */
+ u8 oui[3];
+ u8 oui_type;
+ u8 oui_subtype;
+ u8 version;
+ u8 acInfo;
+ u8 reserved;
+ struct wme_ac_parameter ac[4];
+
+} __attribute__ ((packed));
+
+#endif
+
+#ifdef PLATFORM_WINDOWS
+
+#pragma pack(1)
+
+struct wpa_ie_hdr {
+ u8 elem_id;
+ u8 len;
+ u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
+ u8 version[2]; /* little endian */
+};
+
+struct rsn_ie_hdr {
+ u8 elem_id; /* WLAN_EID_RSN */
+ u8 len;
+ u8 version[2]; /* little endian */
+};
+
+#pragma pack()
+
+#endif
+
+#define WPA_PUT_LE16(a, val) \
+ do { \
+ (a)[1] = ((u16) (val)) >> 8; \
+ (a)[0] = ((u16) (val)) & 0xff; \
+ } while (0)
+
+#define WPA_PUT_BE32(a, val) \
+ do { \
+ (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
+ (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
+ (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
+ (a)[3] = (u8) (((u32) (val)) & 0xff); \
+ } while (0)
+
+#define WPA_PUT_LE32(a, val) \
+ do { \
+ (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \
+ (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \
+ (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
+ (a)[0] = (u8) (((u32) (val)) & 0xff); \
+ } while (0)
+
+#define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val))
+//#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val))
+
+
+
+/* Action category code */
+enum ieee80211_category {
+ WLAN_CATEGORY_SPECTRUM_MGMT = 0,
+ WLAN_CATEGORY_QOS = 1,
+ WLAN_CATEGORY_DLS = 2,
+ WLAN_CATEGORY_BACK = 3,
+ WLAN_CATEGORY_HT = 7,
+ WLAN_CATEGORY_WMM = 17,
+};
+
+/* SPECTRUM_MGMT action code */
+enum ieee80211_spectrum_mgmt_actioncode {
+ WLAN_ACTION_SPCT_MSR_REQ = 0,
+ WLAN_ACTION_SPCT_MSR_RPRT = 1,
+ WLAN_ACTION_SPCT_TPC_REQ = 2,
+ WLAN_ACTION_SPCT_TPC_RPRT = 3,
+ WLAN_ACTION_SPCT_CHL_SWITCH = 4,
+ WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,
+};
+
+/* BACK action code */
+enum ieee80211_back_actioncode {
+ WLAN_ACTION_ADDBA_REQ = 0,
+ WLAN_ACTION_ADDBA_RESP = 1,
+ WLAN_ACTION_DELBA = 2,
+};
+
+/* HT features action code */
+enum ieee80211_ht_actioncode {
+ WLAN_ACTION_NOTIFY_CH_WIDTH = 0,
+ WLAN_ACTION_SM_PS = 1,
+ WLAN_ACTION_PSPM = 2,
+ WLAN_ACTION_PCO_PHASE = 3,
+ WLAN_ACTION_MIMO_CSI_MX = 4,
+ WLAN_ACTION_MIMO_NONCP_BF = 5,
+ WLAN_ACTION_MIMP_CP_BF = 6,
+ WLAN_ACTION_ASEL_INDICATES_FB = 7,
+ WLAN_ACTION_HI_INFO_EXCHG = 8,
+};
+
+/* BACK (block-ack) parties */
+enum ieee80211_back_parties {
+ WLAN_BACK_RECIPIENT = 0,
+ WLAN_BACK_INITIATOR = 1,
+ WLAN_BACK_TIMER = 2,
+};
+
+#ifdef PLATFORM_LINUX
+
+struct ieee80211_mgmt {
+ u16 frame_control;
+ u16 duration;
+ u8 da[6];
+ u8 sa[6];
+ u8 bssid[6];
+ u16 seq_ctrl;
+ union {
+ struct {
+ u16 auth_alg;
+ u16 auth_transaction;
+ u16 status_code;
+ /* possibly followed by Challenge text */
+ u8 variable[0];
+ } __attribute__ ((packed)) auth;
+ struct {
+ u16 reason_code;
+ } __attribute__ ((packed)) deauth;
+ struct {
+ u16 capab_info;
+ u16 listen_interval;
+ /* followed by SSID and Supported rates */
+ u8 variable[0];
+ } __attribute__ ((packed)) assoc_req;
+ struct {
+ u16 capab_info;
+ u16 status_code;
+ u16 aid;
+ /* followed by Supported rates */
+ u8 variable[0];
+ } __attribute__ ((packed)) assoc_resp, reassoc_resp;
+ struct {
+ u16 capab_info;
+ u16 listen_interval;
+ u8 current_ap[6];
+ /* followed by SSID and Supported rates */
+ u8 variable[0];
+ } __attribute__ ((packed)) reassoc_req;
+ struct {
+ u16 reason_code;
+ } __attribute__ ((packed)) disassoc;
+ struct {
+ __le64 timestamp;
+ u16 beacon_int;
+ u16 capab_info;
+ /* followed by some of SSID, Supported rates,
+ * FH Params, DS Params, CF Params, IBSS Params, TIM */
+ u8 variable[0];
+ } __attribute__ ((packed)) beacon;
+ struct {
+ /* only variable items: SSID, Supported rates */
+ u8 variable[0];
+ } __attribute__ ((packed)) probe_req;
+ struct {
+ __le64 timestamp;
+ u16 beacon_int;
+ u16 capab_info;
+ /* followed by some of SSID, Supported rates,
+ * FH Params, DS Params, CF Params, IBSS Params */
+ u8 variable[0];
+ } __attribute__ ((packed)) probe_resp;
+ struct {
+ u8 category;
+ union {
+ struct {
+ u8 action_code;
+ u8 dialog_token;
+ u8 status_code;
+ u8 variable[0];
+ } __attribute__ ((packed)) wme_action;
+#if 0
+ struct{
+ u8 action_code;
+ u8 element_id;
+ u8 length;
+ struct ieee80211_channel_sw_ie sw_elem;
+ } __attribute__ ((packed)) chan_switch;
+ struct{
+ u8 action_code;
+ u8 dialog_token;
+ u8 element_id;
+ u8 length;
+ struct ieee80211_msrment_ie msr_elem;
+ } __attribute__ ((packed)) measurement;
+#endif
+ struct{
+ u8 action_code;
+ u8 dialog_token;
+ u16 capab;
+ u16 timeout;
+ u16 start_seq_num;
+ } __attribute__ ((packed)) addba_req;
+ struct{
+ u8 action_code;
+ u8 dialog_token;
+ u16 status;
+ u16 capab;
+ u16 timeout;
+ } __attribute__ ((packed)) addba_resp;
+ struct{
+ u8 action_code;
+ u16 params;
+ u16 reason_code;
+ } __attribute__ ((packed)) delba;
+ struct{
+ u8 action_code;
+ /* capab_info for open and confirm,
+ * reason for close
+ */
+ u16 aux;
+ /* Followed in plink_confirm by status
+ * code, AID and supported rates,
+ * and directly by supported rates in
+ * plink_open and plink_close
+ */
+ u8 variable[0];
+ } __attribute__ ((packed)) plink_action;
+ struct{
+ u8 action_code;
+ u8 variable[0];
+ } __attribute__ ((packed)) mesh_action;
+ } __attribute__ ((packed)) u;
+ } __attribute__ ((packed)) action;
+ } __attribute__ ((packed)) u;
+}__attribute__ ((packed));
+
+#endif
+
+
+#ifdef PLATFORM_WINDOWS
+
+#pragma pack(1)
+
+struct ieee80211_mgmt {
+ u16 frame_control;
+ u16 duration;
+ u8 da[6];
+ u8 sa[6];
+ u8 bssid[6];
+ u16 seq_ctrl;
+ union {
+ struct {
+ u16 auth_alg;
+ u16 auth_transaction;
+ u16 status_code;
+ /* possibly followed by Challenge text */
+ u8 variable[0];
+ } auth;
+ struct {
+ u16 reason_code;
+ } deauth;
+ struct {
+ u16 capab_info;
+ u16 listen_interval;
+ /* followed by SSID and Supported rates */
+ u8 variable[0];
+ } assoc_req;
+ struct {
+ u16 capab_info;
+ u16 status_code;
+ u16 aid;
+ /* followed by Supported rates */
+ u8 variable[0];
+ } assoc_resp, reassoc_resp;
+ struct {
+ u16 capab_info;
+ u16 listen_interval;
+ u8 current_ap[6];
+ /* followed by SSID and Supported rates */
+ u8 variable[0];
+ } reassoc_req;
+ struct {
+ u16 reason_code;
+ } disassoc;
+#if 0
+ struct {
+ __le64 timestamp;
+ u16 beacon_int;
+ u16 capab_info;
+ /* followed by some of SSID, Supported rates,
+ * FH Params, DS Params, CF Params, IBSS Params, TIM */
+ u8 variable[0];
+ } beacon;
+ struct {
+ /* only variable items: SSID, Supported rates */
+ u8 variable[0];
+ } probe_req;
+
+ struct {
+ __le64 timestamp;
+ u16 beacon_int;
+ u16 capab_info;
+ /* followed by some of SSID, Supported rates,
+ * FH Params, DS Params, CF Params, IBSS Params */
+ u8 variable[0];
+ } probe_resp;
+#endif
+ struct {
+ u8 category;
+ union {
+ struct {
+ u8 action_code;
+ u8 dialog_token;
+ u8 status_code;
+ u8 variable[0];
+ } wme_action;
+/*
+ struct{
+ u8 action_code;
+ u8 element_id;
+ u8 length;
+ struct ieee80211_channel_sw_ie sw_elem;
+ } chan_switch;
+ struct{
+ u8 action_code;
+ u8 dialog_token;
+ u8 element_id;
+ u8 length;
+ struct ieee80211_msrment_ie msr_elem;
+ } measurement;
+*/
+ struct{
+ u8 action_code;
+ u8 dialog_token;
+ u16 capab;
+ u16 timeout;
+ u16 start_seq_num;
+ } addba_req;
+ struct{
+ u8 action_code;
+ u8 dialog_token;
+ u16 status;
+ u16 capab;
+ u16 timeout;
+ } addba_resp;
+ struct{
+ u8 action_code;
+ u16 params;
+ u16 reason_code;
+ } delba;
+ struct{
+ u8 action_code;
+ /* capab_info for open and confirm,
+ * reason for close
+ */
+ u16 aux;
+ /* Followed in plink_confirm by status
+ * code, AID and supported rates,
+ * and directly by supported rates in
+ * plink_open and plink_close
+ */
+ u8 variable[0];
+ } plink_action;
+ struct{
+ u8 action_code;
+ u8 variable[0];
+ } mesh_action;
+ } u;
+ } action;
+ } u;
+} ;
+
+#pragma pack()
+
+#endif
+
+/* mgmt header + 1 byte category code */
+#define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u)
+
+
+
+#endif
+
diff --git a/rtl8xxx_EU/include/ioctl_cfg80211.h b/rtl8xxx_EU/include/ioctl_cfg80211.h
index d21341d..f7fd232 100644..100755
--- a/rtl8xxx_EU/include/ioctl_cfg80211.h
+++ b/rtl8xxx_EU/include/ioctl_cfg80211.h
@@ -1,176 +1,179 @@
-/******************************************************************************
- *
- * 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 __IOCTL_CFG80211_H__
-#define __IOCTL_CFG80211_H__
-
-
-#if defined(RTW_USE_CFG80211_STA_EVENT)
- #undef CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
-#endif
-
-struct rtw_wdev_invit_info {
- u8 state; /* 0: req, 1:rep */
- u8 peer_mac[ETH_ALEN];
- u8 active;
- u8 token;
- u8 flags;
- u8 status;
- u8 req_op_ch;
- u8 rsp_op_ch;
-};
-
-#define rtw_wdev_invit_info_init(invit_info) \
- do { \
- (invit_info)->state = 0xff; \
- _rtw_memset((invit_info)->peer_mac, 0, ETH_ALEN); \
- (invit_info)->active = 0xff; \
- (invit_info)->token = 0; \
- (invit_info)->flags = 0x00; \
- (invit_info)->status = 0xff; \
- (invit_info)->req_op_ch = 0; \
- (invit_info)->rsp_op_ch = 0; \
- } while (0)
-
-struct rtw_wdev_nego_info {
- u8 state; /* 0: req, 1:rep, 2:conf */
- u8 peer_mac[ETH_ALEN];
- u8 active;
- u8 token;
- u8 status;
- u8 req_intent;
- u8 req_op_ch;
- u8 req_listen_ch;
- u8 rsp_intent;
- u8 rsp_op_ch;
- u8 conf_op_ch;
-};
-
-#define rtw_wdev_nego_info_init(nego_info) \
- do { \
- (nego_info)->state = 0xff; \
- _rtw_memset((nego_info)->peer_mac, 0, ETH_ALEN); \
- (nego_info)->active = 0xff; \
- (nego_info)->token = 0; \
- (nego_info)->status = 0xff; \
- (nego_info)->req_intent = 0xff; \
- (nego_info)->req_op_ch = 0; \
- (nego_info)->req_listen_ch = 0; \
- (nego_info)->rsp_intent = 0xff; \
- (nego_info)->rsp_op_ch = 0; \
- (nego_info)->conf_op_ch = 0; \
- } while (0)
-
-struct rtw_wdev_priv
-{
- struct wireless_dev *rtw_wdev;
-
- _adapter *padapter;
-
- struct cfg80211_scan_request *scan_request;
- _lock scan_req_lock;
-
- struct net_device *pmon_ndev;//for monitor interface
- char ifname_mon[IFNAMSIZ + 1]; //interface name for monitor interface
-
- u8 p2p_enabled;
-
- u8 provdisc_req_issued;
-
- struct rtw_wdev_invit_info invit_info;
- struct rtw_wdev_nego_info nego_info;
-
- u8 bandroid_scan;
- bool block;
- bool power_mgmt;
-
-#ifdef CONFIG_CONCURRENT_MODE
- ATOMIC_T ro_ch_to;
- ATOMIC_T switch_ch_to;
-#endif
-
-};
-
-#define wiphy_to_adapter(x) (*((_adapter**)wiphy_priv(x)))
-
-#define wdev_to_ndev(w) ((w)->netdev)
-
-int rtw_wdev_alloc(_adapter *padapter, struct device *dev);
-void rtw_wdev_free(struct wireless_dev *wdev);
-void rtw_wdev_unregister(struct wireless_dev *wdev);
-
-void rtw_cfg80211_init_wiphy(_adapter *padapter);
-
-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);
-void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter);
-void rtw_cfg80211_indicate_connect(_adapter *padapter);
-void rtw_cfg80211_indicate_disconnect(_adapter *padapter);
-void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted);
-
-#ifdef CONFIG_AP_MODE
-void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
-void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, unsigned short reason);
-#endif //CONFIG_AP_MODE
-
-void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, size_t len);
-void rtw_cfg80211_rx_p2p_action_public(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
-void rtw_cfg80211_rx_action_p2p(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
-void rtw_cfg80211_rx_action(_adapter *adapter, u8 *frame, uint frame_len, const char*msg);
-
-int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, int type);
-
-bool rtw_cfg80211_pwr_mgmt(_adapter *adapter);
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE)
-#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)
-#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)
-#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, buf, len)
-#else
-#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, bss, buf, len)
-#endif
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->pnetdev, cookie, buf, len, ack, gfp)
-#else
-#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->rtw_wdev, cookie, buf, len, ack, gfp)
-#endif
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->pnetdev, cookie, chan, channel_type, duration, gfp)
-#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->pnetdev, cookie, chan, chan_type, gfp)
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
-#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, channel_type, duration, gfp)
-#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, chan_type, gfp)
-#else
-#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, duration, gfp)
-#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, gfp)
-#endif
-
-#endif //__IOCTL_CFG80211_H__
-
+/******************************************************************************
+ *
+ * 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 __IOCTL_CFG80211_H__
+#define __IOCTL_CFG80211_H__
+
+
+#if defined(RTW_USE_CFG80211_STA_EVENT)
+ #undef CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
+#endif
+
+struct rtw_wdev_invit_info {
+ u8 state; /* 0: req, 1:rep */
+ u8 peer_mac[ETH_ALEN];
+ u8 active;
+ u8 token;
+ u8 flags;
+ u8 status;
+ u8 req_op_ch;
+ u8 rsp_op_ch;
+};
+
+#define rtw_wdev_invit_info_init(invit_info) \
+ do { \
+ (invit_info)->state = 0xff; \
+ _rtw_memset((invit_info)->peer_mac, 0, ETH_ALEN); \
+ (invit_info)->active = 0xff; \
+ (invit_info)->token = 0; \
+ (invit_info)->flags = 0x00; \
+ (invit_info)->status = 0xff; \
+ (invit_info)->req_op_ch = 0; \
+ (invit_info)->rsp_op_ch = 0; \
+ } while (0)
+
+struct rtw_wdev_nego_info {
+ u8 state; /* 0: req, 1:rep, 2:conf */
+ u8 peer_mac[ETH_ALEN];
+ u8 active;
+ u8 token;
+ u8 status;
+ u8 req_intent;
+ u8 req_op_ch;
+ u8 req_listen_ch;
+ u8 rsp_intent;
+ u8 rsp_op_ch;
+ u8 conf_op_ch;
+};
+
+#define rtw_wdev_nego_info_init(nego_info) \
+ do { \
+ (nego_info)->state = 0xff; \
+ _rtw_memset((nego_info)->peer_mac, 0, ETH_ALEN); \
+ (nego_info)->active = 0xff; \
+ (nego_info)->token = 0; \
+ (nego_info)->status = 0xff; \
+ (nego_info)->req_intent = 0xff; \
+ (nego_info)->req_op_ch = 0; \
+ (nego_info)->req_listen_ch = 0; \
+ (nego_info)->rsp_intent = 0xff; \
+ (nego_info)->rsp_op_ch = 0; \
+ (nego_info)->conf_op_ch = 0; \
+ } while (0)
+
+struct rtw_wdev_priv
+{
+ struct wireless_dev *rtw_wdev;
+
+ _adapter *padapter;
+
+ struct cfg80211_scan_request *scan_request;
+ _lock scan_req_lock;
+
+ struct net_device *pmon_ndev;//for monitor interface
+ char ifname_mon[IFNAMSIZ + 1]; //interface name for monitor interface
+
+ u8 p2p_enabled;
+
+ u8 provdisc_req_issued;
+
+ struct rtw_wdev_invit_info invit_info;
+ struct rtw_wdev_nego_info nego_info;
+
+ u8 bandroid_scan;
+ bool block;
+ bool block_scan;
+ bool power_mgmt;
+
+#ifdef CONFIG_CONCURRENT_MODE
+ ATOMIC_T ro_ch_to;
+ ATOMIC_T switch_ch_to;
+#endif
+
+};
+
+#define wiphy_to_adapter(x) (*((_adapter**)wiphy_priv(x)))
+
+#define wdev_to_ndev(w) ((w)->netdev)
+
+int rtw_wdev_alloc(_adapter *padapter, struct device *dev);
+void rtw_wdev_free(struct wireless_dev *wdev);
+void rtw_wdev_unregister(struct wireless_dev *wdev);
+
+void rtw_cfg80211_init_wiphy(_adapter *padapter);
+
+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);
+void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter);
+void rtw_cfg80211_indicate_connect(_adapter *padapter);
+void rtw_cfg80211_indicate_disconnect(_adapter *padapter);
+void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted);
+
+#ifdef CONFIG_AP_MODE
+void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
+void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, unsigned short reason);
+#endif //CONFIG_AP_MODE
+
+void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, size_t len);
+void rtw_cfg80211_rx_p2p_action_public(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
+void rtw_cfg80211_rx_action_p2p(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
+void rtw_cfg80211_rx_action(_adapter *adapter, u8 *frame, uint frame_len, const char*msg);
+
+int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, int type);
+
+bool rtw_cfg80211_pwr_mgmt(_adapter *adapter);
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE)
+#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)
+#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)
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3 , 18 , 0))
+#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)
+#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)
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE)
+#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, buf, len)
+#else
+#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, bss, buf, len)
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->pnetdev, cookie, buf, len, ack, gfp)
+#else
+#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->rtw_wdev, cookie, buf, len, ack, gfp)
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->pnetdev, cookie, chan, channel_type, duration, gfp)
+#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->pnetdev, cookie, chan, chan_type, gfp)
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, channel_type, duration, gfp)
+#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, chan_type, gfp)
+#else
+#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, duration, gfp)
+#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, gfp)
+#endif
+
+#endif //__IOCTL_CFG80211_H__
+
diff --git a/rtl8xxx_EU/include/osdep_service.h b/rtl8xxx_EU/include/osdep_service.h
index 76026b9..b262938 100755
--- a/rtl8xxx_EU/include/osdep_service.h
+++ b/rtl8xxx_EU/include/osdep_service.h
@@ -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/rtl8xxx_EU/include/osdep_service_bsd.h b/rtl8xxx_EU/include/osdep_service_bsd.h
index b56ccbb..040225c 100755
--- a/rtl8xxx_EU/include/osdep_service_bsd.h
+++ b/rtl8xxx_EU/include/osdep_service_bsd.h
@@ -1,749 +1,749 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __OSDEP_BSD_SERVICE_H_
-#define __OSDEP_BSD_SERVICE_H_
-
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/systm.h>
-#include <sys/param.h>
-#include <sys/sockio.h>
-#include <sys/sysctl.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/mbuf.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/endian.h>
-#include <sys/kdb.h>
-#include <sys/kthread.h>
-#include <sys/malloc.h>
-#include <sys/time.h>
-#include <machine/atomic.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-#include <net/route.h>
-
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/if_ether.h>
-#include <if_ether.h>
-
-#include <net80211/ieee80211_var.h>
-#include <net80211/ieee80211_regdomain.h>
-#include <net80211/ieee80211_radiotap.h>
-#include <net80211/ieee80211_ratectl.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include "usbdevs.h"
-
-#define USB_DEBUG_VAR rum_debug
-#include <dev/usb/usb_debug.h>
-
-#if 1 //Baron porting from linux, it's all temp solution, needs to check again
-#include <sys/sema.h>
-#include <sys/pcpu.h> /* XXX for PCPU_GET */
-// typedef struct semaphore _sema;
- typedef struct sema _sema;
-// typedef spinlock_t _lock;
- typedef struct mtx _lock;
- typedef struct mtx _mutex;
- typedef struct timer_list _timer;
- struct list_head {
- struct list_head *next, *prev;
- };
- struct __queue {
- struct list_head queue;
- _lock lock;
- };
-
- //typedef struct sk_buff _pkt;
- typedef struct mbuf _pkt;
- typedef struct mbuf _buffer;
-
- typedef struct __queue _queue;
- typedef struct list_head _list;
- typedef int _OS_STATUS;
- //typedef u32 _irqL;
- typedef unsigned long _irqL;
- typedef struct ifnet * _nic_hdl;
-
- typedef pid_t _thread_hdl_;
-// typedef struct thread _thread_hdl_;
- typedef void thread_return;
- typedef void* thread_context;
-
- //#define thread_exit() complete_and_exit(NULL, 0)
-
- #define thread_exit() do{printf("%s", "RTKTHREAD_exit");}while(0)
-
- typedef void timer_hdl_return;
- typedef void* timer_hdl_context;
- typedef struct work_struct _workitem;
-
-#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-/* emulate a modern version */
-#define LINUX_VERSION_CODE KERNEL_VERSION(2, 6, 35)
-
-#define WIRELESS_EXT -1
-#define HZ hz
-#define spin_lock_irqsave mtx_lock_irqsave
-#define spin_lock_bh mtx_lock_irqsave
-#define mtx_lock_irqsave(lock, x) mtx_lock(lock)//{local_irq_save((x)); mtx_lock_spin((lock));}
-//#define IFT_RTW 0xf9 //ifnet allocate type for RTW
-#define free_netdev if_free
-#define LIST_CONTAINOR(ptr, type, member) \
- ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
-#define container_of(p,t,n) (t*)((p)-&(((t*)0)->n))
-/*
- * Linux timers are emulated using FreeBSD callout functions
- * (and taskqueue functionality).
- *
- * Currently no timer stats functionality.
- *
- * See (linux_compat) processes.c
- *
- */
-struct timer_list {
-
- /* FreeBSD callout related fields */
- struct callout callout;
-
- //timeout function
- void (*function)(void*);
- //argument
- void *arg;
-
-};
-struct workqueue_struct;
-struct work_struct;
-typedef void (*work_func_t)(struct work_struct *work);
-/* Values for the state of an item of work (work_struct) */
-typedef enum work_state {
- WORK_STATE_UNSET = 0,
- WORK_STATE_CALLOUT_PENDING = 1,
- WORK_STATE_TASK_PENDING = 2,
- WORK_STATE_WORK_CANCELLED = 3
-} work_state_t;
-
-struct work_struct {
- struct task task; /* FreeBSD task */
- work_state_t state; /* the pending or otherwise state of work. */
- work_func_t func;
-};
-#define spin_unlock_irqrestore mtx_unlock_irqrestore
-#define spin_unlock_bh mtx_unlock_irqrestore
-#define mtx_unlock_irqrestore(lock,x) mtx_unlock(lock);
-extern void _rtw_spinlock_init(_lock *plock);
-
-//modify private structure to match freebsd
-#define BITS_PER_LONG 32
-union ktime {
- s64 tv64;
-#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
- struct {
-#ifdef __BIG_ENDIAN
- s32 sec, nsec;
-#else
- s32 nsec, sec;
-#endif
- } tv;
-#endif
-};
-#define kmemcheck_bitfield_begin(name)
-#define kmemcheck_bitfield_end(name)
-#define CHECKSUM_NONE 0
-typedef unsigned char *sk_buff_data_t;
-typedef union ktime ktime_t; /* Kill this */
-
-void rtw_mtx_lock(_lock *plock);
-
-void rtw_mtx_unlock(_lock *plock);
-
-/**
- * struct sk_buff - socket buffer
- * @next: Next buffer in list
- * @prev: Previous buffer in list
- * @sk: Socket we are owned by
- * @tstamp: Time we arrived
- * @dev: Device we arrived on/are leaving by
- * @transport_header: Transport layer header
- * @network_header: Network layer header
- * @mac_header: Link layer header
- * @_skb_refdst: destination entry (with norefcount bit)
- * @sp: the security path, used for xfrm
- * @cb: Control buffer. Free for use by every layer. Put private vars here
- * @len: Length of actual data
- * @data_len: Data length
- * @mac_len: Length of link layer header
- * @hdr_len: writable header length of cloned skb
- * @csum: Checksum (must include start/offset pair)
- * @csum_start: Offset from skb->head where checksumming should start
- * @csum_offset: Offset from csum_start where checksum should be stored
- * @local_df: allow local fragmentation
- * @cloned: Head may be cloned (check refcnt to be sure)
- * @nohdr: Payload reference only, must not modify header
- * @pkt_type: Packet class
- * @fclone: skbuff clone status
- * @ip_summed: Driver fed us an IP checksum
- * @priority: Packet queueing priority
- * @users: User count - see {datagram,tcp}.c
- * @protocol: Packet protocol from driver
- * @truesize: Buffer size
- * @head: Head of buffer
- * @data: Data head pointer
- * @tail: Tail pointer
- * @end: End pointer
- * @destructor: Destruct function
- * @mark: Generic packet mark
- * @nfct: Associated connection, if any
- * @ipvs_property: skbuff is owned by ipvs
- * @peeked: this packet has been seen already, so stats have been
- * done for it, don't do them again
- * @nf_trace: netfilter packet trace flag
- * @nfctinfo: Relationship of this skb to the connection
- * @nfct_reasm: netfilter conntrack re-assembly pointer
- * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
- * @skb_iif: ifindex of device we arrived on
- * @rxhash: the packet hash computed on receive
- * @queue_mapping: Queue mapping for multiqueue devices
- * @tc_index: Traffic control index
- * @tc_verd: traffic control verdict
- * @ndisc_nodetype: router type (from link layer)
- * @dma_cookie: a cookie to one of several possible DMA operations
- * done by skb DMA functions
- * @secmark: security marking
- * @vlan_tci: vlan tag control information
- */
-
-struct sk_buff {
- /* These two members must be first. */
- struct sk_buff *next;
- struct sk_buff *prev;
-
- ktime_t tstamp;
-
- struct sock *sk;
- //struct net_device *dev;
- struct ifnet *dev;
-
- /*
- * This is the control buffer. It is free to use for every
- * layer. Please put your private variables there. If you
- * want to keep them across layers you have to do a skb_clone()
- * first. This is owned by whoever has the skb queued ATM.
- */
- char cb[48] __aligned(8);
-
- unsigned long _skb_refdst;
-#ifdef CONFIG_XFRM
- struct sec_path *sp;
-#endif
- unsigned int len,
- data_len;
- u16 mac_len,
- hdr_len;
- union {
- u32 csum;
- struct {
- u16 csum_start;
- u16 csum_offset;
- }smbol2;
- }smbol1;
- u32 priority;
- kmemcheck_bitfield_begin(flags1);
- u8 local_df:1,
- cloned:1,
- ip_summed:2,
- nohdr:1,
- nfctinfo:3;
- u8 pkt_type:3,
- fclone:2,
- ipvs_property:1,
- peeked:1,
- nf_trace:1;
- kmemcheck_bitfield_end(flags1);
- u16 protocol;
-
- void (*destructor)(struct sk_buff *skb);
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
- struct nf_conntrack *nfct;
- struct sk_buff *nfct_reasm;
-#endif
-#ifdef CONFIG_BRIDGE_NETFILTER
- struct nf_bridge_info *nf_bridge;
-#endif
-
- int skb_iif;
-#ifdef CONFIG_NET_SCHED
- u16 tc_index; /* traffic control index */
-#ifdef CONFIG_NET_CLS_ACT
- u16 tc_verd; /* traffic control verdict */
-#endif
-#endif
-
- u32 rxhash;
-
- kmemcheck_bitfield_begin(flags2);
- u16 queue_mapping:16;
-#ifdef CONFIG_IPV6_NDISC_NODETYPE
- u8 ndisc_nodetype:2,
- deliver_no_wcard:1;
-#else
- u8 deliver_no_wcard:1;
-#endif
- kmemcheck_bitfield_end(flags2);
-
- /* 0/14 bit hole */
-
-#ifdef CONFIG_NET_DMA
- dma_cookie_t dma_cookie;
-#endif
-#ifdef CONFIG_NETWORK_SECMARK
- u32 secmark;
-#endif
- union {
- u32 mark;
- u32 dropcount;
- }symbol3;
-
- u16 vlan_tci;
-
- sk_buff_data_t transport_header;
- sk_buff_data_t network_header;
- sk_buff_data_t mac_header;
- /* These elements must be at the end, see alloc_skb() for details. */
- sk_buff_data_t tail;
- sk_buff_data_t end;
- unsigned char *head,
- *data;
- unsigned int truesize;
- atomic_t users;
-};
-struct sk_buff_head {
- /* These two members must be first. */
- struct sk_buff *next;
- struct sk_buff *prev;
-
- u32 qlen;
- _lock lock;
-};
-#define skb_tail_pointer(skb) skb->tail
-static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
-{
- unsigned char *tmp = skb_tail_pointer(skb);
- //SKB_LINEAR_ASSERT(skb);
- skb->tail += len;
- skb->len += len;
- return tmp;
-}
-
-static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
-{
- skb->len -= len;
- if(skb->len < skb->data_len)
- printf("%s(),%d,error!\n",__FUNCTION__,__LINE__);
- return skb->data += len;
-}
-static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
-{
- #ifdef PLATFORM_FREEBSD
- return __skb_pull(skb, len);
- #else
- return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
- #endif //PLATFORM_FREEBSD
-}
-static inline u32 skb_queue_len(const struct sk_buff_head *list_)
-{
- return list_->qlen;
-}
-static inline void __skb_insert(struct sk_buff *newsk,
- struct sk_buff *prev, struct sk_buff *next,
- struct sk_buff_head *list)
-{
- newsk->next = next;
- newsk->prev = prev;
- next->prev = prev->next = newsk;
- list->qlen++;
-}
-static inline void __skb_queue_before(struct sk_buff_head *list,
- struct sk_buff *next,
- struct sk_buff *newsk)
-{
- __skb_insert(newsk, next->prev, next, list);
-}
-static inline void skb_queue_tail(struct sk_buff_head *list,
- struct sk_buff *newsk)
-{
- mtx_lock(&list->lock);
- __skb_queue_before(list, (struct sk_buff *)list, newsk);
- mtx_unlock(&list->lock);
-}
-static inline struct sk_buff *skb_peek(struct sk_buff_head *list_)
-{
- struct sk_buff *list = ((struct sk_buff *)list_)->next;
- if (list == (struct sk_buff *)list_)
- list = NULL;
- return list;
-}
-static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
-{
- struct sk_buff *next, *prev;
-
- list->qlen--;
- next = skb->next;
- prev = skb->prev;
- skb->next = skb->prev = NULL;
- next->prev = prev;
- prev->next = next;
-}
-
-static inline struct sk_buff *skb_dequeue(struct sk_buff_head *list)
-{
- mtx_lock(&list->lock);
-
- struct sk_buff *skb = skb_peek(list);
- if (skb)
- __skb_unlink(skb, list);
-
- mtx_unlock(&list->lock);
-
- return skb;
-}
-static inline void skb_reserve(struct sk_buff *skb, int len)
-{
- skb->data += len;
- skb->tail += len;
-}
-static inline void __skb_queue_head_init(struct sk_buff_head *list)
-{
- list->prev = list->next = (struct sk_buff *)list;
- list->qlen = 0;
-}
-/*
- * This function creates a split out lock class for each invocation;
- * this is needed for now since a whole lot of users of the skb-queue
- * infrastructure in drivers have different locking usage (in hardirq)
- * than the networking core (in softirq only). In the long run either the
- * network layer or drivers should need annotation to consolidate the
- * main types of usage into 3 classes.
- */
-static inline void skb_queue_head_init(struct sk_buff_head *list)
-{
- _rtw_spinlock_init(&list->lock);
- __skb_queue_head_init(list);
-}
-unsigned long copy_from_user(void *to, const void *from, unsigned long n);
-unsigned long copy_to_user(void *to, const void *from, unsigned long n);
-struct sk_buff * dev_alloc_skb(unsigned int size);
-struct sk_buff *skb_clone(const struct sk_buff *skb);
-void dev_kfree_skb_any(struct sk_buff *skb);
-#endif //Baron porting from linux, it's all temp solution, needs to check again
-
-
-#if 1 // kenny add Linux compatibility code for Linux USB driver
-#include <dev/usb/usb_compat_linux.h>
-
-#define __init // __attribute ((constructor))
-#define __exit // __attribute ((destructor))
-
-/*
- * Definitions for module_init and module_exit macros.
- *
- * These macros will use the SYSINIT framework to call a specified
- * function (with no arguments) on module loading or unloading.
- *
- */
-
-void module_init_exit_wrapper(void *arg);
-
-#define module_init(initfn) \
- SYSINIT(mod_init_ ## initfn, \
- SI_SUB_KLD, SI_ORDER_FIRST, \
- module_init_exit_wrapper, initfn)
-
-#define module_exit(exitfn) \
- SYSUNINIT(mod_exit_ ## exitfn, \
- SI_SUB_KLD, SI_ORDER_ANY, \
- module_init_exit_wrapper, exitfn)
-
-/*
- * The usb_register and usb_deregister functions are used to register
- * usb drivers with the usb subsystem.
- */
-int usb_register(struct usb_driver *driver);
-int usb_deregister(struct usb_driver *driver);
-
-/*
- * usb_get_dev and usb_put_dev - increment/decrement the reference count
- * of the usb device structure.
- *
- * Original body of usb_get_dev:
- *
- * if (dev)
- * get_device(&dev->dev);
- * return dev;
- *
- * Reference counts are not currently used in this compatibility
- * layer. So these functions will do nothing.
- */
-static inline struct usb_device *
-usb_get_dev(struct usb_device *dev)
-{
- return dev;
-}
-
-static inline void
-usb_put_dev(struct usb_device *dev)
-{
- return;
-}
-
-
-// rtw_usb_compat_linux
-int rtw_usb_submit_urb(struct urb *urb, uint16_t mem_flags);
-int rtw_usb_unlink_urb(struct urb *urb);
-int rtw_usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe);
-int rtw_usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
- uint8_t request, uint8_t requesttype,
- uint16_t value, uint16_t index, void *data,
- uint16_t size, usb_timeout_t timeout);
-int rtw_usb_set_interface(struct usb_device *dev, uint8_t iface_no, uint8_t alt_index);
-int rtw_usb_setup_endpoint(struct usb_device *dev,
- struct usb_host_endpoint *uhe, usb_size_t bufsize);
-struct urb *rtw_usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags);
-struct usb_host_endpoint *rtw_usb_find_host_endpoint(struct usb_device *dev, uint8_t type, uint8_t ep);
-struct usb_host_interface *rtw_usb_altnum_to_altsetting(const struct usb_interface *intf, uint8_t alt_index);
-struct usb_interface *rtw_usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no);
-void *rtw_usbd_get_intfdata(struct usb_interface *intf);
-void rtw_usb_linux_register(void *arg);
-void rtw_usb_linux_deregister(void *arg);
-void rtw_usb_linux_free_device(struct usb_device *dev);
-void rtw_usb_free_urb(struct urb *urb);
-void rtw_usb_init_urb(struct urb *urb);
-void rtw_usb_kill_urb(struct urb *urb);
-void rtw_usb_set_intfdata(struct usb_interface *intf, void *data);
-void rtw_usb_fill_bulk_urb(struct urb *urb, struct usb_device *udev,
- struct usb_host_endpoint *uhe, void *buf,
- int length, usb_complete_t callback, void *arg);
-int rtw_usb_bulk_msg(struct usb_device *udev, struct usb_host_endpoint *uhe,
- void *data, int len, uint16_t *pactlen, usb_timeout_t timeout);
-void *usb_get_intfdata(struct usb_interface *intf);
-int usb_linux_init_endpoints(struct usb_device *udev);
-
-
-
-typedef struct urb * PURB;
-
-typedef unsigned gfp_t;
-#define __GFP_WAIT ((gfp_t)0x10u) /* Can wait and reschedule? */
-#define __GFP_HIGH ((gfp_t)0x20u) /* Should access emergency pools? */
-#define __GFP_IO ((gfp_t)0x40u) /* Can start physical IO? */
-#define __GFP_FS ((gfp_t)0x80u) /* Can call down to low-level FS? */
-#define __GFP_COLD ((gfp_t)0x100u) /* Cache-cold page required */
-#define __GFP_NOWARN ((gfp_t)0x200u) /* Suppress page allocation failure warning */
-#define __GFP_REPEAT ((gfp_t)0x400u) /* Retry the allocation. Might fail */
-#define __GFP_NOFAIL ((gfp_t)0x800u) /* Retry for ever. Cannot fail */
-#define __GFP_NORETRY ((gfp_t)0x1000u)/* Do not retry. Might fail */
-#define __GFP_NO_GROW ((gfp_t)0x2000u)/* Slab internal usage */
-#define __GFP_COMP ((gfp_t)0x4000u)/* Add compound page metadata */
-#define __GFP_ZERO ((gfp_t)0x8000u)/* Return zeroed page on success */
-#define __GFP_NOMEMALLOC ((gfp_t)0x10000u) /* Don't use emergency reserves */
-#define __GFP_HARDWALL ((gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
-
-/* This equals 0, but use constants in case they ever change */
-#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
-/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
-#define GFP_ATOMIC (__GFP_HIGH)
-#define GFP_NOIO (__GFP_WAIT)
-#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
-#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
-#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
-#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
- __GFP_HIGHMEM)
-
-
-#endif // kenny add Linux compatibility code for Linux USB
-
-__inline static _list *get_next(_list *list)
-{
- return list->next;
-}
-
-__inline static _list *get_list_head(_queue *queue)
-{
- return (&(queue->queue));
-}
-
-
-#define LIST_CONTAINOR(ptr, type, member) \
- ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
-
-
-__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
-{
- spin_lock_irqsave(plock, *pirqL);
-}
-
-__inline static void _exit_critical(_lock *plock, _irqL *pirqL)
-{
- spin_unlock_irqrestore(plock, *pirqL);
-}
-
-__inline static void _enter_critical_ex(_lock *plock, _irqL *pirqL)
-{
- spin_lock_irqsave(plock, *pirqL);
-}
-
-__inline static void _exit_critical_ex(_lock *plock, _irqL *pirqL)
-{
- spin_unlock_irqrestore(plock, *pirqL);
-}
-
-__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)
-{
- spin_lock_bh(plock, *pirqL);
-}
-
-__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)
-{
- spin_unlock_bh(plock, *pirqL);
-}
-
-__inline static void _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
-{
-
- mtx_lock(pmutex);
-
-}
-
-
-__inline static void _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
-{
-
- mtx_unlock(pmutex);
-
-}
-static inline void __list_del(struct list_head * prev, struct list_head * next)
-{
- next->prev = prev;
- prev->next = next;
-}
-static inline void INIT_LIST_HEAD(struct list_head *list)
-{
- list->next = list;
- list->prev = list;
-}
-__inline static void rtw_list_delete(_list *plist)
-{
- __list_del(plist->prev, plist->next);
- INIT_LIST_HEAD(plist);
-}
-
-__inline static void _init_timer(_timer *ptimer,_nic_hdl padapter,void *pfunc,void* cntx)
-{
- ptimer->function = pfunc;
- ptimer->arg = cntx;
- callout_init(&ptimer->callout, CALLOUT_MPSAFE);
-}
-
-__inline static void _set_timer(_timer *ptimer,u32 delay_time)
-{
- // mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
- if(ptimer->function && ptimer->arg){
- rtw_mtx_lock(NULL);
- callout_reset(&ptimer->callout, delay_time,ptimer->function, ptimer->arg);
- rtw_mtx_unlock(NULL);
- }
-}
-
-__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
-{
- // del_timer_sync(ptimer);
- // *bcancelled= _TRUE;//TRUE ==1; FALSE==0
- rtw_mtx_lock(NULL);
- callout_drain(&ptimer->callout);
- rtw_mtx_unlock(NULL);
-}
-
-__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
-{
- printf("%s Not implement yet! \n",__FUNCTION__);
-}
-
-__inline static void _set_workitem(_workitem *pwork)
-{
- printf("%s Not implement yet! \n",__FUNCTION__);
-// schedule_work(pwork);
-}
-
-//
-// Global Mutex: can only be used at PASSIVE level.
-//
-
-#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
-{ \
-}
-
-#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
-{ \
-}
-
-#define ATOMIC_INIT(i) { (i) }
-
-static __inline void thread_enter(char *name);
-
-//Atomic integer operations
-typedef uint32_t ATOMIC_T ;
-
-#define rtw_netdev_priv(netdev) (((struct ifnet *)netdev)->if_softc)
-
-#define rtw_free_netdev(netdev) if_free((netdev))
-
-#define NDEV_FMT "%s"
-#define NDEV_ARG(ndev) ""
-#define ADPT_FMT "%s"
-#define ADPT_ARG(adapter) ""
-#define FUNC_NDEV_FMT "%s"
-#define FUNC_NDEV_ARG(ndev) __func__
-#define FUNC_ADPT_FMT "%s"
-#define FUNC_ADPT_ARG(adapter) __func__
-
-#define STRUCT_PACKED
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __OSDEP_BSD_SERVICE_H_
+#define __OSDEP_BSD_SERVICE_H_
+
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/param.h>
+#include <sys/sockio.h>
+#include <sys/sysctl.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/mbuf.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kdb.h>
+#include <sys/kthread.h>
+#include <sys/malloc.h>
+#include <sys/time.h>
+#include <machine/atomic.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/rman.h>
+
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/ethernet.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+#include <net/route.h>
+
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#include <netinet/if_ether.h>
+#include <if_ether.h>
+
+#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_regdomain.h>
+#include <net80211/ieee80211_radiotap.h>
+#include <net80211/ieee80211_ratectl.h>
+
+#include <dev/usb/usb.h>
+#include <dev/usb/usbdi.h>
+#include "usbdevs.h"
+
+#define USB_DEBUG_VAR rum_debug
+#include <dev/usb/usb_debug.h>
+
+#if 1 //Baron porting from linux, it's all temp solution, needs to check again
+#include <sys/sema.h>
+#include <sys/pcpu.h> /* XXX for PCPU_GET */
+// typedef struct semaphore _sema;
+ typedef struct sema _sema;
+// typedef spinlock_t _lock;
+ typedef struct mtx _lock;
+ typedef struct mtx _mutex;
+ typedef struct timer_list _timer;
+ struct list_head {
+ struct list_head *next, *prev;
+ };
+ struct __queue {
+ struct list_head queue;
+ _lock lock;
+ };
+
+ //typedef struct sk_buff _pkt;
+ typedef struct mbuf _pkt;
+ typedef struct mbuf _buffer;
+
+ typedef struct __queue _queue;
+ typedef struct list_head _list;
+ typedef int _OS_STATUS;
+ //typedef u32 _irqL;
+ typedef unsigned long _irqL;
+ typedef struct ifnet * _nic_hdl;
+
+ typedef pid_t _thread_hdl_;
+// typedef struct thread _thread_hdl_;
+ typedef void thread_return;
+ typedef void* thread_context;
+
+ //#define thread_exit() complete_and_exit(NULL, 0)
+
+ #define thread_exit() do{printf("%s", "RTKTHREAD_exit");}while(0)
+
+ typedef void timer_hdl_return;
+ typedef void* timer_hdl_context;
+ typedef struct work_struct _workitem;
+
+#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+/* emulate a modern version */
+#define LINUX_VERSION_CODE KERNEL_VERSION(2, 6, 35)
+
+#define WIRELESS_EXT -1
+#define HZ hz
+#define spin_lock_irqsave mtx_lock_irqsave
+#define spin_lock_bh mtx_lock_irqsave
+#define mtx_lock_irqsave(lock, x) mtx_lock(lock)//{local_irq_save((x)); mtx_lock_spin((lock));}
+//#define IFT_RTW 0xf9 //ifnet allocate type for RTW
+#define free_netdev if_free
+#define LIST_CONTAINOR(ptr, type, member) \
+ ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
+#define container_of(p,t,n) (t*)((p)-&(((t*)0)->n))
+/*
+ * Linux timers are emulated using FreeBSD callout functions
+ * (and taskqueue functionality).
+ *
+ * Currently no timer stats functionality.
+ *
+ * See (linux_compat) processes.c
+ *
+ */
+struct timer_list {
+
+ /* FreeBSD callout related fields */
+ struct callout callout;
+
+ //timeout function
+ void (*function)(void*);
+ //argument
+ void *arg;
+
+};
+struct workqueue_struct;
+struct work_struct;
+typedef void (*work_func_t)(struct work_struct *work);
+/* Values for the state of an item of work (work_struct) */
+typedef enum work_state {
+ WORK_STATE_UNSET = 0,
+ WORK_STATE_CALLOUT_PENDING = 1,
+ WORK_STATE_TASK_PENDING = 2,
+ WORK_STATE_WORK_CANCELLED = 3
+} work_state_t;
+
+struct work_struct {
+ struct task task; /* FreeBSD task */
+ work_state_t state; /* the pending or otherwise state of work. */
+ work_func_t func;
+};
+#define spin_unlock_irqrestore mtx_unlock_irqrestore
+#define spin_unlock_bh mtx_unlock_irqrestore
+#define mtx_unlock_irqrestore(lock,x) mtx_unlock(lock);
+extern void _rtw_spinlock_init(_lock *plock);
+
+//modify private structure to match freebsd
+#define BITS_PER_LONG 32
+union ktime {
+ s64 tv64;
+#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
+ struct {
+#ifdef __BIG_ENDIAN
+ s32 sec, nsec;
+#else
+ s32 nsec, sec;
+#endif
+ } tv;
+#endif
+};
+#define kmemcheck_bitfield_begin(name)
+#define kmemcheck_bitfield_end(name)
+#define CHECKSUM_NONE 0
+typedef unsigned char *sk_buff_data_t;
+typedef union ktime ktime_t; /* Kill this */
+
+void rtw_mtx_lock(_lock *plock);
+
+void rtw_mtx_unlock(_lock *plock);
+
+/**
+ * struct sk_buff - socket buffer
+ * @next: Next buffer in list
+ * @prev: Previous buffer in list
+ * @sk: Socket we are owned by
+ * @tstamp: Time we arrived
+ * @dev: Device we arrived on/are leaving by
+ * @transport_header: Transport layer header
+ * @network_header: Network layer header
+ * @mac_header: Link layer header
+ * @_skb_refdst: destination entry (with norefcount bit)
+ * @sp: the security path, used for xfrm
+ * @cb: Control buffer. Free for use by every layer. Put private vars here
+ * @len: Length of actual data
+ * @data_len: Data length
+ * @mac_len: Length of link layer header
+ * @hdr_len: writable header length of cloned skb
+ * @csum: Checksum (must include start/offset pair)
+ * @csum_start: Offset from skb->head where checksumming should start
+ * @csum_offset: Offset from csum_start where checksum should be stored
+ * @local_df: allow local fragmentation
+ * @cloned: Head may be cloned (check refcnt to be sure)
+ * @nohdr: Payload reference only, must not modify header
+ * @pkt_type: Packet class
+ * @fclone: skbuff clone status
+ * @ip_summed: Driver fed us an IP checksum
+ * @priority: Packet queueing priority
+ * @users: User count - see {datagram,tcp}.c
+ * @protocol: Packet protocol from driver
+ * @truesize: Buffer size
+ * @head: Head of buffer
+ * @data: Data head pointer
+ * @tail: Tail pointer
+ * @end: End pointer
+ * @destructor: Destruct function
+ * @mark: Generic packet mark
+ * @nfct: Associated connection, if any
+ * @ipvs_property: skbuff is owned by ipvs
+ * @peeked: this packet has been seen already, so stats have been
+ * done for it, don't do them again
+ * @nf_trace: netfilter packet trace flag
+ * @nfctinfo: Relationship of this skb to the connection
+ * @nfct_reasm: netfilter conntrack re-assembly pointer
+ * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
+ * @skb_iif: ifindex of device we arrived on
+ * @rxhash: the packet hash computed on receive
+ * @queue_mapping: Queue mapping for multiqueue devices
+ * @tc_index: Traffic control index
+ * @tc_verd: traffic control verdict
+ * @ndisc_nodetype: router type (from link layer)
+ * @dma_cookie: a cookie to one of several possible DMA operations
+ * done by skb DMA functions
+ * @secmark: security marking
+ * @vlan_tci: vlan tag control information
+ */
+
+struct sk_buff {
+ /* These two members must be first. */
+ struct sk_buff *next;
+ struct sk_buff *prev;
+
+ ktime_t tstamp;
+
+ struct sock *sk;
+ //struct net_device *dev;
+ struct ifnet *dev;
+
+ /*
+ * This is the control buffer. It is free to use for every
+ * layer. Please put your private variables there. If you
+ * want to keep them across layers you have to do a skb_clone()
+ * first. This is owned by whoever has the skb queued ATM.
+ */
+ char cb[48] __aligned(8);
+
+ unsigned long _skb_refdst;
+#ifdef CONFIG_XFRM
+ struct sec_path *sp;
+#endif
+ unsigned int len,
+ data_len;
+ u16 mac_len,
+ hdr_len;
+ union {
+ u32 csum;
+ struct {
+ u16 csum_start;
+ u16 csum_offset;
+ }smbol2;
+ }smbol1;
+ u32 priority;
+ kmemcheck_bitfield_begin(flags1);
+ u8 local_df:1,
+ cloned:1,
+ ip_summed:2,
+ nohdr:1,
+ nfctinfo:3;
+ u8 pkt_type:3,
+ fclone:2,
+ ipvs_property:1,
+ peeked:1,
+ nf_trace:1;
+ kmemcheck_bitfield_end(flags1);
+ u16 protocol;
+
+ void (*destructor)(struct sk_buff *skb);
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
+ struct nf_conntrack *nfct;
+ struct sk_buff *nfct_reasm;
+#endif
+#ifdef CONFIG_BRIDGE_NETFILTER
+ struct nf_bridge_info *nf_bridge;
+#endif
+
+ int skb_iif;
+#ifdef CONFIG_NET_SCHED
+ u16 tc_index; /* traffic control index */
+#ifdef CONFIG_NET_CLS_ACT
+ u16 tc_verd; /* traffic control verdict */
+#endif
+#endif
+
+ u32 rxhash;
+
+ kmemcheck_bitfield_begin(flags2);
+ u16 queue_mapping:16;
+#ifdef CONFIG_IPV6_NDISC_NODETYPE
+ u8 ndisc_nodetype:2,
+ deliver_no_wcard:1;
+#else
+ u8 deliver_no_wcard:1;
+#endif
+ kmemcheck_bitfield_end(flags2);
+
+ /* 0/14 bit hole */
+
+#ifdef CONFIG_NET_DMA
+ dma_cookie_t dma_cookie;
+#endif
+#ifdef CONFIG_NETWORK_SECMARK
+ u32 secmark;
+#endif
+ union {
+ u32 mark;
+ u32 dropcount;
+ }symbol3;
+
+ u16 vlan_tci;
+
+ sk_buff_data_t transport_header;
+ sk_buff_data_t network_header;
+ sk_buff_data_t mac_header;
+ /* These elements must be at the end, see alloc_skb() for details. */
+ sk_buff_data_t tail;
+ sk_buff_data_t end;
+ unsigned char *head,
+ *data;
+ unsigned int truesize;
+ atomic_t users;
+};
+struct sk_buff_head {
+ /* These two members must be first. */
+ struct sk_buff *next;
+ struct sk_buff *prev;
+
+ u32 qlen;
+ _lock lock;
+};
+#define skb_tail_pointer(skb) skb->tail
+static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
+{
+ unsigned char *tmp = skb_tail_pointer(skb);
+ //SKB_LINEAR_ASSERT(skb);
+ skb->tail += len;
+ skb->len += len;
+ return tmp;
+}
+
+static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
+{
+ skb->len -= len;
+ if(skb->len < skb->data_len)
+ printf("%s(),%d,error!\n",__FUNCTION__,__LINE__);
+ return skb->data += len;
+}
+static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
+{
+ #ifdef PLATFORM_FREEBSD
+ return __skb_pull(skb, len);
+ #else
+ return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
+ #endif //PLATFORM_FREEBSD
+}
+static inline u32 skb_queue_len(const struct sk_buff_head *list_)
+{
+ return list_->qlen;
+}
+static inline void __skb_insert(struct sk_buff *newsk,
+ struct sk_buff *prev, struct sk_buff *next,
+ struct sk_buff_head *list)
+{
+ newsk->next = next;
+ newsk->prev = prev;
+ next->prev = prev->next = newsk;
+ list->qlen++;
+}
+static inline void __skb_queue_before(struct sk_buff_head *list,
+ struct sk_buff *next,
+ struct sk_buff *newsk)
+{
+ __skb_insert(newsk, next->prev, next, list);
+}
+static inline void skb_queue_tail(struct sk_buff_head *list,
+ struct sk_buff *newsk)
+{
+ mtx_lock(&list->lock);
+ __skb_queue_before(list, (struct sk_buff *)list, newsk);
+ mtx_unlock(&list->lock);
+}
+static inline struct sk_buff *skb_peek(struct sk_buff_head *list_)
+{
+ struct sk_buff *list = ((struct sk_buff *)list_)->next;
+ if (list == (struct sk_buff *)list_)
+ list = NULL;
+ return list;
+}
+static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
+{
+ struct sk_buff *next, *prev;
+
+ list->qlen--;
+ next = skb->next;
+ prev = skb->prev;
+ skb->next = skb->prev = NULL;
+ next->prev = prev;
+ prev->next = next;
+}
+
+static inline struct sk_buff *skb_dequeue(struct sk_buff_head *list)
+{
+ mtx_lock(&list->lock);
+
+ struct sk_buff *skb = skb_peek(list);
+ if (skb)
+ __skb_unlink(skb, list);
+
+ mtx_unlock(&list->lock);
+
+ return skb;
+}
+static inline void skb_reserve(struct sk_buff *skb, int len)
+{
+ skb->data += len;
+ skb->tail += len;
+}
+static inline void __skb_queue_head_init(struct sk_buff_head *list)
+{
+ list->prev = list->next = (struct sk_buff *)list;
+ list->qlen = 0;
+}
+/*
+ * This function creates a split out lock class for each invocation;
+ * this is needed for now since a whole lot of users of the skb-queue
+ * infrastructure in drivers have different locking usage (in hardirq)
+ * than the networking core (in softirq only). In the long run either the
+ * network layer or drivers should need annotation to consolidate the
+ * main types of usage into 3 classes.
+ */
+static inline void skb_queue_head_init(struct sk_buff_head *list)
+{
+ _rtw_spinlock_init(&list->lock);
+ __skb_queue_head_init(list);
+}
+unsigned long copy_from_user(void *to, const void *from, unsigned long n);
+unsigned long copy_to_user(void *to, const void *from, unsigned long n);
+struct sk_buff * dev_alloc_skb(unsigned int size);
+struct sk_buff *skb_clone(const struct sk_buff *skb);
+void dev_kfree_skb_any(struct sk_buff *skb);
+#endif //Baron porting from linux, it's all temp solution, needs to check again
+
+
+#if 1 // kenny add Linux compatibility code for Linux USB driver
+#include <dev/usb/usb_compat_linux.h>
+
+#define __init // __attribute ((constructor))
+#define __exit // __attribute ((destructor))
+
+/*
+ * Definitions for module_init and module_exit macros.
+ *
+ * These macros will use the SYSINIT framework to call a specified
+ * function (with no arguments) on module loading or unloading.
+ *
+ */
+
+void module_init_exit_wrapper(void *arg);
+
+#define module_init(initfn) \
+ SYSINIT(mod_init_ ## initfn, \
+ SI_SUB_KLD, SI_ORDER_FIRST, \
+ module_init_exit_wrapper, initfn)
+
+#define module_exit(exitfn) \
+ SYSUNINIT(mod_exit_ ## exitfn, \
+ SI_SUB_KLD, SI_ORDER_ANY, \
+ module_init_exit_wrapper, exitfn)
+
+/*
+ * The usb_register and usb_deregister functions are used to register
+ * usb drivers with the usb subsystem.
+ */
+int usb_register(struct usb_driver *driver);
+int usb_deregister(struct usb_driver *driver);
+
+/*
+ * usb_get_dev and usb_put_dev - increment/decrement the reference count
+ * of the usb device structure.
+ *
+ * Original body of usb_get_dev:
+ *
+ * if (dev)
+ * get_device(&dev->dev);
+ * return dev;
+ *
+ * Reference counts are not currently used in this compatibility
+ * layer. So these functions will do nothing.
+ */
+static inline struct usb_device *
+usb_get_dev(struct usb_device *dev)
+{
+ return dev;
+}
+
+static inline void
+usb_put_dev(struct usb_device *dev)
+{
+ return;
+}
+
+
+// rtw_usb_compat_linux
+int rtw_usb_submit_urb(struct urb *urb, uint16_t mem_flags);
+int rtw_usb_unlink_urb(struct urb *urb);
+int rtw_usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe);
+int rtw_usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
+ uint8_t request, uint8_t requesttype,
+ uint16_t value, uint16_t index, void *data,
+ uint16_t size, usb_timeout_t timeout);
+int rtw_usb_set_interface(struct usb_device *dev, uint8_t iface_no, uint8_t alt_index);
+int rtw_usb_setup_endpoint(struct usb_device *dev,
+ struct usb_host_endpoint *uhe, usb_size_t bufsize);
+struct urb *rtw_usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags);
+struct usb_host_endpoint *rtw_usb_find_host_endpoint(struct usb_device *dev, uint8_t type, uint8_t ep);
+struct usb_host_interface *rtw_usb_altnum_to_altsetting(const struct usb_interface *intf, uint8_t alt_index);
+struct usb_interface *rtw_usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no);
+void *rtw_usbd_get_intfdata(struct usb_interface *intf);
+void rtw_usb_linux_register(void *arg);
+void rtw_usb_linux_deregister(void *arg);
+void rtw_usb_linux_free_device(struct usb_device *dev);
+void rtw_usb_free_urb(struct urb *urb);
+void rtw_usb_init_urb(struct urb *urb);
+void rtw_usb_kill_urb(struct urb *urb);
+void rtw_usb_set_intfdata(struct usb_interface *intf, void *data);
+void rtw_usb_fill_bulk_urb(struct urb *urb, struct usb_device *udev,
+ struct usb_host_endpoint *uhe, void *buf,
+ int length, usb_complete_t callback, void *arg);
+int rtw_usb_bulk_msg(struct usb_device *udev, struct usb_host_endpoint *uhe,
+ void *data, int len, uint16_t *pactlen, usb_timeout_t timeout);
+void *usb_get_intfdata(struct usb_interface *intf);
+int usb_linux_init_endpoints(struct usb_device *udev);
+
+
+
+typedef struct urb * PURB;
+
+typedef unsigned gfp_t;
+#define __GFP_WAIT ((gfp_t)0x10u) /* Can wait and reschedule? */
+#define __GFP_HIGH ((gfp_t)0x20u) /* Should access emergency pools? */
+#define __GFP_IO ((gfp_t)0x40u) /* Can start physical IO? */
+#define __GFP_FS ((gfp_t)0x80u) /* Can call down to low-level FS? */
+#define __GFP_COLD ((gfp_t)0x100u) /* Cache-cold page required */
+#define __GFP_NOWARN ((gfp_t)0x200u) /* Suppress page allocation failure warning */
+#define __GFP_REPEAT ((gfp_t)0x400u) /* Retry the allocation. Might fail */
+#define __GFP_NOFAIL ((gfp_t)0x800u) /* Retry for ever. Cannot fail */
+#define __GFP_NORETRY ((gfp_t)0x1000u)/* Do not retry. Might fail */
+#define __GFP_NO_GROW ((gfp_t)0x2000u)/* Slab internal usage */
+#define __GFP_COMP ((gfp_t)0x4000u)/* Add compound page metadata */
+#define __GFP_ZERO ((gfp_t)0x8000u)/* Return zeroed page on success */
+#define __GFP_NOMEMALLOC ((gfp_t)0x10000u) /* Don't use emergency reserves */
+#define __GFP_HARDWALL ((gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
+
+/* This equals 0, but use constants in case they ever change */
+#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
+/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
+#define GFP_ATOMIC (__GFP_HIGH)
+#define GFP_NOIO (__GFP_WAIT)
+#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
+#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
+#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
+#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
+ __GFP_HIGHMEM)
+
+
+#endif // kenny add Linux compatibility code for Linux USB
+
+__inline static _list *get_next(_list *list)
+{
+ return list->next;
+}
+
+__inline static _list *get_list_head(_queue *queue)
+{
+ return (&(queue->queue));
+}
+
+
+#define LIST_CONTAINOR(ptr, type, member) \
+ ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
+
+
+__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
+{
+ spin_lock_irqsave(plock, *pirqL);
+}
+
+__inline static void _exit_critical(_lock *plock, _irqL *pirqL)
+{
+ spin_unlock_irqrestore(plock, *pirqL);
+}
+
+__inline static void _enter_critical_ex(_lock *plock, _irqL *pirqL)
+{
+ spin_lock_irqsave(plock, *pirqL);
+}
+
+__inline static void _exit_critical_ex(_lock *plock, _irqL *pirqL)
+{
+ spin_unlock_irqrestore(plock, *pirqL);
+}
+
+__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)
+{
+ spin_lock_bh(plock, *pirqL);
+}
+
+__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)
+{
+ spin_unlock_bh(plock, *pirqL);
+}
+
+__inline static void _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
+{
+
+ mtx_lock(pmutex);
+
+}
+
+
+__inline static void _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
+{
+
+ mtx_unlock(pmutex);
+
+}
+static inline void __list_del(struct list_head * prev, struct list_head * next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+static inline void INIT_LIST_HEAD(struct list_head *list)
+{
+ list->next = list;
+ list->prev = list;
+}
+__inline static void rtw_list_delete(_list *plist)
+{
+ __list_del(plist->prev, plist->next);
+ INIT_LIST_HEAD(plist);
+}
+
+__inline static void _init_timer(_timer *ptimer,_nic_hdl padapter,void *pfunc,void* cntx)
+{
+ ptimer->function = pfunc;
+ ptimer->arg = cntx;
+ callout_init(&ptimer->callout, CALLOUT_MPSAFE);
+}
+
+__inline static void _set_timer(_timer *ptimer,u32 delay_time)
+{
+ // mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
+ if(ptimer->function && ptimer->arg){
+ rtw_mtx_lock(NULL);
+ callout_reset(&ptimer->callout, delay_time,ptimer->function, ptimer->arg);
+ rtw_mtx_unlock(NULL);
+ }
+}
+
+__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
+{
+ // del_timer_sync(ptimer);
+ // *bcancelled= _TRUE;//TRUE ==1; FALSE==0
+ rtw_mtx_lock(NULL);
+ callout_drain(&ptimer->callout);
+ rtw_mtx_unlock(NULL);
+}
+
+__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
+{
+ printf("%s Not implement yet! \n",__FUNCTION__);
+}
+
+__inline static void _set_workitem(_workitem *pwork)
+{
+ printf("%s Not implement yet! \n",__FUNCTION__);
+// schedule_work(pwork);
+}
+
+//
+// Global Mutex: can only be used at PASSIVE level.
+//
+
+#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
+{ \
+}
+
+#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
+{ \
+}
+
+#define ATOMIC_INIT(i) { (i) }
+
+static __inline void thread_enter(char *name);
+
+//Atomic integer operations
+typedef uint32_t ATOMIC_T ;
+
+#define rtw_netdev_priv(netdev) (((struct ifnet *)netdev)->if_softc)
+
+#define rtw_free_netdev(netdev) if_free((netdev))
+
+#define NDEV_FMT "%s"
+#define NDEV_ARG(ndev) ""
+#define ADPT_FMT "%s"
+#define ADPT_ARG(adapter) ""
+#define FUNC_NDEV_FMT "%s"
+#define FUNC_NDEV_ARG(ndev) __func__
+#define FUNC_ADPT_FMT "%s"
+#define FUNC_ADPT_ARG(adapter) __func__
+
+#define STRUCT_PACKED
+
+#endif
+
diff --git a/rtl8xxx_EU/include/osdep_service_ce.h b/rtl8xxx_EU/include/osdep_service_ce.h
index 04c5b18..5f2a78a 100755
--- a/rtl8xxx_EU/include/osdep_service_ce.h
+++ b/rtl8xxx_EU/include/osdep_service_ce.h
@@ -16,177 +16,177 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
- ******************************************************************************/
-
-#ifndef __OSDEP_CE_SERVICE_H_
-#define __OSDEP_CE_SERVICE_H_
-
-
-#include <ndis.h>
-#include <ntddndis.h>
-
-#ifdef CONFIG_SDIO_HCI
-#include "SDCardDDK.h"
-#endif
-
-#ifdef CONFIG_USB_HCI
-#include <usbdi.h>
-#endif
-
-typedef HANDLE _sema;
-typedef LIST_ENTRY _list;
-typedef NDIS_STATUS _OS_STATUS;
-
-typedef NDIS_SPIN_LOCK _lock;
-
-typedef HANDLE _rwlock; //Mutex
-
-typedef u32 _irqL;
-
-typedef NDIS_HANDLE _nic_hdl;
-
-
-typedef NDIS_MINIPORT_TIMER _timer;
-
-struct __queue {
- LIST_ENTRY queue;
- _lock lock;
-};
-
-typedef NDIS_PACKET _pkt;
-typedef NDIS_BUFFER _buffer;
-typedef struct __queue _queue;
-
-typedef HANDLE _thread_hdl_;
-typedef DWORD thread_return;
-typedef void* thread_context;
-typedef NDIS_WORK_ITEM _workitem;
-
-#define thread_exit() ExitThread(STATUS_SUCCESS); return 0;
-
-
-#define SEMA_UPBND (0x7FFFFFFF) //8192
-
-__inline static _list *get_prev(_list *list)
-{
- return list->Blink;
-}
-
-__inline static _list *get_next(_list *list)
-{
- return list->Flink;
-}
-
-__inline static _list *get_list_head(_queue *queue)
-{
- return (&(queue->queue));
-}
-
-#define LIST_CONTAINOR(ptr, type, member) CONTAINING_RECORD(ptr, type, member)
-
-__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
-{
- NdisAcquireSpinLock(plock);
-}
-
-__inline static void _exit_critical(_lock *plock, _irqL *pirqL)
-{
- NdisReleaseSpinLock(plock);
-}
-
-__inline static _enter_critical_ex(_lock *plock, _irqL *pirqL)
-{
- NdisDprAcquireSpinLock(plock);
-}
-
-__inline static _exit_critical_ex(_lock *plock, _irqL *pirqL)
-{
- NdisDprReleaseSpinLock(plock);
-}
-
-
-__inline static void _enter_hwio_critical(_rwlock *prwlock, _irqL *pirqL)
-{
- WaitForSingleObject(*prwlock, INFINITE );
-
-}
-
-__inline static void _exit_hwio_critical(_rwlock *prwlock, _irqL *pirqL)
-{
- ReleaseMutex(*prwlock);
-}
-
-__inline static void rtw_list_delete(_list *plist)
-{
- RemoveEntryList(plist);
- InitializeListHead(plist);
-}
-
-#define RTW_TIMER_HDL_ARGS IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3
-
-__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,PVOID cntx)
-{
- NdisMInitializeTimer(ptimer, nic_hdl, pfunc, cntx);
-}
-
-__inline static void _set_timer(_timer *ptimer,u32 delay_time)
-{
- NdisMSetTimer(ptimer,delay_time);
-}
-
-__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
-{
- NdisMCancelTimer(ptimer,bcancelled);
-}
-
-__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
-{
-
- NdisInitializeWorkItem(pwork, pfunc, cntx);
-}
-
-__inline static void _set_workitem(_workitem *pwork)
-{
- NdisScheduleWorkItem(pwork);
-}
-
-#define ATOMIC_INIT(i) { (i) }
-
-//
-// Global Mutex: can only be used at PASSIVE level.
-//
-
-#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
-{ \
- while (NdisInterlockedIncrement((PULONG)&(_MutexCounter)) != 1)\
- { \
- NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
- NdisMSleep(10000); \
- } \
-}
-
-#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
-{ \
- NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
-}
-
-// limitation of path length
-#define PATH_LENGTH_MAX MAX_PATH
-
-//Atomic integer operations
-#define ATOMIC_T LONG
-
-#define NDEV_FMT "%s"
-#define NDEV_ARG(ndev) ""
-#define ADPT_FMT "%s"
-#define ADPT_ARG(adapter) ""
-#define FUNC_NDEV_FMT "%s"
-#define FUNC_NDEV_ARG(ndev) __func__
-#define FUNC_ADPT_FMT "%s"
-#define FUNC_ADPT_ARG(adapter) __func__
-
-#define STRUCT_PACKED
-
-
-#endif
-
+ ******************************************************************************/
+
+#ifndef __OSDEP_CE_SERVICE_H_
+#define __OSDEP_CE_SERVICE_H_
+
+
+#include <ndis.h>
+#include <ntddndis.h>
+
+#ifdef CONFIG_SDIO_HCI
+#include "SDCardDDK.h"
+#endif
+
+#ifdef CONFIG_USB_HCI
+#include <usbdi.h>
+#endif
+
+typedef HANDLE _sema;
+typedef LIST_ENTRY _list;
+typedef NDIS_STATUS _OS_STATUS;
+
+typedef NDIS_SPIN_LOCK _lock;
+
+typedef HANDLE _rwlock; //Mutex
+
+typedef u32 _irqL;
+
+typedef NDIS_HANDLE _nic_hdl;
+
+
+typedef NDIS_MINIPORT_TIMER _timer;
+
+struct __queue {
+ LIST_ENTRY queue;
+ _lock lock;
+};
+
+typedef NDIS_PACKET _pkt;
+typedef NDIS_BUFFER _buffer;
+typedef struct __queue _queue;
+
+typedef HANDLE _thread_hdl_;
+typedef DWORD thread_return;
+typedef void* thread_context;
+typedef NDIS_WORK_ITEM _workitem;
+
+#define thread_exit() ExitThread(STATUS_SUCCESS); return 0;
+
+
+#define SEMA_UPBND (0x7FFFFFFF) //8192
+
+__inline static _list *get_prev(_list *list)
+{
+ return list->Blink;
+}
+
+__inline static _list *get_next(_list *list)
+{
+ return list->Flink;
+}
+
+__inline static _list *get_list_head(_queue *queue)
+{
+ return (&(queue->queue));
+}
+
+#define LIST_CONTAINOR(ptr, type, member) CONTAINING_RECORD(ptr, type, member)
+
+__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
+{
+ NdisAcquireSpinLock(plock);
+}
+
+__inline static void _exit_critical(_lock *plock, _irqL *pirqL)
+{
+ NdisReleaseSpinLock(plock);
+}
+
+__inline static _enter_critical_ex(_lock *plock, _irqL *pirqL)
+{
+ NdisDprAcquireSpinLock(plock);
+}
+
+__inline static _exit_critical_ex(_lock *plock, _irqL *pirqL)
+{
+ NdisDprReleaseSpinLock(plock);
+}
+
+
+__inline static void _enter_hwio_critical(_rwlock *prwlock, _irqL *pirqL)
+{
+ WaitForSingleObject(*prwlock, INFINITE );
+
+}
+
+__inline static void _exit_hwio_critical(_rwlock *prwlock, _irqL *pirqL)
+{
+ ReleaseMutex(*prwlock);
+}
+
+__inline static void rtw_list_delete(_list *plist)
+{
+ RemoveEntryList(plist);
+ InitializeListHead(plist);
+}
+
+#define RTW_TIMER_HDL_ARGS IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3
+
+__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,PVOID cntx)
+{
+ NdisMInitializeTimer(ptimer, nic_hdl, pfunc, cntx);
+}
+
+__inline static void _set_timer(_timer *ptimer,u32 delay_time)
+{
+ NdisMSetTimer(ptimer,delay_time);
+}
+
+__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
+{
+ NdisMCancelTimer(ptimer,bcancelled);
+}
+
+__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
+{
+
+ NdisInitializeWorkItem(pwork, pfunc, cntx);
+}
+
+__inline static void _set_workitem(_workitem *pwork)
+{
+ NdisScheduleWorkItem(pwork);
+}
+
+#define ATOMIC_INIT(i) { (i) }
+
+//
+// Global Mutex: can only be used at PASSIVE level.
+//
+
+#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
+{ \
+ while (NdisInterlockedIncrement((PULONG)&(_MutexCounter)) != 1)\
+ { \
+ NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
+ NdisMSleep(10000); \
+ } \
+}
+
+#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
+{ \
+ NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
+}
+
+// limitation of path length
+#define PATH_LENGTH_MAX MAX_PATH
+
+//Atomic integer operations
+#define ATOMIC_T LONG
+
+#define NDEV_FMT "%s"
+#define NDEV_ARG(ndev) ""
+#define ADPT_FMT "%s"
+#define ADPT_ARG(adapter) ""
+#define FUNC_NDEV_FMT "%s"
+#define FUNC_NDEV_ARG(ndev) __func__
+#define FUNC_ADPT_FMT "%s"
+#define FUNC_ADPT_ARG(adapter) __func__
+
+#define STRUCT_PACKED
+
+
+#endif
+
diff --git a/rtl8xxx_EU/include/osdep_service_linux.h b/rtl8xxx_EU/include/osdep_service_linux.h
index 894169d..1f44f87 100755
--- a/rtl8xxx_EU/include/osdep_service_linux.h
+++ b/rtl8xxx_EU/include/osdep_service_linux.h
@@ -1,405 +1,413 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __OSDEP_LINUX_SERVICE_H_
-#define __OSDEP_LINUX_SERVICE_H_
-
- #include <linux/version.h>
- #include <linux/spinlock.h>
- #include <linux/compiler.h>
- #include <linux/kernel.h>
- #include <linux/errno.h>
- #include <linux/init.h>
- #include <linux/slab.h>
- #include <linux/module.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5))
- #include <linux/kref.h>
-#endif
- //#include <linux/smp_lock.h>
- #include <linux/netdevice.h>
- #include <linux/skbuff.h>
- #include <linux/circ_buf.h>
- #include <asm/uaccess.h>
- #include <asm/byteorder.h>
- #include <asm/atomic.h>
- #include <asm/io.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
- #include <asm/semaphore.h>
-#else
- #include <linux/semaphore.h>
-#endif
- #include <linux/sem.h>
- #include <linux/sched.h>
- #include <linux/etherdevice.h>
- #include <linux/wireless.h>
- #include <net/iw_handler.h>
- #include <linux/if_arp.h>
- #include <linux/rtnetlink.h>
- #include <linux/delay.h>
- #include <linux/interrupt.h> // for struct tasklet_struct
- #include <linux/ip.h>
- #include <linux/kthread.h>
- #include <linux/list.h>
- #include <linux/vmalloc.h>
-
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,41))
- #include <linux/tqueue.h>
-#endif
-
-#ifdef RTK_DMP_PLATFORM
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
- #include <linux/pageremap.h>
-#endif
- #include <asm/io.h>
-#endif
-
-#ifdef CONFIG_IOCTL_CFG80211
-// #include <linux/ieee80211.h>
- #include <net/ieee80211_radiotap.h>
- #include <net/cfg80211.h>
-#endif //CONFIG_IOCTL_CFG80211
-
-#ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
- #include <linux/in.h>
- #include <linux/udp.h>
-#endif
-
-#ifdef CONFIG_HAS_EARLYSUSPEND
- #include <linux/earlysuspend.h>
-#endif //CONFIG_HAS_EARLYSUSPEND
-
-#ifdef CONFIG_EFUSE_CONFIG_FILE
- #include <linux/fs.h>
-#endif //CONFIG_EFUSE_CONFIG_FILE
-
-#ifdef CONFIG_USB_HCI
- #include <linux/usb.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
- #include <linux/usb_ch9.h>
-#else
- #include <linux/usb/ch9.h>
-#endif
-#endif
-
-#ifdef CONFIG_USB_HCI
- typedef struct urb * PURB;
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22))
-#ifdef CONFIG_USB_SUSPEND
-#define CONFIG_AUTOSUSPEND 1
-#endif
-#endif
-#endif
-
- typedef struct semaphore _sema;
- typedef spinlock_t _lock;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- typedef struct mutex _mutex;
-#else
- typedef struct semaphore _mutex;
-#endif
- typedef struct timer_list _timer;
-
- struct __queue {
- struct list_head queue;
- _lock lock;
- };
-
- typedef struct sk_buff _pkt;
- typedef unsigned char _buffer;
-
- typedef struct __queue _queue;
- typedef struct list_head _list;
- typedef int _OS_STATUS;
- //typedef u32 _irqL;
- typedef unsigned long _irqL;
- typedef struct net_device * _nic_hdl;
-
- typedef void* _thread_hdl_;
- typedef int thread_return;
- typedef void* thread_context;
-
- #define thread_exit() complete_and_exit(NULL, 0)
-
- typedef void timer_hdl_return;
- typedef void* timer_hdl_context;
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
- typedef struct work_struct _workitem;
-#else
- typedef struct tq_struct _workitem;
-#endif
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
- #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
-#endif
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
-// Porting from linux kernel, for compatible with old kernel.
-static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
-{
- return skb->tail;
-}
-
-static inline void skb_reset_tail_pointer(struct sk_buff *skb)
-{
- skb->tail = skb->data;
-}
-
-static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
-{
- skb->tail = skb->data + offset;
-}
-
-static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
-{
- return skb->end;
-}
-#endif
-
-__inline static _list *get_next(_list *list)
-{
- return list->next;
-}
-
-__inline static _list *get_list_head(_queue *queue)
-{
- return (&(queue->queue));
-}
-
-
-#define LIST_CONTAINOR(ptr, type, member) \
- ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
-
-
-__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
-{
- spin_lock_irqsave(plock, *pirqL);
-}
-
-__inline static void _exit_critical(_lock *plock, _irqL *pirqL)
-{
- spin_unlock_irqrestore(plock, *pirqL);
-}
-
-__inline static void _enter_critical_ex(_lock *plock, _irqL *pirqL)
-{
- spin_lock_irqsave(plock, *pirqL);
-}
-
-__inline static void _exit_critical_ex(_lock *plock, _irqL *pirqL)
-{
- spin_unlock_irqrestore(plock, *pirqL);
-}
-
-__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)
-{
- spin_lock_bh(plock);
-}
-
-__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)
-{
- spin_unlock_bh(plock);
-}
-
-__inline static int _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
-{
- int ret = 0;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- //mutex_lock(pmutex);
- ret = mutex_lock_interruptible(pmutex);
-#else
- ret = down_interruptible(pmutex);
-#endif
- return ret;
-}
-
-
-__inline static void _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- mutex_unlock(pmutex);
-#else
- up(pmutex);
-#endif
-}
-
-__inline static void rtw_list_delete(_list *plist)
-{
- list_del_init(plist);
-}
-
-#define RTW_TIMER_HDL_ARGS void *FunctionContext
-
-__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx)
-{
- //setup_timer(ptimer, pfunc,(u32)cntx);
- ptimer->function = pfunc;
- ptimer->data = (unsigned long)cntx;
- init_timer(ptimer);
-}
-
-__inline static void _set_timer(_timer *ptimer,u32 delay_time)
-{
- mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
-}
-
-__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
-{
- del_timer_sync(ptimer);
- *bcancelled= _TRUE;//TRUE ==1; FALSE==0
-}
-
-
-__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
- INIT_WORK(pwork, pfunc);
-#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
- INIT_WORK(pwork, pfunc,pwork);
-#else
- INIT_TQUEUE(pwork, pfunc,pwork);
-#endif
-}
-
-__inline static void _set_workitem(_workitem *pwork)
-{
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
- schedule_work(pwork);
-#else
- schedule_task(pwork);
-#endif
-}
-
-__inline static void _cancel_workitem_sync(_workitem *pwork)
-{
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22))
- cancel_work_sync(pwork);
-#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
- flush_scheduled_work();
-#else
- flush_scheduled_tasks();
-#endif
-}
-//
-// Global Mutex: can only be used at PASSIVE level.
-//
-
-#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
-{ \
- while (atomic_inc_return((atomic_t *)&(_MutexCounter)) != 1)\
- { \
- atomic_dec((atomic_t *)&(_MutexCounter)); \
- msleep(10); \
- } \
-}
-
-#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
-{ \
- atomic_dec((atomic_t *)&(_MutexCounter)); \
-}
-
-static inline int rtw_netif_queue_stopped(struct net_device *pnetdev)
-{
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
- return (netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) &&
- netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 1)) &&
- netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 2)) &&
- netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3)) );
-#else
- return netif_queue_stopped(pnetdev);
-#endif
-}
-
-static inline void rtw_netif_wake_queue(struct net_device *pnetdev)
-{
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
- netif_tx_wake_all_queues(pnetdev);
-#else
- netif_wake_queue(pnetdev);
-#endif
-}
-
-static inline void rtw_netif_start_queue(struct net_device *pnetdev)
-{
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
- netif_tx_start_all_queues(pnetdev);
-#else
- netif_start_queue(pnetdev);
-#endif
-}
-
-static inline void rtw_netif_stop_queue(struct net_device *pnetdev)
-{
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
- netif_tx_stop_all_queues(pnetdev);
-#else
- netif_stop_queue(pnetdev);
-#endif
-}
-
-static inline void rtw_merge_string(char *dst, int dst_len, char *src1, char *src2)
-{
- int len = 0;
- len += snprintf(dst+len, dst_len - len, "%s", src1);
- len += snprintf(dst+len, dst_len - len, "%s", src2);
-}
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
-#define rtw_signal_process(pid, sig) kill_pid(find_vpid((pid)),(sig), 1)
-#else //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
-#define rtw_signal_process(pid, sig) kill_proc((pid), (sig), 1)
-#endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
-
-
-// Suspend lock prevent system from going suspend
-#ifdef CONFIG_WAKELOCK
-#include <linux/wakelock.h>
-#elif defined(CONFIG_ANDROID_POWER)
-#include <linux/android_power.h>
-#endif
-
-// limitation of path length
-#define PATH_LENGTH_MAX PATH_MAX
-
-//Atomic integer operations
-#define ATOMIC_T atomic_t
-
-#define rtw_netdev_priv(netdev) ( ((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv )
-
-#define NDEV_FMT "%s"
-#define NDEV_ARG(ndev) ndev->name
-#define ADPT_FMT "%s"
-#define ADPT_ARG(adapter) adapter->pnetdev->name
-#define FUNC_NDEV_FMT "%s(%s)"
-#define FUNC_NDEV_ARG(ndev) __func__, ndev->name
-#define FUNC_ADPT_FMT "%s(%s)"
-#define FUNC_ADPT_ARG(adapter) __func__, adapter->pnetdev->name
-
-struct rtw_netdev_priv_indicator {
- void *priv;
- u32 sizeof_priv;
-};
-struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_priv);
-extern struct net_device * rtw_alloc_etherdev(int sizeof_priv);
-
-#define STRUCT_PACKED __attribute__ ((packed))
-
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __OSDEP_LINUX_SERVICE_H_
+#define __OSDEP_LINUX_SERVICE_H_
+
+ #include <linux/version.h>
+ #include <linux/spinlock.h>
+ #include <linux/compiler.h>
+ #include <linux/kernel.h>
+ #include <linux/errno.h>
+ #include <linux/init.h>
+ #include <linux/slab.h>
+ #include <linux/module.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5))
+ #include <linux/kref.h>
+#endif
+ //#include <linux/smp_lock.h>
+ #include <linux/netdevice.h>
+ #include <linux/skbuff.h>
+ #include <linux/circ_buf.h>
+ #include <asm/uaccess.h>
+ #include <asm/byteorder.h>
+ #include <asm/atomic.h>
+ #include <asm/io.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
+ #include <asm/semaphore.h>
+#else
+ #include <linux/semaphore.h>
+#endif
+ #include <linux/sem.h>
+ #include <linux/sched.h>
+ #include <linux/etherdevice.h>
+ #include <linux/wireless.h>
+ #include <net/iw_handler.h>
+ #include <linux/if_arp.h>
+ #include <linux/rtnetlink.h>
+ #include <linux/delay.h>
+ #include <linux/interrupt.h> // for struct tasklet_struct
+ #include <linux/ip.h>
+ #include <linux/kthread.h>
+ #include <linux/list.h>
+ #include <linux/vmalloc.h>
+
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,41))
+ #include <linux/tqueue.h>
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0))
+ #include <uapi/linux/limits.h>
+#else
+ #include <linux/limits.h>
+#endif
+
+#ifdef RTK_DMP_PLATFORM
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
+ #include <linux/pageremap.h>
+#endif
+ #include <asm/io.h>
+#endif
+
+ /* Monitor mode */
+ #include <net/ieee80211_radiotap.h>
+
+#ifdef CONFIG_IOCTL_CFG80211
+/* #include <linux/ieee80211.h> */
+ #include <net/cfg80211.h>
+#endif //CONFIG_IOCTL_CFG80211
+
+#ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
+ #include <linux/in.h>
+ #include <linux/udp.h>
+#endif
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ #include <linux/earlysuspend.h>
+#endif //CONFIG_HAS_EARLYSUSPEND
+
+#ifdef CONFIG_EFUSE_CONFIG_FILE
+ #include <linux/fs.h>
+#endif //CONFIG_EFUSE_CONFIG_FILE
+
+#ifdef CONFIG_USB_HCI
+ #include <linux/usb.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
+ #include <linux/usb_ch9.h>
+#else
+ #include <linux/usb/ch9.h>
+#endif
+#endif
+
+#ifdef CONFIG_USB_HCI
+ typedef struct urb * PURB;
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22))
+#ifdef CONFIG_USB_SUSPEND
+#define CONFIG_AUTOSUSPEND 1
+#endif
+#endif
+#endif
+
+ typedef struct semaphore _sema;
+ typedef spinlock_t _lock;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ typedef struct mutex _mutex;
+#else
+ typedef struct semaphore _mutex;
+#endif
+ typedef struct timer_list _timer;
+
+ struct __queue {
+ struct list_head queue;
+ _lock lock;
+ };
+
+ typedef struct sk_buff _pkt;
+ typedef unsigned char _buffer;
+
+ typedef struct __queue _queue;
+ typedef struct list_head _list;
+ typedef int _OS_STATUS;
+ //typedef u32 _irqL;
+ typedef unsigned long _irqL;
+ typedef struct net_device * _nic_hdl;
+
+ typedef void* _thread_hdl_;
+ typedef int thread_return;
+ typedef void* thread_context;
+
+ #define thread_exit() complete_and_exit(NULL, 0)
+
+ typedef void timer_hdl_return;
+ typedef void* timer_hdl_context;
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
+ typedef struct work_struct _workitem;
+#else
+ typedef struct tq_struct _workitem;
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
+ #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
+// Porting from linux kernel, for compatible with old kernel.
+static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
+{
+ return skb->tail;
+}
+
+static inline void skb_reset_tail_pointer(struct sk_buff *skb)
+{
+ skb->tail = skb->data;
+}
+
+static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
+{
+ skb->tail = skb->data + offset;
+}
+
+static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
+{
+ return skb->end;
+}
+#endif
+
+__inline static _list *get_next(_list *list)
+{
+ return list->next;
+}
+
+__inline static _list *get_list_head(_queue *queue)
+{
+ return (&(queue->queue));
+}
+
+
+#define LIST_CONTAINOR(ptr, type, member) \
+ ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
+
+
+__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
+{
+ spin_lock_irqsave(plock, *pirqL);
+}
+
+__inline static void _exit_critical(_lock *plock, _irqL *pirqL)
+{
+ spin_unlock_irqrestore(plock, *pirqL);
+}
+
+__inline static void _enter_critical_ex(_lock *plock, _irqL *pirqL)
+{
+ spin_lock_irqsave(plock, *pirqL);
+}
+
+__inline static void _exit_critical_ex(_lock *plock, _irqL *pirqL)
+{
+ spin_unlock_irqrestore(plock, *pirqL);
+}
+
+__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)
+{
+ spin_lock_bh(plock);
+}
+
+__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)
+{
+ spin_unlock_bh(plock);
+}
+
+__inline static int _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
+{
+ int ret = 0;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ //mutex_lock(pmutex);
+ ret = mutex_lock_interruptible(pmutex);
+#else
+ ret = down_interruptible(pmutex);
+#endif
+ return ret;
+}
+
+
+__inline static void _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ mutex_unlock(pmutex);
+#else
+ up(pmutex);
+#endif
+}
+
+__inline static void rtw_list_delete(_list *plist)
+{
+ list_del_init(plist);
+}
+
+#define RTW_TIMER_HDL_ARGS void *FunctionContext
+
+__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx)
+{
+ //setup_timer(ptimer, pfunc,(u32)cntx);
+ ptimer->function = pfunc;
+ ptimer->data = (unsigned long)cntx;
+ init_timer(ptimer);
+}
+
+__inline static void _set_timer(_timer *ptimer,u32 delay_time)
+{
+ mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
+}
+
+__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
+{
+ del_timer_sync(ptimer);
+ *bcancelled= _TRUE;//TRUE ==1; FALSE==0
+}
+
+
+__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ INIT_WORK(pwork, pfunc);
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
+ INIT_WORK(pwork, pfunc,pwork);
+#else
+ INIT_TQUEUE(pwork, pfunc,pwork);
+#endif
+}
+
+__inline static void _set_workitem(_workitem *pwork)
+{
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
+ schedule_work(pwork);
+#else
+ schedule_task(pwork);
+#endif
+}
+
+__inline static void _cancel_workitem_sync(_workitem *pwork)
+{
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22))
+ cancel_work_sync(pwork);
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
+ flush_scheduled_work();
+#else
+ flush_scheduled_tasks();
+#endif
+}
+//
+// Global Mutex: can only be used at PASSIVE level.
+//
+
+#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
+{ \
+ while (atomic_inc_return((atomic_t *)&(_MutexCounter)) != 1)\
+ { \
+ atomic_dec((atomic_t *)&(_MutexCounter)); \
+ msleep(10); \
+ } \
+}
+
+#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
+{ \
+ atomic_dec((atomic_t *)&(_MutexCounter)); \
+}
+
+static inline int rtw_netif_queue_stopped(struct net_device *pnetdev)
+{
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
+ return (netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) &&
+ netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 1)) &&
+ netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 2)) &&
+ netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3)) );
+#else
+ return netif_queue_stopped(pnetdev);
+#endif
+}
+
+static inline void rtw_netif_wake_queue(struct net_device *pnetdev)
+{
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
+ netif_tx_wake_all_queues(pnetdev);
+#else
+ netif_wake_queue(pnetdev);
+#endif
+}
+
+static inline void rtw_netif_start_queue(struct net_device *pnetdev)
+{
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
+ netif_tx_start_all_queues(pnetdev);
+#else
+ netif_start_queue(pnetdev);
+#endif
+}
+
+static inline void rtw_netif_stop_queue(struct net_device *pnetdev)
+{
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
+ netif_tx_stop_all_queues(pnetdev);
+#else
+ netif_stop_queue(pnetdev);
+#endif
+}
+
+static inline void rtw_merge_string(char *dst, int dst_len, char *src1, char *src2)
+{
+ int len = 0;
+ len += snprintf(dst+len, dst_len - len, "%s", src1);
+ len += snprintf(dst+len, dst_len - len, "%s", src2);
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+#define rtw_signal_process(pid, sig) kill_pid(find_vpid((pid)),(sig), 1)
+#else //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+#define rtw_signal_process(pid, sig) kill_proc((pid), (sig), 1)
+#endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+
+
+// Suspend lock prevent system from going suspend
+#ifdef CONFIG_WAKELOCK
+#include <linux/wakelock.h>
+#elif defined(CONFIG_ANDROID_POWER)
+#include <linux/android_power.h>
+#endif
+
+// limitation of path length
+#define PATH_LENGTH_MAX PATH_MAX
+
+//Atomic integer operations
+#define ATOMIC_T atomic_t
+
+#define rtw_netdev_priv(netdev) ( ((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv )
+
+#define NDEV_FMT "%s"
+#define NDEV_ARG(ndev) ndev->name
+#define ADPT_FMT "%s"
+#define ADPT_ARG(adapter) adapter->pnetdev->name
+#define FUNC_NDEV_FMT "%s(%s)"
+#define FUNC_NDEV_ARG(ndev) __func__, ndev->name
+#define FUNC_ADPT_FMT "%s(%s)"
+#define FUNC_ADPT_ARG(adapter) __func__, adapter->pnetdev->name
+
+struct rtw_netdev_priv_indicator {
+ void *priv;
+ u32 sizeof_priv;
+};
+struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_priv);
+extern struct net_device * rtw_alloc_etherdev(int sizeof_priv);
+
+#define STRUCT_PACKED __attribute__ ((packed))
+
+
+#endif
+
diff --git a/rtl8xxx_EU/include/osdep_service_xp.h b/rtl8xxx_EU/include/osdep_service_xp.h
index 45d54af..61b1a00 100755
--- a/rtl8xxx_EU/include/osdep_service_xp.h
+++ b/rtl8xxx_EU/include/osdep_service_xp.h
@@ -1,202 +1,202 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __OSDEP_LINUX_SERVICE_H_
-#define __OSDEP_LINUX_SERVICE_H_
-
- #include <ndis.h>
- #include <ntddk.h>
- #include <ntddndis.h>
- #include <ntdef.h>
-
-#ifdef CONFIG_USB_HCI
- #include <usb.h>
- #include <usbioctl.h>
- #include <usbdlib.h>
-#endif
-
- typedef KSEMAPHORE _sema;
- typedef LIST_ENTRY _list;
- typedef NDIS_STATUS _OS_STATUS;
-
-
- typedef NDIS_SPIN_LOCK _lock;
-
- typedef KMUTEX _mutex;
-
- typedef KIRQL _irqL;
-
- // USB_PIPE for WINCE , but handle can be use just integer under windows
- typedef NDIS_HANDLE _nic_hdl;
-
-
- typedef NDIS_MINIPORT_TIMER _timer;
-
- struct __queue {
- LIST_ENTRY queue;
- _lock lock;
- };
-
- typedef NDIS_PACKET _pkt;
- typedef NDIS_BUFFER _buffer;
- typedef struct __queue _queue;
-
- typedef PKTHREAD _thread_hdl_;
- typedef void thread_return;
- typedef void* thread_context;
-
- typedef NDIS_WORK_ITEM _workitem;
-
- #define thread_exit() PsTerminateSystemThread(STATUS_SUCCESS);
-
- #define HZ 10000000
- #define SEMA_UPBND (0x7FFFFFFF) //8192
-
-__inline static _list *get_next(_list *list)
-{
- return list->Flink;
-}
-
-__inline static _list *get_list_head(_queue *queue)
-{
- return (&(queue->queue));
-}
-
-
-#define LIST_CONTAINOR(ptr, type, member) CONTAINING_RECORD(ptr, type, member)
-
-
-__inline static _enter_critical(_lock *plock, _irqL *pirqL)
-{
- NdisAcquireSpinLock(plock);
-}
-
-__inline static _exit_critical(_lock *plock, _irqL *pirqL)
-{
- NdisReleaseSpinLock(plock);
-}
-
-
-__inline static _enter_critical_ex(_lock *plock, _irqL *pirqL)
-{
- NdisDprAcquireSpinLock(plock);
-}
-
-__inline static _exit_critical_ex(_lock *plock, _irqL *pirqL)
-{
- NdisDprReleaseSpinLock(plock);
-}
-
-__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)
-{
- NdisDprAcquireSpinLock(plock);
-}
-
-__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)
-{
- NdisDprReleaseSpinLock(plock);
-}
-
-__inline static _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
-{
- KeWaitForSingleObject(pmutex, Executive, KernelMode, FALSE, NULL);
-}
-
-
-__inline static _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
-{
- KeReleaseMutex(pmutex, FALSE);
-}
-
-
-__inline static void rtw_list_delete(_list *plist)
-{
- RemoveEntryList(plist);
- InitializeListHead(plist);
-}
-
-#define RTW_TIMER_HDL_ARGS IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3
-
-__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,PVOID cntx)
-{
- NdisMInitializeTimer(ptimer, nic_hdl, pfunc, cntx);
-}
-
-__inline static void _set_timer(_timer *ptimer,u32 delay_time)
-{
- NdisMSetTimer(ptimer,delay_time);
-}
-
-__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
-{
- NdisMCancelTimer(ptimer,bcancelled);
-}
-
-__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
-{
-
- NdisInitializeWorkItem(pwork, pfunc, cntx);
-}
-
-__inline static void _set_workitem(_workitem *pwork)
-{
- NdisScheduleWorkItem(pwork);
-}
-
-
-#define ATOMIC_INIT(i) { (i) }
-
-//
-// Global Mutex: can only be used at PASSIVE level.
-//
-
-#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
-{ \
- while (NdisInterlockedIncrement((PULONG)&(_MutexCounter)) != 1)\
- { \
- NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
- NdisMSleep(10000); \
- } \
-}
-
-#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
-{ \
- NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
-}
-
-// limitation of path length
-#define PATH_LENGTH_MAX MAX_PATH
-
-//Atomic integer operations
-#define ATOMIC_T LONG
-
-
-#define NDEV_FMT "%s"
-#define NDEV_ARG(ndev) ""
-#define ADPT_FMT "%s"
-#define ADPT_ARG(adapter) ""
-#define FUNC_NDEV_FMT "%s"
-#define FUNC_NDEV_ARG(ndev) __func__
-#define FUNC_ADPT_FMT "%s"
-#define FUNC_ADPT_ARG(adapter) __func__
-
-#define STRUCT_PACKED
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __OSDEP_LINUX_SERVICE_H_
+#define __OSDEP_LINUX_SERVICE_H_
+
+ #include <ndis.h>
+ #include <ntddk.h>
+ #include <ntddndis.h>
+ #include <ntdef.h>
+
+#ifdef CONFIG_USB_HCI
+ #include <usb.h>
+ #include <usbioctl.h>
+ #include <usbdlib.h>
+#endif
+
+ typedef KSEMAPHORE _sema;
+ typedef LIST_ENTRY _list;
+ typedef NDIS_STATUS _OS_STATUS;
+
+
+ typedef NDIS_SPIN_LOCK _lock;
+
+ typedef KMUTEX _mutex;
+
+ typedef KIRQL _irqL;
+
+ // USB_PIPE for WINCE , but handle can be use just integer under windows
+ typedef NDIS_HANDLE _nic_hdl;
+
+
+ typedef NDIS_MINIPORT_TIMER _timer;
+
+ struct __queue {
+ LIST_ENTRY queue;
+ _lock lock;
+ };
+
+ typedef NDIS_PACKET _pkt;
+ typedef NDIS_BUFFER _buffer;
+ typedef struct __queue _queue;
+
+ typedef PKTHREAD _thread_hdl_;
+ typedef void thread_return;
+ typedef void* thread_context;
+
+ typedef NDIS_WORK_ITEM _workitem;
+
+ #define thread_exit() PsTerminateSystemThread(STATUS_SUCCESS);
+
+ #define HZ 10000000
+ #define SEMA_UPBND (0x7FFFFFFF) //8192
+
+__inline static _list *get_next(_list *list)
+{
+ return list->Flink;
+}
+
+__inline static _list *get_list_head(_queue *queue)
+{
+ return (&(queue->queue));
+}
+
+
+#define LIST_CONTAINOR(ptr, type, member) CONTAINING_RECORD(ptr, type, member)
+
+
+__inline static _enter_critical(_lock *plock, _irqL *pirqL)
+{
+ NdisAcquireSpinLock(plock);
+}
+
+__inline static _exit_critical(_lock *plock, _irqL *pirqL)
+{
+ NdisReleaseSpinLock(plock);
+}
+
+
+__inline static _enter_critical_ex(_lock *plock, _irqL *pirqL)
+{
+ NdisDprAcquireSpinLock(plock);
+}
+
+__inline static _exit_critical_ex(_lock *plock, _irqL *pirqL)
+{
+ NdisDprReleaseSpinLock(plock);
+}
+
+__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)
+{
+ NdisDprAcquireSpinLock(plock);
+}
+
+__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)
+{
+ NdisDprReleaseSpinLock(plock);
+}
+
+__inline static _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
+{
+ KeWaitForSingleObject(pmutex, Executive, KernelMode, FALSE, NULL);
+}
+
+
+__inline static _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
+{
+ KeReleaseMutex(pmutex, FALSE);
+}
+
+
+__inline static void rtw_list_delete(_list *plist)
+{
+ RemoveEntryList(plist);
+ InitializeListHead(plist);
+}
+
+#define RTW_TIMER_HDL_ARGS IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3
+
+__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,PVOID cntx)
+{
+ NdisMInitializeTimer(ptimer, nic_hdl, pfunc, cntx);
+}
+
+__inline static void _set_timer(_timer *ptimer,u32 delay_time)
+{
+ NdisMSetTimer(ptimer,delay_time);
+}
+
+__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
+{
+ NdisMCancelTimer(ptimer,bcancelled);
+}
+
+__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
+{
+
+ NdisInitializeWorkItem(pwork, pfunc, cntx);
+}
+
+__inline static void _set_workitem(_workitem *pwork)
+{
+ NdisScheduleWorkItem(pwork);
+}
+
+
+#define ATOMIC_INIT(i) { (i) }
+
+//
+// Global Mutex: can only be used at PASSIVE level.
+//
+
+#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
+{ \
+ while (NdisInterlockedIncrement((PULONG)&(_MutexCounter)) != 1)\
+ { \
+ NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
+ NdisMSleep(10000); \
+ } \
+}
+
+#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
+{ \
+ NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
+}
+
+// limitation of path length
+#define PATH_LENGTH_MAX MAX_PATH
+
+//Atomic integer operations
+#define ATOMIC_T LONG
+
+
+#define NDEV_FMT "%s"
+#define NDEV_ARG(ndev) ""
+#define ADPT_FMT "%s"
+#define ADPT_ARG(adapter) ""
+#define FUNC_NDEV_FMT "%s"
+#define FUNC_NDEV_ARG(ndev) __func__
+#define FUNC_ADPT_FMT "%s"
+#define FUNC_ADPT_ARG(adapter) __func__
+
+#define STRUCT_PACKED
+
+#endif
+
diff --git a/rtl8xxx_EU/include/recv_osdep.h b/rtl8xxx_EU/include/recv_osdep.h
index e101337..269ce24 100755
--- a/rtl8xxx_EU/include/recv_osdep.h
+++ b/rtl8xxx_EU/include/recv_osdep.h
@@ -29,6 +29,8 @@ extern s32 rtw_recv_entry(union recv_frame *precv_frame);
extern int rtw_recv_indicatepkt(_adapter *adapter, union recv_frame *precv_frame);
extern void rtw_recv_returnpacket(IN _nic_hdl cnxt, IN _pkt *preturnedpkt);
+extern int rtw_recv_monitor(_adapter *padapter, union recv_frame *precv_frame);
+
extern void rtw_hostapd_mlme_rx(_adapter *padapter, union recv_frame *precv_frame);
extern void rtw_handle_tkip_mic_err(_adapter *padapter,u8 bgroup);
diff --git a/rtl8xxx_EU/include/rtl8188e_hal.h b/rtl8xxx_EU/include/rtl8188e_hal.h
index bf9a8bd..e83ea3a 100755
--- a/rtl8xxx_EU/include/rtl8188e_hal.h
+++ b/rtl8xxx_EU/include/rtl8188e_hal.h
@@ -1,301 +1,304 @@
-/******************************************************************************
- *
- * 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 __RTL8188E_HAL_H__
-#define __RTL8188E_HAL_H__
-
-//#include "hal_com.h"
-#if 1
-#include "hal_data.h"
-#else
-#include "../hal/OUTSRC/odm_precomp.h"
-#endif
-
-//include HAL Related header after HAL Related compiling flags
-#include "rtl8188e_spec.h"
-#include "Hal8188EPhyReg.h"
-#include "Hal8188EPhyCfg.h"
-#include "rtl8188e_rf.h"
-#include "rtl8188e_dm.h"
-#include "rtl8188e_recv.h"
-#include "rtl8188e_xmit.h"
-#include "rtl8188e_cmd.h"
-#include "rtl8188e_led.h"
-#include "Hal8188EPwrSeq.h"
-#ifdef DBG_CONFIG_ERROR_DETECT
-#include "rtl8188e_sreset.h"
-#endif
-
-#if 0
- // Fw Array
- #define Rtl8188E_FwImageArray Rtl8188EFwImgArray
- #define Rtl8188E_FWImgArrayLength Rtl8188EFWImgArrayLength
-#ifdef CONFIG_WOWLAN
- #define Rtl8188E_FwWoWImageArray Array_MP_8188E_FW_WoWLAN
- #define Rtl8188E_FwWoWImgArrayLength ArrayLength_MP_8188E_FW_WoWLAN
-#endif //CONFIG_WOWLAN
-#endif
-
-
- #define RTL8188E_FW_IMG "rtl8188e/FW_NIC.bin"
- #define RTL8188E_FW_WW_IMG "rtl8188e/FW_WoWLAN.bin"
- #define RTL8188E_PHY_REG "rtl8188e/PHY_REG.txt"
- #define RTL8188E_PHY_RADIO_A "rtl8188e/RadioA.txt"
- #define RTL8188E_PHY_RADIO_B "rtl8188e/RadioB.txt"
- #define RTL8188E_TXPWR_TRACK "rtl8188e/TxPowerTrack.txt"
- #define RTL8188E_AGC_TAB "rtl8188e/AGC_TAB.txt"
- #define RTL8188E_PHY_MACREG "rtl8188e/MAC_REG.txt"
- #define RTL8188E_PHY_REG_PG "rtl8188e/PHY_REG_PG.txt"
- #define RTL8188E_PHY_REG_MP "rtl8188e/PHY_REG_MP.txt"
- #define RTL8188E_TXPWR_LMT "rtl8188e/TXPWR_LMT.txt"
-
- //---------------------------------------------------------------------
- // RTL8188E Power Configuration CMDs for USB/SDIO/PCIE interfaces
- //---------------------------------------------------------------------
- #define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow
- #define Rtl8188E_NIC_RF_OFF_FLOW rtl8188E_radio_off_flow
- #define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow
- #define Rtl8188E_NIC_ENABLE_FLOW rtl8188E_card_enable_flow
- #define Rtl8188E_NIC_SUSPEND_FLOW rtl8188E_suspend_flow
- #define Rtl8188E_NIC_RESUME_FLOW rtl8188E_resume_flow
- #define Rtl8188E_NIC_PDN_FLOW rtl8188E_hwpdn_flow
- #define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow
- #define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188E_leave_lps_flow
-
-
-#if 1 // download firmware related data structure
-#define FW_8188E_SIZE 0x4000 //16384,16k
-#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 {
- FIRMWARE_SOURCE eFWSource;
-#ifdef CONFIG_EMBEDDED_FWIMG
- u8* szFwBuffer;
-#else
- u8 szFwBuffer[FW_8188E_SIZE];
-#endif
- u32 ulFwLength;
-} RT_FIRMWARE_8188E, *PRT_FIRMWARE_8188E;
-
-//
-// This structure must be cared byte-ordering
-//
-
-typedef struct _RT_8188E_FIRMWARE_HDR
-{
- // 8-byte alinment required
-
- //--- LONG WORD 0 ----
- u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
- u8 Category; // AP/NIC and USB/PCI
- u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
- u16 Version; // FW Version
- u8 Subversion; // FW Subversion, default 0x00
- u16 Rsvd1;
-
-
- //--- LONG WORD 1 ----
- u8 Month; // Release time Month field
- u8 Date; // Release time Date field
- u8 Hour; // Release time Hour field
- u8 Minute; // Release time Minute field
- u16 RamCodeSize; // The size of RAM code
- u8 Foundry;
- u8 Rsvd2;
-
- //--- LONG WORD 2 ----
- u32 SvnIdx; // The SVN entry index
- u32 Rsvd3;
-
- //--- LONG WORD 3 ----
- u32 Rsvd4;
- u32 Rsvd5;
-}RT_8188E_FIRMWARE_HDR, *PRT_8188E_FIRMWARE_HDR;
-#endif // download firmware related data structure
-
-
-#define DRIVER_EARLY_INT_TIME_8188E 0x05
-#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_TX_REPORT_BUFFER_SIZE 0x0400 // 1k
-
-
-// Note: We will divide number of page equally for each queue other than public queue!
-// 22k = 22528 bytes = 176 pages (@page = 128 bytes)
-// must reserved about 7 pages for LPS => 176-7 = 169 (0xA9)
-// 2*BCN / 1*ps-poll / 1*null-data /1*prob_rsp /1*QOS null-data /1*BT QOS null-data
-
-#define BCNQ_PAGE_NUM_88E 0x08
-
-//For WoWLan , more reserved page
-#ifdef CONFIG_WOWLAN
-#define WOWLAN_PAGE_NUM_88E 0x00
-#else
-#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 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)
-
-// 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
-
-// Note: For Normal Chip Setting, modify later
-#define WMM_NORMAL_PAGE_NUM_HPQ_88E 0x29
-#define WMM_NORMAL_PAGE_NUM_LPQ_88E 0x1C
-#define WMM_NORMAL_PAGE_NUM_NPQ_88E 0x1C
-
-
-//-------------------------------------------------------------------------
-// Chip specific
-//-------------------------------------------------------------------------
-#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3)
-#define CHIP_BONDING_92C_1T2R 0x1
-#define CHIP_BONDING_88C_USB_MCARD 0x2
-#define CHIP_BONDING_88C_USB_HP 0x1
-
-//-------------------------------------------------------------------------
-// Channel Plan
-//-------------------------------------------------------------------------
-
-
-#define EFUSE_REAL_CONTENT_LEN 512
-#define EFUSE_MAP_LEN 128
-#define EFUSE_MAX_SECTION 16
-#define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
-#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN)
-//
-// <Roger_Notes>
-// To prevent out of boundary programming case,
-// leave 1byte and program full section
-// 9bytes + 1byt + 5bytes and pre 1byte.
-// For worst case:
-// | 1byte|----8bytes----|1byte|--5bytes--|
-// | | Reserved(14bytes) |
-//
-#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
-#define EFUSE_MAX_WORD_UNIT_88E 4
-#define EFUSE_IC_ID_OFFSET_88E 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
-#define AVAILABLE_EFUSE_ADDR_88E(addr) (addr < EFUSE_REAL_CONTENT_LEN_88E)
-// <Roger_Notes> To prevent out of boundary programming case, leave 1byte and program full section
-// 9bytes + 1byt + 5bytes and pre 1byte.
-// For worst case:
-// | 2byte|----8bytes----|1byte|--7bytes--| //92D
-#define EFUSE_OOB_PROTECT_BYTES_88E 18 // PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte.
-#define EFUSE_PROTECT_BYTES_BANK_88E 16
-
-
-//========================================================
-// EFUSE for BT definition
-//========================================================
-#define EFUSE_BT_REAL_CONTENT_LEN 1536 // 512*3
-#define EFUSE_BT_MAP_LEN 1024 // 1k bytes
-#define EFUSE_BT_MAX_SECTION 128 // 1024/8
-
-#define EFUSE_PROTECT_BYTES_BANK 16
-
-#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
-#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
-
-//#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE)
-
-//#define RT_IS_FUNC_DISABLED(__pAdapter, __FuncBits) ( (__pAdapter)->DisabledFunctions & (__FuncBits) )
-
-#ifdef CONFIG_PCI_HCI
-void InterruptRecognized8188EE(PADAPTER Adapter, PRT_ISR_CONTENT pIsrContent);
-void UpdateInterruptMask8188EE(PADAPTER Adapter, u32 AddMSR, u32 AddMSR1, u32 RemoveMSR, u32 RemoveMSR1);
-#endif //CONFIG_PCI_HCI
-
-// rtl8188e_hal_init.c
-
-s32 rtl8188e_FirmwareDownload(PADAPTER padapter, BOOLEAN bUsedWoWLANFw);
-void _8051Reset88E(PADAPTER padapter);
-void rtl8188e_InitializeFirmwareVars(PADAPTER padapter);
-
-
-s32 InitLLTTable(PADAPTER padapter, u8 txpktbuf_bndy);
-
-// EFuse
-u8 GetEEPROMSize8188E(PADAPTER padapter);
-void Hal_InitPGData88E(PADAPTER padapter);
-void Hal_EfuseParseIDCode88E(PADAPTER padapter, u8 *hwinfo);
-void Hal_ReadTxPowerInfo88E(PADAPTER padapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-
-void Hal_EfuseParseEEPROMVer88E(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void rtl8188e_EfuseParseChnlPlan(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseCustomerID88E(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_ReadAntennaDiversity88E (PADAPTER pAdapter,u8*PROMContent,BOOLEAN AutoLoadFail);
-void Hal_ReadThermalMeter_88E(PADAPTER Adapter,u8* PROMContent,BOOLEAN AutoloadFail);
-void Hal_EfuseParseXtal_8188E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-void Hal_EfuseParseBoardType88E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-void Hal_ReadPowerSavingMode88E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-
-BOOLEAN HalDetectPwrDownMode88E(PADAPTER Adapter);
-
-#ifdef CONFIG_WOWLAN
-void Hal_DetectWoWMode(PADAPTER pAdapter);
-#endif //CONFIG_WOWLAN
-//RT_CHANNEL_DOMAIN rtl8723a_HalMapChannelPlan(PADAPTER padapter, u8 HalChannelPlan);
-//VERSION_8192C rtl8723a_ReadChipVersion(PADAPTER padapter);
-//void rtl8723a_ReadBluetoothCoexistInfo(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoloadFail);
-void Hal_InitChannelPlan(PADAPTER padapter);
-
-void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc);
-
-// register
-void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits);
-
-void rtl8188e_start_thread(_adapter *padapter);
-void rtl8188e_stop_thread(_adapter *padapter);
-
-void rtw_IOL_cmd_tx_pkt_buf_dump(ADAPTER *Adapter,int data_len);
-#ifdef CONFIG_IOL_EFUSE_PATCH
-s32 rtl8188e_iol_efuse_patch(PADAPTER padapter);
-#endif//CONFIG_IOL_EFUSE_PATCH
-void _InitTransferPageSize(PADAPTER padapter);
-
-void SetHwReg8188E(PADAPTER padapter, u8 variable, u8 *val);
-void GetHwReg8188E(PADAPTER padapter, u8 variable, u8 *val);
-u8 GetHalDefVar8188E(PADAPTER Adapter, HAL_DEF_VARIABLE eVariable, PVOID pValue);
-
-#endif //__RTL8188E_HAL_H__
-
+/******************************************************************************
+ *
+ * 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 __RTL8188E_HAL_H__
+#define __RTL8188E_HAL_H__
+
+//#include "hal_com.h"
+#if 1
+#include "hal_data.h"
+#else
+#include "../hal/OUTSRC/odm_precomp.h"
+#endif
+
+//include HAL Related header after HAL Related compiling flags
+#include "rtl8188e_spec.h"
+#include "Hal8188EPhyReg.h"
+#include "Hal8188EPhyCfg.h"
+#include "rtl8188e_rf.h"
+#include "rtl8188e_dm.h"
+#include "rtl8188e_recv.h"
+#include "rtl8188e_xmit.h"
+#include "rtl8188e_cmd.h"
+#include "rtl8188e_led.h"
+#include "Hal8188EPwrSeq.h"
+#ifdef DBG_CONFIG_ERROR_DETECT
+#include "rtl8188e_sreset.h"
+#endif
+
+#if 0
+ // Fw Array
+ #define Rtl8188E_FwImageArray Rtl8188EFwImgArray
+ #define Rtl8188E_FWImgArrayLength Rtl8188EFWImgArrayLength
+#ifdef CONFIG_WOWLAN
+ #define Rtl8188E_FwWoWImageArray Array_MP_8188E_FW_WoWLAN
+ #define Rtl8188E_FwWoWImgArrayLength ArrayLength_MP_8188E_FW_WoWLAN
+#endif //CONFIG_WOWLAN
+#endif
+
+
+ #define RTL8188E_FW_IMG "rtl8188e/FW_NIC.bin"
+ #define RTL8188E_FW_WW_IMG "rtl8188e/FW_WoWLAN.bin"
+ #define RTL8188E_PHY_REG "rtl8188e/PHY_REG.txt"
+ #define RTL8188E_PHY_RADIO_A "rtl8188e/RadioA.txt"
+ #define RTL8188E_PHY_RADIO_B "rtl8188e/RadioB.txt"
+ #define RTL8188E_TXPWR_TRACK "rtl8188e/TxPowerTrack.txt"
+ #define RTL8188E_AGC_TAB "rtl8188e/AGC_TAB.txt"
+ #define RTL8188E_PHY_MACREG "rtl8188e/MAC_REG.txt"
+ #define RTL8188E_PHY_REG_PG "rtl8188e/PHY_REG_PG.txt"
+ #define RTL8188E_PHY_REG_MP "rtl8188e/PHY_REG_MP.txt"
+ #define RTL8188E_TXPWR_LMT "rtl8188e/TXPWR_LMT.txt"
+
+ //---------------------------------------------------------------------
+ // RTL8188E Power Configuration CMDs for USB/SDIO/PCIE interfaces
+ //---------------------------------------------------------------------
+ #define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow
+ #define Rtl8188E_NIC_RF_OFF_FLOW rtl8188E_radio_off_flow
+ #define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow
+ #define Rtl8188E_NIC_ENABLE_FLOW rtl8188E_card_enable_flow
+ #define Rtl8188E_NIC_SUSPEND_FLOW rtl8188E_suspend_flow
+ #define Rtl8188E_NIC_RESUME_FLOW rtl8188E_resume_flow
+ #define Rtl8188E_NIC_PDN_FLOW rtl8188E_hwpdn_flow
+ #define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow
+ #define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188E_leave_lps_flow
+
+
+#if 1 // download firmware related data structure
+#define FW_8188E_SIZE 0x4000 //16384,16k
+#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 {
+ FIRMWARE_SOURCE eFWSource;
+#ifdef CONFIG_EMBEDDED_FWIMG
+ u8* szFwBuffer;
+#else
+ u8 szFwBuffer[FW_8188E_SIZE];
+#endif
+ u32 ulFwLength;
+} RT_FIRMWARE_8188E, *PRT_FIRMWARE_8188E;
+
+//
+// This structure must be cared byte-ordering
+//
+
+typedef struct _RT_8188E_FIRMWARE_HDR
+{
+ // 8-byte alinment required
+
+ //--- LONG WORD 0 ----
+ u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
+ u8 Category; // AP/NIC and USB/PCI
+ u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
+ u16 Version; // FW Version
+ u8 Subversion; // FW Subversion, default 0x00
+ u16 Rsvd1;
+
+
+ //--- LONG WORD 1 ----
+ u8 Month; // Release time Month field
+ u8 Date; // Release time Date field
+ u8 Hour; // Release time Hour field
+ u8 Minute; // Release time Minute field
+ u16 RamCodeSize; // The size of RAM code
+ u8 Foundry;
+ u8 Rsvd2;
+
+ //--- LONG WORD 2 ----
+ u32 SvnIdx; // The SVN entry index
+ u32 Rsvd3;
+
+ //--- LONG WORD 3 ----
+ u32 Rsvd4;
+ u32 Rsvd5;
+}RT_8188E_FIRMWARE_HDR, *PRT_8188E_FIRMWARE_HDR;
+#endif // download firmware related data structure
+
+
+#define DRIVER_EARLY_INT_TIME_8188E 0x05
+#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_TX_REPORT_BUFFER_SIZE 0x0400 // 1k
+
+
+// Note: We will divide number of page equally for each queue other than public queue!
+// 22k = 22528 bytes = 176 pages (@page = 128 bytes)
+// must reserved about 7 pages for LPS => 176-7 = 169 (0xA9)
+// 2*BCN / 1*ps-poll / 1*null-data /1*prob_rsp /1*QOS null-data /1*BT QOS null-data
+
+#define BCNQ_PAGE_NUM_88E 0x08
+
+//For WoWLan , more reserved page
+#ifdef CONFIG_WOWLAN
+#define WOWLAN_PAGE_NUM_88E 0x00
+#else
+#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 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)
+
+// 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
+
+// Note: For Normal Chip Setting, modify later
+#define WMM_NORMAL_PAGE_NUM_HPQ_88E 0x29
+#define WMM_NORMAL_PAGE_NUM_LPQ_88E 0x1C
+#define WMM_NORMAL_PAGE_NUM_NPQ_88E 0x1C
+
+
+//-------------------------------------------------------------------------
+// Chip specific
+//-------------------------------------------------------------------------
+#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3)
+#define CHIP_BONDING_92C_1T2R 0x1
+#define CHIP_BONDING_88C_USB_MCARD 0x2
+#define CHIP_BONDING_88C_USB_HP 0x1
+
+//-------------------------------------------------------------------------
+// Channel Plan
+//-------------------------------------------------------------------------
+
+
+#define EFUSE_REAL_CONTENT_LEN 512
+#define EFUSE_MAP_LEN 128
+#define EFUSE_MAX_SECTION 16
+#define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
+#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN)
+//
+// <Roger_Notes>
+// To prevent out of boundary programming case,
+// leave 1byte and program full section
+// 9bytes + 1byt + 5bytes and pre 1byte.
+// For worst case:
+// | 1byte|----8bytes----|1byte|--5bytes--|
+// | | Reserved(14bytes) |
+//
+#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
+#define EFUSE_MAX_WORD_UNIT_88E 4
+#define EFUSE_IC_ID_OFFSET_88E 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
+#define AVAILABLE_EFUSE_ADDR_88E(addr) (addr < EFUSE_REAL_CONTENT_LEN_88E)
+// <Roger_Notes> To prevent out of boundary programming case, leave 1byte and program full section
+// 9bytes + 1byt + 5bytes and pre 1byte.
+// For worst case:
+// | 2byte|----8bytes----|1byte|--7bytes--| //92D
+#define EFUSE_OOB_PROTECT_BYTES_88E 18 // PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte.
+#define EFUSE_PROTECT_BYTES_BANK_88E 16
+
+
+//========================================================
+// EFUSE for BT definition
+//========================================================
+#define EFUSE_BT_REAL_CONTENT_LEN 1536 // 512*3
+#define EFUSE_BT_MAP_LEN 1024 // 1k bytes
+#define EFUSE_BT_MAX_SECTION 128 // 1024/8
+
+#define EFUSE_PROTECT_BYTES_BANK 16
+
+#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
+#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
+
+//#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE)
+
+//#define RT_IS_FUNC_DISABLED(__pAdapter, __FuncBits) ( (__pAdapter)->DisabledFunctions & (__FuncBits) )
+
+#ifdef CONFIG_PCI_HCI
+void InterruptRecognized8188EE(PADAPTER Adapter, PRT_ISR_CONTENT pIsrContent);
+void UpdateInterruptMask8188EE(PADAPTER Adapter, u32 AddMSR, u32 AddMSR1, u32 RemoveMSR, u32 RemoveMSR1);
+#endif //CONFIG_PCI_HCI
+
+// rtl8188e_hal_init.c
+
+s32 rtl8188e_FirmwareDownload(PADAPTER padapter, BOOLEAN bUsedWoWLANFw);
+void _8051Reset88E(PADAPTER padapter);
+void rtl8188e_InitializeFirmwareVars(PADAPTER padapter);
+
+
+s32 InitLLTTable(PADAPTER padapter, u8 txpktbuf_bndy);
+
+// EFuse
+u8 GetEEPROMSize8188E(PADAPTER padapter);
+void Hal_InitPGData88E(PADAPTER padapter);
+void Hal_EfuseParseIDCode88E(PADAPTER padapter, u8 *hwinfo);
+void Hal_ReadTxPowerInfo88E(PADAPTER padapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+
+void Hal_EfuseParseEEPROMVer88E(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void rtl8188e_EfuseParseChnlPlan(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseCustomerID88E(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_ReadAntennaDiversity88E (PADAPTER pAdapter,u8*PROMContent,BOOLEAN AutoLoadFail);
+void Hal_ReadThermalMeter_88E(PADAPTER Adapter,u8* PROMContent,BOOLEAN AutoloadFail);
+void Hal_EfuseParseXtal_8188E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+void Hal_EfuseParseBoardType88E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+void Hal_ReadPowerSavingMode88E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+
+BOOLEAN HalDetectPwrDownMode88E(PADAPTER Adapter);
+
+#ifdef CONFIG_WOWLAN
+void Hal_DetectWoWMode(PADAPTER pAdapter);
+#endif //CONFIG_WOWLAN
+//RT_CHANNEL_DOMAIN rtl8723a_HalMapChannelPlan(PADAPTER padapter, u8 HalChannelPlan);
+//VERSION_8192C rtl8723a_ReadChipVersion(PADAPTER padapter);
+//void rtl8723a_ReadBluetoothCoexistInfo(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoloadFail);
+void Hal_InitChannelPlan(PADAPTER padapter);
+
+void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc);
+
+// register
+void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits);
+
+void rtl8188e_start_thread(_adapter *padapter);
+void rtl8188e_stop_thread(_adapter *padapter);
+
+void rtw_IOL_cmd_tx_pkt_buf_dump(ADAPTER *Adapter,int data_len);
+#ifdef CONFIG_IOL_EFUSE_PATCH
+s32 rtl8188e_iol_efuse_patch(PADAPTER padapter);
+#endif//CONFIG_IOL_EFUSE_PATCH
+void _InitTransferPageSize(PADAPTER padapter);
+
+void SetHwReg8188E(PADAPTER padapter, u8 variable, u8 *val);
+void GetHwReg8188E(PADAPTER padapter, u8 variable, u8 *val);
+void ResumeTxBeacon(PADAPTER padapter);
+void StopTxBeacon(PADAPTER padapter);
+
+u8 GetHalDefVar8188E(PADAPTER Adapter, HAL_DEF_VARIABLE eVariable, PVOID pValue);
+
+#endif //__RTL8188E_HAL_H__
+
diff --git a/rtl8xxx_EU/include/rtl8188e_led.h b/rtl8xxx_EU/include/rtl8188e_led.h
index c5e3800..748b087 100755
--- a/rtl8xxx_EU/include/rtl8188e_led.h
+++ b/rtl8xxx_EU/include/rtl8188e_led.h
@@ -1,41 +1,41 @@
-/******************************************************************************
- *
- * 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 __RTL8188E_LED_H__
-#define __RTL8188E_LED_H__
-
-
-//================================================================================
-// Interface to manipulate LED objects.
-//================================================================================
-#ifdef CONFIG_USB_HCI
-void rtl8188eu_InitSwLeds(PADAPTER padapter);
-void rtl8188eu_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_PCI_HCI
-void rtl8188ee_InitSwLeds(PADAPTER padapter);
-void rtl8188ee_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_SDIO_HCI
-void rtl8188es_InitSwLeds(PADAPTER padapter);
-void rtl8188es_DeInitSwLeds(PADAPTER padapter);
-#endif
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8188E_LED_H__
+#define __RTL8188E_LED_H__
+
+
+//================================================================================
+// Interface to manipulate LED objects.
+//================================================================================
+#ifdef CONFIG_USB_HCI
+void rtl8188eu_InitSwLeds(PADAPTER padapter);
+void rtl8188eu_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_PCI_HCI
+void rtl8188ee_InitSwLeds(PADAPTER padapter);
+void rtl8188ee_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_SDIO_HCI
+void rtl8188es_InitSwLeds(PADAPTER padapter);
+void rtl8188es_DeInitSwLeds(PADAPTER padapter);
+#endif
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8188e_recv.h b/rtl8xxx_EU/include/rtl8188e_recv.h
index df6e59f..d0dda9c 100755
--- a/rtl8xxx_EU/include/rtl8188e_recv.h
+++ b/rtl8xxx_EU/include/rtl8188e_recv.h
@@ -1,139 +1,139 @@
-/******************************************************************************
- *
- * 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 __RTL8188E_RECV_H__
-#define __RTL8188E_RECV_H__
-
-#include <rtl8192c_recv.h>
-
-#define TX_RPT1_PKT_LEN 8
-
-typedef struct rxreport_8188e
-{
- //Offset 0
- u32 pktlen:14;
- u32 crc32:1;
- u32 icverr:1;
- u32 drvinfosize:4;
- u32 security:3;
- u32 qos:1;
- u32 shift:2;
- u32 physt:1;
- u32 swdec:1;
- u32 ls:1;
- u32 fs:1;
- u32 eor:1;
- u32 own:1;
-
- //Offset 4
- u32 macid:5;
- u32 tid:4;
- u32 hwrsvd:4;
- u32 amsdu:1;
- u32 paggr:1;
- u32 faggr:1;
- u32 a1fit:4;
- u32 a2fit:4;
- u32 pam:1;
- u32 pwr:1;
- u32 md:1;
- u32 mf:1;
- u32 type:2;
- u32 mc:1;
- u32 bc:1;
-
- //Offset 8
- u32 seq:12;
- u32 frag:4;
- u32 nextpktlen:14;
- u32 nextind:1;
- u32 rsvd0831:1;
-
- //Offset 12
- u32 rxmcs:6;
- u32 rxht:1;
- u32 gf:1;
- u32 splcp:1;
- u32 bw:1;
- u32 htc:1;
- u32 eosp:1;
- u32 bssidfit:2;
- u32 rpt_sel:2;
- u32 rsvd1216:13;
- u32 pattern_match:1;
- u32 unicastwake:1;
- u32 magicwake:1;
-
- //Offset 16
- /*
- u32 pattern0match:1;
- u32 pattern1match:1;
- u32 pattern2match:1;
- u32 pattern3match:1;
- u32 pattern4match:1;
- u32 pattern5match:1;
- u32 pattern6match:1;
- u32 pattern7match:1;
- u32 pattern8match:1;
- u32 pattern9match:1;
- u32 patternamatch:1;
- u32 patternbmatch:1;
- u32 patterncmatch:1;
- u32 rsvd1613:19;
- */
- u32 rsvd16;
-
- //Offset 20
- u32 tsfl;
-
- //Offset 24
- u32 bassn:12;
- u32 bavld:1;
- u32 rsvd2413:19;
-} RXREPORT, *PRXREPORT;
-
-
-#ifdef CONFIG_SDIO_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);
-#endif
-
-#ifdef CONFIG_USB_HCI
-#define INTERRUPT_MSG_FORMAT_LEN 60
-void rtl8188eu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
-s32 rtl8188eu_init_recv_priv(PADAPTER padapter);
-void rtl8188eu_free_recv_priv(PADAPTER padapter);
-void rtl8188eu_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf);
-void rtl8188eu_recv_tasklet(void *priv);
-
-#endif
-
-#ifdef CONFIG_PCI_HCI
-s32 rtl8188ee_init_recv_priv(PADAPTER padapter);
-void rtl8188ee_free_recv_priv(PADAPTER padapter);
-#endif
-
-void rtl8188e_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat);
-void rtl8188e_process_phy_info(PADAPTER padapter, void *prframe);
-void update_recvframe_phyinfo_88e(union recv_frame *precvframe,struct phy_stat *pphy_status);
-void update_recvframe_attrib_88e( union recv_frame *precvframe, struct recv_stat *prxstat);
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8188E_RECV_H__
+#define __RTL8188E_RECV_H__
+
+#include <rtl8192c_recv.h>
+
+#define TX_RPT1_PKT_LEN 8
+
+typedef struct rxreport_8188e
+{
+ //Offset 0
+ u32 pktlen:14;
+ u32 crc32:1;
+ u32 icverr:1;
+ u32 drvinfosize:4;
+ u32 security:3;
+ u32 qos:1;
+ u32 shift:2;
+ u32 physt:1;
+ u32 swdec:1;
+ u32 ls:1;
+ u32 fs:1;
+ u32 eor:1;
+ u32 own:1;
+
+ //Offset 4
+ u32 macid:5;
+ u32 tid:4;
+ u32 hwrsvd:4;
+ u32 amsdu:1;
+ u32 paggr:1;
+ u32 faggr:1;
+ u32 a1fit:4;
+ u32 a2fit:4;
+ u32 pam:1;
+ u32 pwr:1;
+ u32 md:1;
+ u32 mf:1;
+ u32 type:2;
+ u32 mc:1;
+ u32 bc:1;
+
+ //Offset 8
+ u32 seq:12;
+ u32 frag:4;
+ u32 nextpktlen:14;
+ u32 nextind:1;
+ u32 rsvd0831:1;
+
+ //Offset 12
+ u32 rxmcs:6;
+ u32 rxht:1;
+ u32 gf:1;
+ u32 splcp:1;
+ u32 bw:1;
+ u32 htc:1;
+ u32 eosp:1;
+ u32 bssidfit:2;
+ u32 rpt_sel:2;
+ u32 rsvd1216:13;
+ u32 pattern_match:1;
+ u32 unicastwake:1;
+ u32 magicwake:1;
+
+ //Offset 16
+ /*
+ u32 pattern0match:1;
+ u32 pattern1match:1;
+ u32 pattern2match:1;
+ u32 pattern3match:1;
+ u32 pattern4match:1;
+ u32 pattern5match:1;
+ u32 pattern6match:1;
+ u32 pattern7match:1;
+ u32 pattern8match:1;
+ u32 pattern9match:1;
+ u32 patternamatch:1;
+ u32 patternbmatch:1;
+ u32 patterncmatch:1;
+ u32 rsvd1613:19;
+ */
+ u32 rsvd16;
+
+ //Offset 20
+ u32 tsfl;
+
+ //Offset 24
+ u32 bassn:12;
+ u32 bavld:1;
+ u32 rsvd2413:19;
+} RXREPORT, *PRXREPORT;
+
+
+#ifdef CONFIG_SDIO_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);
+#endif
+
+#ifdef CONFIG_USB_HCI
+#define INTERRUPT_MSG_FORMAT_LEN 60
+void rtl8188eu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
+s32 rtl8188eu_init_recv_priv(PADAPTER padapter);
+void rtl8188eu_free_recv_priv(PADAPTER padapter);
+void rtl8188eu_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf);
+void rtl8188eu_recv_tasklet(void *priv);
+
+#endif
+
+#ifdef CONFIG_PCI_HCI
+s32 rtl8188ee_init_recv_priv(PADAPTER padapter);
+void rtl8188ee_free_recv_priv(PADAPTER padapter);
+#endif
+
+void rtl8188e_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat);
+void rtl8188e_process_phy_info(PADAPTER padapter, void *prframe);
+void update_recvframe_phyinfo_88e(union recv_frame *precvframe,struct phy_stat *pphy_status);
+void update_recvframe_attrib_88e( union recv_frame *precvframe, struct recv_stat *prxstat);
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8188e_spec.h b/rtl8xxx_EU/include/rtl8188e_spec.h
index 0c7ef4f..fc43197 100755
--- a/rtl8xxx_EU/include/rtl8188e_spec.h
+++ b/rtl8xxx_EU/include/rtl8188e_spec.h
@@ -1,154 +1,154 @@
-/******************************************************************************
- *
- * 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 __RTL8188E_SPEC_H__
-#define __RTL8188E_SPEC_H__
-
-
-//============================================================
-// 8188E Regsiter offset definition
-//============================================================
-
-
-//============================================================
-//
-//============================================================
-
-//-----------------------------------------------------
-//
-// 0x0000h ~ 0x00FFh System Configuration
-//
-//-----------------------------------------------------
-#define REG_BB_PAD_CTRL 0x0064
-#define REG_HMEBOX_E0 0x0088
-#define REG_HMEBOX_E1 0x008A
-#define REG_HMEBOX_E2 0x008C
-#define REG_HMEBOX_E3 0x008E
-#define REG_HMEBOX_EXT_0 0x01F0
-#define REG_HMEBOX_EXT_1 0x01F4
-#define REG_HMEBOX_EXT_2 0x01F8
-#define REG_HMEBOX_EXT_3 0x01FC
-#define REG_HIMR_88E 0x00B0 //RTL8188E
-#define REG_HISR_88E 0x00B4 //RTL8188E
-#define REG_HIMRE_88E 0x00B8 //RTL8188E
-#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
-
-//-----------------------------------------------------
-//
-// 0x0100h ~ 0x01FFh MACTOP General Configuration
-//
-//-----------------------------------------------------
-#define REG_PKTBUF_DBG_ADDR (REG_PKTBUF_DBG_CTRL)
-#define REG_RXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+2)
-#define REG_TXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+3)
-#define REG_WOWLAN_WAKE_REASON REG_MCUTST_WOWLAN
-
-//-----------------------------------------------------
-//
-// 0x0200h ~ 0x027Fh TXDMA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0280h ~ 0x02FFh RXDMA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0300h ~ 0x03FFh PCIe
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0400h ~ 0x047Fh Protocol Configuration
-//
-//-----------------------------------------------------
-#ifdef CONFIG_WOWLAN
-#define REG_TXPKTBUF_IV_LOW 0x01a4
-#define REG_TXPKTBUF_IV_HIGH 0x01a8
-#endif
-
-//-----------------------------------------------------
-//
-// 0x0500h ~ 0x05FFh EDCA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0600h ~ 0x07FFh WMAC Configuration
-//
-//-----------------------------------------------------
-//----------------------------------------------------------------------------
-// 88E Driver Initialization Offload REG_FDHM0(Offset 0x88, 8 bits)
-//----------------------------------------------------------------------------
-//IOL config for REG_FDHM0(Reg0x88)
-#define CMD_INIT_LLT BIT0
-#define CMD_READ_EFUSE_MAP BIT1
-#define CMD_EFUSE_PATCH BIT2
-#define CMD_IOCONFIG BIT3
-#define CMD_INIT_LLT_ERR BIT4
-#define CMD_READ_EFUSE_MAP_ERR BIT5
-#define CMD_EFUSE_PATCH_ERR BIT6
-#define CMD_IOCONFIG_ERR BIT7
-
-//-----------------------------------------------------
-//
-// Redifine register definition for compatibility
-//
-//-----------------------------------------------------
-
-// TODO: use these definition when using REG_xxx naming rule.
-// NOTE: DO NOT Remove these definition. Use later.
-#define ISR_88E REG_HISR_88E
-
-#ifdef CONFIG_PCI_HCI
-//#define IMR_RX_MASK (IMR_ROK_88E|IMR_RDU_88E|IMR_RXFOVW_88E)
-#define IMR_TX_MASK (IMR_VODOK_88E|IMR_VIDOK_88E|IMR_BEDOK_88E|IMR_BKDOK_88E|IMR_MGNTDOK_88E|IMR_HIGHDOK_88E|IMR_BCNDERR0_88E)
-
-#ifdef CONFIG_CONCURRENT_MODE
-#define RT_BCN_INT_MASKS (IMR_BCNDMAINT0_88E | IMR_TBDOK_88E | IMR_TBDER_88E | IMR_BCNDMAINT_E_88E)
-#else
-#define RT_BCN_INT_MASKS (IMR_BCNDMAINT0_88E | IMR_TBDOK_88E | IMR_TBDER_88E)
-#endif
-
-#define RT_AC_INT_MASKS (IMR_VIDOK_88E | IMR_VODOK_88E | IMR_BEDOK_88E|IMR_BKDOK_88E)
-#endif
-
-
-//========================================================
-// General definitions
-//========================================================
-
-
-//----------------------------------------------------------------------------
-// 8192C EEPROM/EFUSE share register definition.
-//----------------------------------------------------------------------------
-
-#define EFUSE_ACCESS_ON 0x69 // For RTL8723 only.
-#define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only.
-
-#endif //__RTL8188E_SPEC_H__
-
+/******************************************************************************
+ *
+ * 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 __RTL8188E_SPEC_H__
+#define __RTL8188E_SPEC_H__
+
+
+//============================================================
+// 8188E Regsiter offset definition
+//============================================================
+
+
+//============================================================
+//
+//============================================================
+
+//-----------------------------------------------------
+//
+// 0x0000h ~ 0x00FFh System Configuration
+//
+//-----------------------------------------------------
+#define REG_BB_PAD_CTRL 0x0064
+#define REG_HMEBOX_E0 0x0088
+#define REG_HMEBOX_E1 0x008A
+#define REG_HMEBOX_E2 0x008C
+#define REG_HMEBOX_E3 0x008E
+#define REG_HMEBOX_EXT_0 0x01F0
+#define REG_HMEBOX_EXT_1 0x01F4
+#define REG_HMEBOX_EXT_2 0x01F8
+#define REG_HMEBOX_EXT_3 0x01FC
+#define REG_HIMR_88E 0x00B0 //RTL8188E
+#define REG_HISR_88E 0x00B4 //RTL8188E
+#define REG_HIMRE_88E 0x00B8 //RTL8188E
+#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
+
+//-----------------------------------------------------
+//
+// 0x0100h ~ 0x01FFh MACTOP General Configuration
+//
+//-----------------------------------------------------
+#define REG_PKTBUF_DBG_ADDR (REG_PKTBUF_DBG_CTRL)
+#define REG_RXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+2)
+#define REG_TXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+3)
+#define REG_WOWLAN_WAKE_REASON REG_MCUTST_WOWLAN
+
+//-----------------------------------------------------
+//
+// 0x0200h ~ 0x027Fh TXDMA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0280h ~ 0x02FFh RXDMA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0300h ~ 0x03FFh PCIe
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0400h ~ 0x047Fh Protocol Configuration
+//
+//-----------------------------------------------------
+#ifdef CONFIG_WOWLAN
+#define REG_TXPKTBUF_IV_LOW 0x01a4
+#define REG_TXPKTBUF_IV_HIGH 0x01a8
+#endif
+
+//-----------------------------------------------------
+//
+// 0x0500h ~ 0x05FFh EDCA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0600h ~ 0x07FFh WMAC Configuration
+//
+//-----------------------------------------------------
+//----------------------------------------------------------------------------
+// 88E Driver Initialization Offload REG_FDHM0(Offset 0x88, 8 bits)
+//----------------------------------------------------------------------------
+//IOL config for REG_FDHM0(Reg0x88)
+#define CMD_INIT_LLT BIT0
+#define CMD_READ_EFUSE_MAP BIT1
+#define CMD_EFUSE_PATCH BIT2
+#define CMD_IOCONFIG BIT3
+#define CMD_INIT_LLT_ERR BIT4
+#define CMD_READ_EFUSE_MAP_ERR BIT5
+#define CMD_EFUSE_PATCH_ERR BIT6
+#define CMD_IOCONFIG_ERR BIT7
+
+//-----------------------------------------------------
+//
+// Redifine register definition for compatibility
+//
+//-----------------------------------------------------
+
+// TODO: use these definition when using REG_xxx naming rule.
+// NOTE: DO NOT Remove these definition. Use later.
+#define ISR_88E REG_HISR_88E
+
+#ifdef CONFIG_PCI_HCI
+//#define IMR_RX_MASK (IMR_ROK_88E|IMR_RDU_88E|IMR_RXFOVW_88E)
+#define IMR_TX_MASK (IMR_VODOK_88E|IMR_VIDOK_88E|IMR_BEDOK_88E|IMR_BKDOK_88E|IMR_MGNTDOK_88E|IMR_HIGHDOK_88E|IMR_BCNDERR0_88E)
+
+#ifdef CONFIG_CONCURRENT_MODE
+#define RT_BCN_INT_MASKS (IMR_BCNDMAINT0_88E | IMR_TBDOK_88E | IMR_TBDER_88E | IMR_BCNDMAINT_E_88E)
+#else
+#define RT_BCN_INT_MASKS (IMR_BCNDMAINT0_88E | IMR_TBDOK_88E | IMR_TBDER_88E)
+#endif
+
+#define RT_AC_INT_MASKS (IMR_VIDOK_88E | IMR_VODOK_88E | IMR_BEDOK_88E|IMR_BKDOK_88E)
+#endif
+
+
+//========================================================
+// General definitions
+//========================================================
+
+
+//----------------------------------------------------------------------------
+// 8192C EEPROM/EFUSE share register definition.
+//----------------------------------------------------------------------------
+
+#define EFUSE_ACCESS_ON 0x69 // For RTL8723 only.
+#define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only.
+
+#endif //__RTL8188E_SPEC_H__
+
diff --git a/rtl8xxx_EU/include/rtl8188e_xmit.h b/rtl8xxx_EU/include/rtl8188e_xmit.h
index 3a711c1..064c1af 100755
--- a/rtl8xxx_EU/include/rtl8188e_xmit.h
+++ b/rtl8xxx_EU/include/rtl8188e_xmit.h
@@ -1,304 +1,304 @@
-/******************************************************************************
- *
- * 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 __RTL8188E_XMIT_H__
-#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)
-#define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value)
-#define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value)
-#define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value)
-#define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value)
-#define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value)
-#define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value)
-
-//
-//defined for TX DESC Operation
-//
-
-#define MAX_TID (15)
-
-//OFFSET 0
-#define OFFSET_SZ 0
-#define OFFSET_SHT 16
-#define BMC BIT(24)
-#define LSG BIT(26)
-#define FSG BIT(27)
-#define OWN BIT(31)
-
-
-//OFFSET 4
-#define PKT_OFFSET_SZ 0
-#define QSEL_SHT 8
-#define RATE_ID_SHT 16
-#define NAVUSEHDR BIT(20)
-#define SEC_TYPE_SHT 22
-#define PKT_OFFSET_SHT 26
-
-//OFFSET 8
-#define AGG_EN BIT(12)
-#define AGG_BK BIT(16)
-#define AMPDU_DENSITY_SHT 20
-#define ANTSEL_A BIT(24)
-#define ANTSEL_B BIT(25)
-#define TX_ANT_CCK_SHT 26
-#define TX_ANTL_SHT 28
-#define TX_ANT_HT_SHT 30
-
-//OFFSET 12
-#define SEQ_SHT 16
-#define EN_HWSEQ BIT(31)
-
-//OFFSET 16
-#define QOS BIT(6)
-#define HW_SSN BIT(7)
-#define USERATE BIT(8)
-#define DISDATAFB BIT(10)
-#define CTS_2_SELF BIT(11)
-#define RTS_EN BIT(12)
-#define HW_RTS_EN BIT(13)
-#define DATA_SHORT BIT(24)
-#define PWR_STATUS_SHT 15
-#define DATA_SC_SHT 20
-#define DATA_BW BIT(25)
-
-//OFFSET 20
-#define RTY_LMT_EN BIT(17)
-
-
-//OFFSET 20
-#define SGI BIT(6)
-#define USB_TXAGG_NUM_SHT 24
-
-typedef struct txdesc_88e
-{
- //Offset 0
- u32 pktlen:16;
- u32 offset:8;
- u32 bmc:1;
- u32 htc:1;
- u32 ls:1;
- u32 fs:1;
- u32 linip:1;
- u32 noacm:1;
- u32 gf:1;
- u32 own:1;
-
- //Offset 4
- u32 macid:6;
- u32 rsvd0406:2;
- u32 qsel:5;
- u32 rd_nav_ext:1;
- u32 lsig_txop_en:1;
- u32 pifs:1;
- u32 rate_id:4;
- u32 navusehdr:1;
- u32 en_desc_id:1;
- u32 sectype:2;
- u32 rsvd0424:2;
- u32 pkt_offset:5; // unit: 8 bytes
- u32 rsvd0431:1;
-
- //Offset 8
- u32 rts_rc:6;
- u32 data_rc:6;
- u32 agg_en:1;
- u32 rd_en:1;
- u32 bar_rty_th:2;
- u32 bk:1;
- u32 morefrag:1;
- u32 raw:1;
- u32 ccx:1;
- u32 ampdu_density:3;
- u32 bt_null:1;
- u32 ant_sel_a:1;
- u32 ant_sel_b:1;
- u32 tx_ant_cck:2;
- u32 tx_antl:2;
- u32 tx_ant_ht:2;
-
- //Offset 12
- u32 nextheadpage:8;
- u32 tailpage:8;
- u32 seq:12;
- u32 cpu_handle:1;
- u32 tag1:1;
- u32 trigger_int:1;
- u32 hwseq_en:1;
-
- //Offset 16
- u32 rtsrate:5;
- u32 ap_dcfe:1;
- u32 hwseq_sel:2;
- u32 userate:1;
- u32 disrtsfb:1;
- u32 disdatafb:1;
- u32 cts2self:1;
- u32 rtsen:1;
- u32 hw_rts_en:1;
- u32 port_id:1;
- u32 pwr_status:3;
- u32 wait_dcts:1;
- u32 cts2ap_en:1;
- u32 data_sc:2;
- u32 data_stbc:2;
- u32 data_short:1;
- u32 data_bw:1;
- u32 rts_short:1;
- u32 rts_bw:1;
- u32 rts_sc:2;
- u32 vcs_stbc:2;
-
- //Offset 20
- u32 datarate:6;
- u32 sgi:1;
- u32 try_rate:1;
- u32 data_ratefb_lmt:5;
- u32 rts_ratefb_lmt:4;
- u32 rty_lmt_en:1;
- u32 data_rt_lmt:6;
- u32 usb_txagg_num:8;
-
- //Offset 24
- u32 txagg_a:5;
- u32 txagg_b:5;
- u32 use_max_len:1;
- u32 max_agg_num:5;
- u32 mcsg1_max_len:4;
- u32 mcsg2_max_len:4;
- u32 mcsg3_max_len:4;
- u32 mcs7_sgi_max_len:4;
-
- //Offset 28
- u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB)
- u32 sw0:8; /* offset 30 */
- u32 sw1:4;
- u32 mcs15_sgi_max_len:4;
-}TXDESC_8188E, *PTXDESC_8188E;
-
-#define txdesc_set_ccx_sw_88e(txdesc, value) \
- do { \
- ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \
- ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \
- } while (0)
-
-struct txrpt_ccx_88e {
- /* offset 0 */
- u8 tag1:1;
- u8 pkt_num:3;
- u8 txdma_underflow:1;
- u8 int_bt:1;
- u8 int_tri:1;
- u8 int_ccx:1;
-
- /* offset 1 */
- u8 mac_id:6;
- u8 pkt_ok:1;
- u8 bmc:1;
-
- /* offset 2 */
- u8 retry_cnt:6;
- u8 lifetime_over:1;
- u8 retry_over:1;
-
- /* offset 3 */
- u8 ccx_qtime0;
- u8 ccx_qtime1;
-
- /* offset 5 */
- u8 final_data_rate;
-
- /* offset 6 */
- u8 sw1:4;
- u8 qsel:4;
-
- /* offset 7 */
- u8 sw0;
-};
-
-#define txrpt_ccx_sw_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
-s32 rtl8188es_init_xmit_priv(PADAPTER padapter);
-void rtl8188es_free_xmit_priv(PADAPTER padapter);
-s32 rtl8188es_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8188es_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8188es_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-thread_return rtl8188es_xmit_thread(thread_context context);
-s32 rtl8188es_xmit_buf_handler(PADAPTER padapter);
-
-#ifdef CONFIG_SDIO_TX_TASKLET
-void rtl8188es_xmit_tasklet(void *priv);
-#endif
-#endif
-
-#ifdef CONFIG_USB_HCI
-s32 rtl8188eu_init_xmit_priv(PADAPTER padapter);
-void rtl8188eu_free_xmit_priv(PADAPTER padapter);
-s32 rtl8188eu_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8188eu_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8188eu_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-s32 rtl8188eu_xmit_buf_handler(PADAPTER padapter);
-void rtl8188eu_xmit_tasklet(void *priv);
-s32 rtl8188eu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
-#endif
-
-#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);
-void rtl8188ee_xmit_tasklet(void *priv);
-#endif
-
-
-
-#ifdef CONFIG_TX_EARLY_MODE
-void UpdateEarlyModeInfo8188E(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmitbuf );
-#endif
-
-#ifdef CONFIG_XMIT_ACK
-void dump_txrpt_ccx_88e(void *buf);
-void handle_txrpt_ccx_88e(_adapter *adapter, u8 *buf);
-#else
-#define dump_txrpt_ccx_88e(buf) do {} while(0)
-#define handle_txrpt_ccx_88e(adapter, buf) do {} while(0)
-#endif //CONFIG_XMIT_ACK
-
-void _dbg_dump_tx_info(_adapter *padapter,int frame_tag,struct tx_desc *ptxdesc);
-#endif //__RTL8188E_XMIT_H__
-
+/******************************************************************************
+ *
+ * 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 __RTL8188E_XMIT_H__
+#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)
+#define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value)
+#define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value)
+#define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value)
+#define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value)
+#define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value)
+#define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value)
+
+//
+//defined for TX DESC Operation
+//
+
+#define MAX_TID (15)
+
+//OFFSET 0
+#define OFFSET_SZ 0
+#define OFFSET_SHT 16
+#define BMC BIT(24)
+#define LSG BIT(26)
+#define FSG BIT(27)
+#define OWN BIT(31)
+
+
+//OFFSET 4
+#define PKT_OFFSET_SZ 0
+#define QSEL_SHT 8
+#define RATE_ID_SHT 16
+#define NAVUSEHDR BIT(20)
+#define SEC_TYPE_SHT 22
+#define PKT_OFFSET_SHT 26
+
+//OFFSET 8
+#define AGG_EN BIT(12)
+#define AGG_BK BIT(16)
+#define AMPDU_DENSITY_SHT 20
+#define ANTSEL_A BIT(24)
+#define ANTSEL_B BIT(25)
+#define TX_ANT_CCK_SHT 26
+#define TX_ANTL_SHT 28
+#define TX_ANT_HT_SHT 30
+
+//OFFSET 12
+#define SEQ_SHT 16
+#define EN_HWSEQ BIT(31)
+
+//OFFSET 16
+#define QOS BIT(6)
+#define HW_SSN BIT(7)
+#define USERATE BIT(8)
+#define DISDATAFB BIT(10)
+#define CTS_2_SELF BIT(11)
+#define RTS_EN BIT(12)
+#define HW_RTS_EN BIT(13)
+#define DATA_SHORT BIT(24)
+#define PWR_STATUS_SHT 15
+#define DATA_SC_SHT 20
+#define DATA_BW BIT(25)
+
+//OFFSET 20
+#define RTY_LMT_EN BIT(17)
+
+
+//OFFSET 20
+#define SGI BIT(6)
+#define USB_TXAGG_NUM_SHT 24
+
+typedef struct txdesc_88e
+{
+ //Offset 0
+ u32 pktlen:16;
+ u32 offset:8;
+ u32 bmc:1;
+ u32 htc:1;
+ u32 ls:1;
+ u32 fs:1;
+ u32 linip:1;
+ u32 noacm:1;
+ u32 gf:1;
+ u32 own:1;
+
+ //Offset 4
+ u32 macid:6;
+ u32 rsvd0406:2;
+ u32 qsel:5;
+ u32 rd_nav_ext:1;
+ u32 lsig_txop_en:1;
+ u32 pifs:1;
+ u32 rate_id:4;
+ u32 navusehdr:1;
+ u32 en_desc_id:1;
+ u32 sectype:2;
+ u32 rsvd0424:2;
+ u32 pkt_offset:5; // unit: 8 bytes
+ u32 rsvd0431:1;
+
+ //Offset 8
+ u32 rts_rc:6;
+ u32 data_rc:6;
+ u32 agg_en:1;
+ u32 rd_en:1;
+ u32 bar_rty_th:2;
+ u32 bk:1;
+ u32 morefrag:1;
+ u32 raw:1;
+ u32 ccx:1;
+ u32 ampdu_density:3;
+ u32 bt_null:1;
+ u32 ant_sel_a:1;
+ u32 ant_sel_b:1;
+ u32 tx_ant_cck:2;
+ u32 tx_antl:2;
+ u32 tx_ant_ht:2;
+
+ //Offset 12
+ u32 nextheadpage:8;
+ u32 tailpage:8;
+ u32 seq:12;
+ u32 cpu_handle:1;
+ u32 tag1:1;
+ u32 trigger_int:1;
+ u32 hwseq_en:1;
+
+ //Offset 16
+ u32 rtsrate:5;
+ u32 ap_dcfe:1;
+ u32 hwseq_sel:2;
+ u32 userate:1;
+ u32 disrtsfb:1;
+ u32 disdatafb:1;
+ u32 cts2self:1;
+ u32 rtsen:1;
+ u32 hw_rts_en:1;
+ u32 port_id:1;
+ u32 pwr_status:3;
+ u32 wait_dcts:1;
+ u32 cts2ap_en:1;
+ u32 data_sc:2;
+ u32 data_stbc:2;
+ u32 data_short:1;
+ u32 data_bw:1;
+ u32 rts_short:1;
+ u32 rts_bw:1;
+ u32 rts_sc:2;
+ u32 vcs_stbc:2;
+
+ //Offset 20
+ u32 datarate:6;
+ u32 sgi:1;
+ u32 try_rate:1;
+ u32 data_ratefb_lmt:5;
+ u32 rts_ratefb_lmt:4;
+ u32 rty_lmt_en:1;
+ u32 data_rt_lmt:6;
+ u32 usb_txagg_num:8;
+
+ //Offset 24
+ u32 txagg_a:5;
+ u32 txagg_b:5;
+ u32 use_max_len:1;
+ u32 max_agg_num:5;
+ u32 mcsg1_max_len:4;
+ u32 mcsg2_max_len:4;
+ u32 mcsg3_max_len:4;
+ u32 mcs7_sgi_max_len:4;
+
+ //Offset 28
+ u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB)
+ u32 sw0:8; /* offset 30 */
+ u32 sw1:4;
+ u32 mcs15_sgi_max_len:4;
+}TXDESC_8188E, *PTXDESC_8188E;
+
+#define txdesc_set_ccx_sw_88e(txdesc, value) \
+ do { \
+ ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \
+ ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \
+ } while (0)
+
+struct txrpt_ccx_88e {
+ /* offset 0 */
+ u8 tag1:1;
+ u8 pkt_num:3;
+ u8 txdma_underflow:1;
+ u8 int_bt:1;
+ u8 int_tri:1;
+ u8 int_ccx:1;
+
+ /* offset 1 */
+ u8 mac_id:6;
+ u8 pkt_ok:1;
+ u8 bmc:1;
+
+ /* offset 2 */
+ u8 retry_cnt:6;
+ u8 lifetime_over:1;
+ u8 retry_over:1;
+
+ /* offset 3 */
+ u8 ccx_qtime0;
+ u8 ccx_qtime1;
+
+ /* offset 5 */
+ u8 final_data_rate;
+
+ /* offset 6 */
+ u8 sw1:4;
+ u8 qsel:4;
+
+ /* offset 7 */
+ u8 sw0;
+};
+
+#define txrpt_ccx_sw_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
+s32 rtl8188es_init_xmit_priv(PADAPTER padapter);
+void rtl8188es_free_xmit_priv(PADAPTER padapter);
+s32 rtl8188es_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8188es_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8188es_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+thread_return rtl8188es_xmit_thread(thread_context context);
+s32 rtl8188es_xmit_buf_handler(PADAPTER padapter);
+
+#ifdef CONFIG_SDIO_TX_TASKLET
+void rtl8188es_xmit_tasklet(void *priv);
+#endif
+#endif
+
+#ifdef CONFIG_USB_HCI
+s32 rtl8188eu_init_xmit_priv(PADAPTER padapter);
+void rtl8188eu_free_xmit_priv(PADAPTER padapter);
+s32 rtl8188eu_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8188eu_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8188eu_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+s32 rtl8188eu_xmit_buf_handler(PADAPTER padapter);
+void rtl8188eu_xmit_tasklet(void *priv);
+s32 rtl8188eu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
+#endif
+
+#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);
+void rtl8188ee_xmit_tasklet(void *priv);
+#endif
+
+
+
+#ifdef CONFIG_TX_EARLY_MODE
+void UpdateEarlyModeInfo8188E(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmitbuf );
+#endif
+
+#ifdef CONFIG_XMIT_ACK
+void dump_txrpt_ccx_88e(void *buf);
+void handle_txrpt_ccx_88e(_adapter *adapter, u8 *buf);
+#else
+#define dump_txrpt_ccx_88e(buf) do {} while(0)
+#define handle_txrpt_ccx_88e(adapter, buf) do {} while(0)
+#endif //CONFIG_XMIT_ACK
+
+void _dbg_dump_tx_info(_adapter *padapter,int frame_tag,struct tx_desc *ptxdesc);
+#endif //__RTL8188E_XMIT_H__
+
diff --git a/rtl8xxx_EU/include/rtl8192c_event.h b/rtl8xxx_EU/include/rtl8192c_event.h
index 7596531..1013f74 100755
--- a/rtl8xxx_EU/include/rtl8192c_event.h
+++ b/rtl8xxx_EU/include/rtl8192c_event.h
@@ -16,13 +16,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
- ******************************************************************************/
-#ifndef _RTL8192C_EVENT_H_
-#define _RTL8192C_EVENT_H_
-
-
-
-
-#endif
-
-
+ ******************************************************************************/
+#ifndef _RTL8192C_EVENT_H_
+#define _RTL8192C_EVENT_H_
+
+
+
+
+#endif
+
+
diff --git a/rtl8xxx_EU/include/rtl8192e_hal.h b/rtl8xxx_EU/include/rtl8192e_hal.h
index 2b76b8c..c084fbf 100755
--- a/rtl8xxx_EU/include/rtl8192e_hal.h
+++ b/rtl8xxx_EU/include/rtl8192e_hal.h
@@ -1,295 +1,295 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __RTL8192E_HAL_H__
-#define __RTL8192E_HAL_H__
-
-//#include "hal_com.h"
-
-#if 1
-#include "hal_data.h"
-#else
-#include "../hal/OUTSRC/odm_precomp.h"
-#endif
-
-//include HAL Related header after HAL Related compiling flags
-#include "rtl8192e_spec.h"
-#include "rtl8192e_rf.h"
-#include "rtl8192e_dm.h"
-#include "rtl8192e_recv.h"
-#include "rtl8192e_xmit.h"
-#include "rtl8192e_cmd.h"
-#include "rtl8192e_led.h"
-#include "Hal8192EPwrSeq.h"
-#include "Hal8192EPhyReg.h"
-#include "Hal8192EPhyCfg.h"
-
-
-#ifdef DBG_CONFIG_ERROR_DETECT
-#include "rtl8192e_sreset.h"
-#endif
-
-
-//---------------------------------------------------------------------
-// RTL8192E From header
-//---------------------------------------------------------------------
- #define RTL8192E_FW_IMG "rtl8192e/FW_NIC.bin"
- #define RTL8192E_FW_WW_IMG "rtl8192e/FW_WoWLAN.bin"
- #define RTL8192E_PHY_REG "rtl8192e/PHY_REG.txt"
- #define RTL8192E_PHY_RADIO_A "rtl8192e/RadioA.txt"
- #define RTL8192E_PHY_RADIO_B "rtl8192e/RadioB.txt"
- #define RTL8192E_TXPWR_TRACK "rtl8192e/TxPowerTrack.txt"
- #define RTL8192E_AGC_TAB "rtl8192e/AGC_TAB.txt"
- #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"
-
-//---------------------------------------------------------------------
-// RTL8192E Power Configuration CMDs for PCIe interface
-//---------------------------------------------------------------------
-#define Rtl8192E_NIC_PWR_ON_FLOW rtl8192E_power_on_flow
-#define Rtl8192E_NIC_RF_OFF_FLOW rtl8192E_radio_off_flow
-#define Rtl8192E_NIC_DISABLE_FLOW rtl8192E_card_disable_flow
-#define Rtl8192E_NIC_ENABLE_FLOW rtl8192E_card_enable_flow
-#define Rtl8192E_NIC_SUSPEND_FLOW rtl8192E_suspend_flow
-#define Rtl8192E_NIC_RESUME_FLOW rtl8192E_resume_flow
-#define Rtl8192E_NIC_PDN_FLOW rtl8192E_hwpdn_flow
-#define Rtl8192E_NIC_LPS_ENTER_FLOW rtl8192E_enter_lps_flow
-#define Rtl8192E_NIC_LPS_LEAVE_FLOW rtl8192E_leave_lps_flow
-
-
-#if 1 // download firmware related data structure
-#define FW_SIZE_8192E 0x8000 // Compatible with RTL8192e Maximal RAM code size 32k
-#define FW_START_ADDRESS 0x1000
-#define FW_END_ADDRESS 0x5FFF
-
-
-#define IS_FW_HEADER_EXIST_8192E(_pFwHdr) ((GET_FIRMWARE_HDR_SIGNATURE_8192E(_pFwHdr) &0xFFF0) == 0x92E0)
-
-
-
-typedef struct _RT_FIRMWARE_8192E {
- FIRMWARE_SOURCE eFWSource;
-#ifdef CONFIG_EMBEDDED_FWIMG
- u8* szFwBuffer;
-#else
- u8 szFwBuffer[FW_SIZE_8192E];
-#endif
- u32 ulFwLength;
-} RT_FIRMWARE_8192E, *PRT_FIRMWARE_8192E;
-
-//
-// This structure must be cared byte-ordering
-//
-// Added by tynli. 2009.12.04.
-
-//=====================================================
-// Firmware Header(8-byte alinment required)
-//=====================================================
-//--- LONG WORD 0 ----
-#define GET_FIRMWARE_HDR_SIGNATURE_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 0, 16) // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
-#define GET_FIRMWARE_HDR_CATEGORY_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 16, 8) // AP/NIC and USB/PCI
-#define GET_FIRMWARE_HDR_FUNCTION_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 24, 8) // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
-#define GET_FIRMWARE_HDR_VERSION_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 0, 16)// FW Version
-#define GET_FIRMWARE_HDR_SUB_VER_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 16, 8) // FW Subversion, default 0x00
-#define GET_FIRMWARE_HDR_RSVD1_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 24, 8)
-
-//--- LONG WORD 1 ----
-#define GET_FIRMWARE_HDR_MONTH_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 0, 8) // Release time Month field
-#define GET_FIRMWARE_HDR_DATE_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 8, 8) // Release time Date field
-#define GET_FIRMWARE_HDR_HOUR_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 16, 8)// Release time Hour field
-#define GET_FIRMWARE_HDR_MINUTE_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 24, 8)// Release time Minute field
-#define GET_FIRMWARE_HDR_ROMCODE_SIZE_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+12, 0, 16)// The size of RAM code
-#define GET_FIRMWARE_HDR_RSVD2_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+12, 16, 16)
-
-//--- LONG WORD 2 ----
-#define GET_FIRMWARE_HDR_SVN_IDX_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+16, 0, 32)// The SVN entry index
-#define GET_FIRMWARE_HDR_RSVD3_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+20, 0, 32)
-
-//--- LONG WORD 3 ----
-#define GET_FIRMWARE_HDR_RSVD4_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+24, 0, 32)
-#define GET_FIRMWARE_HDR_RSVD5_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+28, 0, 32)
-
-#endif // download firmware related data structure
-
-#define DRIVER_EARLY_INT_TIME_8192E 0x05
-#define BCN_DMA_ATIME_INT_TIME_8192E 0x02
-
-#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
-
-#define TX_PAGE_BOUNDARY_8192E (TX_TOTAL_PAGE_NUMBER_8192E + 1)//0xF4,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_PUBQ_8192E 0xE0
-#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_EPQ_8192E 0x00
-
-
-
-//Note: For WMM Normal Chip Setting ,modify later
-#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8192E TX_PAGE_BOUNDARY_8192E
-#define WMM_NORMAL_TX_PAGE_BOUNDARY_8192E (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8192E + 1)
-
-#define WMM_NORMAL_PAGE_NUM_PUBQ_8192E NORMAL_PAGE_NUM_PUBQ_8192E
-#define WMM_NORMAL_PAGE_NUM_HPQ_8192E NORMAL_PAGE_NUM_HPQ_8192E
-#define WMM_NORMAL_PAGE_NUM_LPQ_8192E NORMAL_PAGE_NUM_LPQ_8192E
-#define WMM_NORMAL_PAGE_NUM_NPQ_8192E NORMAL_PAGE_NUM_NPQ_8192E
-
-#define USB_JAGUAR_DUMMY_OFFSET_8192EU 2
-#define USB_JAGUAR_DUMMY_UNIT_8192EU 8
-#define USB_JAGUAR_ALL_DUMMY_LENGTH_8192EU (USB_JAGUAR_DUMMY_OFFSET_8192EU * USB_JAGUAR_DUMMY_UNIT_8192EU)
-#define USB_HWDESC_HEADER_LEN_8192EU (TX_DESC_SIZE_8192E + USB_JAGUAR_ALL_DUMMY_LENGTH_8192EU)
-
-
-//-------------------------------------------------------------------------
-// Chip specific
-//-------------------------------------------------------------------------
-
-//-------------------------------------------------------------------------
-// Channel Plan
-//-------------------------------------------------------------------------
-
-#define HWSET_MAX_SIZE_8192E 512
-
-#define EFUSE_REAL_CONTENT_LEN_8192E 512
-
-#define EFUSE_MAP_LEN_8192E 512
-#define EFUSE_MAX_SECTION_8192E 64
-#define EFUSE_MAX_WORD_UNIT_8192E 4
-#define EFUSE_IC_ID_OFFSET_8192E 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
-#define AVAILABLE_EFUSE_ADDR_8192E(addr) (addr < EFUSE_REAL_CONTENT_LEN_8192E)
-//
-// <Roger_Notes> To prevent out of boundary programming case, leave 1byte and program full section
-// 9bytes + 1byt + 5bytes and pre 1byte.
-// For worst case:
-// | 1byte|----8bytes----|1byte|--5bytes--|
-// | | Reserved(14bytes) |
-//
-#define EFUSE_OOB_PROTECT_BYTES_8192E 15 // PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte.
-
-
-
-//========================================================
-// EFUSE for BT definition
-//========================================================
-#define EFUSE_BT_REAL_BANK_CONTENT_LEN_8192E 512
-#define EFUSE_BT_REAL_CONTENT_LEN_8192E 1024 // 512*2
-#define EFUSE_BT_MAP_LEN_8192E 1024 // 1k bytes
-#define EFUSE_BT_MAX_SECTION_8192E 128 // 1024/8
-
-#define EFUSE_PROTECT_BYTES_BANK_8192E 16
-#define EFUSE_MAX_BANK_8192E 3
-//===========================================================
-
-#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
-#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
-
-//#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE)
-
-//#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);
-void InitializeFirmwareVars8192E(PADAPTER padapter);
-
-s32 InitLLTTable8192E(PADAPTER padapter, u8 txpktbuf_bndy);
-
-// EFuse
-u8 GetEEPROMSize8192E(PADAPTER padapter);
-void hal_InitPGData_8192E(PADAPTER padapter, u8* PROMContent);
-void Hal_EfuseParseIDCode8192E(PADAPTER padapter, u8 *hwinfo);
-void Hal_ReadPROMVersion8192E(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_ReadPowerSavingMode8192E(PADAPTER padapter, u8* hwinfo, BOOLEAN AutoLoadFail);
-void Hal_ReadTxPowerInfo8192E(PADAPTER padapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-void Hal_ReadBoardType8192E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-void Hal_ReadThermalMeter_8192E(PADAPTER Adapter,u8* PROMContent,BOOLEAN AutoloadFail);
-void Hal_ReadChannelPlan8192E(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseXtal_8192E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-void Hal_ReadAntennaDiversity8192E(PADAPTER pAdapter,u8* PROMContent,BOOLEAN AutoLoadFail);
-void Hal_ReadPAType_8192E(PADAPTER Adapter,u8* PROMContent, BOOLEAN AutoloadFail);
-void Hal_EfuseParseBTCoexistInfo8192E(PADAPTER Adapter, u8* hwinfo, BOOLEAN AutoLoadFail);
-u8 Hal_CrystalAFEAdjust(_adapter * Adapter);
-
-BOOLEAN HalDetectPwrDownMode8192E(PADAPTER Adapter);
-
-#ifdef CONFIG_WOWLAN
-void Hal_DetectWoWMode(PADAPTER pAdapter);
-#endif //CONFIG_WOWLAN
-
-/***********************************************************/
-// RTL8192E-MAC Setting
-VOID _InitTxBufferBoundary_8192E(IN PADAPTER Adapter,IN u8 txpktbuf_bndy);
-VOID _InitPageBoundary_8192E(IN PADAPTER Adapter);
-//VOID _InitTransferPageSize_8192E(IN PADAPTER Adapter);
-VOID _InitDriverInfoSize_8192E(IN PADAPTER Adapter,IN u8 drvInfoSize);
-VOID _InitRxSetting_8192E(PADAPTER Adapter);
-VOID _InitRDGSetting_8192E(PADAPTER Adapter);
-void _InitID_8192E(IN PADAPTER Adapter);
-VOID _InitNetworkType_8192E(IN PADAPTER Adapter);
-VOID _InitWMACSetting_8192E(IN PADAPTER Adapter);
-VOID _InitAdaptiveCtrl_8192E(IN PADAPTER Adapter);
-VOID _InitEDCA_8192E( IN PADAPTER Adapter);
-VOID _InitRetryFunction_8192E( IN PADAPTER Adapter);
-VOID _InitBeaconParameters_8192E(IN PADAPTER Adapter);
-VOID _InitBeaconMaxError_8192E(
- IN PADAPTER Adapter,
- IN BOOLEAN InfraMode
- );
-void _BBTurnOnBlock_8192E(PADAPTER padapter);
-void SetBeaconRelatedRegisters8192E(PADAPTER padapter);
-VOID hal_ReadRFType_8192E(PADAPTER Adapter);
-// RTL8192E-MAC Setting
-/***********************************************************/
-
-void SetHwReg8192E(PADAPTER Adapter, u8 variable, u8* val);
-void GetHwReg8192E(PADAPTER Adapter, u8 variable, u8* val);
-u8
-SetHalDefVar8192E(
- IN PADAPTER Adapter,
- IN HAL_DEF_VARIABLE eVariable,
- IN PVOID pValue
- );
-u8
-GetHalDefVar8192E(
- IN PADAPTER Adapter,
- IN HAL_DEF_VARIABLE eVariable,
- IN PVOID pValue
- );
-
-void rtl8192e_set_hal_ops(struct hal_ops *pHalFunc);
-void rtl8192e_init_default_value(_adapter * padapter);
-// register
-void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits);
-
-void rtl8192e_start_thread(_adapter *padapter);
-void rtl8192e_stop_thread(_adapter *padapter);
-#endif //__RTL8192E_HAL_H__
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __RTL8192E_HAL_H__
+#define __RTL8192E_HAL_H__
+
+//#include "hal_com.h"
+
+#if 1
+#include "hal_data.h"
+#else
+#include "../hal/OUTSRC/odm_precomp.h"
+#endif
+
+//include HAL Related header after HAL Related compiling flags
+#include "rtl8192e_spec.h"
+#include "rtl8192e_rf.h"
+#include "rtl8192e_dm.h"
+#include "rtl8192e_recv.h"
+#include "rtl8192e_xmit.h"
+#include "rtl8192e_cmd.h"
+#include "rtl8192e_led.h"
+#include "Hal8192EPwrSeq.h"
+#include "Hal8192EPhyReg.h"
+#include "Hal8192EPhyCfg.h"
+
+
+#ifdef DBG_CONFIG_ERROR_DETECT
+#include "rtl8192e_sreset.h"
+#endif
+
+
+//---------------------------------------------------------------------
+// RTL8192E From header
+//---------------------------------------------------------------------
+ #define RTL8192E_FW_IMG "rtl8192e/FW_NIC.bin"
+ #define RTL8192E_FW_WW_IMG "rtl8192e/FW_WoWLAN.bin"
+ #define RTL8192E_PHY_REG "rtl8192e/PHY_REG.txt"
+ #define RTL8192E_PHY_RADIO_A "rtl8192e/RadioA.txt"
+ #define RTL8192E_PHY_RADIO_B "rtl8192e/RadioB.txt"
+ #define RTL8192E_TXPWR_TRACK "rtl8192e/TxPowerTrack.txt"
+ #define RTL8192E_AGC_TAB "rtl8192e/AGC_TAB.txt"
+ #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"
+
+//---------------------------------------------------------------------
+// RTL8192E Power Configuration CMDs for PCIe interface
+//---------------------------------------------------------------------
+#define Rtl8192E_NIC_PWR_ON_FLOW rtl8192E_power_on_flow
+#define Rtl8192E_NIC_RF_OFF_FLOW rtl8192E_radio_off_flow
+#define Rtl8192E_NIC_DISABLE_FLOW rtl8192E_card_disable_flow
+#define Rtl8192E_NIC_ENABLE_FLOW rtl8192E_card_enable_flow
+#define Rtl8192E_NIC_SUSPEND_FLOW rtl8192E_suspend_flow
+#define Rtl8192E_NIC_RESUME_FLOW rtl8192E_resume_flow
+#define Rtl8192E_NIC_PDN_FLOW rtl8192E_hwpdn_flow
+#define Rtl8192E_NIC_LPS_ENTER_FLOW rtl8192E_enter_lps_flow
+#define Rtl8192E_NIC_LPS_LEAVE_FLOW rtl8192E_leave_lps_flow
+
+
+#if 1 // download firmware related data structure
+#define FW_SIZE_8192E 0x8000 // Compatible with RTL8192e Maximal RAM code size 32k
+#define FW_START_ADDRESS 0x1000
+#define FW_END_ADDRESS 0x5FFF
+
+
+#define IS_FW_HEADER_EXIST_8192E(_pFwHdr) ((GET_FIRMWARE_HDR_SIGNATURE_8192E(_pFwHdr) &0xFFF0) == 0x92E0)
+
+
+
+typedef struct _RT_FIRMWARE_8192E {
+ FIRMWARE_SOURCE eFWSource;
+#ifdef CONFIG_EMBEDDED_FWIMG
+ u8* szFwBuffer;
+#else
+ u8 szFwBuffer[FW_SIZE_8192E];
+#endif
+ u32 ulFwLength;
+} RT_FIRMWARE_8192E, *PRT_FIRMWARE_8192E;
+
+//
+// This structure must be cared byte-ordering
+//
+// Added by tynli. 2009.12.04.
+
+//=====================================================
+// Firmware Header(8-byte alinment required)
+//=====================================================
+//--- LONG WORD 0 ----
+#define GET_FIRMWARE_HDR_SIGNATURE_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 0, 16) // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
+#define GET_FIRMWARE_HDR_CATEGORY_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 16, 8) // AP/NIC and USB/PCI
+#define GET_FIRMWARE_HDR_FUNCTION_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 24, 8) // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
+#define GET_FIRMWARE_HDR_VERSION_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 0, 16)// FW Version
+#define GET_FIRMWARE_HDR_SUB_VER_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 16, 8) // FW Subversion, default 0x00
+#define GET_FIRMWARE_HDR_RSVD1_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 24, 8)
+
+//--- LONG WORD 1 ----
+#define GET_FIRMWARE_HDR_MONTH_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 0, 8) // Release time Month field
+#define GET_FIRMWARE_HDR_DATE_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 8, 8) // Release time Date field
+#define GET_FIRMWARE_HDR_HOUR_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 16, 8)// Release time Hour field
+#define GET_FIRMWARE_HDR_MINUTE_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 24, 8)// Release time Minute field
+#define GET_FIRMWARE_HDR_ROMCODE_SIZE_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+12, 0, 16)// The size of RAM code
+#define GET_FIRMWARE_HDR_RSVD2_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+12, 16, 16)
+
+//--- LONG WORD 2 ----
+#define GET_FIRMWARE_HDR_SVN_IDX_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+16, 0, 32)// The SVN entry index
+#define GET_FIRMWARE_HDR_RSVD3_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+20, 0, 32)
+
+//--- LONG WORD 3 ----
+#define GET_FIRMWARE_HDR_RSVD4_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+24, 0, 32)
+#define GET_FIRMWARE_HDR_RSVD5_8192E(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+28, 0, 32)
+
+#endif // download firmware related data structure
+
+#define DRIVER_EARLY_INT_TIME_8192E 0x05
+#define BCN_DMA_ATIME_INT_TIME_8192E 0x02
+
+#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
+
+#define TX_PAGE_BOUNDARY_8192E (TX_TOTAL_PAGE_NUMBER_8192E + 1)//0xF4,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_PUBQ_8192E 0xE0
+#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_EPQ_8192E 0x00
+
+
+
+//Note: For WMM Normal Chip Setting ,modify later
+#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8192E TX_PAGE_BOUNDARY_8192E
+#define WMM_NORMAL_TX_PAGE_BOUNDARY_8192E (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8192E + 1)
+
+#define WMM_NORMAL_PAGE_NUM_PUBQ_8192E NORMAL_PAGE_NUM_PUBQ_8192E
+#define WMM_NORMAL_PAGE_NUM_HPQ_8192E NORMAL_PAGE_NUM_HPQ_8192E
+#define WMM_NORMAL_PAGE_NUM_LPQ_8192E NORMAL_PAGE_NUM_LPQ_8192E
+#define WMM_NORMAL_PAGE_NUM_NPQ_8192E NORMAL_PAGE_NUM_NPQ_8192E
+
+#define USB_JAGUAR_DUMMY_OFFSET_8192EU 2
+#define USB_JAGUAR_DUMMY_UNIT_8192EU 8
+#define USB_JAGUAR_ALL_DUMMY_LENGTH_8192EU (USB_JAGUAR_DUMMY_OFFSET_8192EU * USB_JAGUAR_DUMMY_UNIT_8192EU)
+#define USB_HWDESC_HEADER_LEN_8192EU (TX_DESC_SIZE_8192E + USB_JAGUAR_ALL_DUMMY_LENGTH_8192EU)
+
+
+//-------------------------------------------------------------------------
+// Chip specific
+//-------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------
+// Channel Plan
+//-------------------------------------------------------------------------
+
+#define HWSET_MAX_SIZE_8192E 512
+
+#define EFUSE_REAL_CONTENT_LEN_8192E 512
+
+#define EFUSE_MAP_LEN_8192E 512
+#define EFUSE_MAX_SECTION_8192E 64
+#define EFUSE_MAX_WORD_UNIT_8192E 4
+#define EFUSE_IC_ID_OFFSET_8192E 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
+#define AVAILABLE_EFUSE_ADDR_8192E(addr) (addr < EFUSE_REAL_CONTENT_LEN_8192E)
+//
+// <Roger_Notes> To prevent out of boundary programming case, leave 1byte and program full section
+// 9bytes + 1byt + 5bytes and pre 1byte.
+// For worst case:
+// | 1byte|----8bytes----|1byte|--5bytes--|
+// | | Reserved(14bytes) |
+//
+#define EFUSE_OOB_PROTECT_BYTES_8192E 15 // PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte.
+
+
+
+//========================================================
+// EFUSE for BT definition
+//========================================================
+#define EFUSE_BT_REAL_BANK_CONTENT_LEN_8192E 512
+#define EFUSE_BT_REAL_CONTENT_LEN_8192E 1024 // 512*2
+#define EFUSE_BT_MAP_LEN_8192E 1024 // 1k bytes
+#define EFUSE_BT_MAX_SECTION_8192E 128 // 1024/8
+
+#define EFUSE_PROTECT_BYTES_BANK_8192E 16
+#define EFUSE_MAX_BANK_8192E 3
+//===========================================================
+
+#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
+#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
+
+//#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE)
+
+//#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);
+void InitializeFirmwareVars8192E(PADAPTER padapter);
+
+s32 InitLLTTable8192E(PADAPTER padapter, u8 txpktbuf_bndy);
+
+// EFuse
+u8 GetEEPROMSize8192E(PADAPTER padapter);
+void hal_InitPGData_8192E(PADAPTER padapter, u8* PROMContent);
+void Hal_EfuseParseIDCode8192E(PADAPTER padapter, u8 *hwinfo);
+void Hal_ReadPROMVersion8192E(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_ReadPowerSavingMode8192E(PADAPTER padapter, u8* hwinfo, BOOLEAN AutoLoadFail);
+void Hal_ReadTxPowerInfo8192E(PADAPTER padapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+void Hal_ReadBoardType8192E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+void Hal_ReadThermalMeter_8192E(PADAPTER Adapter,u8* PROMContent,BOOLEAN AutoloadFail);
+void Hal_ReadChannelPlan8192E(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseXtal_8192E(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+void Hal_ReadAntennaDiversity8192E(PADAPTER pAdapter,u8* PROMContent,BOOLEAN AutoLoadFail);
+void Hal_ReadPAType_8192E(PADAPTER Adapter,u8* PROMContent, BOOLEAN AutoloadFail);
+void Hal_EfuseParseBTCoexistInfo8192E(PADAPTER Adapter, u8* hwinfo, BOOLEAN AutoLoadFail);
+u8 Hal_CrystalAFEAdjust(_adapter * Adapter);
+
+BOOLEAN HalDetectPwrDownMode8192E(PADAPTER Adapter);
+
+#ifdef CONFIG_WOWLAN
+void Hal_DetectWoWMode(PADAPTER pAdapter);
+#endif //CONFIG_WOWLAN
+
+/***********************************************************/
+// RTL8192E-MAC Setting
+VOID _InitTxBufferBoundary_8192E(IN PADAPTER Adapter,IN u8 txpktbuf_bndy);
+VOID _InitPageBoundary_8192E(IN PADAPTER Adapter);
+//VOID _InitTransferPageSize_8192E(IN PADAPTER Adapter);
+VOID _InitDriverInfoSize_8192E(IN PADAPTER Adapter,IN u8 drvInfoSize);
+VOID _InitRxSetting_8192E(PADAPTER Adapter);
+VOID _InitRDGSetting_8192E(PADAPTER Adapter);
+void _InitID_8192E(IN PADAPTER Adapter);
+VOID _InitNetworkType_8192E(IN PADAPTER Adapter);
+VOID _InitWMACSetting_8192E(IN PADAPTER Adapter);
+VOID _InitAdaptiveCtrl_8192E(IN PADAPTER Adapter);
+VOID _InitEDCA_8192E( IN PADAPTER Adapter);
+VOID _InitRetryFunction_8192E( IN PADAPTER Adapter);
+VOID _InitBeaconParameters_8192E(IN PADAPTER Adapter);
+VOID _InitBeaconMaxError_8192E(
+ IN PADAPTER Adapter,
+ IN BOOLEAN InfraMode
+ );
+void _BBTurnOnBlock_8192E(PADAPTER padapter);
+void SetBeaconRelatedRegisters8192E(PADAPTER padapter);
+VOID hal_ReadRFType_8192E(PADAPTER Adapter);
+// RTL8192E-MAC Setting
+/***********************************************************/
+
+void SetHwReg8192E(PADAPTER Adapter, u8 variable, u8* val);
+void GetHwReg8192E(PADAPTER Adapter, u8 variable, u8* val);
+u8
+SetHalDefVar8192E(
+ IN PADAPTER Adapter,
+ IN HAL_DEF_VARIABLE eVariable,
+ IN PVOID pValue
+ );
+u8
+GetHalDefVar8192E(
+ IN PADAPTER Adapter,
+ IN HAL_DEF_VARIABLE eVariable,
+ IN PVOID pValue
+ );
+
+void rtl8192e_set_hal_ops(struct hal_ops *pHalFunc);
+void rtl8192e_init_default_value(_adapter * padapter);
+// register
+void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits);
+
+void rtl8192e_start_thread(_adapter *padapter);
+void rtl8192e_stop_thread(_adapter *padapter);
+#endif //__RTL8192E_HAL_H__
+
diff --git a/rtl8xxx_EU/include/rtl8192e_led.h b/rtl8xxx_EU/include/rtl8192e_led.h
index 221e0aa..53317d0 100755
--- a/rtl8xxx_EU/include/rtl8192e_led.h
+++ b/rtl8xxx_EU/include/rtl8192e_led.h
@@ -1,41 +1,41 @@
-/******************************************************************************
- *
- * 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 __RTL8192E_LED_H__
-#define __RTL8192E_LED_H__
-
-
-//================================================================================
-// Interface to manipulate LED objects.
-//================================================================================
-#ifdef CONFIG_USB_HCI
-void rtl8192eu_InitSwLeds(PADAPTER padapter);
-void rtl8192eu_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_PCI_HCI
-void rtl8192ee_InitSwLeds(PADAPTER padapter);
-void rtl8192ee_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_SDIO_HCI
-void rtl8192es_InitSwLeds(PADAPTER padapter);
-void rtl8192es_DeInitSwLeds(PADAPTER padapter);
-#endif
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8192E_LED_H__
+#define __RTL8192E_LED_H__
+
+
+//================================================================================
+// Interface to manipulate LED objects.
+//================================================================================
+#ifdef CONFIG_USB_HCI
+void rtl8192eu_InitSwLeds(PADAPTER padapter);
+void rtl8192eu_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_PCI_HCI
+void rtl8192ee_InitSwLeds(PADAPTER padapter);
+void rtl8192ee_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_SDIO_HCI
+void rtl8192es_InitSwLeds(PADAPTER padapter);
+void rtl8192es_DeInitSwLeds(PADAPTER padapter);
+#endif
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8192e_recv.h b/rtl8xxx_EU/include/rtl8192e_recv.h
index a840484..03fac1f 100755
--- a/rtl8xxx_EU/include/rtl8192e_recv.h
+++ b/rtl8xxx_EU/include/rtl8192e_recv.h
@@ -1,147 +1,147 @@
-/******************************************************************************
- *
- * 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 __RTL8192E_RECV_H__
-#define __RTL8192E_RECV_H__
-
-#if defined(CONFIG_USB_HCI)
-
-#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
- #define MAX_RECVBUF_SZ (32768) // 32k
- //#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
-
-#elif defined(CONFIG_PCI_HCI)
-//#ifndef CONFIG_MINIMAL_MEMORY_USAGE
-// #define MAX_RECVBUF_SZ (9100)
-//#else
- #define MAX_RECVBUF_SZ (4000) // about 4K
-//#endif
-
-
-#elif defined(CONFIG_SDIO_HCI)
-
-#define MAX_RECVBUF_SZ (10240)
-
-#endif
-
-
-// Rx smooth factor
-#define Rx_Smooth_Factor (20)
-
-//=============
-
-//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)
-#define GET_RX_STATUS_DESC_ICVERR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 15, 1)
-#define GET_RX_STATUS_DESC_DRVINFO_SIZE_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 4)
-#define GET_RX_STATUS_DESC_SECURITY_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 20, 3)
-#define GET_RX_STATUS_DESC_QOS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 23, 1)
-#define GET_RX_STATUS_DESC_SHIFT_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 24, 2)
-#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)
-
-//DWORD 1
-#define GET_RX_STATUS_DESC_MACID_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 0, 7)
-#define GET_RX_STATUS_DESC_TID_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 8, 4)
-#define GET_RX_STATUS_DESC_MACID_VLD_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 12, 1)
-#define GET_RX_STATUS_DESC_AMSDU_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 13, 1)
-#define GET_RX_STATUS_DESC_RXID_MATCH_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 14, 1)
-#define GET_RX_STATUS_DESC_PAGGR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 15, 1)
-#define GET_RX_STATUS_DESC_A1_FITS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 16, 4)
-#define GET_RX_STATUS_DESC_TCPOFFLOAD_CHKERR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 20, 1)
-#define GET_RX_STATUS_DESC_TCPOFFLOAD_IPVER_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 21, 1)
-#define GET_RX_STATUS_DESC_TCPOFFLOAD_IS_TCPUDP_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 22, 1)
-#define GET_RX_STATUS_DESC_TCPOFFLOAD_CHK_VLD_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 23, 1)
-#define GET_RX_STATUS_DESC_PAM_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 24, 1)
-#define GET_RX_STATUS_DESC_PWR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 25, 1)
-#define GET_RX_STATUS_DESC_MORE_DATA_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 26, 1)
-#define GET_RX_STATUS_DESC_MORE_FRAG_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 27, 1)
-#define GET_RX_STATUS_DESC_TYPE_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 28, 2)
-#define GET_RX_STATUS_DESC_MC_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 30, 1)
-#define GET_RX_STATUS_DESC_BC_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 31, 1)
-
-//DWORD 2
-#define GET_RX_STATUS_DESC_SEQ_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 0, 12)
-#define GET_RX_STATUS_DESC_FRAG_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 12, 4)
-#define GET_RX_STATUS_DESC_RX_IS_QOS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 16, 1)
-
-#define GET_RX_STATUS_DESC_WLANHD_IV_LEN_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 18, 6)
-#define GET_RX_STATUS_DESC_HWRSVD_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 24, 4)
-#define GET_RX_STATUS_DESC_FCS_OK_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 31, 1)
-#define GET_RX_STATUS_DESC_RPT_SEL_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 28, 1)
-
-//DWORD 3
-#define GET_RX_STATUS_DESC_RX_RATE_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 0, 7)
-#define GET_RX_STATUS_DESC_HTC_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 10, 1)
-#define GET_RX_STATUS_DESC_EOSP_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 11, 1)
-#define GET_RX_STATUS_DESC_BSSID_FIT_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 12, 2)
-#define GET_RX_STATUS_DESC_DMA_AGG_NUM_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 16, 8)
-
-#define GET_RX_STATUS_DESC_PATTERN_MATCH_92E(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 29, 1)
-#define GET_RX_STATUS_DESC_UNICAST_92E(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 30, 1)
-#define GET_RX_STATUS_DESC_MAGIC_WAKE_92E(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 31, 1)
-
-
-//DWORD 5
-#define GET_RX_STATUS_DESC_TSFL_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
-
-#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);
-void rtl8812s_free_recv_priv(PADAPTER padapter);
-void rtl8812s_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf);
-#endif
-
-#ifdef CONFIG_USB_HCI
-#define INTERRUPT_MSG_FORMAT_LEN 60
-void rtl8192eu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
-s32 rtl8192eu_init_recv_priv(PADAPTER padapter);
-void rtl8192eu_free_recv_priv(PADAPTER padapter);
-void rtl8192eu_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf);
-void rtl8192eu_recv_tasklet(void *priv);
-
-#endif
-
-#ifdef CONFIG_PCI_HCI
-s32 rtl8192ee_init_recv_priv(PADAPTER padapter);
-void rtl8192ee_free_recv_priv(PADAPTER padapter);
-#endif
-
-void rtl8192e_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
-void rtl8192e_query_rx_phy_status(union recv_frame *prframe, u8 *pphy_stat);
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8192E_RECV_H__
+#define __RTL8192E_RECV_H__
+
+#if defined(CONFIG_USB_HCI)
+
+#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
+ #define MAX_RECVBUF_SZ (32768) // 32k
+ //#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
+
+#elif defined(CONFIG_PCI_HCI)
+//#ifndef CONFIG_MINIMAL_MEMORY_USAGE
+// #define MAX_RECVBUF_SZ (9100)
+//#else
+ #define MAX_RECVBUF_SZ (4000) // about 4K
+//#endif
+
+
+#elif defined(CONFIG_SDIO_HCI)
+
+#define MAX_RECVBUF_SZ (10240)
+
+#endif
+
+
+// Rx smooth factor
+#define Rx_Smooth_Factor (20)
+
+//=============
+
+//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)
+#define GET_RX_STATUS_DESC_ICVERR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 15, 1)
+#define GET_RX_STATUS_DESC_DRVINFO_SIZE_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 4)
+#define GET_RX_STATUS_DESC_SECURITY_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 20, 3)
+#define GET_RX_STATUS_DESC_QOS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 23, 1)
+#define GET_RX_STATUS_DESC_SHIFT_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 24, 2)
+#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)
+
+//DWORD 1
+#define GET_RX_STATUS_DESC_MACID_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 0, 7)
+#define GET_RX_STATUS_DESC_TID_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 8, 4)
+#define GET_RX_STATUS_DESC_MACID_VLD_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 12, 1)
+#define GET_RX_STATUS_DESC_AMSDU_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 13, 1)
+#define GET_RX_STATUS_DESC_RXID_MATCH_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 14, 1)
+#define GET_RX_STATUS_DESC_PAGGR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 15, 1)
+#define GET_RX_STATUS_DESC_A1_FITS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 16, 4)
+#define GET_RX_STATUS_DESC_TCPOFFLOAD_CHKERR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 20, 1)
+#define GET_RX_STATUS_DESC_TCPOFFLOAD_IPVER_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 21, 1)
+#define GET_RX_STATUS_DESC_TCPOFFLOAD_IS_TCPUDP_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 22, 1)
+#define GET_RX_STATUS_DESC_TCPOFFLOAD_CHK_VLD_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 23, 1)
+#define GET_RX_STATUS_DESC_PAM_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 24, 1)
+#define GET_RX_STATUS_DESC_PWR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 25, 1)
+#define GET_RX_STATUS_DESC_MORE_DATA_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 26, 1)
+#define GET_RX_STATUS_DESC_MORE_FRAG_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 27, 1)
+#define GET_RX_STATUS_DESC_TYPE_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 28, 2)
+#define GET_RX_STATUS_DESC_MC_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 30, 1)
+#define GET_RX_STATUS_DESC_BC_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 31, 1)
+
+//DWORD 2
+#define GET_RX_STATUS_DESC_SEQ_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 0, 12)
+#define GET_RX_STATUS_DESC_FRAG_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 12, 4)
+#define GET_RX_STATUS_DESC_RX_IS_QOS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 16, 1)
+
+#define GET_RX_STATUS_DESC_WLANHD_IV_LEN_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 18, 6)
+#define GET_RX_STATUS_DESC_HWRSVD_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 24, 4)
+#define GET_RX_STATUS_DESC_FCS_OK_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 31, 1)
+#define GET_RX_STATUS_DESC_RPT_SEL_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 28, 1)
+
+//DWORD 3
+#define GET_RX_STATUS_DESC_RX_RATE_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 0, 7)
+#define GET_RX_STATUS_DESC_HTC_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 10, 1)
+#define GET_RX_STATUS_DESC_EOSP_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 11, 1)
+#define GET_RX_STATUS_DESC_BSSID_FIT_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 12, 2)
+#define GET_RX_STATUS_DESC_DMA_AGG_NUM_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 16, 8)
+
+#define GET_RX_STATUS_DESC_PATTERN_MATCH_92E(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 29, 1)
+#define GET_RX_STATUS_DESC_UNICAST_92E(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 30, 1)
+#define GET_RX_STATUS_DESC_MAGIC_WAKE_92E(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 31, 1)
+
+
+//DWORD 5
+#define GET_RX_STATUS_DESC_TSFL_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
+
+#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);
+void rtl8812s_free_recv_priv(PADAPTER padapter);
+void rtl8812s_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf);
+#endif
+
+#ifdef CONFIG_USB_HCI
+#define INTERRUPT_MSG_FORMAT_LEN 60
+void rtl8192eu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
+s32 rtl8192eu_init_recv_priv(PADAPTER padapter);
+void rtl8192eu_free_recv_priv(PADAPTER padapter);
+void rtl8192eu_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf);
+void rtl8192eu_recv_tasklet(void *priv);
+
+#endif
+
+#ifdef CONFIG_PCI_HCI
+s32 rtl8192ee_init_recv_priv(PADAPTER padapter);
+void rtl8192ee_free_recv_priv(PADAPTER padapter);
+#endif
+
+void rtl8192e_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
+void rtl8192e_query_rx_phy_status(union recv_frame *prframe, u8 *pphy_stat);
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8192e_spec.h b/rtl8xxx_EU/include/rtl8192e_spec.h
index c3f9316..0e50b73 100755
--- a/rtl8xxx_EU/include/rtl8192e_spec.h
+++ b/rtl8xxx_EU/include/rtl8192e_spec.h
@@ -1,253 +1,253 @@
-/******************************************************************************
- *
- * 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 __RTL8192E_SPEC_H__
-#define __RTL8192E_SPEC_H__
-
-#include <drv_conf.h>
-
-
-//============================================================
-// 8192E Regsiter offset definition
-//============================================================
-
-//============================================================
-//
-//============================================================
-
-//-----------------------------------------------------
-//
-// 0x0000h ~ 0x00FFh System Configuration
-//
-//-----------------------------------------------------
-#define REG_AFE_CTRL1_8192E 0x0024
-#define REG_AFE_CTRL2_8192E 0x0028
-#define REG_AFE_CTRL3_8192E 0x002c
-
-
-#define REG_SDIO_CTRL_8192E 0x0070
-#define REG_OPT_CTRL_8192E 0x0074
-#define REG_RF_B_CTRL_8192E 0x0076
-#define REG_AFE_CTRL4_8192E 0x0078
-#define REG_LDO_SWR_CTRL 0x007C
-#define REG_FW_DRV_MSG_8192E 0x0088
-#define REG_HMEBOX_E2_E3_8192E 0x008C
-#define REG_HIMR0_8192E 0x00B0
-#define REG_HISR0_8192E 0x00B4
-#define REG_HIMR1_8192E 0x00B8
-#define REG_HISR1_8192E 0x00BC
-
-#define REG_SYS_CFG1_8192E 0x00F0
-#define REG_SYS_CFG2_8192E 0x00FC
-//-----------------------------------------------------
-//
-// 0x0100h ~ 0x01FFh MACTOP General Configuration
-//
-//-----------------------------------------------------
-#define REG_PKTBUF_DBG_ADDR (REG_PKTBUF_DBG_CTRL)
-#define REG_RXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+2)
-#define REG_TXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+3)
-#define REG_WOWLAN_WAKE_REASON REG_MCUTST_WOWLAN
-
-#define REG_RSVD3_8192E 0x0168
-#define REG_C2HEVT_CMD_SEQ_88XX 0x01A1
-#define REG_C2hEVT_CMD_CONTENT_88XX 0x01A2
-#define REG_C2HEVT_CMD_LEN_88XX 0x01AE
-
-#define REG_HMEBOX_EXT0_8192E 0x01F0
-#define REG_HMEBOX_EXT1_8192E 0x01F4
-#define REG_HMEBOX_EXT2_8192E 0x01F8
-#define REG_HMEBOX_EXT3_8192E 0x01FC
-
-//-----------------------------------------------------
-//
-// 0x0200h ~ 0x027Fh TXDMA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0280h ~ 0x02FFh RXDMA Configuration
-//
-//-----------------------------------------------------
-#define REG_RXDMA_8192E 0x0290
-#define REG_EARLY_MODE_CONTROL_8192E 0x02BC
-
-#define REG_RSVD5_8192E 0x02F0
-#define REG_RSVD6_8192E 0x02F4
-#define REG_RSVD7_8192E 0x02F8
-#define REG_RSVD8_8192E 0x02FC
-
-//-----------------------------------------------------
-//
-// 0x0300h ~ 0x03FFh PCIe
-//
-//-----------------------------------------------------
-#define REG_PCIE_MULTIFET_CTRL_8192E 0x036A //PCIE Multi-Fethc Control
-
-//-----------------------------------------------------
-//
-// 0x0400h ~ 0x047Fh Protocol Configuration
-//
-//-----------------------------------------------------
-#define REG_TXBF_CTRL_8192E 0x042C
-#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_NDPA_OPT_CTRL_8192E 0x045F
-#define REG_DATA_SC_8192E 0x0483
-#define REG_TXRPT_START_OFFSET 0x04AC
-#define REG_AMPDU_BURST_MODE_8192E 0x04BC
-#define REG_HT_SINGLE_AMPDU_8192E 0x04C7
-#define REG_MACID_PKT_DROP0_8192E 0x04D0
-
-//-----------------------------------------------------
-//
-// 0x0500h ~ 0x05FFh EDCA Configuration
-//
-//-----------------------------------------------------
-#define REG_CTWND_8192E 0x0572
-#define REG_SECONDARY_CCA_CTRL_8192E 0x0577
-#define REG_SCH_TXCMD_8192E 0x05F8
-
-//-----------------------------------------------------
-//
-// 0x0600h ~ 0x07FFh WMAC Configuration
-//
-//-----------------------------------------------------
-#define REG_MAC_CR_8192E 0x0600
-
-#define REG_MAC_TX_SM_STATE_8192E 0x06B4
-
-// Power
-#define REG_BFMER0_INFO_8192E 0x06E4
-#define REG_BFMER1_INFO_8192E 0x06EC
-#define REG_CSI_RPT_PARAM_BW20_8192E 0x06F4
-#define REG_CSI_RPT_PARAM_BW40_8192E 0x06F8
-#define REG_CSI_RPT_PARAM_BW80_8192E 0x06FC
-
-// Hardware Port 2
-#define REG_BFMEE_SEL_8192E 0x0714
-#define REG_SND_PTCL_CTRL_8192E 0x0718
-
-
-//-----------------------------------------------------
-//
-// Redifine register definition for compatibility
-//
-//-----------------------------------------------------
-
-// TODO: use these definition when using REG_xxx naming rule.
-// NOTE: DO NOT Remove these definition. Use later.
-#define ISR_8192E REG_HISR0_8192E
-
-//----------------------------------------------------------------------------
-// 8192E IMR/ISR bits (offset 0xB0, 8bits)
-//----------------------------------------------------------------------------
-#define IMR_DISABLED_8192E 0
-// IMR DW0(0x00B0-00B3) Bit 0-31
-#define IMR_TIMER2_8192E BIT31 // Timeout interrupt 2
-#define IMR_TIMER1_8192E BIT30 // Timeout interrupt 1
-#define IMR_PSTIMEOUT_8192E BIT29 // Power Save Time Out Interrupt
-#define IMR_GTINT4_8192E BIT28 // When GTIMER4 expires, this bit is set to 1
-#define IMR_GTINT3_8192E BIT27 // When GTIMER3 expires, this bit is set to 1
-#define IMR_TXBCN0ERR_8192E BIT26 // Transmit Beacon0 Error
-#define IMR_TXBCN0OK_8192E BIT25 // Transmit Beacon0 OK
-#define IMR_TSF_BIT32_TOGGLE_8192E BIT24 // TSF Timer BIT32 toggle indication interrupt
-#define IMR_BCNDMAINT0_8192E BIT20 // Beacon DMA Interrupt 0
-#define IMR_BCNDERR0_8192E BIT16 // Beacon Queue DMA OK0
-#define IMR_HSISR_IND_ON_INT_8192E BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1)
-#define IMR_BCNDMAINT_E_8192E BIT14 // Beacon DMA Interrupt Extension for Win7
-#define IMR_ATIMEND_8192E BIT12 // CTWidnow End or ATIM Window End
-#define IMR_C2HCMD_8192E BIT10 // CPU to Host Command INT Status, Write 1 clear
-#define IMR_CPWM2_8192E BIT9 // CPU power Mode exchange INT Status, Write 1 clear
-#define IMR_CPWM_8192E BIT8 // CPU power Mode exchange INT Status, Write 1 clear
-#define IMR_HIGHDOK_8192E BIT7 // High Queue DMA OK
-#define IMR_MGNTDOK_8192E BIT6 // Management Queue DMA OK
-#define IMR_BKDOK_8192E BIT5 // AC_BK DMA OK
-#define IMR_BEDOK_8192E BIT4 // AC_BE DMA OK
-#define IMR_VIDOK_8192E BIT3 // AC_VI DMA OK
-#define IMR_VODOK_8192E BIT2 // AC_VO DMA OK
-#define IMR_RDU_8192E BIT1 // Rx Descriptor Unavailable
-#define IMR_ROK_8192E BIT0 // Receive DMA OK
-
-// IMR DW1(0x00B4-00B7) Bit 0-31
-#define IMR_BCNDMAINT7_8192E BIT27 // Beacon DMA Interrupt 7
-#define IMR_BCNDMAINT6_8192E BIT26 // Beacon DMA Interrupt 6
-#define IMR_BCNDMAINT5_8192E BIT25 // Beacon DMA Interrupt 5
-#define IMR_BCNDMAINT4_8192E BIT24 // Beacon DMA Interrupt 4
-#define IMR_BCNDMAINT3_8192E BIT23 // Beacon DMA Interrupt 3
-#define IMR_BCNDMAINT2_8192E BIT22 // Beacon DMA Interrupt 2
-#define IMR_BCNDMAINT1_8192E BIT21 // Beacon DMA Interrupt 1
-#define IMR_BCNDOK7_8192E BIT20 // Beacon Queue DMA OK Interrup 7
-#define IMR_BCNDOK6_8192E BIT19 // Beacon Queue DMA OK Interrup 6
-#define IMR_BCNDOK5_8192E BIT18 // Beacon Queue DMA OK Interrup 5
-#define IMR_BCNDOK4_8192E BIT17 // Beacon Queue DMA OK Interrup 4
-#define IMR_BCNDOK3_8192E BIT16 // Beacon Queue DMA OK Interrup 3
-#define IMR_BCNDOK2_8192E BIT15 // Beacon Queue DMA OK Interrup 2
-#define IMR_BCNDOK1_8192E BIT14 // Beacon Queue DMA OK Interrup 1
-#define IMR_ATIMEND_E_8192E BIT13 // ATIM Window End Extension for Win7
-#define IMR_TXERR_8192E BIT11 // Tx Error Flag Interrupt Status, write 1 clear.
-#define IMR_RXERR_8192E BIT10 // Rx Error Flag INT Status, Write 1 clear
-#define IMR_TXFOVW_8192E BIT9 // Transmit FIFO Overflow
-#define IMR_RXFOVW_8192E BIT8 // Receive FIFO Overflow
-
-//----------------------------------------------------------------------------
-// 8192E Auto LLT bits (offset 0x224, 8bits)
-//----------------------------------------------------------------------------
-//224 REG_AUTO_LLT
-// move to hal_com_reg.h
-
-//----------------------------------------------------------------------------
-// 8192E Auto LLT bits (offset 0x290, 32bits)
-//----------------------------------------------------------------------------
-#define BIT_DMA_MODE BIT1
-#define BIT_USB_RXDMA_AGG_EN BIT31
-
-//----------------------------------------------------------------------------
-// 8192E REG_SYS_CFG1 (offset 0xF0, 32bits)
-//----------------------------------------------------------------------------
-#define BIT_SPSLDO_SEL BIT24
-
-
-//----------------------------------------------------------------------------
-// 8192E REG_CCK_CHECK (offset 0x454, 8bits)
-//----------------------------------------------------------------------------
-#define BIT_BCN_PORT_SEL BIT5
-
-//============================================================================
-// Regsiter Bit and Content definition
-//============================================================================
-
-//2 ACMHWCTRL 0x05C0
-#define AcmHw_HwEn_8192E BIT(0)
-#define AcmHw_VoqEn_8192E BIT(1)
-#define AcmHw_ViqEn_8192E BIT(2)
-#define AcmHw_BeqEn_8192E BIT(3)
-#define AcmHw_VoqStatus_8192E BIT(5)
-#define AcmHw_ViqStatus_8192E BIT(6)
-#define AcmHw_BeqStatus_8192E BIT(7)
-
-
-
-
-#endif //__RTL8192E_SPEC_H__
-
+/******************************************************************************
+ *
+ * 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 __RTL8192E_SPEC_H__
+#define __RTL8192E_SPEC_H__
+
+#include <drv_conf.h>
+
+
+//============================================================
+// 8192E Regsiter offset definition
+//============================================================
+
+//============================================================
+//
+//============================================================
+
+//-----------------------------------------------------
+//
+// 0x0000h ~ 0x00FFh System Configuration
+//
+//-----------------------------------------------------
+#define REG_AFE_CTRL1_8192E 0x0024
+#define REG_AFE_CTRL2_8192E 0x0028
+#define REG_AFE_CTRL3_8192E 0x002c
+
+
+#define REG_SDIO_CTRL_8192E 0x0070
+#define REG_OPT_CTRL_8192E 0x0074
+#define REG_RF_B_CTRL_8192E 0x0076
+#define REG_AFE_CTRL4_8192E 0x0078
+#define REG_LDO_SWR_CTRL 0x007C
+#define REG_FW_DRV_MSG_8192E 0x0088
+#define REG_HMEBOX_E2_E3_8192E 0x008C
+#define REG_HIMR0_8192E 0x00B0
+#define REG_HISR0_8192E 0x00B4
+#define REG_HIMR1_8192E 0x00B8
+#define REG_HISR1_8192E 0x00BC
+
+#define REG_SYS_CFG1_8192E 0x00F0
+#define REG_SYS_CFG2_8192E 0x00FC
+//-----------------------------------------------------
+//
+// 0x0100h ~ 0x01FFh MACTOP General Configuration
+//
+//-----------------------------------------------------
+#define REG_PKTBUF_DBG_ADDR (REG_PKTBUF_DBG_CTRL)
+#define REG_RXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+2)
+#define REG_TXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+3)
+#define REG_WOWLAN_WAKE_REASON REG_MCUTST_WOWLAN
+
+#define REG_RSVD3_8192E 0x0168
+#define REG_C2HEVT_CMD_SEQ_88XX 0x01A1
+#define REG_C2hEVT_CMD_CONTENT_88XX 0x01A2
+#define REG_C2HEVT_CMD_LEN_88XX 0x01AE
+
+#define REG_HMEBOX_EXT0_8192E 0x01F0
+#define REG_HMEBOX_EXT1_8192E 0x01F4
+#define REG_HMEBOX_EXT2_8192E 0x01F8
+#define REG_HMEBOX_EXT3_8192E 0x01FC
+
+//-----------------------------------------------------
+//
+// 0x0200h ~ 0x027Fh TXDMA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0280h ~ 0x02FFh RXDMA Configuration
+//
+//-----------------------------------------------------
+#define REG_RXDMA_8192E 0x0290
+#define REG_EARLY_MODE_CONTROL_8192E 0x02BC
+
+#define REG_RSVD5_8192E 0x02F0
+#define REG_RSVD6_8192E 0x02F4
+#define REG_RSVD7_8192E 0x02F8
+#define REG_RSVD8_8192E 0x02FC
+
+//-----------------------------------------------------
+//
+// 0x0300h ~ 0x03FFh PCIe
+//
+//-----------------------------------------------------
+#define REG_PCIE_MULTIFET_CTRL_8192E 0x036A //PCIE Multi-Fethc Control
+
+//-----------------------------------------------------
+//
+// 0x0400h ~ 0x047Fh Protocol Configuration
+//
+//-----------------------------------------------------
+#define REG_TXBF_CTRL_8192E 0x042C
+#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_NDPA_OPT_CTRL_8192E 0x045F
+#define REG_DATA_SC_8192E 0x0483
+#define REG_TXRPT_START_OFFSET 0x04AC
+#define REG_AMPDU_BURST_MODE_8192E 0x04BC
+#define REG_HT_SINGLE_AMPDU_8192E 0x04C7
+#define REG_MACID_PKT_DROP0_8192E 0x04D0
+
+//-----------------------------------------------------
+//
+// 0x0500h ~ 0x05FFh EDCA Configuration
+//
+//-----------------------------------------------------
+#define REG_CTWND_8192E 0x0572
+#define REG_SECONDARY_CCA_CTRL_8192E 0x0577
+#define REG_SCH_TXCMD_8192E 0x05F8
+
+//-----------------------------------------------------
+//
+// 0x0600h ~ 0x07FFh WMAC Configuration
+//
+//-----------------------------------------------------
+#define REG_MAC_CR_8192E 0x0600
+
+#define REG_MAC_TX_SM_STATE_8192E 0x06B4
+
+// Power
+#define REG_BFMER0_INFO_8192E 0x06E4
+#define REG_BFMER1_INFO_8192E 0x06EC
+#define REG_CSI_RPT_PARAM_BW20_8192E 0x06F4
+#define REG_CSI_RPT_PARAM_BW40_8192E 0x06F8
+#define REG_CSI_RPT_PARAM_BW80_8192E 0x06FC
+
+// Hardware Port 2
+#define REG_BFMEE_SEL_8192E 0x0714
+#define REG_SND_PTCL_CTRL_8192E 0x0718
+
+
+//-----------------------------------------------------
+//
+// Redifine register definition for compatibility
+//
+//-----------------------------------------------------
+
+// TODO: use these definition when using REG_xxx naming rule.
+// NOTE: DO NOT Remove these definition. Use later.
+#define ISR_8192E REG_HISR0_8192E
+
+//----------------------------------------------------------------------------
+// 8192E IMR/ISR bits (offset 0xB0, 8bits)
+//----------------------------------------------------------------------------
+#define IMR_DISABLED_8192E 0
+// IMR DW0(0x00B0-00B3) Bit 0-31
+#define IMR_TIMER2_8192E BIT31 // Timeout interrupt 2
+#define IMR_TIMER1_8192E BIT30 // Timeout interrupt 1
+#define IMR_PSTIMEOUT_8192E BIT29 // Power Save Time Out Interrupt
+#define IMR_GTINT4_8192E BIT28 // When GTIMER4 expires, this bit is set to 1
+#define IMR_GTINT3_8192E BIT27 // When GTIMER3 expires, this bit is set to 1
+#define IMR_TXBCN0ERR_8192E BIT26 // Transmit Beacon0 Error
+#define IMR_TXBCN0OK_8192E BIT25 // Transmit Beacon0 OK
+#define IMR_TSF_BIT32_TOGGLE_8192E BIT24 // TSF Timer BIT32 toggle indication interrupt
+#define IMR_BCNDMAINT0_8192E BIT20 // Beacon DMA Interrupt 0
+#define IMR_BCNDERR0_8192E BIT16 // Beacon Queue DMA OK0
+#define IMR_HSISR_IND_ON_INT_8192E BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1)
+#define IMR_BCNDMAINT_E_8192E BIT14 // Beacon DMA Interrupt Extension for Win7
+#define IMR_ATIMEND_8192E BIT12 // CTWidnow End or ATIM Window End
+#define IMR_C2HCMD_8192E BIT10 // CPU to Host Command INT Status, Write 1 clear
+#define IMR_CPWM2_8192E BIT9 // CPU power Mode exchange INT Status, Write 1 clear
+#define IMR_CPWM_8192E BIT8 // CPU power Mode exchange INT Status, Write 1 clear
+#define IMR_HIGHDOK_8192E BIT7 // High Queue DMA OK
+#define IMR_MGNTDOK_8192E BIT6 // Management Queue DMA OK
+#define IMR_BKDOK_8192E BIT5 // AC_BK DMA OK
+#define IMR_BEDOK_8192E BIT4 // AC_BE DMA OK
+#define IMR_VIDOK_8192E BIT3 // AC_VI DMA OK
+#define IMR_VODOK_8192E BIT2 // AC_VO DMA OK
+#define IMR_RDU_8192E BIT1 // Rx Descriptor Unavailable
+#define IMR_ROK_8192E BIT0 // Receive DMA OK
+
+// IMR DW1(0x00B4-00B7) Bit 0-31
+#define IMR_BCNDMAINT7_8192E BIT27 // Beacon DMA Interrupt 7
+#define IMR_BCNDMAINT6_8192E BIT26 // Beacon DMA Interrupt 6
+#define IMR_BCNDMAINT5_8192E BIT25 // Beacon DMA Interrupt 5
+#define IMR_BCNDMAINT4_8192E BIT24 // Beacon DMA Interrupt 4
+#define IMR_BCNDMAINT3_8192E BIT23 // Beacon DMA Interrupt 3
+#define IMR_BCNDMAINT2_8192E BIT22 // Beacon DMA Interrupt 2
+#define IMR_BCNDMAINT1_8192E BIT21 // Beacon DMA Interrupt 1
+#define IMR_BCNDOK7_8192E BIT20 // Beacon Queue DMA OK Interrup 7
+#define IMR_BCNDOK6_8192E BIT19 // Beacon Queue DMA OK Interrup 6
+#define IMR_BCNDOK5_8192E BIT18 // Beacon Queue DMA OK Interrup 5
+#define IMR_BCNDOK4_8192E BIT17 // Beacon Queue DMA OK Interrup 4
+#define IMR_BCNDOK3_8192E BIT16 // Beacon Queue DMA OK Interrup 3
+#define IMR_BCNDOK2_8192E BIT15 // Beacon Queue DMA OK Interrup 2
+#define IMR_BCNDOK1_8192E BIT14 // Beacon Queue DMA OK Interrup 1
+#define IMR_ATIMEND_E_8192E BIT13 // ATIM Window End Extension for Win7
+#define IMR_TXERR_8192E BIT11 // Tx Error Flag Interrupt Status, write 1 clear.
+#define IMR_RXERR_8192E BIT10 // Rx Error Flag INT Status, Write 1 clear
+#define IMR_TXFOVW_8192E BIT9 // Transmit FIFO Overflow
+#define IMR_RXFOVW_8192E BIT8 // Receive FIFO Overflow
+
+//----------------------------------------------------------------------------
+// 8192E Auto LLT bits (offset 0x224, 8bits)
+//----------------------------------------------------------------------------
+//224 REG_AUTO_LLT
+// move to hal_com_reg.h
+
+//----------------------------------------------------------------------------
+// 8192E Auto LLT bits (offset 0x290, 32bits)
+//----------------------------------------------------------------------------
+#define BIT_DMA_MODE BIT1
+#define BIT_USB_RXDMA_AGG_EN BIT31
+
+//----------------------------------------------------------------------------
+// 8192E REG_SYS_CFG1 (offset 0xF0, 32bits)
+//----------------------------------------------------------------------------
+#define BIT_SPSLDO_SEL BIT24
+
+
+//----------------------------------------------------------------------------
+// 8192E REG_CCK_CHECK (offset 0x454, 8bits)
+//----------------------------------------------------------------------------
+#define BIT_BCN_PORT_SEL BIT5
+
+//============================================================================
+// Regsiter Bit and Content definition
+//============================================================================
+
+//2 ACMHWCTRL 0x05C0
+#define AcmHw_HwEn_8192E BIT(0)
+#define AcmHw_VoqEn_8192E BIT(1)
+#define AcmHw_ViqEn_8192E BIT(2)
+#define AcmHw_BeqEn_8192E BIT(3)
+#define AcmHw_VoqStatus_8192E BIT(5)
+#define AcmHw_ViqStatus_8192E BIT(6)
+#define AcmHw_BeqStatus_8192E BIT(7)
+
+
+
+
+#endif //__RTL8192E_SPEC_H__
+
diff --git a/rtl8xxx_EU/include/rtl8192e_xmit.h b/rtl8xxx_EU/include/rtl8192e_xmit.h
index 200a111..c165972 100755
--- a/rtl8xxx_EU/include/rtl8192e_xmit.h
+++ b/rtl8xxx_EU/include/rtl8192e_xmit.h
@@ -1,413 +1,413 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __RTL8192E_XMIT_H__
-#define __RTL8192E_XMIT_H__
-
-typedef struct txdescriptor_8192e
-{
- //Offset 0
- u32 pktlen:16;
- u32 offset:8;
- u32 bmc:1;
- u32 htc:1;
- u32 ls:1;
- u32 fs:1;
- u32 linip:1;
- u32 noacm:1;
- u32 gf:1;
- u32 own:1;
-
- //Offset 4
- u32 macid:6;
- u32 rsvd0406:2;
- u32 qsel:5;
- u32 rd_nav_ext:1;
- u32 lsig_txop_en:1;
- u32 pifs:1;
- u32 rate_id:4;
- u32 navusehdr:1;
- u32 en_desc_id:1;
- u32 sectype:2;
- u32 rsvd0424:2;
- u32 pkt_offset:5; // unit: 8 bytes
- u32 rsvd0431:1;
-
- //Offset 8
- u32 rts_rc:6;
- u32 data_rc:6;
- u32 agg_en:1;
- u32 rd_en:1;
- u32 bar_rty_th:2;
- u32 bk:1;
- u32 morefrag:1;
- u32 raw:1;
- u32 ccx:1;
- u32 ampdu_density:3;
- u32 bt_null:1;
- u32 ant_sel_a:1;
- u32 ant_sel_b:1;
- u32 tx_ant_cck:2;
- u32 tx_antl:2;
- u32 tx_ant_ht:2;
-
- //Offset 12
- u32 nextheadpage:8;
- u32 tailpage:8;
- u32 seq:12;
- u32 cpu_handle:1;
- u32 tag1:1;
- u32 trigger_int:1;
- u32 hwseq_en:1;
-
- //Offset 16
- u32 rtsrate:5;
- u32 ap_dcfe:1;
- u32 hwseq_sel:2;
- u32 userate:1;
- u32 disrtsfb:1;
- u32 disdatafb:1;
- u32 cts2self:1;
- u32 rtsen:1;
- u32 hw_rts_en:1;
- u32 port_id:1;
- u32 pwr_status:3;
- u32 wait_dcts:1;
- u32 cts2ap_en:1;
- u32 data_sc:2;
- u32 data_stbc:2;
- u32 data_short:1;
- u32 data_bw:1;
- u32 rts_short:1;
- u32 rts_bw:1;
- u32 rts_sc:2;
- u32 vcs_stbc:2;
-
- //Offset 20
- u32 datarate:6;
- u32 sgi:1;
- u32 try_rate:1;
- u32 data_ratefb_lmt:5;
- u32 rts_ratefb_lmt:4;
- u32 rty_lmt_en:1;
- u32 data_rt_lmt:6;
- u32 usb_txagg_num:8;
-
- //Offset 24
- u32 txagg_a:5;
- u32 txagg_b:5;
- u32 use_max_len:1;
- u32 max_agg_num:5;
- u32 mcsg1_max_len:4;
- u32 mcsg2_max_len:4;
- u32 mcsg3_max_len:4;
- u32 mcs7_sgi_max_len:4;
-
- //Offset 28
- u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB)
- u32 mcsg4_max_len:4;
- u32 mcsg5_max_len:4;
- u32 mcsg6_max_len:4;
- u32 mcs15_sgi_max_len:4;
-}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)
-#define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value)
-#define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value)
-#define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value)
-#define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value)
-#define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value)
-#define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value)
-
-//
-//defined for TX DESC Operation
-//
-
-#define MAX_TID (15)
-
-//OFFSET 0
-#define OFFSET_SZ 0
-#define OFFSET_SHT 16
-#define BMC BIT(24)
-#define LSG BIT(26)
-#define FSG BIT(27)
-#define OWN BIT(31)
-
-
-//OFFSET 4
-#define PKT_OFFSET_SZ 0
-#define QSEL_SHT 8
-#define RATE_ID_SHT 16
-#define NAVUSEHDR BIT(20)
-#define SEC_TYPE_SHT 22
-#define PKT_OFFSET_SHT 26
-
-//OFFSET 8
-#define AGG_EN BIT(12)
-#define AGG_BK BIT(16)
-#define AMPDU_DENSITY_SHT 20
-#define ANTSEL_A BIT(24)
-#define ANTSEL_B BIT(25)
-#define TX_ANT_CCK_SHT 26
-#define TX_ANTL_SHT 28
-#define TX_ANT_HT_SHT 30
-
-//OFFSET 12
-#define SEQ_SHT 16
-#define EN_HWSEQ BIT(31)
-
-//OFFSET 16
-#define QOS BIT(6)
-#define HW_SSN BIT(7)
-#define USERATE BIT(8)
-#define DISDATAFB BIT(10)
-#define CTS_2_SELF BIT(11)
-#define RTS_EN BIT(12)
-#define HW_RTS_EN BIT(13)
-#define DATA_SHORT BIT(24)
-#define PWR_STATUS_SHT 15
-#define DATA_SC_SHT 20
-#define DATA_BW BIT(25)
-
-//OFFSET 20
-#define RTY_LMT_EN BIT(17)
-
-
-//OFFSET 20
-#define SGI BIT(6)
-#define USB_TXAGG_NUM_SHT 24
-
-
-
-//=====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_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)
-
-// Dword 1
-#define SET_TX_DESC_MACID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 0, 7, __Value)
-#define SET_TX_DESC_QUEUE_SEL_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 8, 5, __Value)
-#define SET_TX_DESC_RDG_NAV_EXT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 13, 1, __Value)
-#define SET_TX_DESC_LSIG_TXOP_EN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 14, 1, __Value)
-#define SET_TX_DESC_PIFS_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 15, 1, __Value)
-#define SET_TX_DESC_RATE_ID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 16, 5, __Value)
-#define SET_TX_DESC_EN_DESC_ID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 21, 1, __Value)
-#define SET_TX_DESC_SEC_TYPE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 22, 2, __Value)
-#define SET_TX_DESC_PKT_OFFSET_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 24, 5, __Value)
-#define SET_TX_DESC_MORE_DATA_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 29, 1, __Value)
-#define SET_TX_DESC_TXOP_PS_CAP_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 30, 1, __Value)
-#define SET_TX_DESC_TXOP_PS_MODE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 31, 1, __Value)
-
-
-// Dword 2
-#define SET_TX_DESC_PAID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 0, 9, __Value)
-#define SET_TX_DESC_CCA_RTS_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 10, 2, __Value)
-#define SET_TX_DESC_AGG_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 12, 1, __Value)
-#define SET_TX_DESC_RDG_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 13, 1, __Value)
-#define SET_TX_DESC_NULL_0_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 14, 1, __Value)
-#define SET_TX_DESC_NULL_1_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 15, 1, __Value)
-#define SET_TX_DESC_BK_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 16, 1, __Value)
-#define SET_TX_DESC_MORE_FRAG_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 17, 1, __Value)
-#define SET_TX_DESC_RAW_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 18, 1, __Value)
-#define GET_TX_DESC_MORE_FRAG_92E(__pTxDesc) LE_BITS_TO_4BYTE( __pTxDesc+8, 17, 1)
-#define SET_TX_DESC_SPE_RPT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 19, 1, __Value)
-#define SET_TX_DESC_AMPDU_DENSITY_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 20, 3, __Value)
-#define SET_TX_DESC_BT_NULL_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 23, 1, __Value)
-#define SET_TX_DESC_GID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 6, __Value)
-
-
-// Dword 3
-#define SET_TX_DESC_WHEADER_LEN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 0, 4, __Value)
-#define SET_TX_DESC_CHK_EN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 4, 1, __Value)
-#define SET_TX_DESC_EARLY_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 5, 1, __Value)
-#define SET_TX_DESC_HWSEQ_SEL_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 6, 2, __Value)
-#define SET_TX_DESC_USE_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 8, 1, __Value)
-#define SET_TX_DESC_DISABLE_RTS_FB_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 9, 1, __Value)
-#define SET_TX_DESC_DISABLE_FB_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 10, 1, __Value)
-#define SET_TX_DESC_CTS2SELF_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 11, 1, __Value)
-#define SET_TX_DESC_RTS_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 12, 1, __Value)
-#define SET_TX_DESC_HW_RTS_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 13, 1, __Value)
-#define SET_TX_DESC_HW_PORT_ID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 14, 1, __Value)
-#define SET_TX_DESC_NAV_USE_HDR_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 15, 1, __Value)
-#define SET_TX_DESC_USE_MAX_LEN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 16, 1, __Value)
-#define SET_TX_DESC_MAX_AGG_NUM_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 17, 5, __Value)
-#define SET_TX_DESC_NDPA_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 22, 2, __Value)
-#define SET_TX_DESC_AMPDU_MAX_TIME_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 24, 8, __Value)
-
-// Dword 4
-#define SET_TX_DESC_TX_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 0, 7, __Value)
-#define SET_TX_DESC_TRY_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 7, 1, __Value)
-#define SET_TX_DESC_DATA_RATE_FB_LIMIT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 8, 5, __Value)
-#define SET_TX_DESC_RTS_RATE_FB_LIMIT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 13, 4, __Value)
-#define SET_TX_DESC_RETRY_LIMIT_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 17, 1, __Value)
-#define SET_TX_DESC_DATA_RETRY_LIMIT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 18, 6, __Value)
-#define SET_TX_DESC_RTS_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 24, 5, __Value)
-#define SET_TX_DESC_PCTS_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 29, 1, __Value)
-#define SET_TX_DESC_PCTS_MASK_IDX_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 30, 2, __Value)
-
-
-// Dword 5
-#define SET_TX_DESC_DATA_SC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 0, 4, __Value)
-#define SET_TX_DESC_DATA_SHORT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 4, 1, __Value)
-#define SET_TX_DESC_DATA_BW_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 5, 2, __Value)
-#define SET_TX_DESC_DATA_LDPC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 7, 1, __Value)
-#define SET_TX_DESC_DATA_STBC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 8, 2, __Value)
-#define SET_TX_DESC_VCS_STBC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 10, 2, __Value)
-#define SET_TX_DESC_RTS_SHORT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 12, 1, __Value)
-#define SET_TX_DESC_RTS_SC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 13, 4, __Value)
-#define SET_TX_DESC_TX_ANT_92E(__pTxDesc,__Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 24, 4, __Value)
-#define SET_TX_DESC_TX_POWER_0_PSET_92E(__pTxDesc,__Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 28, 3, __Value)
-
-// Dword 6
-#define SET_TX_DESC_SW_DEFINE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 0, 12, __Value)
-#define SET_TX_DESC_MBSSID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 12, 4, __Value)
-#define SET_TX_DESC_ANTSEL_A_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 16, 3, __Value)
-#define SET_TX_DESC_ANTSEL_B_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 19, 3, __Value)
-#define SET_TX_DESC_ANTSEL_C_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 22, 3, __Value)
-#define SET_TX_DESC_ANTSEL_D_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 25, 3, __Value)
-
-// Dword 7
-#if(DEV_BUS_TYPE == RT_PCI_INTERFACE)
-#define SET_TX_DESC_TX_BUFFER_SIZE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
-#else
-#define SET_TX_DESC_TX_DESC_CHECKSUM_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
-#endif
-#define SET_TX_DESC_USB_TXAGG_NUM_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 24, 8, __Value)
-
-
-//#define SET_TX_DESC_HWSEQ_EN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 15, 1, __Value)
-// Dword 8
-
-#define SET_TX_DESC_RTS_RC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 0, 6, __Value)
-#define SET_TX_DESC_BAR_RTY_TH_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 6, 2, __Value)
-#define SET_TX_DESC_DATA_RC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 8, 6, __Value)
-#define SET_TX_DESC_EN_HWSEQ_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 15, 1, __Value)
-#define SET_TX_DESC_NEXT_HEAD_PAGE_92E(__pTxDesc,__Value)(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 16, 8, __Value)
-#define SET_TX_DESC_TAIL_PAGE_92E(__pTxDesc,__Value)(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 24, 8, __Value)
-
-// Dword 9
-#define SET_TX_DESC_PADDING_LENGTH_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 0, 11, __Value)
-#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)
-#define SET_EARLYMODE_LEN1_2_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 2, __Value)
-#define SET_EARLYMODE_LEN2_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 2, 15, __Value)
-#define SET_EARLYMODE_LEN3_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 17, 15, __Value)
-
-
-
-void rtl8192e_fill_fake_txdesc(PADAPTER padapter,u8*pDesc,u32 BufferLen,u8 IsPsPoll,u8 IsBTQosNull);
-
-#ifdef CONFIG_USB_HCI
-s32 rtl8192eu_init_xmit_priv(PADAPTER padapter);
-void rtl8192eu_free_xmit_priv(PADAPTER padapter);
-s32 rtl8192eu_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8192eu_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8192eu_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-s32 rtl8192eu_xmit_buf_handler(PADAPTER padapter);
-#define hal_xmit_handler rtl8192eu_xmit_buf_handler
-void rtl8192eu_xmit_tasklet(void *priv);
-s32 rtl8192eu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
-#endif
-
-#ifdef CONFIG_PCI_HCI
-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);
-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);
-void rtl8192ee_xmit_tasklet(void *priv);
-#endif
-
-
-struct txrpt_ccx_92e {
- /* offset 0 */
- u8 tag1:1;
- u8 pkt_num:3;
- u8 txdma_underflow:1;
- u8 int_bt:1;
- u8 int_tri:1;
- u8 int_ccx:1;
-
- /* offset 1 */
- u8 mac_id:6;
- u8 pkt_ok:1;
- u8 bmc:1;
-
- /* offset 2 */
- u8 retry_cnt:6;
- u8 lifetime_over:1;
- u8 retry_over:1;
-
- /* offset 3 */
- u8 ccx_qtime0;
- u8 ccx_qtime1;
-
- /* offset 5 */
- u8 final_data_rate;
-
- /* offset 6 */
- u8 sw1:4;
- u8 qsel:4;
-
- /* offset 7 */
- u8 sw0;
-};
-
-#ifdef CONFIG_TX_EARLY_MODE
-void UpdateEarlyModeInfo8192E(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmitbuf );
-#endif
-
-void _dbg_dump_tx_info(_adapter *padapter,int frame_tag,u8 *ptxdesc);
-
-u8 BWMapping_92E(PADAPTER Adapter, struct pkt_attrib *pattrib);
-
-u8 SCMapping_92E(PADAPTER Adapter, struct pkt_attrib *pattrib);
-
-#endif //__RTL8192E_XMIT_H__
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __RTL8192E_XMIT_H__
+#define __RTL8192E_XMIT_H__
+
+typedef struct txdescriptor_8192e
+{
+ //Offset 0
+ u32 pktlen:16;
+ u32 offset:8;
+ u32 bmc:1;
+ u32 htc:1;
+ u32 ls:1;
+ u32 fs:1;
+ u32 linip:1;
+ u32 noacm:1;
+ u32 gf:1;
+ u32 own:1;
+
+ //Offset 4
+ u32 macid:6;
+ u32 rsvd0406:2;
+ u32 qsel:5;
+ u32 rd_nav_ext:1;
+ u32 lsig_txop_en:1;
+ u32 pifs:1;
+ u32 rate_id:4;
+ u32 navusehdr:1;
+ u32 en_desc_id:1;
+ u32 sectype:2;
+ u32 rsvd0424:2;
+ u32 pkt_offset:5; // unit: 8 bytes
+ u32 rsvd0431:1;
+
+ //Offset 8
+ u32 rts_rc:6;
+ u32 data_rc:6;
+ u32 agg_en:1;
+ u32 rd_en:1;
+ u32 bar_rty_th:2;
+ u32 bk:1;
+ u32 morefrag:1;
+ u32 raw:1;
+ u32 ccx:1;
+ u32 ampdu_density:3;
+ u32 bt_null:1;
+ u32 ant_sel_a:1;
+ u32 ant_sel_b:1;
+ u32 tx_ant_cck:2;
+ u32 tx_antl:2;
+ u32 tx_ant_ht:2;
+
+ //Offset 12
+ u32 nextheadpage:8;
+ u32 tailpage:8;
+ u32 seq:12;
+ u32 cpu_handle:1;
+ u32 tag1:1;
+ u32 trigger_int:1;
+ u32 hwseq_en:1;
+
+ //Offset 16
+ u32 rtsrate:5;
+ u32 ap_dcfe:1;
+ u32 hwseq_sel:2;
+ u32 userate:1;
+ u32 disrtsfb:1;
+ u32 disdatafb:1;
+ u32 cts2self:1;
+ u32 rtsen:1;
+ u32 hw_rts_en:1;
+ u32 port_id:1;
+ u32 pwr_status:3;
+ u32 wait_dcts:1;
+ u32 cts2ap_en:1;
+ u32 data_sc:2;
+ u32 data_stbc:2;
+ u32 data_short:1;
+ u32 data_bw:1;
+ u32 rts_short:1;
+ u32 rts_bw:1;
+ u32 rts_sc:2;
+ u32 vcs_stbc:2;
+
+ //Offset 20
+ u32 datarate:6;
+ u32 sgi:1;
+ u32 try_rate:1;
+ u32 data_ratefb_lmt:5;
+ u32 rts_ratefb_lmt:4;
+ u32 rty_lmt_en:1;
+ u32 data_rt_lmt:6;
+ u32 usb_txagg_num:8;
+
+ //Offset 24
+ u32 txagg_a:5;
+ u32 txagg_b:5;
+ u32 use_max_len:1;
+ u32 max_agg_num:5;
+ u32 mcsg1_max_len:4;
+ u32 mcsg2_max_len:4;
+ u32 mcsg3_max_len:4;
+ u32 mcs7_sgi_max_len:4;
+
+ //Offset 28
+ u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB)
+ u32 mcsg4_max_len:4;
+ u32 mcsg5_max_len:4;
+ u32 mcsg6_max_len:4;
+ u32 mcs15_sgi_max_len:4;
+}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)
+#define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value)
+#define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value)
+#define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value)
+#define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value)
+#define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value)
+#define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value)
+
+//
+//defined for TX DESC Operation
+//
+
+#define MAX_TID (15)
+
+//OFFSET 0
+#define OFFSET_SZ 0
+#define OFFSET_SHT 16
+#define BMC BIT(24)
+#define LSG BIT(26)
+#define FSG BIT(27)
+#define OWN BIT(31)
+
+
+//OFFSET 4
+#define PKT_OFFSET_SZ 0
+#define QSEL_SHT 8
+#define RATE_ID_SHT 16
+#define NAVUSEHDR BIT(20)
+#define SEC_TYPE_SHT 22
+#define PKT_OFFSET_SHT 26
+
+//OFFSET 8
+#define AGG_EN BIT(12)
+#define AGG_BK BIT(16)
+#define AMPDU_DENSITY_SHT 20
+#define ANTSEL_A BIT(24)
+#define ANTSEL_B BIT(25)
+#define TX_ANT_CCK_SHT 26
+#define TX_ANTL_SHT 28
+#define TX_ANT_HT_SHT 30
+
+//OFFSET 12
+#define SEQ_SHT 16
+#define EN_HWSEQ BIT(31)
+
+//OFFSET 16
+#define QOS BIT(6)
+#define HW_SSN BIT(7)
+#define USERATE BIT(8)
+#define DISDATAFB BIT(10)
+#define CTS_2_SELF BIT(11)
+#define RTS_EN BIT(12)
+#define HW_RTS_EN BIT(13)
+#define DATA_SHORT BIT(24)
+#define PWR_STATUS_SHT 15
+#define DATA_SC_SHT 20
+#define DATA_BW BIT(25)
+
+//OFFSET 20
+#define RTY_LMT_EN BIT(17)
+
+
+//OFFSET 20
+#define SGI BIT(6)
+#define USB_TXAGG_NUM_SHT 24
+
+
+
+//=====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_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)
+
+// Dword 1
+#define SET_TX_DESC_MACID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 0, 7, __Value)
+#define SET_TX_DESC_QUEUE_SEL_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 8, 5, __Value)
+#define SET_TX_DESC_RDG_NAV_EXT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 13, 1, __Value)
+#define SET_TX_DESC_LSIG_TXOP_EN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 14, 1, __Value)
+#define SET_TX_DESC_PIFS_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 15, 1, __Value)
+#define SET_TX_DESC_RATE_ID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 16, 5, __Value)
+#define SET_TX_DESC_EN_DESC_ID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 21, 1, __Value)
+#define SET_TX_DESC_SEC_TYPE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 22, 2, __Value)
+#define SET_TX_DESC_PKT_OFFSET_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 24, 5, __Value)
+#define SET_TX_DESC_MORE_DATA_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 29, 1, __Value)
+#define SET_TX_DESC_TXOP_PS_CAP_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 30, 1, __Value)
+#define SET_TX_DESC_TXOP_PS_MODE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 31, 1, __Value)
+
+
+// Dword 2
+#define SET_TX_DESC_PAID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 0, 9, __Value)
+#define SET_TX_DESC_CCA_RTS_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 10, 2, __Value)
+#define SET_TX_DESC_AGG_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 12, 1, __Value)
+#define SET_TX_DESC_RDG_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 13, 1, __Value)
+#define SET_TX_DESC_NULL_0_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 14, 1, __Value)
+#define SET_TX_DESC_NULL_1_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 15, 1, __Value)
+#define SET_TX_DESC_BK_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 16, 1, __Value)
+#define SET_TX_DESC_MORE_FRAG_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 17, 1, __Value)
+#define SET_TX_DESC_RAW_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 18, 1, __Value)
+#define GET_TX_DESC_MORE_FRAG_92E(__pTxDesc) LE_BITS_TO_4BYTE( __pTxDesc+8, 17, 1)
+#define SET_TX_DESC_SPE_RPT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 19, 1, __Value)
+#define SET_TX_DESC_AMPDU_DENSITY_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 20, 3, __Value)
+#define SET_TX_DESC_BT_NULL_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 23, 1, __Value)
+#define SET_TX_DESC_GID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 6, __Value)
+
+
+// Dword 3
+#define SET_TX_DESC_WHEADER_LEN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 0, 4, __Value)
+#define SET_TX_DESC_CHK_EN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 4, 1, __Value)
+#define SET_TX_DESC_EARLY_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 5, 1, __Value)
+#define SET_TX_DESC_HWSEQ_SEL_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 6, 2, __Value)
+#define SET_TX_DESC_USE_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 8, 1, __Value)
+#define SET_TX_DESC_DISABLE_RTS_FB_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 9, 1, __Value)
+#define SET_TX_DESC_DISABLE_FB_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 10, 1, __Value)
+#define SET_TX_DESC_CTS2SELF_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 11, 1, __Value)
+#define SET_TX_DESC_RTS_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 12, 1, __Value)
+#define SET_TX_DESC_HW_RTS_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 13, 1, __Value)
+#define SET_TX_DESC_HW_PORT_ID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 14, 1, __Value)
+#define SET_TX_DESC_NAV_USE_HDR_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 15, 1, __Value)
+#define SET_TX_DESC_USE_MAX_LEN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 16, 1, __Value)
+#define SET_TX_DESC_MAX_AGG_NUM_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 17, 5, __Value)
+#define SET_TX_DESC_NDPA_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 22, 2, __Value)
+#define SET_TX_DESC_AMPDU_MAX_TIME_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 24, 8, __Value)
+
+// Dword 4
+#define SET_TX_DESC_TX_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 0, 7, __Value)
+#define SET_TX_DESC_TRY_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 7, 1, __Value)
+#define SET_TX_DESC_DATA_RATE_FB_LIMIT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 8, 5, __Value)
+#define SET_TX_DESC_RTS_RATE_FB_LIMIT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 13, 4, __Value)
+#define SET_TX_DESC_RETRY_LIMIT_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 17, 1, __Value)
+#define SET_TX_DESC_DATA_RETRY_LIMIT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 18, 6, __Value)
+#define SET_TX_DESC_RTS_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 24, 5, __Value)
+#define SET_TX_DESC_PCTS_ENABLE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 29, 1, __Value)
+#define SET_TX_DESC_PCTS_MASK_IDX_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 30, 2, __Value)
+
+
+// Dword 5
+#define SET_TX_DESC_DATA_SC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 0, 4, __Value)
+#define SET_TX_DESC_DATA_SHORT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 4, 1, __Value)
+#define SET_TX_DESC_DATA_BW_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 5, 2, __Value)
+#define SET_TX_DESC_DATA_LDPC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 7, 1, __Value)
+#define SET_TX_DESC_DATA_STBC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 8, 2, __Value)
+#define SET_TX_DESC_VCS_STBC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 10, 2, __Value)
+#define SET_TX_DESC_RTS_SHORT_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 12, 1, __Value)
+#define SET_TX_DESC_RTS_SC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 13, 4, __Value)
+#define SET_TX_DESC_TX_ANT_92E(__pTxDesc,__Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 24, 4, __Value)
+#define SET_TX_DESC_TX_POWER_0_PSET_92E(__pTxDesc,__Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 28, 3, __Value)
+
+// Dword 6
+#define SET_TX_DESC_SW_DEFINE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 0, 12, __Value)
+#define SET_TX_DESC_MBSSID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 12, 4, __Value)
+#define SET_TX_DESC_ANTSEL_A_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 16, 3, __Value)
+#define SET_TX_DESC_ANTSEL_B_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 19, 3, __Value)
+#define SET_TX_DESC_ANTSEL_C_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 22, 3, __Value)
+#define SET_TX_DESC_ANTSEL_D_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 25, 3, __Value)
+
+// Dword 7
+#if(DEV_BUS_TYPE == RT_PCI_INTERFACE)
+#define SET_TX_DESC_TX_BUFFER_SIZE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
+#else
+#define SET_TX_DESC_TX_DESC_CHECKSUM_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
+#endif
+#define SET_TX_DESC_USB_TXAGG_NUM_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 24, 8, __Value)
+
+
+//#define SET_TX_DESC_HWSEQ_EN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 15, 1, __Value)
+// Dword 8
+
+#define SET_TX_DESC_RTS_RC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 0, 6, __Value)
+#define SET_TX_DESC_BAR_RTY_TH_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 6, 2, __Value)
+#define SET_TX_DESC_DATA_RC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 8, 6, __Value)
+#define SET_TX_DESC_EN_HWSEQ_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 15, 1, __Value)
+#define SET_TX_DESC_NEXT_HEAD_PAGE_92E(__pTxDesc,__Value)(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 16, 8, __Value)
+#define SET_TX_DESC_TAIL_PAGE_92E(__pTxDesc,__Value)(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 24, 8, __Value)
+
+// Dword 9
+#define SET_TX_DESC_PADDING_LENGTH_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 0, 11, __Value)
+#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)
+#define SET_EARLYMODE_LEN1_2_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 2, __Value)
+#define SET_EARLYMODE_LEN2_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 2, 15, __Value)
+#define SET_EARLYMODE_LEN3_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 17, 15, __Value)
+
+
+
+void rtl8192e_fill_fake_txdesc(PADAPTER padapter,u8*pDesc,u32 BufferLen,u8 IsPsPoll,u8 IsBTQosNull);
+
+#ifdef CONFIG_USB_HCI
+s32 rtl8192eu_init_xmit_priv(PADAPTER padapter);
+void rtl8192eu_free_xmit_priv(PADAPTER padapter);
+s32 rtl8192eu_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8192eu_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8192eu_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+s32 rtl8192eu_xmit_buf_handler(PADAPTER padapter);
+#define hal_xmit_handler rtl8192eu_xmit_buf_handler
+void rtl8192eu_xmit_tasklet(void *priv);
+s32 rtl8192eu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
+#endif
+
+#ifdef CONFIG_PCI_HCI
+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);
+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);
+void rtl8192ee_xmit_tasklet(void *priv);
+#endif
+
+
+struct txrpt_ccx_92e {
+ /* offset 0 */
+ u8 tag1:1;
+ u8 pkt_num:3;
+ u8 txdma_underflow:1;
+ u8 int_bt:1;
+ u8 int_tri:1;
+ u8 int_ccx:1;
+
+ /* offset 1 */
+ u8 mac_id:6;
+ u8 pkt_ok:1;
+ u8 bmc:1;
+
+ /* offset 2 */
+ u8 retry_cnt:6;
+ u8 lifetime_over:1;
+ u8 retry_over:1;
+
+ /* offset 3 */
+ u8 ccx_qtime0;
+ u8 ccx_qtime1;
+
+ /* offset 5 */
+ u8 final_data_rate;
+
+ /* offset 6 */
+ u8 sw1:4;
+ u8 qsel:4;
+
+ /* offset 7 */
+ u8 sw0;
+};
+
+#ifdef CONFIG_TX_EARLY_MODE
+void UpdateEarlyModeInfo8192E(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmitbuf );
+#endif
+
+void _dbg_dump_tx_info(_adapter *padapter,int frame_tag,u8 *ptxdesc);
+
+u8 BWMapping_92E(PADAPTER Adapter, struct pkt_attrib *pattrib);
+
+u8 SCMapping_92E(PADAPTER Adapter, struct pkt_attrib *pattrib);
+
+#endif //__RTL8192E_XMIT_H__
+
diff --git a/rtl8xxx_EU/include/rtl8723a_hal.h b/rtl8xxx_EU/include/rtl8723a_hal.h
index 13c6861..47857c2 100755
--- a/rtl8xxx_EU/include/rtl8723a_hal.h
+++ b/rtl8xxx_EU/include/rtl8723a_hal.h
@@ -1,467 +1,467 @@
-/******************************************************************************
- *
- * 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 __RTL8723A_HAL_H__
-#define __RTL8723A_HAL_H__
-
-
-//#include "hal_com.h"
-#if 1
-#include "hal_data.h"
-#else
-#include "../hal/OUTSRC/odm_precomp.h"
-#endif
-
-#include "rtl8723a_spec.h"
-#include "rtl8723a_pg.h"
-#include "Hal8723APhyReg.h"
-#include "Hal8723APhyCfg.h"
-#include "rtl8723a_rf.h"
-#include "rtl8723a_dm.h"
-#include "rtl8723a_recv.h"
-#include "rtl8723a_xmit.h"
-#include "rtl8723a_cmd.h"
-#include "rtl8723a_led.h"
-#include "Hal8723PwrSeq.h"
-#ifdef DBG_CONFIG_ERROR_DETECT
-#include "rtl8723a_sreset.h"
-#endif
-
-
-#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
-
- //2TODO: We should define 8192S firmware related macro settings here!!
- #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
- #define RTL819X_TOTAL_RF_PATH 2
-
-//---------------------------------------------------------------------
-// RTL8723S From file
-//---------------------------------------------------------------------
- #define RTL8723_FW_UMC_IMG "rtl8723S\\rtl8723fw.bin"
- #define RTL8723_FW_UMC_B_IMG "rtl8723S\\rtl8723fw_B.bin"
- #define RTL8723_PHY_REG "rtl8723S\\PHY_REG_1T.txt"
- #define RTL8723_PHY_RADIO_A "rtl8723S\\radio_a_1T.txt"
- #define RTL8723_PHY_RADIO_B "rtl8723S\\radio_b_1T.txt"
- #define RTL8723_AGC_TAB "rtl8723S\\AGC_TAB_1T.txt"
- #define RTL8723_PHY_MACREG "rtl8723S\\MAC_REG.txt"
- #define RTL8723_PHY_REG_PG "rtl8723S\\PHY_REG_PG.txt"
- #define RTL8723_PHY_REG_MP "rtl8723S\\PHY_REG_MP.txt"
-
-//---------------------------------------------------------------------
-// RTL8723S From header
-//---------------------------------------------------------------------
-
- // Fw Array
- #define Rtl8723_FwImageArray Rtl8723SFwImgArray
- #define Rtl8723_FwUMCBCutImageArrayWithBT Rtl8723SFwUMCBCutImgArrayWithBT
- #define Rtl8723_FwUMCBCutImageArrayWithoutBT Rtl8723SFwUMCBCutImgArrayWithoutBT
-
- #define Rtl8723_ImgArrayLength Rtl8723SImgArrayLength
- #define Rtl8723_UMCBCutImgArrayWithBTLength Rtl8723SUMCBCutImgArrayWithBTLength
- #define Rtl8723_UMCBCutImgArrayWithoutBTLength Rtl8723SUMCBCutImgArrayWithoutBTLength
-
- #define Rtl8723_PHY_REG_Array_PG Rtl8723SPHY_REG_Array_PG
- #define Rtl8723_PHY_REG_Array_PGLength Rtl8723SPHY_REG_Array_PGLength
-#if MP_DRIVER == 1
- #define Rtl8723E_FwBTImgArray Rtl8723EFwBTImgArray
- #define Rtl8723E_FwBTImgArrayLength Rtl8723EBTImgArrayLength
-
- #define Rtl8723_FwUMCBCutMPImageArray Rtl8723SFwUMCBCutMPImgArray
- #define Rtl8723_UMCBCutMPImgArrayLength Rtl8723SUMCBCutMPImgArrayLength
-
- #define Rtl8723_PHY_REG_Array_MP Rtl8723SPHY_REG_Array_MP
- #define Rtl8723_PHY_REG_Array_MPLength Rtl8723SPHY_REG_Array_MPLength
-#endif
-
-#endif // CONFIG_SDIO_HCI
-
-#ifdef CONFIG_USB_HCI
-
- //2TODO: We should define 8192S firmware related macro settings here!!
- #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
- #define RTL819X_TOTAL_RF_PATH 2
-
- //TODO: The following need to check!!
- #define RTL8723_FW_UMC_IMG "rtl8192CU\\rtl8723fw.bin"
- #define RTL8723_FW_UMC_B_IMG "rtl8192CU\\rtl8723fw_B.bin"
- #define RTL8723_PHY_REG "rtl8723S\\PHY_REG_1T.txt"
- #define RTL8723_PHY_RADIO_A "rtl8723S\\radio_a_1T.txt"
- #define RTL8723_PHY_RADIO_B "rtl8723S\\radio_b_1T.txt"
- #define RTL8723_AGC_TAB "rtl8723S\\AGC_TAB_1T.txt"
- #define RTL8723_PHY_MACREG "rtl8723S\\MAC_REG.txt"
- #define RTL8723_PHY_REG_PG "rtl8723S\\PHY_REG_PG.txt"
- #define RTL8723_PHY_REG_MP "rtl8723S\\PHY_REG_MP.txt"
-
-//---------------------------------------------------------------------
-// RTL8723S From header
-//---------------------------------------------------------------------
-
- // Fw Array
- #define Rtl8723_FwImageArray Rtl8723UFwImgArray
- #define Rtl8723_FwUMCBCutImageArrayWithBT Rtl8723UFwUMCBCutImgArrayWithBT
- #define Rtl8723_FwUMCBCutImageArrayWithoutBT Rtl8723UFwUMCBCutImgArrayWithoutBT
-
- #define Rtl8723_ImgArrayLength Rtl8723UImgArrayLength
- #define Rtl8723_UMCBCutImgArrayWithBTLength Rtl8723UUMCBCutImgArrayWithBTLength
- #define Rtl8723_UMCBCutImgArrayWithoutBTLength Rtl8723UUMCBCutImgArrayWithoutBTLength
-
- #define Rtl8723_PHY_REG_Array_PG Rtl8723UPHY_REG_Array_PG
- #define Rtl8723_PHY_REG_Array_PGLength Rtl8723UPHY_REG_Array_PGLength
-
-#if MP_DRIVER == 1
- #define Rtl8723E_FwBTImgArray Rtl8723EFwBTImgArray
- #define Rtl8723E_FwBTImgArrayLength Rtl8723EBTImgArrayLength
-
- #define Rtl8723_FwUMCBCutMPImageArray Rtl8723SFwUMCBCutMPImgArray
- #define Rtl8723_UMCBCutMPImgArrayLength Rtl8723SUMCBCutMPImgArrayLength
-
- #define Rtl8723_PHY_REG_Array_MP Rtl8723UPHY_REG_Array_MP
- #define Rtl8723_PHY_REG_Array_MPLength Rtl8723UPHY_REG_Array_MPLength
-#endif
-#endif
-
-
-#define FW_8723A_SIZE 0x8000
-#define FW_8723A_START_ADDRESS 0x1000
-#define FW_8723A_END_ADDRESS 0x1FFF //0x5FFF
-
-
-#define IS_FW_HEADER_EXIST_8723A(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x92C0 ||\
- (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88C0 ||\
- (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x2300)
-
-
-typedef struct _RT_FIRMWARE_8723A {
- FIRMWARE_SOURCE eFWSource;
-#ifdef CONFIG_EMBEDDED_FWIMG
- u8* szFwBuffer;
-#else
- 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;
-
-//
-// This structure must be cared byte-ordering
-//
-// Added by tynli. 2009.12.04.
-typedef struct _RT_8723A_FIRMWARE_HDR
-{
- // 8-byte alinment required
-
- //--- LONG WORD 0 ----
- u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
- u8 Category; // AP/NIC and USB/PCI
- u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
- u16 Version; // FW Version
- u8 Subversion; // FW Subversion, default 0x00
- u16 Rsvd1;
-
-
- //--- LONG WORD 1 ----
- u8 Month; // Release time Month field
- u8 Date; // Release time Date field
- u8 Hour; // Release time Hour field
- u8 Minute; // Release time Minute field
- u16 RamCodeSize; // The size of RAM code
- u16 Rsvd2;
-
- //--- LONG WORD 2 ----
- u32 SvnIdx; // The SVN entry index
- u32 Rsvd3;
-
- //--- LONG WORD 3 ----
- u32 Rsvd4;
- u32 Rsvd5;
-}RT_8723A_FIRMWARE_HDR, *PRT_8723A_FIRMWARE_HDR;
-
-#define DRIVER_EARLY_INT_TIME_8723A 0x05
-#define BCN_DMA_ATIME_INT_TIME_8723A 0x02
-
-//For General Reserved Page Number(Beacon Queue is reserved page)
-//Beacon:2, PS-Poll:1, Null Data:1,Qos Null Data:1,BT Qos Null Data:1
-#define BCNQ_PAGE_NUM_8723A 0x08
-
-#define TX_TOTAL_PAGE_NUMBER_8723A (0xFF - BCNQ_PAGE_NUM_8723A)
-#define TX_PAGE_BOUNDARY_8723A (TX_TOTAL_PAGE_NUMBER_8723A + 1)
-
-#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8723A TX_TOTAL_PAGE_NUMBER_8723A
-#define WMM_NORMAL_TX_PAGE_BOUNDARY_8723A (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8723A + 1)
-
-// For Normal Chip Setting
-// (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER_8723A
-#define NORMAL_PAGE_NUM_HPQ_8723A 0x0C
-#define NORMAL_PAGE_NUM_LPQ_8723A 0x02
-#define NORMAL_PAGE_NUM_NPQ_8723A 0x02
-
-// Note: For Normal Chip Setting, modify later
-#define WMM_NORMAL_PAGE_NUM_HPQ_8723A 0x29
-#define WMM_NORMAL_PAGE_NUM_LPQ_8723A 0x1C
-#define WMM_NORMAL_PAGE_NUM_NPQ_8723A 0x1C
-
-
-//-------------------------------------------------------------------------
-// Chip specific
-//-------------------------------------------------------------------------
-#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3)
-#define CHIP_BONDING_92C_1T2R 0x1
-#define CHIP_BONDING_88C_USB_MCARD 0x2
-#define CHIP_BONDING_88C_USB_HP 0x1
-
-//-------------------------------------------------------------------------
-// Channel Plan
-//-------------------------------------------------------------------------
-
-
-#define HAL_EFUSE_MEMORY
-
-#define EFUSE_REAL_CONTENT_LEN 512
-#define EFUSE_MAP_LEN 128
-#define EFUSE_MAX_SECTION 16
-#define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
-#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN)
-//
-// <Roger_Notes>
-// To prevent out of boundary programming case,
-// leave 1byte and program full section
-// 9bytes + 1byt + 5bytes and pre 1byte.
-// For worst case:
-// | 1byte|----8bytes----|1byte|--5bytes--|
-// | | Reserved(14bytes) |
-//
-
-// PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte.
-#define EFUSE_OOB_PROTECT_BYTES 15
-
-#define EFUSE_REAL_CONTENT_LEN_8723A 512
-#define EFUSE_MAP_LEN_8723A 256
-#define EFUSE_MAX_SECTION_8723A 32
-
-//========================================================
-// EFUSE for BT definition
-//========================================================
-#define EFUSE_BT_REAL_BANK_CONTENT_LEN 512
-#define EFUSE_BT_REAL_CONTENT_LEN 1536 // 512*3
-#define EFUSE_BT_MAP_LEN 1024 // 1k bytes
-#define EFUSE_BT_MAX_SECTION 128 // 1024/8
-
-#define EFUSE_PROTECT_BYTES_BANK 16
-
-
-// Description: Determine the types of C2H events that are the same in driver and Fw.
-// Fisrt constructed by tynli. 2009.10.09.
-typedef enum _RTL8192C_C2H_EVT
-{
- C2H_DBG = 0,
- C2H_TSF = 1,
- C2H_AP_RPT_RSP = 2,
- C2H_CCX_TX_RPT = 3, // The FW notify the report of the specific tx packet.
- C2H_BT_RSSI = 4,
- C2H_BT_OP_MODE = 5,
- C2H_EXT_RA_RPT = 6,
- C2H_HW_INFO_EXCH = 10,
- C2H_C2H_H2C_TEST = 11,
- C2H_BT_INFO = 12,
- C2H_BT_MP_INFO = 15,
- MAX_C2HEVENT
-} RTL8192C_C2H_EVT;
-
-
-#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
-#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
-
-typedef struct rxreport_8723a
-{
- u32 pktlen:14;
- u32 crc32:1;
- u32 icverr:1;
- u32 drvinfosize:4;
- u32 security:3;
- u32 qos:1;
- u32 shift:2;
- u32 physt:1;
- u32 swdec:1;
- u32 ls:1;
- u32 fs:1;
- u32 eor:1;
- u32 own:1;
-
- u32 macid:5;
- u32 tid:4;
- u32 hwrsvd:4;
- u32 amsdu:1;
- u32 paggr:1;
- u32 faggr:1;
- u32 a1fit:4;
- u32 a2fit:4;
- u32 pam:1;
- u32 pwr:1;
- u32 md:1;
- u32 mf:1;
- u32 type:2;
- u32 mc:1;
- u32 bc:1;
-
- u32 seq:12;
- u32 frag:4;
- u32 nextpktlen:14;
- u32 nextind:1;
- u32 rsvd0831:1;
-
- u32 rxmcs:6;
- u32 rxht:1;
- u32 gf:1;
- u32 splcp:1;
- u32 bw:1;
- u32 htc:1;
- u32 eosp:1;
- u32 bssidfit:2;
- u32 rsvd1214:16;
- u32 unicastwake:1;
- u32 magicwake:1;
-
- u32 pattern0match:1;
- u32 pattern1match:1;
- u32 pattern2match:1;
- u32 pattern3match:1;
- u32 pattern4match:1;
- u32 pattern5match:1;
- u32 pattern6match:1;
- u32 pattern7match:1;
- u32 pattern8match:1;
- u32 pattern9match:1;
- u32 patternamatch:1;
- u32 patternbmatch:1;
- u32 patterncmatch:1;
- u32 rsvd1613:19;
-
- u32 tsfl;
-
- u32 bassn:12;
- u32 bavld:1;
- u32 rsvd2413:19;
-} RXREPORT, *PRXREPORT;
-
-typedef struct phystatus_8723a
-{
- u32 rxgain_a:7;
- u32 trsw_a:1;
- u32 rxgain_b:7;
- u32 trsw_b:1;
- u32 chcorr_l:16;
-
- u32 sigqualcck:8;
- u32 cfo_a:8;
- u32 cfo_b:8;
- u32 chcorr_h:8;
-
- u32 noisepwrdb_h:8;
- u32 cfo_tail_a:8;
- u32 cfo_tail_b:8;
- u32 rsvd0824:8;
-
- u32 rsvd1200:8;
- u32 rxevm_a:8;
- u32 rxevm_b:8;
- u32 rxsnr_a:8;
-
- u32 rxsnr_b:8;
- u32 noisepwrdb_l:8;
- u32 rsvd1616:8;
- u32 postsnr_a:8;
-
- u32 postsnr_b:8;
- u32 csi_a:8;
- u32 csi_b:8;
- u32 targetcsi_a:8;
-
- u32 targetcsi_b:8;
- u32 sigevm:8;
- u32 maxexpwr:8;
- u32 exintflag:1;
- u32 sgien:1;
- u32 rxsc:2;
- u32 idlelong:1;
- u32 anttrainen:1;
- u32 antselb:1;
- u32 antsel:1;
-} PHYSTATUS, *PPHYSTATUS;
-
-
-// rtl8723a_hal_init.c
-s32 rtl8723a_FirmwareDownload(PADAPTER padapter);
-void rtl8723a_FirmwareSelfReset(PADAPTER padapter);
-void rtl8723a_InitializeFirmwareVars(PADAPTER padapter);
-
-void rtl8723a_InitAntenna_Selection(PADAPTER padapter);
-void rtl8723a_DeinitAntenna_Selection(PADAPTER padapter);
-void rtl8723a_CheckAntenna_Selection(PADAPTER padapter);
-void rtl8723a_init_default_value(PADAPTER padapter);
-
-s32 InitLLTTable(PADAPTER padapter, u32 boundary);
-
-s32 CardDisableHWSM(PADAPTER padapter, u8 resetMCU);
-s32 CardDisableWithoutHWSM(PADAPTER padapter);
-
-// EFuse
-u8 GetEEPROMSize8723A(PADAPTER padapter);
-void Hal_InitPGData(PADAPTER padapter, u8 *PROMContent);
-void Hal_EfuseParseIDCode(PADAPTER padapter, u8 *hwinfo);
-void Hal_EfuseParseTxPowerInfo_8723A(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseBTCoexistInfo_8723A(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseEEPROMVer(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void rtl8723a_EfuseParseChnlPlan(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseCustomerID(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseAntennaDiversity(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseRateIndicationOption(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseXtal_8723A(PADAPTER pAdapter, u8 *hwinfo, u8 AutoLoadFail);
-void Hal_EfuseParseThermalMeter_8723A(PADAPTER padapter, u8 *hwinfo, u8 AutoLoadFail);
-
-//RT_CHANNEL_DOMAIN rtl8723a_HalMapChannelPlan(PADAPTER padapter, u8 HalChannelPlan);
-//VERSION_8192C rtl8723a_ReadChipVersion(PADAPTER padapter);
-//void rtl8723a_ReadBluetoothCoexistInfo(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoloadFail);
-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);
-#ifdef CONFIG_BT_COEXIST
-void rtl8723a_SingleDualAntennaDetection(PADAPTER padapter);
-#endif
-int FirmwareDownloadBT(PADAPTER Adapter, PRT_MP_FIRMWARE pFirmware);
-
-// register
-void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits);
-void rtl8723a_InitBeaconParameters(PADAPTER padapter);
-void rtl8723a_InitBeaconMaxError(PADAPTER padapter, u8 InfraMode);
-
-void rtl8723a_start_thread(_adapter *padapter);
-void rtl8723a_stop_thread(_adapter *padapter);
-
-s32 c2h_id_filter_ccx_8723a(u8 *buf);
-void _InitTransferPageSize(PADAPTER padapter);
-#endif// __RTL8723A_HAL_H__
-
+/******************************************************************************
+ *
+ * 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 __RTL8723A_HAL_H__
+#define __RTL8723A_HAL_H__
+
+
+//#include "hal_com.h"
+#if 1
+#include "hal_data.h"
+#else
+#include "../hal/OUTSRC/odm_precomp.h"
+#endif
+
+#include "rtl8723a_spec.h"
+#include "rtl8723a_pg.h"
+#include "Hal8723APhyReg.h"
+#include "Hal8723APhyCfg.h"
+#include "rtl8723a_rf.h"
+#include "rtl8723a_dm.h"
+#include "rtl8723a_recv.h"
+#include "rtl8723a_xmit.h"
+#include "rtl8723a_cmd.h"
+#include "rtl8723a_led.h"
+#include "Hal8723PwrSeq.h"
+#ifdef DBG_CONFIG_ERROR_DETECT
+#include "rtl8723a_sreset.h"
+#endif
+
+
+#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
+
+ //2TODO: We should define 8192S firmware related macro settings here!!
+ #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
+ #define RTL819X_TOTAL_RF_PATH 2
+
+//---------------------------------------------------------------------
+// RTL8723S From file
+//---------------------------------------------------------------------
+ #define RTL8723_FW_UMC_IMG "rtl8723S\\rtl8723fw.bin"
+ #define RTL8723_FW_UMC_B_IMG "rtl8723S\\rtl8723fw_B.bin"
+ #define RTL8723_PHY_REG "rtl8723S\\PHY_REG_1T.txt"
+ #define RTL8723_PHY_RADIO_A "rtl8723S\\radio_a_1T.txt"
+ #define RTL8723_PHY_RADIO_B "rtl8723S\\radio_b_1T.txt"
+ #define RTL8723_AGC_TAB "rtl8723S\\AGC_TAB_1T.txt"
+ #define RTL8723_PHY_MACREG "rtl8723S\\MAC_REG.txt"
+ #define RTL8723_PHY_REG_PG "rtl8723S\\PHY_REG_PG.txt"
+ #define RTL8723_PHY_REG_MP "rtl8723S\\PHY_REG_MP.txt"
+
+//---------------------------------------------------------------------
+// RTL8723S From header
+//---------------------------------------------------------------------
+
+ // Fw Array
+ #define Rtl8723_FwImageArray Rtl8723SFwImgArray
+ #define Rtl8723_FwUMCBCutImageArrayWithBT Rtl8723SFwUMCBCutImgArrayWithBT
+ #define Rtl8723_FwUMCBCutImageArrayWithoutBT Rtl8723SFwUMCBCutImgArrayWithoutBT
+
+ #define Rtl8723_ImgArrayLength Rtl8723SImgArrayLength
+ #define Rtl8723_UMCBCutImgArrayWithBTLength Rtl8723SUMCBCutImgArrayWithBTLength
+ #define Rtl8723_UMCBCutImgArrayWithoutBTLength Rtl8723SUMCBCutImgArrayWithoutBTLength
+
+ #define Rtl8723_PHY_REG_Array_PG Rtl8723SPHY_REG_Array_PG
+ #define Rtl8723_PHY_REG_Array_PGLength Rtl8723SPHY_REG_Array_PGLength
+#if MP_DRIVER == 1
+ #define Rtl8723E_FwBTImgArray Rtl8723EFwBTImgArray
+ #define Rtl8723E_FwBTImgArrayLength Rtl8723EBTImgArrayLength
+
+ #define Rtl8723_FwUMCBCutMPImageArray Rtl8723SFwUMCBCutMPImgArray
+ #define Rtl8723_UMCBCutMPImgArrayLength Rtl8723SUMCBCutMPImgArrayLength
+
+ #define Rtl8723_PHY_REG_Array_MP Rtl8723SPHY_REG_Array_MP
+ #define Rtl8723_PHY_REG_Array_MPLength Rtl8723SPHY_REG_Array_MPLength
+#endif
+
+#endif // CONFIG_SDIO_HCI
+
+#ifdef CONFIG_USB_HCI
+
+ //2TODO: We should define 8192S firmware related macro settings here!!
+ #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
+ #define RTL819X_TOTAL_RF_PATH 2
+
+ //TODO: The following need to check!!
+ #define RTL8723_FW_UMC_IMG "rtl8192CU\\rtl8723fw.bin"
+ #define RTL8723_FW_UMC_B_IMG "rtl8192CU\\rtl8723fw_B.bin"
+ #define RTL8723_PHY_REG "rtl8723S\\PHY_REG_1T.txt"
+ #define RTL8723_PHY_RADIO_A "rtl8723S\\radio_a_1T.txt"
+ #define RTL8723_PHY_RADIO_B "rtl8723S\\radio_b_1T.txt"
+ #define RTL8723_AGC_TAB "rtl8723S\\AGC_TAB_1T.txt"
+ #define RTL8723_PHY_MACREG "rtl8723S\\MAC_REG.txt"
+ #define RTL8723_PHY_REG_PG "rtl8723S\\PHY_REG_PG.txt"
+ #define RTL8723_PHY_REG_MP "rtl8723S\\PHY_REG_MP.txt"
+
+//---------------------------------------------------------------------
+// RTL8723S From header
+//---------------------------------------------------------------------
+
+ // Fw Array
+ #define Rtl8723_FwImageArray Rtl8723UFwImgArray
+ #define Rtl8723_FwUMCBCutImageArrayWithBT Rtl8723UFwUMCBCutImgArrayWithBT
+ #define Rtl8723_FwUMCBCutImageArrayWithoutBT Rtl8723UFwUMCBCutImgArrayWithoutBT
+
+ #define Rtl8723_ImgArrayLength Rtl8723UImgArrayLength
+ #define Rtl8723_UMCBCutImgArrayWithBTLength Rtl8723UUMCBCutImgArrayWithBTLength
+ #define Rtl8723_UMCBCutImgArrayWithoutBTLength Rtl8723UUMCBCutImgArrayWithoutBTLength
+
+ #define Rtl8723_PHY_REG_Array_PG Rtl8723UPHY_REG_Array_PG
+ #define Rtl8723_PHY_REG_Array_PGLength Rtl8723UPHY_REG_Array_PGLength
+
+#if MP_DRIVER == 1
+ #define Rtl8723E_FwBTImgArray Rtl8723EFwBTImgArray
+ #define Rtl8723E_FwBTImgArrayLength Rtl8723EBTImgArrayLength
+
+ #define Rtl8723_FwUMCBCutMPImageArray Rtl8723SFwUMCBCutMPImgArray
+ #define Rtl8723_UMCBCutMPImgArrayLength Rtl8723SUMCBCutMPImgArrayLength
+
+ #define Rtl8723_PHY_REG_Array_MP Rtl8723UPHY_REG_Array_MP
+ #define Rtl8723_PHY_REG_Array_MPLength Rtl8723UPHY_REG_Array_MPLength
+#endif
+#endif
+
+
+#define FW_8723A_SIZE 0x8000
+#define FW_8723A_START_ADDRESS 0x1000
+#define FW_8723A_END_ADDRESS 0x1FFF //0x5FFF
+
+
+#define IS_FW_HEADER_EXIST_8723A(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x92C0 ||\
+ (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88C0 ||\
+ (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x2300)
+
+
+typedef struct _RT_FIRMWARE_8723A {
+ FIRMWARE_SOURCE eFWSource;
+#ifdef CONFIG_EMBEDDED_FWIMG
+ u8* szFwBuffer;
+#else
+ 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;
+
+//
+// This structure must be cared byte-ordering
+//
+// Added by tynli. 2009.12.04.
+typedef struct _RT_8723A_FIRMWARE_HDR
+{
+ // 8-byte alinment required
+
+ //--- LONG WORD 0 ----
+ u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
+ u8 Category; // AP/NIC and USB/PCI
+ u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
+ u16 Version; // FW Version
+ u8 Subversion; // FW Subversion, default 0x00
+ u16 Rsvd1;
+
+
+ //--- LONG WORD 1 ----
+ u8 Month; // Release time Month field
+ u8 Date; // Release time Date field
+ u8 Hour; // Release time Hour field
+ u8 Minute; // Release time Minute field
+ u16 RamCodeSize; // The size of RAM code
+ u16 Rsvd2;
+
+ //--- LONG WORD 2 ----
+ u32 SvnIdx; // The SVN entry index
+ u32 Rsvd3;
+
+ //--- LONG WORD 3 ----
+ u32 Rsvd4;
+ u32 Rsvd5;
+}RT_8723A_FIRMWARE_HDR, *PRT_8723A_FIRMWARE_HDR;
+
+#define DRIVER_EARLY_INT_TIME_8723A 0x05
+#define BCN_DMA_ATIME_INT_TIME_8723A 0x02
+
+//For General Reserved Page Number(Beacon Queue is reserved page)
+//Beacon:2, PS-Poll:1, Null Data:1,Qos Null Data:1,BT Qos Null Data:1
+#define BCNQ_PAGE_NUM_8723A 0x08
+
+#define TX_TOTAL_PAGE_NUMBER_8723A (0xFF - BCNQ_PAGE_NUM_8723A)
+#define TX_PAGE_BOUNDARY_8723A (TX_TOTAL_PAGE_NUMBER_8723A + 1)
+
+#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8723A TX_TOTAL_PAGE_NUMBER_8723A
+#define WMM_NORMAL_TX_PAGE_BOUNDARY_8723A (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8723A + 1)
+
+// For Normal Chip Setting
+// (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER_8723A
+#define NORMAL_PAGE_NUM_HPQ_8723A 0x0C
+#define NORMAL_PAGE_NUM_LPQ_8723A 0x02
+#define NORMAL_PAGE_NUM_NPQ_8723A 0x02
+
+// Note: For Normal Chip Setting, modify later
+#define WMM_NORMAL_PAGE_NUM_HPQ_8723A 0x29
+#define WMM_NORMAL_PAGE_NUM_LPQ_8723A 0x1C
+#define WMM_NORMAL_PAGE_NUM_NPQ_8723A 0x1C
+
+
+//-------------------------------------------------------------------------
+// Chip specific
+//-------------------------------------------------------------------------
+#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3)
+#define CHIP_BONDING_92C_1T2R 0x1
+#define CHIP_BONDING_88C_USB_MCARD 0x2
+#define CHIP_BONDING_88C_USB_HP 0x1
+
+//-------------------------------------------------------------------------
+// Channel Plan
+//-------------------------------------------------------------------------
+
+
+#define HAL_EFUSE_MEMORY
+
+#define EFUSE_REAL_CONTENT_LEN 512
+#define EFUSE_MAP_LEN 128
+#define EFUSE_MAX_SECTION 16
+#define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
+#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN)
+//
+// <Roger_Notes>
+// To prevent out of boundary programming case,
+// leave 1byte and program full section
+// 9bytes + 1byt + 5bytes and pre 1byte.
+// For worst case:
+// | 1byte|----8bytes----|1byte|--5bytes--|
+// | | Reserved(14bytes) |
+//
+
+// PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte.
+#define EFUSE_OOB_PROTECT_BYTES 15
+
+#define EFUSE_REAL_CONTENT_LEN_8723A 512
+#define EFUSE_MAP_LEN_8723A 256
+#define EFUSE_MAX_SECTION_8723A 32
+
+//========================================================
+// EFUSE for BT definition
+//========================================================
+#define EFUSE_BT_REAL_BANK_CONTENT_LEN 512
+#define EFUSE_BT_REAL_CONTENT_LEN 1536 // 512*3
+#define EFUSE_BT_MAP_LEN 1024 // 1k bytes
+#define EFUSE_BT_MAX_SECTION 128 // 1024/8
+
+#define EFUSE_PROTECT_BYTES_BANK 16
+
+
+// Description: Determine the types of C2H events that are the same in driver and Fw.
+// Fisrt constructed by tynli. 2009.10.09.
+typedef enum _RTL8192C_C2H_EVT
+{
+ C2H_DBG = 0,
+ C2H_TSF = 1,
+ C2H_AP_RPT_RSP = 2,
+ C2H_CCX_TX_RPT = 3, // The FW notify the report of the specific tx packet.
+ C2H_BT_RSSI = 4,
+ C2H_BT_OP_MODE = 5,
+ C2H_EXT_RA_RPT = 6,
+ C2H_HW_INFO_EXCH = 10,
+ C2H_C2H_H2C_TEST = 11,
+ C2H_BT_INFO = 12,
+ C2H_BT_MP_INFO = 15,
+ MAX_C2HEVENT
+} RTL8192C_C2H_EVT;
+
+
+#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
+#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
+
+typedef struct rxreport_8723a
+{
+ u32 pktlen:14;
+ u32 crc32:1;
+ u32 icverr:1;
+ u32 drvinfosize:4;
+ u32 security:3;
+ u32 qos:1;
+ u32 shift:2;
+ u32 physt:1;
+ u32 swdec:1;
+ u32 ls:1;
+ u32 fs:1;
+ u32 eor:1;
+ u32 own:1;
+
+ u32 macid:5;
+ u32 tid:4;
+ u32 hwrsvd:4;
+ u32 amsdu:1;
+ u32 paggr:1;
+ u32 faggr:1;
+ u32 a1fit:4;
+ u32 a2fit:4;
+ u32 pam:1;
+ u32 pwr:1;
+ u32 md:1;
+ u32 mf:1;
+ u32 type:2;
+ u32 mc:1;
+ u32 bc:1;
+
+ u32 seq:12;
+ u32 frag:4;
+ u32 nextpktlen:14;
+ u32 nextind:1;
+ u32 rsvd0831:1;
+
+ u32 rxmcs:6;
+ u32 rxht:1;
+ u32 gf:1;
+ u32 splcp:1;
+ u32 bw:1;
+ u32 htc:1;
+ u32 eosp:1;
+ u32 bssidfit:2;
+ u32 rsvd1214:16;
+ u32 unicastwake:1;
+ u32 magicwake:1;
+
+ u32 pattern0match:1;
+ u32 pattern1match:1;
+ u32 pattern2match:1;
+ u32 pattern3match:1;
+ u32 pattern4match:1;
+ u32 pattern5match:1;
+ u32 pattern6match:1;
+ u32 pattern7match:1;
+ u32 pattern8match:1;
+ u32 pattern9match:1;
+ u32 patternamatch:1;
+ u32 patternbmatch:1;
+ u32 patterncmatch:1;
+ u32 rsvd1613:19;
+
+ u32 tsfl;
+
+ u32 bassn:12;
+ u32 bavld:1;
+ u32 rsvd2413:19;
+} RXREPORT, *PRXREPORT;
+
+typedef struct phystatus_8723a
+{
+ u32 rxgain_a:7;
+ u32 trsw_a:1;
+ u32 rxgain_b:7;
+ u32 trsw_b:1;
+ u32 chcorr_l:16;
+
+ u32 sigqualcck:8;
+ u32 cfo_a:8;
+ u32 cfo_b:8;
+ u32 chcorr_h:8;
+
+ u32 noisepwrdb_h:8;
+ u32 cfo_tail_a:8;
+ u32 cfo_tail_b:8;
+ u32 rsvd0824:8;
+
+ u32 rsvd1200:8;
+ u32 rxevm_a:8;
+ u32 rxevm_b:8;
+ u32 rxsnr_a:8;
+
+ u32 rxsnr_b:8;
+ u32 noisepwrdb_l:8;
+ u32 rsvd1616:8;
+ u32 postsnr_a:8;
+
+ u32 postsnr_b:8;
+ u32 csi_a:8;
+ u32 csi_b:8;
+ u32 targetcsi_a:8;
+
+ u32 targetcsi_b:8;
+ u32 sigevm:8;
+ u32 maxexpwr:8;
+ u32 exintflag:1;
+ u32 sgien:1;
+ u32 rxsc:2;
+ u32 idlelong:1;
+ u32 anttrainen:1;
+ u32 antselb:1;
+ u32 antsel:1;
+} PHYSTATUS, *PPHYSTATUS;
+
+
+// rtl8723a_hal_init.c
+s32 rtl8723a_FirmwareDownload(PADAPTER padapter);
+void rtl8723a_FirmwareSelfReset(PADAPTER padapter);
+void rtl8723a_InitializeFirmwareVars(PADAPTER padapter);
+
+void rtl8723a_InitAntenna_Selection(PADAPTER padapter);
+void rtl8723a_DeinitAntenna_Selection(PADAPTER padapter);
+void rtl8723a_CheckAntenna_Selection(PADAPTER padapter);
+void rtl8723a_init_default_value(PADAPTER padapter);
+
+s32 InitLLTTable(PADAPTER padapter, u32 boundary);
+
+s32 CardDisableHWSM(PADAPTER padapter, u8 resetMCU);
+s32 CardDisableWithoutHWSM(PADAPTER padapter);
+
+// EFuse
+u8 GetEEPROMSize8723A(PADAPTER padapter);
+void Hal_InitPGData(PADAPTER padapter, u8 *PROMContent);
+void Hal_EfuseParseIDCode(PADAPTER padapter, u8 *hwinfo);
+void Hal_EfuseParseTxPowerInfo_8723A(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseBTCoexistInfo_8723A(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseEEPROMVer(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void rtl8723a_EfuseParseChnlPlan(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseCustomerID(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseAntennaDiversity(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseRateIndicationOption(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseXtal_8723A(PADAPTER pAdapter, u8 *hwinfo, u8 AutoLoadFail);
+void Hal_EfuseParseThermalMeter_8723A(PADAPTER padapter, u8 *hwinfo, u8 AutoLoadFail);
+
+//RT_CHANNEL_DOMAIN rtl8723a_HalMapChannelPlan(PADAPTER padapter, u8 HalChannelPlan);
+//VERSION_8192C rtl8723a_ReadChipVersion(PADAPTER padapter);
+//void rtl8723a_ReadBluetoothCoexistInfo(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoloadFail);
+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);
+#ifdef CONFIG_BT_COEXIST
+void rtl8723a_SingleDualAntennaDetection(PADAPTER padapter);
+#endif
+int FirmwareDownloadBT(PADAPTER Adapter, PRT_MP_FIRMWARE pFirmware);
+
+// register
+void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits);
+void rtl8723a_InitBeaconParameters(PADAPTER padapter);
+void rtl8723a_InitBeaconMaxError(PADAPTER padapter, u8 InfraMode);
+
+void rtl8723a_start_thread(_adapter *padapter);
+void rtl8723a_stop_thread(_adapter *padapter);
+
+s32 c2h_id_filter_ccx_8723a(u8 *buf);
+void _InitTransferPageSize(PADAPTER padapter);
+#endif// __RTL8723A_HAL_H__
+
diff --git a/rtl8xxx_EU/include/rtl8723a_led.h b/rtl8xxx_EU/include/rtl8723a_led.h
index 5a5b8ab..862ac79 100755
--- a/rtl8xxx_EU/include/rtl8723a_led.h
+++ b/rtl8xxx_EU/include/rtl8723a_led.h
@@ -1,45 +1,45 @@
-/******************************************************************************
- *
- * 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 __RTL8723A_LED_H__
-#define __RTL8723A_LED_H__
-
-
-//================================================================================
-// Interface to manipulate LED objects.
-//================================================================================
-#ifdef CONFIG_USB_HCI
-void rtl8723au_InitSwLeds(PADAPTER padapter);
-void rtl8723au_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_PCI_HCI
-void rtl8723ae_InitSwLeds(PADAPTER padapter);
-void rtl8723ae_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_SDIO_HCI
-void rtl8723as_InitSwLeds(PADAPTER padapter);
-void rtl8723as_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_GSPI_HCI
-void rtl8723as_InitSwLeds(PADAPTER padapter);
-void rtl8723as_DeInitSwLeds(PADAPTER padapter);
-#endif
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8723A_LED_H__
+#define __RTL8723A_LED_H__
+
+
+//================================================================================
+// Interface to manipulate LED objects.
+//================================================================================
+#ifdef CONFIG_USB_HCI
+void rtl8723au_InitSwLeds(PADAPTER padapter);
+void rtl8723au_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_PCI_HCI
+void rtl8723ae_InitSwLeds(PADAPTER padapter);
+void rtl8723ae_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_SDIO_HCI
+void rtl8723as_InitSwLeds(PADAPTER padapter);
+void rtl8723as_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_GSPI_HCI
+void rtl8723as_InitSwLeds(PADAPTER padapter);
+void rtl8723as_DeInitSwLeds(PADAPTER padapter);
+#endif
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8723a_recv.h b/rtl8xxx_EU/include/rtl8723a_recv.h
index 9883167..c7765cc 100755
--- a/rtl8xxx_EU/include/rtl8723a_recv.h
+++ b/rtl8xxx_EU/include/rtl8723a_recv.h
@@ -1,41 +1,41 @@
-/******************************************************************************
- *
- * 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 __RTL8723A_RECV_H__
-#define __RTL8723A_RECV_H__
-
-#include <rtl8192c_recv.h>
-
-
-#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
-#ifdef CONFIG_DIRECT_RECV
-void rtl8723as_recv(PADAPTER padapter, struct recv_buf *precvbuf);
-#endif
-s32 rtl8723as_init_recv_priv(PADAPTER padapter);
-void rtl8723as_free_recv_priv(PADAPTER padapter);
-#endif
-
-void rtl8192c_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat);
-void rtl8192c_process_phy_info(PADAPTER padapter, void *prframe);
-#ifdef CONFIG_USB_HCI
-void update_recvframe_attrib(union recv_frame *precvframe, struct recv_stat *prxstat);
-void update_recvframe_phyinfo(union recv_frame *precvframe, struct phy_stat *pphy_info);
-#endif
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8723A_RECV_H__
+#define __RTL8723A_RECV_H__
+
+#include <rtl8192c_recv.h>
+
+
+#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
+#ifdef CONFIG_DIRECT_RECV
+void rtl8723as_recv(PADAPTER padapter, struct recv_buf *precvbuf);
+#endif
+s32 rtl8723as_init_recv_priv(PADAPTER padapter);
+void rtl8723as_free_recv_priv(PADAPTER padapter);
+#endif
+
+void rtl8192c_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat);
+void rtl8192c_process_phy_info(PADAPTER padapter, void *prframe);
+#ifdef CONFIG_USB_HCI
+void update_recvframe_attrib(union recv_frame *precvframe, struct recv_stat *prxstat);
+void update_recvframe_phyinfo(union recv_frame *precvframe, struct phy_stat *pphy_info);
+#endif
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8723a_spec.h b/rtl8xxx_EU/include/rtl8723a_spec.h
index 6f67856..1c34f6d 100755
--- a/rtl8xxx_EU/include/rtl8723a_spec.h
+++ b/rtl8xxx_EU/include/rtl8723a_spec.h
@@ -1,103 +1,103 @@
-/******************************************************************************
- *
- * 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 __RTL8723A_SPEC_H__
-#define __RTL8723A_SPEC_H__
-
-#include <rtl8192c_spec.h>
-
-
-//============================================================================
-// 8723A Regsiter offset definition
-//============================================================================
-
-//-----------------------------------------------------
-//
-// 0x0000h ~ 0x00FFh System Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0100h ~ 0x01FFh MACTOP General Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0200h ~ 0x027Fh TXDMA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0280h ~ 0x02FFh RXDMA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0300h ~ 0x03FFh PCIe
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0400h ~ 0x047Fh Protocol Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0500h ~ 0x05FFh EDCA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0600h ~ 0x07FFh WMAC Configuration
-//
-//-----------------------------------------------------
-
-#define REG_BT_COEX_TABLE_1 0x06C0
-#define REG_BT_COEX_TABLE_2 0x06C4
-
-//============================================================================
-// 8723 Regsiter Bit and Content definition
-//============================================================================
-
-//2 HSISR
-// interrupt mask which needs to clear
-#define MASK_HSISR_CLEAR (HSISR_GPIO12_0_INT |\
- HSISR_SPS_OCP_INT |\
- HSISR_RON_INT |\
- HSISR_PDNINT |\
- HSISR_GPIO9_INT)
-
-
-//----------------------------------------------------------------------------
-// 8723 EFUSE
-//----------------------------------------------------------------------------
-
-//============================================================================
-// General definitions
-//============================================================================
-
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8723A_SPEC_H__
+#define __RTL8723A_SPEC_H__
+
+#include <rtl8192c_spec.h>
+
+
+//============================================================================
+// 8723A Regsiter offset definition
+//============================================================================
+
+//-----------------------------------------------------
+//
+// 0x0000h ~ 0x00FFh System Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0100h ~ 0x01FFh MACTOP General Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0200h ~ 0x027Fh TXDMA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0280h ~ 0x02FFh RXDMA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0300h ~ 0x03FFh PCIe
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0400h ~ 0x047Fh Protocol Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0500h ~ 0x05FFh EDCA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0600h ~ 0x07FFh WMAC Configuration
+//
+//-----------------------------------------------------
+
+#define REG_BT_COEX_TABLE_1 0x06C0
+#define REG_BT_COEX_TABLE_2 0x06C4
+
+//============================================================================
+// 8723 Regsiter Bit and Content definition
+//============================================================================
+
+//2 HSISR
+// interrupt mask which needs to clear
+#define MASK_HSISR_CLEAR (HSISR_GPIO12_0_INT |\
+ HSISR_SPS_OCP_INT |\
+ HSISR_RON_INT |\
+ HSISR_PDNINT |\
+ HSISR_GPIO9_INT)
+
+
+//----------------------------------------------------------------------------
+// 8723 EFUSE
+//----------------------------------------------------------------------------
+
+//============================================================================
+// General definitions
+//============================================================================
+
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8723a_xmit.h b/rtl8xxx_EU/include/rtl8723a_xmit.h
index a4bc48d..ab1a79f 100755
--- a/rtl8xxx_EU/include/rtl8723a_xmit.h
+++ b/rtl8xxx_EU/include/rtl8723a_xmit.h
@@ -1,237 +1,237 @@
-/******************************************************************************
- *
- * 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 __RTL8723A_XMIT_H__
-#define __RTL8723A_XMIT_H__
-
-#include <rtl8192c_xmit.h>
-
-//
-//defined for TX DESC Operation
-//
-
-#define MAX_TID (15)
-
-//OFFSET 0
-#define OFFSET_SZ 0
-#define OFFSET_SHT 16
-#define BMC BIT(24)
-#define LSG BIT(26)
-#define FSG BIT(27)
-#define OWN BIT(31)
-
-
-//OFFSET 4
-#define PKT_OFFSET_SZ 0
-#define BK BIT(6)
-#define QSEL_SHT 8
-#define Rate_ID_SHT 16
-#define NAVUSEHDR BIT(20)
-#define PKT_OFFSET_SHT 26
-#define HWPC BIT(31)
-
-//OFFSET 8
-#define AGG_EN BIT(29)
-
-//OFFSET 12
-#define SEQ_SHT 16
-
-//OFFSET 16
-#define QoS BIT(6)
-#define HW_SEQ_EN BIT(7)
-#define USERATE BIT(8)
-#define DISDATAFB BIT(10)
-#define DATA_SHORT BIT(24)
-#define DATA_BW BIT(25)
-
-//OFFSET 20
-#define SGI BIT(6)
-
-typedef struct txdesc_8723a
-{
- u32 pktlen:16;
- u32 offset:8;
- u32 bmc:1;
- u32 htc:1;
- u32 ls:1;
- u32 fs:1;
- u32 linip:1;
- u32 noacm:1;
- u32 gf:1;
- u32 own:1;
-
- u32 macid:5;
- u32 agg_en:1;
- u32 bk:1;
- u32 rd_en:1;
- u32 qsel:5;
- u32 rd_nav_ext:1;
- u32 lsig_txop_en:1;
- u32 pifs:1;
- u32 rate_id:4;
- u32 navusehdr:1;
- u32 en_desc_id:1;
- u32 sectype:2;
- u32 rsvd0424:2;
- u32 pkt_offset:5; // unit: 8 bytes
- u32 rsvd0431:1;
-
- u32 rts_rc:6;
- u32 data_rc:6;
- u32 rsvd0812:2;
- u32 bar_rty_th:2;
- u32 rsvd0816:1;
- u32 morefrag:1;
- u32 raw:1;
- u32 ccx:1;
- u32 ampdu_density:3;
- u32 bt_null:1;
- u32 ant_sel_a:1;
- u32 ant_sel_b:1;
- u32 tx_ant_cck:2;
- u32 tx_antl:2;
- u32 tx_ant_ht:2;
-
- u32 nextheadpage:8;
- u32 tailpage:8;
- u32 seq:12;
- u32 cpu_handle:1;
- u32 tag1:1;
- u32 trigger_int:1;
- u32 hwseq_en:1;
-
- u32 rtsrate:5;
- u32 ap_dcfe:1;
- u32 hwseq_sel:2;
- u32 userate:1;
- u32 disrtsfb:1;
- u32 disdatafb:1;
- u32 cts2self:1;
- u32 rtsen:1;
- u32 hw_rts_en:1;
- u32 port_id:1;
- u32 rsvd1615:3;
- u32 wait_dcts:1;
- u32 cts2ap_en:1;
- u32 data_sc:2;
- u32 data_stbc:2;
- u32 data_short:1;
- u32 data_bw:1;
- u32 rts_short:1;
- u32 rts_bw:1;
- u32 rts_sc:2;
- u32 vcs_stbc:2;
-
- u32 datarate:6;
- u32 sgi:1;
- u32 try_rate:1;
- u32 data_ratefb_lmt:5;
- u32 rts_ratefb_lmt:4;
- u32 rty_lmt_en:1;
- u32 data_rt_lmt:6;
- u32 usb_txagg_num:8;
-
- u32 txagg_a:5;
- u32 txagg_b:5;
- u32 use_max_len:1;
- u32 max_agg_num:5;
- u32 mcsg1_max_len:4;
- u32 mcsg2_max_len:4;
- u32 mcsg3_max_len:4;
- u32 mcs7_sgi_max_len:4;
-
- u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB)
- u32 mcsg4_max_len:4;
- u32 mcsg5_max_len:4;
- u32 mcsg6_max_len:4;
- u32 mcs15_sgi_max_len:4;
-}TXDESC_8723A, *PTXDESC_8723A;
-
-
-#define txdesc_set_ccx_sw_8723a(txdesc, value) \
- do { \
- ((struct txdesc_8723a *)(txdesc))->mcsg4_max_len = (((value)>>8) & 0x0f); \
- ((struct txdesc_8723a *)(txdesc))->mcs15_sgi_max_len= (((value)>>4) & 0x0f); \
- ((struct txdesc_8723a *)(txdesc))->mcsg6_max_len = ((value) & 0x0f); \
- } while (0)
-
-struct txrpt_ccx_8723a {
- /* offset 0 */
- u8 tag1:1;
- u8 rsvd:4;
- u8 int_bt:1;
- u8 int_tri:1;
- u8 int_ccx:1;
-
- /* offset 1 */
- u8 mac_id:5;
- u8 pkt_drop:1;
- u8 pkt_ok:1;
- u8 bmc:1;
-
- /* offset 2 */
- u8 retry_cnt:6;
- u8 lifetime_over:1;
- u8 retry_over:1;
-
- /* offset 3 */
- u8 ccx_qtime0;
- u8 ccx_qtime1;
-
- /* offset 5 */
- u8 final_data_rate;
-
- /* offset 6 */
- u8 sw1:4;
- u8 qsel:4;
-
- /* offset 7 */
- u8 sw0;
-};
-
-#define txrpt_ccx_sw_8723a(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8))
-#define txrpt_ccx_qtime_8723a(txrpt_ccx) ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8))
-
-#ifdef CONFIG_XMIT_ACK
-void dump_txrpt_ccx_8723a(void *buf);
-void handle_txrpt_ccx_8723a(_adapter *adapter, void *buf);
-#else
-#define dump_txrpt_ccx_8723a(buf) do {} while(0)
-#define handle_txrpt_ccx_8723a(adapter, buf) do {} while(0)
-#endif //CONFIG_XMIT_ACK
-
-void rtl8723a_update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem);
-void rtl8723a_fill_fake_txdesc(PADAPTER padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull);
-
-#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
-s32 rtl8723as_init_xmit_priv(PADAPTER padapter);
-void rtl8723as_free_xmit_priv(PADAPTER padapter);
-s32 rtl8723as_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8723as_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8723as_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-s32 rtl8723as_xmit_buf_handler(PADAPTER padapter);
-thread_return rtl8723as_xmit_thread(thread_context context);
-#endif
-
-#ifdef CONFIG_USB_HCI
-s32 rtl8723au_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-s32 rtl8723au_xmit_buf_handler(PADAPTER padapter);
-#endif
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8723A_XMIT_H__
+#define __RTL8723A_XMIT_H__
+
+#include <rtl8192c_xmit.h>
+
+//
+//defined for TX DESC Operation
+//
+
+#define MAX_TID (15)
+
+//OFFSET 0
+#define OFFSET_SZ 0
+#define OFFSET_SHT 16
+#define BMC BIT(24)
+#define LSG BIT(26)
+#define FSG BIT(27)
+#define OWN BIT(31)
+
+
+//OFFSET 4
+#define PKT_OFFSET_SZ 0
+#define BK BIT(6)
+#define QSEL_SHT 8
+#define Rate_ID_SHT 16
+#define NAVUSEHDR BIT(20)
+#define PKT_OFFSET_SHT 26
+#define HWPC BIT(31)
+
+//OFFSET 8
+#define AGG_EN BIT(29)
+
+//OFFSET 12
+#define SEQ_SHT 16
+
+//OFFSET 16
+#define QoS BIT(6)
+#define HW_SEQ_EN BIT(7)
+#define USERATE BIT(8)
+#define DISDATAFB BIT(10)
+#define DATA_SHORT BIT(24)
+#define DATA_BW BIT(25)
+
+//OFFSET 20
+#define SGI BIT(6)
+
+typedef struct txdesc_8723a
+{
+ u32 pktlen:16;
+ u32 offset:8;
+ u32 bmc:1;
+ u32 htc:1;
+ u32 ls:1;
+ u32 fs:1;
+ u32 linip:1;
+ u32 noacm:1;
+ u32 gf:1;
+ u32 own:1;
+
+ u32 macid:5;
+ u32 agg_en:1;
+ u32 bk:1;
+ u32 rd_en:1;
+ u32 qsel:5;
+ u32 rd_nav_ext:1;
+ u32 lsig_txop_en:1;
+ u32 pifs:1;
+ u32 rate_id:4;
+ u32 navusehdr:1;
+ u32 en_desc_id:1;
+ u32 sectype:2;
+ u32 rsvd0424:2;
+ u32 pkt_offset:5; // unit: 8 bytes
+ u32 rsvd0431:1;
+
+ u32 rts_rc:6;
+ u32 data_rc:6;
+ u32 rsvd0812:2;
+ u32 bar_rty_th:2;
+ u32 rsvd0816:1;
+ u32 morefrag:1;
+ u32 raw:1;
+ u32 ccx:1;
+ u32 ampdu_density:3;
+ u32 bt_null:1;
+ u32 ant_sel_a:1;
+ u32 ant_sel_b:1;
+ u32 tx_ant_cck:2;
+ u32 tx_antl:2;
+ u32 tx_ant_ht:2;
+
+ u32 nextheadpage:8;
+ u32 tailpage:8;
+ u32 seq:12;
+ u32 cpu_handle:1;
+ u32 tag1:1;
+ u32 trigger_int:1;
+ u32 hwseq_en:1;
+
+ u32 rtsrate:5;
+ u32 ap_dcfe:1;
+ u32 hwseq_sel:2;
+ u32 userate:1;
+ u32 disrtsfb:1;
+ u32 disdatafb:1;
+ u32 cts2self:1;
+ u32 rtsen:1;
+ u32 hw_rts_en:1;
+ u32 port_id:1;
+ u32 rsvd1615:3;
+ u32 wait_dcts:1;
+ u32 cts2ap_en:1;
+ u32 data_sc:2;
+ u32 data_stbc:2;
+ u32 data_short:1;
+ u32 data_bw:1;
+ u32 rts_short:1;
+ u32 rts_bw:1;
+ u32 rts_sc:2;
+ u32 vcs_stbc:2;
+
+ u32 datarate:6;
+ u32 sgi:1;
+ u32 try_rate:1;
+ u32 data_ratefb_lmt:5;
+ u32 rts_ratefb_lmt:4;
+ u32 rty_lmt_en:1;
+ u32 data_rt_lmt:6;
+ u32 usb_txagg_num:8;
+
+ u32 txagg_a:5;
+ u32 txagg_b:5;
+ u32 use_max_len:1;
+ u32 max_agg_num:5;
+ u32 mcsg1_max_len:4;
+ u32 mcsg2_max_len:4;
+ u32 mcsg3_max_len:4;
+ u32 mcs7_sgi_max_len:4;
+
+ u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB)
+ u32 mcsg4_max_len:4;
+ u32 mcsg5_max_len:4;
+ u32 mcsg6_max_len:4;
+ u32 mcs15_sgi_max_len:4;
+}TXDESC_8723A, *PTXDESC_8723A;
+
+
+#define txdesc_set_ccx_sw_8723a(txdesc, value) \
+ do { \
+ ((struct txdesc_8723a *)(txdesc))->mcsg4_max_len = (((value)>>8) & 0x0f); \
+ ((struct txdesc_8723a *)(txdesc))->mcs15_sgi_max_len= (((value)>>4) & 0x0f); \
+ ((struct txdesc_8723a *)(txdesc))->mcsg6_max_len = ((value) & 0x0f); \
+ } while (0)
+
+struct txrpt_ccx_8723a {
+ /* offset 0 */
+ u8 tag1:1;
+ u8 rsvd:4;
+ u8 int_bt:1;
+ u8 int_tri:1;
+ u8 int_ccx:1;
+
+ /* offset 1 */
+ u8 mac_id:5;
+ u8 pkt_drop:1;
+ u8 pkt_ok:1;
+ u8 bmc:1;
+
+ /* offset 2 */
+ u8 retry_cnt:6;
+ u8 lifetime_over:1;
+ u8 retry_over:1;
+
+ /* offset 3 */
+ u8 ccx_qtime0;
+ u8 ccx_qtime1;
+
+ /* offset 5 */
+ u8 final_data_rate;
+
+ /* offset 6 */
+ u8 sw1:4;
+ u8 qsel:4;
+
+ /* offset 7 */
+ u8 sw0;
+};
+
+#define txrpt_ccx_sw_8723a(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8))
+#define txrpt_ccx_qtime_8723a(txrpt_ccx) ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8))
+
+#ifdef CONFIG_XMIT_ACK
+void dump_txrpt_ccx_8723a(void *buf);
+void handle_txrpt_ccx_8723a(_adapter *adapter, void *buf);
+#else
+#define dump_txrpt_ccx_8723a(buf) do {} while(0)
+#define handle_txrpt_ccx_8723a(adapter, buf) do {} while(0)
+#endif //CONFIG_XMIT_ACK
+
+void rtl8723a_update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem);
+void rtl8723a_fill_fake_txdesc(PADAPTER padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull);
+
+#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
+s32 rtl8723as_init_xmit_priv(PADAPTER padapter);
+void rtl8723as_free_xmit_priv(PADAPTER padapter);
+s32 rtl8723as_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8723as_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8723as_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+s32 rtl8723as_xmit_buf_handler(PADAPTER padapter);
+thread_return rtl8723as_xmit_thread(thread_context context);
+#endif
+
+#ifdef CONFIG_USB_HCI
+s32 rtl8723au_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+s32 rtl8723au_xmit_buf_handler(PADAPTER padapter);
+#endif
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8723b_hal.h b/rtl8xxx_EU/include/rtl8723b_hal.h
index d7a99a4..3beb340 100755
--- a/rtl8xxx_EU/include/rtl8723b_hal.h
+++ b/rtl8xxx_EU/include/rtl8723b_hal.h
@@ -1,338 +1,338 @@
-/******************************************************************************
- *
- * 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 __RTL8723B_HAL_H__
-#define __RTL8723B_HAL_H__
-
-#include "hal_data.h"
-
-#include "rtl8723b_spec.h"
-#include "rtl8723b_rf.h"
-#include "rtl8723b_dm.h"
-#include "rtl8723b_recv.h"
-#include "rtl8723b_xmit.h"
-#include "rtl8723b_cmd.h"
-#include "rtl8723b_led.h"
-#include "Hal8723BPwrSeq.h"
-#include "Hal8723BPhyReg.h"
-#include "Hal8723BPhyCfg.h"
-#ifdef DBG_CONFIG_ERROR_DETECT
-#include "rtl8723b_sreset.h"
-#endif
-
-
-//---------------------------------------------------------------------
-// RTL8723B From file
-//---------------------------------------------------------------------
- #define RTL8723B_FW_IMG "rtl8723b/FW_NIC.bin"
- #define RTL8723B_FW_WW_IMG "rtl8723b/FW_WoWLAN.bin"
- #define RTL8723B_PHY_REG "rtl8723b/PHY_REG.txt"
- #define RTL8723B_PHY_RADIO_A "rtl8723b/RadioA.txt"
- #define RTL8723B_PHY_RADIO_B "rtl8723b/RadioB.txt"
- #define RTL8723B_TXPWR_TRACK "rtl8723b/TxPowerTrack.txt"
- #define RTL8723B_AGC_TAB "rtl8723b/AGC_TAB.txt"
- #define RTL8723B_PHY_MACREG "rtl8723b/MAC_REG.txt"
- #define RTL8723B_PHY_REG_PG "rtl8723b/PHY_REG_PG.txt"
- #define RTL8723B_PHY_REG_MP "rtl8723b/PHY_REG_MP.txt"
- #define RTL8723B_TXPWR_LMT "rtl8723b/TXPWR_LMT.txt"
-
-//---------------------------------------------------------------------
-// RTL8723B From header
-//---------------------------------------------------------------------
-
-#if MP_DRIVER == 1
- #define Rtl8723B_FwBTImgArray Rtl8723BFwBTImgArray
- #define Rtl8723B_FwBTImgArrayLength Rtl8723BFwBTImgArrayLength
-
- #define Rtl8723B_FwMPImageArray Rtl8723BFwMPImgArray
- #define Rtl8723B_FwMPImgArrayLength Rtl8723BMPImgArrayLength
-
- #define Rtl8723B_PHY_REG_Array_MP Rtl8723B_PHYREG_Array_MP
- #define Rtl8723B_PHY_REG_Array_MPLength Rtl8723B_PHYREG_Array_MPLength
-#endif
-
-
-#define FW_8723B_SIZE 0x8000
-#define FW_8723B_START_ADDRESS 0x1000
-#define FW_8723B_END_ADDRESS 0x1FFF //0x5FFF
-
-#define IS_FW_HEADER_EXIST_8723B(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x5300)
-
-typedef struct _RT_FIRMWARE {
- FIRMWARE_SOURCE eFWSource;
-#ifdef CONFIG_EMBEDDED_FWIMG
- u8* szFwBuffer;
-#else
- 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;
-
-//
-// This structure must be cared byte-ordering
-//
-// Added by tynli. 2009.12.04.
-typedef struct _RT_8723B_FIRMWARE_HDR
-{
- // 8-byte alinment required
-
- //--- LONG WORD 0 ----
- u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
- u8 Category; // AP/NIC and USB/PCI
- u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
- u16 Version; // FW Version
- u16 Subversion; // FW Subversion, default 0x00
-
- //--- LONG WORD 1 ----
- u8 Month; // Release time Month field
- u8 Date; // Release time Date field
- u8 Hour; // Release time Hour field
- u8 Minute; // Release time Minute field
- u16 RamCodeSize; // The size of RAM code
- u16 Rsvd2;
-
- //--- LONG WORD 2 ----
- u32 SvnIdx; // The SVN entry index
- u32 Rsvd3;
-
- //--- LONG WORD 3 ----
- u32 Rsvd4;
- u32 Rsvd5;
-}RT_8723B_FIRMWARE_HDR, *PRT_8723B_FIRMWARE_HDR;
-
-#define DRIVER_EARLY_INT_TIME_8723B 0x05
-#define BCN_DMA_ATIME_INT_TIME_8723B 0x02
-
-// for 8723B
-// TX 32K, RX 16K, Page size 128B for TX, 8B for RX
-#define PAGE_SIZE_TX_8723B 128
-#define PAGE_SIZE_RX_8723B 8
-
-#define RX_DMA_SIZE_8723B 0x4000 // 16K
-#define RX_DMA_RESERVED_SIZE_8723B 0x80 // 128B, reserved for tx report
-#define RX_DMA_BOUNDARY_8723B (RX_DMA_SIZE_8723B - RX_DMA_RESERVED_SIZE_8723B - 1)
-
-
-// Note: We will divide number of page equally for each queue other than public queue!
-
-//For General Reserved Page Number(Beacon Queue is reserved page)
-//Beacon:2, PS-Poll:1, Null Data:1,Qos Null Data:1,BT Qos Null Data:1
-#define BCNQ_PAGE_NUM_8723B 0x08
-#ifdef CONFIG_CONCURRENT_MODE
-#define BCNQ1_PAGE_NUM_8723B 0x08 // 0x04
-#else
-#define BCNQ1_PAGE_NUM_8723B 0x00
-#endif
-
-#ifdef CONFIG_PNO_SUPPORT
-#undef BCNQ1_PAGE_NUM_8723B
-#define BCNQ1_PAGE_NUM_8723B 0x00 // 0x04
-#endif
-#define MAX_RX_DMA_BUFFER_SIZE_8723B 0x2800 // RX 10K
-
-//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_8723B 0x07
-#else
-#define WOWLAN_PAGE_NUM_8723B 0x00
-#endif
-
-#ifdef CONFIG_PNO_SUPPORT
-#undef WOWLAN_PAGE_NUM_8723B
-#define WOWLAN_PAGE_NUM_8723B 0x0d
-#endif
-
-#ifdef CONFIG_AP_WOWLAN
-#define AP_WOWLAN_PAGE_NUM_8723B 0x02
-#endif
-
-#define TX_TOTAL_PAGE_NUMBER_8723B (0xFF - BCNQ_PAGE_NUM_8723B - BCNQ1_PAGE_NUM_8723B - WOWLAN_PAGE_NUM_8723B)
-#define TX_PAGE_BOUNDARY_8723B (TX_TOTAL_PAGE_NUMBER_8723B + 1)
-
-#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8723B TX_TOTAL_PAGE_NUMBER_8723B
-#define WMM_NORMAL_TX_PAGE_BOUNDARY_8723B (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8723B + 1)
-
-// For Normal Chip Setting
-// (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER_8723B
-#define NORMAL_PAGE_NUM_HPQ_8723B 0x0C
-#define NORMAL_PAGE_NUM_LPQ_8723B 0x02
-#define NORMAL_PAGE_NUM_NPQ_8723B 0x02
-
-// Note: For Normal Chip Setting, modify later
-#define WMM_NORMAL_PAGE_NUM_HPQ_8723B 0x30
-#define WMM_NORMAL_PAGE_NUM_LPQ_8723B 0x20
-#define WMM_NORMAL_PAGE_NUM_NPQ_8723B 0x20
-
-
-#include "HalVerDef.h"
-#include "hal_com.h"
-
-#define EFUSE_OOB_PROTECT_BYTES 15
-
-#define HAL_EFUSE_MEMORY
-
-#define HWSET_MAX_SIZE_8723B 512
-#define EFUSE_REAL_CONTENT_LEN_8723B 512
-#define EFUSE_MAP_LEN_8723B 512
-#define EFUSE_MAX_SECTION_8723B 64
-
-#define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
-#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN_8723B)
-
-#define EFUSE_ACCESS_ON 0x69 // For RTL8723 only.
-#define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only.
-
-//========================================================
-// EFUSE for BT definition
-//========================================================
-#define EFUSE_BT_REAL_BANK_CONTENT_LEN 512
-#define EFUSE_BT_REAL_CONTENT_LEN 1536 // 512*3
-#define EFUSE_BT_MAP_LEN 1024 // 1k bytes
-#define EFUSE_BT_MAX_SECTION 128 // 1024/8
-
-#define EFUSE_PROTECT_BYTES_BANK 16
-
-// Description: Determine the types of C2H events that are the same in driver and Fw.
-// Fisrt constructed by tynli. 2009.10.09.
-typedef enum _C2H_EVT
-{
- C2H_DBG = 0,
- C2H_TSF = 1,
- C2H_AP_RPT_RSP = 2,
- C2H_CCX_TX_RPT = 3, // The FW notify the report of the specific tx packet.
- C2H_BT_RSSI = 4,
- C2H_BT_OP_MODE = 5,
- C2H_EXT_RA_RPT = 6,
- C2H_8723B_BT_INFO = 9,
- C2H_HW_INFO_EXCH = 10,
- C2H_8723B_BT_MP_INFO = 11,
- MAX_C2HEVENT
-} C2H_EVT;
-
-typedef struct _C2H_EVT_HDR
-{
- u8 CmdID;
- u8 CmdLen;
- u8 CmdSeq;
-} __attribute__((__packed__)) C2H_EVT_HDR, *PC2H_EVT_HDR;
-
-typedef enum tag_Package_Definition
-{
- PACKAGE_DEFAULT,
- PACKAGE_QFN68,
- PACKAGE_TFBGA90,
- PACKAGE_TFBGA80,
- PACKAGE_TFBGA79
-}PACKAGE_TYPE_E;
-
-#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
-#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
-
-// rtl8723a_hal_init.c
-s32 rtl8723b_FirmwareDownload(PADAPTER padapter, BOOLEAN bUsedWoWLANFw);
-void rtl8723b_FirmwareSelfReset(PADAPTER padapter);
-void rtl8723b_InitializeFirmwareVars(PADAPTER padapter);
-
-void rtl8723b_InitAntenna_Selection(PADAPTER padapter);
-void rtl8723b_DeinitAntenna_Selection(PADAPTER padapter);
-void rtl8723b_CheckAntenna_Selection(PADAPTER padapter);
-void rtl8723b_init_default_value(PADAPTER padapter);
-
-s32 rtl8723b_InitLLTTable(PADAPTER padapter);
-
-s32 CardDisableHWSM(PADAPTER padapter, u8 resetMCU);
-s32 CardDisableWithoutHWSM(PADAPTER padapter);
-
-// EFuse
-u8 GetEEPROMSize8723B(PADAPTER padapter);
-void Hal_InitPGData(PADAPTER padapter, u8 *PROMContent);
-void Hal_EfuseParseIDCode(PADAPTER padapter, u8 *hwinfo);
-void Hal_EfuseParseTxPowerInfo_8723B(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseBTCoexistInfo_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseEEPROMVer_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseChnlPlan_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseCustomerID_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseAntennaDiversity_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseXtal_8723B(PADAPTER pAdapter, u8 *hwinfo, u8 AutoLoadFail);
-void Hal_EfuseParseThermalMeter_8723B(PADAPTER padapter, u8 *hwinfo, u8 AutoLoadFail);
-VOID Hal_EfuseParsePackageType_8723B(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-VOID Hal_EfuseParseVoltage_8723B(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-
-#ifdef CONFIG_C2H_PACKET_EN
-void C2HPacketHandler_8723B(PADAPTER padapter, u8 *pbuffer, u16 length);
-#endif
-
-
-void rtl8723b_set_hal_ops(struct hal_ops *pHalFunc);
-void SetHwReg8723B(PADAPTER padapter, u8 variable, u8 *val);
-void GetHwReg8723B(PADAPTER padapter, u8 variable, u8 *val);
-u8 SetHalDefVar8723B(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval);
-u8 GetHalDefVar8723B(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval);
-
-// register
-void rtl8723b_InitBeaconParameters(PADAPTER padapter);
-void rtl8723b_InitBeaconMaxError(PADAPTER padapter, u8 InfraMode);
-void _InitBurstPktLen_8723BS(PADAPTER Adapter);
-void _8051Reset8723(PADAPTER padapter);
-#ifdef CONFIG_WOWLAN
-void Hal_DetectWoWMode(PADAPTER pAdapter);
-#endif //CONFIG_WOWLAN
-
-void rtl8723b_start_thread(_adapter *padapter);
-void rtl8723b_stop_thread(_adapter *padapter);
-
-#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST)
-void rtl8723bs_init_checkbthang_workqueue(_adapter * adapter);
-void rtl8723bs_free_checkbthang_workqueue(_adapter * adapter);
-void rtl8723bs_cancle_checkbthang_workqueue(_adapter * adapter);
-void rtl8723bs_hal_check_bt_hang(_adapter * adapter);
-#endif
-
-#ifdef CONFIG_GPIO_WAKEUP
-void HalSetOutPutGPIO(PADAPTER padapter, u8 index, u8 OutPutValue);
-#endif
-
-int FirmwareDownloadBT(IN PADAPTER Adapter, PRT_MP_FIRMWARE pFirmware);
-
-void CCX_FwC2HTxRpt_8723b(PADAPTER padapter, u8 *pdata, u8 len);
-s32 c2h_id_filter_ccx_8723b(u8 *buf);
-s32 c2h_handler_8723b(PADAPTER padapter, u8 *pC2hEvent);
-u8 MRateToHwRate8723B(u8 rate);
-u8 HwRateToMRate8723B(u8 rate);
-
-#ifdef CONFIG_RF_GAIN_OFFSET
-void Hal_ReadRFGainOffset(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
-#endif //CONFIG_RF_GAIN_OFFSET
-
-#ifdef CONFIG_PCI_HCI
-BOOLEAN InterruptRecognized8723BE(PADAPTER Adapter);
-VOID UpdateInterruptMask8723BE(PADAPTER Adapter, u32 AddMSR, u32 AddMSR1, u32 RemoveMSR, u32 RemoveMSR1);
-#endif
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8723B_HAL_H__
+#define __RTL8723B_HAL_H__
+
+#include "hal_data.h"
+
+#include "rtl8723b_spec.h"
+#include "rtl8723b_rf.h"
+#include "rtl8723b_dm.h"
+#include "rtl8723b_recv.h"
+#include "rtl8723b_xmit.h"
+#include "rtl8723b_cmd.h"
+#include "rtl8723b_led.h"
+#include "Hal8723BPwrSeq.h"
+#include "Hal8723BPhyReg.h"
+#include "Hal8723BPhyCfg.h"
+#ifdef DBG_CONFIG_ERROR_DETECT
+#include "rtl8723b_sreset.h"
+#endif
+
+
+//---------------------------------------------------------------------
+// RTL8723B From file
+//---------------------------------------------------------------------
+ #define RTL8723B_FW_IMG "rtl8723b/FW_NIC.bin"
+ #define RTL8723B_FW_WW_IMG "rtl8723b/FW_WoWLAN.bin"
+ #define RTL8723B_PHY_REG "rtl8723b/PHY_REG.txt"
+ #define RTL8723B_PHY_RADIO_A "rtl8723b/RadioA.txt"
+ #define RTL8723B_PHY_RADIO_B "rtl8723b/RadioB.txt"
+ #define RTL8723B_TXPWR_TRACK "rtl8723b/TxPowerTrack.txt"
+ #define RTL8723B_AGC_TAB "rtl8723b/AGC_TAB.txt"
+ #define RTL8723B_PHY_MACREG "rtl8723b/MAC_REG.txt"
+ #define RTL8723B_PHY_REG_PG "rtl8723b/PHY_REG_PG.txt"
+ #define RTL8723B_PHY_REG_MP "rtl8723b/PHY_REG_MP.txt"
+ #define RTL8723B_TXPWR_LMT "rtl8723b/TXPWR_LMT.txt"
+
+//---------------------------------------------------------------------
+// RTL8723B From header
+//---------------------------------------------------------------------
+
+#if MP_DRIVER == 1
+ #define Rtl8723B_FwBTImgArray Rtl8723BFwBTImgArray
+ #define Rtl8723B_FwBTImgArrayLength Rtl8723BFwBTImgArrayLength
+
+ #define Rtl8723B_FwMPImageArray Rtl8723BFwMPImgArray
+ #define Rtl8723B_FwMPImgArrayLength Rtl8723BMPImgArrayLength
+
+ #define Rtl8723B_PHY_REG_Array_MP Rtl8723B_PHYREG_Array_MP
+ #define Rtl8723B_PHY_REG_Array_MPLength Rtl8723B_PHYREG_Array_MPLength
+#endif
+
+
+#define FW_8723B_SIZE 0x8000
+#define FW_8723B_START_ADDRESS 0x1000
+#define FW_8723B_END_ADDRESS 0x1FFF //0x5FFF
+
+#define IS_FW_HEADER_EXIST_8723B(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x5300)
+
+typedef struct _RT_FIRMWARE {
+ FIRMWARE_SOURCE eFWSource;
+#ifdef CONFIG_EMBEDDED_FWIMG
+ u8* szFwBuffer;
+#else
+ 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;
+
+//
+// This structure must be cared byte-ordering
+//
+// Added by tynli. 2009.12.04.
+typedef struct _RT_8723B_FIRMWARE_HDR
+{
+ // 8-byte alinment required
+
+ //--- LONG WORD 0 ----
+ u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
+ u8 Category; // AP/NIC and USB/PCI
+ u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
+ u16 Version; // FW Version
+ u16 Subversion; // FW Subversion, default 0x00
+
+ //--- LONG WORD 1 ----
+ u8 Month; // Release time Month field
+ u8 Date; // Release time Date field
+ u8 Hour; // Release time Hour field
+ u8 Minute; // Release time Minute field
+ u16 RamCodeSize; // The size of RAM code
+ u16 Rsvd2;
+
+ //--- LONG WORD 2 ----
+ u32 SvnIdx; // The SVN entry index
+ u32 Rsvd3;
+
+ //--- LONG WORD 3 ----
+ u32 Rsvd4;
+ u32 Rsvd5;
+}RT_8723B_FIRMWARE_HDR, *PRT_8723B_FIRMWARE_HDR;
+
+#define DRIVER_EARLY_INT_TIME_8723B 0x05
+#define BCN_DMA_ATIME_INT_TIME_8723B 0x02
+
+// for 8723B
+// TX 32K, RX 16K, Page size 128B for TX, 8B for RX
+#define PAGE_SIZE_TX_8723B 128
+#define PAGE_SIZE_RX_8723B 8
+
+#define RX_DMA_SIZE_8723B 0x4000 // 16K
+#define RX_DMA_RESERVED_SIZE_8723B 0x80 // 128B, reserved for tx report
+#define RX_DMA_BOUNDARY_8723B (RX_DMA_SIZE_8723B - RX_DMA_RESERVED_SIZE_8723B - 1)
+
+
+// Note: We will divide number of page equally for each queue other than public queue!
+
+//For General Reserved Page Number(Beacon Queue is reserved page)
+//Beacon:2, PS-Poll:1, Null Data:1,Qos Null Data:1,BT Qos Null Data:1
+#define BCNQ_PAGE_NUM_8723B 0x08
+#ifdef CONFIG_CONCURRENT_MODE
+#define BCNQ1_PAGE_NUM_8723B 0x08 // 0x04
+#else
+#define BCNQ1_PAGE_NUM_8723B 0x00
+#endif
+
+#ifdef CONFIG_PNO_SUPPORT
+#undef BCNQ1_PAGE_NUM_8723B
+#define BCNQ1_PAGE_NUM_8723B 0x00 // 0x04
+#endif
+#define MAX_RX_DMA_BUFFER_SIZE_8723B 0x2800 // RX 10K
+
+//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_8723B 0x07
+#else
+#define WOWLAN_PAGE_NUM_8723B 0x00
+#endif
+
+#ifdef CONFIG_PNO_SUPPORT
+#undef WOWLAN_PAGE_NUM_8723B
+#define WOWLAN_PAGE_NUM_8723B 0x0d
+#endif
+
+#ifdef CONFIG_AP_WOWLAN
+#define AP_WOWLAN_PAGE_NUM_8723B 0x02
+#endif
+
+#define TX_TOTAL_PAGE_NUMBER_8723B (0xFF - BCNQ_PAGE_NUM_8723B - BCNQ1_PAGE_NUM_8723B - WOWLAN_PAGE_NUM_8723B)
+#define TX_PAGE_BOUNDARY_8723B (TX_TOTAL_PAGE_NUMBER_8723B + 1)
+
+#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8723B TX_TOTAL_PAGE_NUMBER_8723B
+#define WMM_NORMAL_TX_PAGE_BOUNDARY_8723B (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8723B + 1)
+
+// For Normal Chip Setting
+// (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER_8723B
+#define NORMAL_PAGE_NUM_HPQ_8723B 0x0C
+#define NORMAL_PAGE_NUM_LPQ_8723B 0x02
+#define NORMAL_PAGE_NUM_NPQ_8723B 0x02
+
+// Note: For Normal Chip Setting, modify later
+#define WMM_NORMAL_PAGE_NUM_HPQ_8723B 0x30
+#define WMM_NORMAL_PAGE_NUM_LPQ_8723B 0x20
+#define WMM_NORMAL_PAGE_NUM_NPQ_8723B 0x20
+
+
+#include "HalVerDef.h"
+#include "hal_com.h"
+
+#define EFUSE_OOB_PROTECT_BYTES 15
+
+#define HAL_EFUSE_MEMORY
+
+#define HWSET_MAX_SIZE_8723B 512
+#define EFUSE_REAL_CONTENT_LEN_8723B 512
+#define EFUSE_MAP_LEN_8723B 512
+#define EFUSE_MAX_SECTION_8723B 64
+
+#define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
+#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN_8723B)
+
+#define EFUSE_ACCESS_ON 0x69 // For RTL8723 only.
+#define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only.
+
+//========================================================
+// EFUSE for BT definition
+//========================================================
+#define EFUSE_BT_REAL_BANK_CONTENT_LEN 512
+#define EFUSE_BT_REAL_CONTENT_LEN 1536 // 512*3
+#define EFUSE_BT_MAP_LEN 1024 // 1k bytes
+#define EFUSE_BT_MAX_SECTION 128 // 1024/8
+
+#define EFUSE_PROTECT_BYTES_BANK 16
+
+// Description: Determine the types of C2H events that are the same in driver and Fw.
+// Fisrt constructed by tynli. 2009.10.09.
+typedef enum _C2H_EVT
+{
+ C2H_DBG = 0,
+ C2H_TSF = 1,
+ C2H_AP_RPT_RSP = 2,
+ C2H_CCX_TX_RPT = 3, // The FW notify the report of the specific tx packet.
+ C2H_BT_RSSI = 4,
+ C2H_BT_OP_MODE = 5,
+ C2H_EXT_RA_RPT = 6,
+ C2H_8723B_BT_INFO = 9,
+ C2H_HW_INFO_EXCH = 10,
+ C2H_8723B_BT_MP_INFO = 11,
+ MAX_C2HEVENT
+} C2H_EVT;
+
+typedef struct _C2H_EVT_HDR
+{
+ u8 CmdID;
+ u8 CmdLen;
+ u8 CmdSeq;
+} __attribute__((__packed__)) C2H_EVT_HDR, *PC2H_EVT_HDR;
+
+typedef enum tag_Package_Definition
+{
+ PACKAGE_DEFAULT,
+ PACKAGE_QFN68,
+ PACKAGE_TFBGA90,
+ PACKAGE_TFBGA80,
+ PACKAGE_TFBGA79
+}PACKAGE_TYPE_E;
+
+#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
+#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
+
+// rtl8723a_hal_init.c
+s32 rtl8723b_FirmwareDownload(PADAPTER padapter, BOOLEAN bUsedWoWLANFw);
+void rtl8723b_FirmwareSelfReset(PADAPTER padapter);
+void rtl8723b_InitializeFirmwareVars(PADAPTER padapter);
+
+void rtl8723b_InitAntenna_Selection(PADAPTER padapter);
+void rtl8723b_DeinitAntenna_Selection(PADAPTER padapter);
+void rtl8723b_CheckAntenna_Selection(PADAPTER padapter);
+void rtl8723b_init_default_value(PADAPTER padapter);
+
+s32 rtl8723b_InitLLTTable(PADAPTER padapter);
+
+s32 CardDisableHWSM(PADAPTER padapter, u8 resetMCU);
+s32 CardDisableWithoutHWSM(PADAPTER padapter);
+
+// EFuse
+u8 GetEEPROMSize8723B(PADAPTER padapter);
+void Hal_InitPGData(PADAPTER padapter, u8 *PROMContent);
+void Hal_EfuseParseIDCode(PADAPTER padapter, u8 *hwinfo);
+void Hal_EfuseParseTxPowerInfo_8723B(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseBTCoexistInfo_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseEEPROMVer_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseChnlPlan_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseCustomerID_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseAntennaDiversity_8723B(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseXtal_8723B(PADAPTER pAdapter, u8 *hwinfo, u8 AutoLoadFail);
+void Hal_EfuseParseThermalMeter_8723B(PADAPTER padapter, u8 *hwinfo, u8 AutoLoadFail);
+VOID Hal_EfuseParsePackageType_8723B(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+VOID Hal_EfuseParseVoltage_8723B(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+
+#ifdef CONFIG_C2H_PACKET_EN
+void C2HPacketHandler_8723B(PADAPTER padapter, u8 *pbuffer, u16 length);
+#endif
+
+
+void rtl8723b_set_hal_ops(struct hal_ops *pHalFunc);
+void SetHwReg8723B(PADAPTER padapter, u8 variable, u8 *val);
+void GetHwReg8723B(PADAPTER padapter, u8 variable, u8 *val);
+u8 SetHalDefVar8723B(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval);
+u8 GetHalDefVar8723B(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval);
+
+// register
+void rtl8723b_InitBeaconParameters(PADAPTER padapter);
+void rtl8723b_InitBeaconMaxError(PADAPTER padapter, u8 InfraMode);
+void _InitBurstPktLen_8723BS(PADAPTER Adapter);
+void _8051Reset8723(PADAPTER padapter);
+#ifdef CONFIG_WOWLAN
+void Hal_DetectWoWMode(PADAPTER pAdapter);
+#endif //CONFIG_WOWLAN
+
+void rtl8723b_start_thread(_adapter *padapter);
+void rtl8723b_stop_thread(_adapter *padapter);
+
+#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST)
+void rtl8723bs_init_checkbthang_workqueue(_adapter * adapter);
+void rtl8723bs_free_checkbthang_workqueue(_adapter * adapter);
+void rtl8723bs_cancle_checkbthang_workqueue(_adapter * adapter);
+void rtl8723bs_hal_check_bt_hang(_adapter * adapter);
+#endif
+
+#ifdef CONFIG_GPIO_WAKEUP
+void HalSetOutPutGPIO(PADAPTER padapter, u8 index, u8 OutPutValue);
+#endif
+
+int FirmwareDownloadBT(IN PADAPTER Adapter, PRT_MP_FIRMWARE pFirmware);
+
+void CCX_FwC2HTxRpt_8723b(PADAPTER padapter, u8 *pdata, u8 len);
+s32 c2h_id_filter_ccx_8723b(u8 *buf);
+s32 c2h_handler_8723b(PADAPTER padapter, u8 *pC2hEvent);
+u8 MRateToHwRate8723B(u8 rate);
+u8 HwRateToMRate8723B(u8 rate);
+
+#ifdef CONFIG_RF_GAIN_OFFSET
+void Hal_ReadRFGainOffset(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail);
+#endif //CONFIG_RF_GAIN_OFFSET
+
+#ifdef CONFIG_PCI_HCI
+BOOLEAN InterruptRecognized8723BE(PADAPTER Adapter);
+VOID UpdateInterruptMask8723BE(PADAPTER Adapter, u32 AddMSR, u32 AddMSR1, u32 RemoveMSR, u32 RemoveMSR1);
+#endif
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8723b_led.h b/rtl8xxx_EU/include/rtl8723b_led.h
index 36772c0..161fa48 100755
--- a/rtl8xxx_EU/include/rtl8723b_led.h
+++ b/rtl8xxx_EU/include/rtl8723b_led.h
@@ -1,49 +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 __RTL8723B_LED_H__
-#define __RTL8723B_LED_H__
-
-#include <drv_conf.h>
-#include <osdep_service.h>
-#include <drv_types.h>
-
-
-//================================================================================
-// Interface to manipulate LED objects.
-//================================================================================
-#ifdef CONFIG_USB_HCI
-void rtl8723bu_InitSwLeds(PADAPTER padapter);
-void rtl8723bu_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_SDIO_HCI
-void rtl8723bs_InitSwLeds(PADAPTER padapter);
-void rtl8723bs_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_GSPI_HCI
-void rtl8723bs_InitSwLeds(PADAPTER padapter);
-void rtl8723bs_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_PCI_HCI
-void rtl8723be_InitSwLeds(PADAPTER padapter);
-void rtl8723be_DeInitSwLeds(PADAPTER padapter);
-#endif
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8723B_LED_H__
+#define __RTL8723B_LED_H__
+
+#include <drv_conf.h>
+#include <osdep_service.h>
+#include <drv_types.h>
+
+
+//================================================================================
+// Interface to manipulate LED objects.
+//================================================================================
+#ifdef CONFIG_USB_HCI
+void rtl8723bu_InitSwLeds(PADAPTER padapter);
+void rtl8723bu_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_SDIO_HCI
+void rtl8723bs_InitSwLeds(PADAPTER padapter);
+void rtl8723bs_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_GSPI_HCI
+void rtl8723bs_InitSwLeds(PADAPTER padapter);
+void rtl8723bs_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_PCI_HCI
+void rtl8723be_InitSwLeds(PADAPTER padapter);
+void rtl8723be_DeInitSwLeds(PADAPTER padapter);
+#endif
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8723b_recv.h b/rtl8xxx_EU/include/rtl8723b_recv.h
index 3f0990f..1f983ad 100755
--- a/rtl8xxx_EU/include/rtl8723b_recv.h
+++ b/rtl8xxx_EU/include/rtl8723b_recv.h
@@ -1,173 +1,173 @@
-/******************************************************************************
- *
- * 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 __RTL8723B_RECV_H__
-#define __RTL8723B_RECV_H__
-
-#include <rtl8192c_recv.h>
-
-#ifdef CONFIG_SDIO_HCI
-#ifndef CONFIG_SDIO_RX_COPY
-#undef MAX_RECVBUF_SZ
-#define MAX_RECVBUF_SZ (RX_DMA_SIZE_8723B - RX_DMA_RESERVED_SIZE_8723B)
-#endif // !CONFIG_SDIO_RX_COPY
-#endif // CONFIG_SDIO_HCI
-
-typedef struct rxreport_8723b
-{
- //DWORD 0
- u32 pktlen:14;
- u32 crc32:1;
- u32 icverr:1;
- u32 drvinfosize:4;
- u32 security:3;
- u32 qos:1;
- u32 shift:2;
- u32 physt:1;
- u32 swdec:1;
- u32 rsvd0028:2;
- u32 eor:1;
- u32 rsvd0031:1;
-
- //DWORD 1
- u32 macid:7;
- u32 rsvd0407:1;
- u32 tid:4;
- u32 macid_vld:1;
- u32 amsdu:1;
- u32 rxid_match:1;
- u32 paggr:1;
- u32 a1fit:4;
- u32 chkerr:1; //20
- u32 rx_ipv:1;
- u32 rx_is_tcp_udp:1;
- u32 chk_vld:1; //23
- u32 pam:1;
- u32 pwr:1;
- u32 md:1;
- u32 mf:1;
- u32 type:2;
- u32 mc:1;
- u32 bc:1;
-
- //DWORD 2
- u32 seq:12;
- u32 frag:4;
- u32 rx_is_qos:1;
- u32 rsvd0817:1;
- u32 wlanhd_iv_len:6;
- u32 hwrsvd0824:4;
- u32 c2h_ind:1;
- u32 rsvd0829:2;
- u32 fcs_ok:1;
-
- //DWORD 3
- u32 rx_rate:7;
- u32 rsvd1207:3;
- u32 htc:1;
- u32 esop:1;
- u32 bssid_fit:2;
- u32 rsvd1214:2;
- u32 dma_agg_num:8;
- u32 rsvd1224:5;
- u32 patternmatch:1;
- u32 unicastwake:1;
- u32 magicwake:1;
-
- //DWORD 4
- u32 splcp:1; //Ofdm sgi or cck_splcp
- u32 ldpc:1;
- u32 stbc:1;
- u32 not_sounding:1;
- u32 bw:2;
- u32 rsvd1606:26;
-
- //DWORD 5
- u32 tsfl;
-} RXREPORT, *PRXREPORT;
-
-typedef struct phystatus_8723b
-{
- u32 rxgain_a:7;
- u32 trsw_a:1;
- u32 rxgain_b:7;
- u32 trsw_b:1;
- u32 chcorr_l:16;
-
- u32 sigqualcck:8;
- u32 cfo_a:8;
- u32 cfo_b:8;
- u32 chcorr_h:8;
-
- u32 noisepwrdb_h:8;
- u32 cfo_tail_a:8;
- u32 cfo_tail_b:8;
- u32 rsvd0824:8;
-
- u32 rsvd1200:8;
- u32 rxevm_a:8;
- u32 rxevm_b:8;
- u32 rxsnr_a:8;
-
- u32 rxsnr_b:8;
- u32 noisepwrdb_l:8;
- u32 rsvd1616:8;
- u32 postsnr_a:8;
-
- u32 postsnr_b:8;
- u32 csi_a:8;
- u32 csi_b:8;
- u32 targetcsi_a:8;
-
- u32 targetcsi_b:8;
- u32 sigevm:8;
- u32 maxexpwr:8;
- u32 exintflag:1;
- u32 sgien:1;
- u32 rxsc:2;
- u32 idlelong:1;
- u32 anttrainen:1;
- u32 antselb:1;
- u32 antsel:1;
-} PHYSTATUS, *PPHYSTATUS;
-
-#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
-s32 rtl8723bs_init_recv_priv(PADAPTER padapter);
-void rtl8723bs_free_recv_priv(PADAPTER padapter);
-#endif
-
-void rtl8723b_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat);
-void rtl8723b_process_phy_info(PADAPTER padapter, void *prframe);
-#ifdef CONFIG_USB_HCI
-void update_recvframe_attrib(PADAPTER padapter, union recv_frame *precvframe, struct recv_stat *prxstat);
-void update_recvframe_phyinfo(union recv_frame *precvframe, struct phy_stat *pphy_info);
-int rtl8723bu_init_recv_priv(_adapter *padapter);
-void rtl8723bu_free_recv_priv (_adapter *padapter);
-void rtl8723bu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
-#endif
-
-#ifdef CONFIG_PCI_HCI
-s32 rtl8723be_init_recv_priv(PADAPTER padapter);
-void rtl8723be_free_recv_priv(PADAPTER padapter);
-#endif
-
-void rtl8723b_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8723B_RECV_H__
+#define __RTL8723B_RECV_H__
+
+#include <rtl8192c_recv.h>
+
+#ifdef CONFIG_SDIO_HCI
+#ifndef CONFIG_SDIO_RX_COPY
+#undef MAX_RECVBUF_SZ
+#define MAX_RECVBUF_SZ (RX_DMA_SIZE_8723B - RX_DMA_RESERVED_SIZE_8723B)
+#endif // !CONFIG_SDIO_RX_COPY
+#endif // CONFIG_SDIO_HCI
+
+typedef struct rxreport_8723b
+{
+ //DWORD 0
+ u32 pktlen:14;
+ u32 crc32:1;
+ u32 icverr:1;
+ u32 drvinfosize:4;
+ u32 security:3;
+ u32 qos:1;
+ u32 shift:2;
+ u32 physt:1;
+ u32 swdec:1;
+ u32 rsvd0028:2;
+ u32 eor:1;
+ u32 rsvd0031:1;
+
+ //DWORD 1
+ u32 macid:7;
+ u32 rsvd0407:1;
+ u32 tid:4;
+ u32 macid_vld:1;
+ u32 amsdu:1;
+ u32 rxid_match:1;
+ u32 paggr:1;
+ u32 a1fit:4;
+ u32 chkerr:1; //20
+ u32 rx_ipv:1;
+ u32 rx_is_tcp_udp:1;
+ u32 chk_vld:1; //23
+ u32 pam:1;
+ u32 pwr:1;
+ u32 md:1;
+ u32 mf:1;
+ u32 type:2;
+ u32 mc:1;
+ u32 bc:1;
+
+ //DWORD 2
+ u32 seq:12;
+ u32 frag:4;
+ u32 rx_is_qos:1;
+ u32 rsvd0817:1;
+ u32 wlanhd_iv_len:6;
+ u32 hwrsvd0824:4;
+ u32 c2h_ind:1;
+ u32 rsvd0829:2;
+ u32 fcs_ok:1;
+
+ //DWORD 3
+ u32 rx_rate:7;
+ u32 rsvd1207:3;
+ u32 htc:1;
+ u32 esop:1;
+ u32 bssid_fit:2;
+ u32 rsvd1214:2;
+ u32 dma_agg_num:8;
+ u32 rsvd1224:5;
+ u32 patternmatch:1;
+ u32 unicastwake:1;
+ u32 magicwake:1;
+
+ //DWORD 4
+ u32 splcp:1; //Ofdm sgi or cck_splcp
+ u32 ldpc:1;
+ u32 stbc:1;
+ u32 not_sounding:1;
+ u32 bw:2;
+ u32 rsvd1606:26;
+
+ //DWORD 5
+ u32 tsfl;
+} RXREPORT, *PRXREPORT;
+
+typedef struct phystatus_8723b
+{
+ u32 rxgain_a:7;
+ u32 trsw_a:1;
+ u32 rxgain_b:7;
+ u32 trsw_b:1;
+ u32 chcorr_l:16;
+
+ u32 sigqualcck:8;
+ u32 cfo_a:8;
+ u32 cfo_b:8;
+ u32 chcorr_h:8;
+
+ u32 noisepwrdb_h:8;
+ u32 cfo_tail_a:8;
+ u32 cfo_tail_b:8;
+ u32 rsvd0824:8;
+
+ u32 rsvd1200:8;
+ u32 rxevm_a:8;
+ u32 rxevm_b:8;
+ u32 rxsnr_a:8;
+
+ u32 rxsnr_b:8;
+ u32 noisepwrdb_l:8;
+ u32 rsvd1616:8;
+ u32 postsnr_a:8;
+
+ u32 postsnr_b:8;
+ u32 csi_a:8;
+ u32 csi_b:8;
+ u32 targetcsi_a:8;
+
+ u32 targetcsi_b:8;
+ u32 sigevm:8;
+ u32 maxexpwr:8;
+ u32 exintflag:1;
+ u32 sgien:1;
+ u32 rxsc:2;
+ u32 idlelong:1;
+ u32 anttrainen:1;
+ u32 antselb:1;
+ u32 antsel:1;
+} PHYSTATUS, *PPHYSTATUS;
+
+#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
+s32 rtl8723bs_init_recv_priv(PADAPTER padapter);
+void rtl8723bs_free_recv_priv(PADAPTER padapter);
+#endif
+
+void rtl8723b_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat);
+void rtl8723b_process_phy_info(PADAPTER padapter, void *prframe);
+#ifdef CONFIG_USB_HCI
+void update_recvframe_attrib(PADAPTER padapter, union recv_frame *precvframe, struct recv_stat *prxstat);
+void update_recvframe_phyinfo(union recv_frame *precvframe, struct phy_stat *pphy_info);
+int rtl8723bu_init_recv_priv(_adapter *padapter);
+void rtl8723bu_free_recv_priv (_adapter *padapter);
+void rtl8723bu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
+#endif
+
+#ifdef CONFIG_PCI_HCI
+s32 rtl8723be_init_recv_priv(PADAPTER padapter);
+void rtl8723be_free_recv_priv(PADAPTER padapter);
+#endif
+
+void rtl8723b_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8723b_spec.h b/rtl8xxx_EU/include/rtl8723b_spec.h
index b1fba0f..9f4f919 100755
--- a/rtl8xxx_EU/include/rtl8723b_spec.h
+++ b/rtl8xxx_EU/include/rtl8723b_spec.h
@@ -1,293 +1,293 @@
-/******************************************************************************
- *
- * 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 __RTL8723B_SPEC_H__
-#define __RTL8723B_SPEC_H__
-
-#include <drv_conf.h>
-
-
-#define HAL_NAV_UPPER_UNIT_8723B 128 // micro-second
-
-//-----------------------------------------------------
-//
-// 0x0000h ~ 0x00FFh System Configuration
-//
-//-----------------------------------------------------
-#define REG_RSV_CTRL_8723B 0x001C // 3 Byte
-#define REG_BT_WIFI_ANTENNA_SWITCH_8723B 0x0038
-#define REG_HSISR_8723B 0x005c
-#define REG_PAD_CTRL1_8723B 0x0064
-#define REG_AFE_CTRL_4_8723B 0x0078
-#define REG_HMEBOX_DBG_0_8723B 0x0088
-#define REG_HMEBOX_DBG_1_8723B 0x008A
-#define REG_HMEBOX_DBG_2_8723B 0x008C
-#define REG_HMEBOX_DBG_3_8723B 0x008E
-#define REG_HIMR0_8723B 0x00B0
-#define REG_HISR0_8723B 0x00B4
-#define REG_HIMR1_8723B 0x00B8
-#define REG_HISR1_8723B 0x00BC
-#define REG_PMC_DBG_CTRL2_8723B 0x00CC
-
-//-----------------------------------------------------
-//
-// 0x0100h ~ 0x01FFh MACTOP General Configuration
-//
-//-----------------------------------------------------
-#define REG_C2HEVT_CMD_ID_8723B 0x01A0
-#define REG_C2HEVT_CMD_LEN_8723B 0x01AE
-#define REG_WOWLAN_WAKE_REASON 0x01C7
-#define REG_WOWLAN_GTK_DBG1 0x630
-#define REG_WOWLAN_GTK_DBG2 0x634
-
-#define REG_HMEBOX_EXT0_8723B 0x01F0
-#define REG_HMEBOX_EXT1_8723B 0x01F4
-#define REG_HMEBOX_EXT2_8723B 0x01F8
-#define REG_HMEBOX_EXT3_8723B 0x01FC
-
-//-----------------------------------------------------
-//
-// 0x0200h ~ 0x027Fh TXDMA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0280h ~ 0x02FFh RXDMA Configuration
-//
-//-----------------------------------------------------
-#define REG_RXDMA_CONTROL_8723B 0x0286 // Control the RX DMA.
-#define REG_RXDMA_MODE_CTRL_8723B 0x0290
-
-//-----------------------------------------------------
-//
-// 0x0300h ~ 0x03FFh PCIe
-//
-//-----------------------------------------------------
-#define REG_PCIE_CTRL_REG_8723B 0x0300
-#define REG_INT_MIG_8723B 0x0304 // Interrupt Migration
-#define REG_BCNQ_DESA_8723B 0x0308 // TX Beacon Descriptor Address
-#define REG_HQ_DESA_8723B 0x0310 // TX High Queue Descriptor Address
-#define REG_MGQ_DESA_8723B 0x0318 // TX Manage Queue Descriptor Address
-#define REG_VOQ_DESA_8723B 0x0320 // TX VO Queue Descriptor Address
-#define REG_VIQ_DESA_8723B 0x0328 // TX VI Queue Descriptor Address
-#define REG_BEQ_DESA_8723B 0x0330 // TX BE Queue Descriptor Address
-#define REG_BKQ_DESA_8723B 0x0338 // TX BK Queue Descriptor Address
-#define REG_RX_DESA_8723B 0x0340 // RX Queue Descriptor Address
-#define REG_DBI_WDATA_8723B 0x0348 // DBI Write Data
-#define REG_DBI_RDATA_8723B 0x034C // DBI Read Data
-#define REG_DBI_ADDR_8723B 0x0350 // DBI Address
-#define REG_DBI_FLAG_8723B 0x0352 // DBI Read/Write Flag
-#define REG_MDIO_WDATA_8723B 0x0354 // MDIO for Write PCIE PHY
-#define REG_MDIO_RDATA_8723B 0x0356 // MDIO for Reads PCIE PHY
-#define REG_MDIO_CTL_8723B 0x0358 // MDIO for Control
-#define REG_DBG_SEL_8723B 0x0360 // Debug Selection Register
-#define REG_PCIE_HRPWM_8723B 0x0361 //PCIe RPWM
-#define REG_PCIE_HCPWM_8723B 0x0363 //PCIe CPWM
-#define REG_PCIE_MULTIFET_CTRL_8723B 0x036A //PCIE Multi-Fethc Control
-
-//-----------------------------------------------------
-//
-// 0x0400h ~ 0x047Fh Protocol Configuration
-//
-//-----------------------------------------------------
-#define REG_TXPKTBUF_BCNQ_BDNY_8723B 0x0424
-#define REG_TXPKTBUF_MGQ_BDNY_8723B 0x0425
-#define REG_TXPKTBUF_WMAC_LBK_BF_HD_8723B 0x045D
-#ifdef CONFIG_WOWLAN
-#define REG_TXPKTBUF_IV_LOW 0x0484
-#define REG_TXPKTBUF_IV_HIGH 0x0488
-#endif
-#define REG_AMPDU_BURST_MODE_8723B 0x04BC
-
-//-----------------------------------------------------
-//
-// 0x0500h ~ 0x05FFh EDCA Configuration
-//
-//-----------------------------------------------------
-#define REG_SECONDARY_CCA_CTRL_8723B 0x0577
-
-//-----------------------------------------------------
-//
-// 0x0600h ~ 0x07FFh WMAC Configuration
-//
-//-----------------------------------------------------
-
-
-//============================================================
-// SDIO Bus Specification
-//============================================================
-
-//-----------------------------------------------------
-// SDIO CMD Address Mapping
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// I/O bus domain (Host)
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// SDIO register
-//-----------------------------------------------------
-#define SDIO_REG_HCPWM1_8723B 0x025 // HCI Current Power Mode 1
-
-
-//============================================================================
-// 8723 Regsiter Bit and Content definition
-//============================================================================
-
-//2 HSISR
-// interrupt mask which needs to clear
-#define MASK_HSISR_CLEAR (HSISR_GPIO12_0_INT |\
- HSISR_SPS_OCP_INT |\
- HSISR_RON_INT |\
- HSISR_PDNINT |\
- HSISR_GPIO9_INT)
-
-//-----------------------------------------------------
-//
-// 0x0100h ~ 0x01FFh MACTOP General Configuration
-//
-//-----------------------------------------------------
-
-
-//-----------------------------------------------------
-//
-// 0x0200h ~ 0x027Fh TXDMA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0280h ~ 0x02FFh RXDMA Configuration
-//
-//-----------------------------------------------------
-#define BIT_USB_RXDMA_AGG_EN BIT(31)
-#define RXDMA_AGG_MODE_EN BIT(1)
-
-#ifdef CONFIG_WOWLAN
-#define RXPKT_RELEASE_POLL BIT(16)
-#define RXDMA_IDLE BIT(17)
-#define RW_RELEASE_EN BIT(18)
-#endif
-
-//-----------------------------------------------------
-//
-// 0x0400h ~ 0x047Fh Protocol Configuration
-//
-//-----------------------------------------------------
-
-//----------------------------------------------------------------------------
-// 8723B REG_CCK_CHECK (offset 0x454)
-//----------------------------------------------------------------------------
-#define BIT_BCN_PORT_SEL BIT5
-
-//-----------------------------------------------------
-//
-// 0x0500h ~ 0x05FFh EDCA Configuration
-//
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-//
-// 0x0600h ~ 0x07FFh WMAC Configuration
-//
-//-----------------------------------------------------
-#ifdef CONFIG_RF_GAIN_OFFSET
-
-#ifdef CONFIG_RTL8723B
-#define EEPROM_RF_GAIN_OFFSET 0xC1
-#endif
-
-#define EEPROM_RF_GAIN_VAL 0x1F6
-#endif //CONFIG_RF_GAIN_OFFSET
-
-
-//----------------------------------------------------------------------------
-// 8195 IMR/ISR bits (offset 0xB0, 8bits)
-//----------------------------------------------------------------------------
-#define IMR_DISABLED_8723B 0
-// IMR DW0(0x00B0-00B3) Bit 0-31
-#define IMR_TIMER2_8723B BIT31 // Timeout interrupt 2
-#define IMR_TIMER1_8723B BIT30 // Timeout interrupt 1
-#define IMR_PSTIMEOUT_8723B BIT29 // Power Save Time Out Interrupt
-#define IMR_GTINT4_8723B BIT28 // When GTIMER4 expires, this bit is set to 1
-#define IMR_GTINT3_8723B BIT27 // When GTIMER3 expires, this bit is set to 1
-#define IMR_TXBCN0ERR_8723B BIT26 // Transmit Beacon0 Error
-#define IMR_TXBCN0OK_8723B BIT25 // Transmit Beacon0 OK
-#define IMR_TSF_BIT32_TOGGLE_8723B BIT24 // TSF Timer BIT32 toggle indication interrupt
-#define IMR_BCNDMAINT0_8723B BIT20 // Beacon DMA Interrupt 0
-#define IMR_BCNDERR0_8723B BIT16 // Beacon Queue DMA OK0
-#define IMR_HSISR_IND_ON_INT_8723B BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1)
-#define IMR_BCNDMAINT_E_8723B BIT14 // Beacon DMA Interrupt Extension for Win7
-#define IMR_ATIMEND_8723B BIT12 // CTWidnow End or ATIM Window End
-#define IMR_C2HCMD_8723B BIT10 // CPU to Host Command INT Status, Write 1 clear
-#define IMR_CPWM2_8723B BIT9 // CPU power Mode exchange INT Status, Write 1 clear
-#define IMR_CPWM_8723B BIT8 // CPU power Mode exchange INT Status, Write 1 clear
-#define IMR_HIGHDOK_8723B BIT7 // High Queue DMA OK
-#define IMR_MGNTDOK_8723B BIT6 // Management Queue DMA OK
-#define IMR_BKDOK_8723B BIT5 // AC_BK DMA OK
-#define IMR_BEDOK_8723B BIT4 // AC_BE DMA OK
-#define IMR_VIDOK_8723B BIT3 // AC_VI DMA OK
-#define IMR_VODOK_8723B BIT2 // AC_VO DMA OK
-#define IMR_RDU_8723B BIT1 // Rx Descriptor Unavailable
-#define IMR_ROK_8723B BIT0 // Receive DMA OK
-
-// IMR DW1(0x00B4-00B7) Bit 0-31
-#define IMR_BCNDMAINT7_8723B BIT27 // Beacon DMA Interrupt 7
-#define IMR_BCNDMAINT6_8723B BIT26 // Beacon DMA Interrupt 6
-#define IMR_BCNDMAINT5_8723B BIT25 // Beacon DMA Interrupt 5
-#define IMR_BCNDMAINT4_8723B BIT24 // Beacon DMA Interrupt 4
-#define IMR_BCNDMAINT3_8723B BIT23 // Beacon DMA Interrupt 3
-#define IMR_BCNDMAINT2_8723B BIT22 // Beacon DMA Interrupt 2
-#define IMR_BCNDMAINT1_8723B BIT21 // Beacon DMA Interrupt 1
-#define IMR_BCNDOK7_8723B BIT20 // Beacon Queue DMA OK Interrup 7
-#define IMR_BCNDOK6_8723B BIT19 // Beacon Queue DMA OK Interrup 6
-#define IMR_BCNDOK5_8723B BIT18 // Beacon Queue DMA OK Interrup 5
-#define IMR_BCNDOK4_8723B BIT17 // Beacon Queue DMA OK Interrup 4
-#define IMR_BCNDOK3_8723B BIT16 // Beacon Queue DMA OK Interrup 3
-#define IMR_BCNDOK2_8723B BIT15 // Beacon Queue DMA OK Interrup 2
-#define IMR_BCNDOK1_8723B BIT14 // Beacon Queue DMA OK Interrup 1
-#define IMR_ATIMEND_E_8723B BIT13 // ATIM Window End Extension for Win7
-#define IMR_TXERR_8723B BIT11 // Tx Error Flag Interrupt Status, write 1 clear.
-#define IMR_RXERR_8723B BIT10 // Rx Error Flag INT Status, Write 1 clear
-#define IMR_TXFOVW_8723B BIT9 // Transmit FIFO Overflow
-#define IMR_RXFOVW_8723B BIT8 // Receive FIFO Overflow
-
-#ifdef CONFIG_PCI_HCI
-//#define IMR_RX_MASK (IMR_ROK_8723B|IMR_RDU_8723B|IMR_RXFOVW_8723B)
-#define IMR_TX_MASK (IMR_VODOK_8723B|IMR_VIDOK_8723B|IMR_BEDOK_8723B|IMR_BKDOK_8723B|IMR_MGNTDOK_8723B|IMR_HIGHDOK_8723B)
-
-#define RT_BCN_INT_MASKS (IMR_BCNDMAINT0_8723B | IMR_TXBCN0OK_8723B | IMR_TXBCN0ERR_8723B | IMR_BCNDERR0_8723B)
-
-#define RT_AC_INT_MASKS (IMR_VIDOK_8723B | IMR_VODOK_8723B | IMR_BEDOK_8723B|IMR_BKDOK_8723B)
-#endif
-
-#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_8723BUSB, *PBOARD_TYPE_8723BUSB;
-
-#endif
+/******************************************************************************
+ *
+ * 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 __RTL8723B_SPEC_H__
+#define __RTL8723B_SPEC_H__
+
+#include <drv_conf.h>
+
+
+#define HAL_NAV_UPPER_UNIT_8723B 128 // micro-second
+
+//-----------------------------------------------------
+//
+// 0x0000h ~ 0x00FFh System Configuration
+//
+//-----------------------------------------------------
+#define REG_RSV_CTRL_8723B 0x001C // 3 Byte
+#define REG_BT_WIFI_ANTENNA_SWITCH_8723B 0x0038
+#define REG_HSISR_8723B 0x005c
+#define REG_PAD_CTRL1_8723B 0x0064
+#define REG_AFE_CTRL_4_8723B 0x0078
+#define REG_HMEBOX_DBG_0_8723B 0x0088
+#define REG_HMEBOX_DBG_1_8723B 0x008A
+#define REG_HMEBOX_DBG_2_8723B 0x008C
+#define REG_HMEBOX_DBG_3_8723B 0x008E
+#define REG_HIMR0_8723B 0x00B0
+#define REG_HISR0_8723B 0x00B4
+#define REG_HIMR1_8723B 0x00B8
+#define REG_HISR1_8723B 0x00BC
+#define REG_PMC_DBG_CTRL2_8723B 0x00CC
+
+//-----------------------------------------------------
+//
+// 0x0100h ~ 0x01FFh MACTOP General Configuration
+//
+//-----------------------------------------------------
+#define REG_C2HEVT_CMD_ID_8723B 0x01A0
+#define REG_C2HEVT_CMD_LEN_8723B 0x01AE
+#define REG_WOWLAN_WAKE_REASON 0x01C7
+#define REG_WOWLAN_GTK_DBG1 0x630
+#define REG_WOWLAN_GTK_DBG2 0x634
+
+#define REG_HMEBOX_EXT0_8723B 0x01F0
+#define REG_HMEBOX_EXT1_8723B 0x01F4
+#define REG_HMEBOX_EXT2_8723B 0x01F8
+#define REG_HMEBOX_EXT3_8723B 0x01FC
+
+//-----------------------------------------------------
+//
+// 0x0200h ~ 0x027Fh TXDMA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0280h ~ 0x02FFh RXDMA Configuration
+//
+//-----------------------------------------------------
+#define REG_RXDMA_CONTROL_8723B 0x0286 // Control the RX DMA.
+#define REG_RXDMA_MODE_CTRL_8723B 0x0290
+
+//-----------------------------------------------------
+//
+// 0x0300h ~ 0x03FFh PCIe
+//
+//-----------------------------------------------------
+#define REG_PCIE_CTRL_REG_8723B 0x0300
+#define REG_INT_MIG_8723B 0x0304 // Interrupt Migration
+#define REG_BCNQ_DESA_8723B 0x0308 // TX Beacon Descriptor Address
+#define REG_HQ_DESA_8723B 0x0310 // TX High Queue Descriptor Address
+#define REG_MGQ_DESA_8723B 0x0318 // TX Manage Queue Descriptor Address
+#define REG_VOQ_DESA_8723B 0x0320 // TX VO Queue Descriptor Address
+#define REG_VIQ_DESA_8723B 0x0328 // TX VI Queue Descriptor Address
+#define REG_BEQ_DESA_8723B 0x0330 // TX BE Queue Descriptor Address
+#define REG_BKQ_DESA_8723B 0x0338 // TX BK Queue Descriptor Address
+#define REG_RX_DESA_8723B 0x0340 // RX Queue Descriptor Address
+#define REG_DBI_WDATA_8723B 0x0348 // DBI Write Data
+#define REG_DBI_RDATA_8723B 0x034C // DBI Read Data
+#define REG_DBI_ADDR_8723B 0x0350 // DBI Address
+#define REG_DBI_FLAG_8723B 0x0352 // DBI Read/Write Flag
+#define REG_MDIO_WDATA_8723B 0x0354 // MDIO for Write PCIE PHY
+#define REG_MDIO_RDATA_8723B 0x0356 // MDIO for Reads PCIE PHY
+#define REG_MDIO_CTL_8723B 0x0358 // MDIO for Control
+#define REG_DBG_SEL_8723B 0x0360 // Debug Selection Register
+#define REG_PCIE_HRPWM_8723B 0x0361 //PCIe RPWM
+#define REG_PCIE_HCPWM_8723B 0x0363 //PCIe CPWM
+#define REG_PCIE_MULTIFET_CTRL_8723B 0x036A //PCIE Multi-Fethc Control
+
+//-----------------------------------------------------
+//
+// 0x0400h ~ 0x047Fh Protocol Configuration
+//
+//-----------------------------------------------------
+#define REG_TXPKTBUF_BCNQ_BDNY_8723B 0x0424
+#define REG_TXPKTBUF_MGQ_BDNY_8723B 0x0425
+#define REG_TXPKTBUF_WMAC_LBK_BF_HD_8723B 0x045D
+#ifdef CONFIG_WOWLAN
+#define REG_TXPKTBUF_IV_LOW 0x0484
+#define REG_TXPKTBUF_IV_HIGH 0x0488
+#endif
+#define REG_AMPDU_BURST_MODE_8723B 0x04BC
+
+//-----------------------------------------------------
+//
+// 0x0500h ~ 0x05FFh EDCA Configuration
+//
+//-----------------------------------------------------
+#define REG_SECONDARY_CCA_CTRL_8723B 0x0577
+
+//-----------------------------------------------------
+//
+// 0x0600h ~ 0x07FFh WMAC Configuration
+//
+//-----------------------------------------------------
+
+
+//============================================================
+// SDIO Bus Specification
+//============================================================
+
+//-----------------------------------------------------
+// SDIO CMD Address Mapping
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// I/O bus domain (Host)
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// SDIO register
+//-----------------------------------------------------
+#define SDIO_REG_HCPWM1_8723B 0x025 // HCI Current Power Mode 1
+
+
+//============================================================================
+// 8723 Regsiter Bit and Content definition
+//============================================================================
+
+//2 HSISR
+// interrupt mask which needs to clear
+#define MASK_HSISR_CLEAR (HSISR_GPIO12_0_INT |\
+ HSISR_SPS_OCP_INT |\
+ HSISR_RON_INT |\
+ HSISR_PDNINT |\
+ HSISR_GPIO9_INT)
+
+//-----------------------------------------------------
+//
+// 0x0100h ~ 0x01FFh MACTOP General Configuration
+//
+//-----------------------------------------------------
+
+
+//-----------------------------------------------------
+//
+// 0x0200h ~ 0x027Fh TXDMA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0280h ~ 0x02FFh RXDMA Configuration
+//
+//-----------------------------------------------------
+#define BIT_USB_RXDMA_AGG_EN BIT(31)
+#define RXDMA_AGG_MODE_EN BIT(1)
+
+#ifdef CONFIG_WOWLAN
+#define RXPKT_RELEASE_POLL BIT(16)
+#define RXDMA_IDLE BIT(17)
+#define RW_RELEASE_EN BIT(18)
+#endif
+
+//-----------------------------------------------------
+//
+// 0x0400h ~ 0x047Fh Protocol Configuration
+//
+//-----------------------------------------------------
+
+//----------------------------------------------------------------------------
+// 8723B REG_CCK_CHECK (offset 0x454)
+//----------------------------------------------------------------------------
+#define BIT_BCN_PORT_SEL BIT5
+
+//-----------------------------------------------------
+//
+// 0x0500h ~ 0x05FFh EDCA Configuration
+//
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+//
+// 0x0600h ~ 0x07FFh WMAC Configuration
+//
+//-----------------------------------------------------
+#ifdef CONFIG_RF_GAIN_OFFSET
+
+#ifdef CONFIG_RTL8723B
+#define EEPROM_RF_GAIN_OFFSET 0xC1
+#endif
+
+#define EEPROM_RF_GAIN_VAL 0x1F6
+#endif //CONFIG_RF_GAIN_OFFSET
+
+
+//----------------------------------------------------------------------------
+// 8195 IMR/ISR bits (offset 0xB0, 8bits)
+//----------------------------------------------------------------------------
+#define IMR_DISABLED_8723B 0
+// IMR DW0(0x00B0-00B3) Bit 0-31
+#define IMR_TIMER2_8723B BIT31 // Timeout interrupt 2
+#define IMR_TIMER1_8723B BIT30 // Timeout interrupt 1
+#define IMR_PSTIMEOUT_8723B BIT29 // Power Save Time Out Interrupt
+#define IMR_GTINT4_8723B BIT28 // When GTIMER4 expires, this bit is set to 1
+#define IMR_GTINT3_8723B BIT27 // When GTIMER3 expires, this bit is set to 1
+#define IMR_TXBCN0ERR_8723B BIT26 // Transmit Beacon0 Error
+#define IMR_TXBCN0OK_8723B BIT25 // Transmit Beacon0 OK
+#define IMR_TSF_BIT32_TOGGLE_8723B BIT24 // TSF Timer BIT32 toggle indication interrupt
+#define IMR_BCNDMAINT0_8723B BIT20 // Beacon DMA Interrupt 0
+#define IMR_BCNDERR0_8723B BIT16 // Beacon Queue DMA OK0
+#define IMR_HSISR_IND_ON_INT_8723B BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1)
+#define IMR_BCNDMAINT_E_8723B BIT14 // Beacon DMA Interrupt Extension for Win7
+#define IMR_ATIMEND_8723B BIT12 // CTWidnow End or ATIM Window End
+#define IMR_C2HCMD_8723B BIT10 // CPU to Host Command INT Status, Write 1 clear
+#define IMR_CPWM2_8723B BIT9 // CPU power Mode exchange INT Status, Write 1 clear
+#define IMR_CPWM_8723B BIT8 // CPU power Mode exchange INT Status, Write 1 clear
+#define IMR_HIGHDOK_8723B BIT7 // High Queue DMA OK
+#define IMR_MGNTDOK_8723B BIT6 // Management Queue DMA OK
+#define IMR_BKDOK_8723B BIT5 // AC_BK DMA OK
+#define IMR_BEDOK_8723B BIT4 // AC_BE DMA OK
+#define IMR_VIDOK_8723B BIT3 // AC_VI DMA OK
+#define IMR_VODOK_8723B BIT2 // AC_VO DMA OK
+#define IMR_RDU_8723B BIT1 // Rx Descriptor Unavailable
+#define IMR_ROK_8723B BIT0 // Receive DMA OK
+
+// IMR DW1(0x00B4-00B7) Bit 0-31
+#define IMR_BCNDMAINT7_8723B BIT27 // Beacon DMA Interrupt 7
+#define IMR_BCNDMAINT6_8723B BIT26 // Beacon DMA Interrupt 6
+#define IMR_BCNDMAINT5_8723B BIT25 // Beacon DMA Interrupt 5
+#define IMR_BCNDMAINT4_8723B BIT24 // Beacon DMA Interrupt 4
+#define IMR_BCNDMAINT3_8723B BIT23 // Beacon DMA Interrupt 3
+#define IMR_BCNDMAINT2_8723B BIT22 // Beacon DMA Interrupt 2
+#define IMR_BCNDMAINT1_8723B BIT21 // Beacon DMA Interrupt 1
+#define IMR_BCNDOK7_8723B BIT20 // Beacon Queue DMA OK Interrup 7
+#define IMR_BCNDOK6_8723B BIT19 // Beacon Queue DMA OK Interrup 6
+#define IMR_BCNDOK5_8723B BIT18 // Beacon Queue DMA OK Interrup 5
+#define IMR_BCNDOK4_8723B BIT17 // Beacon Queue DMA OK Interrup 4
+#define IMR_BCNDOK3_8723B BIT16 // Beacon Queue DMA OK Interrup 3
+#define IMR_BCNDOK2_8723B BIT15 // Beacon Queue DMA OK Interrup 2
+#define IMR_BCNDOK1_8723B BIT14 // Beacon Queue DMA OK Interrup 1
+#define IMR_ATIMEND_E_8723B BIT13 // ATIM Window End Extension for Win7
+#define IMR_TXERR_8723B BIT11 // Tx Error Flag Interrupt Status, write 1 clear.
+#define IMR_RXERR_8723B BIT10 // Rx Error Flag INT Status, Write 1 clear
+#define IMR_TXFOVW_8723B BIT9 // Transmit FIFO Overflow
+#define IMR_RXFOVW_8723B BIT8 // Receive FIFO Overflow
+
+#ifdef CONFIG_PCI_HCI
+//#define IMR_RX_MASK (IMR_ROK_8723B|IMR_RDU_8723B|IMR_RXFOVW_8723B)
+#define IMR_TX_MASK (IMR_VODOK_8723B|IMR_VIDOK_8723B|IMR_BEDOK_8723B|IMR_BKDOK_8723B|IMR_MGNTDOK_8723B|IMR_HIGHDOK_8723B)
+
+#define RT_BCN_INT_MASKS (IMR_BCNDMAINT0_8723B | IMR_TXBCN0OK_8723B | IMR_TXBCN0ERR_8723B | IMR_BCNDERR0_8723B)
+
+#define RT_AC_INT_MASKS (IMR_VIDOK_8723B | IMR_VODOK_8723B | IMR_BEDOK_8723B|IMR_BKDOK_8723B)
+#endif
+
+#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_8723BUSB, *PBOARD_TYPE_8723BUSB;
+
+#endif
diff --git a/rtl8xxx_EU/include/rtl8723b_xmit.h b/rtl8xxx_EU/include/rtl8723b_xmit.h
index 2de6a68..306ad24 100755
--- a/rtl8xxx_EU/include/rtl8723b_xmit.h
+++ b/rtl8xxx_EU/include/rtl8723b_xmit.h
@@ -1,502 +1,502 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __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)
-
-//OFFSET 0
-#define OFFSET_SZ 0
-#define OFFSET_SHT 16
-#define BMC BIT(24)
-#define LSG BIT(26)
-#define FSG BIT(27)
-#define OWN BIT(31)
-
-
-//OFFSET 4
-#define PKT_OFFSET_SZ 0
-#define BK BIT(6)
-#define QSEL_SHT 8
-#define Rate_ID_SHT 16
-#define NAVUSEHDR BIT(20)
-#define PKT_OFFSET_SHT 26
-#define HWPC BIT(31)
-
-//OFFSET 8
-#define AGG_EN BIT(29)
-
-//OFFSET 12
-#define SEQ_SHT 16
-
-//OFFSET 16
-#define QoS BIT(6)
-#define HW_SEQ_EN BIT(7)
-#define USERATE BIT(8)
-#define DISDATAFB BIT(10)
-#define DATA_SHORT BIT(24)
-#define DATA_BW BIT(25)
-
-//OFFSET 20
-#define SGI BIT(6)
-
-//
-//defined for TX DESC Operation
-//
-typedef struct txdesc_8723b
-{
- // Offset 0
- u32 pktlen:16;
- u32 offset:8;
- u32 bmc:1;
- u32 htc:1;
- u32 rsvd0026:1;
- u32 rsvd0027:1;
- u32 linip:1;
- u32 noacm:1;
- u32 gf:1;
- u32 rsvd0031:1;
-
- // Offset 4
- u32 macid:7;
- u32 rsvd0407:1;
- u32 qsel:5;
- u32 rdg_nav_ext:1;
- u32 lsig_txop_en:1;
- u32 pifs:1;
- u32 rate_id:5;
- u32 en_desc_id:1;
- u32 sectype:2;
- u32 pkt_offset:5; // unit: 8 bytes
- u32 moredata:1;
- u32 txop_ps_cap:1;
- u32 txop_ps_mode:1;
-
- // Offset 8
- u32 p_aid:9;
- u32 rsvd0809:1;
- u32 cca_rts:2;
- u32 agg_en:1;
- u32 rdg_en:1;
- u32 null_0:1;
- u32 null_1:1;
- u32 bk:1;
- u32 morefrag:1;
- u32 raw:1;
- u32 spe_rpt:1;
- u32 ampdu_density:3;
- u32 bt_null:1;
- u32 g_id:6;
- u32 rsvd0830:2;
-
- // Offset 12
- u32 wheader_len:4;
- u32 chk_en:1;
- u32 early_rate:1;
- u32 hw_ssn_sel:2;
- u32 userate:1;
- u32 disrtsfb:1;
- u32 disdatafb:1;
- u32 cts2self:1;
- u32 rtsen:1;
- u32 hw_rts_en:1;
- u32 port_id:1;
- u32 navusehdr:1;
- u32 use_max_len:1;
- u32 max_agg_num:5;
- u32 ndpa:2;
- u32 ampdu_max_time:8;
-
- // Offset 16
- u32 datarate:7;
- u32 try_rate:1;
- u32 data_ratefb_lmt:5;
- u32 rts_ratefb_lmt:4;
- u32 rty_lmt_en:1;
- u32 data_rt_lmt:6;
- u32 rtsrate:5;
- u32 pcts_en:1;
- u32 pcts_mask_idx:2;
-
- // Offset 20
- u32 data_sc:4;
- u32 data_short:1;
- u32 data_bw:2;
- u32 data_ldpc:1;
- u32 data_stbc:2;
- u32 vcs_stbc:2;
- u32 rts_short:1;
- u32 rts_sc:4;
- u32 rsvd2016:7;
- u32 tx_ant:4;
- u32 txpwr_offset:3;
- u32 rsvd2031:1;
-
- // Offset 24
- u32 sw_define:12;
- u32 mbssid:4;
- u32 antsel_A:3;
- u32 antsel_B:3;
- u32 antsel_C:3;
- u32 antsel_D:3;
- u32 rsvd2428:4;
-
- // Offset 28
- u32 checksum:16;
- u32 rsvd2816:8;
- u32 usb_txagg_num:8;
-
- // Offset 32
- u32 rts_rc:6;
- u32 bar_rty_th:2;
- u32 data_rc:6;
- u32 rsvd3214:1;
- u32 en_hwseq:1;
- u32 nextneadpage:8;
- u32 tailpage:8;
-
- // Offset 36
- u32 padding_len:11;
- u32 txbf_path:1;
- u32 seq:12;
- u32 final_data_rate:8;
-}TXDESC_8723B, *PTXDESC_8723B;
-
-#ifndef __INC_HAL8723BDESC_H
-#define __INC_HAL8723BDESC_H
-
-#define RX_STATUS_DESC_SIZE_8723B 24
-#define RX_DRV_INFO_SIZE_UNIT_8723B 8
-
-
-//DWORD 0
-#define SET_RX_STATUS_DESC_PKT_LEN_8723B(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 0, 14, __Value)
-#define SET_RX_STATUS_DESC_EOR_8723B(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 30, 1, __Value)
-#define SET_RX_STATUS_DESC_OWN_8723B(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 31, 1, __Value)
-
-#define GET_RX_STATUS_DESC_PKT_LEN_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 14)
-#define GET_RX_STATUS_DESC_CRC32_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 14, 1)
-#define GET_RX_STATUS_DESC_ICV_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 15, 1)
-#define GET_RX_STATUS_DESC_DRVINFO_SIZE_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 4)
-#define GET_RX_STATUS_DESC_SECURITY_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 20, 3)
-#define GET_RX_STATUS_DESC_QOS_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 23, 1)
-#define GET_RX_STATUS_DESC_SHIFT_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 24, 2)
-#define GET_RX_STATUS_DESC_PHY_STATUS_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 26, 1)
-#define GET_RX_STATUS_DESC_SWDEC_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 27, 1)
-#define GET_RX_STATUS_DESC_LAST_SEG_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 28, 1)
-#define GET_RX_STATUS_DESC_FIRST_SEG_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 29, 1)
-#define GET_RX_STATUS_DESC_EOR_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 30, 1)
-#define GET_RX_STATUS_DESC_OWN_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 31, 1)
-
-//DWORD 1
-#define GET_RX_STATUS_DESC_MACID_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 0, 7)
-#define GET_RX_STATUS_DESC_TID_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 8, 4)
-#define GET_RX_STATUS_DESC_AMSDU_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 13, 1)
-#define GET_RX_STATUS_DESC_RXID_MATCH_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 14, 1)
-#define GET_RX_STATUS_DESC_PAGGR_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 15, 1)
-#define GET_RX_STATUS_DESC_A1_FIT_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 16, 4)
-#define GET_RX_STATUS_DESC_CHKERR_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 20, 1)
-#define GET_RX_STATUS_DESC_IPVER_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 21, 1)
-#define GET_RX_STATUS_DESC_IS_TCPUDP__8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 22, 1)
-#define GET_RX_STATUS_DESC_CHK_VLD_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 23, 1)
-#define GET_RX_STATUS_DESC_PAM_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 24, 1)
-#define GET_RX_STATUS_DESC_PWR_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 25, 1)
-#define GET_RX_STATUS_DESC_MORE_DATA_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 26, 1)
-#define GET_RX_STATUS_DESC_MORE_FRAG_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 27, 1)
-#define GET_RX_STATUS_DESC_TYPE_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 28, 2)
-#define GET_RX_STATUS_DESC_MC_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 30, 1)
-#define GET_RX_STATUS_DESC_BC_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 31, 1)
-
-//DWORD 2
-#define GET_RX_STATUS_DESC_SEQ_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 0, 12)
-#define GET_RX_STATUS_DESC_FRAG_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 12, 4)
-#define GET_RX_STATUS_DESC_RX_IS_QOS_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 16, 1)
-#define GET_RX_STATUS_DESC_WLANHD_IV_LEN_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 18, 6)
-#define GET_RX_STATUS_DESC_RPT_SEL_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 28, 1)
-
-//DWORD 3
-#define GET_RX_STATUS_DESC_RX_RATE_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 0, 7)
-#define GET_RX_STATUS_DESC_HTC_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 10, 1)
-#define GET_RX_STATUS_DESC_EOSP_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 11, 1)
-#define GET_RX_STATUS_DESC_BSSID_FIT_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 12, 2)
-#ifdef CONFIG_USB_RX_AGGREGATION
-#define GET_RX_STATUS_DESC_USB_AGG_PKTNUM_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 16, 8)
-#endif
-#define GET_RX_STATUS_DESC_PATTERN_MATCH_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 29, 1)
-#define GET_RX_STATUS_DESC_UNICAST_MATCH_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 30, 1)
-#define GET_RX_STATUS_DESC_MAGIC_MATCH_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 31, 1)
-
-//DWORD 6
-#define GET_RX_STATUS_DESC_SPLCP_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 0, 1)
-#define GET_RX_STATUS_DESC_LDPC_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 1, 1)
-#define GET_RX_STATUS_DESC_STBC_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 2, 1)
-#define GET_RX_STATUS_DESC_BW_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 4, 2)
-
-//DWORD 5
-#define GET_RX_STATUS_DESC_TSFL_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
-
-#define GET_RX_STATUS_DESC_BUFF_ADDR_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+24, 0, 32)
-#define GET_RX_STATUS_DESC_BUFF_ADDR64_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+28, 0, 32)
-
-#define SET_RX_STATUS_DESC_BUFF_ADDR_8723B(__pRxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxDesc+24, 0, 32, __Value)
-
-
-// Dword 0
-#define GET_TX_DESC_OWN_8723B(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc, 31, 1)
-
-#define SET_TX_DESC_PKT_SIZE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 0, 16, __Value)
-#define SET_TX_DESC_OFFSET_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 16, 8, __Value)
-#define SET_TX_DESC_BMC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 24, 1, __Value)
-#define SET_TX_DESC_HTC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 25, 1, __Value)
-#define SET_TX_DESC_LAST_SEG_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 26, 1, __Value)
-#define SET_TX_DESC_FIRST_SEG_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 27, 1, __Value)
-#define SET_TX_DESC_LINIP_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 28, 1, __Value)
-#define SET_TX_DESC_NO_ACM_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 29, 1, __Value)
-#define SET_TX_DESC_GF_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 30, 1, __Value)
-#define SET_TX_DESC_OWN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 31, 1, __Value)
-
-// Dword 1
-#define SET_TX_DESC_MACID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 0, 7, __Value)
-#define SET_TX_DESC_QUEUE_SEL_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 8, 5, __Value)
-#define SET_TX_DESC_RDG_NAV_EXT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 13, 1, __Value)
-#define SET_TX_DESC_LSIG_TXOP_EN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 14, 1, __Value)
-#define SET_TX_DESC_PIFS_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 15, 1, __Value)
-#define SET_TX_DESC_RATE_ID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 16, 5, __Value)
-#define SET_TX_DESC_EN_DESC_ID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 21, 1, __Value)
-#define SET_TX_DESC_SEC_TYPE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 22, 2, __Value)
-#define SET_TX_DESC_PKT_OFFSET_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 24, 5, __Value)
-
-
-// Dword 2
-#define SET_TX_DESC_PAID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 0, 9, __Value)
-#define SET_TX_DESC_CCA_RTS_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 10, 2, __Value)
-#define SET_TX_DESC_AGG_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 12, 1, __Value)
-#define SET_TX_DESC_RDG_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 13, 1, __Value)
-#define SET_TX_DESC_AGG_BREAK_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 16, 1, __Value)
-#define SET_TX_DESC_MORE_FRAG_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 17, 1, __Value)
-#define SET_TX_DESC_RAW_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 18, 1, __Value)
-#define SET_TX_DESC_SPE_RPT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 19, 1, __Value)
-#define SET_TX_DESC_AMPDU_DENSITY_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 20, 3, __Value)
-#define SET_TX_DESC_BT_INT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 23, 1, __Value)
-#define SET_TX_DESC_GID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 6, __Value)
-
-
-// Dword 3
-#define SET_TX_DESC_WHEADER_LEN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 0, 4, __Value)
-#define SET_TX_DESC_CHK_EN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 4, 1, __Value)
-#define SET_TX_DESC_EARLY_MODE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 5, 1, __Value)
-#define SET_TX_DESC_HWSEQ_SEL_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 6, 2, __Value)
-#define SET_TX_DESC_USE_RATE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 8, 1, __Value)
-#define SET_TX_DESC_DISABLE_RTS_FB_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 9, 1, __Value)
-#define SET_TX_DESC_DISABLE_FB_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 10, 1, __Value)
-#define SET_TX_DESC_CTS2SELF_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 11, 1, __Value)
-#define SET_TX_DESC_RTS_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 12, 1, __Value)
-#define SET_TX_DESC_HW_RTS_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 13, 1, __Value)
-#define SET_TX_DESC_NAV_USE_HDR_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 15, 1, __Value)
-#define SET_TX_DESC_USE_MAX_LEN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 16, 1, __Value)
-#define SET_TX_DESC_MAX_AGG_NUM_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 17, 5, __Value)
-#define SET_TX_DESC_NDPA_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 22, 2, __Value)
-#define SET_TX_DESC_AMPDU_MAX_TIME_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 24, 8, __Value)
-
-// Dword 4
-#define SET_TX_DESC_TX_RATE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 0, 7, __Value)
-#define SET_TX_DESC_DATA_RATE_FB_LIMIT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 8, 5, __Value)
-#define SET_TX_DESC_RTS_RATE_FB_LIMIT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 13, 4, __Value)
-#define SET_TX_DESC_RETRY_LIMIT_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 17, 1, __Value)
-#define SET_TX_DESC_DATA_RETRY_LIMIT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 18, 6, __Value)
-#define SET_TX_DESC_RTS_RATE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 24, 5, __Value)
-
-
-// Dword 5
-#define SET_TX_DESC_DATA_SC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 0, 4, __Value)
-#define SET_TX_DESC_DATA_SHORT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 4, 1, __Value)
-#define SET_TX_DESC_DATA_BW_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 5, 2, __Value)
-#define SET_TX_DESC_DATA_LDPC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 7, 1, __Value)
-#define SET_TX_DESC_DATA_STBC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 8, 2, __Value)
-#define SET_TX_DESC_CTROL_STBC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 10, 2, __Value)
-#define SET_TX_DESC_RTS_SHORT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 12, 1, __Value)
-#define SET_TX_DESC_RTS_SC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 13, 4, __Value)
-
-
-// Dword 6
-#define SET_TX_DESC_SW_DEFINE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 0, 12, __Value)
-#define SET_TX_DESC_ANTSEL_A_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 16, 3, __Value)
-#define SET_TX_DESC_ANTSEL_B_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 19, 3, __Value)
-#define SET_TX_DESC_ANTSEL_C_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 22, 3, __Value)
-#define SET_TX_DESC_ANTSEL_D_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 25, 3, __Value)
-
-// Dword 7
-#if(DEV_BUS_TYPE == RT_PCI_INTERFACE)
-#define SET_TX_DESC_TX_BUFFER_SIZE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
-#else
-#define SET_TX_DESC_TX_DESC_CHECKSUM_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
-#endif
-#define SET_TX_DESC_USB_TXAGG_NUM_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 24, 8, __Value)
-#if(DEV_BUS_TYPE == RT_SDIO_INTERFACE)
-#define SET_TX_DESC_SDIO_TXSEQ_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 16, 8, __Value)
-#endif
-
-// Dword 8
-#define SET_TX_DESC_HWSEQ_EN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 15, 1, __Value)
-
-// Dword 9
-#define SET_TX_DESC_SEQ_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 12, 12, __Value)
-
-// Dword 10
-#define SET_TX_DESC_TX_BUFFER_ADDRESS_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+40, 0, 32, __Value)
-#define GET_TX_DESC_TX_BUFFER_ADDRESS_8723B(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc+40, 0, 32)
-
-// Dword 11
-#define SET_TX_DESC_NEXT_DESC_ADDRESS_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+48, 0, 32, __Value)
-
-
-#define SET_EARLYMODE_PKTNUM_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 4, __Value)
-#define SET_EARLYMODE_LEN0_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 15, __Value)
-#define SET_EARLYMODE_LEN1_1_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 19, 13, __Value)
-#define SET_EARLYMODE_LEN1_2_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 2, __Value)
-#define SET_EARLYMODE_LEN2_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 2, 15, __Value)
-#define SET_EARLYMODE_LEN3_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 17, 15, __Value)
-
-#endif
-//-----------------------------------------------------------
-//
-// Rate
-//
-//-----------------------------------------------------------
-// CCK Rates, TxHT = 0
-#define DESC8723B_RATE1M 0x00
-#define DESC8723B_RATE2M 0x01
-#define DESC8723B_RATE5_5M 0x02
-#define DESC8723B_RATE11M 0x03
-
-// OFDM Rates, TxHT = 0
-#define DESC8723B_RATE6M 0x04
-#define DESC8723B_RATE9M 0x05
-#define DESC8723B_RATE12M 0x06
-#define DESC8723B_RATE18M 0x07
-#define DESC8723B_RATE24M 0x08
-#define DESC8723B_RATE36M 0x09
-#define DESC8723B_RATE48M 0x0a
-#define DESC8723B_RATE54M 0x0b
-
-// MCS Rates, TxHT = 1
-#define DESC8723B_RATEMCS0 0x0c
-#define DESC8723B_RATEMCS1 0x0d
-#define DESC8723B_RATEMCS2 0x0e
-#define DESC8723B_RATEMCS3 0x0f
-#define DESC8723B_RATEMCS4 0x10
-#define DESC8723B_RATEMCS5 0x11
-#define DESC8723B_RATEMCS6 0x12
-#define DESC8723B_RATEMCS7 0x13
-#define DESC8723B_RATEMCS8 0x14
-#define DESC8723B_RATEMCS9 0x15
-#define DESC8723B_RATEMCS10 0x16
-#define DESC8723B_RATEMCS11 0x17
-#define DESC8723B_RATEMCS12 0x18
-#define DESC8723B_RATEMCS13 0x19
-#define DESC8723B_RATEMCS14 0x1a
-#define DESC8723B_RATEMCS15 0x1b
-#define DESC8723B_RATEVHTSS1MCS0 0x2c
-#define DESC8723B_RATEVHTSS1MCS1 0x2d
-#define DESC8723B_RATEVHTSS1MCS2 0x2e
-#define DESC8723B_RATEVHTSS1MCS3 0x2f
-#define DESC8723B_RATEVHTSS1MCS4 0x30
-#define DESC8723B_RATEVHTSS1MCS5 0x31
-#define DESC8723B_RATEVHTSS1MCS6 0x32
-#define DESC8723B_RATEVHTSS1MCS7 0x33
-#define DESC8723B_RATEVHTSS1MCS8 0x34
-#define DESC8723B_RATEVHTSS1MCS9 0x35
-#define DESC8723B_RATEVHTSS2MCS0 0x36
-#define DESC8723B_RATEVHTSS2MCS1 0x37
-#define DESC8723B_RATEVHTSS2MCS2 0x38
-#define DESC8723B_RATEVHTSS2MCS3 0x39
-#define DESC8723B_RATEVHTSS2MCS4 0x3a
-#define DESC8723B_RATEVHTSS2MCS5 0x3b
-#define DESC8723B_RATEVHTSS2MCS6 0x3c
-#define DESC8723B_RATEVHTSS2MCS7 0x3d
-#define DESC8723B_RATEVHTSS2MCS8 0x3e
-#define DESC8723B_RATEVHTSS2MCS9 0x3f
-
-
-#define RX_HAL_IS_CCK_RATE_8723B(pDesc)\
- (GET_RX_STATUS_DESC_RX_RATE_8723B(pDesc) == DESC8723B_RATE1M ||\
- GET_RX_STATUS_DESC_RX_RATE_8723B(pDesc) == DESC8723B_RATE2M ||\
- GET_RX_STATUS_DESC_RX_RATE_8723B(pDesc) == DESC8723B_RATE5_5M ||\
- GET_RX_STATUS_DESC_RX_RATE_8723B(pDesc) == DESC8723B_RATE11M)
-
-
-void rtl8723b_update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem);
-void rtl8723b_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 rtl8723bs_init_xmit_priv(PADAPTER padapter);
-void rtl8723bs_free_xmit_priv(PADAPTER padapter);
-s32 rtl8723bs_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8723bs_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8723bs_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-s32 rtl8723bs_xmit_buf_handler(PADAPTER padapter);
-thread_return rtl8723bs_xmit_thread(thread_context context);
-#define hal_xmit_handler rtl8723bs_xmit_buf_handler
-#endif
-
-#ifdef CONFIG_USB_HCI
-s32 rtl8723bu_xmit_buf_handler(PADAPTER padapter);
-#define hal_xmit_handler rtl8723bu_xmit_buf_handler
-
-
-s32 rtl8723bu_init_xmit_priv(PADAPTER padapter);
-void rtl8723bu_free_xmit_priv(PADAPTER padapter);
-s32 rtl8723bu_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8723bu_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8723bu_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-//s32 rtl8812au_xmit_buf_handler(PADAPTER padapter);
-void rtl8723bu_xmit_tasklet(void *priv);
-s32 rtl8723bu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
-void _dbg_dump_tx_info(_adapter *padapter,int frame_tag,struct tx_desc *ptxdesc);
-#endif
-
-#ifdef CONFIG_PCI_HCI
-s32 rtl8723be_init_xmit_priv(PADAPTER padapter);
-void rtl8723be_free_xmit_priv(PADAPTER padapter);
-struct xmit_buf *rtl8723be_dequeue_xmitbuf(struct rtw_tx_ring *ring);
-void rtl8723be_xmitframe_resume(_adapter *padapter);
-s32 rtl8723be_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8723be_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8723be_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-void rtl8723be_xmit_tasklet(void *priv);
-#endif
-
-u8 BWMapping_8723B(PADAPTER Adapter, struct pkt_attrib *pattrib);
-u8 SCMapping_8723B(PADAPTER Adapter, struct pkt_attrib *pattrib);
-
-#endif
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __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)
+
+//OFFSET 0
+#define OFFSET_SZ 0
+#define OFFSET_SHT 16
+#define BMC BIT(24)
+#define LSG BIT(26)
+#define FSG BIT(27)
+#define OWN BIT(31)
+
+
+//OFFSET 4
+#define PKT_OFFSET_SZ 0
+#define BK BIT(6)
+#define QSEL_SHT 8
+#define Rate_ID_SHT 16
+#define NAVUSEHDR BIT(20)
+#define PKT_OFFSET_SHT 26
+#define HWPC BIT(31)
+
+//OFFSET 8
+#define AGG_EN BIT(29)
+
+//OFFSET 12
+#define SEQ_SHT 16
+
+//OFFSET 16
+#define QoS BIT(6)
+#define HW_SEQ_EN BIT(7)
+#define USERATE BIT(8)
+#define DISDATAFB BIT(10)
+#define DATA_SHORT BIT(24)
+#define DATA_BW BIT(25)
+
+//OFFSET 20
+#define SGI BIT(6)
+
+//
+//defined for TX DESC Operation
+//
+typedef struct txdesc_8723b
+{
+ // Offset 0
+ u32 pktlen:16;
+ u32 offset:8;
+ u32 bmc:1;
+ u32 htc:1;
+ u32 rsvd0026:1;
+ u32 rsvd0027:1;
+ u32 linip:1;
+ u32 noacm:1;
+ u32 gf:1;
+ u32 rsvd0031:1;
+
+ // Offset 4
+ u32 macid:7;
+ u32 rsvd0407:1;
+ u32 qsel:5;
+ u32 rdg_nav_ext:1;
+ u32 lsig_txop_en:1;
+ u32 pifs:1;
+ u32 rate_id:5;
+ u32 en_desc_id:1;
+ u32 sectype:2;
+ u32 pkt_offset:5; // unit: 8 bytes
+ u32 moredata:1;
+ u32 txop_ps_cap:1;
+ u32 txop_ps_mode:1;
+
+ // Offset 8
+ u32 p_aid:9;
+ u32 rsvd0809:1;
+ u32 cca_rts:2;
+ u32 agg_en:1;
+ u32 rdg_en:1;
+ u32 null_0:1;
+ u32 null_1:1;
+ u32 bk:1;
+ u32 morefrag:1;
+ u32 raw:1;
+ u32 spe_rpt:1;
+ u32 ampdu_density:3;
+ u32 bt_null:1;
+ u32 g_id:6;
+ u32 rsvd0830:2;
+
+ // Offset 12
+ u32 wheader_len:4;
+ u32 chk_en:1;
+ u32 early_rate:1;
+ u32 hw_ssn_sel:2;
+ u32 userate:1;
+ u32 disrtsfb:1;
+ u32 disdatafb:1;
+ u32 cts2self:1;
+ u32 rtsen:1;
+ u32 hw_rts_en:1;
+ u32 port_id:1;
+ u32 navusehdr:1;
+ u32 use_max_len:1;
+ u32 max_agg_num:5;
+ u32 ndpa:2;
+ u32 ampdu_max_time:8;
+
+ // Offset 16
+ u32 datarate:7;
+ u32 try_rate:1;
+ u32 data_ratefb_lmt:5;
+ u32 rts_ratefb_lmt:4;
+ u32 rty_lmt_en:1;
+ u32 data_rt_lmt:6;
+ u32 rtsrate:5;
+ u32 pcts_en:1;
+ u32 pcts_mask_idx:2;
+
+ // Offset 20
+ u32 data_sc:4;
+ u32 data_short:1;
+ u32 data_bw:2;
+ u32 data_ldpc:1;
+ u32 data_stbc:2;
+ u32 vcs_stbc:2;
+ u32 rts_short:1;
+ u32 rts_sc:4;
+ u32 rsvd2016:7;
+ u32 tx_ant:4;
+ u32 txpwr_offset:3;
+ u32 rsvd2031:1;
+
+ // Offset 24
+ u32 sw_define:12;
+ u32 mbssid:4;
+ u32 antsel_A:3;
+ u32 antsel_B:3;
+ u32 antsel_C:3;
+ u32 antsel_D:3;
+ u32 rsvd2428:4;
+
+ // Offset 28
+ u32 checksum:16;
+ u32 rsvd2816:8;
+ u32 usb_txagg_num:8;
+
+ // Offset 32
+ u32 rts_rc:6;
+ u32 bar_rty_th:2;
+ u32 data_rc:6;
+ u32 rsvd3214:1;
+ u32 en_hwseq:1;
+ u32 nextneadpage:8;
+ u32 tailpage:8;
+
+ // Offset 36
+ u32 padding_len:11;
+ u32 txbf_path:1;
+ u32 seq:12;
+ u32 final_data_rate:8;
+}TXDESC_8723B, *PTXDESC_8723B;
+
+#ifndef __INC_HAL8723BDESC_H
+#define __INC_HAL8723BDESC_H
+
+#define RX_STATUS_DESC_SIZE_8723B 24
+#define RX_DRV_INFO_SIZE_UNIT_8723B 8
+
+
+//DWORD 0
+#define SET_RX_STATUS_DESC_PKT_LEN_8723B(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 0, 14, __Value)
+#define SET_RX_STATUS_DESC_EOR_8723B(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 30, 1, __Value)
+#define SET_RX_STATUS_DESC_OWN_8723B(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 31, 1, __Value)
+
+#define GET_RX_STATUS_DESC_PKT_LEN_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 14)
+#define GET_RX_STATUS_DESC_CRC32_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 14, 1)
+#define GET_RX_STATUS_DESC_ICV_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 15, 1)
+#define GET_RX_STATUS_DESC_DRVINFO_SIZE_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 4)
+#define GET_RX_STATUS_DESC_SECURITY_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 20, 3)
+#define GET_RX_STATUS_DESC_QOS_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 23, 1)
+#define GET_RX_STATUS_DESC_SHIFT_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 24, 2)
+#define GET_RX_STATUS_DESC_PHY_STATUS_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 26, 1)
+#define GET_RX_STATUS_DESC_SWDEC_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 27, 1)
+#define GET_RX_STATUS_DESC_LAST_SEG_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 28, 1)
+#define GET_RX_STATUS_DESC_FIRST_SEG_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 29, 1)
+#define GET_RX_STATUS_DESC_EOR_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 30, 1)
+#define GET_RX_STATUS_DESC_OWN_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 31, 1)
+
+//DWORD 1
+#define GET_RX_STATUS_DESC_MACID_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 0, 7)
+#define GET_RX_STATUS_DESC_TID_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 8, 4)
+#define GET_RX_STATUS_DESC_AMSDU_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 13, 1)
+#define GET_RX_STATUS_DESC_RXID_MATCH_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 14, 1)
+#define GET_RX_STATUS_DESC_PAGGR_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 15, 1)
+#define GET_RX_STATUS_DESC_A1_FIT_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 16, 4)
+#define GET_RX_STATUS_DESC_CHKERR_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 20, 1)
+#define GET_RX_STATUS_DESC_IPVER_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 21, 1)
+#define GET_RX_STATUS_DESC_IS_TCPUDP__8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 22, 1)
+#define GET_RX_STATUS_DESC_CHK_VLD_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 23, 1)
+#define GET_RX_STATUS_DESC_PAM_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 24, 1)
+#define GET_RX_STATUS_DESC_PWR_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 25, 1)
+#define GET_RX_STATUS_DESC_MORE_DATA_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 26, 1)
+#define GET_RX_STATUS_DESC_MORE_FRAG_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 27, 1)
+#define GET_RX_STATUS_DESC_TYPE_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 28, 2)
+#define GET_RX_STATUS_DESC_MC_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 30, 1)
+#define GET_RX_STATUS_DESC_BC_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 31, 1)
+
+//DWORD 2
+#define GET_RX_STATUS_DESC_SEQ_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 0, 12)
+#define GET_RX_STATUS_DESC_FRAG_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 12, 4)
+#define GET_RX_STATUS_DESC_RX_IS_QOS_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 16, 1)
+#define GET_RX_STATUS_DESC_WLANHD_IV_LEN_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 18, 6)
+#define GET_RX_STATUS_DESC_RPT_SEL_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 28, 1)
+
+//DWORD 3
+#define GET_RX_STATUS_DESC_RX_RATE_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 0, 7)
+#define GET_RX_STATUS_DESC_HTC_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 10, 1)
+#define GET_RX_STATUS_DESC_EOSP_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 11, 1)
+#define GET_RX_STATUS_DESC_BSSID_FIT_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 12, 2)
+#ifdef CONFIG_USB_RX_AGGREGATION
+#define GET_RX_STATUS_DESC_USB_AGG_PKTNUM_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 16, 8)
+#endif
+#define GET_RX_STATUS_DESC_PATTERN_MATCH_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 29, 1)
+#define GET_RX_STATUS_DESC_UNICAST_MATCH_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 30, 1)
+#define GET_RX_STATUS_DESC_MAGIC_MATCH_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 31, 1)
+
+//DWORD 6
+#define GET_RX_STATUS_DESC_SPLCP_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 0, 1)
+#define GET_RX_STATUS_DESC_LDPC_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 1, 1)
+#define GET_RX_STATUS_DESC_STBC_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 2, 1)
+#define GET_RX_STATUS_DESC_BW_8723B(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 4, 2)
+
+//DWORD 5
+#define GET_RX_STATUS_DESC_TSFL_8723B(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
+
+#define GET_RX_STATUS_DESC_BUFF_ADDR_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+24, 0, 32)
+#define GET_RX_STATUS_DESC_BUFF_ADDR64_8723B(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+28, 0, 32)
+
+#define SET_RX_STATUS_DESC_BUFF_ADDR_8723B(__pRxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxDesc+24, 0, 32, __Value)
+
+
+// Dword 0
+#define GET_TX_DESC_OWN_8723B(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc, 31, 1)
+
+#define SET_TX_DESC_PKT_SIZE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 0, 16, __Value)
+#define SET_TX_DESC_OFFSET_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 16, 8, __Value)
+#define SET_TX_DESC_BMC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 24, 1, __Value)
+#define SET_TX_DESC_HTC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 25, 1, __Value)
+#define SET_TX_DESC_LAST_SEG_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 26, 1, __Value)
+#define SET_TX_DESC_FIRST_SEG_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 27, 1, __Value)
+#define SET_TX_DESC_LINIP_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 28, 1, __Value)
+#define SET_TX_DESC_NO_ACM_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 29, 1, __Value)
+#define SET_TX_DESC_GF_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 30, 1, __Value)
+#define SET_TX_DESC_OWN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 31, 1, __Value)
+
+// Dword 1
+#define SET_TX_DESC_MACID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 0, 7, __Value)
+#define SET_TX_DESC_QUEUE_SEL_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 8, 5, __Value)
+#define SET_TX_DESC_RDG_NAV_EXT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 13, 1, __Value)
+#define SET_TX_DESC_LSIG_TXOP_EN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 14, 1, __Value)
+#define SET_TX_DESC_PIFS_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 15, 1, __Value)
+#define SET_TX_DESC_RATE_ID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 16, 5, __Value)
+#define SET_TX_DESC_EN_DESC_ID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 21, 1, __Value)
+#define SET_TX_DESC_SEC_TYPE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 22, 2, __Value)
+#define SET_TX_DESC_PKT_OFFSET_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 24, 5, __Value)
+
+
+// Dword 2
+#define SET_TX_DESC_PAID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 0, 9, __Value)
+#define SET_TX_DESC_CCA_RTS_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 10, 2, __Value)
+#define SET_TX_DESC_AGG_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 12, 1, __Value)
+#define SET_TX_DESC_RDG_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 13, 1, __Value)
+#define SET_TX_DESC_AGG_BREAK_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 16, 1, __Value)
+#define SET_TX_DESC_MORE_FRAG_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 17, 1, __Value)
+#define SET_TX_DESC_RAW_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 18, 1, __Value)
+#define SET_TX_DESC_SPE_RPT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 19, 1, __Value)
+#define SET_TX_DESC_AMPDU_DENSITY_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 20, 3, __Value)
+#define SET_TX_DESC_BT_INT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 23, 1, __Value)
+#define SET_TX_DESC_GID_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 6, __Value)
+
+
+// Dword 3
+#define SET_TX_DESC_WHEADER_LEN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 0, 4, __Value)
+#define SET_TX_DESC_CHK_EN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 4, 1, __Value)
+#define SET_TX_DESC_EARLY_MODE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 5, 1, __Value)
+#define SET_TX_DESC_HWSEQ_SEL_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 6, 2, __Value)
+#define SET_TX_DESC_USE_RATE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 8, 1, __Value)
+#define SET_TX_DESC_DISABLE_RTS_FB_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 9, 1, __Value)
+#define SET_TX_DESC_DISABLE_FB_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 10, 1, __Value)
+#define SET_TX_DESC_CTS2SELF_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 11, 1, __Value)
+#define SET_TX_DESC_RTS_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 12, 1, __Value)
+#define SET_TX_DESC_HW_RTS_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 13, 1, __Value)
+#define SET_TX_DESC_NAV_USE_HDR_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 15, 1, __Value)
+#define SET_TX_DESC_USE_MAX_LEN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 16, 1, __Value)
+#define SET_TX_DESC_MAX_AGG_NUM_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 17, 5, __Value)
+#define SET_TX_DESC_NDPA_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 22, 2, __Value)
+#define SET_TX_DESC_AMPDU_MAX_TIME_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 24, 8, __Value)
+
+// Dword 4
+#define SET_TX_DESC_TX_RATE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 0, 7, __Value)
+#define SET_TX_DESC_DATA_RATE_FB_LIMIT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 8, 5, __Value)
+#define SET_TX_DESC_RTS_RATE_FB_LIMIT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 13, 4, __Value)
+#define SET_TX_DESC_RETRY_LIMIT_ENABLE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 17, 1, __Value)
+#define SET_TX_DESC_DATA_RETRY_LIMIT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 18, 6, __Value)
+#define SET_TX_DESC_RTS_RATE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 24, 5, __Value)
+
+
+// Dword 5
+#define SET_TX_DESC_DATA_SC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 0, 4, __Value)
+#define SET_TX_DESC_DATA_SHORT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 4, 1, __Value)
+#define SET_TX_DESC_DATA_BW_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 5, 2, __Value)
+#define SET_TX_DESC_DATA_LDPC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 7, 1, __Value)
+#define SET_TX_DESC_DATA_STBC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 8, 2, __Value)
+#define SET_TX_DESC_CTROL_STBC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 10, 2, __Value)
+#define SET_TX_DESC_RTS_SHORT_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 12, 1, __Value)
+#define SET_TX_DESC_RTS_SC_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 13, 4, __Value)
+
+
+// Dword 6
+#define SET_TX_DESC_SW_DEFINE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 0, 12, __Value)
+#define SET_TX_DESC_ANTSEL_A_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 16, 3, __Value)
+#define SET_TX_DESC_ANTSEL_B_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 19, 3, __Value)
+#define SET_TX_DESC_ANTSEL_C_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 22, 3, __Value)
+#define SET_TX_DESC_ANTSEL_D_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 25, 3, __Value)
+
+// Dword 7
+#if(DEV_BUS_TYPE == RT_PCI_INTERFACE)
+#define SET_TX_DESC_TX_BUFFER_SIZE_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
+#else
+#define SET_TX_DESC_TX_DESC_CHECKSUM_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
+#endif
+#define SET_TX_DESC_USB_TXAGG_NUM_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 24, 8, __Value)
+#if(DEV_BUS_TYPE == RT_SDIO_INTERFACE)
+#define SET_TX_DESC_SDIO_TXSEQ_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 16, 8, __Value)
+#endif
+
+// Dword 8
+#define SET_TX_DESC_HWSEQ_EN_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 15, 1, __Value)
+
+// Dword 9
+#define SET_TX_DESC_SEQ_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 12, 12, __Value)
+
+// Dword 10
+#define SET_TX_DESC_TX_BUFFER_ADDRESS_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+40, 0, 32, __Value)
+#define GET_TX_DESC_TX_BUFFER_ADDRESS_8723B(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc+40, 0, 32)
+
+// Dword 11
+#define SET_TX_DESC_NEXT_DESC_ADDRESS_8723B(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+48, 0, 32, __Value)
+
+
+#define SET_EARLYMODE_PKTNUM_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 4, __Value)
+#define SET_EARLYMODE_LEN0_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 15, __Value)
+#define SET_EARLYMODE_LEN1_1_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 19, 13, __Value)
+#define SET_EARLYMODE_LEN1_2_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 2, __Value)
+#define SET_EARLYMODE_LEN2_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 2, 15, __Value)
+#define SET_EARLYMODE_LEN3_8723B(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 17, 15, __Value)
+
+#endif
+//-----------------------------------------------------------
+//
+// Rate
+//
+//-----------------------------------------------------------
+// CCK Rates, TxHT = 0
+#define DESC8723B_RATE1M 0x00
+#define DESC8723B_RATE2M 0x01
+#define DESC8723B_RATE5_5M 0x02
+#define DESC8723B_RATE11M 0x03
+
+// OFDM Rates, TxHT = 0
+#define DESC8723B_RATE6M 0x04
+#define DESC8723B_RATE9M 0x05
+#define DESC8723B_RATE12M 0x06
+#define DESC8723B_RATE18M 0x07
+#define DESC8723B_RATE24M 0x08
+#define DESC8723B_RATE36M 0x09
+#define DESC8723B_RATE48M 0x0a
+#define DESC8723B_RATE54M 0x0b
+
+// MCS Rates, TxHT = 1
+#define DESC8723B_RATEMCS0 0x0c
+#define DESC8723B_RATEMCS1 0x0d
+#define DESC8723B_RATEMCS2 0x0e
+#define DESC8723B_RATEMCS3 0x0f
+#define DESC8723B_RATEMCS4 0x10
+#define DESC8723B_RATEMCS5 0x11
+#define DESC8723B_RATEMCS6 0x12
+#define DESC8723B_RATEMCS7 0x13
+#define DESC8723B_RATEMCS8 0x14
+#define DESC8723B_RATEMCS9 0x15
+#define DESC8723B_RATEMCS10 0x16
+#define DESC8723B_RATEMCS11 0x17
+#define DESC8723B_RATEMCS12 0x18
+#define DESC8723B_RATEMCS13 0x19
+#define DESC8723B_RATEMCS14 0x1a
+#define DESC8723B_RATEMCS15 0x1b
+#define DESC8723B_RATEVHTSS1MCS0 0x2c
+#define DESC8723B_RATEVHTSS1MCS1 0x2d
+#define DESC8723B_RATEVHTSS1MCS2 0x2e
+#define DESC8723B_RATEVHTSS1MCS3 0x2f
+#define DESC8723B_RATEVHTSS1MCS4 0x30
+#define DESC8723B_RATEVHTSS1MCS5 0x31
+#define DESC8723B_RATEVHTSS1MCS6 0x32
+#define DESC8723B_RATEVHTSS1MCS7 0x33
+#define DESC8723B_RATEVHTSS1MCS8 0x34
+#define DESC8723B_RATEVHTSS1MCS9 0x35
+#define DESC8723B_RATEVHTSS2MCS0 0x36
+#define DESC8723B_RATEVHTSS2MCS1 0x37
+#define DESC8723B_RATEVHTSS2MCS2 0x38
+#define DESC8723B_RATEVHTSS2MCS3 0x39
+#define DESC8723B_RATEVHTSS2MCS4 0x3a
+#define DESC8723B_RATEVHTSS2MCS5 0x3b
+#define DESC8723B_RATEVHTSS2MCS6 0x3c
+#define DESC8723B_RATEVHTSS2MCS7 0x3d
+#define DESC8723B_RATEVHTSS2MCS8 0x3e
+#define DESC8723B_RATEVHTSS2MCS9 0x3f
+
+
+#define RX_HAL_IS_CCK_RATE_8723B(pDesc)\
+ (GET_RX_STATUS_DESC_RX_RATE_8723B(pDesc) == DESC8723B_RATE1M ||\
+ GET_RX_STATUS_DESC_RX_RATE_8723B(pDesc) == DESC8723B_RATE2M ||\
+ GET_RX_STATUS_DESC_RX_RATE_8723B(pDesc) == DESC8723B_RATE5_5M ||\
+ GET_RX_STATUS_DESC_RX_RATE_8723B(pDesc) == DESC8723B_RATE11M)
+
+
+void rtl8723b_update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem);
+void rtl8723b_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 rtl8723bs_init_xmit_priv(PADAPTER padapter);
+void rtl8723bs_free_xmit_priv(PADAPTER padapter);
+s32 rtl8723bs_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8723bs_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8723bs_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+s32 rtl8723bs_xmit_buf_handler(PADAPTER padapter);
+thread_return rtl8723bs_xmit_thread(thread_context context);
+#define hal_xmit_handler rtl8723bs_xmit_buf_handler
+#endif
+
+#ifdef CONFIG_USB_HCI
+s32 rtl8723bu_xmit_buf_handler(PADAPTER padapter);
+#define hal_xmit_handler rtl8723bu_xmit_buf_handler
+
+
+s32 rtl8723bu_init_xmit_priv(PADAPTER padapter);
+void rtl8723bu_free_xmit_priv(PADAPTER padapter);
+s32 rtl8723bu_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8723bu_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8723bu_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+//s32 rtl8812au_xmit_buf_handler(PADAPTER padapter);
+void rtl8723bu_xmit_tasklet(void *priv);
+s32 rtl8723bu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
+void _dbg_dump_tx_info(_adapter *padapter,int frame_tag,struct tx_desc *ptxdesc);
+#endif
+
+#ifdef CONFIG_PCI_HCI
+s32 rtl8723be_init_xmit_priv(PADAPTER padapter);
+void rtl8723be_free_xmit_priv(PADAPTER padapter);
+struct xmit_buf *rtl8723be_dequeue_xmitbuf(struct rtw_tx_ring *ring);
+void rtl8723be_xmitframe_resume(_adapter *padapter);
+s32 rtl8723be_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8723be_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8723be_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+void rtl8723be_xmit_tasklet(void *priv);
+#endif
+
+u8 BWMapping_8723B(PADAPTER Adapter, struct pkt_attrib *pattrib);
+u8 SCMapping_8723B(PADAPTER Adapter, struct pkt_attrib *pattrib);
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8812a_hal.h b/rtl8xxx_EU/include/rtl8812a_hal.h
index 79718ee..c2eeab7 100755
--- a/rtl8xxx_EU/include/rtl8812a_hal.h
+++ b/rtl8xxx_EU/include/rtl8812a_hal.h
@@ -1,347 +1,347 @@
-/******************************************************************************
- *
- * 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 __RTL8812A_HAL_H__
-#define __RTL8812A_HAL_H__
-
-//#include "hal_com.h"
-#if 1
-#include "hal_data.h"
-#else
-#include "../hal/OUTSRC/odm_precomp.h"
-#endif
-
-//include HAL Related header after HAL Related compiling flags
-#include "rtl8812a_spec.h"
-#include "rtl8812a_rf.h"
-#include "rtl8812a_dm.h"
-#include "rtl8812a_recv.h"
-#include "rtl8812a_xmit.h"
-#include "rtl8812a_cmd.h"
-#include "rtl8812a_led.h"
-#include "Hal8812PwrSeq.h"
-#include "Hal8821APwrSeq.h" //for 8821A/8811A
-#include "Hal8812PhyReg.h"
-#include "Hal8812PhyCfg.h"
-#ifdef DBG_CONFIG_ERROR_DETECT
-#include "rtl8812a_sreset.h"
-#endif
-
-
-//---------------------------------------------------------------------
-// RTL8812AU From header
-//---------------------------------------------------------------------
- #define RTL8812_FW_IMG "rtl8812a/FW_NIC.bin"
- #define RTL8812_FW_WW_IMG "rtl8812a/FW_WoWLAN.bin"
- #define RTL8812_PHY_REG "rtl8812a/PHY_REG.txt"
- #define RTL8812_PHY_RADIO_A "rtl8812a/RadioA.txt"
- #define RTL8812_PHY_RADIO_B "rtl8812a/RadioB.txt"
- #define RTL8812_TXPWR_TRACK "rtl8812a/TxPowerTrack.txt"
- #define RTL8812_AGC_TAB "rtl8812a/AGC_TAB.txt"
- #define RTL8812_PHY_MACREG "rtl8812a/MAC_REG.txt"
- #define RTL8812_PHY_REG_PG "rtl8812a/PHY_REG_PG.txt"
- #define RTL8812_PHY_REG_MP "rtl8812a/PHY_REG_MP.txt"
- #define RTL8812_TXPWR_LMT "rtl8812a/TXPWR_LMT.txt"
-
-//---------------------------------------------------------------------
-// RTL8821U From file
-//---------------------------------------------------------------------
- #define RTL8821_FW_IMG "rtl8821a/FW_NIC.bin"
- #define RTL8821_FW_WW_IMG "rtl8821a/FW_WoWLAN.bin"
- #define RTL8821_PHY_REG "rtl8821a/PHY_REG.txt"
- #define RTL8821_PHY_RADIO_A "rtl8821a/RadioA.txt"
- #define RTL8821_PHY_RADIO_B "rtl8821a/RadioB.txt"
- #define RTL8821_TXPWR_TRACK "rtl8821a/TxPowerTrack.txt"
- #define RTL8821_AGC_TAB "rtl8821a/AGC_TAB.txt"
- #define RTL8821_PHY_MACREG "rtl8821a/MAC_REG.txt"
- #define RTL8821_PHY_REG_PG "rtl8821a/PHY_REG_PG.txt"
- #define RTL8821_PHY_REG_MP "rtl8821a/PHY_REG_MP.txt"
- #define RTL8821_TXPWR_LMT "rtl8821a/TXPWR_LMT.txt"
-
-//---------------------------------------------------------------------
-// RTL8812 Power Configuration CMDs for PCIe interface
-//---------------------------------------------------------------------
-#define Rtl8812_NIC_PWR_ON_FLOW rtl8812_power_on_flow
-#define Rtl8812_NIC_RF_OFF_FLOW rtl8812_radio_off_flow
-#define Rtl8812_NIC_DISABLE_FLOW rtl8812_card_disable_flow
-#define Rtl8812_NIC_ENABLE_FLOW rtl8812_card_enable_flow
-#define Rtl8812_NIC_SUSPEND_FLOW rtl8812_suspend_flow
-#define Rtl8812_NIC_RESUME_FLOW rtl8812_resume_flow
-#define Rtl8812_NIC_PDN_FLOW rtl8812_hwpdn_flow
-#define Rtl8812_NIC_LPS_ENTER_FLOW rtl8812_enter_lps_flow
-#define Rtl8812_NIC_LPS_LEAVE_FLOW rtl8812_leave_lps_flow
-
-//---------------------------------------------------------------------
-// RTL8821 Power Configuration CMDs for PCIe interface
-//---------------------------------------------------------------------
-#define Rtl8821A_NIC_PWR_ON_FLOW rtl8821A_power_on_flow
-#define Rtl8821A_NIC_RF_OFF_FLOW rtl8821A_radio_off_flow
-#define Rtl8821A_NIC_DISABLE_FLOW rtl8821A_card_disable_flow
-#define Rtl8821A_NIC_ENABLE_FLOW rtl8821A_card_enable_flow
-#define Rtl8821A_NIC_SUSPEND_FLOW rtl8821A_suspend_flow
-#define Rtl8821A_NIC_RESUME_FLOW rtl8821A_resume_flow
-#define Rtl8821A_NIC_PDN_FLOW rtl8821A_hwpdn_flow
-#define Rtl8821A_NIC_LPS_ENTER_FLOW rtl8821A_enter_lps_flow
-#define Rtl8821A_NIC_LPS_LEAVE_FLOW rtl8821A_leave_lps_flow
-
-
-#if 1 // download firmware related data structure
-#define FW_SIZE_8812 0x8000 // Compatible with RTL8723 Maximal RAM code size 24K. modified to 32k, TO compatible with 92d maximal fw size 32k
-#define FW_START_ADDRESS 0x1000
-#define FW_END_ADDRESS 0x5FFF
-
-
-
-typedef struct _RT_FIRMWARE_8812 {
- FIRMWARE_SOURCE eFWSource;
-#ifdef CONFIG_EMBEDDED_FWIMG
- u8* szFwBuffer;
-#else
- u8 szFwBuffer[FW_SIZE_8812];
-#endif
- u32 ulFwLength;
-} RT_FIRMWARE_8812, *PRT_FIRMWARE_8812;
-
-//
-// This structure must be cared byte-ordering
-//
-// Added by tynli. 2009.12.04.
-#define IS_FW_HEADER_EXIST_8812(_pFwHdr) ((GET_FIRMWARE_HDR_SIGNATURE_8812(_pFwHdr) &0xFFF0) == 0x9500)
-
-#define IS_FW_HEADER_EXIST_8821(_pFwHdr) ((GET_FIRMWARE_HDR_SIGNATURE_8812(_pFwHdr) &0xFFF0) == 0x2100)
-//=====================================================
-// Firmware Header(8-byte alinment required)
-//=====================================================
-//--- LONG WORD 0 ----
-#define GET_FIRMWARE_HDR_SIGNATURE_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 0, 16) // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
-#define GET_FIRMWARE_HDR_CATEGORY_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 16, 8) // AP/NIC and USB/PCI
-#define GET_FIRMWARE_HDR_FUNCTION_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 24, 8) // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
-#define GET_FIRMWARE_HDR_VERSION_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 0, 16)// FW Version
-#define GET_FIRMWARE_HDR_SUB_VER_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 16, 8) // FW Subversion, default 0x00
-#define GET_FIRMWARE_HDR_RSVD1_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 24, 8)
-
-//--- LONG WORD 1 ----
-#define GET_FIRMWARE_HDR_MONTH_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 0, 8) // Release time Month field
-#define GET_FIRMWARE_HDR_DATE_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 8, 8) // Release time Date field
-#define GET_FIRMWARE_HDR_HOUR_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 16, 8)// Release time Hour field
-#define GET_FIRMWARE_HDR_MINUTE_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 24, 8)// Release time Minute field
-#define GET_FIRMWARE_HDR_ROMCODE_SIZE_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+12, 0, 16)// The size of RAM code
-#define GET_FIRMWARE_HDR_RSVD2_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+12, 16, 16)
-
-//--- LONG WORD 2 ----
-#define GET_FIRMWARE_HDR_SVN_IDX_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+16, 0, 32)// The SVN entry index
-#define GET_FIRMWARE_HDR_RSVD3_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+20, 0, 32)
-
-//--- LONG WORD 3 ----
-#define GET_FIRMWARE_HDR_RSVD4_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+24, 0, 32)
-#define GET_FIRMWARE_HDR_RSVD5_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+28, 0, 32)
-
-#endif // download firmware related data structure
-
-
-#define DRIVER_EARLY_INT_TIME_8812 0x05
-#define BCN_DMA_ATIME_INT_TIME_8812 0x02
-
-//for 8812
-// TX 128K, RX 16K, Page size 512B for TX, 128B for RX
-#define MAX_RX_DMA_BUFFER_SIZE_8812 0x3E80 //0x3FFF // RX 16K
-
-#define BCNQ_PAGE_NUM_8812 0x07
-
-//For WoWLan , more reserved page
-//ARP Rsp:1, RWC:1, GTK Info:1,GTK RSP:1,GTK EXT MEM:1, PNO: 6
-#ifdef CONFIG_WOWLAN
-#define WOWLAN_PAGE_NUM_8812 0x05
-#else
-#define WOWLAN_PAGE_NUM_8812 0x00
-#endif
-
-#define TX_TOTAL_PAGE_NUMBER_8812 (0xFF - BCNQ_PAGE_NUM_8812 - WOWLAN_PAGE_NUM_8812)
-#define TX_PAGE_BOUNDARY_8812 (TX_TOTAL_PAGE_NUMBER_8812 + 1)
-
-#define TX_PAGE_BOUNDARY_WOWLAN_8812 0xE0
-
-#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8812 TX_PAGE_BOUNDARY_8812
-#define WMM_NORMAL_TX_PAGE_BOUNDARY_8812 (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8812 + 1)
-
-// For Normal Chip Setting
-// (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER_8812
-#define NORMAL_PAGE_NUM_LPQ_8812 0x10
-#define NORMAL_PAGE_NUM_HPQ_8812 0x10
-#define NORMAL_PAGE_NUM_NPQ_8812 0x00
-
-#define WMM_NORMAL_PAGE_NUM_HPQ_8812 0x30
-#define WMM_NORMAL_PAGE_NUM_LPQ_8812 0x20
-#define WMM_NORMAL_PAGE_NUM_NPQ_8812 0x20
-
-
-// for 8821A
-// TX 64K, RX 16K, Page size 256B for TX, 128B for RX
-#define PAGE_SIZE_TX_8821A 256
-#define PAGE_SIZE_RX_8821A 128
-
-#define MAX_RX_DMA_BUFFER_SIZE_8821 0x3E80 // RX 16K
-
-#define BCNQ_PAGE_NUM_8821 0x08
-#ifdef CONFIG_CONCURRENT_MODE
-#define BCNQ1_PAGE_NUM_8821 0x04
-#else
-#define BCNQ1_PAGE_NUM_8821 0x00
-#endif
-
-//For WoWLan , more reserved page
-//ARP Rsp:1, RWC:1, GTK Info:1,GTK RSP:1,GTK EXT MEM:1, PNO: 6
-#ifdef CONFIG_WOWLAN
-#define WOWLAN_PAGE_NUM_8821 0x06
-#else
-#define WOWLAN_PAGE_NUM_8821 0x00
-#endif
-
-#define TX_TOTAL_PAGE_NUMBER_8821 (0xFF - BCNQ_PAGE_NUM_8821 - BCNQ1_PAGE_NUM_8821 - WOWLAN_PAGE_NUM_8821)
-#define TX_PAGE_BOUNDARY_8821 (TX_TOTAL_PAGE_NUMBER_8821 + 1)
-//#define TX_PAGE_BOUNDARY_WOWLAN_8821 0xE0
-
-#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8821 TX_TOTAL_PAGE_NUMBER_8821
-#define WMM_NORMAL_TX_PAGE_BOUNDARY_8821 (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8821 + 1)
-
-
-// (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER
-#define NORMAL_PAGE_NUM_LPQ_8821 0x08//0x10
-#define NORMAL_PAGE_NUM_HPQ_8821 0x08//0x10
-#define NORMAL_PAGE_NUM_NPQ_8821 0x00
-
-#define WMM_NORMAL_PAGE_NUM_HPQ_8821 0x30
-#define WMM_NORMAL_PAGE_NUM_LPQ_8821 0x20
-#define WMM_NORMAL_PAGE_NUM_NPQ_8821 0x20
-
-
-#define EFUSE_HIDDEN_812AU 0
-#define EFUSE_HIDDEN_812AU_VS 1
-#define EFUSE_HIDDEN_812AU_VL 2
-#define EFUSE_HIDDEN_812AU_VN 3
-
-#ifdef CONFIG_PCI_HCI
-#define EFUSE_REAL_CONTENT_LEN_JAGUAR 1024
-#define HWSET_MAX_SIZE_JAGUAR 1024
-#else
-#define EFUSE_REAL_CONTENT_LEN_JAGUAR 512
-#define HWSET_MAX_SIZE_JAGUAR 512
-#endif
-
-#define EFUSE_MAX_BANK_8812A 2
-#define EFUSE_MAP_LEN_JAGUAR 512
-#define EFUSE_MAX_SECTION_JAGUAR 64
-#define EFUSE_MAX_WORD_UNIT_JAGUAR 4
-#define EFUSE_IC_ID_OFFSET_JAGUAR 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
-#define AVAILABLE_EFUSE_ADDR_8812(addr) (addr < EFUSE_REAL_CONTENT_LEN_JAGUAR)
-// <Roger_Notes> To prevent out of boundary programming case, leave 1byte and program full section
-// 9bytes + 1byt + 5bytes and pre 1byte.
-// For worst case:
-// | 2byte|----8bytes----|1byte|--7bytes--| //92D
-#define EFUSE_OOB_PROTECT_BYTES_JAGUAR 18 // PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte.
-#define EFUSE_PROTECT_BYTES_BANK_JAGUAR 16
-// Added for different registry settings to adjust TxPwr index. added by Roger, 2010.03.09.
-typedef enum _TX_PWR_PERCENTAGE{
- TX_PWR_PERCENTAGE_0 = 0x01, // 12.5%
- TX_PWR_PERCENTAGE_1 = 0x02, // 25%
- TX_PWR_PERCENTAGE_2 = 0x04, // 50%
- TX_PWR_PERCENTAGE_3 = 0x08, //100%, default target output power.
-} TX_PWR_PERCENTAGE;
-
-#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
-#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
-
-//#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE)
-
-//#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);
-void InitializeFirmwareVars8812(PADAPTER padapter);
-
-s32 _LLTWrite_8812A(PADAPTER Adapter, u32 address, u32 data);
-s32 InitLLTTable8812A(PADAPTER padapter, u8 txpktbuf_bndy);
-void InitRDGSetting8812A(PADAPTER padapter);
-
-void CheckAutoloadState8812A(PADAPTER padapter);
-
-// EFuse
-u8 GetEEPROMSize8812A(PADAPTER padapter);
-void InitPGData8812A(PADAPTER padapter);
-void Hal_EfuseParseIDCode8812A(PADAPTER padapter, u8 *hwinfo);
-void Hal_ReadPROMVersion8812A(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_ReadTxPowerInfo8812A(PADAPTER padapter, u8* hwinfo,BOOLEAN AutoLoadFail);
-void Hal_ReadBoardType8812A(PADAPTER pAdapter, u8* hwinfo,BOOLEAN AutoLoadFail);
-void Hal_ReadThermalMeter_8812A(PADAPTER Adapter, u8* PROMContent,BOOLEAN AutoloadFail);
-void Hal_ReadChannelPlan8812A(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
-void Hal_EfuseParseXtal_8812A(PADAPTER pAdapter, u8* hwinfo,BOOLEAN AutoLoadFail);
-void Hal_ReadAntennaDiversity8812A(PADAPTER pAdapter,u8* PROMContent,BOOLEAN AutoLoadFail);
-void Hal_ReadAntennaDiversity8821A(PADAPTER pAdapter, u8* PROMContent, BOOLEAN AutoLoadFail);
-void Hal_ReadAmplifierType_8812A(PADAPTER Adapter,u8* PROMContent, BOOLEAN AutoloadFail);
-void Hal_ReadPAType_8821A(PADAPTER Adapter,u8* PROMContent, BOOLEAN AutoloadFail);
-void Hal_ReadRFEType_8812A(PADAPTER Adapter,u8* PROMContent, BOOLEAN AutoloadFail);
-void Hal_EfuseParseBTCoexistInfo8812A(PADAPTER Adapter, u8* hwinfo, BOOLEAN AutoLoadFail);
-void hal_ReadUsbType_8812AU(PADAPTER Adapter, u8 *PROMContent, BOOLEAN AutoloadFail);
-int FirmwareDownloadBT(PADAPTER Adapter, PRT_MP_FIRMWARE pFirmware);
-void Hal_ReadRemoteWakeup_8812A(PADAPTER padapter, u8* hwinfo, BOOLEAN AutoLoadFail);
-
-BOOLEAN HalDetectPwrDownMode8812(PADAPTER Adapter);
-
-#ifdef CONFIG_WOWLAN
-void Hal_DetectWoWMode(PADAPTER pAdapter);
-#endif //CONFIG_WOWLAN
-
-void _InitBeaconParameters_8812A(PADAPTER padapter);
-void SetBeaconRelatedRegisters8812A(PADAPTER padapter);
-
-void ReadRFType8812A(PADAPTER padapter);
-void InitDefaultValue8821A(PADAPTER padapter);
-
-void SetHwReg8812A(PADAPTER padapter, u8 variable, u8 *pval);
-void GetHwReg8812A(PADAPTER padapter, u8 variable, u8 *pval);
-u8 SetHalDefVar8812A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval);
-u8 GetHalDefVar8812A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval);
-s32 c2h_id_filter_ccx_8812a(u8 *buf);
-void rtl8812_set_hal_ops(struct hal_ops *pHalFunc);
-
-// register
-void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits);
-
-void rtl8812_start_thread(PADAPTER padapter);
-void rtl8812_stop_thread(PADAPTER padapter);
-
-#ifdef CONFIG_PCI_HCI
-BOOLEAN InterruptRecognized8812AE(PADAPTER Adapter);
-VOID UpdateInterruptMask8812AE(PADAPTER Adapter, u32 AddMSR, u32 AddMSR1, u32 RemoveMSR, u32 RemoveMSR1);
-#endif
-
-#endif //__RTL8188E_HAL_H__
-
+/******************************************************************************
+ *
+ * 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 __RTL8812A_HAL_H__
+#define __RTL8812A_HAL_H__
+
+//#include "hal_com.h"
+#if 1
+#include "hal_data.h"
+#else
+#include "../hal/OUTSRC/odm_precomp.h"
+#endif
+
+//include HAL Related header after HAL Related compiling flags
+#include "rtl8812a_spec.h"
+#include "rtl8812a_rf.h"
+#include "rtl8812a_dm.h"
+#include "rtl8812a_recv.h"
+#include "rtl8812a_xmit.h"
+#include "rtl8812a_cmd.h"
+#include "rtl8812a_led.h"
+#include "Hal8812PwrSeq.h"
+#include "Hal8821APwrSeq.h" //for 8821A/8811A
+#include "Hal8812PhyReg.h"
+#include "Hal8812PhyCfg.h"
+#ifdef DBG_CONFIG_ERROR_DETECT
+#include "rtl8812a_sreset.h"
+#endif
+
+
+//---------------------------------------------------------------------
+// RTL8812AU From header
+//---------------------------------------------------------------------
+ #define RTL8812_FW_IMG "rtl8812a/FW_NIC.bin"
+ #define RTL8812_FW_WW_IMG "rtl8812a/FW_WoWLAN.bin"
+ #define RTL8812_PHY_REG "rtl8812a/PHY_REG.txt"
+ #define RTL8812_PHY_RADIO_A "rtl8812a/RadioA.txt"
+ #define RTL8812_PHY_RADIO_B "rtl8812a/RadioB.txt"
+ #define RTL8812_TXPWR_TRACK "rtl8812a/TxPowerTrack.txt"
+ #define RTL8812_AGC_TAB "rtl8812a/AGC_TAB.txt"
+ #define RTL8812_PHY_MACREG "rtl8812a/MAC_REG.txt"
+ #define RTL8812_PHY_REG_PG "rtl8812a/PHY_REG_PG.txt"
+ #define RTL8812_PHY_REG_MP "rtl8812a/PHY_REG_MP.txt"
+ #define RTL8812_TXPWR_LMT "rtl8812a/TXPWR_LMT.txt"
+
+//---------------------------------------------------------------------
+// RTL8821U From file
+//---------------------------------------------------------------------
+ #define RTL8821_FW_IMG "rtl8821a/FW_NIC.bin"
+ #define RTL8821_FW_WW_IMG "rtl8821a/FW_WoWLAN.bin"
+ #define RTL8821_PHY_REG "rtl8821a/PHY_REG.txt"
+ #define RTL8821_PHY_RADIO_A "rtl8821a/RadioA.txt"
+ #define RTL8821_PHY_RADIO_B "rtl8821a/RadioB.txt"
+ #define RTL8821_TXPWR_TRACK "rtl8821a/TxPowerTrack.txt"
+ #define RTL8821_AGC_TAB "rtl8821a/AGC_TAB.txt"
+ #define RTL8821_PHY_MACREG "rtl8821a/MAC_REG.txt"
+ #define RTL8821_PHY_REG_PG "rtl8821a/PHY_REG_PG.txt"
+ #define RTL8821_PHY_REG_MP "rtl8821a/PHY_REG_MP.txt"
+ #define RTL8821_TXPWR_LMT "rtl8821a/TXPWR_LMT.txt"
+
+//---------------------------------------------------------------------
+// RTL8812 Power Configuration CMDs for PCIe interface
+//---------------------------------------------------------------------
+#define Rtl8812_NIC_PWR_ON_FLOW rtl8812_power_on_flow
+#define Rtl8812_NIC_RF_OFF_FLOW rtl8812_radio_off_flow
+#define Rtl8812_NIC_DISABLE_FLOW rtl8812_card_disable_flow
+#define Rtl8812_NIC_ENABLE_FLOW rtl8812_card_enable_flow
+#define Rtl8812_NIC_SUSPEND_FLOW rtl8812_suspend_flow
+#define Rtl8812_NIC_RESUME_FLOW rtl8812_resume_flow
+#define Rtl8812_NIC_PDN_FLOW rtl8812_hwpdn_flow
+#define Rtl8812_NIC_LPS_ENTER_FLOW rtl8812_enter_lps_flow
+#define Rtl8812_NIC_LPS_LEAVE_FLOW rtl8812_leave_lps_flow
+
+//---------------------------------------------------------------------
+// RTL8821 Power Configuration CMDs for PCIe interface
+//---------------------------------------------------------------------
+#define Rtl8821A_NIC_PWR_ON_FLOW rtl8821A_power_on_flow
+#define Rtl8821A_NIC_RF_OFF_FLOW rtl8821A_radio_off_flow
+#define Rtl8821A_NIC_DISABLE_FLOW rtl8821A_card_disable_flow
+#define Rtl8821A_NIC_ENABLE_FLOW rtl8821A_card_enable_flow
+#define Rtl8821A_NIC_SUSPEND_FLOW rtl8821A_suspend_flow
+#define Rtl8821A_NIC_RESUME_FLOW rtl8821A_resume_flow
+#define Rtl8821A_NIC_PDN_FLOW rtl8821A_hwpdn_flow
+#define Rtl8821A_NIC_LPS_ENTER_FLOW rtl8821A_enter_lps_flow
+#define Rtl8821A_NIC_LPS_LEAVE_FLOW rtl8821A_leave_lps_flow
+
+
+#if 1 // download firmware related data structure
+#define FW_SIZE_8812 0x8000 // Compatible with RTL8723 Maximal RAM code size 24K. modified to 32k, TO compatible with 92d maximal fw size 32k
+#define FW_START_ADDRESS 0x1000
+#define FW_END_ADDRESS 0x5FFF
+
+
+
+typedef struct _RT_FIRMWARE_8812 {
+ FIRMWARE_SOURCE eFWSource;
+#ifdef CONFIG_EMBEDDED_FWIMG
+ u8* szFwBuffer;
+#else
+ u8 szFwBuffer[FW_SIZE_8812];
+#endif
+ u32 ulFwLength;
+} RT_FIRMWARE_8812, *PRT_FIRMWARE_8812;
+
+//
+// This structure must be cared byte-ordering
+//
+// Added by tynli. 2009.12.04.
+#define IS_FW_HEADER_EXIST_8812(_pFwHdr) ((GET_FIRMWARE_HDR_SIGNATURE_8812(_pFwHdr) &0xFFF0) == 0x9500)
+
+#define IS_FW_HEADER_EXIST_8821(_pFwHdr) ((GET_FIRMWARE_HDR_SIGNATURE_8812(_pFwHdr) &0xFFF0) == 0x2100)
+//=====================================================
+// Firmware Header(8-byte alinment required)
+//=====================================================
+//--- LONG WORD 0 ----
+#define GET_FIRMWARE_HDR_SIGNATURE_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 0, 16) // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
+#define GET_FIRMWARE_HDR_CATEGORY_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 16, 8) // AP/NIC and USB/PCI
+#define GET_FIRMWARE_HDR_FUNCTION_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr, 24, 8) // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
+#define GET_FIRMWARE_HDR_VERSION_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 0, 16)// FW Version
+#define GET_FIRMWARE_HDR_SUB_VER_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 16, 8) // FW Subversion, default 0x00
+#define GET_FIRMWARE_HDR_RSVD1_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+4, 24, 8)
+
+//--- LONG WORD 1 ----
+#define GET_FIRMWARE_HDR_MONTH_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 0, 8) // Release time Month field
+#define GET_FIRMWARE_HDR_DATE_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 8, 8) // Release time Date field
+#define GET_FIRMWARE_HDR_HOUR_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 16, 8)// Release time Hour field
+#define GET_FIRMWARE_HDR_MINUTE_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+8, 24, 8)// Release time Minute field
+#define GET_FIRMWARE_HDR_ROMCODE_SIZE_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+12, 0, 16)// The size of RAM code
+#define GET_FIRMWARE_HDR_RSVD2_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+12, 16, 16)
+
+//--- LONG WORD 2 ----
+#define GET_FIRMWARE_HDR_SVN_IDX_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+16, 0, 32)// The SVN entry index
+#define GET_FIRMWARE_HDR_RSVD3_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+20, 0, 32)
+
+//--- LONG WORD 3 ----
+#define GET_FIRMWARE_HDR_RSVD4_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+24, 0, 32)
+#define GET_FIRMWARE_HDR_RSVD5_8812(__FwHdr) LE_BITS_TO_4BYTE(__FwHdr+28, 0, 32)
+
+#endif // download firmware related data structure
+
+
+#define DRIVER_EARLY_INT_TIME_8812 0x05
+#define BCN_DMA_ATIME_INT_TIME_8812 0x02
+
+//for 8812
+// TX 128K, RX 16K, Page size 512B for TX, 128B for RX
+#define MAX_RX_DMA_BUFFER_SIZE_8812 0x3E80 //0x3FFF // RX 16K
+
+#define BCNQ_PAGE_NUM_8812 0x07
+
+//For WoWLan , more reserved page
+//ARP Rsp:1, RWC:1, GTK Info:1,GTK RSP:1,GTK EXT MEM:1, PNO: 6
+#ifdef CONFIG_WOWLAN
+#define WOWLAN_PAGE_NUM_8812 0x05
+#else
+#define WOWLAN_PAGE_NUM_8812 0x00
+#endif
+
+#define TX_TOTAL_PAGE_NUMBER_8812 (0xFF - BCNQ_PAGE_NUM_8812 - WOWLAN_PAGE_NUM_8812)
+#define TX_PAGE_BOUNDARY_8812 (TX_TOTAL_PAGE_NUMBER_8812 + 1)
+
+#define TX_PAGE_BOUNDARY_WOWLAN_8812 0xE0
+
+#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8812 TX_PAGE_BOUNDARY_8812
+#define WMM_NORMAL_TX_PAGE_BOUNDARY_8812 (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8812 + 1)
+
+// For Normal Chip Setting
+// (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER_8812
+#define NORMAL_PAGE_NUM_LPQ_8812 0x10
+#define NORMAL_PAGE_NUM_HPQ_8812 0x10
+#define NORMAL_PAGE_NUM_NPQ_8812 0x00
+
+#define WMM_NORMAL_PAGE_NUM_HPQ_8812 0x30
+#define WMM_NORMAL_PAGE_NUM_LPQ_8812 0x20
+#define WMM_NORMAL_PAGE_NUM_NPQ_8812 0x20
+
+
+// for 8821A
+// TX 64K, RX 16K, Page size 256B for TX, 128B for RX
+#define PAGE_SIZE_TX_8821A 256
+#define PAGE_SIZE_RX_8821A 128
+
+#define MAX_RX_DMA_BUFFER_SIZE_8821 0x3E80 // RX 16K
+
+#define BCNQ_PAGE_NUM_8821 0x08
+#ifdef CONFIG_CONCURRENT_MODE
+#define BCNQ1_PAGE_NUM_8821 0x04
+#else
+#define BCNQ1_PAGE_NUM_8821 0x00
+#endif
+
+//For WoWLan , more reserved page
+//ARP Rsp:1, RWC:1, GTK Info:1,GTK RSP:1,GTK EXT MEM:1, PNO: 6
+#ifdef CONFIG_WOWLAN
+#define WOWLAN_PAGE_NUM_8821 0x06
+#else
+#define WOWLAN_PAGE_NUM_8821 0x00
+#endif
+
+#define TX_TOTAL_PAGE_NUMBER_8821 (0xFF - BCNQ_PAGE_NUM_8821 - BCNQ1_PAGE_NUM_8821 - WOWLAN_PAGE_NUM_8821)
+#define TX_PAGE_BOUNDARY_8821 (TX_TOTAL_PAGE_NUMBER_8821 + 1)
+//#define TX_PAGE_BOUNDARY_WOWLAN_8821 0xE0
+
+#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8821 TX_TOTAL_PAGE_NUMBER_8821
+#define WMM_NORMAL_TX_PAGE_BOUNDARY_8821 (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_8821 + 1)
+
+
+// (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER
+#define NORMAL_PAGE_NUM_LPQ_8821 0x08//0x10
+#define NORMAL_PAGE_NUM_HPQ_8821 0x08//0x10
+#define NORMAL_PAGE_NUM_NPQ_8821 0x00
+
+#define WMM_NORMAL_PAGE_NUM_HPQ_8821 0x30
+#define WMM_NORMAL_PAGE_NUM_LPQ_8821 0x20
+#define WMM_NORMAL_PAGE_NUM_NPQ_8821 0x20
+
+
+#define EFUSE_HIDDEN_812AU 0
+#define EFUSE_HIDDEN_812AU_VS 1
+#define EFUSE_HIDDEN_812AU_VL 2
+#define EFUSE_HIDDEN_812AU_VN 3
+
+#ifdef CONFIG_PCI_HCI
+#define EFUSE_REAL_CONTENT_LEN_JAGUAR 1024
+#define HWSET_MAX_SIZE_JAGUAR 1024
+#else
+#define EFUSE_REAL_CONTENT_LEN_JAGUAR 512
+#define HWSET_MAX_SIZE_JAGUAR 512
+#endif
+
+#define EFUSE_MAX_BANK_8812A 2
+#define EFUSE_MAP_LEN_JAGUAR 512
+#define EFUSE_MAX_SECTION_JAGUAR 64
+#define EFUSE_MAX_WORD_UNIT_JAGUAR 4
+#define EFUSE_IC_ID_OFFSET_JAGUAR 506 //For some inferiority IC purpose. added by Roger, 2009.09.02.
+#define AVAILABLE_EFUSE_ADDR_8812(addr) (addr < EFUSE_REAL_CONTENT_LEN_JAGUAR)
+// <Roger_Notes> To prevent out of boundary programming case, leave 1byte and program full section
+// 9bytes + 1byt + 5bytes and pre 1byte.
+// For worst case:
+// | 2byte|----8bytes----|1byte|--7bytes--| //92D
+#define EFUSE_OOB_PROTECT_BYTES_JAGUAR 18 // PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte.
+#define EFUSE_PROTECT_BYTES_BANK_JAGUAR 16
+// Added for different registry settings to adjust TxPwr index. added by Roger, 2010.03.09.
+typedef enum _TX_PWR_PERCENTAGE{
+ TX_PWR_PERCENTAGE_0 = 0x01, // 12.5%
+ TX_PWR_PERCENTAGE_1 = 0x02, // 25%
+ TX_PWR_PERCENTAGE_2 = 0x04, // 50%
+ TX_PWR_PERCENTAGE_3 = 0x08, //100%, default target output power.
+} TX_PWR_PERCENTAGE;
+
+#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
+#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
+
+//#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE)
+
+//#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);
+void InitializeFirmwareVars8812(PADAPTER padapter);
+
+s32 _LLTWrite_8812A(PADAPTER Adapter, u32 address, u32 data);
+s32 InitLLTTable8812A(PADAPTER padapter, u8 txpktbuf_bndy);
+void InitRDGSetting8812A(PADAPTER padapter);
+
+void CheckAutoloadState8812A(PADAPTER padapter);
+
+// EFuse
+u8 GetEEPROMSize8812A(PADAPTER padapter);
+void InitPGData8812A(PADAPTER padapter);
+void Hal_EfuseParseIDCode8812A(PADAPTER padapter, u8 *hwinfo);
+void Hal_ReadPROMVersion8812A(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_ReadTxPowerInfo8812A(PADAPTER padapter, u8* hwinfo,BOOLEAN AutoLoadFail);
+void Hal_ReadBoardType8812A(PADAPTER pAdapter, u8* hwinfo,BOOLEAN AutoLoadFail);
+void Hal_ReadThermalMeter_8812A(PADAPTER Adapter, u8* PROMContent,BOOLEAN AutoloadFail);
+void Hal_ReadChannelPlan8812A(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoadFail);
+void Hal_EfuseParseXtal_8812A(PADAPTER pAdapter, u8* hwinfo,BOOLEAN AutoLoadFail);
+void Hal_ReadAntennaDiversity8812A(PADAPTER pAdapter,u8* PROMContent,BOOLEAN AutoLoadFail);
+void Hal_ReadAntennaDiversity8821A(PADAPTER pAdapter, u8* PROMContent, BOOLEAN AutoLoadFail);
+void Hal_ReadAmplifierType_8812A(PADAPTER Adapter,u8* PROMContent, BOOLEAN AutoloadFail);
+void Hal_ReadPAType_8821A(PADAPTER Adapter,u8* PROMContent, BOOLEAN AutoloadFail);
+void Hal_ReadRFEType_8812A(PADAPTER Adapter,u8* PROMContent, BOOLEAN AutoloadFail);
+void Hal_EfuseParseBTCoexistInfo8812A(PADAPTER Adapter, u8* hwinfo, BOOLEAN AutoLoadFail);
+void hal_ReadUsbType_8812AU(PADAPTER Adapter, u8 *PROMContent, BOOLEAN AutoloadFail);
+int FirmwareDownloadBT(PADAPTER Adapter, PRT_MP_FIRMWARE pFirmware);
+void Hal_ReadRemoteWakeup_8812A(PADAPTER padapter, u8* hwinfo, BOOLEAN AutoLoadFail);
+
+BOOLEAN HalDetectPwrDownMode8812(PADAPTER Adapter);
+
+#ifdef CONFIG_WOWLAN
+void Hal_DetectWoWMode(PADAPTER pAdapter);
+#endif //CONFIG_WOWLAN
+
+void _InitBeaconParameters_8812A(PADAPTER padapter);
+void SetBeaconRelatedRegisters8812A(PADAPTER padapter);
+
+void ReadRFType8812A(PADAPTER padapter);
+void InitDefaultValue8821A(PADAPTER padapter);
+
+void SetHwReg8812A(PADAPTER padapter, u8 variable, u8 *pval);
+void GetHwReg8812A(PADAPTER padapter, u8 variable, u8 *pval);
+u8 SetHalDefVar8812A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval);
+u8 GetHalDefVar8812A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval);
+s32 c2h_id_filter_ccx_8812a(u8 *buf);
+void rtl8812_set_hal_ops(struct hal_ops *pHalFunc);
+
+// register
+void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits);
+
+void rtl8812_start_thread(PADAPTER padapter);
+void rtl8812_stop_thread(PADAPTER padapter);
+
+#ifdef CONFIG_PCI_HCI
+BOOLEAN InterruptRecognized8812AE(PADAPTER Adapter);
+VOID UpdateInterruptMask8812AE(PADAPTER Adapter, u32 AddMSR, u32 AddMSR1, u32 RemoveMSR, u32 RemoveMSR1);
+#endif
+
+#endif //__RTL8188E_HAL_H__
+
diff --git a/rtl8xxx_EU/include/rtl8812a_led.h b/rtl8xxx_EU/include/rtl8812a_led.h
index 293e504..f56326c 100755
--- a/rtl8xxx_EU/include/rtl8812a_led.h
+++ b/rtl8xxx_EU/include/rtl8812a_led.h
@@ -1,41 +1,41 @@
-/******************************************************************************
- *
- * 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 __RTL8812A_LED_H__
-#define __RTL8812A_LED_H__
-
-
-//================================================================================
-// Interface to manipulate LED objects.
-//================================================================================
-#ifdef CONFIG_USB_HCI
-void rtl8812au_InitSwLeds(PADAPTER padapter);
-void rtl8812au_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_PCI_HCI
-void rtl8812ae_InitSwLeds(PADAPTER padapter);
-void rtl8812ae_DeInitSwLeds(PADAPTER padapter);
-#endif
-#ifdef CONFIG_SDIO_HCI
-void rtl8812s_InitSwLeds(PADAPTER padapter);
-void rtl8812s_DeInitSwLeds(PADAPTER padapter);
-#endif
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8812A_LED_H__
+#define __RTL8812A_LED_H__
+
+
+//================================================================================
+// Interface to manipulate LED objects.
+//================================================================================
+#ifdef CONFIG_USB_HCI
+void rtl8812au_InitSwLeds(PADAPTER padapter);
+void rtl8812au_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_PCI_HCI
+void rtl8812ae_InitSwLeds(PADAPTER padapter);
+void rtl8812ae_DeInitSwLeds(PADAPTER padapter);
+#endif
+#ifdef CONFIG_SDIO_HCI
+void rtl8812s_InitSwLeds(PADAPTER padapter);
+void rtl8812s_DeInitSwLeds(PADAPTER padapter);
+#endif
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8812a_recv.h b/rtl8xxx_EU/include/rtl8812a_recv.h
index d1c2029..410bbad 100755
--- a/rtl8xxx_EU/include/rtl8812a_recv.h
+++ b/rtl8xxx_EU/include/rtl8812a_recv.h
@@ -1,158 +1,158 @@
-/******************************************************************************
- *
- * 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 __RTL8812A_RECV_H__
-#define __RTL8812A_RECV_H__
-
-#if defined(CONFIG_USB_HCI)
-
-#ifdef PLATFORM_OS_CE
-#define MAX_RECVBUF_SZ (8192+1024) // 8K+1k
-#else
- #ifndef CONFIG_MINIMAL_MEMORY_USAGE
- #define MAX_RECVBUF_SZ (32768) // 32k
- //#define MAX_RECVBUF_SZ (24576) // 24k
- //#define MAX_RECVBUF_SZ (20480) //20K
- //#define MAX_RECVBUF_SZ (10240) //10K
- //#define MAX_RECVBUF_SZ (15360) // 15k < 16k
- //#define MAX_RECVBUF_SZ (8192+1024) // 8K+1k
- #else
- #define MAX_RECVBUF_SZ (4000) // about 4K
- #endif
-#endif
-
-#elif defined(CONFIG_PCI_HCI)
-//#ifndef CONFIG_MINIMAL_MEMORY_USAGE
-// #define MAX_RECVBUF_SZ (9100)
-//#else
- #define MAX_RECVBUF_SZ (4000) // about 4K
-//#endif
-
-
-#elif defined(CONFIG_SDIO_HCI)
-
-#ifdef CONFIG_SDIO_RX_COPY
-#define MAX_RECVBUF_SZ (10240)
-#else // !CONFIG_SDIO_RX_COPY
-#define MAX_RECVBUF_SZ MAX_RX_DMA_BUFFER_SIZE_8821
-#endif // !CONFIG_SDIO_RX_COPY
-
-#endif
-
-
-// Rx smooth factor
-#define Rx_Smooth_Factor (20)
-
-//DWORD 0
-#define SET_RX_STATUS_DESC_PKT_LEN_8812(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 0, 14, __Value)
-#define SET_RX_STATUS_DESC_EOR_8812(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 30, 1, __Value)
-#define SET_RX_STATUS_DESC_OWN_8812(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 31, 1, __Value)
-
-#define GET_RX_STATUS_DESC_PKT_LEN_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 14)
-#define GET_RX_STATUS_DESC_CRC32_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 14, 1)
-#define GET_RX_STATUS_DESC_ICV_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 15, 1)
-#define GET_RX_STATUS_DESC_DRVINFO_SIZE_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 4)
-#define GET_RX_STATUS_DESC_SECURITY_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 20, 3)
-#define GET_RX_STATUS_DESC_QOS_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 23, 1)
-#define GET_RX_STATUS_DESC_SHIFT_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 24, 2)
-#define GET_RX_STATUS_DESC_PHY_STATUS_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 26, 1)
-#define GET_RX_STATUS_DESC_SWDEC_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 27, 1)
-#define GET_RX_STATUS_DESC_LAST_SEG_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 28, 1)
-#define GET_RX_STATUS_DESC_FIRST_SEG_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 29, 1)
-#define GET_RX_STATUS_DESC_EOR_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 30, 1)
-#define GET_RX_STATUS_DESC_OWN_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 31, 1)
-
-//DWORD 1
-#define GET_RX_STATUS_DESC_MACID_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 0, 7)
-#define GET_RX_STATUS_DESC_TID_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 8, 4)
-#define GET_RX_STATUS_DESC_AMSDU_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 13, 1)
-#define GET_RX_STATUS_DESC_RXID_MATCH_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 14, 1)
-#define GET_RX_STATUS_DESC_PAGGR_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 15, 1)
-#define GET_RX_STATUS_DESC_A1_FIT_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 16, 4)
-#define GET_RX_STATUS_DESC_CHKERR_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 20, 1)
-#define GET_RX_STATUS_DESC_IPVER_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 21, 1)
-#define GET_RX_STATUS_DESC_IS_TCPUDP__8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 22, 1)
-#define GET_RX_STATUS_DESC_CHK_VLD_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 23, 1)
-#define GET_RX_STATUS_DESC_PAM_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 24, 1)
-#define GET_RX_STATUS_DESC_PWR_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 25, 1)
-#define GET_RX_STATUS_DESC_MORE_DATA_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 26, 1)
-#define GET_RX_STATUS_DESC_MORE_FRAG_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 27, 1)
-#define GET_RX_STATUS_DESC_TYPE_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 28, 2)
-#define GET_RX_STATUS_DESC_MC_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 30, 1)
-#define GET_RX_STATUS_DESC_BC_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 31, 1)
-
-//DWORD 2
-#define GET_RX_STATUS_DESC_SEQ_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 0, 12)
-#define GET_RX_STATUS_DESC_FRAG_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 12, 4)
-#define GET_RX_STATUS_DESC_RX_IS_QOS_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 16, 1)
-#define GET_RX_STATUS_DESC_WLANHD_IV_LEN_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 18, 6)
-#define GET_RX_STATUS_DESC_RPT_SEL_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 28, 1)
-
-//DWORD 3
-#define GET_RX_STATUS_DESC_RX_RATE_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 0, 7)
-#define GET_RX_STATUS_DESC_HTC_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 10, 1)
-#define GET_RX_STATUS_DESC_EOSP_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 11, 1)
-#define GET_RX_STATUS_DESC_BSSID_FIT_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 12, 2)
-#ifdef CONFIG_USB_RX_AGGREGATION
-#define GET_RX_STATUS_DESC_USB_AGG_PKTNUM_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 16, 8)
-#endif
-#define GET_RX_STATUS_DESC_PATTERN_MATCH_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 29, 1)
-#define GET_RX_STATUS_DESC_UNICAST_MATCH_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 30, 1)
-#define GET_RX_STATUS_DESC_MAGIC_MATCH_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 31, 1)
-
-//DWORD 6
-#define GET_RX_STATUS_DESC_SPLCP_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 0, 1)
-#define GET_RX_STATUS_DESC_LDPC_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 1, 1)
-#define GET_RX_STATUS_DESC_STBC_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 2, 1)
-#define GET_RX_STATUS_DESC_BW_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 4, 2)
-
-//DWORD 5
-#define GET_RX_STATUS_DESC_TSFL_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
-
-#define GET_RX_STATUS_DESC_BUFF_ADDR_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+24, 0, 32)
-#define GET_RX_STATUS_DESC_BUFF_ADDR64_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+28, 0, 32)
-
-#define SET_RX_STATUS_DESC_BUFF_ADDR_8812(__pRxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxDesc+24, 0, 32, __Value)
-
-
-#ifdef CONFIG_SDIO_HCI
-s32 InitRecvPriv8821AS(PADAPTER padapter);
-void FreeRecvPriv8821AS(PADAPTER padapter);
-#endif // CONFIG_SDIO_HCI
-
-#ifdef CONFIG_USB_HCI
-#define INTERRUPT_MSG_FORMAT_LEN 60
-void rtl8812au_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
-s32 rtl8812au_init_recv_priv(PADAPTER padapter);
-void rtl8812au_free_recv_priv(PADAPTER padapter);
-void rtl8812au_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf);
-void rtl8812au_recv_tasklet(void *priv);
-
-#endif
-
-#ifdef CONFIG_PCI_HCI
-s32 rtl8812ae_init_recv_priv(PADAPTER padapter);
-void rtl8812ae_free_recv_priv(PADAPTER padapter);
-#endif
-
-void rtl8812_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
-void rtl8812_query_rx_phy_status(union recv_frame *prframe, u8 *pphy_stat);
-
-#endif
-
+/******************************************************************************
+ *
+ * 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 __RTL8812A_RECV_H__
+#define __RTL8812A_RECV_H__
+
+#if defined(CONFIG_USB_HCI)
+
+#ifdef PLATFORM_OS_CE
+#define MAX_RECVBUF_SZ (8192+1024) // 8K+1k
+#else
+ #ifndef CONFIG_MINIMAL_MEMORY_USAGE
+ #define MAX_RECVBUF_SZ (32768) // 32k
+ //#define MAX_RECVBUF_SZ (24576) // 24k
+ //#define MAX_RECVBUF_SZ (20480) //20K
+ //#define MAX_RECVBUF_SZ (10240) //10K
+ //#define MAX_RECVBUF_SZ (15360) // 15k < 16k
+ //#define MAX_RECVBUF_SZ (8192+1024) // 8K+1k
+ #else
+ #define MAX_RECVBUF_SZ (4000) // about 4K
+ #endif
+#endif
+
+#elif defined(CONFIG_PCI_HCI)
+//#ifndef CONFIG_MINIMAL_MEMORY_USAGE
+// #define MAX_RECVBUF_SZ (9100)
+//#else
+ #define MAX_RECVBUF_SZ (4000) // about 4K
+//#endif
+
+
+#elif defined(CONFIG_SDIO_HCI)
+
+#ifdef CONFIG_SDIO_RX_COPY
+#define MAX_RECVBUF_SZ (10240)
+#else // !CONFIG_SDIO_RX_COPY
+#define MAX_RECVBUF_SZ MAX_RX_DMA_BUFFER_SIZE_8821
+#endif // !CONFIG_SDIO_RX_COPY
+
+#endif
+
+
+// Rx smooth factor
+#define Rx_Smooth_Factor (20)
+
+//DWORD 0
+#define SET_RX_STATUS_DESC_PKT_LEN_8812(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 0, 14, __Value)
+#define SET_RX_STATUS_DESC_EOR_8812(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 30, 1, __Value)
+#define SET_RX_STATUS_DESC_OWN_8812(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 31, 1, __Value)
+
+#define GET_RX_STATUS_DESC_PKT_LEN_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 14)
+#define GET_RX_STATUS_DESC_CRC32_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 14, 1)
+#define GET_RX_STATUS_DESC_ICV_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 15, 1)
+#define GET_RX_STATUS_DESC_DRVINFO_SIZE_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 4)
+#define GET_RX_STATUS_DESC_SECURITY_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 20, 3)
+#define GET_RX_STATUS_DESC_QOS_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 23, 1)
+#define GET_RX_STATUS_DESC_SHIFT_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 24, 2)
+#define GET_RX_STATUS_DESC_PHY_STATUS_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 26, 1)
+#define GET_RX_STATUS_DESC_SWDEC_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 27, 1)
+#define GET_RX_STATUS_DESC_LAST_SEG_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 28, 1)
+#define GET_RX_STATUS_DESC_FIRST_SEG_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 29, 1)
+#define GET_RX_STATUS_DESC_EOR_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 30, 1)
+#define GET_RX_STATUS_DESC_OWN_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 31, 1)
+
+//DWORD 1
+#define GET_RX_STATUS_DESC_MACID_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 0, 7)
+#define GET_RX_STATUS_DESC_TID_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 8, 4)
+#define GET_RX_STATUS_DESC_AMSDU_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 13, 1)
+#define GET_RX_STATUS_DESC_RXID_MATCH_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 14, 1)
+#define GET_RX_STATUS_DESC_PAGGR_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 15, 1)
+#define GET_RX_STATUS_DESC_A1_FIT_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 16, 4)
+#define GET_RX_STATUS_DESC_CHKERR_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 20, 1)
+#define GET_RX_STATUS_DESC_IPVER_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 21, 1)
+#define GET_RX_STATUS_DESC_IS_TCPUDP__8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 22, 1)
+#define GET_RX_STATUS_DESC_CHK_VLD_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 23, 1)
+#define GET_RX_STATUS_DESC_PAM_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 24, 1)
+#define GET_RX_STATUS_DESC_PWR_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 25, 1)
+#define GET_RX_STATUS_DESC_MORE_DATA_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 26, 1)
+#define GET_RX_STATUS_DESC_MORE_FRAG_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 27, 1)
+#define GET_RX_STATUS_DESC_TYPE_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 28, 2)
+#define GET_RX_STATUS_DESC_MC_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 30, 1)
+#define GET_RX_STATUS_DESC_BC_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+4, 31, 1)
+
+//DWORD 2
+#define GET_RX_STATUS_DESC_SEQ_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 0, 12)
+#define GET_RX_STATUS_DESC_FRAG_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 12, 4)
+#define GET_RX_STATUS_DESC_RX_IS_QOS_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 16, 1)
+#define GET_RX_STATUS_DESC_WLANHD_IV_LEN_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 18, 6)
+#define GET_RX_STATUS_DESC_RPT_SEL_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 28, 1)
+
+//DWORD 3
+#define GET_RX_STATUS_DESC_RX_RATE_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 0, 7)
+#define GET_RX_STATUS_DESC_HTC_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 10, 1)
+#define GET_RX_STATUS_DESC_EOSP_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 11, 1)
+#define GET_RX_STATUS_DESC_BSSID_FIT_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 12, 2)
+#ifdef CONFIG_USB_RX_AGGREGATION
+#define GET_RX_STATUS_DESC_USB_AGG_PKTNUM_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 16, 8)
+#endif
+#define GET_RX_STATUS_DESC_PATTERN_MATCH_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 29, 1)
+#define GET_RX_STATUS_DESC_UNICAST_MATCH_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 30, 1)
+#define GET_RX_STATUS_DESC_MAGIC_MATCH_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+12, 31, 1)
+
+//DWORD 6
+#define GET_RX_STATUS_DESC_SPLCP_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 0, 1)
+#define GET_RX_STATUS_DESC_LDPC_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 1, 1)
+#define GET_RX_STATUS_DESC_STBC_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 2, 1)
+#define GET_RX_STATUS_DESC_BW_8812(__pRxDesc) LE_BITS_TO_4BYTE( __pRxDesc+16, 4, 2)
+
+//DWORD 5
+#define GET_RX_STATUS_DESC_TSFL_8812(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
+
+#define GET_RX_STATUS_DESC_BUFF_ADDR_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+24, 0, 32)
+#define GET_RX_STATUS_DESC_BUFF_ADDR64_8812(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+28, 0, 32)
+
+#define SET_RX_STATUS_DESC_BUFF_ADDR_8812(__pRxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxDesc+24, 0, 32, __Value)
+
+
+#ifdef CONFIG_SDIO_HCI
+s32 InitRecvPriv8821AS(PADAPTER padapter);
+void FreeRecvPriv8821AS(PADAPTER padapter);
+#endif // CONFIG_SDIO_HCI
+
+#ifdef CONFIG_USB_HCI
+#define INTERRUPT_MSG_FORMAT_LEN 60
+void rtl8812au_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
+s32 rtl8812au_init_recv_priv(PADAPTER padapter);
+void rtl8812au_free_recv_priv(PADAPTER padapter);
+void rtl8812au_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf);
+void rtl8812au_recv_tasklet(void *priv);
+
+#endif
+
+#ifdef CONFIG_PCI_HCI
+s32 rtl8812ae_init_recv_priv(PADAPTER padapter);
+void rtl8812ae_free_recv_priv(PADAPTER padapter);
+#endif
+
+void rtl8812_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
+void rtl8812_query_rx_phy_status(union recv_frame *prframe, u8 *pphy_stat);
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtl8812a_spec.h b/rtl8xxx_EU/include/rtl8812a_spec.h
index f1e266f..c1f89d3 100755
--- a/rtl8xxx_EU/include/rtl8812a_spec.h
+++ b/rtl8xxx_EU/include/rtl8812a_spec.h
@@ -1,252 +1,252 @@
-/******************************************************************************
- *
- * 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 __RTL8812A_SPEC_H__
-#define __RTL8812A_SPEC_H__
-
-#include <drv_conf.h>
-
-
-//============================================================
-// 8812 Regsiter offset definition
-//============================================================
-
-//============================================================
-//
-//============================================================
-
-//-----------------------------------------------------
-//
-// 0x0000h ~ 0x00FFh System Configuration
-//
-//-----------------------------------------------------
-#define REG_HSIMR_8812 0x0058
-#define REG_HSISR_8812 0x005c
-#define REG_GPIO_EXT_CTRL 0x0060
-#define REG_GPIO_STATUS_8812 0x006C
-#define REG_SDIO_CTRL_8812 0x0070
-#define REG_OPT_CTRL_8812 0x0074
-#define REG_RF_B_CTRL_8812 0x0076
-#define REG_FW_DRV_MSG_8812 0x0088
-#define REG_HMEBOX_E2_E3_8812 0x008C
-#define REG_HIMR0_8812 0x00B0
-#define REG_HISR0_8812 0x00B4
-#define REG_HIMR1_8812 0x00B8
-#define REG_HISR1_8812 0x00BC
-#define REG_EFUSE_BURN_GNT_8812 0x00CF
-#define REG_SYS_CFG1_8812 0x00FC
-
-//-----------------------------------------------------
-//
-// 0x0100h ~ 0x01FFh MACTOP General Configuration
-//
-//-----------------------------------------------------
-#define REG_PKTBUF_DBG_ADDR (REG_PKTBUF_DBG_CTRL)
-#define REG_RXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+2)
-#define REG_TXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+3)
-
-#define REG_RSVD3_8812 0x0168
-#define REG_C2HEVT_CMD_SEQ_88XX 0x01A1
-#define REG_C2hEVT_CMD_CONTENT_88XX 0x01A2
-#define REG_C2HEVT_CMD_LEN_88XX 0x01AE
-
-#define REG_HMEBOX_EXT0_8812 0x01F0
-#define REG_HMEBOX_EXT1_8812 0x01F4
-#define REG_HMEBOX_EXT2_8812 0x01F8
-#define REG_HMEBOX_EXT3_8812 0x01FC
-
-//-----------------------------------------------------
-//
-// 0x0200h ~ 0x027Fh TXDMA Configuration
-//
-//-----------------------------------------------------
-#define REG_DWBCN0_CTRL_8812 REG_TDECTRL
-#define REG_DWBCN1_CTRL_8812 0x0228
-
-//-----------------------------------------------------
-//
-// 0x0280h ~ 0x02FFh RXDMA Configuration
-//
-//-----------------------------------------------------
-#define REG_RXDMA_CONTROL_8812 0x0286 // Control the RX DMA.
-#define REG_RXDMA_PRO_8812 0x0290
-#define REG_EARLY_MODE_CONTROL_8812 0x02BC
-#define REG_RSVD5_8812 0x02F0
-#define REG_RSVD6_8812 0x02F4
-#define REG_RSVD7_8812 0x02F8
-#define REG_RSVD8_8812 0x02FC
-
-
-//-----------------------------------------------------
-//
-// 0x0300h ~ 0x03FFh PCIe
-//
-//-----------------------------------------------------
-#define REG_DBI_WDATA_8812 0x0348 // DBI Write Data
-#define REG_DBI_RDATA_8812 0x034C // DBI Read Data
-#define REG_DBI_ADDR_8812 0x0350 // DBI Address
-#define REG_DBI_FLAG_8812 0x0352 // DBI Read/Write Flag
-#define REG_MDIO_WDATA_8812 0x0354 // MDIO for Write PCIE PHY
-#define REG_MDIO_RDATA_8812 0x0356 // MDIO for Reads PCIE PHY
-#define REG_MDIO_CTL_8812 0x0358 // MDIO for Control
-#define REG_PCIE_MULTIFET_CTRL_8812 0x036A //PCIE Multi-Fethc Control
-
-//-----------------------------------------------------
-//
-// 0x0400h ~ 0x047Fh Protocol Configuration
-//
-//-----------------------------------------------------
-#define REG_TXBF_CTRL_8812 0x042C
-#define REG_ARFR0_8812 0x0444
-#define REG_ARFR1_8812 0x044C
-#define REG_CCK_CHECK_8812 0x0454
-#define REG_AMPDU_MAX_TIME_8812 0x0456
-#define REG_TXPKTBUF_BCNQ_BDNY1_8812 0x0457
-
-#define REG_AMPDU_MAX_LENGTH_8812 0x0458
-#define REG_TXPKTBUF_WMAC_LBK_BF_HD_8812 0x045D
-#define REG_NDPA_OPT_CTRL_8812 0x045F
-#define REG_DATA_SC_8812 0x0483
-#define REG_ARFR2_8812 0x048C
-#define REG_ARFR3_8812 0x0494
-#define REG_TXRPT_START_OFFSET 0x04AC
-#define REG_AMPDU_BURST_MODE_8812 0x04BC
-#define REG_HT_SINGLE_AMPDU_8812 0x04C7
-#define REG_MACID_PKT_DROP0_8812 0x04D0
-
-//-----------------------------------------------------
-//
-// 0x0500h ~ 0x05FFh EDCA Configuration
-//
-//-----------------------------------------------------
-#define REG_CTWND_8812 0x0572
-#define REG_SECONDARY_CCA_CTRL_8812 0x0577
-#define REG_SCH_TXCMD_8812 0x05F8
-
-//-----------------------------------------------------
-//
-// 0x0600h ~ 0x07FFh WMAC Configuration
-//
-//-----------------------------------------------------
-#define REG_MAC_CR_8812 0x0600
-
-#define REG_MAC_TX_SM_STATE_8812 0x06B4
-
-// Power
-#define REG_BFMER0_INFO_8812 0x06E4
-#define REG_BFMER1_INFO_8812 0x06EC
-#define REG_CSI_RPT_PARAM_BW20_8812 0x06F4
-#define REG_CSI_RPT_PARAM_BW40_8812 0x06F8
-#define REG_CSI_RPT_PARAM_BW80_8812 0x06FC
-
-// Hardware Port 2
-#define REG_BFMEE_SEL_8812 0x0714
-#define REG_SND_PTCL_CTRL_8812 0x0718
-
-
-//-----------------------------------------------------
-//
-// Redifine register definition for compatibility
-//
-//-----------------------------------------------------
-
-// TODO: use these definition when using REG_xxx naming rule.
-// NOTE: DO NOT Remove these definition. Use later.
-#define ISR_8812 REG_HISR0_8812
-
-//----------------------------------------------------------------------------
-// 8195 IMR/ISR bits (offset 0xB0, 8bits)
-//----------------------------------------------------------------------------
-#define IMR_DISABLED_8812 0
-// IMR DW0(0x00B0-00B3) Bit 0-31
-#define IMR_TIMER2_8812 BIT31 // Timeout interrupt 2
-#define IMR_TIMER1_8812 BIT30 // Timeout interrupt 1
-#define IMR_PSTIMEOUT_8812 BIT29 // Power Save Time Out Interrupt
-#define IMR_GTINT4_8812 BIT28 // When GTIMER4 expires, this bit is set to 1
-#define IMR_GTINT3_8812 BIT27 // When GTIMER3 expires, this bit is set to 1
-#define IMR_TXBCN0ERR_8812 BIT26 // Transmit Beacon0 Error
-#define IMR_TXBCN0OK_8812 BIT25 // Transmit Beacon0 OK
-#define IMR_TSF_BIT32_TOGGLE_8812 BIT24 // TSF Timer BIT32 toggle indication interrupt
-#define IMR_BCNDMAINT0_8812 BIT20 // Beacon DMA Interrupt 0
-#define IMR_BCNDERR0_8812 BIT16 // Beacon Queue DMA OK0
-#define IMR_HSISR_IND_ON_INT_8812 BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1)
-#define IMR_BCNDMAINT_E_8812 BIT14 // Beacon DMA Interrupt Extension for Win7
-#define IMR_ATIMEND_8812 BIT12 // CTWidnow End or ATIM Window End
-#define IMR_C2HCMD_8812 BIT10 // CPU to Host Command INT Status, Write 1 clear
-#define IMR_CPWM2_8812 BIT9 // CPU power Mode exchange INT Status, Write 1 clear
-#define IMR_CPWM_8812 BIT8 // CPU power Mode exchange INT Status, Write 1 clear
-#define IMR_HIGHDOK_8812 BIT7 // High Queue DMA OK
-#define IMR_MGNTDOK_8812 BIT6 // Management Queue DMA OK
-#define IMR_BKDOK_8812 BIT5 // AC_BK DMA OK
-#define IMR_BEDOK_8812 BIT4 // AC_BE DMA OK
-#define IMR_VIDOK_8812 BIT3 // AC_VI DMA OK
-#define IMR_VODOK_8812 BIT2 // AC_VO DMA OK
-#define IMR_RDU_8812 BIT1 // Rx Descriptor Unavailable
-#define IMR_ROK_8812 BIT0 // Receive DMA OK
-
-// IMR DW1(0x00B4-00B7) Bit 0-31
-#define IMR_BCNDMAINT7_8812 BIT27 // Beacon DMA Interrupt 7
-#define IMR_BCNDMAINT6_8812 BIT26 // Beacon DMA Interrupt 6
-#define IMR_BCNDMAINT5_8812 BIT25 // Beacon DMA Interrupt 5
-#define IMR_BCNDMAINT4_8812 BIT24 // Beacon DMA Interrupt 4
-#define IMR_BCNDMAINT3_8812 BIT23 // Beacon DMA Interrupt 3
-#define IMR_BCNDMAINT2_8812 BIT22 // Beacon DMA Interrupt 2
-#define IMR_BCNDMAINT1_8812 BIT21 // Beacon DMA Interrupt 1
-#define IMR_BCNDOK7_8812 BIT20 // Beacon Queue DMA OK Interrup 7
-#define IMR_BCNDOK6_8812 BIT19 // Beacon Queue DMA OK Interrup 6
-#define IMR_BCNDOK5_8812 BIT18 // Beacon Queue DMA OK Interrup 5
-#define IMR_BCNDOK4_8812 BIT17 // Beacon Queue DMA OK Interrup 4
-#define IMR_BCNDOK3_8812 BIT16 // Beacon Queue DMA OK Interrup 3
-#define IMR_BCNDOK2_8812 BIT15 // Beacon Queue DMA OK Interrup 2
-#define IMR_BCNDOK1_8812 BIT14 // Beacon Queue DMA OK Interrup 1
-#define IMR_ATIMEND_E_8812 BIT13 // ATIM Window End Extension for Win7
-#define IMR_TXERR_8812 BIT11 // Tx Error Flag Interrupt Status, write 1 clear.
-#define IMR_RXERR_8812 BIT10 // Rx Error Flag INT Status, Write 1 clear
-#define IMR_TXFOVW_8812 BIT9 // Transmit FIFO Overflow
-#define IMR_RXFOVW_8812 BIT8 // Receive FIFO Overflow
-
-
-#ifdef CONFIG_PCI_HCI
-//#define IMR_RX_MASK (IMR_ROK_8812|IMR_RDU_8812|IMR_RXFOVW_8812)
-#define IMR_TX_MASK (IMR_VODOK_8812|IMR_VIDOK_8812|IMR_BEDOK_8812|IMR_BKDOK_8812|IMR_MGNTDOK_8812|IMR_HIGHDOK_8812)
-
-#define RT_BCN_INT_MASKS (IMR_BCNDMAINT0_8812 | IMR_TXBCN0OK_8812 | IMR_TXBCN0ERR_8812 | IMR_BCNDERR0_8812)
-
-#define RT_AC_INT_MASKS (IMR_VIDOK_8812 | IMR_VODOK_8812 | IMR_BEDOK_8812|IMR_BKDOK_8812)
-#endif
-
-
-//============================================================================
-// Regsiter Bit and Content definition
-//============================================================================
-
-//2 ACMHWCTRL 0x05C0
-#define AcmHw_HwEn_8812 BIT(0)
-#define AcmHw_VoqEn_8812 BIT(1)
-#define AcmHw_ViqEn_8812 BIT(2)
-#define AcmHw_BeqEn_8812 BIT(3)
-#define AcmHw_VoqStatus_8812 BIT(5)
-#define AcmHw_ViqStatus_8812 BIT(6)
-#define AcmHw_BeqStatus_8812 BIT(7)
-
-#endif //__RTL8188E_SPEC_H__
-
-#ifdef CONFIG_RTL8821A
-#include "rtl8821a_spec.h"
-#endif // CONFIG_RTL8821A
-
+/******************************************************************************
+ *
+ * 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 __RTL8812A_SPEC_H__
+#define __RTL8812A_SPEC_H__
+
+#include <drv_conf.h>
+
+
+//============================================================
+// 8812 Regsiter offset definition
+//============================================================
+
+//============================================================
+//
+//============================================================
+
+//-----------------------------------------------------
+//
+// 0x0000h ~ 0x00FFh System Configuration
+//
+//-----------------------------------------------------
+#define REG_HSIMR_8812 0x0058
+#define REG_HSISR_8812 0x005c
+#define REG_GPIO_EXT_CTRL 0x0060
+#define REG_GPIO_STATUS_8812 0x006C
+#define REG_SDIO_CTRL_8812 0x0070
+#define REG_OPT_CTRL_8812 0x0074
+#define REG_RF_B_CTRL_8812 0x0076
+#define REG_FW_DRV_MSG_8812 0x0088
+#define REG_HMEBOX_E2_E3_8812 0x008C
+#define REG_HIMR0_8812 0x00B0
+#define REG_HISR0_8812 0x00B4
+#define REG_HIMR1_8812 0x00B8
+#define REG_HISR1_8812 0x00BC
+#define REG_EFUSE_BURN_GNT_8812 0x00CF
+#define REG_SYS_CFG1_8812 0x00FC
+
+//-----------------------------------------------------
+//
+// 0x0100h ~ 0x01FFh MACTOP General Configuration
+//
+//-----------------------------------------------------
+#define REG_PKTBUF_DBG_ADDR (REG_PKTBUF_DBG_CTRL)
+#define REG_RXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+2)
+#define REG_TXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+3)
+
+#define REG_RSVD3_8812 0x0168
+#define REG_C2HEVT_CMD_SEQ_88XX 0x01A1
+#define REG_C2hEVT_CMD_CONTENT_88XX 0x01A2
+#define REG_C2HEVT_CMD_LEN_88XX 0x01AE
+
+#define REG_HMEBOX_EXT0_8812 0x01F0
+#define REG_HMEBOX_EXT1_8812 0x01F4
+#define REG_HMEBOX_EXT2_8812 0x01F8
+#define REG_HMEBOX_EXT3_8812 0x01FC
+
+//-----------------------------------------------------
+//
+// 0x0200h ~ 0x027Fh TXDMA Configuration
+//
+//-----------------------------------------------------
+#define REG_DWBCN0_CTRL_8812 REG_TDECTRL
+#define REG_DWBCN1_CTRL_8812 0x0228
+
+//-----------------------------------------------------
+//
+// 0x0280h ~ 0x02FFh RXDMA Configuration
+//
+//-----------------------------------------------------
+#define REG_RXDMA_CONTROL_8812 0x0286 // Control the RX DMA.
+#define REG_RXDMA_PRO_8812 0x0290
+#define REG_EARLY_MODE_CONTROL_8812 0x02BC
+#define REG_RSVD5_8812 0x02F0
+#define REG_RSVD6_8812 0x02F4
+#define REG_RSVD7_8812 0x02F8
+#define REG_RSVD8_8812 0x02FC
+
+
+//-----------------------------------------------------
+//
+// 0x0300h ~ 0x03FFh PCIe
+//
+//-----------------------------------------------------
+#define REG_DBI_WDATA_8812 0x0348 // DBI Write Data
+#define REG_DBI_RDATA_8812 0x034C // DBI Read Data
+#define REG_DBI_ADDR_8812 0x0350 // DBI Address
+#define REG_DBI_FLAG_8812 0x0352 // DBI Read/Write Flag
+#define REG_MDIO_WDATA_8812 0x0354 // MDIO for Write PCIE PHY
+#define REG_MDIO_RDATA_8812 0x0356 // MDIO for Reads PCIE PHY
+#define REG_MDIO_CTL_8812 0x0358 // MDIO for Control
+#define REG_PCIE_MULTIFET_CTRL_8812 0x036A //PCIE Multi-Fethc Control
+
+//-----------------------------------------------------
+//
+// 0x0400h ~ 0x047Fh Protocol Configuration
+//
+//-----------------------------------------------------
+#define REG_TXBF_CTRL_8812 0x042C
+#define REG_ARFR0_8812 0x0444
+#define REG_ARFR1_8812 0x044C
+#define REG_CCK_CHECK_8812 0x0454
+#define REG_AMPDU_MAX_TIME_8812 0x0456
+#define REG_TXPKTBUF_BCNQ_BDNY1_8812 0x0457
+
+#define REG_AMPDU_MAX_LENGTH_8812 0x0458
+#define REG_TXPKTBUF_WMAC_LBK_BF_HD_8812 0x045D
+#define REG_NDPA_OPT_CTRL_8812 0x045F
+#define REG_DATA_SC_8812 0x0483
+#define REG_ARFR2_8812 0x048C
+#define REG_ARFR3_8812 0x0494
+#define REG_TXRPT_START_OFFSET 0x04AC
+#define REG_AMPDU_BURST_MODE_8812 0x04BC
+#define REG_HT_SINGLE_AMPDU_8812 0x04C7
+#define REG_MACID_PKT_DROP0_8812 0x04D0
+
+//-----------------------------------------------------
+//
+// 0x0500h ~ 0x05FFh EDCA Configuration
+//
+//-----------------------------------------------------
+#define REG_CTWND_8812 0x0572
+#define REG_SECONDARY_CCA_CTRL_8812 0x0577
+#define REG_SCH_TXCMD_8812 0x05F8
+
+//-----------------------------------------------------
+//
+// 0x0600h ~ 0x07FFh WMAC Configuration
+//
+//-----------------------------------------------------
+#define REG_MAC_CR_8812 0x0600
+
+#define REG_MAC_TX_SM_STATE_8812 0x06B4
+
+// Power
+#define REG_BFMER0_INFO_8812 0x06E4
+#define REG_BFMER1_INFO_8812 0x06EC
+#define REG_CSI_RPT_PARAM_BW20_8812 0x06F4
+#define REG_CSI_RPT_PARAM_BW40_8812 0x06F8
+#define REG_CSI_RPT_PARAM_BW80_8812 0x06FC
+
+// Hardware Port 2
+#define REG_BFMEE_SEL_8812 0x0714
+#define REG_SND_PTCL_CTRL_8812 0x0718
+
+
+//-----------------------------------------------------
+//
+// Redifine register definition for compatibility
+//
+//-----------------------------------------------------
+
+// TODO: use these definition when using REG_xxx naming rule.
+// NOTE: DO NOT Remove these definition. Use later.
+#define ISR_8812 REG_HISR0_8812
+
+//----------------------------------------------------------------------------
+// 8195 IMR/ISR bits (offset 0xB0, 8bits)
+//----------------------------------------------------------------------------
+#define IMR_DISABLED_8812 0
+// IMR DW0(0x00B0-00B3) Bit 0-31
+#define IMR_TIMER2_8812 BIT31 // Timeout interrupt 2
+#define IMR_TIMER1_8812 BIT30 // Timeout interrupt 1
+#define IMR_PSTIMEOUT_8812 BIT29 // Power Save Time Out Interrupt
+#define IMR_GTINT4_8812 BIT28 // When GTIMER4 expires, this bit is set to 1
+#define IMR_GTINT3_8812 BIT27 // When GTIMER3 expires, this bit is set to 1
+#define IMR_TXBCN0ERR_8812 BIT26 // Transmit Beacon0 Error
+#define IMR_TXBCN0OK_8812 BIT25 // Transmit Beacon0 OK
+#define IMR_TSF_BIT32_TOGGLE_8812 BIT24 // TSF Timer BIT32 toggle indication interrupt
+#define IMR_BCNDMAINT0_8812 BIT20 // Beacon DMA Interrupt 0
+#define IMR_BCNDERR0_8812 BIT16 // Beacon Queue DMA OK0
+#define IMR_HSISR_IND_ON_INT_8812 BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1)
+#define IMR_BCNDMAINT_E_8812 BIT14 // Beacon DMA Interrupt Extension for Win7
+#define IMR_ATIMEND_8812 BIT12 // CTWidnow End or ATIM Window End
+#define IMR_C2HCMD_8812 BIT10 // CPU to Host Command INT Status, Write 1 clear
+#define IMR_CPWM2_8812 BIT9 // CPU power Mode exchange INT Status, Write 1 clear
+#define IMR_CPWM_8812 BIT8 // CPU power Mode exchange INT Status, Write 1 clear
+#define IMR_HIGHDOK_8812 BIT7 // High Queue DMA OK
+#define IMR_MGNTDOK_8812 BIT6 // Management Queue DMA OK
+#define IMR_BKDOK_8812 BIT5 // AC_BK DMA OK
+#define IMR_BEDOK_8812 BIT4 // AC_BE DMA OK
+#define IMR_VIDOK_8812 BIT3 // AC_VI DMA OK
+#define IMR_VODOK_8812 BIT2 // AC_VO DMA OK
+#define IMR_RDU_8812 BIT1 // Rx Descriptor Unavailable
+#define IMR_ROK_8812 BIT0 // Receive DMA OK
+
+// IMR DW1(0x00B4-00B7) Bit 0-31
+#define IMR_BCNDMAINT7_8812 BIT27 // Beacon DMA Interrupt 7
+#define IMR_BCNDMAINT6_8812 BIT26 // Beacon DMA Interrupt 6
+#define IMR_BCNDMAINT5_8812 BIT25 // Beacon DMA Interrupt 5
+#define IMR_BCNDMAINT4_8812 BIT24 // Beacon DMA Interrupt 4
+#define IMR_BCNDMAINT3_8812 BIT23 // Beacon DMA Interrupt 3
+#define IMR_BCNDMAINT2_8812 BIT22 // Beacon DMA Interrupt 2
+#define IMR_BCNDMAINT1_8812 BIT21 // Beacon DMA Interrupt 1
+#define IMR_BCNDOK7_8812 BIT20 // Beacon Queue DMA OK Interrup 7
+#define IMR_BCNDOK6_8812 BIT19 // Beacon Queue DMA OK Interrup 6
+#define IMR_BCNDOK5_8812 BIT18 // Beacon Queue DMA OK Interrup 5
+#define IMR_BCNDOK4_8812 BIT17 // Beacon Queue DMA OK Interrup 4
+#define IMR_BCNDOK3_8812 BIT16 // Beacon Queue DMA OK Interrup 3
+#define IMR_BCNDOK2_8812 BIT15 // Beacon Queue DMA OK Interrup 2
+#define IMR_BCNDOK1_8812 BIT14 // Beacon Queue DMA OK Interrup 1
+#define IMR_ATIMEND_E_8812 BIT13 // ATIM Window End Extension for Win7
+#define IMR_TXERR_8812 BIT11 // Tx Error Flag Interrupt Status, write 1 clear.
+#define IMR_RXERR_8812 BIT10 // Rx Error Flag INT Status, Write 1 clear
+#define IMR_TXFOVW_8812 BIT9 // Transmit FIFO Overflow
+#define IMR_RXFOVW_8812 BIT8 // Receive FIFO Overflow
+
+
+#ifdef CONFIG_PCI_HCI
+//#define IMR_RX_MASK (IMR_ROK_8812|IMR_RDU_8812|IMR_RXFOVW_8812)
+#define IMR_TX_MASK (IMR_VODOK_8812|IMR_VIDOK_8812|IMR_BEDOK_8812|IMR_BKDOK_8812|IMR_MGNTDOK_8812|IMR_HIGHDOK_8812)
+
+#define RT_BCN_INT_MASKS (IMR_BCNDMAINT0_8812 | IMR_TXBCN0OK_8812 | IMR_TXBCN0ERR_8812 | IMR_BCNDERR0_8812)
+
+#define RT_AC_INT_MASKS (IMR_VIDOK_8812 | IMR_VODOK_8812 | IMR_BEDOK_8812|IMR_BKDOK_8812)
+#endif
+
+
+//============================================================================
+// Regsiter Bit and Content definition
+//============================================================================
+
+//2 ACMHWCTRL 0x05C0
+#define AcmHw_HwEn_8812 BIT(0)
+#define AcmHw_VoqEn_8812 BIT(1)
+#define AcmHw_ViqEn_8812 BIT(2)
+#define AcmHw_BeqEn_8812 BIT(3)
+#define AcmHw_VoqStatus_8812 BIT(5)
+#define AcmHw_ViqStatus_8812 BIT(6)
+#define AcmHw_BeqStatus_8812 BIT(7)
+
+#endif //__RTL8188E_SPEC_H__
+
+#ifdef CONFIG_RTL8821A
+#include "rtl8821a_spec.h"
+#endif // CONFIG_RTL8821A
+
diff --git a/rtl8xxx_EU/include/rtl8812a_xmit.h b/rtl8xxx_EU/include/rtl8812a_xmit.h
index cc87890..acde3ea 100755
--- a/rtl8xxx_EU/include/rtl8812a_xmit.h
+++ b/rtl8xxx_EU/include/rtl8812a_xmit.h
@@ -1,376 +1,376 @@
-/******************************************************************************
- *
- * 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 __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)
-#define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value)
-#define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value)
-#define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value)
-#define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value)
-#define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value)
-#define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value)
-
-//
-//defined for TX DESC Operation
-//
-
-#define MAX_TID (15)
-
-//OFFSET 0
-#define OFFSET_SZ 0
-#define OFFSET_SHT 16
-#define BMC BIT(24)
-#define LSG BIT(26)
-#define FSG BIT(27)
-#define OWN BIT(31)
-
-
-//OFFSET 4
-#define PKT_OFFSET_SZ 0
-#define QSEL_SHT 8
-#define RATE_ID_SHT 16
-#define NAVUSEHDR BIT(20)
-#define SEC_TYPE_SHT 22
-#define PKT_OFFSET_SHT 26
-
-//OFFSET 8
-#define AGG_EN BIT(12)
-#define AGG_BK BIT(16)
-#define AMPDU_DENSITY_SHT 20
-#define ANTSEL_A BIT(24)
-#define ANTSEL_B BIT(25)
-#define TX_ANT_CCK_SHT 26
-#define TX_ANTL_SHT 28
-#define TX_ANT_HT_SHT 30
-
-//OFFSET 12
-#define SEQ_SHT 16
-#define EN_HWSEQ BIT(31)
-
-//OFFSET 16
-#define QOS BIT(6)
-#define HW_SSN BIT(7)
-#define USERATE BIT(8)
-#define DISDATAFB BIT(10)
-#define CTS_2_SELF BIT(11)
-#define RTS_EN BIT(12)
-#define HW_RTS_EN BIT(13)
-#define DATA_SHORT BIT(24)
-#define PWR_STATUS_SHT 15
-#define DATA_SC_SHT 20
-#define DATA_BW BIT(25)
-
-//OFFSET 20
-#define RTY_LMT_EN BIT(17)
-
-//OFFSET 20
-#define SGI BIT(6)
-#define USB_TXAGG_NUM_SHT 24
-
-typedef struct txdescriptor_8812
-{
- // Offset 0
- u32 pktlen:16;
- u32 offset:8;
- u32 bmc:1;
- u32 htc:1;
- u32 ls:1;
- u32 fs:1;
- u32 linip:1;
- u32 noacm:1;
- u32 gf:1;
- u32 own:1;
-
- // Offset 4
- u32 macid:6;
- u32 rsvd0406:2;
- u32 qsel:5;
- u32 rd_nav_ext:1;
- u32 lsig_txop_en:1;
- u32 pifs:1;
- u32 rate_id:4;
- u32 navusehdr:1;
- u32 en_desc_id:1;
- u32 sectype:2;
- u32 rsvd0424:2;
- u32 pkt_offset:5; // unit: 8 bytes
- u32 rsvd0431:1;
-
- // Offset 8
- u32 rts_rc:6;
- u32 data_rc:6;
- u32 agg_en:1;
- u32 rd_en:1;
- u32 bar_rty_th:2;
- u32 bk:1;
- u32 morefrag:1;
- u32 raw:1;
- u32 ccx:1;
- u32 ampdu_density:3;
- u32 bt_null:1;
- u32 ant_sel_a:1;
- u32 ant_sel_b:1;
- u32 tx_ant_cck:2;
- u32 tx_antl:2;
- u32 tx_ant_ht:2;
-
- // Offset 12
- u32 nextheadpage:8;
- u32 tailpage:8;
- u32 seq:12;
- u32 cpu_handle:1;
- u32 tag1:1;
- u32 trigger_int:1;
- u32 hwseq_en:1;
-
- // Offset 16
- u32 rtsrate:5;
- u32 ap_dcfe:1;
- u32 hwseq_sel:2;
- u32 userate:1;
- u32 disrtsfb:1;
- u32 disdatafb:1;
- u32 cts2self:1;
- u32 rtsen:1;
- u32 hw_rts_en:1;
- u32 port_id:1;
- u32 pwr_status:3;
- u32 wait_dcts:1;
- u32 cts2ap_en:1;
- u32 data_sc:2;
- u32 data_stbc:2;
- u32 data_short:1;
- u32 data_bw:1;
- u32 rts_short:1;
- u32 rts_bw:1;
- u32 rts_sc:2;
- u32 vcs_stbc:2;
-
- // Offset 20
- u32 datarate:6;
- u32 sgi:1;
- u32 try_rate:1;
- u32 data_ratefb_lmt:5;
- u32 rts_ratefb_lmt:4;
- u32 rty_lmt_en:1;
- u32 data_rt_lmt:6;
- u32 usb_txagg_num:8;
-
- // Offset 24
- u32 txagg_a:5;
- u32 txagg_b:5;
- u32 use_max_len:1;
- u32 max_agg_num:5;
- u32 mcsg1_max_len:4;
- u32 mcsg2_max_len:4;
- u32 mcsg3_max_len:4;
- u32 mcs7_sgi_max_len:4;
-
- // Offset 28
- u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB)
- u32 mcsg4_max_len:4;
- u32 mcsg5_max_len:4;
- u32 mcsg6_max_len:4;
- u32 mcs15_sgi_max_len:4;
-
- // Offset 32
- u32 rsvd32;
-
- // Offset 36
- u32 rsvd36;
-}TXDESC_8812, *PTXDESC_8812;
-
-
-// Dword 0
-#define GET_TX_DESC_OWN_8812(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc, 31, 1)
-#define SET_TX_DESC_PKT_SIZE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 0, 16, __Value)
-#define SET_TX_DESC_OFFSET_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 16, 8, __Value)
-#define SET_TX_DESC_BMC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 24, 1, __Value)
-#define SET_TX_DESC_HTC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 25, 1, __Value)
-#define SET_TX_DESC_LAST_SEG_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 26, 1, __Value)
-#define SET_TX_DESC_FIRST_SEG_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 27, 1, __Value)
-#define SET_TX_DESC_LINIP_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 28, 1, __Value)
-#define SET_TX_DESC_NO_ACM_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 29, 1, __Value)
-#define SET_TX_DESC_GF_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 30, 1, __Value)
-#define SET_TX_DESC_OWN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 31, 1, __Value)
-
-// Dword 1
-#define SET_TX_DESC_MACID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 0, 7, __Value)
-#define SET_TX_DESC_QUEUE_SEL_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 8, 5, __Value)
-#define SET_TX_DESC_RDG_NAV_EXT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 13, 1, __Value)
-#define SET_TX_DESC_LSIG_TXOP_EN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 14, 1, __Value)
-#define SET_TX_DESC_PIFS_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 15, 1, __Value)
-#define SET_TX_DESC_RATE_ID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 16, 5, __Value)
-#define SET_TX_DESC_EN_DESC_ID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 21, 1, __Value)
-#define SET_TX_DESC_SEC_TYPE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 22, 2, __Value)
-#define SET_TX_DESC_PKT_OFFSET_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 24, 5, __Value)
-
-// Dword 2
-#define SET_TX_DESC_PAID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 0, 9, __Value)
-#define SET_TX_DESC_CCA_RTS_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 10, 2, __Value)
-#define SET_TX_DESC_AGG_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 12, 1, __Value)
-#define SET_TX_DESC_RDG_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 13, 1, __Value)
-#define SET_TX_DESC_AGG_BREAK_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 16, 1, __Value)
-#define SET_TX_DESC_MORE_FRAG_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 17, 1, __Value)
-#define SET_TX_DESC_RAW_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 18, 1, __Value)
-#define SET_TX_DESC_SPE_RPT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 19, 1, __Value)
-#define SET_TX_DESC_AMPDU_DENSITY_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 20, 3, __Value)
-#define SET_TX_DESC_BT_INT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 23, 1, __Value)
-#define SET_TX_DESC_GID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 6, __Value)
-
-// Dword 3
-#define SET_TX_DESC_WHEADER_LEN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 0, 4, __Value)
-#define SET_TX_DESC_CHK_EN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 4, 1, __Value)
-#define SET_TX_DESC_EARLY_MODE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 5, 1, __Value)
-#define SET_TX_DESC_HWSEQ_SEL_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 6, 2, __Value)
-#define SET_TX_DESC_USE_RATE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 8, 1, __Value)
-#define SET_TX_DESC_DISABLE_RTS_FB_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 9, 1, __Value)
-#define SET_TX_DESC_DISABLE_FB_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 10, 1, __Value)
-#define SET_TX_DESC_CTS2SELF_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 11, 1, __Value)
-#define SET_TX_DESC_RTS_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 12, 1, __Value)
-#define SET_TX_DESC_HW_RTS_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 13, 1, __Value)
-#define SET_TX_DESC_NAV_USE_HDR_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 15, 1, __Value)
-#define SET_TX_DESC_USE_MAX_LEN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 16, 1, __Value)
-#define SET_TX_DESC_MAX_AGG_NUM_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 17, 5, __Value)
-#define SET_TX_DESC_NDPA_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 22, 2, __Value)
-#define SET_TX_DESC_AMPDU_MAX_TIME_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 24, 8, __Value)
-
-// Dword 4
-#define SET_TX_DESC_TX_RATE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 0, 7, __Value)
-#define SET_TX_DESC_DATA_RATE_FB_LIMIT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 8, 5, __Value)
-#define SET_TX_DESC_RTS_RATE_FB_LIMIT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 13, 4, __Value)
-#define SET_TX_DESC_RETRY_LIMIT_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 17, 1, __Value)
-#define SET_TX_DESC_DATA_RETRY_LIMIT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 18, 6, __Value)
-#define SET_TX_DESC_RTS_RATE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 24, 5, __Value)
-
-// Dword 5
-#define SET_TX_DESC_DATA_SC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 0, 4, __Value)
-#define SET_TX_DESC_DATA_SHORT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 4, 1, __Value)
-#define SET_TX_DESC_DATA_BW_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 5, 2, __Value)
-#define SET_TX_DESC_DATA_LDPC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 7, 1, __Value)
-#define SET_TX_DESC_DATA_STBC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 8, 2, __Value)
-#define SET_TX_DESC_CTROL_STBC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 10, 2, __Value)
-#define SET_TX_DESC_RTS_SHORT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 12, 1, __Value)
-#define SET_TX_DESC_RTS_SC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 13, 4, __Value)
-#define SET_TX_DESC_TX_ANT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 24, 4, __Value)
-
-// Dword 6
-#define SET_TX_DESC_SW_DEFINE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 0, 12, __Value)
-#define SET_TX_DESC_ANTSEL_A_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 16, 3, __Value)
-#define SET_TX_DESC_ANTSEL_B_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 19, 3, __Value)
-#define SET_TX_DESC_ANTSEL_C_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 22, 3, __Value)
-#define SET_TX_DESC_ANTSEL_D_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 25, 3, __Value)
-#define SET_TX_DESC_MBSSID_8821(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 12, 4, __Value)
-
-// Dword 7
-#define SET_TX_DESC_TX_BUFFER_SIZE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
-#define SET_TX_DESC_TX_DESC_CHECKSUM_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
-#define SET_TX_DESC_USB_TXAGG_NUM_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 24, 8, __Value)
-#ifdef CONFIG_SDIO_HCI
-#define SET_TX_DESC_SDIO_TXSEQ_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 16, 8, __Value)
-#endif
-
-// Dword 8
-#define SET_TX_DESC_HWSEQ_EN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 15, 1, __Value)
-
-// Dword 9
-#define SET_TX_DESC_SEQ_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 12, 12, __Value)
-
-// Dword 10
-#define SET_TX_DESC_TX_BUFFER_ADDRESS_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+40, 0, 32, __Value)
-#define GET_TX_DESC_TX_BUFFER_ADDRESS_8812(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc+40, 0, 32)
-
-// Dword 11
-#define SET_TX_DESC_NEXT_DESC_ADDRESS_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+48, 0, 32, __Value)
-
-
-#define SET_EARLYMODE_PKTNUM_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 4, __Value)
-#define SET_EARLYMODE_LEN0_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 15, __Value)
-#define SET_EARLYMODE_LEN1_1_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 19, 13, __Value)
-#define SET_EARLYMODE_LEN1_2_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 2, __Value)
-#define SET_EARLYMODE_LEN2_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 2, 15, __Value)
-#define SET_EARLYMODE_LEN3_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 17, 15, __Value)
-
-#ifdef CONFIG_TX_EARLY_MODE
-#define USB_DUMMY_OFFSET 2
-#else
-#define USB_DUMMY_OFFSET 1
-#endif
-#define USB_DUMMY_LENGTH (USB_DUMMY_OFFSET * PACKET_OFFSET_SZ)
-
-
-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_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);
-
-#ifdef CONFIG_USB_HCI
-s32 rtl8812au_init_xmit_priv(PADAPTER padapter);
-void rtl8812au_free_xmit_priv(PADAPTER padapter);
-s32 rtl8812au_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8812au_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8812au_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-s32 rtl8812au_xmit_buf_handler(PADAPTER padapter);
-void rtl8812au_xmit_tasklet(void *priv);
-s32 rtl8812au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
-#endif
-
-#ifdef CONFIG_PCI_HCI
-s32 rtl8812ae_init_xmit_priv(PADAPTER padapter);
-void rtl8812ae_free_xmit_priv(PADAPTER padapter);
-struct xmit_buf *rtl8812ae_dequeue_xmitbuf(struct rtw_tx_ring *ring);
-void rtl8812ae_xmitframe_resume(_adapter *padapter);
-s32 rtl8812ae_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8812ae_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8812ae_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
-void rtl8812ae_xmit_tasklet(void *priv);
-#endif
-
-#ifdef CONFIG_TX_EARLY_MODE
-void UpdateEarlyModeInfo8812(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmitbuf );
-#endif
-
-void _dbg_dump_tx_info(_adapter *padapter,int frame_tag,u8 *ptxdesc);
-
-u8 BWMapping_8812(PADAPTER Adapter, struct pkt_attrib *pattrib);
-
-u8 SCMapping_8812(PADAPTER Adapter, struct pkt_attrib *pattrib);
-
-#endif //__RTL8812_XMIT_H__
-
-#ifdef CONFIG_RTL8821A
-#include "rtl8821a_xmit.h"
-#endif // CONFIG_RTL8821A
-
+/******************************************************************************
+ *
+ * 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 __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)
+#define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value)
+#define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value)
+#define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value)
+#define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value)
+#define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value)
+#define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value)
+
+//
+//defined for TX DESC Operation
+//
+
+#define MAX_TID (15)
+
+//OFFSET 0
+#define OFFSET_SZ 0
+#define OFFSET_SHT 16
+#define BMC BIT(24)
+#define LSG BIT(26)
+#define FSG BIT(27)
+#define OWN BIT(31)
+
+
+//OFFSET 4
+#define PKT_OFFSET_SZ 0
+#define QSEL_SHT 8
+#define RATE_ID_SHT 16
+#define NAVUSEHDR BIT(20)
+#define SEC_TYPE_SHT 22
+#define PKT_OFFSET_SHT 26
+
+//OFFSET 8
+#define AGG_EN BIT(12)
+#define AGG_BK BIT(16)
+#define AMPDU_DENSITY_SHT 20
+#define ANTSEL_A BIT(24)
+#define ANTSEL_B BIT(25)
+#define TX_ANT_CCK_SHT 26
+#define TX_ANTL_SHT 28
+#define TX_ANT_HT_SHT 30
+
+//OFFSET 12
+#define SEQ_SHT 16
+#define EN_HWSEQ BIT(31)
+
+//OFFSET 16
+#define QOS BIT(6)
+#define HW_SSN BIT(7)
+#define USERATE BIT(8)
+#define DISDATAFB BIT(10)
+#define CTS_2_SELF BIT(11)
+#define RTS_EN BIT(12)
+#define HW_RTS_EN BIT(13)
+#define DATA_SHORT BIT(24)
+#define PWR_STATUS_SHT 15
+#define DATA_SC_SHT 20
+#define DATA_BW BIT(25)
+
+//OFFSET 20
+#define RTY_LMT_EN BIT(17)
+
+//OFFSET 20
+#define SGI BIT(6)
+#define USB_TXAGG_NUM_SHT 24
+
+typedef struct txdescriptor_8812
+{
+ // Offset 0
+ u32 pktlen:16;
+ u32 offset:8;
+ u32 bmc:1;
+ u32 htc:1;
+ u32 ls:1;
+ u32 fs:1;
+ u32 linip:1;
+ u32 noacm:1;
+ u32 gf:1;
+ u32 own:1;
+
+ // Offset 4
+ u32 macid:6;
+ u32 rsvd0406:2;
+ u32 qsel:5;
+ u32 rd_nav_ext:1;
+ u32 lsig_txop_en:1;
+ u32 pifs:1;
+ u32 rate_id:4;
+ u32 navusehdr:1;
+ u32 en_desc_id:1;
+ u32 sectype:2;
+ u32 rsvd0424:2;
+ u32 pkt_offset:5; // unit: 8 bytes
+ u32 rsvd0431:1;
+
+ // Offset 8
+ u32 rts_rc:6;
+ u32 data_rc:6;
+ u32 agg_en:1;
+ u32 rd_en:1;
+ u32 bar_rty_th:2;
+ u32 bk:1;
+ u32 morefrag:1;
+ u32 raw:1;
+ u32 ccx:1;
+ u32 ampdu_density:3;
+ u32 bt_null:1;
+ u32 ant_sel_a:1;
+ u32 ant_sel_b:1;
+ u32 tx_ant_cck:2;
+ u32 tx_antl:2;
+ u32 tx_ant_ht:2;
+
+ // Offset 12
+ u32 nextheadpage:8;
+ u32 tailpage:8;
+ u32 seq:12;
+ u32 cpu_handle:1;
+ u32 tag1:1;
+ u32 trigger_int:1;
+ u32 hwseq_en:1;
+
+ // Offset 16
+ u32 rtsrate:5;
+ u32 ap_dcfe:1;
+ u32 hwseq_sel:2;
+ u32 userate:1;
+ u32 disrtsfb:1;
+ u32 disdatafb:1;
+ u32 cts2self:1;
+ u32 rtsen:1;
+ u32 hw_rts_en:1;
+ u32 port_id:1;
+ u32 pwr_status:3;
+ u32 wait_dcts:1;
+ u32 cts2ap_en:1;
+ u32 data_sc:2;
+ u32 data_stbc:2;
+ u32 data_short:1;
+ u32 data_bw:1;
+ u32 rts_short:1;
+ u32 rts_bw:1;
+ u32 rts_sc:2;
+ u32 vcs_stbc:2;
+
+ // Offset 20
+ u32 datarate:6;
+ u32 sgi:1;
+ u32 try_rate:1;
+ u32 data_ratefb_lmt:5;
+ u32 rts_ratefb_lmt:4;
+ u32 rty_lmt_en:1;
+ u32 data_rt_lmt:6;
+ u32 usb_txagg_num:8;
+
+ // Offset 24
+ u32 txagg_a:5;
+ u32 txagg_b:5;
+ u32 use_max_len:1;
+ u32 max_agg_num:5;
+ u32 mcsg1_max_len:4;
+ u32 mcsg2_max_len:4;
+ u32 mcsg3_max_len:4;
+ u32 mcs7_sgi_max_len:4;
+
+ // Offset 28
+ u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB)
+ u32 mcsg4_max_len:4;
+ u32 mcsg5_max_len:4;
+ u32 mcsg6_max_len:4;
+ u32 mcs15_sgi_max_len:4;
+
+ // Offset 32
+ u32 rsvd32;
+
+ // Offset 36
+ u32 rsvd36;
+}TXDESC_8812, *PTXDESC_8812;
+
+
+// Dword 0
+#define GET_TX_DESC_OWN_8812(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc, 31, 1)
+#define SET_TX_DESC_PKT_SIZE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 0, 16, __Value)
+#define SET_TX_DESC_OFFSET_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 16, 8, __Value)
+#define SET_TX_DESC_BMC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 24, 1, __Value)
+#define SET_TX_DESC_HTC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 25, 1, __Value)
+#define SET_TX_DESC_LAST_SEG_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 26, 1, __Value)
+#define SET_TX_DESC_FIRST_SEG_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 27, 1, __Value)
+#define SET_TX_DESC_LINIP_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 28, 1, __Value)
+#define SET_TX_DESC_NO_ACM_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 29, 1, __Value)
+#define SET_TX_DESC_GF_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 30, 1, __Value)
+#define SET_TX_DESC_OWN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 31, 1, __Value)
+
+// Dword 1
+#define SET_TX_DESC_MACID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 0, 7, __Value)
+#define SET_TX_DESC_QUEUE_SEL_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 8, 5, __Value)
+#define SET_TX_DESC_RDG_NAV_EXT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 13, 1, __Value)
+#define SET_TX_DESC_LSIG_TXOP_EN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 14, 1, __Value)
+#define SET_TX_DESC_PIFS_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 15, 1, __Value)
+#define SET_TX_DESC_RATE_ID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 16, 5, __Value)
+#define SET_TX_DESC_EN_DESC_ID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 21, 1, __Value)
+#define SET_TX_DESC_SEC_TYPE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 22, 2, __Value)
+#define SET_TX_DESC_PKT_OFFSET_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 24, 5, __Value)
+
+// Dword 2
+#define SET_TX_DESC_PAID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 0, 9, __Value)
+#define SET_TX_DESC_CCA_RTS_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 10, 2, __Value)
+#define SET_TX_DESC_AGG_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 12, 1, __Value)
+#define SET_TX_DESC_RDG_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 13, 1, __Value)
+#define SET_TX_DESC_AGG_BREAK_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 16, 1, __Value)
+#define SET_TX_DESC_MORE_FRAG_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 17, 1, __Value)
+#define SET_TX_DESC_RAW_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 18, 1, __Value)
+#define SET_TX_DESC_SPE_RPT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 19, 1, __Value)
+#define SET_TX_DESC_AMPDU_DENSITY_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 20, 3, __Value)
+#define SET_TX_DESC_BT_INT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 23, 1, __Value)
+#define SET_TX_DESC_GID_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 6, __Value)
+
+// Dword 3
+#define SET_TX_DESC_WHEADER_LEN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 0, 4, __Value)
+#define SET_TX_DESC_CHK_EN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 4, 1, __Value)
+#define SET_TX_DESC_EARLY_MODE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 5, 1, __Value)
+#define SET_TX_DESC_HWSEQ_SEL_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 6, 2, __Value)
+#define SET_TX_DESC_USE_RATE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 8, 1, __Value)
+#define SET_TX_DESC_DISABLE_RTS_FB_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 9, 1, __Value)
+#define SET_TX_DESC_DISABLE_FB_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 10, 1, __Value)
+#define SET_TX_DESC_CTS2SELF_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 11, 1, __Value)
+#define SET_TX_DESC_RTS_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 12, 1, __Value)
+#define SET_TX_DESC_HW_RTS_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 13, 1, __Value)
+#define SET_TX_DESC_NAV_USE_HDR_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 15, 1, __Value)
+#define SET_TX_DESC_USE_MAX_LEN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 16, 1, __Value)
+#define SET_TX_DESC_MAX_AGG_NUM_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 17, 5, __Value)
+#define SET_TX_DESC_NDPA_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 22, 2, __Value)
+#define SET_TX_DESC_AMPDU_MAX_TIME_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+12, 24, 8, __Value)
+
+// Dword 4
+#define SET_TX_DESC_TX_RATE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 0, 7, __Value)
+#define SET_TX_DESC_DATA_RATE_FB_LIMIT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 8, 5, __Value)
+#define SET_TX_DESC_RTS_RATE_FB_LIMIT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 13, 4, __Value)
+#define SET_TX_DESC_RETRY_LIMIT_ENABLE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 17, 1, __Value)
+#define SET_TX_DESC_DATA_RETRY_LIMIT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 18, 6, __Value)
+#define SET_TX_DESC_RTS_RATE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 24, 5, __Value)
+
+// Dword 5
+#define SET_TX_DESC_DATA_SC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 0, 4, __Value)
+#define SET_TX_DESC_DATA_SHORT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 4, 1, __Value)
+#define SET_TX_DESC_DATA_BW_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 5, 2, __Value)
+#define SET_TX_DESC_DATA_LDPC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 7, 1, __Value)
+#define SET_TX_DESC_DATA_STBC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 8, 2, __Value)
+#define SET_TX_DESC_CTROL_STBC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 10, 2, __Value)
+#define SET_TX_DESC_RTS_SHORT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 12, 1, __Value)
+#define SET_TX_DESC_RTS_SC_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 13, 4, __Value)
+#define SET_TX_DESC_TX_ANT_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+20, 24, 4, __Value)
+
+// Dword 6
+#define SET_TX_DESC_SW_DEFINE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 0, 12, __Value)
+#define SET_TX_DESC_ANTSEL_A_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 16, 3, __Value)
+#define SET_TX_DESC_ANTSEL_B_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 19, 3, __Value)
+#define SET_TX_DESC_ANTSEL_C_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 22, 3, __Value)
+#define SET_TX_DESC_ANTSEL_D_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 25, 3, __Value)
+#define SET_TX_DESC_MBSSID_8821(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+24, 12, 4, __Value)
+
+// Dword 7
+#define SET_TX_DESC_TX_BUFFER_SIZE_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
+#define SET_TX_DESC_TX_DESC_CHECKSUM_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 0, 16, __Value)
+#define SET_TX_DESC_USB_TXAGG_NUM_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 24, 8, __Value)
+#ifdef CONFIG_SDIO_HCI
+#define SET_TX_DESC_SDIO_TXSEQ_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 16, 8, __Value)
+#endif
+
+// Dword 8
+#define SET_TX_DESC_HWSEQ_EN_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+32, 15, 1, __Value)
+
+// Dword 9
+#define SET_TX_DESC_SEQ_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 12, 12, __Value)
+
+// Dword 10
+#define SET_TX_DESC_TX_BUFFER_ADDRESS_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+40, 0, 32, __Value)
+#define GET_TX_DESC_TX_BUFFER_ADDRESS_8812(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc+40, 0, 32)
+
+// Dword 11
+#define SET_TX_DESC_NEXT_DESC_ADDRESS_8812(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+48, 0, 32, __Value)
+
+
+#define SET_EARLYMODE_PKTNUM_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 4, __Value)
+#define SET_EARLYMODE_LEN0_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 15, __Value)
+#define SET_EARLYMODE_LEN1_1_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 19, 13, __Value)
+#define SET_EARLYMODE_LEN1_2_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 2, __Value)
+#define SET_EARLYMODE_LEN2_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 2, 15, __Value)
+#define SET_EARLYMODE_LEN3_8812(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 17, 15, __Value)
+
+#ifdef CONFIG_TX_EARLY_MODE
+#define USB_DUMMY_OFFSET 2
+#else
+#define USB_DUMMY_OFFSET 1
+#endif
+#define USB_DUMMY_LENGTH (USB_DUMMY_OFFSET * PACKET_OFFSET_SZ)
+
+
+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_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);
+
+#ifdef CONFIG_USB_HCI
+s32 rtl8812au_init_xmit_priv(PADAPTER padapter);
+void rtl8812au_free_xmit_priv(PADAPTER padapter);
+s32 rtl8812au_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8812au_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8812au_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+s32 rtl8812au_xmit_buf_handler(PADAPTER padapter);
+void rtl8812au_xmit_tasklet(void *priv);
+s32 rtl8812au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
+#endif
+
+#ifdef CONFIG_PCI_HCI
+s32 rtl8812ae_init_xmit_priv(PADAPTER padapter);
+void rtl8812ae_free_xmit_priv(PADAPTER padapter);
+struct xmit_buf *rtl8812ae_dequeue_xmitbuf(struct rtw_tx_ring *ring);
+void rtl8812ae_xmitframe_resume(_adapter *padapter);
+s32 rtl8812ae_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8812ae_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8812ae_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
+void rtl8812ae_xmit_tasklet(void *priv);
+#endif
+
+#ifdef CONFIG_TX_EARLY_MODE
+void UpdateEarlyModeInfo8812(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmitbuf );
+#endif
+
+void _dbg_dump_tx_info(_adapter *padapter,int frame_tag,u8 *ptxdesc);
+
+u8 BWMapping_8812(PADAPTER Adapter, struct pkt_attrib *pattrib);
+
+u8 SCMapping_8812(PADAPTER Adapter, struct pkt_attrib *pattrib);
+
+#endif //__RTL8812_XMIT_H__
+
+#ifdef CONFIG_RTL8821A
+#include "rtl8821a_xmit.h"
+#endif // CONFIG_RTL8821A
+
diff --git a/rtl8xxx_EU/include/rtl8821a_spec.h b/rtl8xxx_EU/include/rtl8821a_spec.h
index a6fe31b..0492793 100755
--- a/rtl8xxx_EU/include/rtl8821a_spec.h
+++ b/rtl8xxx_EU/include/rtl8821a_spec.h
@@ -1,97 +1,97 @@
-/******************************************************************************
- *
- * Copyright(c) 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *******************************************************************************/
-#ifndef __RTL8821A_SPEC_H__
-#define __RTL8821A_SPEC_H__
-
-#include <drv_conf.h>
-// This file should based on "hal_com_reg.h"
-#include <hal_com_reg.h>
-// Because 8812a and 8821a is the same serial,
-// most of 8821a register definitions are the same as 8812a.
-#include <rtl8812a_spec.h>
-
-
-//============================================================
-// 8821A Regsiter offset definition
-//============================================================
-
-//============================================================
-// MAC register
-//============================================================
-
-//-----------------------------------------------------
-// 0x0000h ~ 0x00FFh System Configuration
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// 0x0100h ~ 0x01FFh MACTOP General Configuration
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// 0x0200h ~ 0x027Fh TXDMA Configuration
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// 0x0280h ~ 0x02FFh RXDMA Configuration
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// 0x0300h ~ 0x03FFh PCIe
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// 0x0400h ~ 0x047Fh Protocol Configuration
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// 0x0500h ~ 0x05FFh EDCA Configuration
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// 0x0600h ~ 0x07FFh WMAC Configuration
-//-----------------------------------------------------
-
-
-//============================================================
-// SDIO Bus Specification
-//============================================================
-
-//-----------------------------------------------------
-// SDIO CMD Address Mapping
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// I/O bus domain (Host)
-//-----------------------------------------------------
-
-//-----------------------------------------------------
-// SDIO register
-//-----------------------------------------------------
-#undef SDIO_REG_HCPWM1
-#define SDIO_REG_FREE_TXPG2 0x024
-#define SDIO_REG_HCPWM1 0x025
-
-
-//============================================================
-// Regsiter Bit and Content definition
-//============================================================
-
-
-#endif // __RTL8821A_SPEC_H__
-
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *******************************************************************************/
+#ifndef __RTL8821A_SPEC_H__
+#define __RTL8821A_SPEC_H__
+
+#include <drv_conf.h>
+// This file should based on "hal_com_reg.h"
+#include <hal_com_reg.h>
+// Because 8812a and 8821a is the same serial,
+// most of 8821a register definitions are the same as 8812a.
+#include <rtl8812a_spec.h>
+
+
+//============================================================
+// 8821A Regsiter offset definition
+//============================================================
+
+//============================================================
+// MAC register
+//============================================================
+
+//-----------------------------------------------------
+// 0x0000h ~ 0x00FFh System Configuration
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// 0x0100h ~ 0x01FFh MACTOP General Configuration
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// 0x0200h ~ 0x027Fh TXDMA Configuration
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// 0x0280h ~ 0x02FFh RXDMA Configuration
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// 0x0300h ~ 0x03FFh PCIe
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// 0x0400h ~ 0x047Fh Protocol Configuration
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// 0x0500h ~ 0x05FFh EDCA Configuration
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// 0x0600h ~ 0x07FFh WMAC Configuration
+//-----------------------------------------------------
+
+
+//============================================================
+// SDIO Bus Specification
+//============================================================
+
+//-----------------------------------------------------
+// SDIO CMD Address Mapping
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// I/O bus domain (Host)
+//-----------------------------------------------------
+
+//-----------------------------------------------------
+// SDIO register
+//-----------------------------------------------------
+#undef SDIO_REG_HCPWM1
+#define SDIO_REG_FREE_TXPG2 0x024
+#define SDIO_REG_HCPWM1 0x025
+
+
+//============================================================
+// Regsiter Bit and Content definition
+//============================================================
+
+
+#endif // __RTL8821A_SPEC_H__
+
diff --git a/rtl8xxx_EU/include/rtl8821a_xmit.h b/rtl8xxx_EU/include/rtl8821a_xmit.h
index 2b7320d..8128f80 100755
--- a/rtl8xxx_EU/include/rtl8821a_xmit.h
+++ b/rtl8xxx_EU/include/rtl8821a_xmit.h
@@ -1,180 +1,180 @@
-/******************************************************************************
- *
- * Copyright(c) 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __RTL8821A_XMIT_H__
-#define __RTL8821A_XMIT_H__
-
-#include <drv_types.h>
-
-typedef struct txdescriptor_8821a
-{
- // Offset 0
- u32 pktlen:16;
- u32 offset:8;
- u32 bmc:1;
- u32 htc:1;
- u32 rsvd0026:1;
- u32 rsvd0027:1;
- u32 linip:1;
- u32 noacm:1;
- u32 gf:1;
- u32 rsvd0031:1;
-
- // Offset 4
- u32 macid:7;
- u32 rsvd0407:1;
- u32 qsel:5;
- u32 rdg_nav_ext:1;
- u32 lsig_txop_en:1;
- u32 pifs:1;
- u32 rate_id:5;
- u32 en_desc_id:1;
- u32 sectype:2;
- u32 pkt_offset:5; // unit: 8 bytes
- u32 moredata:1;
- u32 txop_ps_cap:1;
- u32 txop_ps_mode:1;
-
- // Offset 8
- u32 p_aid:9;
- u32 rsvd0809:1;
- u32 cca_rts:2;
- u32 agg_en:1;
- u32 rdg_en:1;
- u32 null_0:1;
- u32 null_1:1;
- u32 bk:1;
- u32 morefrag:1;
- u32 raw:1;
- u32 spe_rpt:1;
- u32 ampdu_density:3;
- u32 bt_null:1;
- u32 g_id:6;
- u32 rsvd0830:2;
-
- // Offset 12
- u32 wheader_len:4;
- u32 chk_en:1;
- u32 early_rate:1;
- u32 hw_ssn_sel:2;
- u32 userate:1;
- u32 disrtsfb:1;
- u32 disdatafb:1;
- u32 cts2self:1;
- u32 rtsen:1;
- u32 hw_rts_en:1;
- u32 port_id:1;
- u32 navusehdr:1;
- u32 use_max_len:1;
- u32 max_agg_num:5;
- u32 ndpa:2;
- u32 ampdu_max_time:8;
-
- // Offset 16
- u32 datarate:7;
- u32 try_rate:1;
- u32 data_ratefb_lmt:5;
- u32 rts_ratefb_lmt:4;
- u32 rty_lmt_en:1;
- u32 data_rt_lmt:6;
- u32 rtsrate:5;
- u32 pcts_en:1;
- u32 pcts_mask_idx:2;
-
- // Offset 20
- u32 data_sc:4;
- u32 data_short:1;
- u32 data_bw:2;
- u32 data_ldpc:1;
- u32 data_stbc:2;
- u32 vcs_stbc:2;
- u32 rts_short:1;
- u32 rts_sc:4;
- u32 rsvd2016:7;
- u32 tx_ant:4;
- u32 txpwr_offset:3;
- u32 rsvd2031:1;
-
- // Offset 24
- u32 sw_define:12;
- u32 mbssid:4;
- u32 antsel_A:3;
- u32 antsel_B:3;
- u32 antsel_C:3;
- u32 antsel_D:3;
- u32 rsvd2428:4;
-
- // Offset 28
- u32 checksum:16;
- u32 rsvd2816:8;
- u32 usb_txagg_num:8;
-
- // Offset 32
- u32 rts_rc:6;
- u32 bar_rty_th:2;
- u32 data_rc:6;
- u32 rsvd3214:1;
- u32 en_hwseq:1;
- u32 nextneadpage:8;
- u32 tailpage:8;
-
- // Offset 36
- u32 padding_len:11;
- u32 txbf_path:1;
- u32 seq:12;
- u32 final_data_rate:8;
-}TXDESC_8821A, *PTXDESC_8821A;
-
-#ifdef CONFIG_SDIO_HCI
-s32 InitXmitPriv8821AS(PADAPTER padapter);
-void FreeXmitPriv8821AS(PADAPTER padapter);
-s32 XmitBufHandler8821AS(PADAPTER padapter);
-s32 MgntXmit8821AS(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 HalXmitNoLock8821AS(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 HalXmit8821AS(PADAPTER padapter, struct xmit_frame *pxmitframe);
-#ifndef CONFIG_SDIO_TX_TASKLET
-thread_return XmitThread8821AS(thread_context context);
-#endif // !CONFIG_SDIO_TX_TASKLET
-#endif // CONFIG_SDIO_HCI
-
-#if 0
-#ifdef CONFIG_USB_HCI
-s32 rtl8821au_init_xmit_priv(PADAPTER padapter);
-void rtl8821au_free_xmit_priv(PADAPTER padapter);
-s32 rtl8821au_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8821au_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-s32 rtl8821au_hal_xmitframe_enqueue(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8821au_xmit_buf_handler(PADAPTER padapter);
-void rtl8821au_xmit_tasklet(void *priv);
-s32 rtl8821au_xmitframe_complete(PADAPTER padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
-#endif // CONFIG_USB_HCI
-
-#ifdef CONFIG_PCI_HCI
-s32 rtl8821e_init_xmit_priv(PADAPTER padapter);
-void rtl8821e_free_xmit_priv(PADAPTER padapter);
-struct xmit_buf* rtl8821e_dequeue_xmitbuf(struct rtw_tx_ring *ring);
-void rtl8821e_xmitframe_resume(PADAPTER padapter);
-s32 rtl8821e_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
-s32 rtl8821e_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
-void rtl8821e_xmit_tasklet(void *priv);
-#endif // CONFIG_PCI_HCI
-#endif
-
-#endif //__RTL8821_XMIT_H__
-
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __RTL8821A_XMIT_H__
+#define __RTL8821A_XMIT_H__
+
+#include <drv_types.h>
+
+typedef struct txdescriptor_8821a
+{
+ // Offset 0
+ u32 pktlen:16;
+ u32 offset:8;
+ u32 bmc:1;
+ u32 htc:1;
+ u32 rsvd0026:1;
+ u32 rsvd0027:1;
+ u32 linip:1;
+ u32 noacm:1;
+ u32 gf:1;
+ u32 rsvd0031:1;
+
+ // Offset 4
+ u32 macid:7;
+ u32 rsvd0407:1;
+ u32 qsel:5;
+ u32 rdg_nav_ext:1;
+ u32 lsig_txop_en:1;
+ u32 pifs:1;
+ u32 rate_id:5;
+ u32 en_desc_id:1;
+ u32 sectype:2;
+ u32 pkt_offset:5; // unit: 8 bytes
+ u32 moredata:1;
+ u32 txop_ps_cap:1;
+ u32 txop_ps_mode:1;
+
+ // Offset 8
+ u32 p_aid:9;
+ u32 rsvd0809:1;
+ u32 cca_rts:2;
+ u32 agg_en:1;
+ u32 rdg_en:1;
+ u32 null_0:1;
+ u32 null_1:1;
+ u32 bk:1;
+ u32 morefrag:1;
+ u32 raw:1;
+ u32 spe_rpt:1;
+ u32 ampdu_density:3;
+ u32 bt_null:1;
+ u32 g_id:6;
+ u32 rsvd0830:2;
+
+ // Offset 12
+ u32 wheader_len:4;
+ u32 chk_en:1;
+ u32 early_rate:1;
+ u32 hw_ssn_sel:2;
+ u32 userate:1;
+ u32 disrtsfb:1;
+ u32 disdatafb:1;
+ u32 cts2self:1;
+ u32 rtsen:1;
+ u32 hw_rts_en:1;
+ u32 port_id:1;
+ u32 navusehdr:1;
+ u32 use_max_len:1;
+ u32 max_agg_num:5;
+ u32 ndpa:2;
+ u32 ampdu_max_time:8;
+
+ // Offset 16
+ u32 datarate:7;
+ u32 try_rate:1;
+ u32 data_ratefb_lmt:5;
+ u32 rts_ratefb_lmt:4;
+ u32 rty_lmt_en:1;
+ u32 data_rt_lmt:6;
+ u32 rtsrate:5;
+ u32 pcts_en:1;
+ u32 pcts_mask_idx:2;
+
+ // Offset 20
+ u32 data_sc:4;
+ u32 data_short:1;
+ u32 data_bw:2;
+ u32 data_ldpc:1;
+ u32 data_stbc:2;
+ u32 vcs_stbc:2;
+ u32 rts_short:1;
+ u32 rts_sc:4;
+ u32 rsvd2016:7;
+ u32 tx_ant:4;
+ u32 txpwr_offset:3;
+ u32 rsvd2031:1;
+
+ // Offset 24
+ u32 sw_define:12;
+ u32 mbssid:4;
+ u32 antsel_A:3;
+ u32 antsel_B:3;
+ u32 antsel_C:3;
+ u32 antsel_D:3;
+ u32 rsvd2428:4;
+
+ // Offset 28
+ u32 checksum:16;
+ u32 rsvd2816:8;
+ u32 usb_txagg_num:8;
+
+ // Offset 32
+ u32 rts_rc:6;
+ u32 bar_rty_th:2;
+ u32 data_rc:6;
+ u32 rsvd3214:1;
+ u32 en_hwseq:1;
+ u32 nextneadpage:8;
+ u32 tailpage:8;
+
+ // Offset 36
+ u32 padding_len:11;
+ u32 txbf_path:1;
+ u32 seq:12;
+ u32 final_data_rate:8;
+}TXDESC_8821A, *PTXDESC_8821A;
+
+#ifdef CONFIG_SDIO_HCI
+s32 InitXmitPriv8821AS(PADAPTER padapter);
+void FreeXmitPriv8821AS(PADAPTER padapter);
+s32 XmitBufHandler8821AS(PADAPTER padapter);
+s32 MgntXmit8821AS(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 HalXmitNoLock8821AS(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 HalXmit8821AS(PADAPTER padapter, struct xmit_frame *pxmitframe);
+#ifndef CONFIG_SDIO_TX_TASKLET
+thread_return XmitThread8821AS(thread_context context);
+#endif // !CONFIG_SDIO_TX_TASKLET
+#endif // CONFIG_SDIO_HCI
+
+#if 0
+#ifdef CONFIG_USB_HCI
+s32 rtl8821au_init_xmit_priv(PADAPTER padapter);
+void rtl8821au_free_xmit_priv(PADAPTER padapter);
+s32 rtl8821au_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8821au_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+s32 rtl8821au_hal_xmitframe_enqueue(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8821au_xmit_buf_handler(PADAPTER padapter);
+void rtl8821au_xmit_tasklet(void *priv);
+s32 rtl8821au_xmitframe_complete(PADAPTER padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
+#endif // CONFIG_USB_HCI
+
+#ifdef CONFIG_PCI_HCI
+s32 rtl8821e_init_xmit_priv(PADAPTER padapter);
+void rtl8821e_free_xmit_priv(PADAPTER padapter);
+struct xmit_buf* rtl8821e_dequeue_xmitbuf(struct rtw_tx_ring *ring);
+void rtl8821e_xmitframe_resume(PADAPTER padapter);
+s32 rtl8821e_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
+s32 rtl8821e_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
+void rtl8821e_xmit_tasklet(void *priv);
+#endif // CONFIG_PCI_HCI
+#endif
+
+#endif //__RTL8821_XMIT_H__
+
diff --git a/rtl8xxx_EU/include/rtw_android.h b/rtl8xxx_EU/include/rtw_android.h
index 5f3892c..9cae3eb 100755
--- a/rtl8xxx_EU/include/rtw_android.h
+++ b/rtl8xxx_EU/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,
@@ -54,6 +57,7 @@ enum ANDROID_WIFI_CMD {
ANDROID_WIFI_CMD_MACADDR,
+ ANDROID_WIFI_CMD_BLOCK_SCAN,
ANDROID_WIFI_CMD_BLOCK,
ANDROID_WIFI_CMD_WFD_ENABLE,
diff --git a/rtl8xxx_EU/include/rtw_ap.h b/rtl8xxx_EU/include/rtw_ap.h
index dccd5fa..150238e 100755
--- a/rtl8xxx_EU/include/rtw_ap.h
+++ b/rtl8xxx_EU/include/rtw_ap.h
@@ -1,76 +1,76 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __RTW_AP_H_
-#define __RTW_AP_H_
-
-
-#ifdef CONFIG_AP_MODE
-
-//external function
-extern void rtw_indicate_sta_assoc_event(_adapter *padapter, struct sta_info *psta);
-extern void rtw_indicate_sta_disassoc_event(_adapter *padapter, struct sta_info *psta);
-
-
-void init_mlme_ap_info(_adapter *padapter);
-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 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);
-void start_bss_network(_adapter *padapter, u8 *pbuf);
-int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len);
-void rtw_ap_restore_network(_adapter *padapter);
-void rtw_set_macaddr_acl(_adapter *padapter, int mode);
-int rtw_acl_add_sta(_adapter *padapter, u8 *addr);
-int rtw_acl_remove_sta(_adapter *padapter, u8 *addr);
-
-u8 rtw_ap_set_pairwise_key(_adapter *padapter, struct sta_info *psta);
-int rtw_ap_set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid);
-int rtw_ap_set_wep_key(_adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set_tx);
-
-#ifdef CONFIG_NATIVEAP_MLME
-void associated_clients_update(_adapter *padapter, u8 updated);
-void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta);
-u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta);
-void sta_info_update(_adapter *padapter, struct sta_info *psta);
-void ap_sta_info_defer_update(_adapter *padapter, struct sta_info *psta);
-u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reason);
-int rtw_sta_flush(_adapter *padapter);
-int rtw_ap_inform_ch_switch(_adapter *padapter, u8 new_ch, u8 ch_offset);
-void start_ap_mode(_adapter *padapter);
-void stop_ap_mode(_adapter *padapter);
-#endif
-
-#ifdef CONFIG_CONCURRENT_MODE
-void concurrent_set_ap_chbw(_adapter *padapter, u8 channel, u8 channel_offset, u8 bwmode);
-#endif //CONFIG_CONCURRENT_MODE
-
-
-#ifdef CONFIG_AUTO_AP_MODE
-extern void rtw_start_auto_ap(_adapter *adapter);
-#endif //CONFIG_AUTO_AP_MODE
-
-#endif //end of CONFIG_AP_MODE
-
-#endif
-void update_bmc_sta(_adapter *padapter);
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __RTW_AP_H_
+#define __RTW_AP_H_
+
+
+#ifdef CONFIG_AP_MODE
+
+//external function
+extern void rtw_indicate_sta_assoc_event(_adapter *padapter, struct sta_info *psta);
+extern void rtw_indicate_sta_disassoc_event(_adapter *padapter, struct sta_info *psta);
+
+
+void init_mlme_ap_info(_adapter *padapter);
+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 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);
+void start_bss_network(_adapter *padapter, u8 *pbuf);
+int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len);
+void rtw_ap_restore_network(_adapter *padapter);
+void rtw_set_macaddr_acl(_adapter *padapter, int mode);
+int rtw_acl_add_sta(_adapter *padapter, u8 *addr);
+int rtw_acl_remove_sta(_adapter *padapter, u8 *addr);
+
+u8 rtw_ap_set_pairwise_key(_adapter *padapter, struct sta_info *psta);
+int rtw_ap_set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid);
+int rtw_ap_set_wep_key(_adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set_tx);
+
+#ifdef CONFIG_NATIVEAP_MLME
+void associated_clients_update(_adapter *padapter, u8 updated);
+void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta);
+u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta);
+void sta_info_update(_adapter *padapter, struct sta_info *psta);
+void ap_sta_info_defer_update(_adapter *padapter, struct sta_info *psta);
+u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reason);
+int rtw_sta_flush(_adapter *padapter);
+int rtw_ap_inform_ch_switch(_adapter *padapter, u8 new_ch, u8 ch_offset);
+void start_ap_mode(_adapter *padapter);
+void stop_ap_mode(_adapter *padapter);
+#endif
+
+#ifdef CONFIG_CONCURRENT_MODE
+void concurrent_set_ap_chbw(_adapter *padapter, u8 channel, u8 channel_offset, u8 bwmode);
+#endif //CONFIG_CONCURRENT_MODE
+
+
+#ifdef CONFIG_AUTO_AP_MODE
+extern void rtw_start_auto_ap(_adapter *adapter);
+#endif //CONFIG_AUTO_AP_MODE
+
+#endif //end of CONFIG_AP_MODE
+
+#endif
+void update_bmc_sta(_adapter *padapter);
diff --git a/rtl8xxx_EU/include/rtw_beamforming.h b/rtl8xxx_EU/include/rtw_beamforming.h
index 69d7819..3f2c5a1 100755
--- a/rtl8xxx_EU/include/rtw_beamforming.h
+++ b/rtl8xxx_EU/include/rtw_beamforming.h
@@ -1,142 +1,142 @@
-/******************************************************************************
- *
- * 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_BEAMFORMING_H_
-#define __RTW_BEAMFORMING_H_
-
-#define BEAMFORMING_ENTRY_NUM 2
-#define GET_BEAMFORM_INFO(_pmlmepriv) ((struct beamforming_info *)(&(_pmlmepriv)->beamforming_info))
-
-typedef enum _BEAMFORMING_ENTRY_STATE
-{
- BEAMFORMING_ENTRY_STATE_UNINITIALIZE,
- BEAMFORMING_ENTRY_STATE_INITIALIZEING,
- BEAMFORMING_ENTRY_STATE_INITIALIZED,
- BEAMFORMING_ENTRY_STATE_PROGRESSING,
- BEAMFORMING_ENTRY_STATE_PROGRESSED,
-}BEAMFORMING_ENTRY_STATE, *PBEAMFORMING_ENTRY_STATE;
-
-
-typedef enum _BEAMFORMING_STATE
-{
- BEAMFORMING_STATE_IDLE,
- BEAMFORMING_STATE_START,
- BEAMFORMING_STATE_END,
-}BEAMFORMING_STATE, *PBEAMFORMING_STATE;
-
-
-typedef enum _BEAMFORMING_CAP
-{
- BEAMFORMING_CAP_NONE = 0x0,
- BEAMFORMER_CAP_HT_EXPLICIT = 0x1,
- BEAMFORMEE_CAP_HT_EXPLICIT = 0x2,
- BEAMFORMER_CAP_VHT_SU = 0x4, // Self has er Cap, because Reg er & peer ee
- BEAMFORMEE_CAP_VHT_SU = 0x8, // Self has ee Cap, because Reg ee & peer er
- BEAMFORMER_CAP = 0x10,
- BEAMFORMEE_CAP = 0x20,
-}BEAMFORMING_CAP, *PBEAMFORMING_CAP;
-
-
-typedef enum _SOUNDING_MODE
-{
- SOUNDING_SW_VHT_TIMER = 0x0,
- SOUNDING_SW_HT_TIMER = 0x1,
- SOUNDING_STOP_All_TIMER = 0x2,
- SOUNDING_HW_VHT_TIMER = 0x3,
- SOUNDING_HW_HT_TIMER = 0x4,
- SOUNDING_STOP_OID_TIMER = 0x5,
- SOUNDING_AUTO_VHT_TIMER = 0x6,
- SOUNDING_AUTO_HT_TIMER = 0x7,
- SOUNDING_FW_VHT_TIMER = 0x8,
- SOUNDING_FW_HT_TIMER = 0x9,
-}SOUNDING_MODE, *PSOUNDING_MODE;
-
-
-enum BEAMFORMING_CTRL_TYPE
-{
- BEAMFORMING_CTRL_ENTER = 0,
- BEAMFORMING_CTRL_LEAVE = 1,
- BEAMFORMING_CTRL_START_PERIOD = 2,
- BEAMFORMING_CTRL_END_PERIOD = 3,
- BEAMFORMING_CTRL_SOUNDING_FAIL=4,
- BEAMFORMING_CTRL_SOUNDING_CLK=5,
-};
-
-struct beamforming_entry {
- BOOLEAN bUsed;
- BOOLEAN bSound;
- u16 aid; // Used to construct AID field of NDPA packet.
- u16 mac_id; // Used to Set Reg42C in IBSS mode.
- u16 p_aid; // Used to fill Reg42C & Reg714 to compare with P_AID of Tx DESC.
- u8 mac_addr[6];// Used to fill Reg6E4 to fill Mac address of CSI report frame.
- CHANNEL_WIDTH sound_bw; // Sounding BandWidth
- u16 sound_period;
- BEAMFORMING_CAP beamforming_entry_cap;
- BEAMFORMING_ENTRY_STATE beamforming_entry_state;
- u8 LogSeq;
- u8 LogRetryCnt;
- u8 LogSuccessCnt;
- u8 LogStatusFailCnt;
- u8 PreCsiReport[327];
- u8 DefaultCsiCnt;
- BOOLEAN bDefaultCSI;
-};
-
-struct sounding_info {
- u8 sound_idx;
- CHANNEL_WIDTH sound_bw;
- SOUNDING_MODE sound_mode;
- u16 sound_period;
-};
-
-struct beamforming_info {
- BEAMFORMING_CAP beamforming_cap;
- BEAMFORMING_STATE beamforming_state;
- struct beamforming_entry beamforming_entry[BEAMFORMING_ENTRY_NUM];
- u8 beamforming_cur_idx;
- u8 beamforming_in_progress;
- u8 sounding_sequence;
- struct sounding_info sounding_info;
-};
-
-struct rtw_ndpa_sta_info {
- u16 aid:12;
- u16 feedback_type:1;
- u16 nc_index:3;
-};
-
-BEAMFORMING_CAP beamforming_get_entry_beam_cap_by_mac_id(PVOID pmlmepriv ,u8 mac_id);
-void beamforming_notify(PADAPTER adapter);
-BEAMFORMING_CAP beamforming_get_beamform_cap(struct beamforming_info *pBeamInfo);
-
-u32 beamforming_get_report_frame(PADAPTER Adapter, union recv_frame *precv_frame);
-void beamforming_get_ndpa_frame(PADAPTER Adapter, union recv_frame *precv_frame);
-
-BOOLEAN beamforming_send_ht_ndpa_packet(PADAPTER Adapter, u8 *ra, CHANNEL_WIDTH bw, u8 qidx);
-BOOLEAN beamforming_send_vht_ndpa_packet(PADAPTER Adapter, u8 *ra, u16 aid, CHANNEL_WIDTH bw, u8 qidx);
-
-void beamforming_check_sounding_success(PADAPTER Adapter,BOOLEAN status);
-
-void beamforming_watchdog(PADAPTER Adapter);
-
-void beamforming_wk_hdl(_adapter *padapter, u8 type, u8 *pbuf);
-u8 beamforming_wk_cmd(_adapter*padapter, s32 type, u8 *pbuf, s32 size, u8 enqueue);
-
-#endif
-
+/******************************************************************************
+ *
+ * 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_BEAMFORMING_H_
+#define __RTW_BEAMFORMING_H_
+
+#define BEAMFORMING_ENTRY_NUM 2
+#define GET_BEAMFORM_INFO(_pmlmepriv) ((struct beamforming_info *)(&(_pmlmepriv)->beamforming_info))
+
+typedef enum _BEAMFORMING_ENTRY_STATE
+{
+ BEAMFORMING_ENTRY_STATE_UNINITIALIZE,
+ BEAMFORMING_ENTRY_STATE_INITIALIZEING,
+ BEAMFORMING_ENTRY_STATE_INITIALIZED,
+ BEAMFORMING_ENTRY_STATE_PROGRESSING,
+ BEAMFORMING_ENTRY_STATE_PROGRESSED,
+}BEAMFORMING_ENTRY_STATE, *PBEAMFORMING_ENTRY_STATE;
+
+
+typedef enum _BEAMFORMING_STATE
+{
+ BEAMFORMING_STATE_IDLE,
+ BEAMFORMING_STATE_START,
+ BEAMFORMING_STATE_END,
+}BEAMFORMING_STATE, *PBEAMFORMING_STATE;
+
+
+typedef enum _BEAMFORMING_CAP
+{
+ BEAMFORMING_CAP_NONE = 0x0,
+ BEAMFORMER_CAP_HT_EXPLICIT = 0x1,
+ BEAMFORMEE_CAP_HT_EXPLICIT = 0x2,
+ BEAMFORMER_CAP_VHT_SU = 0x4, // Self has er Cap, because Reg er & peer ee
+ BEAMFORMEE_CAP_VHT_SU = 0x8, // Self has ee Cap, because Reg ee & peer er
+ BEAMFORMER_CAP = 0x10,
+ BEAMFORMEE_CAP = 0x20,
+}BEAMFORMING_CAP, *PBEAMFORMING_CAP;
+
+
+typedef enum _SOUNDING_MODE
+{
+ SOUNDING_SW_VHT_TIMER = 0x0,
+ SOUNDING_SW_HT_TIMER = 0x1,
+ SOUNDING_STOP_All_TIMER = 0x2,
+ SOUNDING_HW_VHT_TIMER = 0x3,
+ SOUNDING_HW_HT_TIMER = 0x4,
+ SOUNDING_STOP_OID_TIMER = 0x5,
+ SOUNDING_AUTO_VHT_TIMER = 0x6,
+ SOUNDING_AUTO_HT_TIMER = 0x7,
+ SOUNDING_FW_VHT_TIMER = 0x8,
+ SOUNDING_FW_HT_TIMER = 0x9,
+}SOUNDING_MODE, *PSOUNDING_MODE;
+
+
+enum BEAMFORMING_CTRL_TYPE
+{
+ BEAMFORMING_CTRL_ENTER = 0,
+ BEAMFORMING_CTRL_LEAVE = 1,
+ BEAMFORMING_CTRL_START_PERIOD = 2,
+ BEAMFORMING_CTRL_END_PERIOD = 3,
+ BEAMFORMING_CTRL_SOUNDING_FAIL=4,
+ BEAMFORMING_CTRL_SOUNDING_CLK=5,
+};
+
+struct beamforming_entry {
+ BOOLEAN bUsed;
+ BOOLEAN bSound;
+ u16 aid; // Used to construct AID field of NDPA packet.
+ u16 mac_id; // Used to Set Reg42C in IBSS mode.
+ u16 p_aid; // Used to fill Reg42C & Reg714 to compare with P_AID of Tx DESC.
+ u8 mac_addr[6];// Used to fill Reg6E4 to fill Mac address of CSI report frame.
+ CHANNEL_WIDTH sound_bw; // Sounding BandWidth
+ u16 sound_period;
+ BEAMFORMING_CAP beamforming_entry_cap;
+ BEAMFORMING_ENTRY_STATE beamforming_entry_state;
+ u8 LogSeq;
+ u8 LogRetryCnt;
+ u8 LogSuccessCnt;
+ u8 LogStatusFailCnt;
+ u8 PreCsiReport[327];
+ u8 DefaultCsiCnt;
+ BOOLEAN bDefaultCSI;
+};
+
+struct sounding_info {
+ u8 sound_idx;
+ CHANNEL_WIDTH sound_bw;
+ SOUNDING_MODE sound_mode;
+ u16 sound_period;
+};
+
+struct beamforming_info {
+ BEAMFORMING_CAP beamforming_cap;
+ BEAMFORMING_STATE beamforming_state;
+ struct beamforming_entry beamforming_entry[BEAMFORMING_ENTRY_NUM];
+ u8 beamforming_cur_idx;
+ u8 beamforming_in_progress;
+ u8 sounding_sequence;
+ struct sounding_info sounding_info;
+};
+
+struct rtw_ndpa_sta_info {
+ u16 aid:12;
+ u16 feedback_type:1;
+ u16 nc_index:3;
+};
+
+BEAMFORMING_CAP beamforming_get_entry_beam_cap_by_mac_id(PVOID pmlmepriv ,u8 mac_id);
+void beamforming_notify(PADAPTER adapter);
+BEAMFORMING_CAP beamforming_get_beamform_cap(struct beamforming_info *pBeamInfo);
+
+u32 beamforming_get_report_frame(PADAPTER Adapter, union recv_frame *precv_frame);
+void beamforming_get_ndpa_frame(PADAPTER Adapter, union recv_frame *precv_frame);
+
+BOOLEAN beamforming_send_ht_ndpa_packet(PADAPTER Adapter, u8 *ra, CHANNEL_WIDTH bw, u8 qidx);
+BOOLEAN beamforming_send_vht_ndpa_packet(PADAPTER Adapter, u8 *ra, u16 aid, CHANNEL_WIDTH bw, u8 qidx);
+
+void beamforming_check_sounding_success(PADAPTER Adapter,BOOLEAN status);
+
+void beamforming_watchdog(PADAPTER Adapter);
+
+void beamforming_wk_hdl(_adapter *padapter, u8 type, u8 *pbuf);
+u8 beamforming_wk_cmd(_adapter*padapter, s32 type, u8 *pbuf, s32 size, u8 enqueue);
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtw_bt_mp.h b/rtl8xxx_EU/include/rtw_bt_mp.h
index 7a1fa0d..4892c26 100755
--- a/rtl8xxx_EU/include/rtw_bt_mp.h
+++ b/rtl8xxx_EU/include/rtw_bt_mp.h
@@ -1,319 +1,319 @@
-/******************************************************************************
- *
- * 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_BT_MP_H
-#define __RTW_BT_MP_H
-
-
-#if(MP_DRIVER == 1)
-
-#pragma pack(1)
-
-// definition for BT_UP_OP_BT_READY
-#define MP_BT_NOT_READY 0
-#define MP_BT_READY 1
-
-// definition for BT_UP_OP_BT_SET_MODE
-typedef enum _MP_BT_MODE{
- MP_BT_MODE_RF_TXRX_TEST_MODE = 0,
- MP_BT_MODE_BT20_DUT_TEST_MODE = 1,
- MP_BT_MODE_BT40_DIRECT_TEST_MODE = 2,
- MP_BT_MODE_CONNECT_TEST_MODE = 3,
- MP_BT_MODE_MAX
-}MP_BT_MODE,*PMP_BT_MODE;
-
-
-// definition for BT_UP_OP_BT_SET_TX_RX_PARAMETER
-typedef struct _BT_TXRX_PARAMETERS{
- u1Byte txrxChannel;
- u4Byte txrxTxPktCnt;
- u1Byte txrxTxPktInterval;
- u1Byte txrxPayloadType;
- u1Byte txrxPktType;
- u2Byte txrxPayloadLen;
- u4Byte txrxPktHeader;
- u1Byte txrxWhitenCoeff;
- u1Byte txrxBdaddr[6];
- u1Byte txrxTxGainIndex;
-} BT_TXRX_PARAMETERS, *PBT_TXRX_PARAMETERS;
-
-// txrxPktType
-typedef enum _MP_BT_PKT_TYPE{
- MP_BT_PKT_DH1 = 0,
- MP_BT_PKT_DH3 = 1,
- MP_BT_PKT_DH5 = 2,
- MP_BT_PKT_2DH1 = 3,
- MP_BT_PKT_2DH3 = 4,
- MP_BT_PKT_2DH5 = 5,
- MP_BT_PKT_3DH1 = 6,
- MP_BT_PKT_3DH3 = 7,
- MP_BT_PKT_3DH5 = 8,
- MP_BT_PKT_LE = 9,
- MP_BT_PKT_MAX
-}MP_BT_PKT_TYPE,*PMP_BT_PKT_TYPE;
-// txrxPayloadType
-typedef enum _MP_BT_PAYLOAD_TYPE{
- MP_BT_PAYLOAD_01010101 = 0,
- MP_BT_PAYLOAD_ALL_1 = 1,
- MP_BT_PAYLOAD_ALL_0 = 2,
- MP_BT_PAYLOAD_11110000 = 3,
- MP_BT_PAYLOAD_PRBS9 = 4,
- MP_BT_PAYLOAD_MAX
-}MP_BT_PAYLOAD_TYPE,*PMP_BT_PAYLOAD_TYPE;
-
-
-// definition for BT_UP_OP_BT_TEST_CTRL
-typedef enum _MP_BT_TEST_CTRL{
- MP_BT_TEST_STOP_ALL_TESTS = 0,
- MP_BT_TEST_START_RX_TEST = 1,
- MP_BT_TEST_START_PACKET_TX_TEST = 2,
- MP_BT_TEST_START_CONTINUOUS_TX_TEST = 3,
- MP_BT_TEST_START_INQUIRY_SCAN_TEST = 4,
- MP_BT_TEST_START_PAGE_SCAN_TEST = 5,
- MP_BT_TEST_START_INQUIRY_PAGE_SCAN_TEST = 6,
- MP_BT_TEST_START_LEGACY_CONNECT_TEST = 7,
- MP_BT_TEST_START_LE_CONNECT_TEST_INITIATOR = 8,
- MP_BT_TEST_START_LE_CONNECT_TEST_ADVERTISER = 9,
- MP_BT_TEST_MAX
-}MP_BT_TEST_CTRL,*PMP_BT_TEST_CTRL;
-
-
-typedef enum _RTL_EXT_C2H_EVT
-{
- EXT_C2H_WIFI_FW_ACTIVE_RSP = 0,
- EXT_C2H_TRIG_BY_BT_FW = 1,
- MAX_EXT_C2HEVENT
-}RTL_EXT_C2H_EVT;
-
-
-// return status definition to the user layer
-typedef enum _BT_CTRL_STATUS{
- BT_STATUS_SUCCESS = 0x00, // Success
- BT_STATUS_BT_OP_SUCCESS = 0x01, // bt fw op execution success
- BT_STATUS_H2C_SUCCESS = 0x02, // H2c success
- BT_STATUS_H2C_TIMTOUT = 0x03, // H2c timeout
- BT_STATUS_H2C_BT_NO_RSP = 0x04, // H2c sent, bt no rsp
- BT_STATUS_C2H_SUCCESS = 0x05, // C2h success
- BT_STATUS_C2H_REQNUM_MISMATCH = 0x06, // bt fw wrong rsp
- BT_STATUS_OPCODE_U_VERSION_MISMATCH = 0x07, // Upper layer OP code version mismatch.
- BT_STATUS_OPCODE_L_VERSION_MISMATCH = 0x08, // Lower layer OP code version mismatch.
- BT_STATUS_UNKNOWN_OPCODE_U = 0x09, // Unknown Upper layer OP code
- BT_STATUS_UNKNOWN_OPCODE_L = 0x0a, // Unknown Lower layer OP code
- BT_STATUS_PARAMETER_FORMAT_ERROR_U = 0x0b, // Wrong parameters sent by upper layer.
- BT_STATUS_PARAMETER_FORMAT_ERROR_L = 0x0c, // bt fw parameter format is not consistency
- BT_STATUS_PARAMETER_OUT_OF_RANGE_U = 0x0d, // uppery layer parameter value is out of range
- BT_STATUS_PARAMETER_OUT_OF_RANGE_L = 0x0e, // bt fw parameter value is out of range
- BT_STATUS_UNKNOWN_STATUS_L = 0x0f, // bt returned an defined status code
- BT_STATUS_UNKNOWN_STATUS_H = 0x10, // driver need to do error handle or not handle-well.
- BT_STATUS_WRONG_LEVEL = 0x11, // should be under passive level
- BT_STATUS_MAX
-}BT_CTRL_STATUS,*PBT_CTRL_STATUS;
-
-// OP codes definition between the user layer and driver
-typedef enum _BT_CTRL_OPCODE_UPPER{
- BT_UP_OP_BT_READY = 0x00,
- BT_UP_OP_BT_SET_MODE = 0x01,
- BT_UP_OP_BT_SET_TX_RX_PARAMETER = 0x02,
- BT_UP_OP_BT_SET_GENERAL = 0x03,
- BT_UP_OP_BT_GET_GENERAL = 0x04,
- BT_UP_OP_BT_TEST_CTRL = 0x05,
- BT_UP_OP_TEST_BT = 0x06,
- BT_UP_OP_MAX
-}BT_CTRL_OPCODE_UPPER,*PBT_CTRL_OPCODE_UPPER;
-
-
-typedef enum _BT_SET_GENERAL{
- BT_GSET_REG = 0x00,
- BT_GSET_RESET = 0x01,
- BT_GSET_TARGET_BD_ADDR = 0x02,
- BT_GSET_TX_PWR_FINETUNE = 0x03,
- BT_SET_TRACKING_INTERVAL = 0x04,
- BT_SET_THERMAL_METER = 0x05,
- BT_ENABLE_CFO_TRACKING = 0x06,
- BT_GSET_UPDATE_BT_PATCH = 0x07,
- BT_GSET_MAX
-}BT_SET_GENERAL,*PBT_SET_GENERAL;
-
-typedef enum _BT_GET_GENERAL{
- BT_GGET_REG = 0x00,
- BT_GGET_STATUS = 0x01,
- BT_GGET_REPORT = 0x02,
- BT_GGET_AFH_MAP = 0x03,
- BT_GGET_AFH_STATUS = 0x04,
- BT_GGET_MAX
-}BT_GET_GENERAL,*PBT_GET_GENERAL;
-
-// definition for BT_UP_OP_BT_SET_GENERAL
-typedef enum _BT_REG_TYPE{
- BT_REG_RF = 0,
- BT_REG_MODEM = 1,
- BT_REG_BLUEWIZE = 2,
- BT_REG_VENDOR = 3,
- BT_REG_LE = 4,
- BT_REG_MAX
-}BT_REG_TYPE,*PBT_REG_TYPE;
-
-// definition for BT_LO_OP_GET_AFH_MAP
-typedef enum _BT_AFH_MAP_TYPE{
- BT_AFH_MAP_RESULT = 0,
- BT_AFH_MAP_WIFI_PSD_ONLY = 1,
- BT_AFH_MAP_WIFI_CH_BW_ONLY = 2,
- BT_AFH_MAP_BT_PSD_ONLY = 3,
- BT_AFH_MAP_HOST_CLASSIFICATION_ONLY = 4,
- BT_AFH_MAP_MAX
-}BT_AFH_MAP_TYPE,*PBT_AFH_MAP_TYPE;
-
-// definition for BT_UP_OP_BT_GET_GENERAL
-typedef enum _BT_REPORT_TYPE{
- BT_REPORT_RX_PACKET_CNT = 0,
- BT_REPORT_RX_ERROR_BITS = 1,
- BT_REPORT_RSSI = 2,
- BT_REPORT_CFO_HDR_QUALITY = 3,
- BT_REPORT_CONNECT_TARGET_BD_ADDR = 4,
- BT_REPORT_MAX
-}BT_REPORT_TYPE,*PBT_REPORT_TYPE;
-
-VOID
-MPTBT_Test(
- IN PADAPTER Adapter,
- IN u1Byte opCode,
- IN u1Byte byte1,
- IN u1Byte byte2,
- IN u1Byte byte3
- );
-
-NDIS_STATUS
-MPTBT_SendOidBT(
- IN PADAPTER pAdapter,
- IN PVOID InformationBuffer,
- IN ULONG InformationBufferLength,
- OUT PULONG BytesRead,
- OUT PULONG BytesNeeded
- );
-
-VOID
-MPTBT_FwC2hBtMpCtrl(
- PADAPTER Adapter,
- pu1Byte tmpBuf,
- u1Byte length
- );
-
-void MPh2c_timeout_handle(void *FunctionContext);
-
-VOID mptbt_BtControlProcess(
- PADAPTER Adapter,
- PVOID pInBuf
- );
-
-#define BT_H2C_MAX_RETRY 1
-#define BT_MAX_C2H_LEN 20
-
-typedef struct _BT_REQ_CMD{
- UCHAR opCodeVer;
- UCHAR OpCode;
- USHORT paraLength;
- UCHAR pParamStart[100];
-} BT_REQ_CMD, *PBT_REQ_CMD;
-
-typedef struct _BT_RSP_CMD{
- USHORT status;
- USHORT paraLength;
- UCHAR pParamStart[100];
-} BT_RSP_CMD, *PBT_RSP_CMD;
-
-
-typedef struct _BT_H2C{
- u1Byte opCodeVer:4;
- u1Byte reqNum:4;
- u1Byte opCode;
- u1Byte buf[100];
-}BT_H2C, *PBT_H2C;
-
-
-
-typedef struct _BT_EXT_C2H{
- u1Byte extendId;
- u1Byte statusCode:4;
- u1Byte retLen:4;
- u1Byte opCodeVer:4;
- u1Byte reqNum:4;
- u1Byte buf[100];
-}BT_EXT_C2H, *PBT_EXT_C2H;
-
-
-typedef enum _BT_OPCODE_STATUS{
- BT_OP_STATUS_SUCCESS = 0x00, // Success
- BT_OP_STATUS_VERSION_MISMATCH = 0x01,
- BT_OP_STATUS_UNKNOWN_OPCODE = 0x02,
- BT_OP_STATUS_ERROR_PARAMETER = 0x03,
- BT_OP_STATUS_MAX
-}BT_OPCODE_STATUS,*PBT_OPCODE_STATUS;
-
-
-
-//OP codes definition between driver and bt fw
-typedef enum _BT_CTRL_OPCODE_LOWER{
- BT_LO_OP_GET_BT_VERSION = 0x00,
- BT_LO_OP_RESET = 0x01,
- BT_LO_OP_TEST_CTRL = 0x02,
- BT_LO_OP_SET_BT_MODE = 0x03,
- BT_LO_OP_SET_CHNL_TX_GAIN = 0x04,
- BT_LO_OP_SET_PKT_TYPE_LEN = 0x05,
- BT_LO_OP_SET_PKT_CNT_L_PL_TYPE = 0x06,
- BT_LO_OP_SET_PKT_CNT_H_PKT_INTV = 0x07,
- BT_LO_OP_SET_PKT_HEADER = 0x08,
- BT_LO_OP_SET_WHITENCOEFF = 0x09,
- BT_LO_OP_SET_BD_ADDR_L = 0x0a,
- BT_LO_OP_SET_BD_ADDR_H = 0x0b,
- BT_LO_OP_WRITE_REG_ADDR = 0x0c,
- BT_LO_OP_WRITE_REG_VALUE = 0x0d,
- BT_LO_OP_GET_BT_STATUS = 0x0e,
- BT_LO_OP_GET_BD_ADDR_L = 0x0f,
- BT_LO_OP_GET_BD_ADDR_H = 0x10,
- BT_LO_OP_READ_REG = 0x11,
- BT_LO_OP_SET_TARGET_BD_ADDR_L = 0x12,
- BT_LO_OP_SET_TARGET_BD_ADDR_H = 0x13,
- BT_LO_OP_SET_TX_POWER_CALIBRATION = 0x14,
- BT_LO_OP_GET_RX_PKT_CNT_L = 0x15,
- BT_LO_OP_GET_RX_PKT_CNT_H = 0x16,
- BT_LO_OP_GET_RX_ERROR_BITS_L = 0x17,
- BT_LO_OP_GET_RX_ERROR_BITS_H = 0x18,
- BT_LO_OP_GET_RSSI = 0x19,
- BT_LO_OP_GET_CFO_HDR_QUALITY_L = 0x1a,
- BT_LO_OP_GET_CFO_HDR_QUALITY_H = 0x1b,
- BT_LO_OP_GET_TARGET_BD_ADDR_L = 0x1c,
- BT_LO_OP_GET_TARGET_BD_ADDR_H = 0x1d,
- BT_LO_OP_GET_AFH_MAP_L = 0x1e,
- BT_LO_OP_GET_AFH_MAP_M = 0x1f,
- BT_LO_OP_GET_AFH_MAP_H = 0x20,
- BT_LO_OP_GET_AFH_STATUS = 0x21,
- BT_LO_OP_SET_TRACKING_INTERVAL = 0x22,
- BT_LO_OP_SET_THERMAL_METER = 0x23,
- BT_LO_OP_ENABLE_CFO_TRACKING = 0x24,
- BT_LO_OP_MAX
-}BT_CTRL_OPCODE_LOWER,*PBT_CTRL_OPCODE_LOWER;
-
-
-
-
-#endif /* #if(MP_DRIVER == 1) */
-
-#endif // #ifndef __INC_MPT_BT_H
-
+/******************************************************************************
+ *
+ * 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_BT_MP_H
+#define __RTW_BT_MP_H
+
+
+#if(MP_DRIVER == 1)
+
+#pragma pack(1)
+
+// definition for BT_UP_OP_BT_READY
+#define MP_BT_NOT_READY 0
+#define MP_BT_READY 1
+
+// definition for BT_UP_OP_BT_SET_MODE
+typedef enum _MP_BT_MODE{
+ MP_BT_MODE_RF_TXRX_TEST_MODE = 0,
+ MP_BT_MODE_BT20_DUT_TEST_MODE = 1,
+ MP_BT_MODE_BT40_DIRECT_TEST_MODE = 2,
+ MP_BT_MODE_CONNECT_TEST_MODE = 3,
+ MP_BT_MODE_MAX
+}MP_BT_MODE,*PMP_BT_MODE;
+
+
+// definition for BT_UP_OP_BT_SET_TX_RX_PARAMETER
+typedef struct _BT_TXRX_PARAMETERS{
+ u1Byte txrxChannel;
+ u4Byte txrxTxPktCnt;
+ u1Byte txrxTxPktInterval;
+ u1Byte txrxPayloadType;
+ u1Byte txrxPktType;
+ u2Byte txrxPayloadLen;
+ u4Byte txrxPktHeader;
+ u1Byte txrxWhitenCoeff;
+ u1Byte txrxBdaddr[6];
+ u1Byte txrxTxGainIndex;
+} BT_TXRX_PARAMETERS, *PBT_TXRX_PARAMETERS;
+
+// txrxPktType
+typedef enum _MP_BT_PKT_TYPE{
+ MP_BT_PKT_DH1 = 0,
+ MP_BT_PKT_DH3 = 1,
+ MP_BT_PKT_DH5 = 2,
+ MP_BT_PKT_2DH1 = 3,
+ MP_BT_PKT_2DH3 = 4,
+ MP_BT_PKT_2DH5 = 5,
+ MP_BT_PKT_3DH1 = 6,
+ MP_BT_PKT_3DH3 = 7,
+ MP_BT_PKT_3DH5 = 8,
+ MP_BT_PKT_LE = 9,
+ MP_BT_PKT_MAX
+}MP_BT_PKT_TYPE,*PMP_BT_PKT_TYPE;
+// txrxPayloadType
+typedef enum _MP_BT_PAYLOAD_TYPE{
+ MP_BT_PAYLOAD_01010101 = 0,
+ MP_BT_PAYLOAD_ALL_1 = 1,
+ MP_BT_PAYLOAD_ALL_0 = 2,
+ MP_BT_PAYLOAD_11110000 = 3,
+ MP_BT_PAYLOAD_PRBS9 = 4,
+ MP_BT_PAYLOAD_MAX
+}MP_BT_PAYLOAD_TYPE,*PMP_BT_PAYLOAD_TYPE;
+
+
+// definition for BT_UP_OP_BT_TEST_CTRL
+typedef enum _MP_BT_TEST_CTRL{
+ MP_BT_TEST_STOP_ALL_TESTS = 0,
+ MP_BT_TEST_START_RX_TEST = 1,
+ MP_BT_TEST_START_PACKET_TX_TEST = 2,
+ MP_BT_TEST_START_CONTINUOUS_TX_TEST = 3,
+ MP_BT_TEST_START_INQUIRY_SCAN_TEST = 4,
+ MP_BT_TEST_START_PAGE_SCAN_TEST = 5,
+ MP_BT_TEST_START_INQUIRY_PAGE_SCAN_TEST = 6,
+ MP_BT_TEST_START_LEGACY_CONNECT_TEST = 7,
+ MP_BT_TEST_START_LE_CONNECT_TEST_INITIATOR = 8,
+ MP_BT_TEST_START_LE_CONNECT_TEST_ADVERTISER = 9,
+ MP_BT_TEST_MAX
+}MP_BT_TEST_CTRL,*PMP_BT_TEST_CTRL;
+
+
+typedef enum _RTL_EXT_C2H_EVT
+{
+ EXT_C2H_WIFI_FW_ACTIVE_RSP = 0,
+ EXT_C2H_TRIG_BY_BT_FW = 1,
+ MAX_EXT_C2HEVENT
+}RTL_EXT_C2H_EVT;
+
+
+// return status definition to the user layer
+typedef enum _BT_CTRL_STATUS{
+ BT_STATUS_SUCCESS = 0x00, // Success
+ BT_STATUS_BT_OP_SUCCESS = 0x01, // bt fw op execution success
+ BT_STATUS_H2C_SUCCESS = 0x02, // H2c success
+ BT_STATUS_H2C_TIMTOUT = 0x03, // H2c timeout
+ BT_STATUS_H2C_BT_NO_RSP = 0x04, // H2c sent, bt no rsp
+ BT_STATUS_C2H_SUCCESS = 0x05, // C2h success
+ BT_STATUS_C2H_REQNUM_MISMATCH = 0x06, // bt fw wrong rsp
+ BT_STATUS_OPCODE_U_VERSION_MISMATCH = 0x07, // Upper layer OP code version mismatch.
+ BT_STATUS_OPCODE_L_VERSION_MISMATCH = 0x08, // Lower layer OP code version mismatch.
+ BT_STATUS_UNKNOWN_OPCODE_U = 0x09, // Unknown Upper layer OP code
+ BT_STATUS_UNKNOWN_OPCODE_L = 0x0a, // Unknown Lower layer OP code
+ BT_STATUS_PARAMETER_FORMAT_ERROR_U = 0x0b, // Wrong parameters sent by upper layer.
+ BT_STATUS_PARAMETER_FORMAT_ERROR_L = 0x0c, // bt fw parameter format is not consistency
+ BT_STATUS_PARAMETER_OUT_OF_RANGE_U = 0x0d, // uppery layer parameter value is out of range
+ BT_STATUS_PARAMETER_OUT_OF_RANGE_L = 0x0e, // bt fw parameter value is out of range
+ BT_STATUS_UNKNOWN_STATUS_L = 0x0f, // bt returned an defined status code
+ BT_STATUS_UNKNOWN_STATUS_H = 0x10, // driver need to do error handle or not handle-well.
+ BT_STATUS_WRONG_LEVEL = 0x11, // should be under passive level
+ BT_STATUS_MAX
+}BT_CTRL_STATUS,*PBT_CTRL_STATUS;
+
+// OP codes definition between the user layer and driver
+typedef enum _BT_CTRL_OPCODE_UPPER{
+ BT_UP_OP_BT_READY = 0x00,
+ BT_UP_OP_BT_SET_MODE = 0x01,
+ BT_UP_OP_BT_SET_TX_RX_PARAMETER = 0x02,
+ BT_UP_OP_BT_SET_GENERAL = 0x03,
+ BT_UP_OP_BT_GET_GENERAL = 0x04,
+ BT_UP_OP_BT_TEST_CTRL = 0x05,
+ BT_UP_OP_TEST_BT = 0x06,
+ BT_UP_OP_MAX
+}BT_CTRL_OPCODE_UPPER,*PBT_CTRL_OPCODE_UPPER;
+
+
+typedef enum _BT_SET_GENERAL{
+ BT_GSET_REG = 0x00,
+ BT_GSET_RESET = 0x01,
+ BT_GSET_TARGET_BD_ADDR = 0x02,
+ BT_GSET_TX_PWR_FINETUNE = 0x03,
+ BT_SET_TRACKING_INTERVAL = 0x04,
+ BT_SET_THERMAL_METER = 0x05,
+ BT_ENABLE_CFO_TRACKING = 0x06,
+ BT_GSET_UPDATE_BT_PATCH = 0x07,
+ BT_GSET_MAX
+}BT_SET_GENERAL,*PBT_SET_GENERAL;
+
+typedef enum _BT_GET_GENERAL{
+ BT_GGET_REG = 0x00,
+ BT_GGET_STATUS = 0x01,
+ BT_GGET_REPORT = 0x02,
+ BT_GGET_AFH_MAP = 0x03,
+ BT_GGET_AFH_STATUS = 0x04,
+ BT_GGET_MAX
+}BT_GET_GENERAL,*PBT_GET_GENERAL;
+
+// definition for BT_UP_OP_BT_SET_GENERAL
+typedef enum _BT_REG_TYPE{
+ BT_REG_RF = 0,
+ BT_REG_MODEM = 1,
+ BT_REG_BLUEWIZE = 2,
+ BT_REG_VENDOR = 3,
+ BT_REG_LE = 4,
+ BT_REG_MAX
+}BT_REG_TYPE,*PBT_REG_TYPE;
+
+// definition for BT_LO_OP_GET_AFH_MAP
+typedef enum _BT_AFH_MAP_TYPE{
+ BT_AFH_MAP_RESULT = 0,
+ BT_AFH_MAP_WIFI_PSD_ONLY = 1,
+ BT_AFH_MAP_WIFI_CH_BW_ONLY = 2,
+ BT_AFH_MAP_BT_PSD_ONLY = 3,
+ BT_AFH_MAP_HOST_CLASSIFICATION_ONLY = 4,
+ BT_AFH_MAP_MAX
+}BT_AFH_MAP_TYPE,*PBT_AFH_MAP_TYPE;
+
+// definition for BT_UP_OP_BT_GET_GENERAL
+typedef enum _BT_REPORT_TYPE{
+ BT_REPORT_RX_PACKET_CNT = 0,
+ BT_REPORT_RX_ERROR_BITS = 1,
+ BT_REPORT_RSSI = 2,
+ BT_REPORT_CFO_HDR_QUALITY = 3,
+ BT_REPORT_CONNECT_TARGET_BD_ADDR = 4,
+ BT_REPORT_MAX
+}BT_REPORT_TYPE,*PBT_REPORT_TYPE;
+
+VOID
+MPTBT_Test(
+ IN PADAPTER Adapter,
+ IN u1Byte opCode,
+ IN u1Byte byte1,
+ IN u1Byte byte2,
+ IN u1Byte byte3
+ );
+
+NDIS_STATUS
+MPTBT_SendOidBT(
+ IN PADAPTER pAdapter,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesRead,
+ OUT PULONG BytesNeeded
+ );
+
+VOID
+MPTBT_FwC2hBtMpCtrl(
+ PADAPTER Adapter,
+ pu1Byte tmpBuf,
+ u1Byte length
+ );
+
+void MPh2c_timeout_handle(void *FunctionContext);
+
+VOID mptbt_BtControlProcess(
+ PADAPTER Adapter,
+ PVOID pInBuf
+ );
+
+#define BT_H2C_MAX_RETRY 1
+#define BT_MAX_C2H_LEN 20
+
+typedef struct _BT_REQ_CMD{
+ UCHAR opCodeVer;
+ UCHAR OpCode;
+ USHORT paraLength;
+ UCHAR pParamStart[100];
+} BT_REQ_CMD, *PBT_REQ_CMD;
+
+typedef struct _BT_RSP_CMD{
+ USHORT status;
+ USHORT paraLength;
+ UCHAR pParamStart[100];
+} BT_RSP_CMD, *PBT_RSP_CMD;
+
+
+typedef struct _BT_H2C{
+ u1Byte opCodeVer:4;
+ u1Byte reqNum:4;
+ u1Byte opCode;
+ u1Byte buf[100];
+}BT_H2C, *PBT_H2C;
+
+
+
+typedef struct _BT_EXT_C2H{
+ u1Byte extendId;
+ u1Byte statusCode:4;
+ u1Byte retLen:4;
+ u1Byte opCodeVer:4;
+ u1Byte reqNum:4;
+ u1Byte buf[100];
+}BT_EXT_C2H, *PBT_EXT_C2H;
+
+
+typedef enum _BT_OPCODE_STATUS{
+ BT_OP_STATUS_SUCCESS = 0x00, // Success
+ BT_OP_STATUS_VERSION_MISMATCH = 0x01,
+ BT_OP_STATUS_UNKNOWN_OPCODE = 0x02,
+ BT_OP_STATUS_ERROR_PARAMETER = 0x03,
+ BT_OP_STATUS_MAX
+}BT_OPCODE_STATUS,*PBT_OPCODE_STATUS;
+
+
+
+//OP codes definition between driver and bt fw
+typedef enum _BT_CTRL_OPCODE_LOWER{
+ BT_LO_OP_GET_BT_VERSION = 0x00,
+ BT_LO_OP_RESET = 0x01,
+ BT_LO_OP_TEST_CTRL = 0x02,
+ BT_LO_OP_SET_BT_MODE = 0x03,
+ BT_LO_OP_SET_CHNL_TX_GAIN = 0x04,
+ BT_LO_OP_SET_PKT_TYPE_LEN = 0x05,
+ BT_LO_OP_SET_PKT_CNT_L_PL_TYPE = 0x06,
+ BT_LO_OP_SET_PKT_CNT_H_PKT_INTV = 0x07,
+ BT_LO_OP_SET_PKT_HEADER = 0x08,
+ BT_LO_OP_SET_WHITENCOEFF = 0x09,
+ BT_LO_OP_SET_BD_ADDR_L = 0x0a,
+ BT_LO_OP_SET_BD_ADDR_H = 0x0b,
+ BT_LO_OP_WRITE_REG_ADDR = 0x0c,
+ BT_LO_OP_WRITE_REG_VALUE = 0x0d,
+ BT_LO_OP_GET_BT_STATUS = 0x0e,
+ BT_LO_OP_GET_BD_ADDR_L = 0x0f,
+ BT_LO_OP_GET_BD_ADDR_H = 0x10,
+ BT_LO_OP_READ_REG = 0x11,
+ BT_LO_OP_SET_TARGET_BD_ADDR_L = 0x12,
+ BT_LO_OP_SET_TARGET_BD_ADDR_H = 0x13,
+ BT_LO_OP_SET_TX_POWER_CALIBRATION = 0x14,
+ BT_LO_OP_GET_RX_PKT_CNT_L = 0x15,
+ BT_LO_OP_GET_RX_PKT_CNT_H = 0x16,
+ BT_LO_OP_GET_RX_ERROR_BITS_L = 0x17,
+ BT_LO_OP_GET_RX_ERROR_BITS_H = 0x18,
+ BT_LO_OP_GET_RSSI = 0x19,
+ BT_LO_OP_GET_CFO_HDR_QUALITY_L = 0x1a,
+ BT_LO_OP_GET_CFO_HDR_QUALITY_H = 0x1b,
+ BT_LO_OP_GET_TARGET_BD_ADDR_L = 0x1c,
+ BT_LO_OP_GET_TARGET_BD_ADDR_H = 0x1d,
+ BT_LO_OP_GET_AFH_MAP_L = 0x1e,
+ BT_LO_OP_GET_AFH_MAP_M = 0x1f,
+ BT_LO_OP_GET_AFH_MAP_H = 0x20,
+ BT_LO_OP_GET_AFH_STATUS = 0x21,
+ BT_LO_OP_SET_TRACKING_INTERVAL = 0x22,
+ BT_LO_OP_SET_THERMAL_METER = 0x23,
+ BT_LO_OP_ENABLE_CFO_TRACKING = 0x24,
+ BT_LO_OP_MAX
+}BT_CTRL_OPCODE_LOWER,*PBT_CTRL_OPCODE_LOWER;
+
+
+
+
+#endif /* #if(MP_DRIVER == 1) */
+
+#endif // #ifndef __INC_MPT_BT_H
+
diff --git a/rtl8xxx_EU/include/rtw_debug.h b/rtl8xxx_EU/include/rtw_debug.h
index 09490bc..bf36357 100755
--- a/rtl8xxx_EU/include/rtw_debug.h
+++ b/rtl8xxx_EU/include/rtw_debug.h
@@ -328,6 +328,9 @@ void mac_reg_dump(void *sel, _adapter *adapter);
void bb_reg_dump(void *sel, _adapter *adapter);
void rf_reg_dump(void *sel, _adapter *adapter);
+struct dvobj_priv;
+void dump_adapters_status(void *sel, struct dvobj_priv *dvobj);
+
#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);
@@ -347,8 +350,8 @@ int proc_get_qos_option(struct seq_file *m, void *v);
int proc_get_ht_option(struct seq_file *m, void *v);
int proc_get_rf_info(struct seq_file *m, void *v);
int proc_get_survey_info(struct seq_file *m, void *v);
+ssize_t proc_set_survey_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
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);
ssize_t proc_set_rate_ctl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
@@ -417,6 +420,9 @@ 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);
+int proc_get_monitor(struct seq_file *m, void *v);
+ssize_t proc_set_monitor(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/rtl8xxx_EU/include/rtw_iol.h b/rtl8xxx_EU/include/rtw_iol.h
index ddabeac..128668c 100755
--- a/rtl8xxx_EU/include/rtw_iol.h
+++ b/rtl8xxx_EU/include/rtw_iol.h
@@ -1,137 +1,137 @@
-/******************************************************************************
- *
- * 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_IOL_H_
-#define __RTW_IOL_H_
-
-
-struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter);
-int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len);
-int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary);
-int rtw_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt);
-bool rtw_IOL_applied(ADAPTER *adapter);
-int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us);
-int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms);
-int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame);
-
-
-#ifdef CONFIG_IOL_NEW_GENERATION
-#define IOREG_CMD_END_LEN 4
-
-struct ioreg_cfg{
- u8 length;
- u8 cmd_id;
- u16 address;
- u32 data;
- u32 mask;
-};
-enum ioreg_cmd{
- IOREG_CMD_LLT = 0x01,
- IOREG_CMD_REFUSE = 0x02,
- IOREG_CMD_EFUSE_PATH = 0x03,
- IOREG_CMD_WB_REG = 0x04,
- IOREG_CMD_WW_REG = 0x05,
- IOREG_CMD_WD_REG = 0x06,
- IOREG_CMD_W_RF = 0x07,
- IOREG_CMD_DELAY_US = 0x10,
- IOREG_CMD_DELAY_MS = 0x11,
- IOREG_CMD_END = 0xFF,
-};
-void read_efuse_from_txpktbuf(ADAPTER *adapter, int bcnhead, u8 *content, u16 *size);
-
-int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask);
-int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask);
-int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask);
-int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask);
-#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value) ,(mask))
-#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value),(mask))
-#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value),(mask))
-#define rtw_IOL_append_WRF_cmd(xmit_frame, rf_path, addr, value,mask) _rtw_IOL_append_WRF_cmd((xmit_frame),(rf_path), (addr), (value),(mask))
-
-u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame);
-void rtw_IOL_cmd_buf_dump(ADAPTER *Adapter,int buf_len,u8 *pbuf);
-
-#ifdef CONFIG_IOL_IOREG_CFG_DBG
- struct cmd_cmp{
- u16 addr;
- u32 value;
- };
-#endif
-
-#else //CONFIG_IOL_NEW_GENERATION
-
-typedef struct _io_offload_cmd {
- u8 rsvd0;
- u8 cmd;
- u16 address;
- u32 value;
-} IO_OFFLOAD_CMD, IOL_CMD;
-
-#define IOL_CMD_LLT 0x00
-//#define IOL_CMD_R_EFUSE 0x01
-#define IOL_CMD_WB_REG 0x02
-#define IOL_CMD_WW_REG 0x03
-#define IOL_CMD_WD_REG 0x04
-//#define IOL_CMD_W_RF 0x05
-#define IOL_CMD_DELAY_US 0x80
-#define IOL_CMD_DELAY_MS 0x81
-//#define IOL_CMD_DELAY_S 0x82
-#define IOL_CMD_END 0x83
-
-/*****************************************************
-CMD Address Value
-(B1) (B2/B3:H/L addr) (B4:B7 : MSB:LSB)
-******************************************************
-IOL_CMD_LLT - B7: PGBNDY
-//IOL_CMD_R_EFUSE - -
-IOL_CMD_WB_REG 0x0~0xFFFF B7
-IOL_CMD_WW_REG 0x0~0xFFFF B6~B7
-IOL_CMD_WD_REG 0x0~0xFFFF B4~B7
-//IOL_CMD_W_RF RF Reg B5~B7
-IOL_CMD_DELAY_US - B6~B7
-IOL_CMD_DELAY_MS - B6~B7
-//IOL_CMD_DELAY_S - B6~B7
-IOL_CMD_END - -
-******************************************************/
-int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value);
-int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value);
-int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value);
-
-
-int rtw_IOL_exec_cmd_array_sync(PADAPTER adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms);
-int rtw_IOL_exec_empty_cmds_sync(ADAPTER *adapter, u32 max_wating_ms);
-
-#ifdef DBG_IO
-int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line);
-int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line);
-int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line);
-#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
-#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
-#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
-#else
-#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value))
-#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value))
-#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value))
-#endif // DBG_IO
-#endif // CONFIG_IOL_NEW_GENERATION
-
-
-
-#endif //__RTW_IOL_H_
-
+/******************************************************************************
+ *
+ * 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_IOL_H_
+#define __RTW_IOL_H_
+
+
+struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter);
+int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len);
+int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary);
+int rtw_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt);
+bool rtw_IOL_applied(ADAPTER *adapter);
+int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us);
+int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms);
+int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame);
+
+
+#ifdef CONFIG_IOL_NEW_GENERATION
+#define IOREG_CMD_END_LEN 4
+
+struct ioreg_cfg{
+ u8 length;
+ u8 cmd_id;
+ u16 address;
+ u32 data;
+ u32 mask;
+};
+enum ioreg_cmd{
+ IOREG_CMD_LLT = 0x01,
+ IOREG_CMD_REFUSE = 0x02,
+ IOREG_CMD_EFUSE_PATH = 0x03,
+ IOREG_CMD_WB_REG = 0x04,
+ IOREG_CMD_WW_REG = 0x05,
+ IOREG_CMD_WD_REG = 0x06,
+ IOREG_CMD_W_RF = 0x07,
+ IOREG_CMD_DELAY_US = 0x10,
+ IOREG_CMD_DELAY_MS = 0x11,
+ IOREG_CMD_END = 0xFF,
+};
+void read_efuse_from_txpktbuf(ADAPTER *adapter, int bcnhead, u8 *content, u16 *size);
+
+int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask);
+int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask);
+int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask);
+int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask);
+#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value) ,(mask))
+#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value),(mask))
+#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value),(mask))
+#define rtw_IOL_append_WRF_cmd(xmit_frame, rf_path, addr, value,mask) _rtw_IOL_append_WRF_cmd((xmit_frame),(rf_path), (addr), (value),(mask))
+
+u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame);
+void rtw_IOL_cmd_buf_dump(ADAPTER *Adapter,int buf_len,u8 *pbuf);
+
+#ifdef CONFIG_IOL_IOREG_CFG_DBG
+ struct cmd_cmp{
+ u16 addr;
+ u32 value;
+ };
+#endif
+
+#else //CONFIG_IOL_NEW_GENERATION
+
+typedef struct _io_offload_cmd {
+ u8 rsvd0;
+ u8 cmd;
+ u16 address;
+ u32 value;
+} IO_OFFLOAD_CMD, IOL_CMD;
+
+#define IOL_CMD_LLT 0x00
+//#define IOL_CMD_R_EFUSE 0x01
+#define IOL_CMD_WB_REG 0x02
+#define IOL_CMD_WW_REG 0x03
+#define IOL_CMD_WD_REG 0x04
+//#define IOL_CMD_W_RF 0x05
+#define IOL_CMD_DELAY_US 0x80
+#define IOL_CMD_DELAY_MS 0x81
+//#define IOL_CMD_DELAY_S 0x82
+#define IOL_CMD_END 0x83
+
+/*****************************************************
+CMD Address Value
+(B1) (B2/B3:H/L addr) (B4:B7 : MSB:LSB)
+******************************************************
+IOL_CMD_LLT - B7: PGBNDY
+//IOL_CMD_R_EFUSE - -
+IOL_CMD_WB_REG 0x0~0xFFFF B7
+IOL_CMD_WW_REG 0x0~0xFFFF B6~B7
+IOL_CMD_WD_REG 0x0~0xFFFF B4~B7
+//IOL_CMD_W_RF RF Reg B5~B7
+IOL_CMD_DELAY_US - B6~B7
+IOL_CMD_DELAY_MS - B6~B7
+//IOL_CMD_DELAY_S - B6~B7
+IOL_CMD_END - -
+******************************************************/
+int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value);
+int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value);
+int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value);
+
+
+int rtw_IOL_exec_cmd_array_sync(PADAPTER adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms);
+int rtw_IOL_exec_empty_cmds_sync(ADAPTER *adapter, u32 max_wating_ms);
+
+#ifdef DBG_IO
+int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line);
+int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line);
+int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line);
+#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
+#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
+#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)
+#else
+#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value))
+#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value))
+#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value))
+#endif // DBG_IO
+#endif // CONFIG_IOL_NEW_GENERATION
+
+
+
+#endif //__RTW_IOL_H_
+
diff --git a/rtl8xxx_EU/include/rtw_mlme.h b/rtl8xxx_EU/include/rtw_mlme.h
index 4e0642a..f3a90c8 100644..100755
--- a/rtl8xxx_EU/include/rtw_mlme.h
+++ b/rtl8xxx_EU/include/rtw_mlme.h
@@ -41,48 +41,57 @@
#define SCANQUEUE_LIFETIME 20000 // 20sec, unit:msec
#endif
-#define WIFI_NULL_STATE 0x00000000
-#define WIFI_ASOC_STATE 0x00000001 // Under Linked state...
-#define WIFI_REASOC_STATE 0x00000002
-#define WIFI_SLEEP_STATE 0x00000004
-#define WIFI_STATION_STATE 0x00000008
-#define WIFI_AP_STATE 0x00000010
-#define WIFI_ADHOC_STATE 0x00000020
-#define WIFI_ADHOC_MASTER_STATE 0x00000040
-#define WIFI_UNDER_LINKING 0x00000080
-
-#define WIFI_UNDER_WPS 0x00000100
-//#define WIFI_UNDER_CMD 0x00000200
-//#define WIFI_UNDER_P2P 0x00000400
-#define WIFI_STA_ALIVE_CHK_STATE 0x00000400
-#define WIFI_SITE_MONITOR 0x00000800 //to indicate the station is under site surveying
-#ifdef WDS
-#define WIFI_WDS 0x00001000
-#define WIFI_WDS_RX_BEACON 0x00002000 // already rx WDS AP beacon
-#endif
-#ifdef AUTO_CONFIG
-#define WIFI_AUTOCONF 0x00004000
-#define WIFI_AUTOCONF_IND 0x00008000
-#endif
-
-/*
-// ========== P2P Section Start ===============
-#define WIFI_P2P_LISTEN_STATE 0x00010000
-#define WIFI_P2P_GROUP_FORMATION_STATE 0x00020000
-// ========== P2P Section End ===============
-*/
+#define WIFI_NULL_STATE 0x00000000
+#define WIFI_ASOC_STATE 0x00000001 /* Linked */
+#define WIFI_REASOC_STATE 0x00000002
+#define WIFI_SLEEP_STATE 0x00000004
+#define WIFI_STATION_STATE 0x00000008
+#define WIFI_AP_STATE 0x00000010
+#define WIFI_ADHOC_STATE 0x00000020
+#define WIFI_ADHOC_MASTER_STATE 0x00000040
+#define WIFI_UNDER_LINKING 0x00000080
+#define WIFI_UNDER_WPS 0x00000100
+#define WIFI_UNDER_CAC 0x00000200
+#define WIFI_STA_ALIVE_CHK_STATE 0x00000400
+#define WIFI_SITE_MONITOR 0x00000800 /* under site surveying */
+#define WIFI_WDS 0x00001000
+#define WIFI_WDS_RX_BEACON 0x00002000 /* already rx WDS AP beacon */
+#define WIFI_AUTOCONF 0x00004000
+#define WIFI_AUTOCONF_IND 0x00008000
+#define WIFI_MP_STATE 0x00010000
+#define WIFI_MP_CTX_BACKGROUND 0x00020000 /* in continuous tx background */
+#define WIFI_MP_CTX_ST 0x00040000 /* in continuous tx with single-tone */
+#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 /* pending in continuous tx background due to out of skb */
+#define WIFI_MP_CTX_CCK_HW 0x00100000 /* in continuous tx */
+#define WIFI_MP_CTX_CCK_CS 0x00200000 /* in continuous tx with carrier suppression */
+#define WIFI_MP_LPBK_STATE 0x00400000
+#define WIFI_OP_CH_SWITCHING 0x00800000
+/*#define WIFI_UNDEFINED_STATE 0x01000000*/
+/*#define WIFI_UNDEFINED_STATE 0x02000000*/
+/*#define WIFI_UNDEFINED_STATE 0x04000000*/
+/*#define WIFI_UNDEFINED_STATE 0x08000000*/
+/*#define WIFI_UNDEFINED_STATE 0x10000000*/
+/*#define WIFI_UNDEFINED_STATE 0x20000000*/
+/*#define WIFI_UNDEFINED_STATE 0x40000000*/
+#define WIFI_MONITOR_STATE 0x80000000
+
+#define MLME_STATE_FMT "%s%s%s%s%s%s%s%s%s%s%s%s"
+#define MLME_STATE_ARG(state) \
+ ((state) & WIFI_STATION_STATE)?" STA":"", \
+ ((state) & WIFI_AP_STATE)?" AP":"", \
+ ((state) & WIFI_ADHOC_STATE)?" ADHOC":"", \
+ ((state) & WIFI_ADHOC_MASTER_STATE)?" ADHOC_M":"", \
+ ((state) & WIFI_MONITOR_STATE)?" MONITOR":"", \
+ ((state) & WIFI_MP_STATE)?" MP":"", \
+ ((state) & WIFI_SITE_MONITOR)?" SCAN":"", \
+ ((state) & WIFI_UNDER_LINKING)?" LINKING":"", \
+ ((state) & WIFI_ASOC_STATE)?" ASOC":"", \
+ ((state) & WIFI_OP_CH_SWITCHING)?" OP_CH_SW":"", \
+ ((state) & WIFI_UNDER_WPS)?" WPS":"", \
+ ((state) & WIFI_SLEEP_STATE)?" SLEEP":""
+
+#define ADPT_MLME_S_ARG(adapter) MLME_STATE_ARG(get_fwstate(&((adapter)->mlmepriv)))
-//#ifdef UNDER_MPTEST
-#define WIFI_MP_STATE 0x00010000
-#define WIFI_MP_CTX_BACKGROUND 0x00020000 // in continous tx background
-#define WIFI_MP_CTX_ST 0x00040000 // in continous tx with single-tone
-#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 // pending in continous tx background due to out of skb
-#define WIFI_MP_CTX_CCK_HW 0x00100000 // in continous tx
-#define WIFI_MP_CTX_CCK_CS 0x00200000 // in continous tx with carrier suppression
-#define WIFI_MP_LPBK_STATE 0x00400000
-//#endif
-
-//#define _FW_UNDER_CMD WIFI_UNDER_CMD
#define _FW_UNDER_LINKING WIFI_UNDER_LINKING
#define _FW_LINKED WIFI_ASOC_STATE
#define _FW_UNDER_SURVEY WIFI_SITE_MONITOR
@@ -191,6 +200,16 @@ struct tx_invite_resp_info{
u8 token; // Used to record the dialog token of p2p invitation request frame.
};
+#define MIRACAST_DISABLED 0
+#define MIRACAST_SOURCE 1
+#define MIRACAST_SINK 2
+#define MIRACAST_INVALID 3
+
+#define is_miracast_enabled(mode) \
+ (mode == MIRACAST_SOURCE || mode == MIRACAST_SINK)
+
+const char *get_miracast_mode_str(int mode);
+
#ifdef CONFIG_WFD
struct wifi_display_info{
@@ -212,7 +231,7 @@ struct wifi_display_info{
// 0 -> WFD Source Device
// 1 -> WFD Primary Sink Device
enum SCAN_RESULT_TYPE scan_result_type; // Used when P2P is enable. This parameter will impact the scan result.
-
+ u8 stack_wfd_mode;
};
#endif //CONFIG_WFD
@@ -257,8 +276,8 @@ struct cfg80211_wifidirect_info{
u8 restore_channel;
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;
+ ATOMIC_T ro_ch_cookie_gen;
+ u64 remain_on_ch_cookie;
bool is_ro_ch;
u32 last_ro_ch_time; /* this will be updated at the beginning and end of ro_ch */
};
@@ -796,6 +815,9 @@ extern void rtw_free_assoc_resources(_adapter* adapter, int lock_scanned_queue);
extern void rtw_indicate_disconnect(_adapter* adapter);
extern void rtw_indicate_connect(_adapter* adapter);
void rtw_indicate_scan_done( _adapter *padapter, bool aborted);
+
+u32 rtw_scan_abort_timeout(_adapter *adapter, u32 timeout_ms);
+void rtw_scan_abort_no_wait(_adapter *adapter);
void rtw_scan_abort(_adapter *adapter);
extern int rtw_restruct_sec_ie(_adapter *adapter,u8 *in_ie,u8 *out_ie,uint in_len);
diff --git a/rtl8xxx_EU/include/rtw_mlme_ext.h b/rtl8xxx_EU/include/rtw_mlme_ext.h
index 82d20cf..e5a48c9 100755
--- a/rtl8xxx_EU/include/rtw_mlme_ext.h
+++ b/rtl8xxx_EU/include/rtw_mlme_ext.h
@@ -89,6 +89,7 @@
#define _HW_STATE_ADHOC_ 0x01
#define _HW_STATE_STATION_ 0x02
#define _HW_STATE_AP_ 0x03
+#define _HW_STATE_MONITOR_ 0x04
#define _1M_RATE_ 0
@@ -478,6 +479,7 @@ struct mlme_ext_info
#if defined(CONFIG_STA_MODE_SCAN_UNDER_AP_MODE) || defined(CONFIG_ATMEL_RC_PATCH)
u8 scan_cnt;
+ u8 backop_cnt;
#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
};
@@ -622,7 +624,7 @@ void change_band_update_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork);
void Save_DM_Func_Flag(_adapter *padapter);
void Restore_DM_Func_Flag(_adapter *padapter);
void Switch_DM_Func(_adapter *padapter, u32 mode, u8 enable);
-
+void ctrl_dm_func_for_offchannel(_adapter *padapter, u32 mode);
//void Set_NETYPE1_MSR(_adapter *padapter, u8 type);
//void Set_NETYPE0_MSR(_adapter *padapter, u8 type);
void Set_MSR(_adapter *padapter, u8 type);
diff --git a/rtl8xxx_EU/include/rtw_odm.h b/rtl8xxx_EU/include/rtw_odm.h
index 50edd01..118cd6f 100755
--- a/rtl8xxx_EU/include/rtw_odm.h
+++ b/rtl8xxx_EU/include/rtw_odm.h
@@ -34,9 +34,11 @@ 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);
+void rtw_odm_adaptivity_config_msg(void *sel, _adapter *adapter);
+
+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_adaptivity_parm_set(_adapter *adapter, s8 TH_L2H_ini, s8 TH_EDCCA_HL_diff);
void rtw_odm_get_perpkt_rssi(void *sel, _adapter *adapter);
#endif // __RTW_ODM_H__
diff --git a/rtl8xxx_EU/include/rtw_recv.h b/rtl8xxx_EU/include/rtw_recv.h
index 0124ed1..2f7c964 100755
--- a/rtl8xxx_EU/include/rtw_recv.h
+++ b/rtl8xxx_EU/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
@@ -254,8 +254,12 @@ struct rx_pkt_attrib {
u8 key_index;
u8 data_rate;
+ u8 bw;
+ u8 stbc;
+ u8 ldpc;
u8 sgi;
u8 pkt_rpt_type;
+ u32 tsfl;
u32 MacIDValidEntry[2]; // 64 bits present 64 entry.
/*
@@ -265,7 +269,7 @@ struct rx_pkt_attrib {
u32 RxPWDBAll;
s32 RecvSignalPower;
*/
- struct phy_info phy_info;
+ struct phy_info phy_info;
};
@@ -822,9 +826,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/rtl8xxx_EU/include/rtw_tdls.h b/rtl8xxx_EU/include/rtw_tdls.h
index ce0e2fc..8825a57 100755
--- a/rtl8xxx_EU/include/rtw_tdls.h
+++ b/rtl8xxx_EU/include/rtw_tdls.h
@@ -1,141 +1,141 @@
-/******************************************************************************
- *
- * 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_TDLS_H_
-#define __RTW_TDLS_H_
-
-
-#ifdef CONFIG_TDLS
-/* TDLS STA state */
-#define TDLS_STATE_NONE 0x00000000 //default state
-#define TDLS_INITIATOR_STATE 0x10000000
-#define TDLS_RESPONDER_STATE 0x20000000
-#define TDLS_LINKED_STATE 0x40000000
-#define TDLS_CH_SWITCH_ON_STATE 0x01000000
-#define TDLS_PEER_AT_OFF_STATE 0x02000000 //could send pkt on target ch
-#define TDLS_AT_OFF_CH_STATE 0x04000000
-#define TDLS_CH_SW_INITIATOR_STATE 0x08000000 //avoiding duplicated or unconditional ch. switch rsp.
-#define TDLS_APSD_CHSW_STATE 0x00100000 //in APSD and want to setup channel switch
-#define TDLS_PEER_SLEEP_STATE 0x00200000 //peer sta is sleeping //[TDLS] UAPSD: will not be used one day
-#define TDLS_SW_OFF_STATE 0x00400000 //terminate channel swithcing
-#define TDLS_ALIVE_STATE 0x00010000 //Check if peer sta is alived.
-#define TDLS_WAIT_PTR_STATE 0x00020000 //Waiting peer's TDLS_PEER_TRAFFIC_RESPONSE frame
-
-#define TPK_RESEND_COUNT 301
-#define CH_SWITCH_TIME 10
-#define CH_SWITCH_TIMEOUT 30
-#define TDLS_STAY_TIME 500
-#define TDLS_SIGNAL_THRESH 0x20
-#define TDLS_WATCHDOG_PERIOD 10 //Periodically sending tdls discovery request in TDLS_WATCHDOG_PERIOD * 2 sec
-#define TDLS_STAY_TIME 500
-#define TDLS_HANDSHAKE_TIME 3000
-#define TDLS_PTI_TIME 7000
-#define TDLS_ALIVE_COUNT 3
-#define TDLS_INI_MACID_ENTRY 6
-
-/* TDLS */
-#define TDLS_MIC_LEN 16
-#define WPA_NONCE_LEN 32
-#define TDLS_TIMEOUT_LEN 4
-
-struct wpa_tdls_ftie {
- u8 ie_type; /* FTIE */
- u8 ie_len;
- u8 mic_ctrl[2];
- u8 mic[TDLS_MIC_LEN];
- u8 Anonce[WPA_NONCE_LEN]; /* Responder Nonce in TDLS */
- u8 Snonce[WPA_NONCE_LEN]; /* Initiator Nonce in TDLS */
- /* followed by optional elements */
-} ;
-
-struct wpa_tdls_lnkid {
- u8 ie_type; /* Link Identifier IE */
- u8 ie_len;
- u8 bssid[ETH_ALEN];
- u8 init_sta[ETH_ALEN];
- u8 resp_sta[ETH_ALEN];
-} ;
-
-static u8 TDLS_RSNIE[]={ 0x01, 0x00, //version shall be set to 1
- 0x00, 0x0f, 0xac, 0x07, //group sipher suite
- 0x01, 0x00, //pairwise cipher suite count
- 0x00, 0x0f, 0xac, 0x04, //pairwise cipher suite list; CCMP only
- 0x01, 0x00, //AKM suite count
- 0x00, 0x0f, 0xac, 0x07, //TPK Handshake
- 0x0c, 0x02,
- //PMKID shall not be present
- };
-
-static u8 TDLS_WMMIE[]={0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; //Qos info all set zero
-
-static u8 TDLS_EXT_CAPIE[] = {0x00, 0x00, 0x00, 0x50, 0x20, 0x00, 0x00, 0x00}; //bit(28), bit(30), bit(37)
-
-// SRC: Supported Regulatory Classes
-static u8 TDLS_SRC[] = { 0x01, 0x01, 0x02, 0x03, 0x04, 0x0c, 0x16, 0x17, 0x18, 0x19, 0x1b, 0x1c, 0x1d, 0x1e, 0x20, 0x21 };
-
-void rtw_reset_tdls_info(_adapter* padapter);
-int rtw_init_tdls_info(_adapter* padapter);
-void rtw_free_tdls_info(struct tdls_info *ptdlsinfo);
-int issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms);
-void rtw_init_tdls_timer(_adapter *padapter, struct sta_info *psta);
-void rtw_free_tdls_timer(struct sta_info *psta);
-void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta);
-#ifdef CONFIG_WFD
-int issue_tunneled_probe_req(_adapter *padapter);
-int issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame);
-#endif //CONFIG_WFD
-int issue_tdls_dis_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt);
-int issue_tdls_setup_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, int wait_ack);
-int issue_tdls_setup_rsp(_adapter *padapter, struct tdls_txmgmt *ptxmgmt);
-int issue_tdls_setup_cfm(_adapter *padapter, struct tdls_txmgmt *ptxmgmt);
-int issue_tdls_dis_rsp(_adapter * padapter, struct tdls_txmgmt *ptxmgmt, u8 privacy);
-int issue_tdls_teardown(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, u8 wait_ack);
-int issue_tdls_peer_traffic_rsp(_adapter *padapter, struct sta_info *psta);
-int issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *psta);
-int issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr);
-int issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr);
-sint On_TDLS_Dis_Rsp(_adapter *adapter, union recv_frame *precv_frame);
-sint On_TDLS_Setup_Req(_adapter *adapter, union recv_frame *precv_frame);
-int On_TDLS_Setup_Rsp(_adapter *adapter, union recv_frame *precv_frame);
-int On_TDLS_Setup_Cfm(_adapter *adapter, union recv_frame *precv_frame);
-int On_TDLS_Dis_Req(_adapter *adapter, union recv_frame *precv_frame);
-int On_TDLS_Teardown(_adapter *adapter, union recv_frame *precv_frame);
-int On_TDLS_Peer_Traffic_Indication(_adapter *adapter, union recv_frame *precv_frame);
-int On_TDLS_Peer_Traffic_Rsp(_adapter *adapter, union recv_frame *precv_frame);
-sint On_TDLS_Ch_Switch_Req(_adapter *adapter, union recv_frame *precv_frame);
-sint On_TDLS_Ch_Switch_Rsp(_adapter *adapter, union recv_frame *precv_frame);
-void rtw_build_tdls_setup_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
-void rtw_build_tdls_setup_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
-void rtw_build_tdls_setup_cfm_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
-void rtw_build_tdls_teardown_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
-void rtw_build_tdls_dis_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
-void rtw_build_tdls_dis_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog, u8 privacy);
-void rtw_build_tdls_peer_traffic_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
-void rtw_build_tdls_peer_traffic_indication_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
-void rtw_build_tdls_ch_switch_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
-void rtw_build_tdls_ch_switch_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
-void rtw_build_tunneled_probe_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
-void rtw_build_tunneled_probe_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
-
-u8 update_sgi_tdls(_adapter *padapter, struct sta_info *psta);
-u32 update_mask_tdls(_adapter *padapter, struct sta_info *psta);
-#endif //CONFIG_TDLS
-
-#endif
-
+/******************************************************************************
+ *
+ * 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_TDLS_H_
+#define __RTW_TDLS_H_
+
+
+#ifdef CONFIG_TDLS
+/* TDLS STA state */
+#define TDLS_STATE_NONE 0x00000000 //default state
+#define TDLS_INITIATOR_STATE 0x10000000
+#define TDLS_RESPONDER_STATE 0x20000000
+#define TDLS_LINKED_STATE 0x40000000
+#define TDLS_CH_SWITCH_ON_STATE 0x01000000
+#define TDLS_PEER_AT_OFF_STATE 0x02000000 //could send pkt on target ch
+#define TDLS_AT_OFF_CH_STATE 0x04000000
+#define TDLS_CH_SW_INITIATOR_STATE 0x08000000 //avoiding duplicated or unconditional ch. switch rsp.
+#define TDLS_APSD_CHSW_STATE 0x00100000 //in APSD and want to setup channel switch
+#define TDLS_PEER_SLEEP_STATE 0x00200000 //peer sta is sleeping //[TDLS] UAPSD: will not be used one day
+#define TDLS_SW_OFF_STATE 0x00400000 //terminate channel swithcing
+#define TDLS_ALIVE_STATE 0x00010000 //Check if peer sta is alived.
+#define TDLS_WAIT_PTR_STATE 0x00020000 //Waiting peer's TDLS_PEER_TRAFFIC_RESPONSE frame
+
+#define TPK_RESEND_COUNT 301
+#define CH_SWITCH_TIME 10
+#define CH_SWITCH_TIMEOUT 30
+#define TDLS_STAY_TIME 500
+#define TDLS_SIGNAL_THRESH 0x20
+#define TDLS_WATCHDOG_PERIOD 10 //Periodically sending tdls discovery request in TDLS_WATCHDOG_PERIOD * 2 sec
+#define TDLS_STAY_TIME 500
+#define TDLS_HANDSHAKE_TIME 3000
+#define TDLS_PTI_TIME 7000
+#define TDLS_ALIVE_COUNT 3
+#define TDLS_INI_MACID_ENTRY 6
+
+/* TDLS */
+#define TDLS_MIC_LEN 16
+#define WPA_NONCE_LEN 32
+#define TDLS_TIMEOUT_LEN 4
+
+struct wpa_tdls_ftie {
+ u8 ie_type; /* FTIE */
+ u8 ie_len;
+ u8 mic_ctrl[2];
+ u8 mic[TDLS_MIC_LEN];
+ u8 Anonce[WPA_NONCE_LEN]; /* Responder Nonce in TDLS */
+ u8 Snonce[WPA_NONCE_LEN]; /* Initiator Nonce in TDLS */
+ /* followed by optional elements */
+} ;
+
+struct wpa_tdls_lnkid {
+ u8 ie_type; /* Link Identifier IE */
+ u8 ie_len;
+ u8 bssid[ETH_ALEN];
+ u8 init_sta[ETH_ALEN];
+ u8 resp_sta[ETH_ALEN];
+} ;
+
+static u8 TDLS_RSNIE[]={ 0x01, 0x00, //version shall be set to 1
+ 0x00, 0x0f, 0xac, 0x07, //group sipher suite
+ 0x01, 0x00, //pairwise cipher suite count
+ 0x00, 0x0f, 0xac, 0x04, //pairwise cipher suite list; CCMP only
+ 0x01, 0x00, //AKM suite count
+ 0x00, 0x0f, 0xac, 0x07, //TPK Handshake
+ 0x0c, 0x02,
+ //PMKID shall not be present
+ };
+
+static u8 TDLS_WMMIE[]={0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; //Qos info all set zero
+
+static u8 TDLS_EXT_CAPIE[] = {0x00, 0x00, 0x00, 0x50, 0x20, 0x00, 0x00, 0x00}; //bit(28), bit(30), bit(37)
+
+// SRC: Supported Regulatory Classes
+static u8 TDLS_SRC[] = { 0x01, 0x01, 0x02, 0x03, 0x04, 0x0c, 0x16, 0x17, 0x18, 0x19, 0x1b, 0x1c, 0x1d, 0x1e, 0x20, 0x21 };
+
+void rtw_reset_tdls_info(_adapter* padapter);
+int rtw_init_tdls_info(_adapter* padapter);
+void rtw_free_tdls_info(struct tdls_info *ptdlsinfo);
+int issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms);
+void rtw_init_tdls_timer(_adapter *padapter, struct sta_info *psta);
+void rtw_free_tdls_timer(struct sta_info *psta);
+void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta);
+#ifdef CONFIG_WFD
+int issue_tunneled_probe_req(_adapter *padapter);
+int issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame);
+#endif //CONFIG_WFD
+int issue_tdls_dis_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt);
+int issue_tdls_setup_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, int wait_ack);
+int issue_tdls_setup_rsp(_adapter *padapter, struct tdls_txmgmt *ptxmgmt);
+int issue_tdls_setup_cfm(_adapter *padapter, struct tdls_txmgmt *ptxmgmt);
+int issue_tdls_dis_rsp(_adapter * padapter, struct tdls_txmgmt *ptxmgmt, u8 privacy);
+int issue_tdls_teardown(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, u8 wait_ack);
+int issue_tdls_peer_traffic_rsp(_adapter *padapter, struct sta_info *psta);
+int issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *psta);
+int issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr);
+int issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr);
+sint On_TDLS_Dis_Rsp(_adapter *adapter, union recv_frame *precv_frame);
+sint On_TDLS_Setup_Req(_adapter *adapter, union recv_frame *precv_frame);
+int On_TDLS_Setup_Rsp(_adapter *adapter, union recv_frame *precv_frame);
+int On_TDLS_Setup_Cfm(_adapter *adapter, union recv_frame *precv_frame);
+int On_TDLS_Dis_Req(_adapter *adapter, union recv_frame *precv_frame);
+int On_TDLS_Teardown(_adapter *adapter, union recv_frame *precv_frame);
+int On_TDLS_Peer_Traffic_Indication(_adapter *adapter, union recv_frame *precv_frame);
+int On_TDLS_Peer_Traffic_Rsp(_adapter *adapter, union recv_frame *precv_frame);
+sint On_TDLS_Ch_Switch_Req(_adapter *adapter, union recv_frame *precv_frame);
+sint On_TDLS_Ch_Switch_Rsp(_adapter *adapter, union recv_frame *precv_frame);
+void rtw_build_tdls_setup_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
+void rtw_build_tdls_setup_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
+void rtw_build_tdls_setup_cfm_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
+void rtw_build_tdls_teardown_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
+void rtw_build_tdls_dis_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, struct tdls_txmgmt *ptxmgmt);
+void rtw_build_tdls_dis_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog, u8 privacy);
+void rtw_build_tdls_peer_traffic_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
+void rtw_build_tdls_peer_traffic_indication_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
+void rtw_build_tdls_ch_switch_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
+void rtw_build_tdls_ch_switch_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
+void rtw_build_tunneled_probe_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
+void rtw_build_tunneled_probe_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
+
+u8 update_sgi_tdls(_adapter *padapter, struct sta_info *psta);
+u32 update_mask_tdls(_adapter *padapter, struct sta_info *psta);
+#endif //CONFIG_TDLS
+
+#endif
+
diff --git a/rtl8xxx_EU/include/rtw_version.h b/rtl8xxx_EU/include/rtw_version.h
index 2d5046f..fdd5374 100644..100755
--- a/rtl8xxx_EU/include/rtw_version.h
+++ b/rtl8xxx_EU/include/rtw_version.h
@@ -1 +1 @@
-#define DRIVERVERSION "v4.3.0.7_12758.20141114"
+#define DRIVERVERSION "v4.3.0.9_15178.20150907"
diff --git a/rtl8xxx_EU/include/rtw_wapi.h b/rtl8xxx_EU/include/rtw_wapi.h
index 582410c..15b9212 100755
--- a/rtl8xxx_EU/include/rtw_wapi.h
+++ b/rtl8xxx_EU/include/rtw_wapi.h
@@ -1,222 +1,222 @@
-#ifndef __INC_WAPI_H
-#define __INC_WAPI_H
-
-
-#define CONFIG_WAPI_SW_SMS4
-#define WAPI_DEBUG
-
-#define SMS4_MIC_LEN 16
-#define WAPI_EXT_LEN 18
-#define MAX_WAPI_IE_LEN 256
-#define sMacHdrLng 24 // octets in data header, no WEP
-
-#ifdef WAPI_DEBUG
-
-/* WAPI trace debug */
-extern u32 wapi_debug_component;
-
-static inline void dump_buf(u8 *buf, u32 len)
-{
- u32 i;
- printk("-----------------Len %d----------------\n", len);
- for(i=0; i<len; i++)
- printk("%2.2x-", *(buf+i));
- printk("\n");
-}
-
-#define WAPI_TRACE(component, x, args...) \
-do { if(wapi_debug_component & (component)) \
- printk(KERN_DEBUG "WAPI" ":" x "" , \
- ##args);\
-}while(0);
-
-#define WAPI_DATA(component, x, buf, len) \
-do { if(wapi_debug_component & (component)){ \
- printk("%s:\n", x);\
- dump_buf((buf), (len));}\
-}while(0);
-
-#define RT_ASSERT_RET(_Exp) \
- if(!(_Exp)) \
- { \
- printk("RTWLAN: "); \
- printk( "Assertion failed! %s,%s,line=%d\n", \
- #_Exp,__FUNCTION__,__LINE__); \
- return; \
- }
-#define RT_ASSERT_RET_VALUE(_Exp,Ret) \
- if(!(_Exp)) \
- { \
- printk("RTWLAN: "); \
- printk( "Assertion failed! %s,%s,line=%d\n", \
- #_Exp,__FUNCTION__,__LINE__); \
- return (Ret); \
- }
-
-#else
-#define RT_ASSERT_RET(_Exp) do {} while(0)
-#define RT_ASSERT_RET_VALUE(_Exp,Ret) do {} while(0)
-#define WAPI_TRACE(component, x, args...) do {} while(0)
-#define WAPI_DATA(component, x, buf, len) do {} while(0)
-#endif
-
-
-enum WAPI_DEBUG {
- WAPI_INIT = 1,
- WAPI_API = 1<<1,
- WAPI_TX = 1<<2,
- WAPI_RX = 1<<3,
- WAPI_MLME = 1<<4,
- WAPI_IOCTL = 1<<5,
- WAPI_ERR = 1<<31
-};
-
-#define WAPI_MAX_BKID_NUM 4
-#define WAPI_MAX_STAINFO_NUM 4
-#define WAPI_CAM_ENTRY_NUM 14 // 28/2=14
-
-typedef struct _RT_WAPI_BKID
-{
- struct list_head list;
- u8 bkid[16];
-}RT_WAPI_BKID,*PRT_WAPI_BKID;
-
-typedef struct _RT_WAPI_KEY
-{
- u8 dataKey[16];
- u8 micKey[16];
- u8 keyId;
- bool bSet;
- bool bTxEnable;
-}RT_WAPI_KEY,*PRT_WAPI_KEY;
-
-typedef enum _RT_WAPI_PACKET_TYPE
-{
- WAPI_NONE = 0,
- WAPI_PREAUTHENTICATE=1,
- WAPI_STAKEY_REQUEST=2,
- WAPI_AUTHENTICATE_ACTIVE=3,
- WAPI_ACCESS_AUTHENTICATE_REQUEST=4,
- WAPI_ACCESS_AUTHENTICATE_RESPONSE=5,
- WAPI_CERTIFICATE_AUTHENTICATE_REQUEST=6,
- WAPI_CERTIFICATE_AUTHENTICATE_RESPONSE=7,
- WAPI_USK_REQUEST=8,
- WAPI_USK_RESPONSE=9,
- WAPI_USK_CONFIRM=10,
- WAPI_MSK_NOTIFICATION=11,
- WAPI_MSK_RESPONSE=12
-}RT_WAPI_PACKET_TYPE;
-
-typedef struct _RT_WAPI_STA_INFO
-{
- struct list_head list;
- u8 PeerMacAddr[6];
- RT_WAPI_KEY wapiUsk;
- RT_WAPI_KEY wapiUskUpdate;
- RT_WAPI_KEY wapiMsk;
- RT_WAPI_KEY wapiMskUpdate;
- u8 lastRxUnicastPN[16];
- u8 lastTxUnicastPN[16];
- u8 lastRxMulticastPN[16];
- u8 lastRxUnicastPNBEQueue[16];
- u8 lastRxUnicastPNBKQueue[16];
- u8 lastRxUnicastPNVIQueue[16];
- u8 lastRxUnicastPNVOQueue[16];
- bool bSetkeyOk;
- bool bAuthenticateInProgress;
- bool bAuthenticatorInUpdata;
-}RT_WAPI_STA_INFO,*PRT_WAPI_STA_INFO;
-
-//Added for HW wapi en/decryption
-typedef struct _RT_WAPI_CAM_ENTRY{
- //RT_LIST_ENTRY list;
- u8 IsUsed;
- u8 entry_idx;//for cam entry
- u8 keyidx; // 0 or 1,new or old key
- u8 PeerMacAddr[6];
- u8 type; //should be 110,wapi
-}RT_WAPI_CAM_ENTRY,*PRT_WAPI_CAM_ENTRY;
-
-typedef struct _RT_WAPI_T
-{
-//BKID
- RT_WAPI_BKID wapiBKID[WAPI_MAX_BKID_NUM];
- struct list_head wapiBKIDIdleList;
- struct list_head wapiBKIDStoreList;
-//Key for Tx Multicast/Broadcast
- RT_WAPI_KEY wapiTxMsk;
-
-//sec related
- u8 lastTxMulticastPN[16];
-//STA list
- RT_WAPI_STA_INFO wapiSta[WAPI_MAX_STAINFO_NUM];
- struct list_head wapiSTAIdleList;
- struct list_head wapiSTAUsedList;
-//
- bool bWapiEnable;
-
-//store WAPI IE
- u8 wapiIE[256];
- u8 wapiIELength;
- bool bWapiPSK;
-//last sequece number for wai packet
- u16 wapiSeqnumAndFragNum;
- int extra_prefix_len;
- int extra_postfix_len;
-
- RT_WAPI_CAM_ENTRY wapiCamEntry[WAPI_CAM_ENTRY_NUM];
-}RT_WAPI_T,*PRT_WAPI_T;
-
-typedef struct _WLAN_HEADER_WAPI_EXTENSION
-{
- u8 KeyIdx;
- u8 Reserved;
- u8 PN[16];
-} WLAN_HEADER_WAPI_EXTENSION, *PWLAN_HEADER_WAPI_EXTENSION;
-
-u32 WapiComparePN(u8 *PN1, u8 *PN2);
-
-
-void rtw_wapi_init(_adapter *padapter);
-
-void rtw_wapi_free(_adapter *padapter);
-
-void rtw_wapi_disable_tx(_adapter *padapter);
-
-u8 rtw_wapi_is_wai_packet(_adapter* padapter,u8 *pkt_data);
-
-void rtw_wapi_update_info(_adapter *padapter, union recv_frame *precv_frame);
-
-u8 rtw_wapi_check_for_drop(_adapter *padapter, union recv_frame *precv_frame);
-
-void rtw_build_probe_resp_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
-
-void rtw_build_beacon_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
-
-void rtw_build_assoc_req_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
-
-void rtw_wapi_on_assoc_ok(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE);
-
-void rtw_wapi_return_one_sta_info(_adapter *padapter, u8 *MacAddr);
-
-void rtw_wapi_return_all_sta_info(_adapter *padapter);
-
-void rtw_wapi_clear_cam_entry(_adapter *padapter, u8 *pMacAddr);
-
-void rtw_wapi_clear_all_cam_entry(_adapter *padapter);
-
-void rtw_wapi_set_key(_adapter *padapter, RT_WAPI_KEY *pWapiKey, RT_WAPI_STA_INFO *pWapiSta, u8 bGroupKey, u8 bUseDefaultKey);
-
-int rtw_wapi_create_event_send(_adapter *padapter, u8 EventId, u8 *MacAddr, u8 *Buff, u16 BufLen);
-
-u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe);
-
-u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe);
-
-void rtw_wapi_get_iv(_adapter *padapter, u8*pRA, u8*IV);
-
-u8 WapiIncreasePN(u8 *PN, u8 AddCount);
-
-bool rtw_wapi_drop_for_key_absent(_adapter *padapter,u8 *pRA);
-
-#endif
+#ifndef __INC_WAPI_H
+#define __INC_WAPI_H
+
+
+#define CONFIG_WAPI_SW_SMS4
+#define WAPI_DEBUG
+
+#define SMS4_MIC_LEN 16
+#define WAPI_EXT_LEN 18
+#define MAX_WAPI_IE_LEN 256
+#define sMacHdrLng 24 // octets in data header, no WEP
+
+#ifdef WAPI_DEBUG
+
+/* WAPI trace debug */
+extern u32 wapi_debug_component;
+
+static inline void dump_buf(u8 *buf, u32 len)
+{
+ u32 i;
+ printk("-----------------Len %d----------------\n", len);
+ for(i=0; i<len; i++)
+ printk("%2.2x-", *(buf+i));
+ printk("\n");
+}
+
+#define WAPI_TRACE(component, x, args...) \
+do { if(wapi_debug_component & (component)) \
+ printk(KERN_DEBUG "WAPI" ":" x "" , \
+ ##args);\
+}while(0);
+
+#define WAPI_DATA(component, x, buf, len) \
+do { if(wapi_debug_component & (component)){ \
+ printk("%s:\n", x);\
+ dump_buf((buf), (len));}\
+}while(0);
+
+#define RT_ASSERT_RET(_Exp) \
+ if(!(_Exp)) \
+ { \
+ printk("RTWLAN: "); \
+ printk( "Assertion failed! %s,%s,line=%d\n", \
+ #_Exp,__FUNCTION__,__LINE__); \
+ return; \
+ }
+#define RT_ASSERT_RET_VALUE(_Exp,Ret) \
+ if(!(_Exp)) \
+ { \
+ printk("RTWLAN: "); \
+ printk( "Assertion failed! %s,%s,line=%d\n", \
+ #_Exp,__FUNCTION__,__LINE__); \
+ return (Ret); \
+ }
+
+#else
+#define RT_ASSERT_RET(_Exp) do {} while(0)
+#define RT_ASSERT_RET_VALUE(_Exp,Ret) do {} while(0)
+#define WAPI_TRACE(component, x, args...) do {} while(0)
+#define WAPI_DATA(component, x, buf, len) do {} while(0)
+#endif
+
+
+enum WAPI_DEBUG {
+ WAPI_INIT = 1,
+ WAPI_API = 1<<1,
+ WAPI_TX = 1<<2,
+ WAPI_RX = 1<<3,
+ WAPI_MLME = 1<<4,
+ WAPI_IOCTL = 1<<5,
+ WAPI_ERR = 1<<31
+};
+
+#define WAPI_MAX_BKID_NUM 4
+#define WAPI_MAX_STAINFO_NUM 4
+#define WAPI_CAM_ENTRY_NUM 14 // 28/2=14
+
+typedef struct _RT_WAPI_BKID
+{
+ struct list_head list;
+ u8 bkid[16];
+}RT_WAPI_BKID,*PRT_WAPI_BKID;
+
+typedef struct _RT_WAPI_KEY
+{
+ u8 dataKey[16];
+ u8 micKey[16];
+ u8 keyId;
+ bool bSet;
+ bool bTxEnable;
+}RT_WAPI_KEY,*PRT_WAPI_KEY;
+
+typedef enum _RT_WAPI_PACKET_TYPE
+{
+ WAPI_NONE = 0,
+ WAPI_PREAUTHENTICATE=1,
+ WAPI_STAKEY_REQUEST=2,
+ WAPI_AUTHENTICATE_ACTIVE=3,
+ WAPI_ACCESS_AUTHENTICATE_REQUEST=4,
+ WAPI_ACCESS_AUTHENTICATE_RESPONSE=5,
+ WAPI_CERTIFICATE_AUTHENTICATE_REQUEST=6,
+ WAPI_CERTIFICATE_AUTHENTICATE_RESPONSE=7,
+ WAPI_USK_REQUEST=8,
+ WAPI_USK_RESPONSE=9,
+ WAPI_USK_CONFIRM=10,
+ WAPI_MSK_NOTIFICATION=11,
+ WAPI_MSK_RESPONSE=12
+}RT_WAPI_PACKET_TYPE;
+
+typedef struct _RT_WAPI_STA_INFO
+{
+ struct list_head list;
+ u8 PeerMacAddr[6];
+ RT_WAPI_KEY wapiUsk;
+ RT_WAPI_KEY wapiUskUpdate;
+ RT_WAPI_KEY wapiMsk;
+ RT_WAPI_KEY wapiMskUpdate;
+ u8 lastRxUnicastPN[16];
+ u8 lastTxUnicastPN[16];
+ u8 lastRxMulticastPN[16];
+ u8 lastRxUnicastPNBEQueue[16];
+ u8 lastRxUnicastPNBKQueue[16];
+ u8 lastRxUnicastPNVIQueue[16];
+ u8 lastRxUnicastPNVOQueue[16];
+ bool bSetkeyOk;
+ bool bAuthenticateInProgress;
+ bool bAuthenticatorInUpdata;
+}RT_WAPI_STA_INFO,*PRT_WAPI_STA_INFO;
+
+//Added for HW wapi en/decryption
+typedef struct _RT_WAPI_CAM_ENTRY{
+ //RT_LIST_ENTRY list;
+ u8 IsUsed;
+ u8 entry_idx;//for cam entry
+ u8 keyidx; // 0 or 1,new or old key
+ u8 PeerMacAddr[6];
+ u8 type; //should be 110,wapi
+}RT_WAPI_CAM_ENTRY,*PRT_WAPI_CAM_ENTRY;
+
+typedef struct _RT_WAPI_T
+{
+//BKID
+ RT_WAPI_BKID wapiBKID[WAPI_MAX_BKID_NUM];
+ struct list_head wapiBKIDIdleList;
+ struct list_head wapiBKIDStoreList;
+//Key for Tx Multicast/Broadcast
+ RT_WAPI_KEY wapiTxMsk;
+
+//sec related
+ u8 lastTxMulticastPN[16];
+//STA list
+ RT_WAPI_STA_INFO wapiSta[WAPI_MAX_STAINFO_NUM];
+ struct list_head wapiSTAIdleList;
+ struct list_head wapiSTAUsedList;
+//
+ bool bWapiEnable;
+
+//store WAPI IE
+ u8 wapiIE[256];
+ u8 wapiIELength;
+ bool bWapiPSK;
+//last sequece number for wai packet
+ u16 wapiSeqnumAndFragNum;
+ int extra_prefix_len;
+ int extra_postfix_len;
+
+ RT_WAPI_CAM_ENTRY wapiCamEntry[WAPI_CAM_ENTRY_NUM];
+}RT_WAPI_T,*PRT_WAPI_T;
+
+typedef struct _WLAN_HEADER_WAPI_EXTENSION
+{
+ u8 KeyIdx;
+ u8 Reserved;
+ u8 PN[16];
+} WLAN_HEADER_WAPI_EXTENSION, *PWLAN_HEADER_WAPI_EXTENSION;
+
+u32 WapiComparePN(u8 *PN1, u8 *PN2);
+
+
+void rtw_wapi_init(_adapter *padapter);
+
+void rtw_wapi_free(_adapter *padapter);
+
+void rtw_wapi_disable_tx(_adapter *padapter);
+
+u8 rtw_wapi_is_wai_packet(_adapter* padapter,u8 *pkt_data);
+
+void rtw_wapi_update_info(_adapter *padapter, union recv_frame *precv_frame);
+
+u8 rtw_wapi_check_for_drop(_adapter *padapter, union recv_frame *precv_frame);
+
+void rtw_build_probe_resp_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
+
+void rtw_build_beacon_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
+
+void rtw_build_assoc_req_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
+
+void rtw_wapi_on_assoc_ok(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE);
+
+void rtw_wapi_return_one_sta_info(_adapter *padapter, u8 *MacAddr);
+
+void rtw_wapi_return_all_sta_info(_adapter *padapter);
+
+void rtw_wapi_clear_cam_entry(_adapter *padapter, u8 *pMacAddr);
+
+void rtw_wapi_clear_all_cam_entry(_adapter *padapter);
+
+void rtw_wapi_set_key(_adapter *padapter, RT_WAPI_KEY *pWapiKey, RT_WAPI_STA_INFO *pWapiSta, u8 bGroupKey, u8 bUseDefaultKey);
+
+int rtw_wapi_create_event_send(_adapter *padapter, u8 EventId, u8 *MacAddr, u8 *Buff, u16 BufLen);
+
+u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe);
+
+u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe);
+
+void rtw_wapi_get_iv(_adapter *padapter, u8*pRA, u8*IV);
+
+u8 WapiIncreasePN(u8 *PN, u8 AddCount);
+
+bool rtw_wapi_drop_for_key_absent(_adapter *padapter,u8 *pRA);
+
+#endif
diff --git a/rtl8xxx_EU/include/rtw_wifi_regd.h b/rtl8xxx_EU/include/rtw_wifi_regd.h
index aea6365..aea6365 100644..100755
--- a/rtl8xxx_EU/include/rtw_wifi_regd.h
+++ b/rtl8xxx_EU/include/rtw_wifi_regd.h
diff --git a/rtl8xxx_EU/include/sdio_ops_ce.h b/rtl8xxx_EU/include/sdio_ops_ce.h
index d2da293..6dfc774 100755
--- a/rtl8xxx_EU/include/sdio_ops_ce.h
+++ b/rtl8xxx_EU/include/sdio_ops_ce.h
@@ -16,40 +16,40 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
- ******************************************************************************/
-#ifndef _SDIO_OPS_WINCE_H_
-#define _SDIO_OPS_WINCE_H_
-
-#include <drv_conf.h>
-#include <osdep_service.h>
-#include <drv_types.h>
-#include <osdep_intf.h>
-
-
-#ifdef PLATFORM_OS_CE
-
-
-extern u8 sdbus_cmd52r_ce(struct intf_priv *pintfpriv, u32 addr);
-
-
-extern void sdbus_cmd52w_ce(struct intf_priv *pintfpriv, u32 addr,u8 val8);
-
-
-uint sdbus_read_blocks_to_membuf_ce(struct intf_priv *pintfpriv, u32 addr, u32 cnt, u8 *pbuf);
-
-extern uint sdbus_read_bytes_to_membuf_ce(struct intf_priv *pintfpriv, u32 addr, u32 cnt, u8 *pbuf);
-
-
-extern uint sdbus_write_blocks_from_membuf_ce(struct intf_priv *pintfpriv, u32 addr, u32 cnt, u8 *pbuf,u8 async);
-
-extern uint sdbus_write_bytes_from_membuf_ce(struct intf_priv *pintfpriv, u32 addr, u32 cnt, u8 *pbuf);
-extern u8 sdbus_func1cmd52r_ce(struct intf_priv *pintfpriv, u32 addr);
-extern void sdbus_func1cmd52w_ce(struct intf_priv *pintfpriv, u32 addr, u8 val8);
-extern uint sdbus_read_reg(struct intf_priv *pintfpriv, u32 addr, u32 cnt,void *pdata);
-extern uint sdbus_write_reg(struct intf_priv *pintfpriv, u32 addr, u32 cnt,void *pdata);
-extern void sdio_read_int(_adapter *padapter, u32 addr,u8 sz,void *pdata);
-
-#endif
-
-#endif
-
+ ******************************************************************************/
+#ifndef _SDIO_OPS_WINCE_H_
+#define _SDIO_OPS_WINCE_H_
+
+#include <drv_conf.h>
+#include <osdep_service.h>
+#include <drv_types.h>
+#include <osdep_intf.h>
+
+
+#ifdef PLATFORM_OS_CE
+
+
+extern u8 sdbus_cmd52r_ce(struct intf_priv *pintfpriv, u32 addr);
+
+
+extern void sdbus_cmd52w_ce(struct intf_priv *pintfpriv, u32 addr,u8 val8);
+
+
+uint sdbus_read_blocks_to_membuf_ce(struct intf_priv *pintfpriv, u32 addr, u32 cnt, u8 *pbuf);
+
+extern uint sdbus_read_bytes_to_membuf_ce(struct intf_priv *pintfpriv, u32 addr, u32 cnt, u8 *pbuf);
+
+
+extern uint sdbus_write_blocks_from_membuf_ce(struct intf_priv *pintfpriv, u32 addr, u32 cnt, u8 *pbuf,u8 async);
+
+extern uint sdbus_write_bytes_from_membuf_ce(struct intf_priv *pintfpriv, u32 addr, u32 cnt, u8 *pbuf);
+extern u8 sdbus_func1cmd52r_ce(struct intf_priv *pintfpriv, u32 addr);
+extern void sdbus_func1cmd52w_ce(struct intf_priv *pintfpriv, u32 addr, u8 val8);
+extern uint sdbus_read_reg(struct intf_priv *pintfpriv, u32 addr, u32 cnt,void *pdata);
+extern uint sdbus_write_reg(struct intf_priv *pintfpriv, u32 addr, u32 cnt,void *pdata);
+extern void sdio_read_int(_adapter *padapter, u32 addr,u8 sz,void *pdata);
+
+#endif
+
+#endif
+
diff --git a/rtl8xxx_EU/include/wlan_bssdef.h b/rtl8xxx_EU/include/wlan_bssdef.h
index dac17a0..3a88531 100755
--- a/rtl8xxx_EU/include/wlan_bssdef.h
+++ b/rtl8xxx_EU/include/wlan_bssdef.h
@@ -85,7 +85,8 @@ typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
Ndis802_11Infrastructure,
Ndis802_11AutoUnknown,
Ndis802_11InfrastructureMax, // Not a real value, defined as upper bound
- Ndis802_11APMode
+ Ndis802_11APMode,
+ Ndis802_11Monitor,
} NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
diff --git a/rtl8xxx_EU/include/xmit_osdep.h b/rtl8xxx_EU/include/xmit_osdep.h
index d489ebf..d489ebf 100644..100755
--- a/rtl8xxx_EU/include/xmit_osdep.h
+++ b/rtl8xxx_EU/include/xmit_osdep.h
diff --git a/rtl8xxx_EU/os_dep/linux/ioctl_cfg80211.c b/rtl8xxx_EU/os_dep/linux/ioctl_cfg80211.c
index 761abb9..b2219cb 100644..100755
--- a/rtl8xxx_EU/os_dep/linux/ioctl_cfg80211.c
+++ b/rtl8xxx_EU/os_dep/linux/ioctl_cfg80211.c
@@ -1,6148 +1,6258 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#define _IOCTL_CFG80211_C_
-
-#include <drv_types.h>
-
-#ifdef CONFIG_IOCTL_CFG80211
-
-#include <rtw_wifi_regd.h>
-
-#define RTW_MAX_MGMT_TX_CNT (8)
-
-#define RTW_SCAN_IE_LEN_MAX 2304
-#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 */
-
-#ifdef CONFIG_WAPI_SUPPORT
-
-#ifndef WLAN_CIPHER_SUITE_SMS4
-#define WLAN_CIPHER_SUITE_SMS4 0x00147201
-#endif
-
-#ifndef WLAN_AKM_SUITE_WAPI_PSK
-#define WLAN_AKM_SUITE_WAPI_PSK 0x000FAC04
-#endif
-
-#ifndef WLAN_AKM_SUITE_WAPI_CERT
-#define WLAN_AKM_SUITE_WAPI_CERT 0x000FAC12
-#endif
-
-#ifndef NL80211_WAPI_VERSION_1
-#define NL80211_WAPI_VERSION_1 (1 << 2)
-#endif
-
-#endif
-
-static const u32 rtw_cipher_suites[] = {
- WLAN_CIPHER_SUITE_WEP40,
- WLAN_CIPHER_SUITE_WEP104,
- WLAN_CIPHER_SUITE_TKIP,
- WLAN_CIPHER_SUITE_CCMP,
-#ifdef CONFIG_WAPI_SUPPORT
- WLAN_CIPHER_SUITE_SMS4,
-#endif // CONFIG_WAPI_SUPPORT
-#ifdef CONFIG_IEEE80211W
- WLAN_CIPHER_SUITE_AES_CMAC,
-#endif //CONFIG_IEEE80211W
-};
-
-#define RATETAB_ENT(_rate, _rateid, _flags) \
- { \
- .bitrate = (_rate), \
- .hw_value = (_rateid), \
- .flags = (_flags), \
- }
-
-#define CHAN2G(_channel, _freq, _flags) { \
- .band = IEEE80211_BAND_2GHZ, \
- .center_freq = (_freq), \
- .hw_value = (_channel), \
- .flags = (_flags), \
- .max_antenna_gain = 0, \
- .max_power = 30, \
-}
-
-#define CHAN5G(_channel, _flags) { \
- .band = IEEE80211_BAND_5GHZ, \
- .center_freq = 5000 + (5 * (_channel)), \
- .hw_value = (_channel), \
- .flags = (_flags), \
- .max_antenna_gain = 0, \
- .max_power = 30, \
-}
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
-/* if wowlan is not supported, kernel generate a disconnect at each suspend
- * cf: /net/wireless/sysfs.c, so register a stub wowlan.
- * Moreover wowlan has to be enabled via a the nl80211_set_wowlan callback.
- * (from user space, e.g. iw phy0 wowlan enable)
- */
-static const struct wiphy_wowlan_support wowlan_stub = {
- .flags = WIPHY_WOWLAN_ANY,
- .n_patterns = 0,
- .pattern_max_len = 0,
- .pattern_min_len = 0,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0))
- .max_pkt_offset = 0,
-#endif
-};
-#endif
-
-static struct ieee80211_rate rtw_rates[] = {
- RATETAB_ENT(10, 0x1, 0),
- RATETAB_ENT(20, 0x2, 0),
- RATETAB_ENT(55, 0x4, 0),
- RATETAB_ENT(110, 0x8, 0),
- RATETAB_ENT(60, 0x10, 0),
- RATETAB_ENT(90, 0x20, 0),
- RATETAB_ENT(120, 0x40, 0),
- RATETAB_ENT(180, 0x80, 0),
- RATETAB_ENT(240, 0x100, 0),
- RATETAB_ENT(360, 0x200, 0),
- RATETAB_ENT(480, 0x400, 0),
- RATETAB_ENT(540, 0x800, 0),
-};
-
-#define rtw_a_rates (rtw_rates + 4)
-#define RTW_A_RATES_NUM 8
-#define rtw_g_rates (rtw_rates + 0)
-#define RTW_G_RATES_NUM 12
-
-#define RTW_2G_CHANNELS_NUM 14
-#define RTW_5G_CHANNELS_NUM 37
-
-static struct ieee80211_channel rtw_2ghz_channels[] = {
- CHAN2G(1, 2412, 0),
- CHAN2G(2, 2417, 0),
- CHAN2G(3, 2422, 0),
- CHAN2G(4, 2427, 0),
- CHAN2G(5, 2432, 0),
- CHAN2G(6, 2437, 0),
- CHAN2G(7, 2442, 0),
- CHAN2G(8, 2447, 0),
- CHAN2G(9, 2452, 0),
- CHAN2G(10, 2457, 0),
- CHAN2G(11, 2462, 0),
- CHAN2G(12, 2467, 0),
- CHAN2G(13, 2472, 0),
- CHAN2G(14, 2484, 0),
-};
-
-static struct ieee80211_channel rtw_5ghz_a_channels[] = {
- CHAN5G(34, 0), CHAN5G(36, 0),
- CHAN5G(38, 0), CHAN5G(40, 0),
- CHAN5G(42, 0), CHAN5G(44, 0),
- CHAN5G(46, 0), CHAN5G(48, 0),
- CHAN5G(52, 0), CHAN5G(56, 0),
- CHAN5G(60, 0), CHAN5G(64, 0),
- CHAN5G(100, 0), CHAN5G(104, 0),
- CHAN5G(108, 0), CHAN5G(112, 0),
- CHAN5G(116, 0), CHAN5G(120, 0),
- CHAN5G(124, 0), CHAN5G(128, 0),
- CHAN5G(132, 0), CHAN5G(136, 0),
- CHAN5G(140, 0), CHAN5G(149, 0),
- CHAN5G(153, 0), CHAN5G(157, 0),
- CHAN5G(161, 0), CHAN5G(165, 0),
- CHAN5G(184, 0), CHAN5G(188, 0),
- CHAN5G(192, 0), CHAN5G(196, 0),
- CHAN5G(200, 0), CHAN5G(204, 0),
- CHAN5G(208, 0), CHAN5G(212, 0),
- CHAN5G(216, 0),
-};
-
-
-void rtw_2g_channels_init(struct ieee80211_channel *channels)
-{
- _rtw_memcpy((void*)channels, (void*)rtw_2ghz_channels,
- sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM
- );
-}
-
-void rtw_5g_channels_init(struct ieee80211_channel *channels)
-{
- _rtw_memcpy((void*)channels, (void*)rtw_5ghz_a_channels,
- sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM
- );
-}
-
-void rtw_2g_rates_init(struct ieee80211_rate *rates)
-{
- _rtw_memcpy(rates, rtw_g_rates,
- sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM
- );
-}
-
-void rtw_5g_rates_init(struct ieee80211_rate *rates)
-{
- _rtw_memcpy(rates, rtw_a_rates,
- sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM
- );
-}
-
-struct ieee80211_supported_band *rtw_spt_band_alloc(
- enum ieee80211_band band
- )
-{
- struct ieee80211_supported_band *spt_band = NULL;
- int n_channels, n_bitrates;
-
- if(band == IEEE80211_BAND_2GHZ)
- {
- n_channels = RTW_2G_CHANNELS_NUM;
- n_bitrates = RTW_G_RATES_NUM;
- }
- else if(band == IEEE80211_BAND_5GHZ)
- {
- n_channels = RTW_5G_CHANNELS_NUM;
- n_bitrates = RTW_A_RATES_NUM;
- }
- else
- {
- goto exit;
- }
-
- spt_band = (struct ieee80211_supported_band *)rtw_zmalloc(
- sizeof(struct ieee80211_supported_band)
- + sizeof(struct ieee80211_channel)*n_channels
- + sizeof(struct ieee80211_rate)*n_bitrates
- );
- if(!spt_band)
- goto exit;
-
- spt_band->channels = (struct ieee80211_channel*)(((u8*)spt_band)+sizeof(struct ieee80211_supported_band));
- spt_band->bitrates= (struct ieee80211_rate*)(((u8*)spt_band->channels)+sizeof(struct ieee80211_channel)*n_channels);
- spt_band->band = band;
- spt_band->n_channels = n_channels;
- spt_band->n_bitrates = n_bitrates;
-
- if(band == IEEE80211_BAND_2GHZ)
- {
- rtw_2g_channels_init(spt_band->channels);
- rtw_2g_rates_init(spt_band->bitrates);
- }
- else if(band == IEEE80211_BAND_5GHZ)
- {
- rtw_5g_channels_init(spt_band->channels);
- rtw_5g_rates_init(spt_band->bitrates);
- }
-
- //spt_band.ht_cap
-
-exit:
-
- return spt_band;
-}
-
-void rtw_spt_band_free(struct ieee80211_supported_band *spt_band)
-{
- u32 size = 0;
-
- if(!spt_band)
- return;
-
- if(spt_band->band == IEEE80211_BAND_2GHZ)
- {
- size = sizeof(struct ieee80211_supported_band)
- + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM
- + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM;
- }
- else if(spt_band->band == IEEE80211_BAND_5GHZ)
- {
- size = sizeof(struct ieee80211_supported_band)
- + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM
- + sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM;
- }
- else
- {
-
- }
- rtw_mfree((u8*)spt_band, size);
-}
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
-static const struct ieee80211_txrx_stypes
-rtw_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
- [NL80211_IFTYPE_ADHOC] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ACTION >> 4)
- },
- [NL80211_IFTYPE_STATION] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
- },
- [NL80211_IFTYPE_AP] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
- BIT(IEEE80211_STYPE_DISASSOC >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4) |
- BIT(IEEE80211_STYPE_DEAUTH >> 4) |
- BIT(IEEE80211_STYPE_ACTION >> 4)
- },
- [NL80211_IFTYPE_AP_VLAN] = {
- /* copy AP */
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
- BIT(IEEE80211_STYPE_DISASSOC >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4) |
- BIT(IEEE80211_STYPE_DEAUTH >> 4) |
- BIT(IEEE80211_STYPE_ACTION >> 4)
- },
- [NL80211_IFTYPE_P2P_CLIENT] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
- },
- [NL80211_IFTYPE_P2P_GO] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
- BIT(IEEE80211_STYPE_DISASSOC >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4) |
- BIT(IEEE80211_STYPE_DEAUTH >> 4) |
- BIT(IEEE80211_STYPE_ACTION >> 4)
- },
-};
-#endif
-
-static int rtw_ieee80211_channel_to_frequency(int chan, int band)
-{
- /* see 802.11 17.3.8.3.2 and Annex J
- * there are overlapping channel numbers in 5GHz and 2GHz bands */
-
- if (band == IEEE80211_BAND_5GHZ) {
- if (chan >= 182 && chan <= 196)
- return 4000 + chan * 5;
- else
- return 5000 + chan * 5;
- } else { /* IEEE80211_BAND_2GHZ */
- if (chan == 14)
- return 2484;
- else if (chan < 14)
- return 2407 + chan * 5;
- else
- return 0; /* not supported */
- }
-}
-
-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)
-{
- struct ieee80211_channel *notify_channel;
- struct cfg80211_bss *bss = NULL;
- //struct ieee80211_supported_band *band;
- u16 channel;
- u32 freq;
- u64 notify_timestamp;
- u16 notify_capability;
- u16 notify_interval;
- u8 *notify_ie;
- size_t notify_ielen;
- s32 notify_signal;
- //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;
- u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
- struct wireless_dev *wdev = padapter->rtw_wdev;
- 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 > buf_size){
- DBG_871X("%s IE Length too long > %zu byte \n",__FUNCTION__,buf_size);
- goto exit;
- }
-
-#ifndef CONFIG_WAPI_SUPPORT
- {
- u16 wapi_len = 0;
-
- if(rtw_get_wapi_ie(pnetwork->network.IEs, pnetwork->network.IELength, NULL, &wapi_len)>0)
- {
- if(wapi_len > 0)
- {
- DBG_871X("%s, no support wapi!\n",__FUNCTION__);
- goto exit;
- }
- }
- }
-#endif //!CONFIG_WAPI_SUPPORT
-
- //To reduce PBC Overlap rate
- //_enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
- if(adapter_wdev_data(padapter)->scan_request != NULL)
- {
- u8 *psr=NULL, sr = 0;
- NDIS_802_11_SSID *pssid = &pnetwork->network.Ssid;
- struct cfg80211_scan_request *request = adapter_wdev_data(padapter)->scan_request;
- struct cfg80211_ssid *ssids = request->ssids;
- u32 wpsielen=0;
- u8 *wpsie=NULL;
-
- wpsie = rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen);
-
- if(wpsie && wpsielen>0)
- psr = rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL);
-
- if (sr != 0)
- {
- if(request->n_ssids == 1 && request->n_channels == 1) // it means under processing WPS
- {
- DBG_8192C("ssid=%s, len=%d\n", pssid->Ssid, pssid->SsidLength);
-
- if (ssids[0].ssid_len == 0) {
- }
- else if(pssid->SsidLength == ssids[0].ssid_len &&
- _rtw_memcmp(pssid->Ssid, ssids[0].ssid, ssids[0].ssid_len))
- {
- DBG_871X("%s, got sr and ssid match!\n", __func__);
- }
- else
- {
- if(psr !=NULL)
- *psr = 0; //clear sr
-
-#if 0
- WLAN_BSSID_EX *pselect_network = &pnetwork->network;
- struct cfg80211_bss *pselect_bss = NULL;
- struct ieee80211_channel *notify_channel = NULL;
- u32 freq;
-
- DBG_871X("%s, got sr, but ssid mismatch, to remove this bss\n", __func__);
-
- if (pselect_network->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_5GHZ);
-
- notify_channel = ieee80211_get_channel(wiphy, freq);
- pselect_bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/,
- pselect_network->MacAddress, pselect_network->Ssid.Ssid,
- pselect_network->Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/,
- 0/*WLAN_CAPABILITY_ESS*/);
-
- if(pselect_bss)
- {
- DBG_871X("%s, got bss for cfg80211 for unlinking bss\n", __func__);
-
- cfg80211_unlink_bss(wiphy, pselect_bss);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
- cfg80211_put_bss(wiphy, pselect_bss);
-#else
- cfg80211_put_bss(pselect_bss);
-#endif
-
- }
-
- goto exit;
-#endif
- }
- }
- }
- }
- //_exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
-
-
- channel = pnetwork->network.Configuration.DSConfig;
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-
- notify_channel = ieee80211_get_channel(wiphy, freq);
-
- 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_;
-
- //We've set wiphy's signal_type as CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
- if ( check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE &&
- is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0)) {
- notify_signal = 100*translate_percentage_to_dbm(padapter->recvpriv.signal_strength);//dbm
- } else {
- notify_signal = 100*translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);//dbm
- }
-
- #if 0
- DBG_8192C("bssid: "MAC_FMT"\n", MAC_ARG(pnetwork->network.MacAddress));
- DBG_8192C("Channel: %d(%d)\n", channel, freq);
- 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: %llu\n", notify_timestamp);
- #endif
-
- //pbuf = buf;
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf;
- fctrl = &(pwlanhdr->frame_ctl);
- *(fctrl) = 0;
-
- SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
- //pmlmeext->mgnt_seq++;
-
- if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON
- _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
- SetFrameSubType(pbuf, WIFI_BEACON);
- } else {
- _rtw_memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN);
- SetFrameSubType(pbuf, WIFI_PROBERSP);
- }
-
- _rtw_memcpy(pwlanhdr->addr2, pnetwork->network.MacAddress, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, pnetwork->network.MacAddress, ETH_ALEN);
-
-
- //pbuf += sizeof(struct rtw_ieee80211_hdr_3addr);
- len = sizeof (struct rtw_ieee80211_hdr_3addr);
- _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))
- //{
- // DBG_8192C("%s, got p2p_ie\n", __func__);
- //}
- //#endif
-
-#if 1
- bss = cfg80211_inform_bss_frame(wiphy, notify_channel, (struct ieee80211_mgmt *)pbuf,
- len, notify_signal, GFP_ATOMIC);
-#else
-
- bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)pnetwork->network.MacAddress,
- notify_timestamp, notify_capability, notify_interval, notify_ie,
- notify_ielen, notify_signal, GFP_ATOMIC/*GFP_KERNEL*/);
-#endif
-
- if (unlikely(!bss)) {
- DBG_8192C(FUNC_ADPT_FMT" bss NULL\n", FUNC_ADPT_ARG(padapter));
- goto exit;
- }
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
-#ifndef COMPAT_KERNEL_RELEASE
- //patch for cfg80211, update beacon ies to information_elements
- if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON
-
- if(bss->len_information_elements != bss->len_beacon_ies)
- {
- bss->information_elements = bss->beacon_ies;
- bss->len_information_elements = bss->len_beacon_ies;
- }
- }
-#endif //COMPAT_KERNEL_RELEASE
-#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
-
-/*
- {
- if( bss->information_elements == bss->proberesp_ies)
- {
- if( bss->len_information_elements != bss->len_proberesp_ies)
- {
- DBG_8192C("error!, len_information_elements != bss->len_proberesp_ies\n");
- }
-
- }
- else if(bss->len_information_elements < bss->len_beacon_ies)
- {
- bss->information_elements = bss->beacon_ies;
- bss->len_information_elements = bss->len_beacon_ies;
- }
- }
-*/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
- cfg80211_put_bss(wiphy, bss);
-#else
- cfg80211_put_bss(bss);
-#endif
-
-exit:
-
- if(pbuf)
- rtw_mfree(pbuf, buf_size);
-
- return bss;
-}
-
-/*
- Check the given bss is valid by kernel API cfg80211_get_bss()
- @padapter : the given adapter
-
- return _TRUE if bss is valid, _FALSE for not found.
-*/
-int rtw_cfg80211_check_bss(_adapter *padapter)
-{
- WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
- struct cfg80211_bss *bss = NULL;
- struct ieee80211_channel *notify_channel = NULL;
- u32 freq;
-
- if (!(pnetwork) || !(padapter->rtw_wdev))
- return _FALSE;
-
- if (pnetwork->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_5GHZ);
-
- notify_channel = ieee80211_get_channel(padapter->rtw_wdev->wiphy, freq);
- bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel,
- 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
- cfg80211_put_bss(bss);
-#endif
-
- return (bss!=NULL);
-}
-
-void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter)
-{
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- 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)
- {
- return;
- }
-
- if (!rtw_cfg80211_check_bss(padapter)) {
- WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
- struct wlan_network *scanned = pmlmepriv->cur_network_scanned;
-
- if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE)
- {
-
- _rtw_memcpy(&cur_network->network, pnetwork, sizeof(WLAN_BSSID_EX));
- if(cur_network)
- {
- if (!rtw_cfg80211_inform_bss(padapter,cur_network))
- DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter));
- else
- DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter));
- }
- else
- {
- DBG_871X("cur_network is not exist!!!\n");
- return ;
- }
- }
- else
- {
- if(scanned == NULL)
- rtw_warn_on(1);
-
- if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE
- && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE
- ) {
- if (!rtw_cfg80211_inform_bss(padapter,scanned)) {
- DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter));
- } else {
- //DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter));
- }
- } else {
- DBG_871X("scanned & pnetwork compare fail\n");
- rtw_warn_on(1);
- }
- }
-
- if (!rtw_cfg80211_check_bss(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)
-{
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct wlan_network *cur_network = &(pmlmepriv->cur_network);
- struct wireless_dev *pwdev = padapter->rtw_wdev;
-#ifdef CONFIG_P2P
- struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
-#endif
- struct cfg80211_bss *bss = NULL;
-
- DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
- if (pwdev->iftype != NL80211_IFTYPE_STATION
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT
- #endif
- ) {
- return;
- }
-
- if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
- return;
-
-#ifdef CONFIG_P2P
- if(pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo));
- rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT);
- rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK);
- DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo));
- }
- }
-#endif //CONFIG_P2P
-
- {
- WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
- struct wlan_network *scanned = pmlmepriv->cur_network_scanned;
-
- //DBG_871X(FUNC_ADPT_FMT" BSS not found\n", FUNC_ADPT_ARG(padapter));
-
- if(scanned == NULL) {
- rtw_warn_on(1);
- goto check_bss;
- }
-
- if (_rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE
- && _rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE
- ) {
- if (!rtw_cfg80211_inform_bss(padapter,scanned)) {
- DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter));
- } else {
- //DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter));
- }
- } else {
- DBG_871X("scanned: %s("MAC_FMT"), cur: %s("MAC_FMT")\n",
- scanned->network.Ssid.Ssid, MAC_ARG(scanned->network.MacAddress),
- pnetwork->Ssid.Ssid, MAC_ARG(pnetwork->MacAddress)
- );
- rtw_warn_on(1);
- }
- }
-
-check_bss:
- if (!rtw_cfg80211_check_bss(padapter))
- DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter));
-
- if (rtw_to_roam(padapter) > 0) {
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
- struct wiphy *wiphy = pwdev->wiphy;
- struct ieee80211_channel *notify_channel;
- u32 freq;
- u16 channel = cur_network->network.Configuration.DSConfig;
-
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-
- notify_channel = ieee80211_get_channel(wiphy, freq);
- #endif
-
- DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter));
- cfg80211_roamed(padapter->pnetdev
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
- , notify_channel
- #endif
- , 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
- , GFP_ATOMIC);
- }
- 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
- }
-}
-
-void rtw_cfg80211_indicate_disconnect(_adapter *padapter)
-{
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct wireless_dev *pwdev = padapter->rtw_wdev;
-#ifdef CONFIG_P2P
- struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
-#endif
-
- DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
-
- if (pwdev->iftype != NL80211_IFTYPE_STATION
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT
- #endif
- ) {
- return;
- }
-
- if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
- return;
-
-#ifdef CONFIG_P2P
- if( pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
- rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE);
-
- DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo));
- }
- }
-#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)
- cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0,
- WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/);
- else if(pwdev->sme_state==CFG80211_SME_CONNECTED)
- cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC);
- //else
- //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
- }
-}
-
-
-#ifdef CONFIG_AP_MODE
-static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
-{
- int ret = 0;
- u32 wep_key_idx, wep_key_len,wep_total_len;
- struct sta_info *psta = NULL, *pbcmc_sta = NULL;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct security_priv* psecuritypriv=&(padapter->securitypriv);
- struct sta_priv *pstapriv = &padapter->stapriv;
-
- DBG_8192C("%s\n", __FUNCTION__);
-
- param->u.crypt.err = 0;
- param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
-
- //sizeof(struct ieee_param) = 64 bytes;
- //if (param_len != (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len)
- if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len)
- {
- ret = -EINVAL;
- goto exit;
- }
-
- if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
- param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
- param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff)
- {
- if (param->u.crypt.idx >= WEP_KEYS)
- {
- ret = -EINVAL;
- goto exit;
- }
- }
- else
- {
- psta = rtw_get_stainfo(pstapriv, param->sta_addr);
- if(!psta)
- {
- //ret = -EINVAL;
- DBG_8192C("rtw_set_encryption(), sta has already been removed or never been added\n");
- goto exit;
- }
- }
-
- if (strcmp(param->u.crypt.alg, "none") == 0 && (psta==NULL))
- {
- //todo:clear default encryption keys
-
- DBG_8192C("clear default encryption keys, keyid=%d\n", param->u.crypt.idx);
-
- goto exit;
- }
-
-
- if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta==NULL))
- {
- DBG_8192C("r871x_set_encryption, crypt.alg = WEP\n");
-
- wep_key_idx = param->u.crypt.idx;
- wep_key_len = param->u.crypt.key_len;
-
- DBG_8192C("r871x_set_encryption, wep_key_idx=%d, len=%d\n", wep_key_idx, wep_key_len);
-
- if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0))
- {
- ret = -EINVAL;
- goto exit;
- }
-
- if (wep_key_len > 0)
- {
- wep_key_len = wep_key_len <= 5 ? 5 : 13;
- }
-
- if (psecuritypriv->bWepDefaultKeyIdxSet == 0)
- {
- //wep default key has not been set, so use this key index as default key.
-
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto;
- psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
- psecuritypriv->dot11PrivacyAlgrthm=_WEP40_;
- psecuritypriv->dot118021XGrpPrivacy=_WEP40_;
-
- if(wep_key_len == 13)
- {
- psecuritypriv->dot11PrivacyAlgrthm=_WEP104_;
- psecuritypriv->dot118021XGrpPrivacy=_WEP104_;
- }
-
- psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;
- }
-
- _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len);
-
- psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len;
-
- rtw_ap_set_wep_key(padapter, param->u.crypt.key, wep_key_len, wep_key_idx, 1);
-
- goto exit;
-
- }
-
-
- if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) // //group key
- {
- if(param->u.crypt.set_tx == 0) //group key
- {
- if(strcmp(param->u.crypt.alg, "WEP") == 0)
- {
- DBG_8192C("%s, set group_key, WEP\n", __FUNCTION__);
-
- _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
-
- psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
- if(param->u.crypt.key_len==13)
- {
- psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
- }
-
- }
- else if(strcmp(param->u.crypt.alg, "TKIP") == 0)
- {
- DBG_8192C("%s, set group_key, TKIP\n", __FUNCTION__);
-
- psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
-
- _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
-
- //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len);
- //set mic key
- _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8);
- _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8);
-
- psecuritypriv->busetkipkey = _TRUE;
-
- }
- else if(strcmp(param->u.crypt.alg, "CCMP") == 0)
- {
- DBG_8192C("%s, set group_key, CCMP\n", __FUNCTION__);
-
- psecuritypriv->dot118021XGrpPrivacy = _AES_;
-
- _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
- }
- else
- {
- DBG_8192C("%s, set group_key, none\n", __FUNCTION__);
-
- psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
- }
-
- psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx;
-
- psecuritypriv->binstallGrpkey = _TRUE;
-
- psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!!
-
- rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
-
- pbcmc_sta=rtw_get_bcmc_stainfo(padapter);
- if(pbcmc_sta)
- {
- pbcmc_sta->ieee8021x_blocked = _FALSE;
- pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy
- }
-
- }
-
- goto exit;
-
- }
-
- if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) // psk/802_1x
- {
- if(check_fwstate(pmlmepriv, WIFI_AP_STATE))
- {
- if(param->u.crypt.set_tx ==1) //pairwise key
- {
- _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
-
- if(strcmp(param->u.crypt.alg, "WEP") == 0)
- {
- DBG_8192C("%s, set pairwise key, WEP\n", __FUNCTION__);
-
- psta->dot118021XPrivacy = _WEP40_;
- if(param->u.crypt.key_len==13)
- {
- psta->dot118021XPrivacy = _WEP104_;
- }
- }
- else if(strcmp(param->u.crypt.alg, "TKIP") == 0)
- {
- DBG_8192C("%s, set pairwise key, TKIP\n", __FUNCTION__);
-
- psta->dot118021XPrivacy = _TKIP_;
-
- //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len);
- //set mic key
- _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8);
- _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8);
-
- psecuritypriv->busetkipkey = _TRUE;
-
- }
- else if(strcmp(param->u.crypt.alg, "CCMP") == 0)
- {
-
- DBG_8192C("%s, set pairwise key, CCMP\n", __FUNCTION__);
-
- psta->dot118021XPrivacy = _AES_;
- }
- else
- {
- DBG_8192C("%s, set pairwise key, none\n", __FUNCTION__);
-
- psta->dot118021XPrivacy = _NO_PRIVACY_;
- }
-
- rtw_ap_set_pairwise_key(padapter, psta);
-
- psta->ieee8021x_blocked = _FALSE;
-
- psta->bpairwise_key_installed = _TRUE;
-
- }
- else//group key???
- {
- if(strcmp(param->u.crypt.alg, "WEP") == 0)
- {
- _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
-
- psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
- if(param->u.crypt.key_len==13)
- {
- psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
- }
- }
- else if(strcmp(param->u.crypt.alg, "TKIP") == 0)
- {
- psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
-
- _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
-
- //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len);
- //set mic key
- _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8);
- _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8);
-
- psecuritypriv->busetkipkey = _TRUE;
-
- }
- else if(strcmp(param->u.crypt.alg, "CCMP") == 0)
- {
- psecuritypriv->dot118021XGrpPrivacy = _AES_;
-
- _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
- }
- else
- {
- psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
- }
-
- psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx;
-
- psecuritypriv->binstallGrpkey = _TRUE;
-
- psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!!
-
- rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
-
- pbcmc_sta=rtw_get_bcmc_stainfo(padapter);
- if(pbcmc_sta)
- {
- pbcmc_sta->ieee8021x_blocked = _FALSE;
- pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy
- }
-
- }
-
- }
-
- }
-
-exit:
-
- return ret;
-
-}
-#endif
-
-static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
-{
- int ret = 0;
- u32 wep_key_idx, wep_key_len,wep_total_len;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct security_priv *psecuritypriv = &padapter->securitypriv;
-#ifdef CONFIG_P2P
- struct wifidirect_info* pwdinfo = &padapter->wdinfo;
-#endif //CONFIG_P2P
-
-_func_enter_;
-
- DBG_8192C("%s\n", __func__);
-
- param->u.crypt.err = 0;
- param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
-
- if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len)
- {
- ret = -EINVAL;
- goto exit;
- }
-
- if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
- param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
- param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff)
- {
- if (param->u.crypt.idx >= WEP_KEYS
-#ifdef CONFIG_IEEE80211W
- && param->u.crypt.idx > BIP_MAX_KEYID
-#endif //CONFIG_IEEE80211W
- )
- {
- ret = -EINVAL;
- goto exit;
- }
- } else {
-#ifdef CONFIG_WAPI_SUPPORT
- if (strcmp(param->u.crypt.alg, "SMS4"))
-#endif
- {
- ret = -EINVAL;
- goto exit;
- }
- }
-
- if (strcmp(param->u.crypt.alg, "WEP") == 0)
- {
- RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("wpa_set_encryption, crypt.alg = WEP\n"));
- DBG_8192C("wpa_set_encryption, crypt.alg = WEP\n");
-
- wep_key_idx = param->u.crypt.idx;
- wep_key_len = param->u.crypt.key_len;
-
- if ((wep_key_idx > WEP_KEYS) || (wep_key_len <= 0))
- {
- ret = -EINVAL;
- goto exit;
- }
-
- if (psecuritypriv->bWepDefaultKeyIdxSet == 0)
- {
- //wep default key has not been set, so use this key index as default key.
-
- wep_key_len = wep_key_len <= 5 ? 5 : 13;
-
- psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
- psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
- psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
-
- if(wep_key_len==13)
- {
- psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
- psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
- }
-
- psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;
- }
-
- _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len);
-
- psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len;
-
- rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0, _TRUE);
-
- goto exit;
- }
-
- if(padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) // 802_1x
- {
- struct sta_info * psta,*pbcmc_sta;
- struct sta_priv * pstapriv = &padapter->stapriv;
-
- //DBG_8192C("%s, : dot11AuthAlgrthm == dot11AuthAlgrthm_8021X \n", __func__);
-
- if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == _TRUE) //sta mode
- {
- psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
- if (psta == NULL) {
- //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n"));
- DBG_8192C("%s, : Obtain Sta_info fail \n", __func__);
- }
- else
- {
- //Jeff: don't disable ieee8021x_blocked while clearing key
- if (strcmp(param->u.crypt.alg, "none") != 0)
- psta->ieee8021x_blocked = _FALSE;
-
-
- if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)||
- (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled))
- {
- psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
- }
-
- if(param->u.crypt.set_tx ==1)//pairwise key
- {
-
- DBG_8192C("%s, : param->u.crypt.set_tx ==1 \n", __func__);
-
- _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
-
- if(strcmp(param->u.crypt.alg, "TKIP") == 0)//set mic key
- {
- //DEBUG_ERR(("\nset key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len));
- _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8);
- _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8);
-
- padapter->securitypriv.busetkipkey=_FALSE;
- //_set_timer(&padapter->securitypriv.tkip_timer, 50);
- }
-
- //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, psta, _TRUE, _TRUE);
- }
- else//group key
- {
- if(strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0)
- {
- _rtw_memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
- _rtw_memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[16]),8);
- _rtw_memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[24]),8);
- padapter->securitypriv.binstallGrpkey = _TRUE;
- //DEBUG_ERR((" param->u.crypt.key_len=%d\n", param->u.crypt.key_len));
- DBG_871X(" ~~~~set sta key:groupkey\n");
-
- padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx;
- rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1, _TRUE);
- }
-#ifdef CONFIG_IEEE80211W
- else if(strcmp(param->u.crypt.alg, "BIP") == 0)
- {
- int no;
- //DBG_871X("BIP key_len=%d , index=%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.key_len, param->u.crypt.idx);
- //save the IGTK key, length 16 bytes
- _rtw_memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
- /*DBG_871X("IGTK key below:\n");
- for(no=0;no<16;no++)
- printk(" %02x ", padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey[no]);
- DBG_871X("\n");*/
- padapter->securitypriv.dot11wBIPKeyid = param->u.crypt.idx;
- padapter->securitypriv.binstallBIPkey = _TRUE;
- DBG_871X(" ~~~~set sta key:IGKT\n");
- }
-#endif //CONFIG_IEEE80211W
-
-#ifdef CONFIG_P2P
- if(pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING))
- {
- rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_DONE);
- }
- }
-#endif //CONFIG_P2P
-
- }
- }
-
- pbcmc_sta=rtw_get_bcmc_stainfo(padapter);
- if(pbcmc_sta==NULL)
- {
- //DEBUG_ERR( ("Set OID_802_11_ADD_KEY: bcmc stainfo is null \n"));
- }
- else
- {
- //Jeff: don't disable ieee8021x_blocked while clearing key
- if (strcmp(param->u.crypt.alg, "none") != 0)
- pbcmc_sta->ieee8021x_blocked = _FALSE;
-
- if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)||
- (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled))
- {
- pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
- }
- }
- }
- else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) //adhoc mode
- {
- }
- }
-
-#ifdef CONFIG_WAPI_SUPPORT
- if (strcmp(param->u.crypt.alg, "SMS4") == 0)
- {
- PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
- PRT_WAPI_STA_INFO pWapiSta;
- u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
- u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
- u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
-
- if(param->u.crypt.set_tx == 1)
- {
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
- if(_rtw_memcmp(pWapiSta->PeerMacAddr,param->sta_addr,6))
- {
- _rtw_memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
-
- pWapiSta->wapiUsk.bSet = true;
- _rtw_memcpy(pWapiSta->wapiUsk.dataKey,param->u.crypt.key,16);
- _rtw_memcpy(pWapiSta->wapiUsk.micKey,param->u.crypt.key+16,16);
- pWapiSta->wapiUsk.keyId = param->u.crypt.idx ;
- pWapiSta->wapiUsk.bTxEnable = true;
-
- _rtw_memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiAEPNInitialValueSrc,16);
- _rtw_memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiAEPNInitialValueSrc,16);
- _rtw_memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiAEPNInitialValueSrc,16);
- _rtw_memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiAEPNInitialValueSrc,16);
- _rtw_memcpy(pWapiSta->lastRxUnicastPN,WapiAEPNInitialValueSrc,16);
- pWapiSta->wapiUskUpdate.bTxEnable = false;
- pWapiSta->wapiUskUpdate.bSet = false;
-
- if (psecuritypriv->sw_encrypt== false || psecuritypriv->sw_decrypt == false)
- {
- //set unicast key for ASUE
- rtw_wapi_set_key(padapter, &pWapiSta->wapiUsk, pWapiSta, false, false);
- }
- }
- }
- }
- else
- {
- list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
- if(_rtw_memcmp(pWapiSta->PeerMacAddr,get_bssid(pmlmepriv),6))
- {
- pWapiSta->wapiMsk.bSet = true;
- _rtw_memcpy(pWapiSta->wapiMsk.dataKey,param->u.crypt.key,16);
- _rtw_memcpy(pWapiSta->wapiMsk.micKey,param->u.crypt.key+16,16);
- pWapiSta->wapiMsk.keyId = param->u.crypt.idx ;
- pWapiSta->wapiMsk.bTxEnable = false;
- if(!pWapiSta->bSetkeyOk)
- pWapiSta->bSetkeyOk = true;
- pWapiSta->bAuthenticateInProgress = false;
-
- _rtw_memcpy(pWapiSta->lastRxMulticastPN, WapiAEMultiCastPNInitialValueSrc, 16);
-
- if (psecuritypriv->sw_decrypt == false)
- {
- //set rx broadcast key for ASUE
- rtw_wapi_set_key(padapter, &pWapiSta->wapiMsk, pWapiSta, true, false);
- }
- }
-
- }
- }
- }
-#endif
-
-
-exit:
-
- DBG_8192C("%s, ret=%d\n", __func__, ret);
-
- _func_exit_;
-
- return ret;
-}
-
-static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- u8 key_index, bool pairwise, const u8 *mac_addr,
-#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- u8 key_index, const u8 *mac_addr,
-#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- struct key_params *params)
-{
- char *alg_name;
- u32 param_len;
- struct ieee_param *param = NULL;
- int ret=0;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct wireless_dev *rtw_wdev = padapter->rtw_wdev;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-
- DBG_871X(FUNC_NDEV_FMT" adding key for %pM\n", FUNC_NDEV_ARG(ndev), mac_addr);
- DBG_871X("cipher=0x%x\n", params->cipher);
- DBG_871X("key_len=0x%x\n", params->key_len);
- DBG_871X("seq_len=0x%x\n", params->seq_len);
- DBG_871X("key_index=%d\n", key_index);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- DBG_871X("pairwise=%d\n", pairwise);
-#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
-
- param_len = sizeof(struct ieee_param) + params->key_len;
- param = (struct ieee_param *)rtw_malloc(param_len);
- if (param == NULL)
- return -1;
-
- _rtw_memset(param, 0, param_len);
-
- param->cmd = IEEE_CMD_SET_ENCRYPTION;
- _rtw_memset(param->sta_addr, 0xff, ETH_ALEN);
-
- switch (params->cipher) {
- case IW_AUTH_CIPHER_NONE:
- //todo: remove key
- //remove = 1;
- alg_name = "none";
- break;
- case WLAN_CIPHER_SUITE_WEP40:
- case WLAN_CIPHER_SUITE_WEP104:
- alg_name = "WEP";
- break;
- case WLAN_CIPHER_SUITE_TKIP:
- alg_name = "TKIP";
- break;
- case WLAN_CIPHER_SUITE_CCMP:
- alg_name = "CCMP";
- break;
-#ifdef CONFIG_IEEE80211W
- case WLAN_CIPHER_SUITE_AES_CMAC:
- alg_name = "BIP";
- break;
-#endif //CONFIG_IEEE80211W
-#ifdef CONFIG_WAPI_SUPPORT
- case WLAN_CIPHER_SUITE_SMS4:
- alg_name= "SMS4";
- if(pairwise == NL80211_KEYTYPE_PAIRWISE) {
- if (key_index != 0 && key_index != 1) {
- ret = -ENOTSUPP;
- goto addkey_end;
- }
- _rtw_memcpy((void*)param->sta_addr, (void*)mac_addr, ETH_ALEN);
- } else {
- DBG_871X("mac_addr is null \n");
- }
- DBG_871X("rtw_wx_set_enc_ext: SMS4 case \n");
- break;
-#endif
-
- default:
- ret = -ENOTSUPP;
- goto addkey_end;
- }
-
- strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN);
-
-
- if (!mac_addr || is_broadcast_ether_addr(mac_addr))
- {
- param->u.crypt.set_tx = 0; //for wpa/wpa2 group key
- } else {
- param->u.crypt.set_tx = 1; //for wpa/wpa2 pairwise key
- }
-
-
- //param->u.crypt.idx = key_index - 1;
- param->u.crypt.idx = key_index;
-
- if (params->seq_len && params->seq)
- {
- _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, (u8 *)params->key, params->key_len);
- }
-
- if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
- {
- ret = rtw_cfg80211_set_encryption(ndev, param, param_len);
- }
- else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
- {
-#ifdef CONFIG_AP_MODE
- if(mac_addr)
- _rtw_memcpy(param->sta_addr, (void*)mac_addr, ETH_ALEN);
-
- ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len);
-#endif
- }
- else
- {
- DBG_8192C("error! fw_state=0x%x, iftype=%d\n", pmlmepriv->fw_state, rtw_wdev->iftype);
-
- }
-
-addkey_end:
- if(param)
- {
- rtw_mfree((u8*)param, param_len);
- }
-
- return ret;
-
-}
-
-static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- u8 key_index, bool pairwise, const u8 *mac_addr,
-#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- u8 key_index, const u8 *mac_addr,
-#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- void *cookie,
- void (*callback)(void *cookie,
- struct key_params*))
-{
-#if 0
- struct iwm_priv *iwm = ndev_to_iwm(ndev);
- struct iwm_key *key = &iwm->keys[key_index];
- struct key_params params;
-
- IWM_DBG_WEXT(iwm, DBG, "Getting key %d\n", key_index);
-
- memset(&params, 0, sizeof(params));
-
- params.cipher = key->cipher;
- params.key_len = key->key_len;
- params.seq_len = key->seq_len;
- params.seq = key->seq;
- params.key = key->key;
-
- callback(cookie, &params);
-
- return key->key_len ? 0 : -ENOENT;
-#endif
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
- return 0;
-}
-
-static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- u8 key_index, bool pairwise, const u8 *mac_addr)
-#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- u8 key_index, const u8 *mac_addr)
-#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct security_priv *psecuritypriv = &padapter->securitypriv;
-
- DBG_871X(FUNC_NDEV_FMT" key_index=%d\n", FUNC_NDEV_ARG(ndev), key_index);
-
- if (key_index == psecuritypriv->dot11PrivacyKeyIndex)
- {
- //clear the flag of wep default key set.
- psecuritypriv->bWepDefaultKeyIdxSet = 0;
- }
-
- return 0;
-}
-
-static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
- struct net_device *ndev, u8 key_index
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
- , bool unicast, bool multicast
- #endif
- )
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct security_priv *psecuritypriv = &padapter->securitypriv;
-
- DBG_871X(FUNC_NDEV_FMT" key_index=%d"
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
- ", unicast=%d, multicast=%d"
- #endif
- ".\n", FUNC_NDEV_ARG(ndev), key_index
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
- , unicast, multicast
- #endif
- );
-
- if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) //set wep default key
- {
- psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
-
- psecuritypriv->dot11PrivacyKeyIndex = key_index;
-
- psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
- psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
- if (psecuritypriv->dot11DefKeylen[key_index] == 13)
- {
- psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
- psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
- }
-
- psecuritypriv->bWepDefaultKeyIdxSet = 1; //set the flag to represent that wep default key has been set
- }
-
- return 0;
-
-}
-
-static int cfg80211_rtw_get_station(struct wiphy *wiphy, 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);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct sta_info *psta = NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
-
- sinfo->filled = 0;
-
- if (!mac) {
- DBG_871X(FUNC_NDEV_FMT" mac==%p\n", FUNC_NDEV_ARG(ndev), mac);
- ret = -ENOENT;
- goto exit;
- }
-
- psta = rtw_get_stainfo(pstapriv, (u8 *)mac);
- if (psta == NULL) {
- DBG_8192C("%s, sta_info is null\n", __func__);
- ret = -ENOENT;
- goto exit;
- }
-
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_871X(FUNC_NDEV_FMT" mac="MAC_FMT"\n", FUNC_NDEV_ARG(ndev), MAC_ARG(mac));
-#endif
-
- //for infra./P2PClient mode
- if( check_fwstate(pmlmepriv, WIFI_STATION_STATE)
- && check_fwstate(pmlmepriv, _FW_LINKED)
- )
- {
- struct wlan_network *cur_network = &(pmlmepriv->cur_network);
-
- 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;
- }
-
- sinfo->filled |= STATION_INFO_SIGNAL;
- sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
-
- sinfo->filled |= STATION_INFO_TX_BITRATE;
- sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
-
- sinfo->filled |= STATION_INFO_RX_PACKETS;
- sinfo->rx_packets = sta_rx_data_pkts(psta);
-
- sinfo->filled |= STATION_INFO_TX_PACKETS;
- sinfo->tx_packets = psta->sta_stats.tx_pkts;
-
- }
-
- //for Ad-Hoc/AP mode
- if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)
- ||check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)
- ||check_fwstate(pmlmepriv, WIFI_AP_STATE))
- && check_fwstate(pmlmepriv, _FW_LINKED)
- )
- {
- //TODO: should acquire station info...
- }
-
-exit:
- return ret;
-}
-
-extern int netdev_open(struct net_device *pnetdev);
-#ifdef CONFIG_CONCURRENT_MODE
-extern int netdev_if2_open(struct net_device *pnetdev);
-#endif
-
-/*
-enum nl80211_iftype {
- NL80211_IFTYPE_UNSPECIFIED,
- NL80211_IFTYPE_ADHOC, //1
- NL80211_IFTYPE_STATION, //2
- NL80211_IFTYPE_AP, //3
- NL80211_IFTYPE_AP_VLAN,
- NL80211_IFTYPE_WDS,
- NL80211_IFTYPE_MONITOR, //6
- NL80211_IFTYPE_MESH_POINT,
- NL80211_IFTYPE_P2P_CLIENT, //8
- NL80211_IFTYPE_P2P_GO, //9
- //keep last
- NUM_NL80211_IFTYPES,
- NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1
-};
-*/
-static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
- struct net_device *ndev,
- enum nl80211_iftype type, u32 *flags,
- struct vif_params *params)
-{
- enum nl80211_iftype old_type;
- NDIS_802_11_NETWORK_INFRASTRUCTURE networkType;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct wireless_dev *rtw_wdev = padapter->rtw_wdev;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-#ifdef CONFIG_P2P
- struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
-#endif
- int ret = 0;
- u8 change = _FALSE;
-
- DBG_871X(FUNC_NDEV_FMT" type=%d\n", FUNC_NDEV_ARG(ndev), type);
-
- if(adapter_to_dvobj(padapter)->processing_dev_remove == _TRUE)
- {
- ret= -EPERM;
- goto exit;
- }
-
-#ifdef CONFIG_CONCURRENT_MODE
- if(padapter->adapter_type == SECONDARY_ADAPTER)
- {
- DBG_871X(FUNC_NDEV_FMT" call netdev_if2_open\n", FUNC_NDEV_ARG(ndev));
- if(netdev_if2_open(ndev) != 0) {
- DBG_871X(FUNC_NDEV_FMT" call netdev_if2_open fail\n", FUNC_NDEV_ARG(ndev));
- ret= -EPERM;
- goto exit;
- }
- }
- else if(padapter->adapter_type == PRIMARY_ADAPTER)
-#endif //CONFIG_CONCURRENT_MODE
- {
- DBG_871X(FUNC_NDEV_FMT" call netdev_open\n", FUNC_NDEV_ARG(ndev));
- if(netdev_open(ndev) != 0) {
- DBG_871X(FUNC_NDEV_FMT" call netdev_open fail\n", FUNC_NDEV_ARG(ndev));
- ret= -EPERM;
- goto exit;
- }
- }
-
- if(_FAIL == rtw_pwr_wakeup(padapter)) {
- DBG_871X(FUNC_NDEV_FMT" call rtw_pwr_wakeup fail\n", FUNC_NDEV_ARG(ndev));
- ret= -EPERM;
- goto exit;
- }
-
- old_type = rtw_wdev->iftype;
- DBG_871X(FUNC_NDEV_FMT" old_iftype=%d, new_iftype=%d\n",
- FUNC_NDEV_ARG(ndev), old_type, type);
-
- if(old_type != type)
- {
- change = _TRUE;
- pmlmeext->action_public_rxseq = 0xffff;
- pmlmeext->action_public_dialog_token = 0xff;
- }
-
- switch (type) {
- case NL80211_IFTYPE_ADHOC:
- networkType = Ndis802_11IBSS;
- break;
-#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE))
- case NL80211_IFTYPE_P2P_CLIENT:
-#endif
- case NL80211_IFTYPE_STATION:
- networkType = Ndis802_11Infrastructure;
- #ifdef CONFIG_P2P
- if(pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- if(change && rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
- {
- //it means remove GO and change mode from AP(GO) to station(P2P DEVICE)
- rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE);
- rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
-
- DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo));
- }
- }
- #endif //CONFIG_P2P
- break;
-#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE))
- case NL80211_IFTYPE_P2P_GO:
-#endif
- case NL80211_IFTYPE_AP:
- networkType = Ndis802_11APMode;
- #ifdef CONFIG_P2P
- if(pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- if(change && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- //it means P2P Group created, we will be GO and change mode from P2P DEVICE to AP(GO)
- rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO);
- }
- }
- #endif //CONFIG_P2P
- break;
- default:
- ret = -EOPNOTSUPP;
- goto exit;
- }
-
- rtw_wdev->iftype = type;
-
- if (rtw_set_802_11_infrastructure_mode(padapter, networkType) ==_FALSE)
- {
- rtw_wdev->iftype = old_type;
- ret = -EPERM;
- goto exit;
- }
-
- rtw_setopmode_cmd(padapter, networkType,_TRUE);
-
-exit:
-
- DBG_871X(FUNC_NDEV_FMT" ret:%d\n", FUNC_NDEV_ARG(ndev), ret);
- return ret;
-}
-
-void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
-{
- struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
- _irqL irqL;
-
- _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
- if (pwdev_priv->scan_request != NULL) {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_871X("%s with scan req\n", __FUNCTION__);
- #endif
-
- /* avoid WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); */
- if(pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy)
- {
- DBG_8192C("error wiphy compare\n");
- }
- else
- {
- cfg80211_scan_done(pwdev_priv->scan_request, aborted);
- }
-
- pwdev_priv->scan_request = NULL;
- } else {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_871X("%s without scan req\n", __FUNCTION__);
- #endif
- }
- _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
-}
-
-void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
-{
- _irqL irqL;
- _list *plist, *phead;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- _queue *queue = &(pmlmepriv->scanned_queue);
- struct wlan_network *pnetwork = NULL;
- u32 cnt=0;
- u32 wait_for_surveydone;
- sint wait_status;
-#ifdef CONFIG_P2P
- struct wifidirect_info* pwdinfo = &padapter->wdinfo;
-#endif //CONFIG_P2P
- struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
-
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s\n", __func__);
-#endif
-
- _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-
- phead = get_list_head(queue);
- plist = get_next(phead);
-
- while(1)
- {
- if (rtw_end_of_queue_search(phead,plist)== _TRUE)
- break;
-
- pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
-
- //report network only if the current channel set contains the channel to which this network belongs
- if(rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0
- && rtw_mlme_band_check(padapter, pnetwork->network.Configuration.DSConfig) == _TRUE
- && _TRUE == rtw_validate_ssid(&(pnetwork->network.Ssid))
- )
- {
- //ev=translate_scan(padapter, a, pnetwork, ev, stop);
- rtw_cfg80211_inform_bss(padapter, pnetwork);
- }
-
- plist = get_next(plist);
-
- }
-
- _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-}
-
-static int rtw_cfg80211_set_probe_req_wpsp2pie(_adapter *padapter, char *buf, int len)
-{
- int ret = 0;
- uint wps_ielen = 0;
- u8 *wps_ie;
- u32 p2p_ielen = 0;
- u8 *p2p_ie;
- u32 wfd_ielen = 0;
- u8 *wfd_ie;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, ielen=%d\n", __func__, len);
-#endif
-
- if(len>0)
- {
- if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
- {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("probe_req_wps_ielen=%d\n", wps_ielen);
- #endif
-
- if(pmlmepriv->wps_probe_req_ie)
- {
- u32 free_len = pmlmepriv->wps_probe_req_ie_len;
- pmlmepriv->wps_probe_req_ie_len = 0;
- rtw_mfree(pmlmepriv->wps_probe_req_ie, free_len);
- pmlmepriv->wps_probe_req_ie = NULL;
- }
-
- pmlmepriv->wps_probe_req_ie = rtw_malloc(wps_ielen);
- if ( pmlmepriv->wps_probe_req_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
- _rtw_memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen);
- pmlmepriv->wps_probe_req_ie_len = wps_ielen;
- }
-
- //buf += wps_ielen;
- //len -= wps_ielen;
-
- #ifdef CONFIG_P2P
- if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen)))
- {
- struct wifidirect_info *wdinfo = &padapter->wdinfo;
- u32 attr_contentlen = 0;
- u8 listen_ch_attr[5];
-
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("probe_req_p2p_ielen=%d\n", p2p_ielen);
- #endif
-
- if(pmlmepriv->p2p_probe_req_ie)
- {
- u32 free_len = pmlmepriv->p2p_probe_req_ie_len;
- pmlmepriv->p2p_probe_req_ie_len = 0;
- rtw_mfree(pmlmepriv->p2p_probe_req_ie, free_len);
- pmlmepriv->p2p_probe_req_ie = NULL;
- }
-
- pmlmepriv->p2p_probe_req_ie = rtw_malloc(p2p_ielen);
- if ( pmlmepriv->p2p_probe_req_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
- _rtw_memcpy(pmlmepriv->p2p_probe_req_ie, p2p_ie, p2p_ielen);
- pmlmepriv->p2p_probe_req_ie_len = p2p_ielen;
-
- if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_LISTEN_CH, (u8*)listen_ch_attr, (uint*) &attr_contentlen)
- && attr_contentlen == 5)
- {
- if (wdinfo->listen_channel != listen_ch_attr[4]) {
- DBG_871X(FUNC_ADPT_FMT" listen channel - country:%c%c%c, class:%u, ch:%u\n",
- FUNC_ADPT_ARG(padapter), listen_ch_attr[0], listen_ch_attr[1], listen_ch_attr[2],
- listen_ch_attr[3], listen_ch_attr[4]);
- wdinfo->listen_channel = listen_ch_attr[4];
- }
- }
- }
- #endif //CONFIG_P2P
-
- //buf += p2p_ielen;
- //len -= p2p_ielen;
-
- #ifdef CONFIG_WFD
- if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen))
- {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("probe_req_wfd_ielen=%d\n", wfd_ielen);
- #endif
-
- if(pmlmepriv->wfd_probe_req_ie)
- {
- u32 free_len = pmlmepriv->wfd_probe_req_ie_len;
- pmlmepriv->wfd_probe_req_ie_len = 0;
- rtw_mfree(pmlmepriv->wfd_probe_req_ie, free_len);
- pmlmepriv->wfd_probe_req_ie = NULL;
- }
-
- pmlmepriv->wfd_probe_req_ie = rtw_malloc(wfd_ielen);
- if ( pmlmepriv->wfd_probe_req_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
- rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len);
- }
- #endif //CONFIG_WFD
-
- }
-
- return ret;
-
-}
-
-static int cfg80211_rtw_scan(struct wiphy *wiphy
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
- , struct net_device *ndev
- #endif
- , struct cfg80211_scan_request *request)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct net_device *ndev = wdev_to_ndev(request->wdev);
-#endif
- int i;
- u8 _status = _FALSE;
- int ret = 0;
- NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
- struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
- _irqL irqL;
- u8 *wps_ie=NULL;
- uint wps_ielen=0;
- u8 *p2p_ie=NULL;
- uint p2p_ielen=0;
- u8 survey_times=3;
- u8 survey_times_for_one_ch=6;
- struct cfg80211_ssid *ssids = request->ssids;
- int social_channel = 0, j = 0;
- bool need_indicate_scan_done = _FALSE;
-
- _adapter *padapter;
- struct rtw_wdev_priv *pwdev_priv;
- struct mlme_priv *pmlmepriv;
-#ifdef CONFIG_P2P
- struct wifidirect_info *pwdinfo;
-#endif //CONFIG_P2P
-#ifdef CONFIG_CONCURRENT_MODE
- PADAPTER pbuddy_adapter = NULL;
- struct mlme_priv *pbuddy_mlmepriv = NULL;
-#endif //CONFIG_CONCURRENT_MODE
-
- if (ndev == NULL) {
- ret = -EINVAL;
- goto exit;
- }
-
- padapter = (_adapter *)rtw_netdev_priv(ndev);
- pwdev_priv = adapter_wdev_data(padapter);
- pmlmepriv= &padapter->mlmepriv;
-#ifdef CONFIG_P2P
- pwdinfo= &(padapter->wdinfo);
-#endif //CONFIG_P2P
-
-//#ifdef CONFIG_DEBUG_CFG80211
- DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
-//#endif
-
-#ifdef CONFIG_CONCURRENT_MODE
- if (padapter->pbuddy_adapter) {
- pbuddy_adapter = padapter->pbuddy_adapter;
- pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv);
- }
-#endif //CONFIG_CONCURRENT_MODE
-
-#ifdef CONFIG_MP_INCLUDED
-if (padapter->registrypriv.mp_mode == 1)
-{
- DBG_871X(FUNC_ADPT_FMT ": MP mode block Scan request\n", FUNC_ADPT_ARG(padapter));
- ret = -EPERM;
- goto exit;
-}
-#ifdef CONFIG_CONCURRENT_MODE
- if (padapter->pbuddy_adapter) {
- if (padapter->pbuddy_adapter->registrypriv.mp_mode == 1)
- {
- DBG_871X(FUNC_ADPT_FMT ": MP mode block Scan request\n", FUNC_ADPT_ARG(padapter->pbuddy_adapter));
- ret = -EPERM;
- goto exit;
- }
- }
-#endif //CONFIG_CONCURRENT_MODE
-#endif
-
- _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
- pwdev_priv->scan_request = request;
- _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
-
- if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
- {
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_871X("%s under WIFI_AP_STATE\n", __FUNCTION__);
-#endif
-
- if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS|_FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE)
- {
- DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state);
-
- if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS))
- {
- DBG_8192C("AP mode process WPS \n");
- }
-
- need_indicate_scan_done = _TRUE;
- goto check_need_indicate_scan_done;
- }
- }
-
- rtw_ps_deny(padapter, PS_DENY_SCAN);
- if(_FAIL == rtw_pwr_wakeup(padapter)) {
- need_indicate_scan_done = _TRUE;
- goto check_need_indicate_scan_done;
- }
-
- #ifdef CONFIG_P2P
- if( pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- if(ssids->ssid != NULL
- && _rtw_memcmp(ssids->ssid, "DIRECT-", 7)
- && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL)
- )
- {
- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- rtw_p2p_enable(padapter, P2P_ROLE_DEVICE);
- adapter_wdev_data(padapter)->p2p_enabled = _TRUE;
- }
- else
- {
- rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo));
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo));
- #endif
- }
- rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN);
-
- if(request->n_channels == 3 &&
- request->channels[0]->hw_value == 1 &&
- request->channels[1]->hw_value == 6 &&
- request->channels[2]->hw_value == 11
- )
- {
- social_channel = 1;
- }
- }
- }
- #endif //CONFIG_P2P
-
- if(request->ie && request->ie_len>0)
- {
- rtw_cfg80211_set_probe_req_wpsp2pie(padapter, (u8 *)request->ie, request->ie_len );
- }
-
- if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) {
- DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state);
- need_indicate_scan_done = _TRUE;
- goto check_need_indicate_scan_done;
- } else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) {
- DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state);
- ret = -EBUSY;
- goto check_need_indicate_scan_done;
- }
-
- if (pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)
- {
-#if 1 // Miracast can't do AP scan
- static u32 lastscantime = 0;
- u32 passtime;
-
- passtime = rtw_get_passing_time_ms(lastscantime);
- lastscantime = rtw_get_current_time();
- if (passtime > 12000)
-#endif
- {
- DBG_871X("%s: bBusyTraffic == _TRUE\n", __FUNCTION__);
- need_indicate_scan_done = _TRUE;
- goto check_need_indicate_scan_done;
- }
- }
-
- if (rtw_is_scan_deny(padapter)){
- DBG_871X(FUNC_ADPT_FMT ": scan deny\n", FUNC_ADPT_ARG(padapter));
- need_indicate_scan_done = _TRUE;
- goto check_need_indicate_scan_done;
- }
-
-#ifdef CONFIG_CONCURRENT_MODE
- if(pbuddy_mlmepriv && (pbuddy_mlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE))
- {
-#if 1 // Miracast can't do AP scan
- static u32 buddylastscantime = 0;
- u32 passtime;
-
- passtime = rtw_get_passing_time_ms(buddylastscantime);
- buddylastscantime = rtw_get_current_time();
- if ((passtime > 12000)
-//#ifdef CONFIG_P2P
-// ||(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE))
-//#endif //CONFIG_P2P
- )
-#endif
- {
- DBG_871X("%s: bBusyTraffic == _TRUE at buddy_intf\n", __FUNCTION__);
- need_indicate_scan_done = _TRUE;
- goto check_need_indicate_scan_done;
- }
- }
-
- if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE) {
- DBG_871X("buddy_intf's mlme state:0x%x\n", pbuddy_mlmepriv->fw_state);
- need_indicate_scan_done = _TRUE;
- goto check_need_indicate_scan_done;
-
- } else if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY)) {
- bool scan_via_buddy = _FALSE;
- struct rtw_wdev_priv *buddy_wdev_priv = adapter_wdev_data(pbuddy_adapter);
-
- _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
- _enter_critical_bh(&buddy_wdev_priv->scan_req_lock, &irqL);
- if (buddy_wdev_priv->scan_request) {
- DBG_871X("scan via buddy\n");
- pmlmepriv->scanning_via_buddy_intf = _TRUE;
- _enter_critical_bh(&pmlmepriv->lock, &irqL);
- set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
- _exit_critical_bh(&pmlmepriv->lock, &irqL);
- scan_via_buddy = _TRUE;
- }
- _exit_critical_bh(&buddy_wdev_priv->scan_req_lock, &irqL);
- _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
-
- if (scan_via_buddy == _FALSE)
- need_indicate_scan_done = _TRUE;
-
- goto check_need_indicate_scan_done;
- }
-#endif /* CONFIG_CONCURRENT_MODE */
-
-#ifdef CONFIG_P2P
- 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);
-
- 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
-
-
- _rtw_memset(ssid, 0, sizeof(NDIS_802_11_SSID)*RTW_SSID_SCAN_AMOUNT);
- //parsing request ssids, n_ssids
- for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("ssid=%s, len=%d\n", ssids[i].ssid, ssids[i].ssid_len);
- #endif
- _rtw_memcpy(ssid[i].Ssid, ssids[i].ssid, ssids[i].ssid_len);
- ssid[i].SsidLength = ssids[i].ssid_len;
- }
-
- /* parsing channels, n_channels */
- _rtw_memset(ch, 0, sizeof(struct rtw_ieee80211_channel)*RTW_CHANNEL_SCAN_AMOUNT);
- for (i=0;i<request->n_channels && i<RTW_CHANNEL_SCAN_AMOUNT;i++) {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_871X(FUNC_ADPT_FMT CHAN_FMT"\n", FUNC_ADPT_ARG(padapter), CHAN_ARG(request->channels[i]));
- #endif
- ch[i].hw_value = request->channels[i]->hw_value;
- ch[i].flags = request->channels[i]->flags;
- }
-
- _enter_critical_bh(&pmlmepriv->lock, &irqL);
- if (request->n_channels == 1) {
- for(i=1;i<survey_times_for_one_ch;i++)
- _rtw_memcpy(&ch[i], &ch[0], sizeof(struct rtw_ieee80211_channel));
- _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, ch, survey_times_for_one_ch);
- } else if (request->n_channels <= 4) {
- for(j=request->n_channels-1;j>=0;j--)
- for(i=0;i<survey_times;i++)
- {
- _rtw_memcpy(&ch[j*survey_times+i], &ch[j], sizeof(struct rtw_ieee80211_channel));
- }
- _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, ch, survey_times * request->n_channels);
- } else {
- _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, NULL, 0);
- }
- _exit_critical_bh(&pmlmepriv->lock, &irqL);
-
-
- if(_status == _FALSE)
- {
- ret = -1;
- }
-
-check_need_indicate_scan_done:
- if (_TRUE == need_indicate_scan_done)
- {
- rtw_cfg80211_surveydone_event_callback(padapter);
- rtw_cfg80211_indicate_scan_done(padapter, _FALSE);
- }
-
-cancel_ps_deny:
- rtw_ps_deny_cancel(padapter, PS_DENY_SCAN);
-
-exit:
- return ret;
-
-}
-
-static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed)
-{
-#if 0
- struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
-
- if (changed & WIPHY_PARAM_RTS_THRESHOLD &&
- (iwm->conf.rts_threshold != wiphy->rts_threshold)) {
- int ret;
-
- iwm->conf.rts_threshold = wiphy->rts_threshold;
-
- ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX,
- CFG_RTS_THRESHOLD,
- iwm->conf.rts_threshold);
- if (ret < 0)
- return ret;
- }
-
- if (changed & WIPHY_PARAM_FRAG_THRESHOLD &&
- (iwm->conf.frag_threshold != wiphy->frag_threshold)) {
- int ret;
-
- iwm->conf.frag_threshold = wiphy->frag_threshold;
-
- ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_FA_CFG_FIX,
- CFG_FRAG_THRESHOLD,
- iwm->conf.frag_threshold);
- if (ret < 0)
- return ret;
- }
-#endif
- DBG_8192C("%s\n", __func__);
- return 0;
-}
-
-
-
-static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32 wpa_version)
-{
- DBG_8192C("%s, wpa_version=%d\n", __func__, wpa_version);
-
- if (!wpa_version) {
- psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
- return 0;
- }
-
-
- if (wpa_version & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2))
- {
- psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPAPSK;
- }
-
-/*
- if (wpa_version & NL80211_WPA_VERSION_2)
- {
- psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK;
- }
-*/
-
- #ifdef CONFIG_WAPI_SUPPORT
- if (wpa_version & NL80211_WAPI_VERSION_1)
- {
- psecuritypriv->ndisauthtype = Ndis802_11AuthModeWAPI;
- }
- #endif
-
- return 0;
-
-}
-
-static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv,
- enum nl80211_auth_type sme_auth_type)
-{
- DBG_8192C("%s, nl80211_auth_type=%d\n", __func__, sme_auth_type);
-
-
- switch (sme_auth_type) {
- case NL80211_AUTHTYPE_AUTOMATIC:
-
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto;
-
- break;
- case NL80211_AUTHTYPE_OPEN_SYSTEM:
-
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
-
- if(psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA)
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
-
-#ifdef CONFIG_WAPI_SUPPORT
- if(psecuritypriv->ndisauthtype == Ndis802_11AuthModeWAPI)
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
-#endif
-
- break;
- case NL80211_AUTHTYPE_SHARED_KEY:
-
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Shared;
-
- psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
-
-
- break;
- default:
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
- //return -ENOTSUPP;
- }
-
- return 0;
-
-}
-
-static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 cipher, bool ucast)
-{
- u32 ndisencryptstatus = Ndis802_11EncryptionDisabled;
-
- u32 *profile_cipher = ucast ? &psecuritypriv->dot11PrivacyAlgrthm :
- &psecuritypriv->dot118021XGrpPrivacy;
-
- DBG_8192C("%s, ucast=%d, cipher=0x%x\n", __func__, ucast, cipher);
-
-
- if (!cipher) {
- *profile_cipher = _NO_PRIVACY_;
- psecuritypriv->ndisencryptstatus = ndisencryptstatus;
- return 0;
- }
-
- switch (cipher) {
- case IW_AUTH_CIPHER_NONE:
- *profile_cipher = _NO_PRIVACY_;
- ndisencryptstatus = Ndis802_11EncryptionDisabled;
-#ifdef CONFIG_WAPI_SUPPORT
- if(psecuritypriv->dot11PrivacyAlgrthm ==_SMS4_ )
- {
- *profile_cipher = _SMS4_;
- }
-#endif
- break;
- case WLAN_CIPHER_SUITE_WEP40:
- *profile_cipher = _WEP40_;
- ndisencryptstatus = Ndis802_11Encryption1Enabled;
- break;
- case WLAN_CIPHER_SUITE_WEP104:
- *profile_cipher = _WEP104_;
- ndisencryptstatus = Ndis802_11Encryption1Enabled;
- break;
- case WLAN_CIPHER_SUITE_TKIP:
- *profile_cipher = _TKIP_;
- ndisencryptstatus = Ndis802_11Encryption2Enabled;
- break;
- case WLAN_CIPHER_SUITE_CCMP:
- *profile_cipher = _AES_;
- ndisencryptstatus = Ndis802_11Encryption3Enabled;
- break;
-#ifdef CONFIG_WAPI_SUPPORT
- case WLAN_CIPHER_SUITE_SMS4:
- *profile_cipher = _SMS4_;
- ndisencryptstatus = Ndis802_11_EncrypteionWAPI;
- break;
-#endif
- default:
- DBG_8192C("Unsupported cipher: 0x%x\n", cipher);
- return -ENOTSUPP;
- }
-
- if(ucast)
- {
- psecuritypriv->ndisencryptstatus = ndisencryptstatus;
-
- //if(psecuritypriv->dot11PrivacyAlgrthm >= _AES_)
- // psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK;
- }
-
- return 0;
-}
-
-static int rtw_cfg80211_set_key_mgt(struct security_priv *psecuritypriv, u32 key_mgt)
-{
- DBG_8192C("%s, key_mgt=0x%x\n", __func__, key_mgt);
-
- if (key_mgt == WLAN_AKM_SUITE_8021X)
- //*auth_type = UMAC_AUTH_TYPE_8021X;
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
- else if (key_mgt == WLAN_AKM_SUITE_PSK) {
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
- }
-#ifdef CONFIG_WAPI_SUPPORT
- else if(key_mgt ==WLAN_AKM_SUITE_WAPI_PSK){
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
- }
- else if(key_mgt ==WLAN_AKM_SUITE_WAPI_CERT){
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
- }
-#endif
-
-
- else {
- DBG_8192C("Invalid key mgt: 0x%x\n", key_mgt);
- //return -EINVAL;
- }
-
- return 0;
-}
-
-static int rtw_cfg80211_set_wpa_ie(_adapter *padapter, u8 *pie, size_t ielen)
-{
- u8 *buf=NULL, *pos=NULL;
- u32 left;
- int group_cipher = 0, pairwise_cipher = 0;
- int ret = 0;
- int wpa_ielen=0;
- int wpa2_ielen=0;
- u8 *pwpa, *pwpa2;
- u8 null_addr[]= {0,0,0,0,0,0};
-
- if (pie == NULL || !ielen) {
- /* Treat this as normal case, but need to clear WIFI_UNDER_WPS */
- _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
- goto exit;
- }
-
- if (ielen > MAX_WPA_IE_LEN+MAX_WPS_IE_LEN+MAX_P2P_IE_LEN) {
- ret = -EINVAL;
- goto exit;
- }
-
- buf = rtw_zmalloc(ielen);
- if (buf == NULL){
- ret = -ENOMEM;
- goto exit;
- }
-
- _rtw_memcpy(buf, pie , ielen);
-
- //dump
- {
- int i;
- DBG_8192C("set wpa_ie(length:%zu):\n", ielen);
- for(i=0;i<ielen;i=i+8)
- DBG_8192C("0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",buf[i],buf[i+1],buf[i+2],buf[i+3],buf[i+4],buf[i+5],buf[i+6],buf[i+7]);
- }
-
- pos = buf;
- if(ielen < RSN_HEADER_LEN){
- RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("Ie len too short %d\n", ielen));
- ret = -1;
- goto exit;
- }
-
- pwpa = rtw_get_wpa_ie(buf, &wpa_ielen, ielen);
- if(pwpa && wpa_ielen>0)
- {
- if(rtw_parse_wpa_ie(pwpa, wpa_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
- {
- padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
- padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPAPSK;
- _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa[0], wpa_ielen+2);
-
- DBG_8192C("got wpa_ie, wpa_ielen:%u\n", wpa_ielen);
- }
- }
-
- pwpa2 = rtw_get_wpa2_ie(buf, &wpa2_ielen, ielen);
- if(pwpa2 && wpa2_ielen>0)
- {
- if(rtw_parse_wpa2_ie(pwpa2, wpa2_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
- {
- padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
- padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK;
- _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa2[0], wpa2_ielen+2);
-
- DBG_8192C("got wpa2_ie, wpa2_ielen:%u\n", wpa2_ielen);
- }
- }
-
- if (group_cipher == 0)
- {
- group_cipher = WPA_CIPHER_NONE;
- }
- if (pairwise_cipher == 0)
- {
- pairwise_cipher = WPA_CIPHER_NONE;
- }
-
- switch(group_cipher)
- {
- case WPA_CIPHER_NONE:
- padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_;
- padapter->securitypriv.ndisencryptstatus=Ndis802_11EncryptionDisabled;
- break;
- case WPA_CIPHER_WEP40:
- padapter->securitypriv.dot118021XGrpPrivacy=_WEP40_;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
- break;
- case WPA_CIPHER_TKIP:
- padapter->securitypriv.dot118021XGrpPrivacy=_TKIP_;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
- break;
- case WPA_CIPHER_CCMP:
- padapter->securitypriv.dot118021XGrpPrivacy=_AES_;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled;
- break;
- case WPA_CIPHER_WEP104:
- padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
- break;
- }
-
- switch(pairwise_cipher)
- {
- case WPA_CIPHER_NONE:
- padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_;
- padapter->securitypriv.ndisencryptstatus=Ndis802_11EncryptionDisabled;
- break;
- case WPA_CIPHER_WEP40:
- padapter->securitypriv.dot11PrivacyAlgrthm=_WEP40_;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
- break;
- case WPA_CIPHER_TKIP:
- padapter->securitypriv.dot11PrivacyAlgrthm=_TKIP_;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
- break;
- case WPA_CIPHER_CCMP:
- padapter->securitypriv.dot11PrivacyAlgrthm=_AES_;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled;
- break;
- case WPA_CIPHER_WEP104:
- padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_;
- padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
- break;
- }
-
- {/* handle wps_ie */
- uint wps_ielen;
- u8 *wps_ie;
-
- wps_ie = rtw_get_wps_ie(buf, ielen, NULL, &wps_ielen);
- if (wps_ie && wps_ielen > 0) {
- DBG_8192C("got wps_ie, wps_ielen:%u\n", wps_ielen);
- padapter->securitypriv.wps_ie_len = wps_ielen<MAX_WPS_IE_LEN?wps_ielen:MAX_WPS_IE_LEN;
- _rtw_memcpy(padapter->securitypriv.wps_ie, wps_ie, padapter->securitypriv.wps_ie_len);
- set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS);
- } else {
- _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
- }
- }
-
- #ifdef CONFIG_P2P
- {//check p2p_ie for assoc req;
- uint p2p_ielen=0;
- u8 *p2p_ie;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-
- if((p2p_ie=rtw_get_p2p_ie(buf, ielen, NULL, &p2p_ielen)))
- {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s p2p_assoc_req_ielen=%d\n", __FUNCTION__, p2p_ielen);
- #endif
-
- if(pmlmepriv->p2p_assoc_req_ie)
- {
- u32 free_len = pmlmepriv->p2p_assoc_req_ie_len;
- pmlmepriv->p2p_assoc_req_ie_len = 0;
- rtw_mfree(pmlmepriv->p2p_assoc_req_ie, free_len);
- pmlmepriv->p2p_assoc_req_ie = NULL;
- }
-
- pmlmepriv->p2p_assoc_req_ie = rtw_malloc(p2p_ielen);
- if ( pmlmepriv->p2p_assoc_req_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- goto exit;
- }
- _rtw_memcpy(pmlmepriv->p2p_assoc_req_ie, p2p_ie, p2p_ielen);
- pmlmepriv->p2p_assoc_req_ie_len = p2p_ielen;
- }
- }
- #endif //CONFIG_P2P
-
- #ifdef CONFIG_WFD
- {//check wfd_ie for assoc req;
- uint wfd_ielen=0;
- u8 *wfd_ie;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-
- if(rtw_get_wfd_ie(buf, ielen, NULL, &wfd_ielen))
- {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s wfd_assoc_req_ielen=%d\n", __FUNCTION__, wfd_ielen);
- #endif
-
- if(pmlmepriv->wfd_assoc_req_ie)
- {
- u32 free_len = pmlmepriv->wfd_assoc_req_ie_len;
- pmlmepriv->wfd_assoc_req_ie_len = 0;
- rtw_mfree(pmlmepriv->wfd_assoc_req_ie, free_len);
- pmlmepriv->wfd_assoc_req_ie = NULL;
- }
-
- pmlmepriv->wfd_assoc_req_ie = rtw_malloc(wfd_ielen);
- if ( pmlmepriv->wfd_assoc_req_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- goto exit;
- }
- rtw_get_wfd_ie(buf, ielen, pmlmepriv->wfd_assoc_req_ie, &pmlmepriv->wfd_assoc_req_ie_len);
- }
- }
- #endif //CONFIG_WFD
-
- //TKIP and AES disallow multicast packets until installing group key
- if(padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_
- || padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_
- || padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
- //WPS open need to enable multicast
- //|| check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == _TRUE)
- rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr);
-
- RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_,
- ("rtw_set_wpa_ie: pairwise_cipher=0x%08x padapter->securitypriv.ndisencryptstatus=%d padapter->securitypriv.ndisauthtype=%d\n",
- pairwise_cipher, padapter->securitypriv.ndisencryptstatus, padapter->securitypriv.ndisauthtype));
-
-exit:
- if (buf)
- rtw_mfree(buf, ielen);
- if (ret)
- _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
- return ret;
-}
-
-static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
- struct cfg80211_ibss_params *params)
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- NDIS_802_11_SSID ndis_ssid;
- struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- int ret=0;
-
- if(_FAIL == rtw_pwr_wakeup(padapter)) {
- ret= -EPERM;
- goto exit;
- }
-
- if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
- ret = -EPERM;
- goto exit;
- }
-
-#ifdef CONFIG_CONCURRENT_MODE
- if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING) == _TRUE) {
- DBG_8192C("%s, but buddy_intf is under linking\n", __FUNCTION__);
- ret = -EINVAL;
- goto exit;
- }
- if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY) == _TRUE) {
- rtw_scan_abort(padapter->pbuddy_adapter);
- }
-#endif //CONFIG_CONCURRENT_MODE
-
- if (!params->ssid || !params->ssid_len)
- {
- ret = -EINVAL;
- goto exit;
- }
-
- if (params->ssid_len > IW_ESSID_MAX_SIZE){
-
- ret= -E2BIG;
- goto exit;
- }
-
- _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID));
- ndis_ssid.SsidLength = 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);
-
- psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
- psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
- psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system
- psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
-
- ret = rtw_cfg80211_set_auth_type(psecuritypriv, NL80211_AUTHTYPE_OPEN_SYSTEM);
- rtw_set_802_11_authentication_mode(padapter, psecuritypriv->ndisauthtype);
-
- if (rtw_set_802_11_ssid(padapter, &ndis_ssid) == _FALSE)
- {
- ret = -1;
- goto exit;
- }
-
-exit:
- return ret;
-}
-
-static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct wireless_dev *rtw_wdev = padapter->rtw_wdev;
- enum nl80211_iftype old_type;
- int ret = 0;
-
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- padapter->mlmepriv.not_indic_disco = _TRUE;
-
- old_type = rtw_wdev->iftype;
-
- rtw_set_to_roam(padapter, 0);
-
- if(check_fwstate(&padapter->mlmepriv, _FW_LINKED))
- {
- rtw_scan_abort(padapter);
- LeaveAllPowerSaveMode(padapter);
-
- rtw_wdev->iftype = NL80211_IFTYPE_STATION;
-
- if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure) ==_FALSE)
- {
- rtw_wdev->iftype = old_type;
- ret = -EPERM;
- goto leave_ibss;
- }
- rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure,_TRUE);
- }
-
-leave_ibss:
- padapter->mlmepriv.not_indic_disco = _FALSE;
-
- return 0;
-}
-
-static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
- struct cfg80211_connect_params *sme)
-{
- int ret=0;
- _irqL irqL;
- _list *phead;
- struct wlan_network *pnetwork = NULL;
- NDIS_802_11_AUTHENTICATION_MODE authmode;
- NDIS_802_11_SSID ndis_ssid;
- u8 *dst_ssid, *src_ssid;
- u8 *dst_bssid, *src_bssid;
- //u8 matched_by_bssid=_FALSE;
- //u8 matched_by_ssid=_FALSE;
- u8 matched=_FALSE;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct security_priv *psecuritypriv = &padapter->securitypriv;
- _queue *queue = &pmlmepriv->scanned_queue;
-
- padapter->mlmepriv.not_indic_disco = _TRUE;
-
- DBG_871X("=>"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
- DBG_871X("privacy=%d, key=%p, key_len=%d, key_idx=%d\n",
- sme->privacy, sme->key, sme->key_len, sme->key_idx);
-
-
- if(adapter_wdev_data(padapter)->block == _TRUE)
- {
- ret = -EBUSY;
- DBG_871X("%s wdev_priv.block is set\n", __FUNCTION__);
- goto exit;
- }
-
-#ifdef CONFIG_PLATFORM_MSTAR_SCAN_BEFORE_CONNECT
- printk("MStar Android!\n");
- if(adapter_wdev_data(padapter)->bandroid_scan == _FALSE)
- {
-#ifdef CONFIG_P2P
- struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
-#endif //CONFIG_P2P
- {
- ret = -EBUSY;
- printk("Android hasn't attached yet!\n");
- goto exit;
- }
- }
-#endif
-
- rtw_ps_deny(padapter, PS_DENY_JOIN);
- if(_FAIL == rtw_pwr_wakeup(padapter)) {
- ret= -EPERM;
- goto exit;
- }
-
- if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
- ret = -EPERM;
- goto exit;
- }
-
-#ifdef CONFIG_CONCURRENT_MODE
- if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING) == _TRUE) {
- DBG_8192C("%s, but buddy_intf is under linking\n", __FUNCTION__);
- ret = -EINVAL;
- goto exit;
- }
- if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY) == _TRUE) {
- rtw_scan_abort(padapter->pbuddy_adapter);
- }
-#endif
-
- if (!sme->ssid || !sme->ssid_len)
- {
- ret = -EINVAL;
- goto exit;
- }
-
- if (sme->ssid_len > IW_ESSID_MAX_SIZE){
-
- ret= -E2BIG;
- goto exit;
- }
-
- _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID));
- ndis_ssid.SsidLength = 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);
-
-
- if (sme->bssid)
- DBG_8192C("bssid="MAC_FMT"\n", MAC_ARG(sme->bssid));
-
-
- if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) {
- ret = -EBUSY;
- DBG_8192C("%s, fw_state=0x%x, goto exit\n", __FUNCTION__, pmlmepriv->fw_state);
- goto exit;
- }
- if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) {
- rtw_scan_abort(padapter);
- }
-
- psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
- psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
- psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
- psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system
- psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
-
-#ifdef CONFIG_WAPI_SUPPORT
- padapter->wapiInfo.bWapiEnable = false;
-#endif
-
- ret = rtw_cfg80211_set_wpa_version(psecuritypriv, sme->crypto.wpa_versions);
- if (ret < 0)
- goto exit;
-
-#ifdef CONFIG_WAPI_SUPPORT
- if(sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1)
- {
- padapter->wapiInfo.bWapiEnable = true;
- padapter->wapiInfo.extra_prefix_len = WAPI_EXT_LEN;
- padapter->wapiInfo.extra_postfix_len = SMS4_MIC_LEN;
- }
-#endif
-
- ret = rtw_cfg80211_set_auth_type(psecuritypriv, sme->auth_type);
-
-#ifdef CONFIG_WAPI_SUPPORT
- if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_WAPI)
- padapter->mlmeextpriv.mlmext_info.auth_algo = psecuritypriv->dot11AuthAlgrthm;
-#endif
-
-
- if (ret < 0)
- goto exit;
-
- DBG_8192C("%s, ie_len=%zu\n", __func__, sme->ie_len);
-
- ret = rtw_cfg80211_set_wpa_ie(padapter, (u8 *)sme->ie, sme->ie_len);
- if (ret < 0)
- goto exit;
-
- if (sme->crypto.n_ciphers_pairwise) {
- ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.ciphers_pairwise[0], _TRUE);
- if (ret < 0)
- goto exit;
- }
-
- //For WEP Shared auth
- if((psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Shared
- || psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Auto) && sme->key
- )
- {
- u32 wep_key_idx, wep_key_len,wep_total_len;
- NDIS_802_11_WEP *pwep = NULL;
- DBG_871X("%s(): Shared/Auto WEP\n",__FUNCTION__);
-
- wep_key_idx = sme->key_idx;
- wep_key_len = sme->key_len;
-
- if (sme->key_idx > WEP_KEYS) {
- ret = -EINVAL;
- goto exit;
- }
-
- if (wep_key_len > 0)
- {
- wep_key_len = wep_key_len <= 5 ? 5 : 13;
- wep_total_len = wep_key_len + FIELD_OFFSET(NDIS_802_11_WEP, KeyMaterial);
- pwep =(NDIS_802_11_WEP *) rtw_malloc(wep_total_len);
- if(pwep == NULL){
- DBG_871X(" wpa_set_encryption: pwep allocate fail !!!\n");
- ret = -ENOMEM;
- goto exit;
- }
-
- _rtw_memset(pwep, 0, wep_total_len);
-
- pwep->KeyLength = wep_key_len;
- pwep->Length = wep_total_len;
-
- if(wep_key_len==13)
- {
- padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_;
- padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_;
- }
- }
- else {
- ret = -EINVAL;
- goto exit;
- }
-
- pwep->KeyIndex = wep_key_idx;
- pwep->KeyIndex |= 0x80000000;
-
- _rtw_memcpy(pwep->KeyMaterial, (void *)sme->key, pwep->KeyLength);
-
- if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL)
- {
- ret = -EOPNOTSUPP ;
- }
-
- if (pwep) {
- rtw_mfree((u8 *)pwep,wep_total_len);
- }
-
- if(ret < 0)
- goto exit;
- }
-
- ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.cipher_group, _FALSE);
- if (ret < 0)
- return ret;
-
- if (sme->crypto.n_akm_suites) {
- ret = rtw_cfg80211_set_key_mgt(psecuritypriv, sme->crypto.akm_suites[0]);
- if (ret < 0)
- goto exit;
- }
-
-#ifdef CONFIG_WAPI_SUPPORT
- if(sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_PSK){
- padapter->wapiInfo.bWapiPSK = true;
- }
- else if(sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_CERT){
- padapter->wapiInfo.bWapiPSK = false;
- }
-#endif
-
- authmode = psecuritypriv->ndisauthtype;
- rtw_set_802_11_authentication_mode(padapter, authmode);
-
- //rtw_set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus);
-
- if (rtw_set_802_11_connect(padapter, (u8 *)sme->bssid, &ndis_ssid) == _FALSE) {
- ret = -1;
- goto exit;
- }
-
- DBG_8192C("set ssid:dot11AuthAlgrthm=%d, dot11PrivacyAlgrthm=%d, dot118021XGrpPrivacy=%d\n", psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, psecuritypriv->dot118021XGrpPrivacy);
-
-exit:
-
- rtw_ps_deny_cancel(padapter, PS_DENY_JOIN);
-
- DBG_8192C("<=%s, ret %d\n",__FUNCTION__, ret);
-
- padapter->mlmepriv.not_indic_disco = _FALSE;
-
- return ret;
-}
-
-static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev,
- u16 reason_code)
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
-
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- padapter->mlmepriv.not_indic_disco = _TRUE;
-
- rtw_set_to_roam(padapter, 0);
-
- //if(check_fwstate(&padapter->mlmepriv, _FW_LINKED))
- {
- rtw_scan_abort(padapter);
- LeaveAllPowerSaveMode(padapter);
- rtw_disassoc_cmd(padapter, 500, _FALSE);
-
- DBG_871X("%s...call rtw_indicate_disconnect\n", __FUNCTION__);
-
- rtw_indicate_disconnect(padapter);
-
- rtw_free_assoc_resources(padapter, 1);
- rtw_pwr_wakeup(padapter);
- }
-
- padapter->mlmepriv.not_indic_disco = _FALSE;
-
- DBG_871X(FUNC_NDEV_FMT" return 0\n", FUNC_NDEV_ARG(ndev));
- return 0;
-}
-
-static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
- struct wireless_dev *wdev,
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
- enum nl80211_tx_power_setting type, int mbm)
-#else
- enum tx_power_setting type, int dbm)
-#endif
-{
-#if 0
- struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
- int ret;
-
- switch (type) {
- case NL80211_TX_POWER_AUTOMATIC:
- return 0;
- case NL80211_TX_POWER_FIXED:
- if (mbm < 0 || (mbm % 100))
- return -EOPNOTSUPP;
-
- if (!test_bit(IWM_STATUS_READY, &iwm->status))
- return 0;
-
- ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX,
- CFG_TX_PWR_LIMIT_USR,
- MBM_TO_DBM(mbm) * 2);
- if (ret < 0)
- return ret;
-
- return iwm_tx_power_trigger(iwm);
- default:
- IWM_ERR(iwm, "Unsupported power type: %d\n", type);
- return -EOPNOTSUPP;
- }
-#endif
- DBG_8192C("%s\n", __func__);
- return 0;
-}
-
-static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
- struct wireless_dev *wdev,
-#endif
- int *dbm)
-{
- DBG_8192C("%s\n", __func__);
-
- *dbm = (12);
-
- return 0;
-}
-
-inline bool rtw_cfg80211_pwr_mgmt(_adapter *adapter)
-{
- struct rtw_wdev_priv *rtw_wdev_priv = adapter_wdev_data(adapter);
- return rtw_wdev_priv->power_mgmt;
-}
-
-static int cfg80211_rtw_set_power_mgmt(struct wiphy *wiphy,
- struct net_device *ndev,
- bool enabled, int timeout)
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct rtw_wdev_priv *rtw_wdev_priv = adapter_wdev_data(padapter);
-
- DBG_871X(FUNC_NDEV_FMT" enabled:%u, timeout:%d\n", FUNC_NDEV_ARG(ndev),
- enabled, timeout);
-
- rtw_wdev_priv->power_mgmt = enabled;
-
- #ifdef CONFIG_LPS
- if (!enabled)
- LPS_Leave(padapter, "CFG80211_PWRMGMT");
- #endif
-
- return 0;
-}
-
-static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy,
- struct net_device *ndev,
- struct cfg80211_pmksa *pmksa)
-{
- 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" "MAC_FMT" "KEY_FMT"\n", FUNC_NDEV_ARG(ndev)
- , MAC_ARG(pmksa->bssid), KEY_ARG(pmksa->pmkid));
-
- 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 ; index<NUM_PMKID_CACHE; index++)
- {
- 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, (u8 *)pmksa->pmkid, WLAN_PMKID_LEN);
- psecuritypriv->PMKIDList[index].bUsed = _TRUE;
- psecuritypriv->PMKIDIndex = index+1;
- blInserted = _TRUE;
- break;
- }
- }
-
- if(!blInserted)
- {
- // Find a new entry
- 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, (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++ ;
- if(psecuritypriv->PMKIDIndex==16)
- {
- psecuritypriv->PMKIDIndex =0;
- }
- }
-
- return 0;
-}
-
-static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy,
- struct net_device *ndev,
- struct cfg80211_pmksa *pmksa)
-{
- u8 index, bMatched = _FALSE;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct security_priv *psecuritypriv = &padapter->securitypriv;
-
- 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 ; index<NUM_PMKID_CACHE; index++)
- {
- 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 );
- psecuritypriv->PMKIDList[index].bUsed = _FALSE;
- bMatched = _TRUE;
- DBG_871X(FUNC_NDEV_FMT" clear id:%hhu\n", FUNC_NDEV_ARG(ndev), index);
- break;
- }
- }
-
- if(_FALSE == bMatched)
- {
- DBG_871X(FUNC_NDEV_FMT" do not have matched BSSID\n"
- , FUNC_NDEV_ARG(ndev));
- return -EINVAL;
- }
-
- return 0;
-}
-
-static int cfg80211_rtw_flush_pmksa(struct wiphy *wiphy,
- struct net_device *ndev)
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct security_priv *psecuritypriv = &padapter->securitypriv;
-
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- _rtw_memset( &psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE );
- psecuritypriv->PMKIDIndex = 0;
-
- return 0;
-}
-
-#ifdef CONFIG_AP_MODE
-void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint frame_len)
-{
- s32 freq;
- int channel;
- struct wireless_dev *pwdev = padapter->rtw_wdev;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct net_device *ndev = padapter->pnetdev;
-
- DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
-
-#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE)
- {
- struct station_info sinfo;
- u8 ie_offset;
- if (GetFrameSubType(pmgmt_frame) == WIFI_ASSOCREQ)
- ie_offset = _ASOCREQ_IE_OFFSET_;
- else // WIFI_REASSOCREQ
- ie_offset = _REASOCREQ_IE_OFFSET_;
-
- sinfo.filled = 0;
- sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
- sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset;
- sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset;
- cfg80211_new_sta(ndev, GetAddr2Ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
- }
-#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
- channel = pmlmeext->cur_channel;
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-
- #ifdef COMPAT_KERNEL_RELEASE
- rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
- #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
- rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
- #else //COMPAT_KERNEL_RELEASE
- {
- //to avoid WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION) when calling cfg80211_send_rx_assoc()
- #ifndef CONFIG_PLATFORM_MSTAR
- pwdev->iftype = NL80211_IFTYPE_STATION;
- #endif //CONFIG_PLATFORM_MSTAR
- DBG_8192C("iftype=%d before call cfg80211_send_rx_assoc()\n", pwdev->iftype);
- rtw_cfg80211_send_rx_assoc(padapter, NULL, pmgmt_frame, frame_len);
- DBG_8192C("iftype=%d after call cfg80211_send_rx_assoc()\n", pwdev->iftype);
- pwdev->iftype = NL80211_IFTYPE_AP;
- //cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
- }
- #endif //COMPAT_KERNEL_RELEASE
-#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */
-
-}
-
-void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, unsigned short reason)
-{
- s32 freq;
- int channel;
- u8 *pmgmt_frame;
- uint frame_len;
- struct rtw_ieee80211_hdr *pwlanhdr;
- unsigned short *fctrl;
- u8 mgmt_buf[128] = {0};
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct net_device *ndev = padapter->pnetdev;
-
- DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
-
-#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE)
- cfg80211_del_sta(ndev, da, GFP_ATOMIC);
-#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
- channel = pmlmeext->cur_channel;
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-
- pmgmt_frame = mgmt_buf;
- pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame;
-
- fctrl = &(pwlanhdr->frame_ctl);
- *(fctrl) = 0;
-
- //_rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
- //_rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, da, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-
- SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
- pmlmeext->mgnt_seq++;
- SetFrameSubType(pmgmt_frame, WIFI_DEAUTH);
-
- pmgmt_frame += sizeof(struct rtw_ieee80211_hdr_3addr);
- frame_len = sizeof(struct rtw_ieee80211_hdr_3addr);
-
- reason = cpu_to_le16(reason);
- pmgmt_frame = rtw_set_fixed_ie(pmgmt_frame, _RSON_CODE_ , (unsigned char *)&reason, &frame_len);
-
- #ifdef COMPAT_KERNEL_RELEASE
- rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC);
- #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
- rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC);
- #else //COMPAT_KERNEL_RELEASE
- cfg80211_send_disassoc(padapter->pnetdev, mgmt_buf, frame_len);
- //cfg80211_rx_action(padapter->pnetdev, freq, mgmt_buf, frame_len, GFP_ATOMIC);
- #endif //COMPAT_KERNEL_RELEASE
-#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */
-}
-
-static int rtw_cfg80211_monitor_if_open(struct net_device *ndev)
-{
- int ret = 0;
-
- DBG_8192C("%s\n", __func__);
-
- return ret;
-}
-
-static int rtw_cfg80211_monitor_if_close(struct net_device *ndev)
-{
- int ret = 0;
-
- DBG_8192C("%s\n", __func__);
-
- return ret;
-}
-
-static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
-{
- int ret = 0;
- int rtap_len;
- int qos_len = 0;
- int dot11_hdr_len = 24;
- int snap_len = 6;
- unsigned char *pdata;
- u16 frame_ctl;
- unsigned char src_mac_addr[6];
- unsigned char dst_mac_addr[6];
- struct ieee80211_hdr *dot11_hdr;
- struct ieee80211_radiotap_header *rtap_hdr;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
-
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- if (skb)
- rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
-
- if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
- goto fail;
-
- rtap_hdr = (struct ieee80211_radiotap_header *)skb->data;
- if (unlikely(rtap_hdr->it_version))
- goto fail;
-
- rtap_len = ieee80211_get_radiotap_len(skb->data);
- if (unlikely(skb->len < rtap_len))
- goto fail;
-
- if(rtap_len != 14)
- {
- DBG_8192C("radiotap len (should be 14): %d\n", rtap_len);
- goto fail;
- }
-
- /* Skip the ratio tap header */
- skb_pull(skb, rtap_len);
-
- dot11_hdr = (struct ieee80211_hdr *)skb->data;
- frame_ctl = le16_to_cpu(dot11_hdr->frame_control);
- /* Check if the QoS bit is set */
- if ((frame_ctl & RTW_IEEE80211_FCTL_FTYPE) == RTW_IEEE80211_FTYPE_DATA) {
- /* Check if this ia a Wireless Distribution System (WDS) frame
- * which has 4 MAC addresses
- */
- if (dot11_hdr->frame_control & 0x0080)
- qos_len = 2;
- if ((dot11_hdr->frame_control & 0x0300) == 0x0300)
- dot11_hdr_len += 6;
-
- memcpy(dst_mac_addr, dot11_hdr->addr1, sizeof(dst_mac_addr));
- memcpy(src_mac_addr, dot11_hdr->addr2, sizeof(src_mac_addr));
-
- /* Skip the 802.11 header, QoS (if any) and SNAP, but leave spaces for
- * for two MAC addresses
- */
- skb_pull(skb, dot11_hdr_len + qos_len + snap_len - sizeof(src_mac_addr) * 2);
- pdata = (unsigned char*)skb->data;
- memcpy(pdata, dst_mac_addr, sizeof(dst_mac_addr));
- memcpy(pdata + sizeof(dst_mac_addr), src_mac_addr, sizeof(src_mac_addr));
-
- DBG_8192C("should be eapol packet\n");
-
- /* Use the real net device to transmit the packet */
- ret = _rtw_xmit_entry(skb, padapter->pnetdev);
-
- return ret;
-
- }
- else if ((frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE))
- == (RTW_IEEE80211_FTYPE_MGMT|RTW_IEEE80211_STYPE_ACTION)
- )
- {
- //only for action frames
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- unsigned char *pframe;
- //u8 category, action, OUI_Subtype, dialogToken=0;
- //unsigned char *frame_body;
- struct rtw_ieee80211_hdr *pwlanhdr;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- u8 *buf = skb->data;
- u32 len = skb->len;
- u8 category, action;
- int type = -1;
-
- if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) {
- DBG_8192C(FUNC_NDEV_FMT" frame_control:0x%x\n", FUNC_NDEV_ARG(ndev),
- le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl));
- goto fail;
- }
-
- DBG_8192C("RTW_Tx:da="MAC_FMT" via "FUNC_NDEV_FMT"\n",
- MAC_ARG(GetAddr1Ptr(buf)), FUNC_NDEV_ARG(ndev));
- #ifdef CONFIG_P2P
- if((type = rtw_p2p_check_frames(padapter, buf, len, _TRUE)) >= 0)
- goto dump;
- #endif
- if (category == RTW_WLAN_CATEGORY_PUBLIC)
- DBG_871X("RTW_Tx:%s\n", action_public_str(action));
- else
- DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action);
-
-dump:
- //starting alloc mgmt frame to dump it
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- goto fail;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(padapter, pattrib);
- pattrib->retry_ctrl = _FALSE;
-
- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-
- _rtw_memcpy(pframe, (void*)buf, len);
- #ifdef CONFIG_WFD
- if (type >= 0)
- {
- struct wifi_display_info *pwfd_info;
-
- pwfd_info = padapter->wdinfo.wfd_info;
-
- if ( _TRUE == pwfd_info->wfd_enable )
- {
- rtw_append_wfd_ie( padapter, pframe, &len );
- }
- }
- #endif // CONFIG_WFD
- pattrib->pktlen = len;
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
- //update seq number
- pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
- pattrib->seqnum = pmlmeext->mgnt_seq;
- pmlmeext->mgnt_seq++;
-
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- dump_mgntframe(padapter, pmgntframe);
-
- }
- else
- {
- DBG_8192C("frame_ctl=0x%x\n", frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE));
- }
-
-
-fail:
-
- rtw_skb_free(skb);
-
- return 0;
-
-}
-
-static void rtw_cfg80211_monitor_if_set_multicast_list(struct net_device *ndev)
-{
- DBG_8192C("%s\n", __func__);
-}
-
-static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void *addr)
-{
- int ret = 0;
-
- DBG_8192C("%s\n", __func__);
-
- return ret;
-}
-
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
-static const struct net_device_ops rtw_cfg80211_monitor_if_ops = {
- .ndo_open = rtw_cfg80211_monitor_if_open,
- .ndo_stop = rtw_cfg80211_monitor_if_close,
- .ndo_start_xmit = rtw_cfg80211_monitor_if_xmit_entry,
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
- .ndo_set_multicast_list = rtw_cfg80211_monitor_if_set_multicast_list,
- #endif
- .ndo_set_mac_address = rtw_cfg80211_monitor_if_set_mac_address,
-};
-#endif
-
-static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct net_device **ndev)
-{
- int ret = 0;
- struct net_device* mon_ndev = NULL;
- struct wireless_dev* mon_wdev = NULL;
- struct rtw_netdev_priv_indicator *pnpi;
- struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
-
- if (!name ) {
- DBG_871X(FUNC_ADPT_FMT" without specific name\n", FUNC_ADPT_ARG(padapter));
- ret = -EINVAL;
- goto out;
- }
-
- if (pwdev_priv->pmon_ndev) {
- DBG_871X(FUNC_ADPT_FMT" monitor interface exist: "NDEV_FMT"\n",
- FUNC_ADPT_ARG(padapter), NDEV_ARG(pwdev_priv->pmon_ndev));
- ret = -EBUSY;
- goto out;
- }
-
- mon_ndev = alloc_etherdev(sizeof(struct rtw_netdev_priv_indicator));
- if (!mon_ndev) {
- DBG_871X(FUNC_ADPT_FMT" allocate ndev fail\n", FUNC_ADPT_ARG(padapter));
- ret = -ENOMEM;
- goto out;
- }
-
- mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
- strncpy(mon_ndev->name, name, IFNAMSIZ);
- mon_ndev->name[IFNAMSIZ - 1] = 0;
- mon_ndev->destructor = rtw_ndev_destructor;
-
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
- mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
-#else
- mon_ndev->open = rtw_cfg80211_monitor_if_open;
- mon_ndev->stop = rtw_cfg80211_monitor_if_close;
- mon_ndev->hard_start_xmit = rtw_cfg80211_monitor_if_xmit_entry;
- mon_ndev->set_mac_address = rtw_cfg80211_monitor_if_set_mac_address;
-#endif
-
- pnpi = netdev_priv(mon_ndev);
- pnpi->priv = padapter;
- pnpi->sizeof_priv = sizeof(_adapter);
-
- /* wdev */
- mon_wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev));
- if (!mon_wdev) {
- DBG_871X(FUNC_ADPT_FMT" allocate mon_wdev fail\n", FUNC_ADPT_ARG(padapter));
- ret = -ENOMEM;
- goto out;
- }
-
- mon_wdev->wiphy = padapter->rtw_wdev->wiphy;
- mon_wdev->netdev = mon_ndev;
- mon_wdev->iftype = NL80211_IFTYPE_MONITOR;
- mon_ndev->ieee80211_ptr = mon_wdev;
-
- ret = register_netdevice(mon_ndev);
- if (ret) {
- goto out;
- }
-
- *ndev = pwdev_priv->pmon_ndev = mon_ndev;
- _rtw_memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ+1);
-
-out:
- if (ret && mon_wdev) {
- rtw_mfree((u8*)mon_wdev, sizeof(struct wireless_dev));
- mon_wdev = NULL;
- }
-
- if (ret && mon_ndev) {
- free_netdev(mon_ndev);
- *ndev = mon_ndev = NULL;
- }
-
- return ret;
-}
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
-static struct wireless_dev *
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
-static struct net_device *
-#else
-static int
-#endif
- cfg80211_rtw_add_virtual_intf(
- struct wiphy *wiphy,
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
- const char *name,
- #else
- char *name,
- #endif
- enum nl80211_iftype type, u32 *flags, struct vif_params *params)
-{
- int ret = 0;
- struct net_device* ndev = NULL;
- _adapter *padapter = wiphy_to_adapter(wiphy);
-
- DBG_871X(FUNC_ADPT_FMT " wiphy:%s, name:%s, type:%d\n",
- FUNC_ADPT_ARG(padapter), wiphy_name(wiphy), name, type);
-
- switch (type) {
- case NL80211_IFTYPE_ADHOC:
- case NL80211_IFTYPE_AP_VLAN:
- case NL80211_IFTYPE_WDS:
- case NL80211_IFTYPE_MESH_POINT:
- ret = -ENODEV;
- break;
- case NL80211_IFTYPE_MONITOR:
- ret = rtw_cfg80211_add_monitor_if(padapter, (char *)name, &ndev);
- break;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- case NL80211_IFTYPE_P2P_CLIENT:
-#endif
- case NL80211_IFTYPE_STATION:
- ret = -ENODEV;
- break;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- case NL80211_IFTYPE_P2P_GO:
-#endif
- case NL80211_IFTYPE_AP:
- ret = -ENODEV;
- break;
- default:
- ret = -ENODEV;
- DBG_871X("Unsupported interface type\n");
- break;
- }
-
- DBG_871X(FUNC_ADPT_FMT" ndev:%p, ret:%d\n", FUNC_ADPT_ARG(padapter), ndev, ret);
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- return ndev ? ndev->ieee80211_ptr : ERR_PTR(ret);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
- return ndev ? ndev : ERR_PTR(ret);
-#else
- return ret;
-#endif
-}
-
-static int cfg80211_rtw_del_virtual_intf(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct wireless_dev *wdev
-#else
- struct net_device *ndev
-#endif
-)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct net_device *ndev = wdev_to_ndev(wdev);
-#endif
- int ret = 0;
- _adapter *adapter;
- struct rtw_wdev_priv *pwdev_priv;
-
- if (!ndev) {
- ret = -EINVAL;
- goto exit;
- }
-
- adapter = (_adapter *)rtw_netdev_priv(ndev);
- pwdev_priv = adapter_wdev_data(adapter);
-
- unregister_netdevice(ndev);
-
- if (ndev == pwdev_priv->pmon_ndev) {
- pwdev_priv->pmon_ndev = NULL;
- pwdev_priv->ifname_mon[0] = '\0';
- DBG_871X(FUNC_NDEV_FMT" remove monitor interface\n", FUNC_NDEV_ARG(ndev));
- }
-
-exit:
- return ret;
-}
-
-static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, const u8 *tail, size_t tail_len)
-{
- int ret=0;
- u8 *pbuf = NULL;
- uint len, wps_ielen=0;
- uint p2p_ielen=0;
- u8 *p2p_ie;
- u8 got_p2p_ie = _FALSE;
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- //struct sta_priv *pstapriv = &padapter->stapriv;
-
-
- DBG_8192C("%s beacon_head_len=%zu, beacon_tail_len=%zu\n", __FUNCTION__, head_len, tail_len);
-
-
- if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
- return -EINVAL;
-
- if(head_len<24)
- return -EINVAL;
-
-
- pbuf = rtw_zmalloc(head_len+tail_len);
- if(!pbuf)
- return -ENOMEM;
-
-
- //_rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2);
-
- //if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0))
- // pstapriv->max_num_sta = NUM_STA;
-
-
- _rtw_memcpy(pbuf, (void *)head+24, head_len-24);// 24=beacon header len.
- _rtw_memcpy(pbuf+head_len-24, (void *)tail, tail_len);
-
- len = head_len+tail_len-24;
-
- //check wps ie if inclued
- if(rtw_get_wps_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &wps_ielen))
- DBG_8192C("add bcn, wps_ielen=%d\n", wps_ielen);
-
-#ifdef CONFIG_P2P
- if( adapter->wdinfo.driver_interface == DRIVER_CFG80211 )
- {
- //check p2p if enable
- if(rtw_get_p2p_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &p2p_ielen))
- {
- struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
- struct wifidirect_info *pwdinfo= &(adapter->wdinfo);
-
- DBG_8192C("got p2p_ie, len=%d\n", p2p_ielen);
-
- got_p2p_ie = _TRUE;
-
- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- DBG_8192C("Enable P2P function for the first time\n");
- rtw_p2p_enable(adapter, P2P_ROLE_GO);
- adapter_wdev_data(adapter)->p2p_enabled = _TRUE;
-
- adapter->stapriv.expire_to = 3; // 3x2 = 6 sec in p2p mode
- }
- else
- {
- DBG_8192C("enter GO Mode, p2p_ielen=%d\n", p2p_ielen);
-
- rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO);
- rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK);
- pwdinfo->intent = 15;
- }
- }
- }
-#endif // CONFIG_P2P
-
- /* pbss_network->IEs will not include p2p_ie, wfd ie */
- rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, P2P_OUI, 4);
- rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, WFD_OUI, 4);
-
- if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS)
- {
-#ifdef CONFIG_P2P
- //check p2p if enable
- if(got_p2p_ie == _TRUE)
- {
- struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
- struct wifidirect_info *pwdinfo= &(adapter->wdinfo);
- pwdinfo->operating_channel = pmlmeext->cur_channel;
- }
-#endif //CONFIG_P2P
- ret = 0;
- }
- else
- {
- ret = -EINVAL;
- }
-
-
- rtw_mfree(pbuf, head_len+tail_len);
-
- return ret;
-}
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE)
-static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *ndev,
- struct beacon_parameters *info)
-{
- int ret=0;
- _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
-
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
- ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
-
- return ret;
-}
-
-static int cfg80211_rtw_set_beacon(struct wiphy *wiphy, struct net_device *ndev,
- struct beacon_parameters *info)
-{
- _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
- struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
-
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- pmlmeext->bstart_bss = _TRUE;
-
- cfg80211_rtw_add_beacon(wiphy, ndev, info);
-
- return 0;
-}
-
-static int cfg80211_rtw_del_beacon(struct wiphy *wiphy, struct net_device *ndev)
-{
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- return 0;
-}
-#else
-static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev,
- struct cfg80211_ap_settings *settings)
-{
- int ret = 0;
- _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
-
- DBG_871X(FUNC_NDEV_FMT" hidden_ssid:%d, auth_type:%d\n", FUNC_NDEV_ARG(ndev),
- settings->hidden_ssid, settings->auth_type);
-
- ret = rtw_add_beacon(adapter, settings->beacon.head, settings->beacon.head_len,
- settings->beacon.tail, settings->beacon.tail_len);
-
- adapter->mlmeextpriv.mlmext_info.hidden_ssid_mode = settings->hidden_ssid;
-
- if (settings->ssid && settings->ssid_len) {
- WLAN_BSSID_EX *pbss_network = &adapter->mlmepriv.cur_network.network;
- WLAN_BSSID_EX *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network;
-
- if(0)
- 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);
-
- _rtw_memcpy(pbss_network->Ssid.Ssid, (void *)settings->ssid, settings->ssid_len);
- pbss_network->Ssid.SsidLength = settings->ssid_len;
- _rtw_memcpy(pbss_network_ext->Ssid.Ssid, (void *)settings->ssid, settings->ssid_len);
- pbss_network_ext->Ssid.SsidLength = settings->ssid_len;
-
- if(0)
- DBG_871X(FUNC_ADPT_FMT" after ssid:(%s,%d), (%s,%d)\n", FUNC_ADPT_ARG(adapter),
- pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength,
- pbss_network_ext->Ssid.Ssid, pbss_network_ext->Ssid.SsidLength);
- }
-
- return ret;
-}
-
-static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
- struct cfg80211_beacon_data *info)
-{
- int ret = 0;
- _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
-
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
-
- return ret;
-}
-
-static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
-{
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
- return 0;
-}
-
-#endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-
-static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev,
-#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;
-}
-
-static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0))
- u8 *mac
-#else
- const u8 *mac
-#endif
-)
-{
- int ret=0;
- _irqL irqL;
- _list *phead, *plist;
- u8 updated = _FALSE;
- struct sta_info *psta = NULL;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct sta_priv *pstapriv = &padapter->stapriv;
-
- DBG_871X("+"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE)
- {
- DBG_8192C("%s, fw_state != FW_LINKED|WIFI_AP_STATE\n", __func__);
- return -EINVAL;
- }
-
-
- if(!mac)
- {
- DBG_8192C("flush all sta, and cam_entry\n");
-
- flush_all_cam_entry(padapter); //clear CAM
-
- ret = rtw_sta_flush(padapter);
-
- return ret;
- }
-
-
- DBG_8192C("free sta macaddr =" MAC_FMT "\n", MAC_ARG(mac));
-
- if (mac[0] == 0xff && mac[1] == 0xff &&
- mac[2] == 0xff && mac[3] == 0xff &&
- mac[4] == 0xff && mac[5] == 0xff)
- {
- return -EINVAL;
- }
-
-
- _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- phead = &pstapriv->asoc_list;
- plist = get_next(phead);
-
- //check asoc_queue
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- {
- psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
-
- plist = get_next(plist);
-
- if(_rtw_memcmp((u8 *)mac, psta->hwaddr, ETH_ALEN))
- {
- if(psta->dot8021xalg == 1 && psta->bpairwise_key_installed == _FALSE)
- {
- DBG_8192C("%s, sta's dot8021xalg = 1 and key_installed = _FALSE\n", __func__);
- }
- else
- {
- DBG_8192C("free psta=%p, aid=%d\n", psta, psta->aid);
-
- rtw_list_delete(&psta->asoc_list);
- pstapriv->asoc_list_cnt--;
-
- //_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
- updated = ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING);
- //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- psta = NULL;
-
- break;
- }
-
- }
-
- }
-
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
- associated_clients_update(padapter, updated);
-
- DBG_871X("-"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- return ret;
-
-}
-
-static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev,
-#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;
-}
-
-static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *ndev,
- int idx, u8 *mac, struct station_info *sinfo)
-{
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- //TODO: dump scanned queue
-
- return -ENOENT;
-}
-
-static int cfg80211_rtw_change_bss(struct wiphy *wiphy, struct net_device *ndev,
- struct bss_parameters *params)
-{
- u8 i;
-
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-/*
- DBG_8192C("use_cts_prot=%d\n", params->use_cts_prot);
- DBG_8192C("use_short_preamble=%d\n", params->use_short_preamble);
- DBG_8192C("use_short_slot_time=%d\n", params->use_short_slot_time);
- DBG_8192C("ap_isolate=%d\n", params->ap_isolate);
-
- DBG_8192C("basic_rates_len=%d\n", params->basic_rates_len);
- for(i=0; i<params->basic_rates_len; i++)
- {
- DBG_8192C("basic_rates=%d\n", params->basic_rates[i]);
-
- }
-*/
- return 0;
-
-}
-
-static int cfg80211_rtw_set_channel(struct wiphy *wiphy
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- , struct net_device *ndev
- #endif
- , struct ieee80211_channel *chan, enum nl80211_channel_type channel_type)
-{
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
- #endif
-
- return 0;
-}
-
-static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev,
- struct cfg80211_auth_request *req)
-{
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- return 0;
-}
-
-static int cfg80211_rtw_assoc(struct wiphy *wiphy, struct net_device *ndev,
- struct cfg80211_assoc_request *req)
-{
- DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- return 0;
-}
-#endif //CONFIG_AP_MODE
-
-void rtw_cfg80211_rx_action_p2p(_adapter *padapter, u8 *pmgmt_frame, uint frame_len)
-{
- int type;
- s32 freq;
- int channel;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- u8 category, action;
-
- channel = rtw_get_oper_ch(padapter);
-
- DBG_8192C("RTW_Rx:cur_ch=%d\n", channel);
- #ifdef CONFIG_P2P
- type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE);
- if (type >= 0)
- goto indicate;
- #endif
- rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action);
- DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
-
-indicate:
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
-#else
- cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
-#endif
-}
-
-void rtw_cfg80211_rx_p2p_action_public(_adapter *padapter, u8 *pmgmt_frame, uint frame_len)
-{
- int type;
- s32 freq;
- int channel;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- u8 category, action;
-
- channel = rtw_get_oper_ch(padapter);
-
- DBG_8192C("RTW_Rx:cur_ch=%d\n", channel);
- #ifdef CONFIG_P2P
- type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE);
- if (type >= 0) {
- switch (type) {
- case P2P_GO_NEGO_CONF:
- case P2P_PROVISION_DISC_RESP:
- case P2P_INVIT_RESP:
- rtw_set_scan_deny(padapter, 2000);
- rtw_clear_scan_deny(padapter);
- }
- goto indicate;
- }
- #endif
- rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action);
- DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
-
-indicate:
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
-#else
- cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
-#endif
-}
-
-void rtw_cfg80211_rx_action(_adapter *adapter, u8 *frame, uint frame_len, const char*msg)
-{
- s32 freq;
- int channel;
- struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
- struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
- u8 category, action;
-
- channel = rtw_get_oper_ch(adapter);
-
- rtw_action_frame_parse(frame, frame_len, &category, &action);
-
- DBG_8192C("RTW_Rx:cur_ch=%d\n", channel);
- if (msg)
- DBG_871X("RTW_Rx:%s\n", msg);
- else
- DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
-
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
- else
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, GFP_ATOMIC);
-#else
- cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC);
-#endif
-
-}
-
-#ifdef CONFIG_P2P
-void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, size_t len)
-{
- u16 wps_devicepassword_id = 0x0000;
- uint wps_devicepassword_id_len = 0;
- u8 wpsie[ 255 ] = { 0x00 }, p2p_ie[ 255 ] = { 0x00 };
- uint p2p_ielen = 0;
- uint wpsielen = 0;
- u32 devinfo_contentlen = 0;
- u8 devinfo_content[64] = { 0x00 };
- u16 capability = 0;
- uint capability_len = 0;
-
- unsigned char category = RTW_WLAN_CATEGORY_PUBLIC;
- u8 action = P2P_PUB_ACTION_ACTION;
- u8 dialogToken = 1;
- u32 p2poui = cpu_to_be32(P2POUI);
- u8 oui_subtype = P2P_PROVISION_DISC_REQ;
- u32 p2pielen = 0;
-#ifdef CONFIG_WFD
- u32 wfdielen = 0;
-#endif //CONFIG_WFD
-
- 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);
- u8 *frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr));
- size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr);
-
-
- DBG_871X( "[%s] In\n", __FUNCTION__ );
-
- //prepare for building provision_request frame
- _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr1Ptr(buf), ETH_ALEN);
- _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerDevAddr, GetAddr1Ptr(buf), ETH_ALEN);
-
- pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON;
-
- rtw_get_wps_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, wpsie, &wpsielen);
- rtw_get_wps_attr_content( wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8*) &wps_devicepassword_id, &wps_devicepassword_id_len);
- wps_devicepassword_id = be16_to_cpu( wps_devicepassword_id );
-
- switch(wps_devicepassword_id)
- {
- case WPS_DPID_PIN:
- pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL;
- break;
- case WPS_DPID_USER_SPEC:
- pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_DISPLYA;
- break;
- case WPS_DPID_MACHINE_SPEC:
- break;
- case WPS_DPID_REKEY:
- break;
- case WPS_DPID_PBC:
- pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON;
- break;
- case WPS_DPID_REGISTRAR_SPEC:
- pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_KEYPAD;
- break;
- default:
- break;
- }
-
-
- if ( rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, p2p_ie, &p2p_ielen ) )
- {
-
- rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, devinfo_content, &devinfo_contentlen);
- rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&capability, &capability_len);
-
- }
-
-
- //start to build provision_request frame
- _rtw_memset(wpsie, 0, sizeof(wpsie));
- _rtw_memset(p2p_ie, 0, sizeof(p2p_ie));
- p2p_ielen = 0;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- return;
- }
-
-
- //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, pwdinfo->tx_prov_disc_info.peerDevAddr, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, pwdinfo->tx_prov_disc_info.peerDevAddr, ETH_ALEN);
-
- 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);
-
- 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, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen));
- pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen));
- pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen));
-
-
- //build_prov_disc_request_p2p_ie
- // P2P OUI
- p2pielen = 0;
- p2p_ie[ p2pielen++ ] = 0x50;
- p2p_ie[ p2pielen++ ] = 0x6F;
- p2p_ie[ p2pielen++ ] = 0x9A;
- p2p_ie[ p2pielen++ ] = 0x09; // WFA P2P v1.0
-
- // Commented by Albert 20110301
- // According to the P2P Specification, the provision discovery request frame should contain 3 P2P attributes
- // 1. P2P Capability
- // 2. Device Info
- // 3. Group ID ( When joining an operating P2P Group )
-
- // P2P Capability ATTR
- // Type:
- p2p_ie[ p2pielen++ ] = P2P_ATTR_CAPABILITY;
-
- // Length:
- //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0002 );
- RTW_PUT_LE16(p2p_ie + p2pielen, 0x0002);
- p2pielen += 2;
-
- // Value:
- // Device Capability Bitmap, 1 byte
- // Group Capability Bitmap, 1 byte
- _rtw_memcpy(p2p_ie + p2pielen, &capability, 2);
- p2pielen += 2;
-
-
- // Device Info ATTR
- // Type:
- p2p_ie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO;
-
- // Length:
- // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes)
- // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes)
- //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len );
- RTW_PUT_LE16(p2p_ie + p2pielen, devinfo_contentlen);
- p2pielen += 2;
-
- // Value:
- _rtw_memcpy(p2p_ie + p2pielen, devinfo_content, devinfo_contentlen);
- p2pielen += devinfo_contentlen;
-
-
- pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2p_ie, &p2p_ielen);
- //p2pielen = build_prov_disc_request_p2p_ie( pwdinfo, pframe, NULL, 0, pwdinfo->tx_prov_disc_info.peerDevAddr);
- //pframe += p2pielen;
- pattrib->pktlen += p2p_ielen;
-
- wpsielen = 0;
- // WPS OUI
- *(u32*) ( wpsie ) = cpu_to_be32( WPSOUI );
- wpsielen += 4;
-
- // WPS version
- // Type:
- *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_VER1 );
- wpsielen += 2;
-
- // Length:
- *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0001 );
- wpsielen += 2;
-
- // Value:
- wpsie[wpsielen++] = WPS_VERSION_1; // Version 1.0
-
- // Config Method
- // Type:
- *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_CONF_METHOD );
- wpsielen += 2;
-
- // Length:
- *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0002 );
- wpsielen += 2;
-
- // Value:
- *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( pwdinfo->tx_prov_disc_info.wps_config_method_request );
- wpsielen += 2;
-
- pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen );
-
-
-#ifdef CONFIG_WFD
- wfdielen = build_provdisc_req_wfd_ie(pwdinfo, pframe);
- pframe += wfdielen;
- pattrib->pktlen += wfdielen;
-#endif //CONFIG_WFD
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- //dump_mgntframe(padapter, pmgntframe);
- if (dump_mgntframe_and_wait_ack(padapter, pmgntframe) != _SUCCESS)
- DBG_8192C("%s, ack to\n", __func__);
-
- //if(wps_devicepassword_id == WPS_DPID_REGISTRAR_SPEC)
- //{
- // DBG_8192C("waiting for p2p peer key-in PIN CODE\n");
- // rtw_msleep_os(15000); // 15 sec for key in PIN CODE, workaround for GS2 before issuing Nego Req.
- //}
-
-}
-
-static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct wireless_dev *wdev,
-#else
- struct net_device *ndev,
-#endif
- struct ieee80211_channel * channel,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
- enum nl80211_channel_type channel_type,
-#endif
- unsigned int duration, u64 *cookie)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct net_device *ndev = wdev_to_ndev(wdev);
-#endif
- s32 err = 0;
- u8 remain_ch = (u8) ieee80211_frequency_to_channel(channel->center_freq);
- u8 ready_on_channel = _FALSE;
- _adapter *padapter;
- struct rtw_wdev_priv *pwdev_priv;
- struct mlme_ext_priv *pmlmeext;
- struct wifidirect_info *pwdinfo;
- struct cfg80211_wifidirect_info *pcfg80211_wdinfo;
-
-#ifndef CONFIG_RADIO_WORK
- #define RTW_ROCH_DURATION_ENLARGE
- #define RTW_ROCH_BACK_OP
-#endif
-
- if (ndev == NULL) {
- return -EINVAL;
- }
-
- padapter = (_adapter *)rtw_netdev_priv(ndev);
- pwdev_priv = adapter_wdev_data(padapter);
- pmlmeext = &padapter->mlmeextpriv;
- pwdinfo = &padapter->wdinfo;
- pcfg80211_wdinfo = &padapter->cfg80211_wdinfo;
-
- 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
- p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK);
- pcfg80211_wdinfo->not_indic_ro_ch_exp = _FALSE;
- }
-
- pcfg80211_wdinfo->is_ro_ch = _TRUE;
- pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time();
-
- if(_FAIL == rtw_pwr_wakeup(padapter)) {
- err = -EFAULT;
- goto exit;
- }
-
- _rtw_memcpy(&pcfg80211_wdinfo->remain_on_ch_channel, channel, sizeof(struct ieee80211_channel));
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
- pcfg80211_wdinfo->remain_on_ch_type= channel_type;
- #endif
- pcfg80211_wdinfo->remain_on_ch_cookie= *cookie;
-
- rtw_scan_abort(padapter);
-#ifdef CONFIG_CONCURRENT_MODE
- if(rtw_buddy_adapter_up(padapter))
- rtw_scan_abort(padapter->pbuddy_adapter);
-#endif //CONFIG_CONCURRENT_MODE
-
- if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE)
- {
- DBG_871X("mlme state:0x%x\n", get_fwstate(&padapter->mlmepriv));
- remain_ch = padapter->mlmeextpriv.cur_channel;
- }
-#ifdef CONFIG_CONCURRENT_MODE
- if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE)
- {
- DBG_871X("buddy_intf's mlme state:0x%x\n", get_fwstate(&(padapter->pbuddy_adapter->mlmepriv)));
- remain_ch = padapter->pbuddy_adapter->mlmeextpriv.cur_channel;
- }
-#endif /* CONFIG_CONCURRENT_MODE */
-
- //if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- rtw_p2p_enable(padapter, P2P_ROLE_DEVICE);
- adapter_wdev_data(padapter)->p2p_enabled = _TRUE;
- padapter->wdinfo.listen_channel = remain_ch;
- }
- else
- {
- rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo));
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo));
-#endif
- }
-
-
- rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN);
-
-
-#ifdef RTW_ROCH_DURATION_ENLARGE
- if(duration < 400)
- duration = duration*3;//extend from exper.
-#endif
-
-
-
-#ifdef RTW_ROCH_BACK_OP
-#ifdef CONFIG_CONCURRENT_MODE
- if(check_buddy_fwstate(padapter, _FW_LINKED) &&
- (duration<pwdinfo->ext_listen_interval))
- {
- duration = duration + pwdinfo->ext_listen_interval;
- }
-#endif
-#endif
-
- pcfg80211_wdinfo->restore_channel = rtw_get_oper_ch(padapter);
-
- if(rtw_ch_set_search_ch(pmlmeext->channel_set, remain_ch) >= 0) {
-#ifdef CONFIG_CONCURRENT_MODE
- if ( check_buddy_fwstate(padapter, _FW_LINKED) )
- {
- PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
- struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
-
- if((remain_ch != pbuddy_mlmeext->cur_channel) && !check_fwstate(&padapter->mlmepriv, _FW_LINKED))
- {
- if(ATOMIC_READ(&pwdev_priv->switch_ch_to)==1 ||
- (remain_ch != pmlmeext->cur_channel))
- {
- if (check_buddy_fwstate(padapter, WIFI_FW_STATION_STATE)) {
- DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__);
- issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500);
- }
-
- ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
-
-#ifdef RTW_ROCH_BACK_OP
- DBG_8192C("%s, set switch ch timer, duration=%d\n", __func__, duration-pwdinfo->ext_listen_interval);
- _set_timer(&pwdinfo->ap_p2p_switch_timer, duration-pwdinfo->ext_listen_interval);
-#endif
- }
- }
-
- ready_on_channel = _TRUE;
- //pmlmeext->cur_channel = remain_ch;
- //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
- }else
-#endif //CONFIG_CONCURRENT_MODE
- if(remain_ch != rtw_get_oper_ch(padapter) )
- {
- ready_on_channel = _TRUE;
- //pmlmeext->cur_channel = remain_ch;
- //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
- }
- } else {
- DBG_871X("%s remain_ch:%u not in channel plan!!!!\n", __FUNCTION__, remain_ch);
- }
-
-
- //call this after other things have been done
-#ifdef CONFIG_CONCURRENT_MODE
- if(ATOMIC_READ(&pwdev_priv->ro_ch_to)==1 ||
- (remain_ch != rtw_get_oper_ch(padapter)))
- {
- u8 co_channel = 0xff;
- ATOMIC_SET(&pwdev_priv->ro_ch_to, 0);
-#endif
-
- if(ready_on_channel == _TRUE)
- {
- if ( !check_fwstate(&padapter->mlmepriv, _FW_LINKED ) )
- {
- pmlmeext->cur_channel = remain_ch;
-
-#ifdef CONFIG_CONCURRENT_MODE
- co_channel = rtw_get_oper_ch(padapter);
-
- if(co_channel !=remain_ch)
-#endif
- {
- //if (!padapter->mlmepriv.LinkDetectInfo.bBusyTraffic)
- set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
- }
- }
- }
- DBG_8192C("%s, set ro ch timer, duration=%d\n", __func__, duration);
- _set_timer( &pcfg80211_wdinfo->remain_on_ch_timer, duration);
-
-#ifdef CONFIG_CONCURRENT_MODE
- }
-#endif
-
- rtw_cfg80211_ready_on_channel(padapter, *cookie, channel, channel_type, duration, GFP_KERNEL);
-
-exit:
- if (err) {
- pcfg80211_wdinfo->is_ro_ch = _FALSE;
- pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time();
- }
-
- return err;
-}
-
-static s32 cfg80211_rtw_cancel_remain_on_channel(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct wireless_dev *wdev,
-#else
- struct net_device *ndev,
-#endif
- u64 cookie)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct net_device *ndev = wdev_to_ndev(wdev);
-#endif
- s32 err = 0;
- _adapter *padapter;
- struct rtw_wdev_priv *pwdev_priv;
- struct wifidirect_info *pwdinfo;
- struct cfg80211_wifidirect_info *pcfg80211_wdinfo;
-
- if (ndev == NULL) {
- err = -EINVAL;
- goto exit;
- }
-
- padapter = (_adapter *)rtw_netdev_priv(ndev);
- pwdev_priv = adapter_wdev_data(padapter);
- pwdinfo = &padapter->wdinfo;
- pcfg80211_wdinfo = &padapter->cfg80211_wdinfo;
-
- 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
- // Disable P2P Listen State
- if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
- {
- if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
- {
- rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE);
- _rtw_memset(pwdinfo, 0x00, sizeof(struct wifidirect_info));
- }
- }
- else
- #endif
- {
- rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo));
-#endif
- }
-
- pcfg80211_wdinfo->is_ro_ch = _FALSE;
- pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time();
-
-exit:
- return err;
-}
-
-#endif //CONFIG_P2P
-
-static int _cfg80211_rtw_mgmt_tx(_adapter *padapter, u8 tx_ch, const u8 *buf, size_t len)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- unsigned char *pframe;
- int ret = _FAIL;
- bool ack = _TRUE;
- struct rtw_ieee80211_hdr *pwlanhdr;
- struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-#ifdef CONFIG_P2P
- struct wifidirect_info *pwdinfo = &padapter->wdinfo;
-#endif //CONFIG_P2P
- //struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo;
-
- rtw_set_scan_deny(padapter, 1000);
-
- rtw_scan_abort(padapter);
- #ifdef CONFIG_CONCURRENT_MODE
- if(rtw_buddy_adapter_up(padapter))
- rtw_scan_abort(padapter->pbuddy_adapter);
- #endif /* CONFIG_CONCURRENT_MODE */
-#ifdef CONFIG_P2P
- if (padapter->cfg80211_wdinfo.is_ro_ch == _TRUE) {
- //DBG_8192C("%s, cancel ro ch timer\n", __func__);
- //_cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer);
- //padapter->cfg80211_wdinfo.is_ro_ch = _FALSE;
- #ifdef CONFIG_CONCURRENT_MODE
- if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
- {
- DBG_8192C("%s, extend ro ch time\n", __func__);
- _set_timer( &padapter->cfg80211_wdinfo.remain_on_ch_timer, pwdinfo->ext_listen_period);
- }
- #endif //CONFIG_CONCURRENT_MODE
- }
-#endif //CONFIG_P2P
-#ifdef CONFIG_CONCURRENT_MODE
- if (check_buddy_fwstate(padapter, _FW_LINKED )) {
- u8 co_channel=0xff;
- PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
- struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
-
- co_channel = rtw_get_oper_ch(padapter);
-
- if (tx_ch != pbuddy_mlmeext->cur_channel) {
-
- u16 ext_listen_period;
-
- if (ATOMIC_READ(&pwdev_priv->switch_ch_to)==1) {
- if (check_buddy_fwstate(padapter, WIFI_FW_STATION_STATE)) {
- DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__);
- issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500);
- }
-
- ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
-
- //DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, pwdinfo->ext_listen_period);
- //_set_timer(&pwdinfo->ap_p2p_switch_timer, pwdinfo->ext_listen_period);
- }
-
- if (check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
- {
- ext_listen_period = 500;// 500ms
- }
- else
- {
- ext_listen_period = pwdinfo->ext_listen_period;
- }
-
- DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, ext_listen_period);
- _set_timer(&pwdinfo->ap_p2p_switch_timer, ext_listen_period);
-
- }
-
- if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
- pmlmeext->cur_channel = tx_ch;
-
- if (tx_ch != co_channel)
- set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
- }else
-#endif //CONFIG_CONCURRENT_MODE
- //if (tx_ch != pmlmeext->cur_channel) {
- if(tx_ch != rtw_get_oper_ch(padapter)) {
- if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
- pmlmeext->cur_channel = tx_ch;
- set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
- }
-
- //starting alloc mgmt frame to dump it
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- //ret = -ENOMEM;
- ret = _FAIL;
- goto exit;
- }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(padapter, pattrib);
- pattrib->retry_ctrl = _FALSE;
-
- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-
- _rtw_memcpy(pframe, (void*)buf, len);
- pattrib->pktlen = len;
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
- //update seq number
- pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
- pattrib->seqnum = pmlmeext->mgnt_seq;
- pmlmeext->mgnt_seq++;
-
-#ifdef CONFIG_WFD
- {
- struct wifi_display_info *pwfd_info;
-
- pwfd_info = padapter->wdinfo.wfd_info;
-
- if ( _TRUE == pwfd_info->wfd_enable )
- {
- rtw_append_wfd_ie( padapter, pframe, &pattrib->pktlen );
- }
- }
-#endif // CONFIG_WFD
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- if (dump_mgntframe_and_wait_ack(padapter, pmgntframe) != _SUCCESS)
- {
- ack = _FALSE;
- ret = _FAIL;
-
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, ack == _FAIL\n", __func__);
- #endif
- }
- else
- {
-
-#ifdef CONFIG_XMIT_ACK
- rtw_msleep_os(50);
-#endif
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, ack=%d, ok!\n", __func__, ack);
- #endif
- ret = _SUCCESS;
- }
-
-exit:
-
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, ret=%d\n", __func__, ret);
- #endif
-
- return ret;
-
-}
-
-static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct wireless_dev *wdev,
-#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)
- bool offchan,
- #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)
- unsigned int wait,
- #endif
- const u8 *buf, size_t len,
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
- bool no_cck,
- #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;
- u32 dump_limit = RTW_MAX_MGMT_TX_CNT;
- u32 dump_cnt = 0;
- bool ack = _TRUE;
- u8 tx_ch = (u8)ieee80211_frequency_to_channel(chan->center_freq);
- u8 category, action;
- int type = (-1);
- u32 start = rtw_get_current_time();
- _adapter *padapter;
- struct rtw_wdev_priv *pwdev_priv;
-
- if (ndev == NULL) {
- ret = -EINVAL;
- goto exit;
- }
-
- padapter = (_adapter *)rtw_netdev_priv(ndev);
- pwdev_priv = adapter_wdev_data(padapter);
-
- /* cookie generation */
- *cookie = (unsigned long) buf;
-
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_871X(FUNC_ADPT_FMT" len=%zu, ch=%d"
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
- ", ch_type=%d"
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- ", channel_type_valid=%d"
- #endif
- #endif
- "\n", FUNC_ADPT_ARG(padapter),
- len, tx_ch
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
- , channel_type
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- , channel_type_valid
- #endif
- #endif
- );
-#endif /* CONFIG_DEBUG_CFG80211 */
-
- /* indicate ack before issue frame to avoid racing with rsp frame */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- rtw_cfg80211_mgmt_tx_status(padapter, *cookie, buf, len, ack, GFP_KERNEL);
-#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35))
- cfg80211_action_tx_status(ndev, *cookie, buf, len, ack, GFP_KERNEL);
-#endif
-
- if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) {
- DBG_8192C(FUNC_ADPT_FMT" frame_control:0x%x\n", FUNC_ADPT_ARG(padapter),
- le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl));
- goto exit;
- }
-
- DBG_8192C("RTW_Tx:tx_ch=%d, da="MAC_FMT"\n", tx_ch, MAC_ARG(GetAddr1Ptr(buf)));
- #ifdef CONFIG_P2P
- if((type = rtw_p2p_check_frames(padapter, buf, len, _TRUE)) >= 0) {
- goto dump;
- }
- #endif
- if (category == RTW_WLAN_CATEGORY_PUBLIC)
- DBG_871X("RTW_Tx:%s\n", action_public_str(action));
- else
- DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action);
-
-dump:
-
- rtw_ps_deny(padapter, PS_DENY_MGNT_TX);
- if(_FAIL == rtw_pwr_wakeup(padapter)) {
- ret = -EFAULT;
- goto cancel_ps_deny;
- }
-
- do {
- dump_cnt++;
- tx_ret = _cfg80211_rtw_mgmt_tx(padapter, tx_ch, buf, len);
- } while (dump_cnt < dump_limit && tx_ret != _SUCCESS);
-
- if (tx_ret != _SUCCESS || dump_cnt > 1) {
- DBG_871X(FUNC_ADPT_FMT" %s (%d/%d) in %d ms\n", FUNC_ADPT_ARG(padapter),
- tx_ret==_SUCCESS?"OK":"FAIL", dump_cnt, dump_limit, rtw_get_passing_time_ms(start));
- }
-
- switch (type) {
- case P2P_GO_NEGO_CONF:
- rtw_clear_scan_deny(padapter);
- break;
- case P2P_INVIT_RESP:
- if (pwdev_priv->invit_info.flags & BIT(0)
- && pwdev_priv->invit_info.status == 0)
- {
- DBG_871X(FUNC_ADPT_FMT" agree with invitation of persistent group\n",
- FUNC_ADPT_ARG(padapter));
- rtw_set_scan_deny(padapter, 5000);
- rtw_pwr_wakeup_ex(padapter, 5000);
- rtw_clear_scan_deny(padapter);
- }
- break;
- }
-
-cancel_ps_deny:
- rtw_ps_deny_cancel(padapter, PS_DENY_MGNT_TX);
-exit:
- return ret;
-}
-
-static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
- struct wireless_dev *wdev,
-#else
- struct net_device *ndev,
-#endif
- u16 frame_type, bool reg)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- struct net_device *ndev = wdev_to_ndev(wdev);
-#endif
- _adapter *adapter;
-
- if (ndev == NULL)
- goto exit;
-
- adapter = (_adapter *)rtw_netdev_priv(ndev);
-
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_871X(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter),
- frame_type, reg);
-#endif
-
- if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ))
- return;
-exit:
- return;
-}
-
-#if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy,
- struct net_device *ndev,
- u8 *peer,
- u8 action_code,
- u8 dialog_token,
- u16 status_code,
- const u8 *buf,
- size_t len)
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- int ret = 0;
- struct tdls_txmgmt txmgmt;
-
- //TDLS: discard wpa_supplicant's frame mgmt
- DBG_871X("%s %d\n", __FUNCTION__, __LINE__);
- return 0;
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- _rtw_memcpy(txmgmt.peer, peer, ETH_ALEN);
- txmgmt.action_code = action_code;
- txmgmt.dialog_token= dialog_token;
- txmgmt.status_code = status_code;
- txmgmt.len = len;
- txmgmt.buf = (u8 *)rtw_malloc(txmgmt.len);
- if (txmgmt.buf == NULL)
- {
- ret = -ENOMEM;
- goto bad;
- }
- _rtw_memcpy(txmgmt.buf, (void*)buf, txmgmt.len);
- txmgmt.external_support = _TRUE;
-
-//TDLS: Debug purpose
-#if 0
- DBG_871X("%s %d\n", __FUNCTION__, __LINE__);
- DBG_871X("peer:"MAC_FMT" ", MAC_ARG(txmgmt.peer));
- DBG_871X("action code:%d ", txmgmt.action_code);
- DBG_871X("dialog:%d ", txmgmt.dialog_token);
- DBG_871X("status code:%d\n", txmgmt.status_code);
- if( txmgmt.len > 0 )
- {
- int i=0;
- for(;i < len; i++)
- DBG_871X("%02x ", *(txmgmt.buf+i));
- DBG_871X("\n len:%d\n", txmgmt.len);
- }
-#endif
-
- switch(txmgmt.action_code) {
- case TDLS_SETUP_REQUEST:
- issue_tdls_setup_req(padapter, &txmgmt, _TRUE);
- break;
- case TDLS_SETUP_RESPONSE:
- issue_tdls_setup_rsp(padapter, &txmgmt);
- break;
- case TDLS_SETUP_CONFIRM:
- issue_tdls_setup_cfm(padapter, &txmgmt);
- break;
- case TDLS_TEARDOWN:
- break;
- case TDLS_DISCOVERY_REQUEST:
- issue_tdls_dis_req(padapter, &txmgmt);
- break;
- }
-
-bad:
- if (txmgmt.buf)
- {
- rtw_mfree(txmgmt.buf, txmgmt.len);
- }
-
- return ret;
-}
-
-static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy,
- struct net_device *ndev,
- u8 *peer,
- enum nl80211_tdls_operation oper)
-{
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct tdls_txmgmt txmgmt;
- struct sta_info *ptdls_sta = NULL;
-
- DBG_871X(FUNC_NDEV_FMT", nl80211_tdls_operation:%d\n", FUNC_NDEV_ARG(ndev), oper);
-
-#ifdef CONFIG_LPS
- rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1);
-#endif //CONFIG_LPS
-
- _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
- if(peer)
- _rtw_memcpy(txmgmt.peer, peer, ETH_ALEN);
-#if 0
- CFG80211_TDLS_DISCOVERY_REQ,
- CFG80211_TDLS_SETUP,
- CFG80211_TDLS_TEARDOWN,
- CFG80211_TDLS_ENABLE_LINK,
- CFG80211_TDLS_DISABLE_LINK,
- CFG80211_TDLS_ENABLE,
- CFG80211_TDLS_DISABLE
-#endif
- switch(oper) {
- case NL80211_TDLS_DISCOVERY_REQ:
- issue_tdls_dis_req(padapter, &txmgmt);
- break;
- case NL80211_TDLS_SETUP:
-#ifdef CONFIG_WFD
- if ( _AES_ != padapter->securitypriv.dot11PrivacyAlgrthm )
- {
- if ( padapter->wdinfo.wfd_tdls_weaksec == _TRUE)
- issue_tdls_setup_req(padapter, &txmgmt, _TRUE);
- else
- DBG_871X( "[%s] Current link is not AES, SKIP sending the tdls setup request!!\n", __FUNCTION__ );
- }
- else
-#endif // CONFIG_WFD
- {
- issue_tdls_setup_req(padapter, &txmgmt, _TRUE);
- }
- break;
- case NL80211_TDLS_TEARDOWN:
- ptdls_sta = rtw_get_stainfo( &(padapter->stapriv), txmgmt.peer);
- if(ptdls_sta != NULL)
- {
- txmgmt.status_code = _RSON_TDLS_TEAR_UN_RSN_;
- issue_tdls_teardown(padapter, &txmgmt, _FALSE);
- }
- else
- DBG_871X( "TDLS peer not found\n");
- break;
- case NL80211_TDLS_ENABLE_LINK:
- break;
- case NL80211_TDLS_DISABLE_LINK:
- break;
- }
- return 0;
-}
-#endif /* CONFIG_TDLS */
-
-static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, int len)
-{
- int ret = 0;
- uint wps_ielen = 0;
- u8 *wps_ie;
- u32 p2p_ielen = 0;
- u8 wps_oui[8]={0x0,0x50,0xf2,0x04};
- u8 *p2p_ie;
- u32 wfd_ielen = 0;
- u8 *wfd_ie;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-
- DBG_871X(FUNC_NDEV_FMT" ielen=%d\n", FUNC_NDEV_ARG(ndev), len);
-
- if(len>0)
- {
- if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
- {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("bcn_wps_ielen=%d\n", wps_ielen);
- #endif
-
- if(pmlmepriv->wps_beacon_ie)
- {
- u32 free_len = pmlmepriv->wps_beacon_ie_len;
- pmlmepriv->wps_beacon_ie_len = 0;
- rtw_mfree(pmlmepriv->wps_beacon_ie, free_len);
- pmlmepriv->wps_beacon_ie = NULL;
- }
-
- pmlmepriv->wps_beacon_ie = rtw_malloc(wps_ielen);
- if ( pmlmepriv->wps_beacon_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
-
- _rtw_memcpy(pmlmepriv->wps_beacon_ie, wps_ie, wps_ielen);
- pmlmepriv->wps_beacon_ie_len = wps_ielen;
-
- update_beacon(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, _TRUE);
-
- }
-
- //buf += wps_ielen;
- //len -= wps_ielen;
-
- #ifdef CONFIG_P2P
- if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen)))
- {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("bcn_p2p_ielen=%d\n", p2p_ielen);
- #endif
-
- if(pmlmepriv->p2p_beacon_ie)
- {
- u32 free_len = pmlmepriv->p2p_beacon_ie_len;
- pmlmepriv->p2p_beacon_ie_len = 0;
- rtw_mfree(pmlmepriv->p2p_beacon_ie, free_len);
- pmlmepriv->p2p_beacon_ie = NULL;
- }
-
- pmlmepriv->p2p_beacon_ie = rtw_malloc(p2p_ielen);
- if ( pmlmepriv->p2p_beacon_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
-
- _rtw_memcpy(pmlmepriv->p2p_beacon_ie, p2p_ie, p2p_ielen);
- pmlmepriv->p2p_beacon_ie_len = p2p_ielen;
-
- }
- #endif //CONFIG_P2P
-
- //buf += p2p_ielen;
- //len -= p2p_ielen;
-
- #ifdef CONFIG_WFD
- if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen))
- {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("bcn_wfd_ielen=%d\n", wfd_ielen);
- #endif
-
- if(pmlmepriv->wfd_beacon_ie)
- {
- u32 free_len = pmlmepriv->wfd_beacon_ie_len;
- pmlmepriv->wfd_beacon_ie_len = 0;
- rtw_mfree(pmlmepriv->wfd_beacon_ie, free_len);
- pmlmepriv->wfd_beacon_ie = NULL;
- }
-
- pmlmepriv->wfd_beacon_ie = rtw_malloc(wfd_ielen);
- if ( pmlmepriv->wfd_beacon_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
- rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len);
- }
- #endif //CONFIG_WFD
-
- pmlmeext->bstart_bss = _TRUE;
-
- }
-
- return ret;
-
-}
-
-static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *buf, int len)
-{
- int ret = 0;
- uint wps_ielen = 0;
- u8 *wps_ie;
- u32 p2p_ielen = 0;
- u8 *p2p_ie;
- u32 wfd_ielen = 0;
- u8 *wfd_ie;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(net);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, ielen=%d\n", __func__, len);
-#endif
-
- if(len>0)
- {
- if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
- {
- uint attr_contentlen = 0;
- u16 uconfig_method, *puconfig_method = NULL;
-
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("probe_resp_wps_ielen=%d\n", wps_ielen);
- #endif
-
- if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS))
- {
- u8 sr = 0;
- rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL);
-
- if (sr != 0)
- {
- DBG_871X("%s, got sr\n", __func__);
- }
- else
- {
- DBG_8192C("GO mode process WPS under site-survey, sr no set\n");
- return ret;
- }
- }
-
- if(pmlmepriv->wps_probe_resp_ie)
- {
- u32 free_len = pmlmepriv->wps_probe_resp_ie_len;
- pmlmepriv->wps_probe_resp_ie_len = 0;
- rtw_mfree(pmlmepriv->wps_probe_resp_ie, free_len);
- pmlmepriv->wps_probe_resp_ie = NULL;
- }
-
- pmlmepriv->wps_probe_resp_ie = rtw_malloc(wps_ielen);
- if ( pmlmepriv->wps_probe_resp_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
-
- //add PUSH_BUTTON config_method by driver self in wpsie of probe_resp at GO Mode
- if ( (puconfig_method = (u16*)rtw_get_wps_attr_content( wps_ie, wps_ielen, WPS_ATTR_CONF_METHOD , NULL, &attr_contentlen)) != NULL )
- {
- //struct registry_priv *pregistrypriv = &padapter->registrypriv;
- struct wireless_dev *wdev = padapter->rtw_wdev;
-
- #ifdef CONFIG_DEBUG_CFG80211
- //printk("config_method in wpsie of probe_resp = 0x%x\n", be16_to_cpu(*puconfig_method));
- #endif
-
- //if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- if(wdev->iftype != NL80211_IFTYPE_P2P_GO) //for WIFI-DIRECT LOGO 4.2.2, AUTO GO can't set PUSH_BUTTON flags
- {
- uconfig_method = WPS_CM_PUSH_BUTTON;
- uconfig_method = cpu_to_be16( uconfig_method );
-
- *puconfig_method |= uconfig_method;
- }
- #endif
- }
-
- _rtw_memcpy(pmlmepriv->wps_probe_resp_ie, wps_ie, wps_ielen);
- pmlmepriv->wps_probe_resp_ie_len = wps_ielen;
-
- }
-
- //buf += wps_ielen;
- //len -= wps_ielen;
-
- #ifdef CONFIG_P2P
- if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen)))
- {
- u8 is_GO = _FALSE;
- u32 attr_contentlen = 0;
- u16 cap_attr=0;
-
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("probe_resp_p2p_ielen=%d\n", p2p_ielen);
- #endif
-
- //Check P2P Capability ATTR
- if( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&cap_attr, (uint*) &attr_contentlen) )
- {
- u8 grp_cap=0;
- //DBG_8192C( "[%s] Got P2P Capability Attr!!\n", __FUNCTION__ );
- cap_attr = le16_to_cpu(cap_attr);
- grp_cap = (u8)((cap_attr >> 8)&0xff);
-
- is_GO = (grp_cap&BIT(0)) ? _TRUE:_FALSE;
-
- if(is_GO)
- DBG_8192C("Got P2P Capability Attr, grp_cap=0x%x, is_GO\n", grp_cap);
- }
-
-
- if(is_GO == _FALSE)
- {
- if(pmlmepriv->p2p_probe_resp_ie)
- {
- u32 free_len = pmlmepriv->p2p_probe_resp_ie_len;
- pmlmepriv->p2p_probe_resp_ie_len = 0;
- rtw_mfree(pmlmepriv->p2p_probe_resp_ie, free_len);
- pmlmepriv->p2p_probe_resp_ie = NULL;
- }
-
- pmlmepriv->p2p_probe_resp_ie = rtw_malloc(p2p_ielen);
- if ( pmlmepriv->p2p_probe_resp_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
- _rtw_memcpy(pmlmepriv->p2p_probe_resp_ie, p2p_ie, p2p_ielen);
- pmlmepriv->p2p_probe_resp_ie_len = p2p_ielen;
- }
- else
- {
- if(pmlmepriv->p2p_go_probe_resp_ie)
- {
- u32 free_len = pmlmepriv->p2p_go_probe_resp_ie_len;
- pmlmepriv->p2p_go_probe_resp_ie_len = 0;
- rtw_mfree(pmlmepriv->p2p_go_probe_resp_ie, free_len);
- pmlmepriv->p2p_go_probe_resp_ie = NULL;
- }
-
- pmlmepriv->p2p_go_probe_resp_ie = rtw_malloc(p2p_ielen);
- if ( pmlmepriv->p2p_go_probe_resp_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
- _rtw_memcpy(pmlmepriv->p2p_go_probe_resp_ie, p2p_ie, p2p_ielen);
- pmlmepriv->p2p_go_probe_resp_ie_len = p2p_ielen;
- }
-
- }
- #endif //CONFIG_P2P
-
- //buf += p2p_ielen;
- //len -= p2p_ielen;
-
- #ifdef CONFIG_WFD
- if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen))
- {
- #ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("probe_resp_wfd_ielen=%d\n", wfd_ielen);
- #endif
-
- if(pmlmepriv->wfd_probe_resp_ie)
- {
- u32 free_len = pmlmepriv->wfd_probe_resp_ie_len;
- pmlmepriv->wfd_probe_resp_ie_len = 0;
- rtw_mfree(pmlmepriv->wfd_probe_resp_ie, free_len);
- pmlmepriv->wfd_probe_resp_ie = NULL;
- }
-
- pmlmepriv->wfd_probe_resp_ie = rtw_malloc(wfd_ielen);
- if ( pmlmepriv->wfd_probe_resp_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
- rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len);
- }
- #endif //CONFIG_WFD
-
- }
-
- return ret;
-
-}
-
-static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, char *buf, int len)
-{
- int ret = 0;
- _adapter *padapter = (_adapter *)rtw_netdev_priv(net);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-
- DBG_8192C("%s, ielen=%d\n", __func__, len);
-
- if(len>0)
- {
- if(pmlmepriv->wps_assoc_resp_ie)
- {
- u32 free_len = pmlmepriv->wps_assoc_resp_ie_len;
- pmlmepriv->wps_assoc_resp_ie_len = 0;
- rtw_mfree(pmlmepriv->wps_assoc_resp_ie, free_len);
- pmlmepriv->wps_assoc_resp_ie = NULL;
- }
-
- pmlmepriv->wps_assoc_resp_ie = rtw_malloc(len);
- if ( pmlmepriv->wps_assoc_resp_ie == NULL) {
- DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
- return -EINVAL;
-
- }
- _rtw_memcpy(pmlmepriv->wps_assoc_resp_ie, buf, len);
- pmlmepriv->wps_assoc_resp_ie_len = len;
- }
-
- return ret;
-
-}
-
-int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len,
- int type)
-{
- int ret = 0;
- uint wps_ielen = 0;
- u32 p2p_ielen = 0;
-
-#ifdef CONFIG_DEBUG_CFG80211
- DBG_8192C("%s, ielen=%d\n", __func__, len);
-#endif
-
- if( (rtw_get_wps_ie(buf, len, NULL, &wps_ielen) && (wps_ielen>0))
- #ifdef CONFIG_P2P
- || (rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen) && (p2p_ielen>0))
- #endif
- )
- {
- if (net != NULL)
- {
- switch (type)
- {
- case 0x1: //BEACON
- ret = rtw_cfg80211_set_beacon_wpsp2pie(net, buf, len);
- break;
- case 0x2: //PROBE_RESP
- ret = rtw_cfg80211_set_probe_resp_wpsp2pie(net, buf, len);
- break;
- case 0x4: //ASSOC_RESP
- ret = rtw_cfg80211_set_assoc_resp_wpsp2pie(net, buf, len);
- break;
- }
- }
- }
-
- return ret;
-
-}
-
-static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type)
-{
-
-#define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */
-#define MAX_BIT_RATE_40MHZ_MCS7 150 /* Mbps */
-
- ht_cap->ht_supported = _TRUE;
-
- ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
- IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20 |
- IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU;
-
- /*
- *Maximum length of AMPDU that the STA can receive.
- *Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
- */
- ht_cap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
-
- /*Minimum MPDU start spacing , */
- ht_cap->ampdu_density = IEEE80211_HT_MPDU_DENSITY_16;
-
- ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
-
- /*
- *hw->wiphy->bands[IEEE80211_BAND_2GHZ]
- *base on ant_num
- *rx_mask: RX mask
- *if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7
- *if rx_ant =2 rx_mask[1]=0xff;==>MCS8-MCS15
- *if rx_ant >=3 rx_mask[2]=0xff;
- *if BW_40 rx_mask[4]=0x01;
- *highest supported RX rate
- */
- if(rf_type == RF_1T1R)
- {
- ht_cap->mcs.rx_mask[0] = 0xFF;
- ht_cap->mcs.rx_mask[1] = 0x00;
- ht_cap->mcs.rx_mask[4] = 0x01;
-
- ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS7;
- }
- else if((rf_type == RF_1T2R) || (rf_type==RF_2T2R))
- {
- ht_cap->mcs.rx_mask[0] = 0xFF;
- ht_cap->mcs.rx_mask[1] = 0xFF;
- ht_cap->mcs.rx_mask[4] = 0x01;
-
- ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS15;
- }
- else
- {
- DBG_8192C("%s, error rf_type=%d\n", __func__, rf_type);
- }
-
-}
-
-void rtw_cfg80211_init_wiphy(_adapter *padapter)
-{
- u8 rf_type;
- struct ieee80211_supported_band *bands;
- struct wireless_dev *pwdev = padapter->rtw_wdev;
- struct wiphy *wiphy = pwdev->wiphy;
-
- rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
-
- DBG_8192C("%s:rf_type=%d\n", __func__, rf_type);
-
- /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */
- {
- bands = wiphy->bands[IEEE80211_BAND_2GHZ];
- if(bands)
- rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type);
- }
-
- /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */
- {
- bands = wiphy->bands[IEEE80211_BAND_5GHZ];
- if(bands)
- rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type);
- }
-
- /* init regulary domain */
- rtw_regd_init(padapter);
-
- /* copy mac_addr to wiphy */
- _rtw_memcpy(wiphy->perm_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
-
-}
-
-/*
-struct ieee80211_iface_limit rtw_limits[] = {
- { .max = 1, .types = BIT(NL80211_IFTYPE_STATION)
- | BIT(NL80211_IFTYPE_ADHOC)
-#ifdef CONFIG_AP_MODE
- | BIT(NL80211_IFTYPE_AP)
-#endif
-#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE))
- | BIT(NL80211_IFTYPE_P2P_CLIENT)
- | BIT(NL80211_IFTYPE_P2P_GO)
-#endif
- },
- {.max = 1, .types = BIT(NL80211_IFTYPE_MONITOR)},
-};
-
-struct ieee80211_iface_combination rtw_combinations = {
- .limits = rtw_limits,
- .n_limits = ARRAY_SIZE(rtw_limits),
- .max_interfaces = 2,
- .num_different_channels = 1,
-};
-*/
-
-static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy)
-{
-
- wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
-
- wiphy->max_scan_ssids = RTW_SSID_SCAN_AMOUNT;
- wiphy->max_scan_ie_len = RTW_SCAN_IE_LEN_MAX;
- wiphy->max_num_pmkids = RTW_MAX_NUM_PMKIDS;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
- wiphy->max_remain_on_channel_duration = RTW_MAX_REMAIN_ON_CHANNEL_DURATION;
-#endif
-
- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
- | BIT(NL80211_IFTYPE_ADHOC)
-#ifdef CONFIG_AP_MODE
- | BIT(NL80211_IFTYPE_AP)
- | BIT(NL80211_IFTYPE_MONITOR)
-#endif
-#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE))
- | BIT(NL80211_IFTYPE_P2P_CLIENT)
- | BIT(NL80211_IFTYPE_P2P_GO)
-#endif
- ;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
-#ifdef CONFIG_AP_MODE
- wiphy->mgmt_stypes = rtw_cfg80211_default_mgmt_stypes;
-#endif //CONFIG_AP_MODE
-#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
- wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
-#endif
-
- /*
- wiphy->iface_combinations = &rtw_combinations;
- wiphy->n_iface_combinations = 1;
- */
-
- wiphy->cipher_suites = rtw_cipher_suites;
- wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites);
-
- /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */
- wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ);
- /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */
- wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ);
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
- wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS;
-#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
- wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME;
-#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))
- wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
- //wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
-#endif /* CONFIG_TDLS */
-
- if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE)
- wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
- else
- wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
- //wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
-#endif
-}
-
-static struct cfg80211_ops rtw_cfg80211_ops = {
- .change_virtual_intf = cfg80211_rtw_change_iface,
- .add_key = cfg80211_rtw_add_key,
- .get_key = cfg80211_rtw_get_key,
- .del_key = cfg80211_rtw_del_key,
- .set_default_key = cfg80211_rtw_set_default_key,
- .get_station = cfg80211_rtw_get_station,
- .scan = cfg80211_rtw_scan,
- .set_wiphy_params = cfg80211_rtw_set_wiphy_params,
- .connect = cfg80211_rtw_connect,
- .disconnect = cfg80211_rtw_disconnect,
- .join_ibss = cfg80211_rtw_join_ibss,
- .leave_ibss = cfg80211_rtw_leave_ibss,
- .set_tx_power = cfg80211_rtw_set_txpower,
- .get_tx_power = cfg80211_rtw_get_txpower,
- .set_power_mgmt = cfg80211_rtw_set_power_mgmt,
- .set_pmksa = cfg80211_rtw_set_pmksa,
- .del_pmksa = cfg80211_rtw_del_pmksa,
- .flush_pmksa = cfg80211_rtw_flush_pmksa,
-
-#ifdef CONFIG_AP_MODE
- .add_virtual_intf = cfg80211_rtw_add_virtual_intf,
- .del_virtual_intf = cfg80211_rtw_del_virtual_intf,
-
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE)
- .add_beacon = cfg80211_rtw_add_beacon,
- .set_beacon = cfg80211_rtw_set_beacon,
- .del_beacon = cfg80211_rtw_del_beacon,
- #else
- .start_ap = cfg80211_rtw_start_ap,
- .change_beacon = cfg80211_rtw_change_beacon,
- .stop_ap = cfg80211_rtw_stop_ap,
- #endif
-
- .add_station = cfg80211_rtw_add_station,
- .del_station = cfg80211_rtw_del_station,
- .change_station = cfg80211_rtw_change_station,
- .dump_station = cfg80211_rtw_dump_station,
- .change_bss = cfg80211_rtw_change_bss,
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
- .set_channel = cfg80211_rtw_set_channel,
- #endif
- //.auth = cfg80211_rtw_auth,
- //.assoc = cfg80211_rtw_assoc,
-#endif //CONFIG_AP_MODE
-
-#ifdef CONFIG_P2P
- .remain_on_channel = cfg80211_rtw_remain_on_channel,
- .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel,
-#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
- .mgmt_tx = cfg80211_rtw_mgmt_tx,
- .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
-#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35))
- .action = cfg80211_rtw_mgmt_tx,
-#endif
-
-#if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
- .tdls_mgmt = cfg80211_rtw_tdls_mgmt,
- .tdls_oper = cfg80211_rtw_tdls_oper,
-#endif /* CONFIG_TDLS */
-};
-
-int rtw_wdev_alloc(_adapter *padapter, struct device *dev)
-{
- int ret = 0;
- struct wiphy *wiphy;
- struct wireless_dev *wdev;
- struct rtw_wdev_priv *pwdev_priv;
- struct net_device *pnetdev = padapter->pnetdev;
-
- DBG_8192C("%s(padapter=%p)\n", __func__, padapter);
-
- /* wiphy */
- wiphy = wiphy_new(&rtw_cfg80211_ops, sizeof(_adapter*));
- if (!wiphy) {
- DBG_8192C("Couldn't allocate wiphy device\n");
- ret = -ENOMEM;
- goto exit;
- }
- set_wiphy_dev(wiphy, dev);
- *((_adapter**)wiphy_priv(wiphy)) = padapter;
- rtw_cfg80211_preinit_wiphy(padapter, wiphy);
-
- ret = wiphy_register(wiphy);
- if (ret < 0) {
- DBG_8192C("Couldn't register wiphy device\n");
- goto free_wiphy;
- }
-
- /* wdev */
- wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev));
- if (!wdev) {
- DBG_8192C("Couldn't allocate wireless device\n");
- ret = -ENOMEM;
- goto unregister_wiphy;
- }
- wdev->wiphy = wiphy;
- wdev->netdev = pnetdev;
-
- wdev->iftype = NL80211_IFTYPE_STATION; // will be init in rtw_hal_init()
- // Must sync with _rtw_init_mlme_priv()
- // pmlmepriv->fw_state = WIFI_STATION_STATE
- //wdev->iftype = NL80211_IFTYPE_MONITOR; // for rtw_setopmode_cmd() in cfg80211_rtw_change_iface()
- padapter->rtw_wdev = wdev;
- pnetdev->ieee80211_ptr = wdev;
-
- //init pwdev_priv
- pwdev_priv = adapter_wdev_data(padapter);
- pwdev_priv->rtw_wdev = wdev;
- pwdev_priv->pmon_ndev = NULL;
- pwdev_priv->ifname_mon[0] = '\0';
- pwdev_priv->padapter = padapter;
- pwdev_priv->scan_request = NULL;
- _rtw_spinlock_init(&pwdev_priv->scan_req_lock);
-
- pwdev_priv->p2p_enabled = _FALSE;
- pwdev_priv->provdisc_req_issued = _FALSE;
- rtw_wdev_invit_info_init(&pwdev_priv->invit_info);
- rtw_wdev_nego_info_init(&pwdev_priv->nego_info);
-
- pwdev_priv->bandroid_scan = _FALSE;
-
- if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE)
- pwdev_priv->power_mgmt = _TRUE;
- else
- pwdev_priv->power_mgmt = _FALSE;
-
-#ifdef CONFIG_CONCURRENT_MODE
- ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
- ATOMIC_SET(&pwdev_priv->ro_ch_to, 1);
-#endif
-
- return ret;
-
- rtw_mfree((u8*)wdev, sizeof(struct wireless_dev));
-unregister_wiphy:
- wiphy_unregister(wiphy);
- free_wiphy:
- wiphy_free(wiphy);
-exit:
- return ret;
-
-}
-
-void rtw_wdev_free(struct wireless_dev *wdev)
-{
- DBG_8192C("%s(wdev=%p)\n", __func__, wdev);
-
- if (!wdev)
- return;
-
- rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]);
- rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]);
-
- wiphy_free(wdev->wiphy);
-
- rtw_mfree((u8*)wdev, sizeof(struct wireless_dev));
-}
-
-void rtw_wdev_unregister(struct wireless_dev *wdev)
-{
- struct net_device *ndev;
- _adapter *adapter;
- struct rtw_wdev_priv *pwdev_priv;
-
- DBG_8192C("%s(wdev=%p)\n", __func__, wdev);
-
- if (!wdev)
- return;
-
- if(!(ndev = wdev_to_ndev(wdev)))
- return;
-
- adapter = (_adapter *)rtw_netdev_priv(ndev);
- pwdev_priv = adapter_wdev_data(adapter);
-
- rtw_cfg80211_indicate_scan_done(adapter, _TRUE);
-
- if (pwdev_priv->pmon_ndev) {
- DBG_8192C("%s, unregister monitor interface\n", __func__);
- unregister_netdev(pwdev_priv->pmon_ndev);
- }
-
- wiphy_unregister(wdev->wiphy);
-}
-
-#endif //CONFIG_IOCTL_CFG80211
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _IOCTL_CFG80211_C_
+
+#include <drv_types.h>
+
+#ifdef CONFIG_IOCTL_CFG80211
+
+#include <rtw_wifi_regd.h>
+
+#define RTW_MAX_MGMT_TX_CNT (8)
+#define RTW_MAX_MGMT_TX_MS_GAS (500)
+
+#define RTW_SCAN_IE_LEN_MAX 2304
+#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 */
+
+#ifdef CONFIG_WAPI_SUPPORT
+
+#ifndef WLAN_CIPHER_SUITE_SMS4
+#define WLAN_CIPHER_SUITE_SMS4 0x00147201
+#endif
+
+#ifndef WLAN_AKM_SUITE_WAPI_PSK
+#define WLAN_AKM_SUITE_WAPI_PSK 0x000FAC04
+#endif
+
+#ifndef WLAN_AKM_SUITE_WAPI_CERT
+#define WLAN_AKM_SUITE_WAPI_CERT 0x000FAC12
+#endif
+
+#ifndef NL80211_WAPI_VERSION_1
+#define NL80211_WAPI_VERSION_1 (1 << 2)
+#endif
+
+#endif
+
+static const u32 rtw_cipher_suites[] = {
+ WLAN_CIPHER_SUITE_WEP40,
+ WLAN_CIPHER_SUITE_WEP104,
+ WLAN_CIPHER_SUITE_TKIP,
+ WLAN_CIPHER_SUITE_CCMP,
+#ifdef CONFIG_WAPI_SUPPORT
+ WLAN_CIPHER_SUITE_SMS4,
+#endif // CONFIG_WAPI_SUPPORT
+#ifdef CONFIG_IEEE80211W
+ WLAN_CIPHER_SUITE_AES_CMAC,
+#endif //CONFIG_IEEE80211W
+};
+
+#define RATETAB_ENT(_rate, _rateid, _flags) \
+ { \
+ .bitrate = (_rate), \
+ .hw_value = (_rateid), \
+ .flags = (_flags), \
+ }
+
+#define CHAN2G(_channel, _freq, _flags) { \
+ .band = IEEE80211_BAND_2GHZ, \
+ .center_freq = (_freq), \
+ .hw_value = (_channel), \
+ .flags = (_flags), \
+ .max_antenna_gain = 0, \
+ .max_power = 30, \
+}
+
+#define CHAN5G(_channel, _flags) { \
+ .band = IEEE80211_BAND_5GHZ, \
+ .center_freq = 5000 + (5 * (_channel)), \
+ .hw_value = (_channel), \
+ .flags = (_flags), \
+ .max_antenna_gain = 0, \
+ .max_power = 30, \
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
+/* if wowlan is not supported, kernel generate a disconnect at each suspend
+ * cf: /net/wireless/sysfs.c, so register a stub wowlan.
+ * Moreover wowlan has to be enabled via a the nl80211_set_wowlan callback.
+ * (from user space, e.g. iw phy0 wowlan enable)
+ */
+static const struct wiphy_wowlan_support wowlan_stub = {
+ .flags = WIPHY_WOWLAN_ANY,
+ .n_patterns = 0,
+ .pattern_max_len = 0,
+ .pattern_min_len = 0,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0))
+ .max_pkt_offset = 0,
+#endif
+};
+#endif
+
+static struct ieee80211_rate rtw_rates[] = {
+ RATETAB_ENT(10, 0x1, 0),
+ RATETAB_ENT(20, 0x2, 0),
+ RATETAB_ENT(55, 0x4, 0),
+ RATETAB_ENT(110, 0x8, 0),
+ RATETAB_ENT(60, 0x10, 0),
+ RATETAB_ENT(90, 0x20, 0),
+ RATETAB_ENT(120, 0x40, 0),
+ RATETAB_ENT(180, 0x80, 0),
+ RATETAB_ENT(240, 0x100, 0),
+ RATETAB_ENT(360, 0x200, 0),
+ RATETAB_ENT(480, 0x400, 0),
+ RATETAB_ENT(540, 0x800, 0),
+};
+
+#define rtw_a_rates (rtw_rates + 4)
+#define RTW_A_RATES_NUM 8
+#define rtw_g_rates (rtw_rates + 0)
+#define RTW_G_RATES_NUM 12
+
+#define RTW_2G_CHANNELS_NUM 14
+#define RTW_5G_CHANNELS_NUM 37
+
+static struct ieee80211_channel rtw_2ghz_channels[] = {
+ CHAN2G(1, 2412, 0),
+ CHAN2G(2, 2417, 0),
+ CHAN2G(3, 2422, 0),
+ CHAN2G(4, 2427, 0),
+ CHAN2G(5, 2432, 0),
+ CHAN2G(6, 2437, 0),
+ CHAN2G(7, 2442, 0),
+ CHAN2G(8, 2447, 0),
+ CHAN2G(9, 2452, 0),
+ CHAN2G(10, 2457, 0),
+ CHAN2G(11, 2462, 0),
+ CHAN2G(12, 2467, 0),
+ CHAN2G(13, 2472, 0),
+ CHAN2G(14, 2484, 0),
+};
+
+static struct ieee80211_channel rtw_5ghz_a_channels[] = {
+ CHAN5G(34, 0), CHAN5G(36, 0),
+ CHAN5G(38, 0), CHAN5G(40, 0),
+ CHAN5G(42, 0), CHAN5G(44, 0),
+ CHAN5G(46, 0), CHAN5G(48, 0),
+ CHAN5G(52, 0), CHAN5G(56, 0),
+ CHAN5G(60, 0), CHAN5G(64, 0),
+ CHAN5G(100, 0), CHAN5G(104, 0),
+ CHAN5G(108, 0), CHAN5G(112, 0),
+ CHAN5G(116, 0), CHAN5G(120, 0),
+ CHAN5G(124, 0), CHAN5G(128, 0),
+ CHAN5G(132, 0), CHAN5G(136, 0),
+ CHAN5G(140, 0), CHAN5G(149, 0),
+ CHAN5G(153, 0), CHAN5G(157, 0),
+ CHAN5G(161, 0), CHAN5G(165, 0),
+ CHAN5G(184, 0), CHAN5G(188, 0),
+ CHAN5G(192, 0), CHAN5G(196, 0),
+ CHAN5G(200, 0), CHAN5G(204, 0),
+ CHAN5G(208, 0), CHAN5G(212, 0),
+ CHAN5G(216, 0),
+};
+
+
+void rtw_2g_channels_init(struct ieee80211_channel *channels)
+{
+ _rtw_memcpy((void*)channels, (void*)rtw_2ghz_channels,
+ sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM
+ );
+}
+
+void rtw_5g_channels_init(struct ieee80211_channel *channels)
+{
+ _rtw_memcpy((void*)channels, (void*)rtw_5ghz_a_channels,
+ sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM
+ );
+}
+
+void rtw_2g_rates_init(struct ieee80211_rate *rates)
+{
+ _rtw_memcpy(rates, rtw_g_rates,
+ sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM
+ );
+}
+
+void rtw_5g_rates_init(struct ieee80211_rate *rates)
+{
+ _rtw_memcpy(rates, rtw_a_rates,
+ sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM
+ );
+}
+
+struct ieee80211_supported_band *rtw_spt_band_alloc(
+ enum ieee80211_band band
+ )
+{
+ struct ieee80211_supported_band *spt_band = NULL;
+ int n_channels, n_bitrates;
+
+ if(band == IEEE80211_BAND_2GHZ)
+ {
+ n_channels = RTW_2G_CHANNELS_NUM;
+ n_bitrates = RTW_G_RATES_NUM;
+ }
+ else if(band == IEEE80211_BAND_5GHZ)
+ {
+ n_channels = RTW_5G_CHANNELS_NUM;
+ n_bitrates = RTW_A_RATES_NUM;
+ }
+ else
+ {
+ goto exit;
+ }
+
+ spt_band = (struct ieee80211_supported_band *)rtw_zmalloc(
+ sizeof(struct ieee80211_supported_band)
+ + sizeof(struct ieee80211_channel)*n_channels
+ + sizeof(struct ieee80211_rate)*n_bitrates
+ );
+ if(!spt_band)
+ goto exit;
+
+ spt_band->channels = (struct ieee80211_channel*)(((u8*)spt_band)+sizeof(struct ieee80211_supported_band));
+ spt_band->bitrates= (struct ieee80211_rate*)(((u8*)spt_band->channels)+sizeof(struct ieee80211_channel)*n_channels);
+ spt_band->band = band;
+ spt_band->n_channels = n_channels;
+ spt_band->n_bitrates = n_bitrates;
+
+ if(band == IEEE80211_BAND_2GHZ)
+ {
+ rtw_2g_channels_init(spt_band->channels);
+ rtw_2g_rates_init(spt_band->bitrates);
+ }
+ else if(band == IEEE80211_BAND_5GHZ)
+ {
+ rtw_5g_channels_init(spt_band->channels);
+ rtw_5g_rates_init(spt_band->bitrates);
+ }
+
+ //spt_band.ht_cap
+
+exit:
+
+ return spt_band;
+}
+
+void rtw_spt_band_free(struct ieee80211_supported_band *spt_band)
+{
+ u32 size = 0;
+
+ if(!spt_band)
+ return;
+
+ if(spt_band->band == IEEE80211_BAND_2GHZ)
+ {
+ size = sizeof(struct ieee80211_supported_band)
+ + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM
+ + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM;
+ }
+ else if(spt_band->band == IEEE80211_BAND_5GHZ)
+ {
+ size = sizeof(struct ieee80211_supported_band)
+ + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM
+ + sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM;
+ }
+ else
+ {
+
+ }
+ rtw_mfree((u8*)spt_band, size);
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+static const struct ieee80211_txrx_stypes
+rtw_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
+ [NL80211_IFTYPE_ADHOC] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4)
+ },
+ [NL80211_IFTYPE_STATION] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+ },
+ [NL80211_IFTYPE_AP] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+ BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+ BIT(IEEE80211_STYPE_ACTION >> 4)
+ },
+ [NL80211_IFTYPE_AP_VLAN] = {
+ /* copy AP */
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+ BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+ BIT(IEEE80211_STYPE_ACTION >> 4)
+ },
+ [NL80211_IFTYPE_P2P_CLIENT] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+ },
+ [NL80211_IFTYPE_P2P_GO] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+ BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+ BIT(IEEE80211_STYPE_ACTION >> 4)
+ },
+};
+#endif
+
+static int rtw_ieee80211_channel_to_frequency(int chan, int band)
+{
+ /* see 802.11 17.3.8.3.2 and Annex J
+ * there are overlapping channel numbers in 5GHz and 2GHz bands */
+
+ if (band == IEEE80211_BAND_5GHZ) {
+ if (chan >= 182 && chan <= 196)
+ return 4000 + chan * 5;
+ else
+ return 5000 + chan * 5;
+ } else { /* IEEE80211_BAND_2GHZ */
+ if (chan == 14)
+ return 2484;
+ else if (chan < 14)
+ return 2407 + chan * 5;
+ else
+ return 0; /* not supported */
+ }
+}
+
+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)
+{
+ struct ieee80211_channel *notify_channel;
+ struct cfg80211_bss *bss = NULL;
+ //struct ieee80211_supported_band *band;
+ u16 channel;
+ u32 freq;
+ u64 notify_timestamp;
+ u16 notify_capability;
+ u16 notify_interval;
+ u8 *notify_ie;
+ size_t notify_ielen;
+ s32 notify_signal;
+ //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;
+ u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+ struct wireless_dev *wdev = padapter->rtw_wdev;
+ 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 > buf_size){
+ DBG_871X("%s IE Length too long > %zu byte \n",__FUNCTION__,buf_size);
+ goto exit;
+ }
+
+#ifndef CONFIG_WAPI_SUPPORT
+ {
+ u16 wapi_len = 0;
+
+ if(rtw_get_wapi_ie(pnetwork->network.IEs, pnetwork->network.IELength, NULL, &wapi_len)>0)
+ {
+ if(wapi_len > 0)
+ {
+ DBG_871X("%s, no support wapi!\n",__FUNCTION__);
+ goto exit;
+ }
+ }
+ }
+#endif //!CONFIG_WAPI_SUPPORT
+
+ //To reduce PBC Overlap rate
+ //_enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+ if(adapter_wdev_data(padapter)->scan_request != NULL)
+ {
+ u8 *psr=NULL, sr = 0;
+ NDIS_802_11_SSID *pssid = &pnetwork->network.Ssid;
+ struct cfg80211_scan_request *request = adapter_wdev_data(padapter)->scan_request;
+ struct cfg80211_ssid *ssids = request->ssids;
+ u32 wpsielen=0;
+ u8 *wpsie=NULL;
+
+ wpsie = rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen);
+
+ if(wpsie && wpsielen>0)
+ psr = rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL);
+
+ if (sr != 0)
+ {
+ if(request->n_ssids == 1 && request->n_channels == 1) // it means under processing WPS
+ {
+ DBG_8192C("ssid=%s, len=%d\n", pssid->Ssid, pssid->SsidLength);
+
+ if (ssids[0].ssid_len == 0) {
+ }
+ else if(pssid->SsidLength == ssids[0].ssid_len &&
+ _rtw_memcmp(pssid->Ssid, ssids[0].ssid, ssids[0].ssid_len))
+ {
+ DBG_871X("%s, got sr and ssid match!\n", __func__);
+ }
+ else
+ {
+ if(psr !=NULL)
+ *psr = 0; //clear sr
+
+#if 0
+ WLAN_BSSID_EX *pselect_network = &pnetwork->network;
+ struct cfg80211_bss *pselect_bss = NULL;
+ struct ieee80211_channel *notify_channel = NULL;
+ u32 freq;
+
+ DBG_871X("%s, got sr, but ssid mismatch, to remove this bss\n", __func__);
+
+ if (pselect_network->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_5GHZ);
+
+ notify_channel = ieee80211_get_channel(wiphy, freq);
+ pselect_bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/,
+ pselect_network->MacAddress, pselect_network->Ssid.Ssid,
+ pselect_network->Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/,
+ 0/*WLAN_CAPABILITY_ESS*/);
+
+ if(pselect_bss)
+ {
+ DBG_871X("%s, got bss for cfg80211 for unlinking bss\n", __func__);
+
+ cfg80211_unlink_bss(wiphy, pselect_bss);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ cfg80211_put_bss(wiphy, pselect_bss);
+#else
+ cfg80211_put_bss(pselect_bss);
+#endif
+
+ }
+
+ goto exit;
+#endif
+ }
+ }
+ }
+ }
+ //_exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+
+
+ channel = pnetwork->network.Configuration.DSConfig;
+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+
+ notify_channel = ieee80211_get_channel(wiphy, freq);
+
+ 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_;
+
+ //We've set wiphy's signal_type as CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
+ if ( check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE &&
+ is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0)) {
+ notify_signal = 100*translate_percentage_to_dbm(padapter->recvpriv.signal_strength);//dbm
+ } else {
+ notify_signal = 100*translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);//dbm
+ }
+
+ #if 0
+ DBG_8192C("bssid: "MAC_FMT"\n", MAC_ARG(pnetwork->network.MacAddress));
+ DBG_8192C("Channel: %d(%d)\n", channel, freq);
+ 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: %llu\n", notify_timestamp);
+ #endif
+
+ //pbuf = buf;
+
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf;
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+
+ SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
+ //pmlmeext->mgnt_seq++;
+
+ if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON
+ _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
+ SetFrameSubType(pbuf, WIFI_BEACON);
+ } else {
+ _rtw_memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ SetFrameSubType(pbuf, WIFI_PROBERSP);
+ }
+
+ _rtw_memcpy(pwlanhdr->addr2, pnetwork->network.MacAddress, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, pnetwork->network.MacAddress, ETH_ALEN);
+
+
+ //pbuf += sizeof(struct rtw_ieee80211_hdr_3addr);
+ len = sizeof (struct rtw_ieee80211_hdr_3addr);
+ _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))
+ //{
+ // DBG_8192C("%s, got p2p_ie\n", __func__);
+ //}
+ //#endif
+
+#if 1
+ bss = cfg80211_inform_bss_frame(wiphy, notify_channel, (struct ieee80211_mgmt *)pbuf,
+ len, notify_signal, GFP_ATOMIC);
+#else
+
+ bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)pnetwork->network.MacAddress,
+ notify_timestamp, notify_capability, notify_interval, notify_ie,
+ notify_ielen, notify_signal, GFP_ATOMIC/*GFP_KERNEL*/);
+#endif
+
+ if (unlikely(!bss)) {
+ DBG_8192C(FUNC_ADPT_FMT" bss NULL\n", FUNC_ADPT_ARG(padapter));
+ goto exit;
+ }
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
+#ifndef COMPAT_KERNEL_RELEASE
+ //patch for cfg80211, update beacon ies to information_elements
+ if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON
+
+ if(bss->len_information_elements != bss->len_beacon_ies)
+ {
+ bss->information_elements = bss->beacon_ies;
+ bss->len_information_elements = bss->len_beacon_ies;
+ }
+ }
+#endif //COMPAT_KERNEL_RELEASE
+#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
+
+/*
+ {
+ if( bss->information_elements == bss->proberesp_ies)
+ {
+ if( bss->len_information_elements != bss->len_proberesp_ies)
+ {
+ DBG_8192C("error!, len_information_elements != bss->len_proberesp_ies\n");
+ }
+
+ }
+ else if(bss->len_information_elements < bss->len_beacon_ies)
+ {
+ bss->information_elements = bss->beacon_ies;
+ bss->len_information_elements = bss->len_beacon_ies;
+ }
+ }
+*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ cfg80211_put_bss(wiphy, bss);
+#else
+ cfg80211_put_bss(bss);
+#endif
+
+exit:
+
+ if(pbuf)
+ rtw_mfree(pbuf, buf_size);
+
+ return bss;
+}
+
+/*
+ Check the given bss is valid by kernel API cfg80211_get_bss()
+ @padapter : the given adapter
+
+ return _TRUE if bss is valid, _FALSE for not found.
+*/
+int rtw_cfg80211_check_bss(_adapter *padapter)
+{
+ WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
+ struct cfg80211_bss *bss = NULL;
+ struct ieee80211_channel *notify_channel = NULL;
+ u32 freq;
+
+ if (!(pnetwork) || !(padapter->rtw_wdev))
+ return _FALSE;
+
+ if (pnetwork->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_5GHZ);
+
+ notify_channel = ieee80211_get_channel(padapter->rtw_wdev->wiphy, freq);
+ bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel,
+ 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
+ cfg80211_put_bss(bss);
+#endif
+
+ return (bss!=NULL);
+}
+
+void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter)
+{
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ 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 = 2412;
+ struct ieee80211_channel *notify_channel;
+#endif
+
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
+ if (cur_network->network.Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(cur_network->network.Configuration.DSConfig, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(cur_network->network.Configuration.DSConfig, IEEE80211_BAND_5GHZ);
+
+ if (0)
+ DBG_871X("chan: %d, freq: %d\n", cur_network->network.Configuration.DSConfig, freq);
+#endif
+
+ if (pwdev->iftype != NL80211_IFTYPE_ADHOC)
+ {
+ return;
+ }
+
+ if (!rtw_cfg80211_check_bss(padapter)) {
+ WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
+ struct wlan_network *scanned = pmlmepriv->cur_network_scanned;
+
+ if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE)
+ {
+
+ _rtw_memcpy(&cur_network->network, pnetwork, sizeof(WLAN_BSSID_EX));
+ if(cur_network)
+ {
+ if (!rtw_cfg80211_inform_bss(padapter,cur_network))
+ DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter));
+ else
+ DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter));
+ }
+ else
+ {
+ DBG_871X("cur_network is not exist!!!\n");
+ return ;
+ }
+ }
+ else
+ {
+ if(scanned == NULL)
+ rtw_warn_on(1);
+
+ if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE
+ && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE
+ ) {
+ if (!rtw_cfg80211_inform_bss(padapter,scanned)) {
+ DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter));
+ } else {
+ //DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter));
+ }
+ } else {
+ DBG_871X("scanned & pnetwork compare fail\n");
+ rtw_warn_on(1);
+ }
+ }
+
+ if (!rtw_cfg80211_check_bss(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))
+ notify_channel = ieee80211_get_channel(wiphy, freq);
+ cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC);
+#else
+ cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, GFP_ATOMIC);
+#endif
+}
+
+void rtw_cfg80211_indicate_connect(_adapter *padapter)
+{
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct wlan_network *cur_network = &(pmlmepriv->cur_network);
+ struct wireless_dev *pwdev = padapter->rtw_wdev;
+#ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
+#endif
+ struct cfg80211_bss *bss = NULL;
+
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+ if (pwdev->iftype != NL80211_IFTYPE_STATION
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT
+ #endif
+ ) {
+ return;
+ }
+
+ if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
+ return;
+
+#ifdef CONFIG_P2P
+ if(pwdinfo->driver_interface == DRIVER_CFG80211 )
+ {
+ if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo));
+ rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT);
+ rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK);
+ DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo));
+ }
+ }
+#endif //CONFIG_P2P
+
+ {
+ WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
+ struct wlan_network *scanned = pmlmepriv->cur_network_scanned;
+
+ //DBG_871X(FUNC_ADPT_FMT" BSS not found\n", FUNC_ADPT_ARG(padapter));
+
+ if(scanned == NULL) {
+ rtw_warn_on(1);
+ goto check_bss;
+ }
+
+ if (_rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE
+ && _rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE
+ ) {
+ if (!rtw_cfg80211_inform_bss(padapter,scanned)) {
+ DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter));
+ } else {
+ //DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter));
+ }
+ } else {
+ DBG_871X("scanned: %s("MAC_FMT"), cur: %s("MAC_FMT")\n",
+ scanned->network.Ssid.Ssid, MAC_ARG(scanned->network.MacAddress),
+ pnetwork->Ssid.Ssid, MAC_ARG(pnetwork->MacAddress)
+ );
+ rtw_warn_on(1);
+ }
+ }
+
+check_bss:
+ if (!rtw_cfg80211_check_bss(padapter))
+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter));
+
+ if (rtw_to_roam(padapter) > 0) {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
+ struct wiphy *wiphy = pwdev->wiphy;
+ struct ieee80211_channel *notify_channel;
+ u32 freq;
+ u16 channel = cur_network->network.Configuration.DSConfig;
+
+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+
+ notify_channel = ieee80211_get_channel(wiphy, freq);
+ #endif
+
+ DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter));
+ cfg80211_roamed(padapter->pnetdev
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
+ , notify_channel
+ #endif
+ , 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
+ , GFP_ATOMIC);
+ }
+ 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
+ }
+}
+
+void rtw_cfg80211_indicate_disconnect(_adapter *padapter)
+{
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct wireless_dev *pwdev = padapter->rtw_wdev;
+#ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
+#endif
+
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+
+ if (pwdev->iftype != NL80211_IFTYPE_STATION
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT
+ #endif
+ ) {
+ return;
+ }
+
+ if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
+ return;
+
+#ifdef CONFIG_P2P
+ if( pwdinfo->driver_interface == DRIVER_CFG80211 )
+ {
+ if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
+ rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE);
+
+ DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo));
+ }
+ }
+#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)
+ cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0,
+ WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/);
+ else if(pwdev->sme_state==CFG80211_SME_CONNECTED)
+ cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC);
+ //else
+ //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
+ }
+}
+
+
+#ifdef CONFIG_AP_MODE
+static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
+{
+ int ret = 0;
+ u32 wep_key_idx, wep_key_len,wep_total_len;
+ struct sta_info *psta = NULL, *pbcmc_sta = NULL;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct security_priv* psecuritypriv=&(padapter->securitypriv);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+
+ DBG_8192C("%s\n", __FUNCTION__);
+
+ param->u.crypt.err = 0;
+ param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
+
+ //sizeof(struct ieee_param) = 64 bytes;
+ //if (param_len != (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len)
+ if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len)
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
+ param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
+ param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff)
+ {
+ if (param->u.crypt.idx >= WEP_KEYS)
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+ }
+ else
+ {
+ psta = rtw_get_stainfo(pstapriv, param->sta_addr);
+ if(!psta)
+ {
+ //ret = -EINVAL;
+ DBG_8192C("rtw_set_encryption(), sta has already been removed or never been added\n");
+ goto exit;
+ }
+ }
+
+ if (strcmp(param->u.crypt.alg, "none") == 0 && (psta==NULL))
+ {
+ //todo:clear default encryption keys
+
+ DBG_8192C("clear default encryption keys, keyid=%d\n", param->u.crypt.idx);
+
+ goto exit;
+ }
+
+
+ if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta==NULL))
+ {
+ DBG_8192C("r871x_set_encryption, crypt.alg = WEP\n");
+
+ wep_key_idx = param->u.crypt.idx;
+ wep_key_len = param->u.crypt.key_len;
+
+ DBG_8192C("r871x_set_encryption, wep_key_idx=%d, len=%d\n", wep_key_idx, wep_key_len);
+
+ if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0))
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ if (wep_key_len > 0)
+ {
+ wep_key_len = wep_key_len <= 5 ? 5 : 13;
+ }
+
+ if (psecuritypriv->bWepDefaultKeyIdxSet == 0)
+ {
+ //wep default key has not been set, so use this key index as default key.
+
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto;
+ psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
+ psecuritypriv->dot11PrivacyAlgrthm=_WEP40_;
+ psecuritypriv->dot118021XGrpPrivacy=_WEP40_;
+
+ if(wep_key_len == 13)
+ {
+ psecuritypriv->dot11PrivacyAlgrthm=_WEP104_;
+ psecuritypriv->dot118021XGrpPrivacy=_WEP104_;
+ }
+
+ psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;
+ }
+
+ _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len);
+
+ psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len;
+
+ rtw_ap_set_wep_key(padapter, param->u.crypt.key, wep_key_len, wep_key_idx, 1);
+
+ goto exit;
+
+ }
+
+
+ if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) // //group key
+ {
+ if(param->u.crypt.set_tx == 0) //group key
+ {
+ if(strcmp(param->u.crypt.alg, "WEP") == 0)
+ {
+ DBG_8192C("%s, set group_key, WEP\n", __FUNCTION__);
+
+ _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+
+ psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
+ if(param->u.crypt.key_len==13)
+ {
+ psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
+ }
+
+ }
+ else if(strcmp(param->u.crypt.alg, "TKIP") == 0)
+ {
+ DBG_8192C("%s, set group_key, TKIP\n", __FUNCTION__);
+
+ psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
+
+ _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+
+ //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len);
+ //set mic key
+ _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8);
+ _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8);
+
+ psecuritypriv->busetkipkey = _TRUE;
+
+ }
+ else if(strcmp(param->u.crypt.alg, "CCMP") == 0)
+ {
+ DBG_8192C("%s, set group_key, CCMP\n", __FUNCTION__);
+
+ psecuritypriv->dot118021XGrpPrivacy = _AES_;
+
+ _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+ }
+ else
+ {
+ DBG_8192C("%s, set group_key, none\n", __FUNCTION__);
+
+ psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
+ }
+
+ psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx;
+
+ psecuritypriv->binstallGrpkey = _TRUE;
+
+ psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!!
+
+ rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
+
+ pbcmc_sta=rtw_get_bcmc_stainfo(padapter);
+ if(pbcmc_sta)
+ {
+ pbcmc_sta->ieee8021x_blocked = _FALSE;
+ pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy
+ }
+
+ }
+
+ goto exit;
+
+ }
+
+ if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) // psk/802_1x
+ {
+ if(check_fwstate(pmlmepriv, WIFI_AP_STATE))
+ {
+ if(param->u.crypt.set_tx ==1) //pairwise key
+ {
+ _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+
+ if(strcmp(param->u.crypt.alg, "WEP") == 0)
+ {
+ DBG_8192C("%s, set pairwise key, WEP\n", __FUNCTION__);
+
+ psta->dot118021XPrivacy = _WEP40_;
+ if(param->u.crypt.key_len==13)
+ {
+ psta->dot118021XPrivacy = _WEP104_;
+ }
+ }
+ else if(strcmp(param->u.crypt.alg, "TKIP") == 0)
+ {
+ DBG_8192C("%s, set pairwise key, TKIP\n", __FUNCTION__);
+
+ psta->dot118021XPrivacy = _TKIP_;
+
+ //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len);
+ //set mic key
+ _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8);
+ _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8);
+
+ psecuritypriv->busetkipkey = _TRUE;
+
+ }
+ else if(strcmp(param->u.crypt.alg, "CCMP") == 0)
+ {
+
+ DBG_8192C("%s, set pairwise key, CCMP\n", __FUNCTION__);
+
+ psta->dot118021XPrivacy = _AES_;
+ }
+ else
+ {
+ DBG_8192C("%s, set pairwise key, none\n", __FUNCTION__);
+
+ psta->dot118021XPrivacy = _NO_PRIVACY_;
+ }
+
+ rtw_ap_set_pairwise_key(padapter, psta);
+
+ psta->ieee8021x_blocked = _FALSE;
+
+ psta->bpairwise_key_installed = _TRUE;
+
+ }
+ else//group key???
+ {
+ if(strcmp(param->u.crypt.alg, "WEP") == 0)
+ {
+ _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+
+ psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
+ if(param->u.crypt.key_len==13)
+ {
+ psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
+ }
+ }
+ else if(strcmp(param->u.crypt.alg, "TKIP") == 0)
+ {
+ psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
+
+ _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+
+ //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len);
+ //set mic key
+ _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8);
+ _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8);
+
+ psecuritypriv->busetkipkey = _TRUE;
+
+ }
+ else if(strcmp(param->u.crypt.alg, "CCMP") == 0)
+ {
+ psecuritypriv->dot118021XGrpPrivacy = _AES_;
+
+ _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+ }
+ else
+ {
+ psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
+ }
+
+ psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx;
+
+ psecuritypriv->binstallGrpkey = _TRUE;
+
+ psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!!
+
+ rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
+
+ pbcmc_sta=rtw_get_bcmc_stainfo(padapter);
+ if(pbcmc_sta)
+ {
+ pbcmc_sta->ieee8021x_blocked = _FALSE;
+ pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy
+ }
+
+ }
+
+ }
+
+ }
+
+exit:
+
+ return ret;
+
+}
+#endif
+
+static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
+{
+ int ret = 0;
+ u32 wep_key_idx, wep_key_len,wep_total_len;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+#ifdef CONFIG_P2P
+ struct wifidirect_info* pwdinfo = &padapter->wdinfo;
+#endif //CONFIG_P2P
+
+_func_enter_;
+
+ DBG_8192C("%s\n", __func__);
+
+ param->u.crypt.err = 0;
+ param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
+
+ if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len)
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
+ param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
+ param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff)
+ {
+ if (param->u.crypt.idx >= WEP_KEYS
+#ifdef CONFIG_IEEE80211W
+ && param->u.crypt.idx > BIP_MAX_KEYID
+#endif //CONFIG_IEEE80211W
+ )
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+ } else {
+#ifdef CONFIG_WAPI_SUPPORT
+ if (strcmp(param->u.crypt.alg, "SMS4"))
+#endif
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+ }
+
+ if (strcmp(param->u.crypt.alg, "WEP") == 0)
+ {
+ RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("wpa_set_encryption, crypt.alg = WEP\n"));
+ DBG_8192C("wpa_set_encryption, crypt.alg = WEP\n");
+
+ wep_key_idx = param->u.crypt.idx;
+ wep_key_len = param->u.crypt.key_len;
+
+ if ((wep_key_idx > WEP_KEYS) || (wep_key_len <= 0))
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ if (psecuritypriv->bWepDefaultKeyIdxSet == 0)
+ {
+ //wep default key has not been set, so use this key index as default key.
+
+ wep_key_len = wep_key_len <= 5 ? 5 : 13;
+
+ psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
+ psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
+ psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
+
+ if(wep_key_len==13)
+ {
+ psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
+ psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
+ }
+
+ psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;
+ }
+
+ _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len);
+
+ psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len;
+
+ rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0, _TRUE);
+
+ goto exit;
+ }
+
+ if(padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) // 802_1x
+ {
+ struct sta_info * psta,*pbcmc_sta;
+ struct sta_priv * pstapriv = &padapter->stapriv;
+
+ //DBG_8192C("%s, : dot11AuthAlgrthm == dot11AuthAlgrthm_8021X \n", __func__);
+
+ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == _TRUE) //sta mode
+ {
+ psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
+ if (psta == NULL) {
+ //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n"));
+ DBG_8192C("%s, : Obtain Sta_info fail \n", __func__);
+ }
+ else
+ {
+ //Jeff: don't disable ieee8021x_blocked while clearing key
+ if (strcmp(param->u.crypt.alg, "none") != 0)
+ psta->ieee8021x_blocked = _FALSE;
+
+
+ if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)||
+ (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled))
+ {
+ psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
+ }
+
+ if(param->u.crypt.set_tx ==1)//pairwise key
+ {
+
+ DBG_8192C("%s, : param->u.crypt.set_tx ==1 \n", __func__);
+
+ _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+
+ if(strcmp(param->u.crypt.alg, "TKIP") == 0)//set mic key
+ {
+ //DEBUG_ERR(("\nset key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len));
+ _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8);
+ _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8);
+
+ padapter->securitypriv.busetkipkey=_FALSE;
+ //_set_timer(&padapter->securitypriv.tkip_timer, 50);
+ }
+
+ //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, psta, _TRUE, _TRUE);
+ }
+ else//group key
+ {
+ if(strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0)
+ {
+ _rtw_memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+ _rtw_memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[16]),8);
+ _rtw_memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[24]),8);
+ padapter->securitypriv.binstallGrpkey = _TRUE;
+ //DEBUG_ERR((" param->u.crypt.key_len=%d\n", param->u.crypt.key_len));
+ DBG_871X(" ~~~~set sta key:groupkey\n");
+
+ padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx;
+ rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1, _TRUE);
+ }
+#ifdef CONFIG_IEEE80211W
+ else if(strcmp(param->u.crypt.alg, "BIP") == 0)
+ {
+ int no;
+ //DBG_871X("BIP key_len=%d , index=%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.key_len, param->u.crypt.idx);
+ //save the IGTK key, length 16 bytes
+ _rtw_memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
+ /*DBG_871X("IGTK key below:\n");
+ for(no=0;no<16;no++)
+ printk(" %02x ", padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey[no]);
+ DBG_871X("\n");*/
+ padapter->securitypriv.dot11wBIPKeyid = param->u.crypt.idx;
+ padapter->securitypriv.binstallBIPkey = _TRUE;
+ DBG_871X(" ~~~~set sta key:IGKT\n");
+ }
+#endif //CONFIG_IEEE80211W
+
+#ifdef CONFIG_P2P
+ if(pwdinfo->driver_interface == DRIVER_CFG80211 )
+ {
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING))
+ {
+ rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_DONE);
+ }
+ }
+#endif //CONFIG_P2P
+
+ }
+ }
+
+ pbcmc_sta=rtw_get_bcmc_stainfo(padapter);
+ if(pbcmc_sta==NULL)
+ {
+ //DEBUG_ERR( ("Set OID_802_11_ADD_KEY: bcmc stainfo is null \n"));
+ }
+ else
+ {
+ //Jeff: don't disable ieee8021x_blocked while clearing key
+ if (strcmp(param->u.crypt.alg, "none") != 0)
+ pbcmc_sta->ieee8021x_blocked = _FALSE;
+
+ if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)||
+ (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled))
+ {
+ pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
+ }
+ }
+ }
+ else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) //adhoc mode
+ {
+ }
+ }
+
+#ifdef CONFIG_WAPI_SUPPORT
+ if (strcmp(param->u.crypt.alg, "SMS4") == 0)
+ {
+ PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
+ PRT_WAPI_STA_INFO pWapiSta;
+ u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+ u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+ u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
+
+ if(param->u.crypt.set_tx == 1)
+ {
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
+ if(_rtw_memcmp(pWapiSta->PeerMacAddr,param->sta_addr,6))
+ {
+ _rtw_memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
+
+ pWapiSta->wapiUsk.bSet = true;
+ _rtw_memcpy(pWapiSta->wapiUsk.dataKey,param->u.crypt.key,16);
+ _rtw_memcpy(pWapiSta->wapiUsk.micKey,param->u.crypt.key+16,16);
+ pWapiSta->wapiUsk.keyId = param->u.crypt.idx ;
+ pWapiSta->wapiUsk.bTxEnable = true;
+
+ _rtw_memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiAEPNInitialValueSrc,16);
+ _rtw_memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiAEPNInitialValueSrc,16);
+ _rtw_memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiAEPNInitialValueSrc,16);
+ _rtw_memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiAEPNInitialValueSrc,16);
+ _rtw_memcpy(pWapiSta->lastRxUnicastPN,WapiAEPNInitialValueSrc,16);
+ pWapiSta->wapiUskUpdate.bTxEnable = false;
+ pWapiSta->wapiUskUpdate.bSet = false;
+
+ if (psecuritypriv->sw_encrypt== false || psecuritypriv->sw_decrypt == false)
+ {
+ //set unicast key for ASUE
+ rtw_wapi_set_key(padapter, &pWapiSta->wapiUsk, pWapiSta, false, false);
+ }
+ }
+ }
+ }
+ else
+ {
+ list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
+ if(_rtw_memcmp(pWapiSta->PeerMacAddr,get_bssid(pmlmepriv),6))
+ {
+ pWapiSta->wapiMsk.bSet = true;
+ _rtw_memcpy(pWapiSta->wapiMsk.dataKey,param->u.crypt.key,16);
+ _rtw_memcpy(pWapiSta->wapiMsk.micKey,param->u.crypt.key+16,16);
+ pWapiSta->wapiMsk.keyId = param->u.crypt.idx ;
+ pWapiSta->wapiMsk.bTxEnable = false;
+ if(!pWapiSta->bSetkeyOk)
+ pWapiSta->bSetkeyOk = true;
+ pWapiSta->bAuthenticateInProgress = false;
+
+ _rtw_memcpy(pWapiSta->lastRxMulticastPN, WapiAEMultiCastPNInitialValueSrc, 16);
+
+ if (psecuritypriv->sw_decrypt == false)
+ {
+ //set rx broadcast key for ASUE
+ rtw_wapi_set_key(padapter, &pWapiSta->wapiMsk, pWapiSta, true, false);
+ }
+ }
+
+ }
+ }
+ }
+#endif
+
+
+exit:
+
+ DBG_8192C("%s, ret=%d\n", __func__, ret);
+
+ _func_exit_;
+
+ return ret;
+}
+
+static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ u8 key_index, bool pairwise, const u8 *mac_addr,
+#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ u8 key_index, const u8 *mac_addr,
+#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ struct key_params *params)
+{
+ char *alg_name;
+ u32 param_len;
+ struct ieee_param *param = NULL;
+ int ret=0;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct wireless_dev *rtw_wdev = padapter->rtw_wdev;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+
+ DBG_871X(FUNC_NDEV_FMT" adding key for %pM\n", FUNC_NDEV_ARG(ndev), mac_addr);
+ DBG_871X("cipher=0x%x\n", params->cipher);
+ DBG_871X("key_len=0x%x\n", params->key_len);
+ DBG_871X("seq_len=0x%x\n", params->seq_len);
+ DBG_871X("key_index=%d\n", key_index);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ DBG_871X("pairwise=%d\n", pairwise);
+#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+
+ param_len = sizeof(struct ieee_param) + params->key_len;
+ param = (struct ieee_param *)rtw_malloc(param_len);
+ if (param == NULL)
+ return -1;
+
+ _rtw_memset(param, 0, param_len);
+
+ param->cmd = IEEE_CMD_SET_ENCRYPTION;
+ _rtw_memset(param->sta_addr, 0xff, ETH_ALEN);
+
+ switch (params->cipher) {
+ case IW_AUTH_CIPHER_NONE:
+ //todo: remove key
+ //remove = 1;
+ alg_name = "none";
+ break;
+ case WLAN_CIPHER_SUITE_WEP40:
+ case WLAN_CIPHER_SUITE_WEP104:
+ alg_name = "WEP";
+ break;
+ case WLAN_CIPHER_SUITE_TKIP:
+ alg_name = "TKIP";
+ break;
+ case WLAN_CIPHER_SUITE_CCMP:
+ alg_name = "CCMP";
+ break;
+#ifdef CONFIG_IEEE80211W
+ case WLAN_CIPHER_SUITE_AES_CMAC:
+ alg_name = "BIP";
+ break;
+#endif //CONFIG_IEEE80211W
+#ifdef CONFIG_WAPI_SUPPORT
+ case WLAN_CIPHER_SUITE_SMS4:
+ alg_name= "SMS4";
+ if(pairwise == NL80211_KEYTYPE_PAIRWISE) {
+ if (key_index != 0 && key_index != 1) {
+ ret = -ENOTSUPP;
+ goto addkey_end;
+ }
+ _rtw_memcpy((void*)param->sta_addr, (void*)mac_addr, ETH_ALEN);
+ } else {
+ DBG_871X("mac_addr is null \n");
+ }
+ DBG_871X("rtw_wx_set_enc_ext: SMS4 case \n");
+ break;
+#endif
+
+ default:
+ ret = -ENOTSUPP;
+ goto addkey_end;
+ }
+
+ strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN);
+
+
+ if (!mac_addr || is_broadcast_ether_addr(mac_addr))
+ {
+ param->u.crypt.set_tx = 0; //for wpa/wpa2 group key
+ } else {
+ param->u.crypt.set_tx = 1; //for wpa/wpa2 pairwise key
+ }
+
+
+ //param->u.crypt.idx = key_index - 1;
+ param->u.crypt.idx = key_index;
+
+ if (params->seq_len && params->seq)
+ {
+ _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, (u8 *)params->key, params->key_len);
+ }
+
+ if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
+ {
+ ret = rtw_cfg80211_set_encryption(ndev, param, param_len);
+ }
+ else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
+ {
+#ifdef CONFIG_AP_MODE
+ if(mac_addr)
+ _rtw_memcpy(param->sta_addr, (void*)mac_addr, ETH_ALEN);
+
+ 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);
+
+ }
+
+addkey_end:
+ if(param)
+ {
+ rtw_mfree((u8*)param, param_len);
+ }
+
+ return ret;
+
+}
+
+static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ u8 key_index, bool pairwise, const u8 *mac_addr,
+#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ u8 key_index, const u8 *mac_addr,
+#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ void *cookie,
+ void (*callback)(void *cookie,
+ struct key_params*))
+{
+#if 0
+ struct iwm_priv *iwm = ndev_to_iwm(ndev);
+ struct iwm_key *key = &iwm->keys[key_index];
+ struct key_params params;
+
+ IWM_DBG_WEXT(iwm, DBG, "Getting key %d\n", key_index);
+
+ memset(&params, 0, sizeof(params));
+
+ params.cipher = key->cipher;
+ params.key_len = key->key_len;
+ params.seq_len = key->seq_len;
+ params.seq = key->seq;
+ params.key = key->key;
+
+ callback(cookie, &params);
+
+ return key->key_len ? 0 : -ENOENT;
+#endif
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+ return 0;
+}
+
+static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ u8 key_index, bool pairwise, const u8 *mac_addr)
+#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ u8 key_index, const u8 *mac_addr)
+#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+
+ DBG_871X(FUNC_NDEV_FMT" key_index=%d\n", FUNC_NDEV_ARG(ndev), key_index);
+
+ if (key_index == psecuritypriv->dot11PrivacyKeyIndex)
+ {
+ //clear the flag of wep default key set.
+ psecuritypriv->bWepDefaultKeyIdxSet = 0;
+ }
+
+ return 0;
+}
+
+static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
+ struct net_device *ndev, u8 key_index
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
+ , bool unicast, bool multicast
+ #endif
+ )
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+
+ DBG_871X(FUNC_NDEV_FMT" key_index=%d"
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
+ ", unicast=%d, multicast=%d"
+ #endif
+ ".\n", FUNC_NDEV_ARG(ndev), key_index
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
+ , unicast, multicast
+ #endif
+ );
+
+ if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) //set wep default key
+ {
+ psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
+
+ psecuritypriv->dot11PrivacyKeyIndex = key_index;
+
+ psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
+ psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
+ if (psecuritypriv->dot11DefKeylen[key_index] == 13)
+ {
+ psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
+ psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
+ }
+
+ psecuritypriv->bWepDefaultKeyIdxSet = 1; //set the flag to represent that wep default key has been set
+ }
+
+ return 0;
+
+}
+
+static int cfg80211_rtw_get_station(struct wiphy *wiphy, 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);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct sta_info *psta = NULL;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+
+ sinfo->filled = 0;
+
+ if (!mac) {
+ DBG_871X(FUNC_NDEV_FMT" mac==%p\n", FUNC_NDEV_ARG(ndev), mac);
+ ret = -ENOENT;
+ goto exit;
+ }
+
+ psta = rtw_get_stainfo(pstapriv, (u8 *)mac);
+ if (psta == NULL) {
+ DBG_8192C("%s, sta_info is null\n", __func__);
+ ret = -ENOENT;
+ goto exit;
+ }
+
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_871X(FUNC_NDEV_FMT" mac="MAC_FMT"\n", FUNC_NDEV_ARG(ndev), MAC_ARG(mac));
+#endif
+
+ //for infra./P2PClient mode
+ if( check_fwstate(pmlmepriv, WIFI_STATION_STATE)
+ && check_fwstate(pmlmepriv, _FW_LINKED)
+ )
+ {
+ struct wlan_network *cur_network = &(pmlmepriv->cur_network);
+
+ 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;
+ }
+
+ sinfo->filled |= STATION_INFO_SIGNAL;
+ sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
+
+ sinfo->filled |= STATION_INFO_TX_BITRATE;
+ sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
+
+ sinfo->filled |= STATION_INFO_RX_PACKETS;
+ sinfo->rx_packets = sta_rx_data_pkts(psta);
+
+ sinfo->filled |= STATION_INFO_TX_PACKETS;
+ sinfo->tx_packets = psta->sta_stats.tx_pkts;
+
+ }
+
+ //for Ad-Hoc/AP mode
+ if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)
+ ||check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)
+ ||check_fwstate(pmlmepriv, WIFI_AP_STATE))
+ && check_fwstate(pmlmepriv, _FW_LINKED)
+ )
+ {
+ //TODO: should acquire station info...
+ }
+
+exit:
+ return ret;
+}
+
+extern int netdev_open(struct net_device *pnetdev);
+#ifdef CONFIG_CONCURRENT_MODE
+extern int netdev_if2_open(struct net_device *pnetdev);
+#endif
+
+/*
+enum nl80211_iftype {
+ NL80211_IFTYPE_UNSPECIFIED,
+ NL80211_IFTYPE_ADHOC, //1
+ NL80211_IFTYPE_STATION, //2
+ NL80211_IFTYPE_AP, //3
+ NL80211_IFTYPE_AP_VLAN,
+ NL80211_IFTYPE_WDS,
+ NL80211_IFTYPE_MONITOR, //6
+ NL80211_IFTYPE_MESH_POINT,
+ NL80211_IFTYPE_P2P_CLIENT, //8
+ NL80211_IFTYPE_P2P_GO, //9
+ //keep last
+ NUM_NL80211_IFTYPES,
+ NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1
+};
+*/
+static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
+ struct net_device *ndev,
+ enum nl80211_iftype type, u32 *flags,
+ struct vif_params *params)
+{
+ enum nl80211_iftype old_type;
+ NDIS_802_11_NETWORK_INFRASTRUCTURE networkType;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct wireless_dev *rtw_wdev = padapter->rtw_wdev;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+#ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
+#endif
+ int ret = 0;
+ u8 change = _FALSE;
+
+ DBG_871X(FUNC_NDEV_FMT" type=%d\n", FUNC_NDEV_ARG(ndev), type);
+
+ if(adapter_to_dvobj(padapter)->processing_dev_remove == _TRUE)
+ {
+ ret= -EPERM;
+ goto exit;
+ }
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if(padapter->adapter_type == SECONDARY_ADAPTER)
+ {
+ DBG_871X(FUNC_NDEV_FMT" call netdev_if2_open\n", FUNC_NDEV_ARG(ndev));
+ if(netdev_if2_open(ndev) != 0) {
+ DBG_871X(FUNC_NDEV_FMT" call netdev_if2_open fail\n", FUNC_NDEV_ARG(ndev));
+ ret= -EPERM;
+ goto exit;
+ }
+ }
+ else if(padapter->adapter_type == PRIMARY_ADAPTER)
+#endif //CONFIG_CONCURRENT_MODE
+ {
+ DBG_871X(FUNC_NDEV_FMT" call netdev_open\n", FUNC_NDEV_ARG(ndev));
+ if(netdev_open(ndev) != 0) {
+ DBG_871X(FUNC_NDEV_FMT" call netdev_open fail\n", FUNC_NDEV_ARG(ndev));
+ ret= -EPERM;
+ goto exit;
+ }
+ }
+
+ if(_FAIL == rtw_pwr_wakeup(padapter)) {
+ DBG_871X(FUNC_NDEV_FMT" call rtw_pwr_wakeup fail\n", FUNC_NDEV_ARG(ndev));
+ ret= -EPERM;
+ goto exit;
+ }
+
+ old_type = rtw_wdev->iftype;
+ DBG_871X(FUNC_NDEV_FMT" old_iftype=%d, new_iftype=%d\n",
+ FUNC_NDEV_ARG(ndev), old_type, type);
+
+ if(old_type != type)
+ {
+ change = _TRUE;
+ pmlmeext->action_public_rxseq = 0xffff;
+ pmlmeext->action_public_dialog_token = 0xff;
+ }
+
+ /* initial default type */
+ ndev->type = ARPHRD_ETHER;
+
+ switch (type) {
+ case NL80211_IFTYPE_ADHOC:
+ networkType = Ndis802_11IBSS;
+ break;
+#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE))
+ case NL80211_IFTYPE_P2P_CLIENT:
+#endif
+ case NL80211_IFTYPE_STATION:
+ networkType = Ndis802_11Infrastructure;
+ #ifdef CONFIG_P2P
+ if(pwdinfo->driver_interface == DRIVER_CFG80211 )
+ {
+ if(change && rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
+ {
+ //it means remove GO and change mode from AP(GO) to station(P2P DEVICE)
+ rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE);
+ rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
+
+ DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo));
+ }
+ }
+ #endif //CONFIG_P2P
+ break;
+#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE))
+ case NL80211_IFTYPE_P2P_GO:
+#endif
+ case NL80211_IFTYPE_AP:
+ networkType = Ndis802_11APMode;
+ #ifdef CONFIG_P2P
+ if(pwdinfo->driver_interface == DRIVER_CFG80211 )
+ {
+ if(change && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ //it means P2P Group created, we will be GO and change mode from P2P DEVICE to AP(GO)
+ rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO);
+ }
+ }
+ #endif //CONFIG_P2P
+ break;
+ case NL80211_IFTYPE_MONITOR:
+ networkType = Ndis802_11Monitor;
+#if 0
+ ndev->type = ARPHRD_IEEE80211; /* IEEE 802.11 : 801 */
+#endif
+ ndev->type = ARPHRD_IEEE80211_RADIOTAP; /* IEEE 802.11 + radiotap header : 803 */
+ break;
+ default:
+ ret = -EOPNOTSUPP;
+ goto exit;
+ }
+
+ rtw_wdev->iftype = type;
+
+ if (rtw_set_802_11_infrastructure_mode(padapter, networkType) ==_FALSE)
+ {
+ rtw_wdev->iftype = old_type;
+ ret = -EPERM;
+ goto exit;
+ }
+
+ rtw_setopmode_cmd(padapter, networkType, _TRUE);
+
+exit:
+
+ DBG_871X(FUNC_NDEV_FMT" ret:%d\n", FUNC_NDEV_ARG(ndev), ret);
+ return ret;
+}
+
+void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
+{
+ struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
+ _irqL irqL;
+
+ _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+ if (pwdev_priv->scan_request != NULL) {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_871X("%s with scan req\n", __FUNCTION__);
+ #endif
+
+ /* avoid WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); */
+ if(pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy)
+ {
+ DBG_8192C("error wiphy compare\n");
+ }
+ else
+ {
+ cfg80211_scan_done(pwdev_priv->scan_request, aborted);
+ }
+
+ pwdev_priv->scan_request = NULL;
+ } else {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_871X("%s without scan req\n", __FUNCTION__);
+ #endif
+ }
+ _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+}
+
+void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
+{
+ _irqL irqL;
+ _list *plist, *phead;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ _queue *queue = &(pmlmepriv->scanned_queue);
+ struct wlan_network *pnetwork = NULL;
+ u32 cnt=0;
+ u32 wait_for_surveydone;
+ sint wait_status;
+#ifdef CONFIG_P2P
+ struct wifidirect_info* pwdinfo = &padapter->wdinfo;
+#endif //CONFIG_P2P
+ struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
+
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s\n", __func__);
+#endif
+
+ _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
+
+ phead = get_list_head(queue);
+ plist = get_next(phead);
+
+ while(1)
+ {
+ if (rtw_end_of_queue_search(phead,plist)== _TRUE)
+ break;
+
+ pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
+
+ //report network only if the current channel set contains the channel to which this network belongs
+ if(rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0
+ && rtw_mlme_band_check(padapter, pnetwork->network.Configuration.DSConfig) == _TRUE
+ && _TRUE == rtw_validate_ssid(&(pnetwork->network.Ssid))
+ )
+ {
+ //ev=translate_scan(padapter, a, pnetwork, ev, stop);
+ rtw_cfg80211_inform_bss(padapter, pnetwork);
+ }
+
+ plist = get_next(plist);
+
+ }
+
+ _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
+}
+
+static int rtw_cfg80211_set_probe_req_wpsp2pie(_adapter *padapter, char *buf, int len)
+{
+ int ret = 0;
+ uint wps_ielen = 0;
+ u8 *wps_ie;
+ u32 p2p_ielen = 0;
+ u8 *p2p_ie;
+ u32 wfd_ielen = 0;
+ u8 *wfd_ie;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, ielen=%d\n", __func__, len);
+#endif
+
+ if(len>0)
+ {
+ if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
+ {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("probe_req_wps_ielen=%d\n", wps_ielen);
+ #endif
+
+ if(pmlmepriv->wps_probe_req_ie)
+ {
+ u32 free_len = pmlmepriv->wps_probe_req_ie_len;
+ pmlmepriv->wps_probe_req_ie_len = 0;
+ rtw_mfree(pmlmepriv->wps_probe_req_ie, free_len);
+ pmlmepriv->wps_probe_req_ie = NULL;
+ }
+
+ pmlmepriv->wps_probe_req_ie = rtw_malloc(wps_ielen);
+ if ( pmlmepriv->wps_probe_req_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+ _rtw_memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen);
+ pmlmepriv->wps_probe_req_ie_len = wps_ielen;
+ }
+
+ //buf += wps_ielen;
+ //len -= wps_ielen;
+
+ #ifdef CONFIG_P2P
+ if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen)))
+ {
+ struct wifidirect_info *wdinfo = &padapter->wdinfo;
+ u32 attr_contentlen = 0;
+ u8 listen_ch_attr[5];
+
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("probe_req_p2p_ielen=%d\n", p2p_ielen);
+ #endif
+
+ if(pmlmepriv->p2p_probe_req_ie)
+ {
+ u32 free_len = pmlmepriv->p2p_probe_req_ie_len;
+ pmlmepriv->p2p_probe_req_ie_len = 0;
+ rtw_mfree(pmlmepriv->p2p_probe_req_ie, free_len);
+ pmlmepriv->p2p_probe_req_ie = NULL;
+ }
+
+ pmlmepriv->p2p_probe_req_ie = rtw_malloc(p2p_ielen);
+ if ( pmlmepriv->p2p_probe_req_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+ _rtw_memcpy(pmlmepriv->p2p_probe_req_ie, p2p_ie, p2p_ielen);
+ pmlmepriv->p2p_probe_req_ie_len = p2p_ielen;
+
+ if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_LISTEN_CH, (u8*)listen_ch_attr, (uint*) &attr_contentlen)
+ && attr_contentlen == 5)
+ {
+ if (wdinfo->listen_channel != listen_ch_attr[4]) {
+ DBG_871X(FUNC_ADPT_FMT" listen channel - country:%c%c%c, class:%u, ch:%u\n",
+ FUNC_ADPT_ARG(padapter), listen_ch_attr[0], listen_ch_attr[1], listen_ch_attr[2],
+ listen_ch_attr[3], listen_ch_attr[4]);
+ wdinfo->listen_channel = listen_ch_attr[4];
+ }
+ }
+ }
+ #endif //CONFIG_P2P
+
+ //buf += p2p_ielen;
+ //len -= p2p_ielen;
+
+ #ifdef CONFIG_WFD
+ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen))
+ {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("probe_req_wfd_ielen=%d\n", wfd_ielen);
+ #endif
+
+ if(pmlmepriv->wfd_probe_req_ie)
+ {
+ u32 free_len = pmlmepriv->wfd_probe_req_ie_len;
+ pmlmepriv->wfd_probe_req_ie_len = 0;
+ rtw_mfree(pmlmepriv->wfd_probe_req_ie, free_len);
+ pmlmepriv->wfd_probe_req_ie = NULL;
+ }
+
+ pmlmepriv->wfd_probe_req_ie = rtw_malloc(wfd_ielen);
+ if ( pmlmepriv->wfd_probe_req_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len);
+ }
+ #endif //CONFIG_WFD
+
+ }
+
+ return ret;
+
+}
+
+static int cfg80211_rtw_scan(struct wiphy *wiphy
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
+ , struct net_device *ndev
+ #endif
+ , struct cfg80211_scan_request *request)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct net_device *ndev = wdev_to_ndev(request->wdev);
+#endif
+ int i;
+ u8 _status = _FALSE;
+ int ret = 0;
+ NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
+ struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
+ _irqL irqL;
+ u8 *wps_ie=NULL;
+ uint wps_ielen=0;
+ u8 *p2p_ie=NULL;
+ uint p2p_ielen=0;
+ u8 survey_times=3;
+ u8 survey_times_for_one_ch=6;
+ struct cfg80211_ssid *ssids = request->ssids;
+ int social_channel = 0, j = 0;
+ bool need_indicate_scan_done = _FALSE;
+ bool ps_denied = _FALSE;
+
+ _adapter *padapter;
+ struct rtw_wdev_priv *pwdev_priv;
+ struct mlme_priv *pmlmepriv;
+#ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo;
+#endif //CONFIG_P2P
+#ifdef CONFIG_CONCURRENT_MODE
+ PADAPTER pbuddy_adapter = NULL;
+ struct mlme_priv *pbuddy_mlmepriv = NULL;
+#endif //CONFIG_CONCURRENT_MODE
+
+ if (ndev == NULL) {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ padapter = (_adapter *)rtw_netdev_priv(ndev);
+ pwdev_priv = adapter_wdev_data(padapter);
+ pmlmepriv= &padapter->mlmepriv;
+#ifdef CONFIG_P2P
+ pwdinfo= &(padapter->wdinfo);
+#endif //CONFIG_P2P
+
+//#ifdef CONFIG_DEBUG_CFG80211
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+//#endif
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if (padapter->pbuddy_adapter) {
+ pbuddy_adapter = padapter->pbuddy_adapter;
+ pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv);
+ }
+#endif //CONFIG_CONCURRENT_MODE
+
+#ifdef CONFIG_MP_INCLUDED
+if (padapter->registrypriv.mp_mode == 1)
+{
+ DBG_871X(FUNC_ADPT_FMT ": MP mode block Scan request\n", FUNC_ADPT_ARG(padapter));
+ ret = -EPERM;
+ goto exit;
+}
+#ifdef CONFIG_CONCURRENT_MODE
+ if (padapter->pbuddy_adapter) {
+ if (padapter->pbuddy_adapter->registrypriv.mp_mode == 1)
+ {
+ DBG_871X(FUNC_ADPT_FMT ": MP mode block Scan request\n", FUNC_ADPT_ARG(padapter->pbuddy_adapter));
+ ret = -EPERM;
+ goto exit;
+ }
+ }
+#endif //CONFIG_CONCURRENT_MODE
+#endif
+
+ _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+ pwdev_priv->scan_request = request;
+ _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+
+ if (adapter_wdev_data(padapter)->block_scan == _TRUE) {
+ DBG_871X(FUNC_ADPT_FMT" wdev_priv.block_scan is set\n", FUNC_ADPT_ARG(padapter));
+ need_indicate_scan_done = _TRUE;
+ goto check_need_indicate_scan_done;
+ }
+
+ if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
+ {
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_871X("%s under WIFI_AP_STATE\n", __FUNCTION__);
+#endif
+
+ if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS|_FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE)
+ {
+ DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state);
+
+ if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS))
+ {
+ DBG_8192C("AP mode process WPS \n");
+ }
+
+ need_indicate_scan_done = _TRUE;
+ goto check_need_indicate_scan_done;
+ }
+ }
+
+ rtw_ps_deny(padapter, PS_DENY_SCAN);
+ ps_denied = _TRUE;
+ if(_FAIL == rtw_pwr_wakeup(padapter)) {
+ need_indicate_scan_done = _TRUE;
+ goto check_need_indicate_scan_done;
+ }
+
+ #ifdef CONFIG_P2P
+ if( pwdinfo->driver_interface == DRIVER_CFG80211 )
+ {
+ if(ssids->ssid != NULL
+ && _rtw_memcmp(ssids->ssid, "DIRECT-", 7)
+ && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL)
+ )
+ {
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ rtw_p2p_enable(padapter, P2P_ROLE_DEVICE);
+ adapter_wdev_data(padapter)->p2p_enabled = _TRUE;
+ }
+ else
+ {
+ rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo));
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo));
+ #endif
+ }
+ rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN);
+
+ if(request->n_channels == 3 &&
+ request->channels[0]->hw_value == 1 &&
+ request->channels[1]->hw_value == 6 &&
+ request->channels[2]->hw_value == 11
+ )
+ {
+ social_channel = 1;
+ }
+ }
+ }
+ #endif //CONFIG_P2P
+
+ if(request->ie && request->ie_len>0)
+ {
+ rtw_cfg80211_set_probe_req_wpsp2pie(padapter, (u8 *)request->ie, request->ie_len );
+ }
+
+ if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) {
+ DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state);
+ need_indicate_scan_done = _TRUE;
+ goto check_need_indicate_scan_done;
+ } else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) {
+ DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state);
+ ret = -EBUSY;
+ goto check_need_indicate_scan_done;
+ }
+
+ if (pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)
+ {
+#if 1 // Miracast can't do AP scan
+ static u32 lastscantime = 0;
+ u32 passtime;
+
+ passtime = rtw_get_passing_time_ms(lastscantime);
+ lastscantime = rtw_get_current_time();
+ if (passtime > 12000)
+#endif
+ {
+ DBG_871X("%s: bBusyTraffic == _TRUE\n", __FUNCTION__);
+ need_indicate_scan_done = _TRUE;
+ goto check_need_indicate_scan_done;
+ }
+ }
+
+ if (rtw_is_scan_deny(padapter)){
+ DBG_871X(FUNC_ADPT_FMT ": scan deny\n", FUNC_ADPT_ARG(padapter));
+ need_indicate_scan_done = _TRUE;
+ goto check_need_indicate_scan_done;
+ }
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if(pbuddy_mlmepriv && (pbuddy_mlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE))
+ {
+#if 1 // Miracast can't do AP scan
+ static u32 buddylastscantime = 0;
+ u32 passtime;
+
+ passtime = rtw_get_passing_time_ms(buddylastscantime);
+ buddylastscantime = rtw_get_current_time();
+ if ((passtime > 12000)
+//#ifdef CONFIG_P2P
+// ||(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE))
+//#endif //CONFIG_P2P
+ )
+#endif
+ {
+ DBG_871X("%s: bBusyTraffic == _TRUE at buddy_intf\n", __FUNCTION__);
+ need_indicate_scan_done = _TRUE;
+ goto check_need_indicate_scan_done;
+ }
+ }
+
+ if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE) {
+ DBG_871X("buddy_intf's mlme state:0x%x\n", pbuddy_mlmepriv->fw_state);
+ need_indicate_scan_done = _TRUE;
+ goto check_need_indicate_scan_done;
+
+ } else if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY)) {
+ bool scan_via_buddy = _FALSE;
+ struct rtw_wdev_priv *buddy_wdev_priv = adapter_wdev_data(pbuddy_adapter);
+
+ _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+ _enter_critical_bh(&buddy_wdev_priv->scan_req_lock, &irqL);
+ if (buddy_wdev_priv->scan_request) {
+ DBG_871X("scan via buddy\n");
+ pmlmepriv->scanning_via_buddy_intf = _TRUE;
+ _enter_critical_bh(&pmlmepriv->lock, &irqL);
+ set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
+ _exit_critical_bh(&pmlmepriv->lock, &irqL);
+ scan_via_buddy = _TRUE;
+ }
+ _exit_critical_bh(&buddy_wdev_priv->scan_req_lock, &irqL);
+ _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+
+ if (scan_via_buddy == _FALSE)
+ need_indicate_scan_done = _TRUE;
+
+ goto check_need_indicate_scan_done;
+ }
+#endif /* CONFIG_CONCURRENT_MODE */
+
+#ifdef CONFIG_P2P
+ 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);
+
+ 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
+
+
+ _rtw_memset(ssid, 0, sizeof(NDIS_802_11_SSID)*RTW_SSID_SCAN_AMOUNT);
+ //parsing request ssids, n_ssids
+ for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("ssid=%s, len=%d\n", ssids[i].ssid, ssids[i].ssid_len);
+ #endif
+ _rtw_memcpy(ssid[i].Ssid, ssids[i].ssid, ssids[i].ssid_len);
+ ssid[i].SsidLength = ssids[i].ssid_len;
+ }
+
+ /* parsing channels, n_channels */
+ _rtw_memset(ch, 0, sizeof(struct rtw_ieee80211_channel)*RTW_CHANNEL_SCAN_AMOUNT);
+ for (i=0;i<request->n_channels && i<RTW_CHANNEL_SCAN_AMOUNT;i++) {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_871X(FUNC_ADPT_FMT CHAN_FMT"\n", FUNC_ADPT_ARG(padapter), CHAN_ARG(request->channels[i]));
+ #endif
+ ch[i].hw_value = request->channels[i]->hw_value;
+ ch[i].flags = request->channels[i]->flags;
+ }
+
+ _enter_critical_bh(&pmlmepriv->lock, &irqL);
+ if (request->n_channels == 1) {
+ for(i=1;i<survey_times_for_one_ch;i++)
+ _rtw_memcpy(&ch[i], &ch[0], sizeof(struct rtw_ieee80211_channel));
+ _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, ch, survey_times_for_one_ch);
+ } else if (request->n_channels <= 4) {
+ for(j=request->n_channels-1;j>=0;j--)
+ for(i=0;i<survey_times;i++)
+ {
+ _rtw_memcpy(&ch[j*survey_times+i], &ch[j], sizeof(struct rtw_ieee80211_channel));
+ }
+ _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, ch, survey_times * request->n_channels);
+ } else {
+ _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, NULL, 0);
+ }
+ _exit_critical_bh(&pmlmepriv->lock, &irqL);
+
+
+ if(_status == _FALSE)
+ {
+ ret = -1;
+ }
+
+check_need_indicate_scan_done:
+ if (_TRUE == need_indicate_scan_done)
+ {
+ rtw_cfg80211_surveydone_event_callback(padapter);
+ rtw_cfg80211_indicate_scan_done(padapter, _FALSE);
+ }
+
+cancel_ps_deny:
+ if (ps_denied == _TRUE)
+ rtw_ps_deny_cancel(padapter, PS_DENY_SCAN);
+
+exit:
+ return ret;
+
+}
+
+static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+{
+#if 0
+ struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
+
+ if (changed & WIPHY_PARAM_RTS_THRESHOLD &&
+ (iwm->conf.rts_threshold != wiphy->rts_threshold)) {
+ int ret;
+
+ iwm->conf.rts_threshold = wiphy->rts_threshold;
+
+ ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX,
+ CFG_RTS_THRESHOLD,
+ iwm->conf.rts_threshold);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (changed & WIPHY_PARAM_FRAG_THRESHOLD &&
+ (iwm->conf.frag_threshold != wiphy->frag_threshold)) {
+ int ret;
+
+ iwm->conf.frag_threshold = wiphy->frag_threshold;
+
+ ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_FA_CFG_FIX,
+ CFG_FRAG_THRESHOLD,
+ iwm->conf.frag_threshold);
+ if (ret < 0)
+ return ret;
+ }
+#endif
+ DBG_8192C("%s\n", __func__);
+ return 0;
+}
+
+
+
+static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32 wpa_version)
+{
+ DBG_8192C("%s, wpa_version=%d\n", __func__, wpa_version);
+
+ if (!wpa_version) {
+ psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
+ return 0;
+ }
+
+
+ if (wpa_version & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2))
+ {
+ psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPAPSK;
+ }
+
+/*
+ if (wpa_version & NL80211_WPA_VERSION_2)
+ {
+ psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK;
+ }
+*/
+
+ #ifdef CONFIG_WAPI_SUPPORT
+ if (wpa_version & NL80211_WAPI_VERSION_1)
+ {
+ psecuritypriv->ndisauthtype = Ndis802_11AuthModeWAPI;
+ }
+ #endif
+
+ return 0;
+
+}
+
+static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv,
+ enum nl80211_auth_type sme_auth_type)
+{
+ DBG_8192C("%s, nl80211_auth_type=%d\n", __func__, sme_auth_type);
+
+
+ switch (sme_auth_type) {
+ case NL80211_AUTHTYPE_AUTOMATIC:
+
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto;
+
+ break;
+ case NL80211_AUTHTYPE_OPEN_SYSTEM:
+
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
+
+ if(psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA)
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
+
+#ifdef CONFIG_WAPI_SUPPORT
+ if(psecuritypriv->ndisauthtype == Ndis802_11AuthModeWAPI)
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
+#endif
+
+ break;
+ case NL80211_AUTHTYPE_SHARED_KEY:
+
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Shared;
+
+ psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
+
+
+ break;
+ default:
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
+ //return -ENOTSUPP;
+ }
+
+ return 0;
+
+}
+
+static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 cipher, bool ucast)
+{
+ u32 ndisencryptstatus = Ndis802_11EncryptionDisabled;
+
+ u32 *profile_cipher = ucast ? &psecuritypriv->dot11PrivacyAlgrthm :
+ &psecuritypriv->dot118021XGrpPrivacy;
+
+ DBG_8192C("%s, ucast=%d, cipher=0x%x\n", __func__, ucast, cipher);
+
+
+ if (!cipher) {
+ *profile_cipher = _NO_PRIVACY_;
+ psecuritypriv->ndisencryptstatus = ndisencryptstatus;
+ return 0;
+ }
+
+ switch (cipher) {
+ case IW_AUTH_CIPHER_NONE:
+ *profile_cipher = _NO_PRIVACY_;
+ ndisencryptstatus = Ndis802_11EncryptionDisabled;
+#ifdef CONFIG_WAPI_SUPPORT
+ if(psecuritypriv->dot11PrivacyAlgrthm ==_SMS4_ )
+ {
+ *profile_cipher = _SMS4_;
+ }
+#endif
+ break;
+ case WLAN_CIPHER_SUITE_WEP40:
+ *profile_cipher = _WEP40_;
+ ndisencryptstatus = Ndis802_11Encryption1Enabled;
+ break;
+ case WLAN_CIPHER_SUITE_WEP104:
+ *profile_cipher = _WEP104_;
+ ndisencryptstatus = Ndis802_11Encryption1Enabled;
+ break;
+ case WLAN_CIPHER_SUITE_TKIP:
+ *profile_cipher = _TKIP_;
+ ndisencryptstatus = Ndis802_11Encryption2Enabled;
+ break;
+ case WLAN_CIPHER_SUITE_CCMP:
+ *profile_cipher = _AES_;
+ ndisencryptstatus = Ndis802_11Encryption3Enabled;
+ break;
+#ifdef CONFIG_WAPI_SUPPORT
+ case WLAN_CIPHER_SUITE_SMS4:
+ *profile_cipher = _SMS4_;
+ ndisencryptstatus = Ndis802_11_EncrypteionWAPI;
+ break;
+#endif
+ default:
+ DBG_8192C("Unsupported cipher: 0x%x\n", cipher);
+ return -ENOTSUPP;
+ }
+
+ if(ucast)
+ {
+ psecuritypriv->ndisencryptstatus = ndisencryptstatus;
+
+ //if(psecuritypriv->dot11PrivacyAlgrthm >= _AES_)
+ // psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK;
+ }
+
+ return 0;
+}
+
+static int rtw_cfg80211_set_key_mgt(struct security_priv *psecuritypriv, u32 key_mgt)
+{
+ DBG_8192C("%s, key_mgt=0x%x\n", __func__, key_mgt);
+
+ if (key_mgt == WLAN_AKM_SUITE_8021X)
+ //*auth_type = UMAC_AUTH_TYPE_8021X;
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
+ else if (key_mgt == WLAN_AKM_SUITE_PSK) {
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
+ }
+#ifdef CONFIG_WAPI_SUPPORT
+ else if(key_mgt ==WLAN_AKM_SUITE_WAPI_PSK){
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
+ }
+ else if(key_mgt ==WLAN_AKM_SUITE_WAPI_CERT){
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
+ }
+#endif
+
+
+ else {
+ DBG_8192C("Invalid key mgt: 0x%x\n", key_mgt);
+ //return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int rtw_cfg80211_set_wpa_ie(_adapter *padapter, u8 *pie, size_t ielen)
+{
+ u8 *buf=NULL, *pos=NULL;
+ u32 left;
+ int group_cipher = 0, pairwise_cipher = 0;
+ int ret = 0;
+ int wpa_ielen=0;
+ int wpa2_ielen=0;
+ u8 *pwpa, *pwpa2;
+ u8 null_addr[]= {0,0,0,0,0,0};
+
+ if (pie == NULL || !ielen) {
+ /* Treat this as normal case, but need to clear WIFI_UNDER_WPS */
+ _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
+ goto exit;
+ }
+
+ if (ielen > MAX_WPA_IE_LEN+MAX_WPS_IE_LEN+MAX_P2P_IE_LEN) {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ buf = rtw_zmalloc(ielen);
+ if (buf == NULL){
+ ret = -ENOMEM;
+ goto exit;
+ }
+
+ _rtw_memcpy(buf, pie , ielen);
+
+ //dump
+ {
+ int i;
+ DBG_8192C("set wpa_ie(length:%zu):\n", ielen);
+ for(i=0;i<ielen;i=i+8)
+ DBG_8192C("0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",buf[i],buf[i+1],buf[i+2],buf[i+3],buf[i+4],buf[i+5],buf[i+6],buf[i+7]);
+ }
+
+ pos = buf;
+ if(ielen < RSN_HEADER_LEN){
+ RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("Ie len too short %d\n", ielen));
+ ret = -1;
+ goto exit;
+ }
+
+ pwpa = rtw_get_wpa_ie(buf, &wpa_ielen, ielen);
+ if(pwpa && wpa_ielen>0)
+ {
+ if(rtw_parse_wpa_ie(pwpa, wpa_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
+ {
+ padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
+ padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPAPSK;
+ _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa[0], wpa_ielen+2);
+
+ DBG_8192C("got wpa_ie, wpa_ielen:%u\n", wpa_ielen);
+ }
+ }
+
+ pwpa2 = rtw_get_wpa2_ie(buf, &wpa2_ielen, ielen);
+ if(pwpa2 && wpa2_ielen>0)
+ {
+ if(rtw_parse_wpa2_ie(pwpa2, wpa2_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
+ {
+ padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
+ padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK;
+ _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa2[0], wpa2_ielen+2);
+
+ DBG_8192C("got wpa2_ie, wpa2_ielen:%u\n", wpa2_ielen);
+ }
+ }
+
+ if (group_cipher == 0)
+ {
+ group_cipher = WPA_CIPHER_NONE;
+ }
+ if (pairwise_cipher == 0)
+ {
+ pairwise_cipher = WPA_CIPHER_NONE;
+ }
+
+ switch(group_cipher)
+ {
+ case WPA_CIPHER_NONE:
+ padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_;
+ padapter->securitypriv.ndisencryptstatus=Ndis802_11EncryptionDisabled;
+ break;
+ case WPA_CIPHER_WEP40:
+ padapter->securitypriv.dot118021XGrpPrivacy=_WEP40_;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
+ break;
+ case WPA_CIPHER_TKIP:
+ padapter->securitypriv.dot118021XGrpPrivacy=_TKIP_;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
+ break;
+ case WPA_CIPHER_CCMP:
+ padapter->securitypriv.dot118021XGrpPrivacy=_AES_;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled;
+ break;
+ case WPA_CIPHER_WEP104:
+ padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
+ break;
+ }
+
+ switch(pairwise_cipher)
+ {
+ case WPA_CIPHER_NONE:
+ padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_;
+ padapter->securitypriv.ndisencryptstatus=Ndis802_11EncryptionDisabled;
+ break;
+ case WPA_CIPHER_WEP40:
+ padapter->securitypriv.dot11PrivacyAlgrthm=_WEP40_;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
+ break;
+ case WPA_CIPHER_TKIP:
+ padapter->securitypriv.dot11PrivacyAlgrthm=_TKIP_;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
+ break;
+ case WPA_CIPHER_CCMP:
+ padapter->securitypriv.dot11PrivacyAlgrthm=_AES_;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled;
+ break;
+ case WPA_CIPHER_WEP104:
+ padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_;
+ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
+ break;
+ }
+
+ {/* handle wps_ie */
+ uint wps_ielen;
+ u8 *wps_ie;
+
+ wps_ie = rtw_get_wps_ie(buf, ielen, NULL, &wps_ielen);
+ if (wps_ie && wps_ielen > 0) {
+ DBG_8192C("got wps_ie, wps_ielen:%u\n", wps_ielen);
+ padapter->securitypriv.wps_ie_len = wps_ielen<MAX_WPS_IE_LEN?wps_ielen:MAX_WPS_IE_LEN;
+ _rtw_memcpy(padapter->securitypriv.wps_ie, wps_ie, padapter->securitypriv.wps_ie_len);
+ set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS);
+ } else {
+ _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
+ }
+ }
+
+ #ifdef CONFIG_P2P
+ {//check p2p_ie for assoc req;
+ uint p2p_ielen=0;
+ u8 *p2p_ie;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+
+ if((p2p_ie=rtw_get_p2p_ie(buf, ielen, NULL, &p2p_ielen)))
+ {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s p2p_assoc_req_ielen=%d\n", __FUNCTION__, p2p_ielen);
+ #endif
+
+ if(pmlmepriv->p2p_assoc_req_ie)
+ {
+ u32 free_len = pmlmepriv->p2p_assoc_req_ie_len;
+ pmlmepriv->p2p_assoc_req_ie_len = 0;
+ rtw_mfree(pmlmepriv->p2p_assoc_req_ie, free_len);
+ pmlmepriv->p2p_assoc_req_ie = NULL;
+ }
+
+ pmlmepriv->p2p_assoc_req_ie = rtw_malloc(p2p_ielen);
+ if ( pmlmepriv->p2p_assoc_req_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ goto exit;
+ }
+ _rtw_memcpy(pmlmepriv->p2p_assoc_req_ie, p2p_ie, p2p_ielen);
+ pmlmepriv->p2p_assoc_req_ie_len = p2p_ielen;
+ }
+ }
+ #endif //CONFIG_P2P
+
+ #ifdef CONFIG_WFD
+ {//check wfd_ie for assoc req;
+ uint wfd_ielen=0;
+ u8 *wfd_ie;
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+
+ if(rtw_get_wfd_ie(buf, ielen, NULL, &wfd_ielen))
+ {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s wfd_assoc_req_ielen=%d\n", __FUNCTION__, wfd_ielen);
+ #endif
+
+ if(pmlmepriv->wfd_assoc_req_ie)
+ {
+ u32 free_len = pmlmepriv->wfd_assoc_req_ie_len;
+ pmlmepriv->wfd_assoc_req_ie_len = 0;
+ rtw_mfree(pmlmepriv->wfd_assoc_req_ie, free_len);
+ pmlmepriv->wfd_assoc_req_ie = NULL;
+ }
+
+ pmlmepriv->wfd_assoc_req_ie = rtw_malloc(wfd_ielen);
+ if ( pmlmepriv->wfd_assoc_req_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ goto exit;
+ }
+ rtw_get_wfd_ie(buf, ielen, pmlmepriv->wfd_assoc_req_ie, &pmlmepriv->wfd_assoc_req_ie_len);
+ }
+ }
+ #endif //CONFIG_WFD
+
+ //TKIP and AES disallow multicast packets until installing group key
+ if(padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_
+ || padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_
+ || padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
+ //WPS open need to enable multicast
+ //|| check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == _TRUE)
+ rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr);
+
+ RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_,
+ ("rtw_set_wpa_ie: pairwise_cipher=0x%08x padapter->securitypriv.ndisencryptstatus=%d padapter->securitypriv.ndisauthtype=%d\n",
+ pairwise_cipher, padapter->securitypriv.ndisencryptstatus, padapter->securitypriv.ndisauthtype));
+
+exit:
+ if (buf)
+ rtw_mfree(buf, ielen);
+ if (ret)
+ _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
+ return ret;
+}
+
+static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_ibss_params *params)
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ NDIS_802_11_SSID ndis_ssid;
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+ 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));
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
+ struct cfg80211_chan_def *pch_def;
+#endif
+ struct ieee80211_channel *pch;
+ int ret=0;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
+ pch_def = (struct cfg80211_chan_def *)(&params->chandef);
+ pch = (struct ieee80211_channel *) pch_def->chan;
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
+ pch = (struct ieee80211_channel *)(params->channel);
+#endif
+
+ if(_FAIL == rtw_pwr_wakeup(padapter)) {
+ ret= -EPERM;
+ goto exit;
+ }
+
+ if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
+ ret = -EPERM;
+ goto exit;
+ }
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING) == _TRUE) {
+ DBG_8192C("%s, but buddy_intf is under linking\n", __FUNCTION__);
+ ret = -EINVAL;
+ goto exit;
+ }
+ if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY) == _TRUE) {
+ rtw_scan_abort(padapter->pbuddy_adapter);
+ }
+#endif //CONFIG_CONCURRENT_MODE
+
+ if (!params->ssid || !params->ssid_len)
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ if (params->ssid_len > IW_ESSID_MAX_SIZE){
+
+ ret= -E2BIG;
+ goto exit;
+ }
+
+ _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID));
+ ndis_ssid.SsidLength = 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);
+
+ psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
+ psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
+ psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system
+ psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
+
+ ret = rtw_cfg80211_set_auth_type(psecuritypriv, NL80211_AUTHTYPE_OPEN_SYSTEM);
+ rtw_set_802_11_authentication_mode(padapter, psecuritypriv->ndisauthtype);
+
+ DBG_871X("%s: center_freq = %d\n", __func__, pch->center_freq);
+ pmlmeext->cur_channel = rtw_freq2ch(pch->center_freq);
+
+ if (rtw_set_802_11_ssid(padapter, &ndis_ssid) == _FALSE)
+ {
+ ret = -1;
+ goto exit;
+ }
+
+exit:
+ return ret;
+}
+
+static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct wireless_dev *rtw_wdev = padapter->rtw_wdev;
+ enum nl80211_iftype old_type;
+ int ret = 0;
+
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ padapter->mlmepriv.not_indic_disco = _TRUE;
+
+ old_type = rtw_wdev->iftype;
+
+ rtw_set_to_roam(padapter, 0);
+
+ if(check_fwstate(&padapter->mlmepriv, _FW_LINKED))
+ {
+ rtw_scan_abort(padapter);
+ LeaveAllPowerSaveMode(padapter);
+
+ rtw_wdev->iftype = NL80211_IFTYPE_STATION;
+
+ if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure) ==_FALSE)
+ {
+ rtw_wdev->iftype = old_type;
+ ret = -EPERM;
+ goto leave_ibss;
+ }
+ rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure,_TRUE);
+ }
+
+leave_ibss:
+ padapter->mlmepriv.not_indic_disco = _FALSE;
+
+ return 0;
+}
+
+static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_connect_params *sme)
+{
+ int ret=0;
+ _irqL irqL;
+ _list *phead;
+ struct wlan_network *pnetwork = NULL;
+ NDIS_802_11_AUTHENTICATION_MODE authmode;
+ NDIS_802_11_SSID ndis_ssid;
+ u8 *dst_ssid, *src_ssid;
+ u8 *dst_bssid, *src_bssid;
+ //u8 matched_by_bssid=_FALSE;
+ //u8 matched_by_ssid=_FALSE;
+ u8 matched=_FALSE;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+ _queue *queue = &pmlmepriv->scanned_queue;
+
+ padapter->mlmepriv.not_indic_disco = _TRUE;
+
+ DBG_871X("=>"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+ DBG_871X("privacy=%d, key=%p, key_len=%d, key_idx=%d\n",
+ sme->privacy, sme->key, sme->key_len, sme->key_idx);
+
+
+ if(adapter_wdev_data(padapter)->block == _TRUE)
+ {
+ ret = -EBUSY;
+ DBG_871X("%s wdev_priv.block is set\n", __FUNCTION__);
+ goto exit;
+ }
+
+#ifdef CONFIG_PLATFORM_MSTAR_SCAN_BEFORE_CONNECT
+ printk("MStar Android!\n");
+ if(adapter_wdev_data(padapter)->bandroid_scan == _FALSE)
+ {
+#ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+#endif //CONFIG_P2P
+ {
+ ret = -EBUSY;
+ printk("Android hasn't attached yet!\n");
+ goto exit;
+ }
+ }
+#endif
+
+ rtw_ps_deny(padapter, PS_DENY_JOIN);
+ if(_FAIL == rtw_pwr_wakeup(padapter)) {
+ ret= -EPERM;
+ goto exit;
+ }
+
+ if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
+ ret = -EPERM;
+ goto exit;
+ }
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING) == _TRUE) {
+ DBG_8192C("%s, but buddy_intf is under linking\n", __FUNCTION__);
+ ret = -EINVAL;
+ goto exit;
+ }
+ if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY) == _TRUE) {
+ rtw_scan_abort(padapter->pbuddy_adapter);
+ }
+#endif
+
+ if (!sme->ssid || !sme->ssid_len)
+ {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ if (sme->ssid_len > IW_ESSID_MAX_SIZE){
+
+ ret= -E2BIG;
+ goto exit;
+ }
+
+ _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID));
+ ndis_ssid.SsidLength = 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);
+
+
+ if (sme->bssid)
+ DBG_8192C("bssid="MAC_FMT"\n", MAC_ARG(sme->bssid));
+
+
+ if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) {
+ ret = -EBUSY;
+ DBG_8192C("%s, fw_state=0x%x, goto exit\n", __FUNCTION__, pmlmepriv->fw_state);
+ goto exit;
+ }
+ if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) {
+ rtw_scan_abort(padapter);
+ }
+
+ psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
+ psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
+ psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
+ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system
+ psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
+
+#ifdef CONFIG_WAPI_SUPPORT
+ padapter->wapiInfo.bWapiEnable = false;
+#endif
+
+ ret = rtw_cfg80211_set_wpa_version(psecuritypriv, sme->crypto.wpa_versions);
+ if (ret < 0)
+ goto exit;
+
+#ifdef CONFIG_WAPI_SUPPORT
+ if(sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1)
+ {
+ padapter->wapiInfo.bWapiEnable = true;
+ padapter->wapiInfo.extra_prefix_len = WAPI_EXT_LEN;
+ padapter->wapiInfo.extra_postfix_len = SMS4_MIC_LEN;
+ }
+#endif
+
+ ret = rtw_cfg80211_set_auth_type(psecuritypriv, sme->auth_type);
+
+#ifdef CONFIG_WAPI_SUPPORT
+ if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_WAPI)
+ padapter->mlmeextpriv.mlmext_info.auth_algo = psecuritypriv->dot11AuthAlgrthm;
+#endif
+
+
+ if (ret < 0)
+ goto exit;
+
+ DBG_8192C("%s, ie_len=%zu\n", __func__, sme->ie_len);
+
+ ret = rtw_cfg80211_set_wpa_ie(padapter, (u8 *)sme->ie, sme->ie_len);
+ if (ret < 0)
+ goto exit;
+
+ if (sme->crypto.n_ciphers_pairwise) {
+ ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.ciphers_pairwise[0], _TRUE);
+ if (ret < 0)
+ goto exit;
+ }
+
+ //For WEP Shared auth
+ if((psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Shared
+ || psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Auto) && sme->key
+ )
+ {
+ u32 wep_key_idx, wep_key_len,wep_total_len;
+ NDIS_802_11_WEP *pwep = NULL;
+ DBG_871X("%s(): Shared/Auto WEP\n",__FUNCTION__);
+
+ wep_key_idx = sme->key_idx;
+ wep_key_len = sme->key_len;
+
+ if (sme->key_idx > WEP_KEYS) {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ if (wep_key_len > 0)
+ {
+ wep_key_len = wep_key_len <= 5 ? 5 : 13;
+ wep_total_len = wep_key_len + FIELD_OFFSET(NDIS_802_11_WEP, KeyMaterial);
+ pwep =(NDIS_802_11_WEP *) rtw_malloc(wep_total_len);
+ if(pwep == NULL){
+ DBG_871X(" wpa_set_encryption: pwep allocate fail !!!\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+
+ _rtw_memset(pwep, 0, wep_total_len);
+
+ pwep->KeyLength = wep_key_len;
+ pwep->Length = wep_total_len;
+
+ if(wep_key_len==13)
+ {
+ padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_;
+ padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_;
+ }
+ }
+ else {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ pwep->KeyIndex = wep_key_idx;
+ pwep->KeyIndex |= 0x80000000;
+
+ _rtw_memcpy(pwep->KeyMaterial, (void *)sme->key, pwep->KeyLength);
+
+ if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL)
+ {
+ ret = -EOPNOTSUPP ;
+ }
+
+ if (pwep) {
+ rtw_mfree((u8 *)pwep,wep_total_len);
+ }
+
+ if(ret < 0)
+ goto exit;
+ }
+
+ ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.cipher_group, _FALSE);
+ if (ret < 0)
+ return ret;
+
+ if (sme->crypto.n_akm_suites) {
+ ret = rtw_cfg80211_set_key_mgt(psecuritypriv, sme->crypto.akm_suites[0]);
+ if (ret < 0)
+ goto exit;
+ }
+
+#ifdef CONFIG_WAPI_SUPPORT
+ if(sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_PSK){
+ padapter->wapiInfo.bWapiPSK = true;
+ }
+ else if(sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_CERT){
+ padapter->wapiInfo.bWapiPSK = false;
+ }
+#endif
+
+ authmode = psecuritypriv->ndisauthtype;
+ rtw_set_802_11_authentication_mode(padapter, authmode);
+
+ //rtw_set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus);
+
+ if (rtw_set_802_11_connect(padapter, (u8 *)sme->bssid, &ndis_ssid) == _FALSE) {
+ ret = -1;
+ goto exit;
+ }
+
+ DBG_8192C("set ssid:dot11AuthAlgrthm=%d, dot11PrivacyAlgrthm=%d, dot118021XGrpPrivacy=%d\n", psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, psecuritypriv->dot118021XGrpPrivacy);
+
+exit:
+
+ rtw_ps_deny_cancel(padapter, PS_DENY_JOIN);
+
+ DBG_8192C("<=%s, ret %d\n",__FUNCTION__, ret);
+
+ padapter->mlmepriv.not_indic_disco = _FALSE;
+
+ return ret;
+}
+
+static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev,
+ u16 reason_code)
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ padapter->mlmepriv.not_indic_disco = _TRUE;
+
+ rtw_set_to_roam(padapter, 0);
+
+ //if(check_fwstate(&padapter->mlmepriv, _FW_LINKED))
+ {
+ rtw_scan_abort(padapter);
+ LeaveAllPowerSaveMode(padapter);
+ rtw_disassoc_cmd(padapter, 500, _FALSE);
+
+ DBG_871X("%s...call rtw_indicate_disconnect\n", __FUNCTION__);
+
+ rtw_indicate_disconnect(padapter);
+
+ rtw_free_assoc_resources(padapter, 1);
+ rtw_pwr_wakeup(padapter);
+ }
+
+ padapter->mlmepriv.not_indic_disco = _FALSE;
+
+ DBG_871X(FUNC_NDEV_FMT" return 0\n", FUNC_NDEV_ARG(ndev));
+ return 0;
+}
+
+static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+ struct wireless_dev *wdev,
+#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
+ enum nl80211_tx_power_setting type, int mbm)
+#else
+ enum tx_power_setting type, int dbm)
+#endif
+{
+#if 0
+ struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
+ int ret;
+
+ switch (type) {
+ case NL80211_TX_POWER_AUTOMATIC:
+ return 0;
+ case NL80211_TX_POWER_FIXED:
+ if (mbm < 0 || (mbm % 100))
+ return -EOPNOTSUPP;
+
+ if (!test_bit(IWM_STATUS_READY, &iwm->status))
+ return 0;
+
+ ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX,
+ CFG_TX_PWR_LIMIT_USR,
+ MBM_TO_DBM(mbm) * 2);
+ if (ret < 0)
+ return ret;
+
+ return iwm_tx_power_trigger(iwm);
+ default:
+ IWM_ERR(iwm, "Unsupported power type: %d\n", type);
+ return -EOPNOTSUPP;
+ }
+#endif
+ DBG_8192C("%s\n", __func__);
+ return 0;
+}
+
+static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+ struct wireless_dev *wdev,
+#endif
+ int *dbm)
+{
+ DBG_8192C("%s\n", __func__);
+
+ *dbm = (12);
+
+ return 0;
+}
+
+inline bool rtw_cfg80211_pwr_mgmt(_adapter *adapter)
+{
+ struct rtw_wdev_priv *rtw_wdev_priv = adapter_wdev_data(adapter);
+ return rtw_wdev_priv->power_mgmt;
+}
+
+static int cfg80211_rtw_set_power_mgmt(struct wiphy *wiphy,
+ struct net_device *ndev,
+ bool enabled, int timeout)
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct rtw_wdev_priv *rtw_wdev_priv = adapter_wdev_data(padapter);
+
+ DBG_871X(FUNC_NDEV_FMT" enabled:%u, timeout:%d\n", FUNC_NDEV_ARG(ndev),
+ enabled, timeout);
+
+ rtw_wdev_priv->power_mgmt = enabled;
+
+ #ifdef CONFIG_LPS
+ if (!enabled)
+ LPS_Leave(padapter, "CFG80211_PWRMGMT");
+ #endif
+
+ return 0;
+}
+
+static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy,
+ struct net_device *ndev,
+ struct cfg80211_pmksa *pmksa)
+{
+ 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" "MAC_FMT" "KEY_FMT"\n", FUNC_NDEV_ARG(ndev)
+ , MAC_ARG(pmksa->bssid), KEY_ARG(pmksa->pmkid));
+
+ 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 ; index<NUM_PMKID_CACHE; index++)
+ {
+ 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, (u8 *)pmksa->pmkid, WLAN_PMKID_LEN);
+ psecuritypriv->PMKIDList[index].bUsed = _TRUE;
+ psecuritypriv->PMKIDIndex = index+1;
+ blInserted = _TRUE;
+ break;
+ }
+ }
+
+ if(!blInserted)
+ {
+ // Find a new entry
+ 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, (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++ ;
+ if(psecuritypriv->PMKIDIndex==16)
+ {
+ psecuritypriv->PMKIDIndex =0;
+ }
+ }
+
+ return 0;
+}
+
+static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy,
+ struct net_device *ndev,
+ struct cfg80211_pmksa *pmksa)
+{
+ u8 index, bMatched = _FALSE;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+
+ 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 ; index<NUM_PMKID_CACHE; index++)
+ {
+ 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 );
+ psecuritypriv->PMKIDList[index].bUsed = _FALSE;
+ bMatched = _TRUE;
+ DBG_871X(FUNC_NDEV_FMT" clear id:%hhu\n", FUNC_NDEV_ARG(ndev), index);
+ break;
+ }
+ }
+
+ if(_FALSE == bMatched)
+ {
+ DBG_871X(FUNC_NDEV_FMT" do not have matched BSSID\n"
+ , FUNC_NDEV_ARG(ndev));
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int cfg80211_rtw_flush_pmksa(struct wiphy *wiphy,
+ struct net_device *ndev)
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
+
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ _rtw_memset( &psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE );
+ psecuritypriv->PMKIDIndex = 0;
+
+ return 0;
+}
+
+#ifdef CONFIG_AP_MODE
+void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint frame_len)
+{
+ s32 freq;
+ int channel;
+ struct wireless_dev *pwdev = padapter->rtw_wdev;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct net_device *ndev = padapter->pnetdev;
+
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+
+#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE)
+ {
+ struct station_info sinfo;
+ u8 ie_offset;
+ if (GetFrameSubType(pmgmt_frame) == WIFI_ASSOCREQ)
+ ie_offset = _ASOCREQ_IE_OFFSET_;
+ else // WIFI_REASSOCREQ
+ ie_offset = _REASOCREQ_IE_OFFSET_;
+
+ sinfo.filled = 0;
+ sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
+ sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset;
+ sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset;
+ cfg80211_new_sta(ndev, GetAddr2Ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
+ }
+#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
+ channel = pmlmeext->cur_channel;
+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+
+ #ifdef COMPAT_KERNEL_RELEASE
+ rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
+ #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
+ rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
+ #else //COMPAT_KERNEL_RELEASE
+ {
+ //to avoid WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION) when calling cfg80211_send_rx_assoc()
+ #ifndef CONFIG_PLATFORM_MSTAR
+ pwdev->iftype = NL80211_IFTYPE_STATION;
+ #endif //CONFIG_PLATFORM_MSTAR
+ DBG_8192C("iftype=%d before call cfg80211_send_rx_assoc()\n", pwdev->iftype);
+ rtw_cfg80211_send_rx_assoc(padapter, NULL, pmgmt_frame, frame_len);
+ DBG_8192C("iftype=%d after call cfg80211_send_rx_assoc()\n", pwdev->iftype);
+ pwdev->iftype = NL80211_IFTYPE_AP;
+ //cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
+ }
+ #endif //COMPAT_KERNEL_RELEASE
+#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */
+
+}
+
+void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, unsigned short reason)
+{
+ s32 freq;
+ int channel;
+ u8 *pmgmt_frame;
+ uint frame_len;
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ unsigned short *fctrl;
+ u8 mgmt_buf[128] = {0};
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct net_device *ndev = padapter->pnetdev;
+
+ DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
+
+#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE)
+ cfg80211_del_sta(ndev, da, GFP_ATOMIC);
+#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
+ channel = pmlmeext->cur_channel;
+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+
+ pmgmt_frame = mgmt_buf;
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame;
+
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+
+ //_rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
+ //_rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, da, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+
+ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
+ pmlmeext->mgnt_seq++;
+ SetFrameSubType(pmgmt_frame, WIFI_DEAUTH);
+
+ pmgmt_frame += sizeof(struct rtw_ieee80211_hdr_3addr);
+ frame_len = sizeof(struct rtw_ieee80211_hdr_3addr);
+
+ reason = cpu_to_le16(reason);
+ pmgmt_frame = rtw_set_fixed_ie(pmgmt_frame, _RSON_CODE_ , (unsigned char *)&reason, &frame_len);
+
+ #ifdef COMPAT_KERNEL_RELEASE
+ rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC);
+ #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
+ rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC);
+ #else //COMPAT_KERNEL_RELEASE
+ cfg80211_send_disassoc(padapter->pnetdev, mgmt_buf, frame_len);
+ //cfg80211_rx_action(padapter->pnetdev, freq, mgmt_buf, frame_len, GFP_ATOMIC);
+ #endif //COMPAT_KERNEL_RELEASE
+#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */
+}
+
+static int rtw_cfg80211_monitor_if_open(struct net_device *ndev)
+{
+ int ret = 0;
+
+ DBG_8192C("%s\n", __func__);
+
+ return ret;
+}
+
+static int rtw_cfg80211_monitor_if_close(struct net_device *ndev)
+{
+ int ret = 0;
+
+ DBG_8192C("%s\n", __func__);
+
+ return ret;
+}
+
+static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
+{
+ int ret = 0;
+ int rtap_len;
+ int qos_len = 0;
+ int dot11_hdr_len = 24;
+ int snap_len = 6;
+ unsigned char *pdata;
+ u16 frame_ctl;
+ unsigned char src_mac_addr[6];
+ unsigned char dst_mac_addr[6];
+ struct ieee80211_hdr *dot11_hdr;
+ struct ieee80211_radiotap_header *rtap_hdr;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ if (skb)
+ rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
+
+ if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
+ goto fail;
+
+ rtap_hdr = (struct ieee80211_radiotap_header *)skb->data;
+ if (unlikely(rtap_hdr->it_version))
+ goto fail;
+
+ rtap_len = ieee80211_get_radiotap_len(skb->data);
+ if (unlikely(skb->len < rtap_len))
+ goto fail;
+
+ if(rtap_len != 14)
+ {
+ DBG_8192C("radiotap len (should be 14): %d\n", rtap_len);
+ goto fail;
+ }
+
+ /* Skip the ratio tap header */
+ skb_pull(skb, rtap_len);
+
+ dot11_hdr = (struct ieee80211_hdr *)skb->data;
+ frame_ctl = le16_to_cpu(dot11_hdr->frame_control);
+ /* Check if the QoS bit is set */
+ if ((frame_ctl & RTW_IEEE80211_FCTL_FTYPE) == RTW_IEEE80211_FTYPE_DATA) {
+ /* Check if this ia a Wireless Distribution System (WDS) frame
+ * which has 4 MAC addresses
+ */
+ if (dot11_hdr->frame_control & 0x0080)
+ qos_len = 2;
+ if ((dot11_hdr->frame_control & 0x0300) == 0x0300)
+ dot11_hdr_len += 6;
+
+ memcpy(dst_mac_addr, dot11_hdr->addr1, sizeof(dst_mac_addr));
+ memcpy(src_mac_addr, dot11_hdr->addr2, sizeof(src_mac_addr));
+
+ /* Skip the 802.11 header, QoS (if any) and SNAP, but leave spaces for
+ * for two MAC addresses
+ */
+ skb_pull(skb, dot11_hdr_len + qos_len + snap_len - sizeof(src_mac_addr) * 2);
+ pdata = (unsigned char*)skb->data;
+ memcpy(pdata, dst_mac_addr, sizeof(dst_mac_addr));
+ memcpy(pdata + sizeof(dst_mac_addr), src_mac_addr, sizeof(src_mac_addr));
+
+ DBG_8192C("should be eapol packet\n");
+
+ /* Use the real net device to transmit the packet */
+ ret = _rtw_xmit_entry(skb, padapter->pnetdev);
+
+ return ret;
+
+ }
+ else if ((frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE))
+ == (RTW_IEEE80211_FTYPE_MGMT|RTW_IEEE80211_STYPE_ACTION)
+ )
+ {
+ //only for action frames
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ unsigned char *pframe;
+ //u8 category, action, OUI_Subtype, dialogToken=0;
+ //unsigned char *frame_body;
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ u8 *buf = skb->data;
+ u32 len = skb->len;
+ u8 category, action;
+ int type = -1;
+
+ if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) {
+ DBG_8192C(FUNC_NDEV_FMT" frame_control:0x%x\n", FUNC_NDEV_ARG(ndev),
+ le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl));
+ goto fail;
+ }
+
+ DBG_8192C("RTW_Tx:da="MAC_FMT" via "FUNC_NDEV_FMT"\n",
+ MAC_ARG(GetAddr1Ptr(buf)), FUNC_NDEV_ARG(ndev));
+ #ifdef CONFIG_P2P
+ if((type = rtw_p2p_check_frames(padapter, buf, len, _TRUE)) >= 0)
+ goto dump;
+ #endif
+ if (category == RTW_WLAN_CATEGORY_PUBLIC)
+ DBG_871X("RTW_Tx:%s\n", action_public_str(action));
+ else
+ DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action);
+
+dump:
+ //starting alloc mgmt frame to dump it
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ goto fail;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ update_mgntframe_attrib(padapter, pattrib);
+ pattrib->retry_ctrl = _FALSE;
+
+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+
+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+
+ _rtw_memcpy(pframe, (void*)buf, len);
+ #ifdef CONFIG_WFD
+ if (type >= 0)
+ {
+ struct wifi_display_info *pwfd_info;
+
+ pwfd_info = padapter->wdinfo.wfd_info;
+
+ if ( _TRUE == pwfd_info->wfd_enable )
+ {
+ rtw_append_wfd_ie( padapter, pframe, &len );
+ }
+ }
+ #endif // CONFIG_WFD
+ pattrib->pktlen = len;
+
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+ //update seq number
+ pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
+ pattrib->seqnum = pmlmeext->mgnt_seq;
+ pmlmeext->mgnt_seq++;
+
+
+ pattrib->last_txcmdsz = pattrib->pktlen;
+
+ dump_mgntframe(padapter, pmgntframe);
+
+ }
+ else
+ {
+ DBG_8192C("frame_ctl=0x%x\n", frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE));
+ }
+
+
+fail:
+
+ rtw_skb_free(skb);
+
+ return 0;
+
+}
+
+static void rtw_cfg80211_monitor_if_set_multicast_list(struct net_device *ndev)
+{
+ DBG_8192C("%s\n", __func__);
+}
+
+static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void *addr)
+{
+ int ret = 0;
+
+ DBG_8192C("%s\n", __func__);
+
+ return ret;
+}
+
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
+static const struct net_device_ops rtw_cfg80211_monitor_if_ops = {
+ .ndo_open = rtw_cfg80211_monitor_if_open,
+ .ndo_stop = rtw_cfg80211_monitor_if_close,
+ .ndo_start_xmit = rtw_cfg80211_monitor_if_xmit_entry,
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
+ .ndo_set_multicast_list = rtw_cfg80211_monitor_if_set_multicast_list,
+ #endif
+ .ndo_set_mac_address = rtw_cfg80211_monitor_if_set_mac_address,
+};
+#endif
+
+static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct net_device **ndev)
+{
+ int ret = 0;
+ struct net_device* mon_ndev = NULL;
+ struct wireless_dev* mon_wdev = NULL;
+ struct rtw_netdev_priv_indicator *pnpi;
+ struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
+
+ if (!name ) {
+ DBG_871X(FUNC_ADPT_FMT" without specific name\n", FUNC_ADPT_ARG(padapter));
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if (pwdev_priv->pmon_ndev) {
+ DBG_871X(FUNC_ADPT_FMT" monitor interface exist: "NDEV_FMT"\n",
+ FUNC_ADPT_ARG(padapter), NDEV_ARG(pwdev_priv->pmon_ndev));
+ ret = -EBUSY;
+ goto out;
+ }
+
+ mon_ndev = alloc_etherdev(sizeof(struct rtw_netdev_priv_indicator));
+ if (!mon_ndev) {
+ DBG_871X(FUNC_ADPT_FMT" allocate ndev fail\n", FUNC_ADPT_ARG(padapter));
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
+ strncpy(mon_ndev->name, name, IFNAMSIZ);
+ mon_ndev->name[IFNAMSIZ - 1] = 0;
+ mon_ndev->destructor = rtw_ndev_destructor;
+
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
+ mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
+#else
+ mon_ndev->open = rtw_cfg80211_monitor_if_open;
+ mon_ndev->stop = rtw_cfg80211_monitor_if_close;
+ mon_ndev->hard_start_xmit = rtw_cfg80211_monitor_if_xmit_entry;
+ mon_ndev->set_mac_address = rtw_cfg80211_monitor_if_set_mac_address;
+#endif
+
+ pnpi = netdev_priv(mon_ndev);
+ pnpi->priv = padapter;
+ pnpi->sizeof_priv = sizeof(_adapter);
+
+ /* wdev */
+ mon_wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev));
+ if (!mon_wdev) {
+ DBG_871X(FUNC_ADPT_FMT" allocate mon_wdev fail\n", FUNC_ADPT_ARG(padapter));
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ mon_wdev->wiphy = padapter->rtw_wdev->wiphy;
+ mon_wdev->netdev = mon_ndev;
+ mon_wdev->iftype = NL80211_IFTYPE_MONITOR;
+ mon_ndev->ieee80211_ptr = mon_wdev;
+
+ ret = register_netdevice(mon_ndev);
+ if (ret) {
+ goto out;
+ }
+
+ *ndev = pwdev_priv->pmon_ndev = mon_ndev;
+ _rtw_memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ+1);
+
+out:
+ if (ret && mon_wdev) {
+ rtw_mfree((u8*)mon_wdev, sizeof(struct wireless_dev));
+ mon_wdev = NULL;
+ }
+
+ if (ret && mon_ndev) {
+ free_netdev(mon_ndev);
+ *ndev = mon_ndev = NULL;
+ }
+
+ return ret;
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+static struct wireless_dev *
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
+static struct net_device *
+#else
+static int
+#endif
+ cfg80211_rtw_add_virtual_intf(
+ struct wiphy *wiphy,
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
+ const char *name,
+ #else
+ char *name,
+ #endif
+ enum nl80211_iftype type, u32 *flags, struct vif_params *params)
+{
+ int ret = 0;
+ struct net_device* ndev = NULL;
+ _adapter *padapter = wiphy_to_adapter(wiphy);
+
+ DBG_871X(FUNC_ADPT_FMT " wiphy:%s, name:%s, type:%d\n",
+ FUNC_ADPT_ARG(padapter), wiphy_name(wiphy), name, type);
+
+ switch (type) {
+ case NL80211_IFTYPE_ADHOC:
+ case NL80211_IFTYPE_AP_VLAN:
+ case NL80211_IFTYPE_WDS:
+ case NL80211_IFTYPE_MESH_POINT:
+ ret = -ENODEV;
+ break;
+ case NL80211_IFTYPE_MONITOR:
+ ret = rtw_cfg80211_add_monitor_if(padapter, (char *)name, &ndev);
+ break;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ case NL80211_IFTYPE_P2P_CLIENT:
+#endif
+ case NL80211_IFTYPE_STATION:
+ ret = -ENODEV;
+ break;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ case NL80211_IFTYPE_P2P_GO:
+#endif
+ case NL80211_IFTYPE_AP:
+ ret = -ENODEV;
+ break;
+ default:
+ ret = -ENODEV;
+ DBG_871X("Unsupported interface type\n");
+ break;
+ }
+
+ DBG_871X(FUNC_ADPT_FMT" ndev:%p, ret:%d\n", FUNC_ADPT_ARG(padapter), ndev, ret);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ return ndev ? ndev->ieee80211_ptr : ERR_PTR(ret);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
+ return ndev ? ndev : ERR_PTR(ret);
+#else
+ return ret;
+#endif
+}
+
+static int cfg80211_rtw_del_virtual_intf(struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct wireless_dev *wdev
+#else
+ struct net_device *ndev
+#endif
+)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct net_device *ndev = wdev_to_ndev(wdev);
+#endif
+ int ret = 0;
+ _adapter *adapter;
+ struct rtw_wdev_priv *pwdev_priv;
+
+ if (!ndev) {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ adapter = (_adapter *)rtw_netdev_priv(ndev);
+ pwdev_priv = adapter_wdev_data(adapter);
+
+ unregister_netdevice(ndev);
+
+ if (ndev == pwdev_priv->pmon_ndev) {
+ pwdev_priv->pmon_ndev = NULL;
+ pwdev_priv->ifname_mon[0] = '\0';
+ DBG_871X(FUNC_NDEV_FMT" remove monitor interface\n", FUNC_NDEV_ARG(ndev));
+ }
+
+exit:
+ return ret;
+}
+
+static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, const u8 *tail, size_t tail_len)
+{
+ int ret=0;
+ u8 *pbuf = NULL;
+ uint len, wps_ielen=0;
+ uint p2p_ielen=0;
+ u8 *p2p_ie;
+ u8 got_p2p_ie = _FALSE;
+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
+ //struct sta_priv *pstapriv = &padapter->stapriv;
+
+
+ DBG_8192C("%s beacon_head_len=%zu, beacon_tail_len=%zu\n", __FUNCTION__, head_len, tail_len);
+
+
+ if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
+ return -EINVAL;
+
+ if(head_len<24)
+ return -EINVAL;
+
+
+ pbuf = rtw_zmalloc(head_len+tail_len);
+ if(!pbuf)
+ return -ENOMEM;
+
+
+ //_rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2);
+
+ //if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0))
+ // pstapriv->max_num_sta = NUM_STA;
+
+
+ _rtw_memcpy(pbuf, (void *)head+24, head_len-24);// 24=beacon header len.
+ _rtw_memcpy(pbuf+head_len-24, (void *)tail, tail_len);
+
+ len = head_len+tail_len-24;
+
+ //check wps ie if inclued
+ if(rtw_get_wps_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &wps_ielen))
+ DBG_8192C("add bcn, wps_ielen=%d\n", wps_ielen);
+
+#ifdef CONFIG_P2P
+ if( adapter->wdinfo.driver_interface == DRIVER_CFG80211 )
+ {
+ //check p2p if enable
+ if(rtw_get_p2p_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &p2p_ielen))
+ {
+ struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
+ struct wifidirect_info *pwdinfo= &(adapter->wdinfo);
+
+ DBG_8192C("got p2p_ie, len=%d\n", p2p_ielen);
+
+ got_p2p_ie = _TRUE;
+
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ DBG_8192C("Enable P2P function for the first time\n");
+ rtw_p2p_enable(adapter, P2P_ROLE_GO);
+ adapter_wdev_data(adapter)->p2p_enabled = _TRUE;
+
+ adapter->stapriv.expire_to = 3; // 3x2 = 6 sec in p2p mode
+ }
+ else
+ {
+ DBG_8192C("enter GO Mode, p2p_ielen=%d\n", p2p_ielen);
+
+ rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO);
+ rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK);
+ pwdinfo->intent = 15;
+ }
+ }
+ }
+#endif // CONFIG_P2P
+
+ /* pbss_network->IEs will not include p2p_ie, wfd ie */
+ rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, P2P_OUI, 4);
+ rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, WFD_OUI, 4);
+
+ if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS)
+ {
+#ifdef CONFIG_P2P
+ //check p2p if enable
+ if(got_p2p_ie == _TRUE)
+ {
+ struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
+ struct wifidirect_info *pwdinfo= &(adapter->wdinfo);
+ pwdinfo->operating_channel = pmlmeext->cur_channel;
+ }
+#endif //CONFIG_P2P
+ ret = 0;
+ }
+ else
+ {
+ ret = -EINVAL;
+ }
+
+
+ rtw_mfree(pbuf, head_len+tail_len);
+
+ return ret;
+}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE)
+static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *ndev,
+ struct beacon_parameters *info)
+{
+ int ret=0;
+ _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
+
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+ ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
+
+ return ret;
+}
+
+static int cfg80211_rtw_set_beacon(struct wiphy *wiphy, struct net_device *ndev,
+ struct beacon_parameters *info)
+{
+ _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
+
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ pmlmeext->bstart_bss = _TRUE;
+
+ cfg80211_rtw_add_beacon(wiphy, ndev, info);
+
+ return 0;
+}
+
+static int cfg80211_rtw_del_beacon(struct wiphy *wiphy, struct net_device *ndev)
+{
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ return 0;
+}
+#else
+static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_ap_settings *settings)
+{
+ int ret = 0;
+ _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
+
+ DBG_871X(FUNC_NDEV_FMT" hidden_ssid:%d, auth_type:%d\n", FUNC_NDEV_ARG(ndev),
+ settings->hidden_ssid, settings->auth_type);
+
+ ret = rtw_add_beacon(adapter, settings->beacon.head, settings->beacon.head_len,
+ settings->beacon.tail, settings->beacon.tail_len);
+
+ adapter->mlmeextpriv.mlmext_info.hidden_ssid_mode = settings->hidden_ssid;
+
+ if (settings->ssid && settings->ssid_len) {
+ WLAN_BSSID_EX *pbss_network = &adapter->mlmepriv.cur_network.network;
+ WLAN_BSSID_EX *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network;
+
+ if(0)
+ 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);
+
+ _rtw_memcpy(pbss_network->Ssid.Ssid, (void *)settings->ssid, settings->ssid_len);
+ pbss_network->Ssid.SsidLength = settings->ssid_len;
+ _rtw_memcpy(pbss_network_ext->Ssid.Ssid, (void *)settings->ssid, settings->ssid_len);
+ pbss_network_ext->Ssid.SsidLength = settings->ssid_len;
+
+ if(0)
+ DBG_871X(FUNC_ADPT_FMT" after ssid:(%s,%d), (%s,%d)\n", FUNC_ADPT_ARG(adapter),
+ pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength,
+ pbss_network_ext->Ssid.Ssid, pbss_network_ext->Ssid.SsidLength);
+ }
+
+ return ret;
+}
+
+static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_beacon_data *info)
+{
+ int ret = 0;
+ _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
+
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
+
+ return ret;
+}
+
+static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
+{
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+ return 0;
+}
+
+#endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+
+static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev,
+#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;
+}
+
+static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0))
+ u8 *mac
+#else
+ const u8 *mac
+#endif
+)
+{
+ int ret=0;
+ _irqL irqL;
+ _list *phead, *plist;
+ u8 updated = _FALSE;
+ struct sta_info *psta = NULL;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+
+ DBG_871X("+"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE)
+ {
+ DBG_8192C("%s, fw_state != FW_LINKED|WIFI_AP_STATE\n", __func__);
+ return -EINVAL;
+ }
+
+
+ if(!mac)
+ {
+ DBG_8192C("flush all sta, and cam_entry\n");
+
+ flush_all_cam_entry(padapter); //clear CAM
+
+ ret = rtw_sta_flush(padapter);
+
+ return ret;
+ }
+
+
+ DBG_8192C("free sta macaddr =" MAC_FMT "\n", MAC_ARG(mac));
+
+ if (mac[0] == 0xff && mac[1] == 0xff &&
+ mac[2] == 0xff && mac[3] == 0xff &&
+ mac[4] == 0xff && mac[5] == 0xff)
+ {
+ return -EINVAL;
+ }
+
+
+ _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ phead = &pstapriv->asoc_list;
+ plist = get_next(phead);
+
+ //check asoc_queue
+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+ {
+ psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
+
+ plist = get_next(plist);
+
+ if(_rtw_memcmp((u8 *)mac, psta->hwaddr, ETH_ALEN))
+ {
+ if(psta->dot8021xalg == 1 && psta->bpairwise_key_installed == _FALSE)
+ {
+ DBG_8192C("%s, sta's dot8021xalg = 1 and key_installed = _FALSE\n", __func__);
+ }
+ else
+ {
+ DBG_8192C("free psta=%p, aid=%d\n", psta, psta->aid);
+
+ rtw_list_delete(&psta->asoc_list);
+ pstapriv->asoc_list_cnt--;
+
+ //_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+ if (check_fwstate(pmlmepriv, (WIFI_AP_STATE)) == _TRUE)
+ updated = ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_PREV_AUTH_NOT_VALID);
+ else
+ updated = ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING);
+ //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ psta = NULL;
+
+ break;
+ }
+
+ }
+
+ }
+
+ _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+ associated_clients_update(padapter, updated);
+
+ DBG_871X("-"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ return ret;
+
+}
+
+static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev,
+#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;
+}
+
+static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *ndev,
+ int idx, u8 *mac, struct station_info *sinfo)
+{
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ //TODO: dump scanned queue
+
+ return -ENOENT;
+}
+
+static int cfg80211_rtw_change_bss(struct wiphy *wiphy, struct net_device *ndev,
+ struct bss_parameters *params)
+{
+ u8 i;
+
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+/*
+ DBG_8192C("use_cts_prot=%d\n", params->use_cts_prot);
+ DBG_8192C("use_short_preamble=%d\n", params->use_short_preamble);
+ DBG_8192C("use_short_slot_time=%d\n", params->use_short_slot_time);
+ DBG_8192C("ap_isolate=%d\n", params->ap_isolate);
+
+ DBG_8192C("basic_rates_len=%d\n", params->basic_rates_len);
+ for(i=0; i<params->basic_rates_len; i++)
+ {
+ DBG_8192C("basic_rates=%d\n", params->basic_rates[i]);
+
+ }
+*/
+ return 0;
+
+}
+
+static int cfg80211_rtw_set_channel(struct wiphy *wiphy
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ , struct net_device *ndev
+ #endif
+ , struct ieee80211_channel *chan, enum nl80211_channel_type channel_type)
+{
+ int chan_target = (u8) ieee80211_frequency_to_channel(chan->center_freq);
+ int chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ int chan_width = CHANNEL_WIDTH_20;
+ _adapter *padapter = wiphy_to_adapter(wiphy);
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+ #endif
+
+ switch (channel_type) {
+ case NL80211_CHAN_NO_HT:
+ case NL80211_CHAN_HT20:
+ chan_width = CHANNEL_WIDTH_20;
+ chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ break;
+ case NL80211_CHAN_HT40MINUS:
+ chan_width = CHANNEL_WIDTH_40;
+ chan_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
+ break;
+ case NL80211_CHAN_HT40PLUS:
+ chan_width = CHANNEL_WIDTH_40;
+ chan_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
+ break;
+ default:
+ chan_width = CHANNEL_WIDTH_20;
+ chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ break;
+ }
+
+ set_channel_bwmode(padapter, chan_target, chan_offset, chan_width);
+
+ return 0;
+}
+
+static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_auth_request *req)
+{
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ return 0;
+}
+
+static int cfg80211_rtw_assoc(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_assoc_request *req)
+{
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ return 0;
+}
+#endif //CONFIG_AP_MODE
+
+void rtw_cfg80211_rx_action_p2p(_adapter *padapter, u8 *pmgmt_frame, uint frame_len)
+{
+ int type;
+ s32 freq;
+ int channel;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ u8 category, action;
+
+ channel = rtw_get_oper_ch(padapter);
+
+ DBG_8192C("RTW_Rx:cur_ch=%d\n", channel);
+ #ifdef CONFIG_P2P
+ type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE);
+ if (type >= 0)
+ goto indicate;
+ #endif
+ rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action);
+ DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
+
+indicate:
+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
+#else
+ cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
+#endif
+}
+
+void rtw_cfg80211_rx_p2p_action_public(_adapter *padapter, u8 *pmgmt_frame, uint frame_len)
+{
+ int type;
+ s32 freq;
+ int channel;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ u8 category, action;
+
+ channel = rtw_get_oper_ch(padapter);
+
+ DBG_8192C("RTW_Rx:cur_ch=%d\n", channel);
+ #ifdef CONFIG_P2P
+ type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE);
+ if (type >= 0) {
+ switch (type) {
+ case P2P_GO_NEGO_CONF:
+ case P2P_PROVISION_DISC_RESP:
+ case P2P_INVIT_RESP:
+ rtw_set_scan_deny(padapter, 2000);
+ rtw_clear_scan_deny(padapter);
+ }
+ goto indicate;
+ }
+ #endif
+ rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action);
+ DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
+
+indicate:
+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
+#else
+ cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
+#endif
+}
+
+void rtw_cfg80211_rx_action(_adapter *adapter, u8 *frame, uint frame_len, const char*msg)
+{
+ s32 freq;
+ int channel;
+ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
+ struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
+ u8 category, action;
+
+ channel = rtw_get_oper_ch(adapter);
+
+ rtw_action_frame_parse(frame, frame_len, &category, &action);
+
+ if (action == ACT_PUBLIC_GAS_INITIAL_REQ) {
+ rtw_set_scan_deny(adapter, 200);
+ rtw_scan_abort_no_wait(adapter);
+ #ifdef CONFIG_CONCURRENT_MODE
+ if (rtw_buddy_adapter_up(adapter))
+ rtw_scan_abort_no_wait(adapter->pbuddy_adapter);
+ #endif
+ }
+
+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+ else
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, GFP_ATOMIC);
+#else
+ cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC);
+#endif
+
+ DBG_8192C("RTW_Rx:cur_ch=%d\n", channel);
+ if (msg)
+ DBG_871X("RTW_Rx:%s\n", msg);
+ else
+ DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
+}
+
+#ifdef CONFIG_P2P
+void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, size_t len)
+{
+ u16 wps_devicepassword_id = 0x0000;
+ uint wps_devicepassword_id_len = 0;
+ u8 wpsie[ 255 ] = { 0x00 }, p2p_ie[ 255 ] = { 0x00 };
+ uint p2p_ielen = 0;
+ uint wpsielen = 0;
+ u32 devinfo_contentlen = 0;
+ u8 devinfo_content[64] = { 0x00 };
+ u16 capability = 0;
+ uint capability_len = 0;
+
+ unsigned char category = RTW_WLAN_CATEGORY_PUBLIC;
+ u8 action = P2P_PUB_ACTION_ACTION;
+ u8 dialogToken = 1;
+ u32 p2poui = cpu_to_be32(P2POUI);
+ u8 oui_subtype = P2P_PROVISION_DISC_REQ;
+ u32 p2pielen = 0;
+#ifdef CONFIG_WFD
+ u32 wfdielen = 0;
+#endif //CONFIG_WFD
+
+ 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);
+ u8 *frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr));
+ size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr);
+
+
+ DBG_871X( "[%s] In\n", __FUNCTION__ );
+
+ //prepare for building provision_request frame
+ _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr1Ptr(buf), ETH_ALEN);
+ _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerDevAddr, GetAddr1Ptr(buf), ETH_ALEN);
+
+ pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON;
+
+ rtw_get_wps_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, wpsie, &wpsielen);
+ rtw_get_wps_attr_content( wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8*) &wps_devicepassword_id, &wps_devicepassword_id_len);
+ wps_devicepassword_id = be16_to_cpu( wps_devicepassword_id );
+
+ switch(wps_devicepassword_id)
+ {
+ case WPS_DPID_PIN:
+ pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL;
+ break;
+ case WPS_DPID_USER_SPEC:
+ pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_DISPLYA;
+ break;
+ case WPS_DPID_MACHINE_SPEC:
+ break;
+ case WPS_DPID_REKEY:
+ break;
+ case WPS_DPID_PBC:
+ pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON;
+ break;
+ case WPS_DPID_REGISTRAR_SPEC:
+ pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_KEYPAD;
+ break;
+ default:
+ break;
+ }
+
+
+ if ( rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, p2p_ie, &p2p_ielen ) )
+ {
+
+ rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, devinfo_content, &devinfo_contentlen);
+ rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&capability, &capability_len);
+
+ }
+
+
+ //start to build provision_request frame
+ _rtw_memset(wpsie, 0, sizeof(wpsie));
+ _rtw_memset(p2p_ie, 0, sizeof(p2p_ie));
+ p2p_ielen = 0;
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ return;
+ }
+
+
+ //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, pwdinfo->tx_prov_disc_info.peerDevAddr, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, pwdinfo->tx_prov_disc_info.peerDevAddr, ETH_ALEN);
+
+ 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);
+
+ 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, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen));
+
+
+ //build_prov_disc_request_p2p_ie
+ // P2P OUI
+ p2pielen = 0;
+ p2p_ie[ p2pielen++ ] = 0x50;
+ p2p_ie[ p2pielen++ ] = 0x6F;
+ p2p_ie[ p2pielen++ ] = 0x9A;
+ p2p_ie[ p2pielen++ ] = 0x09; // WFA P2P v1.0
+
+ // Commented by Albert 20110301
+ // According to the P2P Specification, the provision discovery request frame should contain 3 P2P attributes
+ // 1. P2P Capability
+ // 2. Device Info
+ // 3. Group ID ( When joining an operating P2P Group )
+
+ // P2P Capability ATTR
+ // Type:
+ p2p_ie[ p2pielen++ ] = P2P_ATTR_CAPABILITY;
+
+ // Length:
+ //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0002 );
+ RTW_PUT_LE16(p2p_ie + p2pielen, 0x0002);
+ p2pielen += 2;
+
+ // Value:
+ // Device Capability Bitmap, 1 byte
+ // Group Capability Bitmap, 1 byte
+ _rtw_memcpy(p2p_ie + p2pielen, &capability, 2);
+ p2pielen += 2;
+
+
+ // Device Info ATTR
+ // Type:
+ p2p_ie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO;
+
+ // Length:
+ // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes)
+ // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes)
+ //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len );
+ RTW_PUT_LE16(p2p_ie + p2pielen, devinfo_contentlen);
+ p2pielen += 2;
+
+ // Value:
+ _rtw_memcpy(p2p_ie + p2pielen, devinfo_content, devinfo_contentlen);
+ p2pielen += devinfo_contentlen;
+
+
+ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2p_ie, &p2p_ielen);
+ //p2pielen = build_prov_disc_request_p2p_ie( pwdinfo, pframe, NULL, 0, pwdinfo->tx_prov_disc_info.peerDevAddr);
+ //pframe += p2pielen;
+ pattrib->pktlen += p2p_ielen;
+
+ wpsielen = 0;
+ // WPS OUI
+ *(u32*) ( wpsie ) = cpu_to_be32( WPSOUI );
+ wpsielen += 4;
+
+ // WPS version
+ // Type:
+ *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_VER1 );
+ wpsielen += 2;
+
+ // Length:
+ *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0001 );
+ wpsielen += 2;
+
+ // Value:
+ wpsie[wpsielen++] = WPS_VERSION_1; // Version 1.0
+
+ // Config Method
+ // Type:
+ *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_CONF_METHOD );
+ wpsielen += 2;
+
+ // Length:
+ *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0002 );
+ wpsielen += 2;
+
+ // Value:
+ *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( pwdinfo->tx_prov_disc_info.wps_config_method_request );
+ wpsielen += 2;
+
+ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen );
+
+
+#ifdef CONFIG_WFD
+ wfdielen = build_provdisc_req_wfd_ie(pwdinfo, pframe);
+ pframe += wfdielen;
+ pattrib->pktlen += wfdielen;
+#endif //CONFIG_WFD
+
+ pattrib->last_txcmdsz = pattrib->pktlen;
+
+ //dump_mgntframe(padapter, pmgntframe);
+ if (dump_mgntframe_and_wait_ack(padapter, pmgntframe) != _SUCCESS)
+ DBG_8192C("%s, ack to\n", __func__);
+
+ //if(wps_devicepassword_id == WPS_DPID_REGISTRAR_SPEC)
+ //{
+ // DBG_8192C("waiting for p2p peer key-in PIN CODE\n");
+ // rtw_msleep_os(15000); // 15 sec for key in PIN CODE, workaround for GS2 before issuing Nego Req.
+ //}
+
+}
+
+static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct wireless_dev *wdev,
+#else
+ struct net_device *ndev,
+#endif
+ struct ieee80211_channel * channel,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+ enum nl80211_channel_type channel_type,
+#endif
+ unsigned int duration, u64 *cookie)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct net_device *ndev = wdev_to_ndev(wdev);
+#endif
+ s32 err = 0;
+ u8 remain_ch = (u8) ieee80211_frequency_to_channel(channel->center_freq);
+ u8 ready_on_channel = _FALSE;
+ _adapter *padapter;
+ struct rtw_wdev_priv *pwdev_priv;
+ struct mlme_ext_priv *pmlmeext;
+ struct wifidirect_info *pwdinfo;
+ struct cfg80211_wifidirect_info *pcfg80211_wdinfo;
+
+#ifndef CONFIG_RADIO_WORK
+ #define RTW_ROCH_DURATION_ENLARGE
+ #define RTW_ROCH_BACK_OP
+#endif
+
+ if (ndev == NULL) {
+ return -EINVAL;
+ }
+
+ padapter = (_adapter *)rtw_netdev_priv(ndev);
+ pwdev_priv = adapter_wdev_data(padapter);
+ pmlmeext = &padapter->mlmeextpriv;
+ pwdinfo = &padapter->wdinfo;
+ pcfg80211_wdinfo = &padapter->cfg80211_wdinfo;
+
+ *cookie = ATOMIC_INC_RETURN(&pcfg80211_wdinfo->ro_ch_cookie_gen);
+
+ DBG_871X(FUNC_ADPT_FMT" ch:%u duration:%d, cookie:0x%llx\n", FUNC_ADPT_ARG(padapter), remain_ch, duration, *cookie);
+
+ if(pcfg80211_wdinfo->is_ro_ch == _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
+ p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK);
+ }
+
+ pcfg80211_wdinfo->is_ro_ch = _TRUE;
+ pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time();
+
+ if(_FAIL == rtw_pwr_wakeup(padapter)) {
+ err = -EFAULT;
+ goto exit;
+ }
+
+ _rtw_memcpy(&pcfg80211_wdinfo->remain_on_ch_channel, channel, sizeof(struct ieee80211_channel));
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+ pcfg80211_wdinfo->remain_on_ch_type= channel_type;
+ #endif
+ pcfg80211_wdinfo->remain_on_ch_cookie= *cookie;
+
+ rtw_scan_abort(padapter);
+#ifdef CONFIG_CONCURRENT_MODE
+ if(rtw_buddy_adapter_up(padapter))
+ rtw_scan_abort(padapter->pbuddy_adapter);
+#endif //CONFIG_CONCURRENT_MODE
+
+ if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE)
+ {
+ DBG_871X("mlme state:0x%x\n", get_fwstate(&padapter->mlmepriv));
+ remain_ch = padapter->mlmeextpriv.cur_channel;
+ }
+#ifdef CONFIG_CONCURRENT_MODE
+ if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE)
+ {
+ DBG_871X("buddy_intf's mlme state:0x%x\n", get_fwstate(&(padapter->pbuddy_adapter->mlmepriv)));
+ remain_ch = padapter->pbuddy_adapter->mlmeextpriv.cur_channel;
+ }
+#endif /* CONFIG_CONCURRENT_MODE */
+
+ //if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ rtw_p2p_enable(padapter, P2P_ROLE_DEVICE);
+ adapter_wdev_data(padapter)->p2p_enabled = _TRUE;
+ padapter->wdinfo.listen_channel = remain_ch;
+ }
+ else
+ {
+ rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo));
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo));
+#endif
+ }
+
+
+ rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN);
+
+ #ifdef RTW_ROCH_DURATION_ENLARGE
+ if (duration < 400)
+ duration = duration * 3; /* extend from exper */
+ #endif
+
+#ifdef RTW_ROCH_BACK_OP
+#ifdef CONFIG_CONCURRENT_MODE
+ if(check_buddy_fwstate(padapter, _FW_LINKED) &&
+ (duration<pwdinfo->ext_listen_interval))
+ {
+ duration = duration + pwdinfo->ext_listen_interval;
+ }
+#endif
+#endif /* RTW_ROCH_BACK_OP */
+
+ pcfg80211_wdinfo->restore_channel = rtw_get_oper_ch(padapter);
+
+ if(rtw_ch_set_search_ch(pmlmeext->channel_set, remain_ch) >= 0) {
+#ifdef CONFIG_CONCURRENT_MODE
+ if ( check_buddy_fwstate(padapter, _FW_LINKED) )
+ {
+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
+
+ if((remain_ch != pbuddy_mlmeext->cur_channel) && !check_fwstate(&padapter->mlmepriv, _FW_LINKED))
+ {
+ if(ATOMIC_READ(&pwdev_priv->switch_ch_to)==1 ||
+ (remain_ch != pmlmeext->cur_channel))
+ {
+ if (check_buddy_fwstate(padapter, WIFI_FW_STATION_STATE)) {
+ DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__);
+ issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500);
+ }
+
+ ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
+
+ #ifdef RTW_ROCH_BACK_OP
+ DBG_8192C("%s, set switch ch timer, duration=%d\n", __func__, duration-pwdinfo->ext_listen_interval);
+ _set_timer(&pwdinfo->ap_p2p_switch_timer, duration-pwdinfo->ext_listen_interval);
+ #endif
+ }
+ }
+
+ ready_on_channel = _TRUE;
+ //pmlmeext->cur_channel = remain_ch;
+ //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
+ }else
+#endif //CONFIG_CONCURRENT_MODE
+ if(remain_ch != rtw_get_oper_ch(padapter) )
+ {
+ ready_on_channel = _TRUE;
+ //pmlmeext->cur_channel = remain_ch;
+ //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
+ }
+ } else {
+ DBG_871X("%s remain_ch:%u not in channel plan!!!!\n", __FUNCTION__, remain_ch);
+ }
+
+
+ //call this after other things have been done
+#ifdef CONFIG_CONCURRENT_MODE
+ if(ATOMIC_READ(&pwdev_priv->ro_ch_to)==1 ||
+ (remain_ch != rtw_get_oper_ch(padapter)))
+ {
+ u8 co_channel = 0xff;
+ ATOMIC_SET(&pwdev_priv->ro_ch_to, 0);
+#endif
+
+ if(ready_on_channel == _TRUE)
+ {
+ if ( !check_fwstate(&padapter->mlmepriv, _FW_LINKED ) )
+ {
+ pmlmeext->cur_channel = remain_ch;
+
+#ifdef CONFIG_CONCURRENT_MODE
+ co_channel = rtw_get_oper_ch(padapter);
+
+ if(co_channel !=remain_ch)
+#endif
+ {
+ //if (!padapter->mlmepriv.LinkDetectInfo.bBusyTraffic)
+ set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
+ }
+ }
+ }
+ DBG_8192C("%s, set ro ch timer, duration=%d\n", __func__, duration);
+ _set_timer( &pcfg80211_wdinfo->remain_on_ch_timer, duration);
+
+#ifdef CONFIG_CONCURRENT_MODE
+ }
+#endif
+
+ rtw_cfg80211_ready_on_channel(padapter, *cookie, channel, channel_type, duration, GFP_KERNEL);
+
+exit:
+ if (err) {
+ pcfg80211_wdinfo->is_ro_ch = _FALSE;
+ pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time();
+ }
+
+ return err;
+}
+
+static s32 cfg80211_rtw_cancel_remain_on_channel(struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct wireless_dev *wdev,
+#else
+ struct net_device *ndev,
+#endif
+ u64 cookie)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct net_device *ndev = wdev_to_ndev(wdev);
+#endif
+ s32 err = 0;
+ _adapter *padapter;
+ struct rtw_wdev_priv *pwdev_priv;
+ struct wifidirect_info *pwdinfo;
+ struct cfg80211_wifidirect_info *pcfg80211_wdinfo;
+
+ if (ndev == NULL) {
+ err = -EINVAL;
+ goto exit;
+ }
+
+ padapter = (_adapter *)rtw_netdev_priv(ndev);
+ pwdev_priv = adapter_wdev_data(padapter);
+ pwdinfo = &padapter->wdinfo;
+ pcfg80211_wdinfo = &padapter->cfg80211_wdinfo;
+
+ DBG_871X(FUNC_ADPT_FMT" cookie:0x%llx\n", FUNC_ADPT_ARG(padapter), cookie);
+
+ if (pcfg80211_wdinfo->is_ro_ch == _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);
+ }
+
+ #if 0
+ // Disable P2P Listen State
+ if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
+ {
+ if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+ rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE);
+ _rtw_memset(pwdinfo, 0x00, sizeof(struct wifidirect_info));
+ }
+ }
+ else
+ #endif
+ {
+ rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo));
+#endif
+ }
+
+ pcfg80211_wdinfo->is_ro_ch = _FALSE;
+ pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time();
+
+exit:
+ return err;
+}
+
+#endif //CONFIG_P2P
+
+static int _cfg80211_rtw_mgmt_tx(_adapter *padapter, u8 tx_ch, const u8 *buf, size_t len)
+{
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ unsigned char *pframe;
+ int ret = _FAIL;
+ bool ack = _TRUE;
+ struct rtw_ieee80211_hdr *pwlanhdr;
+ struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+#ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo = &padapter->wdinfo;
+#endif //CONFIG_P2P
+ //struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo;
+
+ rtw_set_scan_deny(padapter, 1000);
+
+ rtw_scan_abort(padapter);
+ #ifdef CONFIG_CONCURRENT_MODE
+ if(rtw_buddy_adapter_up(padapter))
+ rtw_scan_abort(padapter->pbuddy_adapter);
+ #endif /* CONFIG_CONCURRENT_MODE */
+#ifdef CONFIG_P2P
+ if (padapter->cfg80211_wdinfo.is_ro_ch == _TRUE) {
+ //DBG_8192C("%s, cancel ro ch timer\n", __func__);
+ //_cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer);
+ //padapter->cfg80211_wdinfo.is_ro_ch = _FALSE;
+ #ifdef CONFIG_CONCURRENT_MODE
+ if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
+ {
+ DBG_8192C("%s, extend ro ch time\n", __func__);
+ _set_timer( &padapter->cfg80211_wdinfo.remain_on_ch_timer, pwdinfo->ext_listen_period);
+ }
+ #endif //CONFIG_CONCURRENT_MODE
+ }
+#endif //CONFIG_P2P
+#ifdef CONFIG_CONCURRENT_MODE
+ if (check_buddy_fwstate(padapter, _FW_LINKED )) {
+ u8 co_channel=0xff;
+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
+
+ co_channel = rtw_get_oper_ch(padapter);
+
+ if (tx_ch != pbuddy_mlmeext->cur_channel) {
+
+ u16 ext_listen_period;
+
+ if (ATOMIC_READ(&pwdev_priv->switch_ch_to)==1) {
+ if (check_buddy_fwstate(padapter, WIFI_FW_STATION_STATE)) {
+ DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__);
+ issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500);
+ }
+
+ ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
+
+ //DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, pwdinfo->ext_listen_period);
+ //_set_timer(&pwdinfo->ap_p2p_switch_timer, pwdinfo->ext_listen_period);
+ }
+
+ if (check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
+ {
+ ext_listen_period = 500;// 500ms
+ }
+ else
+ {
+ ext_listen_period = pwdinfo->ext_listen_period;
+ }
+
+ DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, ext_listen_period);
+ _set_timer(&pwdinfo->ap_p2p_switch_timer, ext_listen_period);
+
+ }
+
+ if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
+ pmlmeext->cur_channel = tx_ch;
+
+ if (tx_ch != co_channel)
+ set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
+ }else
+#endif //CONFIG_CONCURRENT_MODE
+ //if (tx_ch != pmlmeext->cur_channel) {
+ if(tx_ch != rtw_get_oper_ch(padapter)) {
+ if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
+ pmlmeext->cur_channel = tx_ch;
+ set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
+ }
+
+ //starting alloc mgmt frame to dump it
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+ //ret = -ENOMEM;
+ ret = _FAIL;
+ goto exit;
+ }
+
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ update_mgntframe_attrib(padapter, pattrib);
+ pattrib->retry_ctrl = _FALSE;
+
+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+
+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+
+ _rtw_memcpy(pframe, (void*)buf, len);
+ pattrib->pktlen = len;
+
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+ //update seq number
+ pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
+ pattrib->seqnum = pmlmeext->mgnt_seq;
+ pmlmeext->mgnt_seq++;
+
+#ifdef CONFIG_WFD
+ {
+ struct wifi_display_info *pwfd_info;
+
+ pwfd_info = padapter->wdinfo.wfd_info;
+
+ if ( _TRUE == pwfd_info->wfd_enable )
+ {
+ rtw_append_wfd_ie( padapter, pframe, &pattrib->pktlen );
+ }
+ }
+#endif // CONFIG_WFD
+
+ pattrib->last_txcmdsz = pattrib->pktlen;
+
+ if (dump_mgntframe_and_wait_ack(padapter, pmgntframe) != _SUCCESS)
+ {
+ ack = _FALSE;
+ ret = _FAIL;
+
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, ack == _FAIL\n", __func__);
+ #endif
+ }
+ else
+ {
+
+#ifdef CONFIG_XMIT_ACK
+ rtw_msleep_os(50);
+#endif
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, ack=%d, ok!\n", __func__, ack);
+ #endif
+ ret = _SUCCESS;
+ }
+
+exit:
+
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, ret=%d\n", __func__, ret);
+ #endif
+
+ return ret;
+
+}
+
+static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct wireless_dev *wdev,
+#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)
+ bool offchan,
+ #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)
+ unsigned int wait,
+ #endif
+ const u8 *buf, size_t len,
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ bool no_cck,
+ #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;
+ u32 dump_limit = RTW_MAX_MGMT_TX_CNT;
+ u32 dump_cnt = 0;
+ bool ack = _TRUE;
+ u8 tx_ch = (u8)ieee80211_frequency_to_channel(chan->center_freq);
+ u8 category, action;
+ int type = (-1);
+ u32 start = rtw_get_current_time();
+ _adapter *padapter;
+ struct rtw_wdev_priv *pwdev_priv;
+
+ if (ndev == NULL) {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ padapter = (_adapter *)rtw_netdev_priv(ndev);
+ pwdev_priv = adapter_wdev_data(padapter);
+
+ /* cookie generation */
+ *cookie = (unsigned long) buf;
+
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_871X(FUNC_ADPT_FMT" len=%zu, ch=%d"
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+ ", ch_type=%d"
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ ", channel_type_valid=%d"
+ #endif
+ #endif
+ "\n", FUNC_ADPT_ARG(padapter),
+ len, tx_ch
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+ , channel_type
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ , channel_type_valid
+ #endif
+ #endif
+ );
+#endif /* CONFIG_DEBUG_CFG80211 */
+
+ /* indicate ack before issue frame to avoid racing with rsp frame */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ rtw_cfg80211_mgmt_tx_status(padapter, *cookie, buf, len, ack, GFP_KERNEL);
+#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35))
+ cfg80211_action_tx_status(ndev, *cookie, buf, len, ack, GFP_KERNEL);
+#endif
+
+ if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) {
+ DBG_8192C(FUNC_ADPT_FMT" frame_control:0x%x\n", FUNC_ADPT_ARG(padapter),
+ le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl));
+ goto exit;
+ }
+
+ DBG_8192C("RTW_Tx:tx_ch=%d, da="MAC_FMT"\n", tx_ch, MAC_ARG(GetAddr1Ptr(buf)));
+ #ifdef CONFIG_P2P
+ if((type = rtw_p2p_check_frames(padapter, buf, len, _TRUE)) >= 0) {
+ goto dump;
+ }
+ #endif
+ if (category == RTW_WLAN_CATEGORY_PUBLIC)
+ DBG_871X("RTW_Tx:%s\n", action_public_str(action));
+ else
+ DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action);
+
+dump:
+
+ rtw_ps_deny(padapter, PS_DENY_MGNT_TX);
+ if(_FAIL == rtw_pwr_wakeup(padapter)) {
+ ret = -EFAULT;
+ goto cancel_ps_deny;
+ }
+
+ while (1) {
+ u32 sleep_ms = 0;
+ u32 retry_guarantee_ms = 0;
+
+ dump_cnt++;
+ tx_ret = _cfg80211_rtw_mgmt_tx(padapter, tx_ch, buf, len);
+
+ switch (action) {
+ case ACT_PUBLIC_GAS_INITIAL_REQ:
+ case ACT_PUBLIC_GAS_INITIAL_RSP:
+ sleep_ms = 50;
+ retry_guarantee_ms = RTW_MAX_MGMT_TX_MS_GAS;
+ }
+
+ if (tx_ret == _SUCCESS
+ || (dump_cnt >= dump_limit && rtw_get_passing_time_ms(start) >= retry_guarantee_ms))
+ break;
+
+ if (sleep_ms > 0)
+ rtw_msleep_os(sleep_ms);
+ }
+
+ if (tx_ret != _SUCCESS || dump_cnt > 1) {
+ DBG_871X(FUNC_ADPT_FMT" %s (%d/%d) in %d ms\n", FUNC_ADPT_ARG(padapter),
+ tx_ret==_SUCCESS?"OK":"FAIL", dump_cnt, dump_limit, rtw_get_passing_time_ms(start));
+ }
+
+ switch (type) {
+ case P2P_GO_NEGO_CONF:
+ rtw_clear_scan_deny(padapter);
+ break;
+ case P2P_INVIT_RESP:
+ if (pwdev_priv->invit_info.flags & BIT(0)
+ && pwdev_priv->invit_info.status == 0)
+ {
+ DBG_871X(FUNC_ADPT_FMT" agree with invitation of persistent group\n",
+ FUNC_ADPT_ARG(padapter));
+ rtw_set_scan_deny(padapter, 5000);
+ rtw_pwr_wakeup_ex(padapter, 5000);
+ rtw_clear_scan_deny(padapter);
+ }
+ break;
+ }
+
+cancel_ps_deny:
+ rtw_ps_deny_cancel(padapter, PS_DENY_MGNT_TX);
+exit:
+ return ret;
+}
+
+static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
+ struct wireless_dev *wdev,
+#else
+ struct net_device *ndev,
+#endif
+ u16 frame_type, bool reg)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ struct net_device *ndev = wdev_to_ndev(wdev);
+#endif
+ _adapter *adapter;
+
+ if (ndev == NULL)
+ goto exit;
+
+ adapter = (_adapter *)rtw_netdev_priv(ndev);
+
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_871X(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter),
+ frame_type, reg);
+#endif
+
+ if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ))
+ return;
+exit:
+ return;
+}
+
+#if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy,
+ struct net_device *ndev,
+ u8 *peer,
+ u8 action_code,
+ u8 dialog_token,
+ u16 status_code,
+ const u8 *buf,
+ size_t len)
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ int ret = 0;
+ struct tdls_txmgmt txmgmt;
+
+ //TDLS: discard wpa_supplicant's frame mgmt
+ DBG_871X("%s %d\n", __FUNCTION__, __LINE__);
+ return 0;
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ _rtw_memcpy(txmgmt.peer, peer, ETH_ALEN);
+ txmgmt.action_code = action_code;
+ txmgmt.dialog_token= dialog_token;
+ txmgmt.status_code = status_code;
+ txmgmt.len = len;
+ txmgmt.buf = (u8 *)rtw_malloc(txmgmt.len);
+ if (txmgmt.buf == NULL)
+ {
+ ret = -ENOMEM;
+ goto bad;
+ }
+ _rtw_memcpy(txmgmt.buf, (void*)buf, txmgmt.len);
+ txmgmt.external_support = _TRUE;
+
+//TDLS: Debug purpose
+#if 0
+ DBG_871X("%s %d\n", __FUNCTION__, __LINE__);
+ DBG_871X("peer:"MAC_FMT" ", MAC_ARG(txmgmt.peer));
+ DBG_871X("action code:%d ", txmgmt.action_code);
+ DBG_871X("dialog:%d ", txmgmt.dialog_token);
+ DBG_871X("status code:%d\n", txmgmt.status_code);
+ if( txmgmt.len > 0 )
+ {
+ int i=0;
+ for(;i < len; i++)
+ DBG_871X("%02x ", *(txmgmt.buf+i));
+ DBG_871X("\n len:%d\n", txmgmt.len);
+ }
+#endif
+
+ switch(txmgmt.action_code) {
+ case TDLS_SETUP_REQUEST:
+ issue_tdls_setup_req(padapter, &txmgmt, _TRUE);
+ break;
+ case TDLS_SETUP_RESPONSE:
+ issue_tdls_setup_rsp(padapter, &txmgmt);
+ break;
+ case TDLS_SETUP_CONFIRM:
+ issue_tdls_setup_cfm(padapter, &txmgmt);
+ break;
+ case TDLS_TEARDOWN:
+ break;
+ case TDLS_DISCOVERY_REQUEST:
+ issue_tdls_dis_req(padapter, &txmgmt);
+ break;
+ }
+
+bad:
+ if (txmgmt.buf)
+ {
+ rtw_mfree(txmgmt.buf, txmgmt.len);
+ }
+
+ return ret;
+}
+
+static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy,
+ struct net_device *ndev,
+ u8 *peer,
+ enum nl80211_tdls_operation oper)
+{
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct tdls_txmgmt txmgmt;
+ struct sta_info *ptdls_sta = NULL;
+
+ DBG_871X(FUNC_NDEV_FMT", nl80211_tdls_operation:%d\n", FUNC_NDEV_ARG(ndev), oper);
+
+#ifdef CONFIG_LPS
+ rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1);
+#endif //CONFIG_LPS
+
+ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
+ if(peer)
+ _rtw_memcpy(txmgmt.peer, peer, ETH_ALEN);
+#if 0
+ CFG80211_TDLS_DISCOVERY_REQ,
+ CFG80211_TDLS_SETUP,
+ CFG80211_TDLS_TEARDOWN,
+ CFG80211_TDLS_ENABLE_LINK,
+ CFG80211_TDLS_DISABLE_LINK,
+ CFG80211_TDLS_ENABLE,
+ CFG80211_TDLS_DISABLE
+#endif
+ switch(oper) {
+ case NL80211_TDLS_DISCOVERY_REQ:
+ issue_tdls_dis_req(padapter, &txmgmt);
+ break;
+ case NL80211_TDLS_SETUP:
+#ifdef CONFIG_WFD
+ if ( _AES_ != padapter->securitypriv.dot11PrivacyAlgrthm )
+ {
+ if ( padapter->wdinfo.wfd_tdls_weaksec == _TRUE)
+ issue_tdls_setup_req(padapter, &txmgmt, _TRUE);
+ else
+ DBG_871X( "[%s] Current link is not AES, SKIP sending the tdls setup request!!\n", __FUNCTION__ );
+ }
+ else
+#endif // CONFIG_WFD
+ {
+ issue_tdls_setup_req(padapter, &txmgmt, _TRUE);
+ }
+ break;
+ case NL80211_TDLS_TEARDOWN:
+ ptdls_sta = rtw_get_stainfo( &(padapter->stapriv), txmgmt.peer);
+ if(ptdls_sta != NULL)
+ {
+ txmgmt.status_code = _RSON_TDLS_TEAR_UN_RSN_;
+ issue_tdls_teardown(padapter, &txmgmt, _FALSE);
+ }
+ else
+ DBG_871X( "TDLS peer not found\n");
+ break;
+ case NL80211_TDLS_ENABLE_LINK:
+ break;
+ case NL80211_TDLS_DISABLE_LINK:
+ break;
+ }
+ return 0;
+}
+#endif /* CONFIG_TDLS */
+
+static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, int len)
+{
+ int ret = 0;
+ uint wps_ielen = 0;
+ u8 *wps_ie;
+ u32 p2p_ielen = 0;
+ u8 wps_oui[8]={0x0,0x50,0xf2,0x04};
+ u8 *p2p_ie;
+ u32 wfd_ielen = 0;
+ u8 *wfd_ie;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+
+ DBG_871X(FUNC_NDEV_FMT" ielen=%d\n", FUNC_NDEV_ARG(ndev), len);
+
+ if(len>0)
+ {
+ if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
+ {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("bcn_wps_ielen=%d\n", wps_ielen);
+ #endif
+
+ if(pmlmepriv->wps_beacon_ie)
+ {
+ u32 free_len = pmlmepriv->wps_beacon_ie_len;
+ pmlmepriv->wps_beacon_ie_len = 0;
+ rtw_mfree(pmlmepriv->wps_beacon_ie, free_len);
+ pmlmepriv->wps_beacon_ie = NULL;
+ }
+
+ pmlmepriv->wps_beacon_ie = rtw_malloc(wps_ielen);
+ if ( pmlmepriv->wps_beacon_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+
+ _rtw_memcpy(pmlmepriv->wps_beacon_ie, wps_ie, wps_ielen);
+ pmlmepriv->wps_beacon_ie_len = wps_ielen;
+
+ update_beacon(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, _TRUE);
+
+ }
+
+ //buf += wps_ielen;
+ //len -= wps_ielen;
+
+ #ifdef CONFIG_P2P
+ if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen)))
+ {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("bcn_p2p_ielen=%d\n", p2p_ielen);
+ #endif
+
+ if(pmlmepriv->p2p_beacon_ie)
+ {
+ u32 free_len = pmlmepriv->p2p_beacon_ie_len;
+ pmlmepriv->p2p_beacon_ie_len = 0;
+ rtw_mfree(pmlmepriv->p2p_beacon_ie, free_len);
+ pmlmepriv->p2p_beacon_ie = NULL;
+ }
+
+ pmlmepriv->p2p_beacon_ie = rtw_malloc(p2p_ielen);
+ if ( pmlmepriv->p2p_beacon_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+
+ _rtw_memcpy(pmlmepriv->p2p_beacon_ie, p2p_ie, p2p_ielen);
+ pmlmepriv->p2p_beacon_ie_len = p2p_ielen;
+
+ }
+ #endif //CONFIG_P2P
+
+ //buf += p2p_ielen;
+ //len -= p2p_ielen;
+
+ #ifdef CONFIG_WFD
+ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen))
+ {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("bcn_wfd_ielen=%d\n", wfd_ielen);
+ #endif
+
+ if(pmlmepriv->wfd_beacon_ie)
+ {
+ u32 free_len = pmlmepriv->wfd_beacon_ie_len;
+ pmlmepriv->wfd_beacon_ie_len = 0;
+ rtw_mfree(pmlmepriv->wfd_beacon_ie, free_len);
+ pmlmepriv->wfd_beacon_ie = NULL;
+ }
+
+ pmlmepriv->wfd_beacon_ie = rtw_malloc(wfd_ielen);
+ if ( pmlmepriv->wfd_beacon_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len);
+ }
+ #endif //CONFIG_WFD
+
+ pmlmeext->bstart_bss = _TRUE;
+
+ }
+
+ return ret;
+
+}
+
+static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *buf, int len)
+{
+ int ret = 0;
+ uint wps_ielen = 0;
+ u8 *wps_ie;
+ u32 p2p_ielen = 0;
+ u8 *p2p_ie;
+ u32 wfd_ielen = 0;
+ u8 *wfd_ie;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(net);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, ielen=%d\n", __func__, len);
+#endif
+
+ if(len>0)
+ {
+ if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
+ {
+ uint attr_contentlen = 0;
+ u16 uconfig_method, *puconfig_method = NULL;
+
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("probe_resp_wps_ielen=%d\n", wps_ielen);
+ #endif
+
+ if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS))
+ {
+ u8 sr = 0;
+ rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL);
+
+ if (sr != 0)
+ {
+ DBG_871X("%s, got sr\n", __func__);
+ }
+ else
+ {
+ DBG_8192C("GO mode process WPS under site-survey, sr no set\n");
+ return ret;
+ }
+ }
+
+ if(pmlmepriv->wps_probe_resp_ie)
+ {
+ u32 free_len = pmlmepriv->wps_probe_resp_ie_len;
+ pmlmepriv->wps_probe_resp_ie_len = 0;
+ rtw_mfree(pmlmepriv->wps_probe_resp_ie, free_len);
+ pmlmepriv->wps_probe_resp_ie = NULL;
+ }
+
+ pmlmepriv->wps_probe_resp_ie = rtw_malloc(wps_ielen);
+ if ( pmlmepriv->wps_probe_resp_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+
+ //add PUSH_BUTTON config_method by driver self in wpsie of probe_resp at GO Mode
+ if ( (puconfig_method = (u16*)rtw_get_wps_attr_content( wps_ie, wps_ielen, WPS_ATTR_CONF_METHOD , NULL, &attr_contentlen)) != NULL )
+ {
+ //struct registry_priv *pregistrypriv = &padapter->registrypriv;
+ struct wireless_dev *wdev = padapter->rtw_wdev;
+
+ #ifdef CONFIG_DEBUG_CFG80211
+ //printk("config_method in wpsie of probe_resp = 0x%x\n", be16_to_cpu(*puconfig_method));
+ #endif
+
+ //if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ if(wdev->iftype != NL80211_IFTYPE_P2P_GO) //for WIFI-DIRECT LOGO 4.2.2, AUTO GO can't set PUSH_BUTTON flags
+ {
+ uconfig_method = WPS_CM_PUSH_BUTTON;
+ uconfig_method = cpu_to_be16( uconfig_method );
+
+ *puconfig_method |= uconfig_method;
+ }
+ #endif
+ }
+
+ _rtw_memcpy(pmlmepriv->wps_probe_resp_ie, wps_ie, wps_ielen);
+ pmlmepriv->wps_probe_resp_ie_len = wps_ielen;
+
+ }
+
+ //buf += wps_ielen;
+ //len -= wps_ielen;
+
+ #ifdef CONFIG_P2P
+ if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen)))
+ {
+ u8 is_GO = _FALSE;
+ u32 attr_contentlen = 0;
+ u16 cap_attr=0;
+
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("probe_resp_p2p_ielen=%d\n", p2p_ielen);
+ #endif
+
+ //Check P2P Capability ATTR
+ if( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&cap_attr, (uint*) &attr_contentlen) )
+ {
+ u8 grp_cap=0;
+ //DBG_8192C( "[%s] Got P2P Capability Attr!!\n", __FUNCTION__ );
+ cap_attr = le16_to_cpu(cap_attr);
+ grp_cap = (u8)((cap_attr >> 8)&0xff);
+
+ is_GO = (grp_cap&BIT(0)) ? _TRUE:_FALSE;
+
+ if(is_GO)
+ DBG_8192C("Got P2P Capability Attr, grp_cap=0x%x, is_GO\n", grp_cap);
+ }
+
+
+ if(is_GO == _FALSE)
+ {
+ if(pmlmepriv->p2p_probe_resp_ie)
+ {
+ u32 free_len = pmlmepriv->p2p_probe_resp_ie_len;
+ pmlmepriv->p2p_probe_resp_ie_len = 0;
+ rtw_mfree(pmlmepriv->p2p_probe_resp_ie, free_len);
+ pmlmepriv->p2p_probe_resp_ie = NULL;
+ }
+
+ pmlmepriv->p2p_probe_resp_ie = rtw_malloc(p2p_ielen);
+ if ( pmlmepriv->p2p_probe_resp_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+ _rtw_memcpy(pmlmepriv->p2p_probe_resp_ie, p2p_ie, p2p_ielen);
+ pmlmepriv->p2p_probe_resp_ie_len = p2p_ielen;
+ }
+ else
+ {
+ if(pmlmepriv->p2p_go_probe_resp_ie)
+ {
+ u32 free_len = pmlmepriv->p2p_go_probe_resp_ie_len;
+ pmlmepriv->p2p_go_probe_resp_ie_len = 0;
+ rtw_mfree(pmlmepriv->p2p_go_probe_resp_ie, free_len);
+ pmlmepriv->p2p_go_probe_resp_ie = NULL;
+ }
+
+ pmlmepriv->p2p_go_probe_resp_ie = rtw_malloc(p2p_ielen);
+ if ( pmlmepriv->p2p_go_probe_resp_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+ _rtw_memcpy(pmlmepriv->p2p_go_probe_resp_ie, p2p_ie, p2p_ielen);
+ pmlmepriv->p2p_go_probe_resp_ie_len = p2p_ielen;
+ }
+
+ }
+ #endif //CONFIG_P2P
+
+ //buf += p2p_ielen;
+ //len -= p2p_ielen;
+
+ #ifdef CONFIG_WFD
+ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen))
+ {
+ #ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("probe_resp_wfd_ielen=%d\n", wfd_ielen);
+ #endif
+
+ if(pmlmepriv->wfd_probe_resp_ie)
+ {
+ u32 free_len = pmlmepriv->wfd_probe_resp_ie_len;
+ pmlmepriv->wfd_probe_resp_ie_len = 0;
+ rtw_mfree(pmlmepriv->wfd_probe_resp_ie, free_len);
+ pmlmepriv->wfd_probe_resp_ie = NULL;
+ }
+
+ pmlmepriv->wfd_probe_resp_ie = rtw_malloc(wfd_ielen);
+ if ( pmlmepriv->wfd_probe_resp_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len);
+ }
+ #endif //CONFIG_WFD
+
+ }
+
+ return ret;
+
+}
+
+static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, char *buf, int len)
+{
+ int ret = 0;
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(net);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+
+ DBG_8192C("%s, ielen=%d\n", __func__, len);
+
+ if(len>0)
+ {
+ if(pmlmepriv->wps_assoc_resp_ie)
+ {
+ u32 free_len = pmlmepriv->wps_assoc_resp_ie_len;
+ pmlmepriv->wps_assoc_resp_ie_len = 0;
+ rtw_mfree(pmlmepriv->wps_assoc_resp_ie, free_len);
+ pmlmepriv->wps_assoc_resp_ie = NULL;
+ }
+
+ pmlmepriv->wps_assoc_resp_ie = rtw_malloc(len);
+ if ( pmlmepriv->wps_assoc_resp_ie == NULL) {
+ DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__);
+ return -EINVAL;
+
+ }
+ _rtw_memcpy(pmlmepriv->wps_assoc_resp_ie, buf, len);
+ pmlmepriv->wps_assoc_resp_ie_len = len;
+ }
+
+ return ret;
+
+}
+
+int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len,
+ int type)
+{
+ int ret = 0;
+ uint wps_ielen = 0;
+ u32 p2p_ielen = 0;
+
+#ifdef CONFIG_DEBUG_CFG80211
+ DBG_8192C("%s, ielen=%d\n", __func__, len);
+#endif
+
+ if( (rtw_get_wps_ie(buf, len, NULL, &wps_ielen) && (wps_ielen>0))
+ #ifdef CONFIG_P2P
+ || (rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen) && (p2p_ielen>0))
+ #endif
+ )
+ {
+ if (net != NULL)
+ {
+ switch (type)
+ {
+ case 0x1: //BEACON
+ ret = rtw_cfg80211_set_beacon_wpsp2pie(net, buf, len);
+ break;
+ case 0x2: //PROBE_RESP
+ ret = rtw_cfg80211_set_probe_resp_wpsp2pie(net, buf, len);
+ break;
+ case 0x4: //ASSOC_RESP
+ ret = rtw_cfg80211_set_assoc_resp_wpsp2pie(net, buf, len);
+ break;
+ }
+ }
+ }
+
+ return ret;
+
+}
+
+static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type)
+{
+
+#define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */
+#define MAX_BIT_RATE_40MHZ_MCS7 150 /* Mbps */
+
+ ht_cap->ht_supported = _TRUE;
+
+ ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
+ IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20 |
+ IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU;
+
+ /*
+ *Maximum length of AMPDU that the STA can receive.
+ *Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
+ */
+ ht_cap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
+
+ /*Minimum MPDU start spacing , */
+ ht_cap->ampdu_density = IEEE80211_HT_MPDU_DENSITY_16;
+
+ ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
+
+ /*
+ *hw->wiphy->bands[IEEE80211_BAND_2GHZ]
+ *base on ant_num
+ *rx_mask: RX mask
+ *if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7
+ *if rx_ant =2 rx_mask[1]=0xff;==>MCS8-MCS15
+ *if rx_ant >=3 rx_mask[2]=0xff;
+ *if BW_40 rx_mask[4]=0x01;
+ *highest supported RX rate
+ */
+ if(rf_type == RF_1T1R)
+ {
+ ht_cap->mcs.rx_mask[0] = 0xFF;
+ ht_cap->mcs.rx_mask[1] = 0x00;
+ ht_cap->mcs.rx_mask[4] = 0x01;
+
+ ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS7;
+ }
+ else if((rf_type == RF_1T2R) || (rf_type==RF_2T2R))
+ {
+ ht_cap->mcs.rx_mask[0] = 0xFF;
+ ht_cap->mcs.rx_mask[1] = 0xFF;
+ ht_cap->mcs.rx_mask[4] = 0x01;
+
+ ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS15;
+ }
+ else
+ {
+ DBG_8192C("%s, error rf_type=%d\n", __func__, rf_type);
+ }
+
+}
+
+void rtw_cfg80211_init_wiphy(_adapter *padapter)
+{
+ u8 rf_type;
+ struct ieee80211_supported_band *bands;
+ struct wireless_dev *pwdev = padapter->rtw_wdev;
+ struct wiphy *wiphy = pwdev->wiphy;
+
+ rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
+
+ DBG_8192C("%s:rf_type=%d\n", __func__, rf_type);
+
+ if (padapter->registrypriv.wireless_mode & WIRELESS_11G)
+ {
+ bands = wiphy->bands[IEEE80211_BAND_2GHZ];
+ if(bands)
+ rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type);
+ }
+
+ if (padapter->registrypriv.wireless_mode & WIRELESS_11A)
+ {
+ bands = wiphy->bands[IEEE80211_BAND_5GHZ];
+ if(bands)
+ rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type);
+ }
+
+ /* init regulary domain */
+ rtw_regd_init(padapter);
+
+ /* copy mac_addr to wiphy */
+ _rtw_memcpy(wiphy->perm_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
+
+}
+
+/*
+struct ieee80211_iface_limit rtw_limits[] = {
+ { .max = 1, .types = BIT(NL80211_IFTYPE_STATION)
+ | BIT(NL80211_IFTYPE_ADHOC)
+#ifdef CONFIG_AP_MODE
+ | BIT(NL80211_IFTYPE_AP)
+#endif
+#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE))
+ | BIT(NL80211_IFTYPE_P2P_CLIENT)
+ | BIT(NL80211_IFTYPE_P2P_GO)
+#endif
+ },
+ {.max = 1, .types = BIT(NL80211_IFTYPE_MONITOR)},
+};
+
+struct ieee80211_iface_combination rtw_combinations = {
+ .limits = rtw_limits,
+ .n_limits = ARRAY_SIZE(rtw_limits),
+ .max_interfaces = 2,
+ .num_different_channels = 1,
+};
+*/
+
+static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy)
+{
+
+ wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
+
+ wiphy->max_scan_ssids = RTW_SSID_SCAN_AMOUNT;
+ wiphy->max_scan_ie_len = RTW_SCAN_IE_LEN_MAX;
+ wiphy->max_num_pmkids = RTW_MAX_NUM_PMKIDS;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
+ wiphy->max_remain_on_channel_duration = RTW_MAX_REMAIN_ON_CHANNEL_DURATION;
+#endif
+
+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
+ | BIT(NL80211_IFTYPE_ADHOC)
+#ifdef CONFIG_AP_MODE
+ | BIT(NL80211_IFTYPE_AP)
+ #ifndef CONFIG_RADIO_WORK
+ | BIT(NL80211_IFTYPE_MONITOR)
+ #endif
+#endif
+#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE))
+ | BIT(NL80211_IFTYPE_P2P_CLIENT)
+ | BIT(NL80211_IFTYPE_P2P_GO)
+#endif
+ ;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+#ifdef CONFIG_AP_MODE
+ wiphy->mgmt_stypes = rtw_cfg80211_default_mgmt_stypes;
+#endif //CONFIG_AP_MODE
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
+ #ifndef CONFIG_RADIO_WORK
+ wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
+ #endif
+#endif
+
+ /*
+ wiphy->iface_combinations = &rtw_combinations;
+ wiphy->n_iface_combinations = 1;
+ */
+
+ wiphy->cipher_suites = rtw_cipher_suites;
+ wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites);
+
+ /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */
+ wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ);
+#ifdef CONFIG_IEEE80211_BAND_5GHZ
+ /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */
+ wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ);
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
+ wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS;
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+ wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME;
+#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))
+ wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
+ //wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
+#endif /* CONFIG_TDLS */
+
+ if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE)
+ wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
+ else
+ wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ //wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
+#endif
+}
+
+static struct cfg80211_ops rtw_cfg80211_ops = {
+ .change_virtual_intf = cfg80211_rtw_change_iface,
+ .add_key = cfg80211_rtw_add_key,
+ .get_key = cfg80211_rtw_get_key,
+ .del_key = cfg80211_rtw_del_key,
+ .set_default_key = cfg80211_rtw_set_default_key,
+ .get_station = cfg80211_rtw_get_station,
+ .scan = cfg80211_rtw_scan,
+ .set_wiphy_params = cfg80211_rtw_set_wiphy_params,
+ .connect = cfg80211_rtw_connect,
+ .disconnect = cfg80211_rtw_disconnect,
+ .join_ibss = cfg80211_rtw_join_ibss,
+ .leave_ibss = cfg80211_rtw_leave_ibss,
+ .set_tx_power = cfg80211_rtw_set_txpower,
+ .get_tx_power = cfg80211_rtw_get_txpower,
+ .set_power_mgmt = cfg80211_rtw_set_power_mgmt,
+ .set_pmksa = cfg80211_rtw_set_pmksa,
+ .del_pmksa = cfg80211_rtw_del_pmksa,
+ .flush_pmksa = cfg80211_rtw_flush_pmksa,
+
+#ifdef CONFIG_AP_MODE
+ .add_virtual_intf = cfg80211_rtw_add_virtual_intf,
+ .del_virtual_intf = cfg80211_rtw_del_virtual_intf,
+
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE)
+ .add_beacon = cfg80211_rtw_add_beacon,
+ .set_beacon = cfg80211_rtw_set_beacon,
+ .del_beacon = cfg80211_rtw_del_beacon,
+ #else
+ .start_ap = cfg80211_rtw_start_ap,
+ .change_beacon = cfg80211_rtw_change_beacon,
+ .stop_ap = cfg80211_rtw_stop_ap,
+ #endif
+
+ .add_station = cfg80211_rtw_add_station,
+ .del_station = cfg80211_rtw_del_station,
+ .change_station = cfg80211_rtw_change_station,
+ .dump_station = cfg80211_rtw_dump_station,
+ .change_bss = cfg80211_rtw_change_bss,
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
+ .set_channel = cfg80211_rtw_set_channel,
+ #endif
+ //.auth = cfg80211_rtw_auth,
+ //.assoc = cfg80211_rtw_assoc,
+#endif //CONFIG_AP_MODE
+
+#ifdef CONFIG_P2P
+ .remain_on_channel = cfg80211_rtw_remain_on_channel,
+ .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel,
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ .mgmt_tx = cfg80211_rtw_mgmt_tx,
+ .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
+#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35))
+ .action = cfg80211_rtw_mgmt_tx,
+#endif
+
+#if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ .tdls_mgmt = cfg80211_rtw_tdls_mgmt,
+ .tdls_oper = cfg80211_rtw_tdls_oper,
+#endif /* CONFIG_TDLS */
+};
+
+int rtw_wdev_alloc(_adapter *padapter, struct device *dev)
+{
+ int ret = 0;
+ struct wiphy *wiphy;
+ struct wireless_dev *wdev;
+ struct rtw_wdev_priv *pwdev_priv;
+ struct net_device *pnetdev = padapter->pnetdev;
+
+ DBG_8192C("%s(padapter=%p)\n", __func__, padapter);
+
+ /* wiphy */
+ wiphy = wiphy_new(&rtw_cfg80211_ops, sizeof(_adapter*));
+ if (!wiphy) {
+ DBG_8192C("Couldn't allocate wiphy device\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+ set_wiphy_dev(wiphy, dev);
+ *((_adapter**)wiphy_priv(wiphy)) = padapter;
+ rtw_cfg80211_preinit_wiphy(padapter, wiphy);
+
+ ret = wiphy_register(wiphy);
+ if (ret < 0) {
+ DBG_8192C("Couldn't register wiphy device\n");
+ goto free_wiphy;
+ }
+
+ /* wdev */
+ wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev));
+ if (!wdev) {
+ DBG_8192C("Couldn't allocate wireless device\n");
+ ret = -ENOMEM;
+ goto unregister_wiphy;
+ }
+ wdev->wiphy = wiphy;
+ wdev->netdev = pnetdev;
+
+ wdev->iftype = NL80211_IFTYPE_STATION; // will be init in rtw_hal_init()
+ // Must sync with _rtw_init_mlme_priv()
+ // pmlmepriv->fw_state = WIFI_STATION_STATE
+ //wdev->iftype = NL80211_IFTYPE_MONITOR; // for rtw_setopmode_cmd() in cfg80211_rtw_change_iface()
+ padapter->rtw_wdev = wdev;
+ pnetdev->ieee80211_ptr = wdev;
+
+ //init pwdev_priv
+ pwdev_priv = adapter_wdev_data(padapter);
+ pwdev_priv->rtw_wdev = wdev;
+ pwdev_priv->pmon_ndev = NULL;
+ pwdev_priv->ifname_mon[0] = '\0';
+ pwdev_priv->padapter = padapter;
+ pwdev_priv->scan_request = NULL;
+ _rtw_spinlock_init(&pwdev_priv->scan_req_lock);
+
+ pwdev_priv->p2p_enabled = _FALSE;
+ pwdev_priv->provdisc_req_issued = _FALSE;
+ rtw_wdev_invit_info_init(&pwdev_priv->invit_info);
+ rtw_wdev_nego_info_init(&pwdev_priv->nego_info);
+
+ pwdev_priv->bandroid_scan = _FALSE;
+
+ if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE)
+ pwdev_priv->power_mgmt = _TRUE;
+ else
+ pwdev_priv->power_mgmt = _FALSE;
+
+#ifdef CONFIG_CONCURRENT_MODE
+ ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
+ ATOMIC_SET(&pwdev_priv->ro_ch_to, 1);
+#endif
+
+ return ret;
+
+ rtw_mfree((u8*)wdev, sizeof(struct wireless_dev));
+unregister_wiphy:
+ wiphy_unregister(wiphy);
+ free_wiphy:
+ wiphy_free(wiphy);
+exit:
+ return ret;
+
+}
+
+void rtw_wdev_free(struct wireless_dev *wdev)
+{
+ DBG_8192C("%s(wdev=%p)\n", __func__, wdev);
+
+ if (!wdev)
+ return;
+
+ rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]);
+ rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]);
+
+ wiphy_free(wdev->wiphy);
+
+ rtw_mfree((u8*)wdev, sizeof(struct wireless_dev));
+}
+
+void rtw_wdev_unregister(struct wireless_dev *wdev)
+{
+ struct net_device *ndev;
+ _adapter *adapter;
+ struct rtw_wdev_priv *pwdev_priv;
+
+ DBG_8192C("%s(wdev=%p)\n", __func__, wdev);
+
+ if (!wdev)
+ return;
+
+ if(!(ndev = wdev_to_ndev(wdev)))
+ return;
+
+ adapter = (_adapter *)rtw_netdev_priv(ndev);
+ pwdev_priv = adapter_wdev_data(adapter);
+
+ rtw_cfg80211_indicate_scan_done(adapter, _TRUE);
+
+ if (pwdev_priv->pmon_ndev) {
+ DBG_8192C("%s, unregister monitor interface\n", __func__);
+ unregister_netdev(pwdev_priv->pmon_ndev);
+ }
+
+ wiphy_unregister(wdev->wiphy);
+}
+
+#endif //CONFIG_IOCTL_CFG80211
+
diff --git a/rtl8xxx_EU/os_dep/linux/ioctl_linux.c b/rtl8xxx_EU/os_dep/linux/ioctl_linux.c
index d950733..e1184f5 100755
--- a/rtl8xxx_EU/os_dep/linux/ioctl_linux.c
+++ b/rtl8xxx_EU/os_dep/linux/ioctl_linux.c
@@ -1536,10 +1536,51 @@ static int rtw_wx_set_freq(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
+
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct wlan_network *cur_network = &(pmlmepriv->cur_network);
+ int exp = 1, freq = 0, div = 0;
+
_func_enter_;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+rtw_wx_set_freq\n"));
+ if (wrqu->freq.m <= 1000) {
+ if (wrqu->freq.flags == IW_FREQ_AUTO) {
+ padapter->mlmeextpriv.cur_channel = 1;
+ DBG_871X("%s: channel is auto, set to channel 1\n", __func__);
+ } else {
+ padapter->mlmeextpriv.cur_channel = wrqu->freq.m;
+ DBG_871X("%s: set to channel %d\n", __func__, padapter->mlmeextpriv.cur_channel);
+ }
+ } else {
+ while (wrqu->freq.e) {
+ exp *= 10;
+ wrqu->freq.e--;
+ }
+
+ freq = wrqu->freq.m;
+ while (!(freq%10)) {
+ freq /= 10;
+ exp *= 10;
+ }
+
+ /* freq unit is MHz here */
+ div = 1000000/exp;
+
+ if (div)
+ freq /= div;
+ else {
+ div = exp/1000000;
+ freq *= div;
+ }
+
+ /* If freq is invalid, rtw_freq2ch() will return channel 1 */
+ padapter->mlmeextpriv.cur_channel = rtw_freq2ch(freq);
+ DBG_871X("%s: set to channel %d\n", __func__, padapter->mlmeextpriv.cur_channel);
+ }
+
_func_exit_;
return 0;
@@ -1588,9 +1629,21 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
ret = -EPERM;
goto exit;
}
-
+
+ /* initial default type */
+ dev->type = ARPHRD_ETHER;
+
switch(wrqu->mode)
{
+ case IW_MODE_MONITOR:
+ networkType = Ndis802_11Monitor;
+#if 0
+ dev->type = ARPHRD_IEEE80211; /* IEEE 802.11 : 801 */
+#endif
+ dev->type = ARPHRD_IEEE80211_RADIOTAP; /* IEEE 802.11 + radiotap header : 803 */
+ DBG_871X("set_mode = IW_MODE_MONITOR\n");
+ break;
+
case IW_MODE_AUTO:
networkType = Ndis802_11AutoUnknown;
DBG_871X("set_mode = IW_MODE_AUTO\n");
@@ -2573,7 +2626,10 @@ static int rtw_wx_set_essid(struct net_device *dev,
#ifdef DBG_IOCTL
DBG_871X("DBG_IOCTL %s:%d\n",__FUNCTION__, __LINE__);
#endif
-
+ #ifdef CONFIG_WEXT_DONT_JOIN_BYSSID
+ DBG_871X("%s: CONFIG_WEXT_DONT_JOIN_BYSSID be defined!! only allow bssid joining\n", __func__);
+ return -EPERM;
+ #endif
/*
#ifdef CONFIG_CONCURRENT_MODE
if(padapter->iface_type > PRIMARY_IFACE)
@@ -8053,9 +8109,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;
}
@@ -14184,8 +14240,16 @@ 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;
diff --git a/rtl8xxx_EU/os_dep/linux/mlme_linux.c b/rtl8xxx_EU/os_dep/linux/mlme_linux.c
index 4a12ed5..4a12ed5 100644..100755
--- a/rtl8xxx_EU/os_dep/linux/mlme_linux.c
+++ b/rtl8xxx_EU/os_dep/linux/mlme_linux.c
diff --git a/rtl8xxx_EU/os_dep/linux/os_intfs.c b/rtl8xxx_EU/os_dep/linux/os_intfs.c
index c3a1529..c1a5aaa 100644..100755
--- a/rtl8xxx_EU/os_dep/linux/os_intfs.c
+++ b/rtl8xxx_EU/os_dep/linux/os_intfs.c
@@ -320,6 +320,22 @@ 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");
+
+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_adaptivity_dml = CONFIG_RTW_ADAPTIVITY_DML;
+module_param(rtw_adaptivity_dml, uint, 0644);
+MODULE_PARM_DESC(rtw_adaptivity_dml, "0:disable, 1:enable");
+
+uint rtw_adaptivity_dc_backoff = CONFIG_RTW_ADAPTIVITY_DC_BACKOFF;
+module_param(rtw_adaptivity_dc_backoff, uint, 0644);
+MODULE_PARM_DESC(rtw_adaptivity_dc_backoff, "DC backoff for Adaptivity");
+
#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;
@@ -533,6 +549,12 @@ _func_enter_;
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->adaptivity_dml = (u8)rtw_adaptivity_dml;
+ registry_par->adaptivity_dc_backoff = (u8)rtw_adaptivity_dc_backoff;
+
_func_exit_;
return status;
diff --git a/rtl8xxx_EU/os_dep/linux/recv_linux.c b/rtl8xxx_EU/os_dep/linux/recv_linux.c
index 2f965d2..d4ce0fc 100755
--- a/rtl8xxx_EU/os_dep/linux/recv_linux.c
+++ b/rtl8xxx_EU/os_dep/linux/recv_linux.c
@@ -552,6 +552,52 @@ static void rtw_os_ksocket_send(_adapter *padapter, union recv_frame *precv_fram
}
#endif //CONFIG_AUTO_AP_MODE
+int rtw_recv_monitor(_adapter *padapter, union recv_frame *precv_frame)
+{
+ int ret = _FAIL;
+ struct recv_priv *precvpriv;
+ _queue *pfree_recv_queue;
+ _pkt *skb;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct rx_pkt_attrib *pattrib;
+
+ if (NULL == precv_frame)
+ goto _recv_drop;
+
+ pattrib = &precv_frame->u.hdr.attrib;
+ precvpriv = &(padapter->recvpriv);
+ pfree_recv_queue = &(precvpriv->free_recv_queue);
+
+ skb = precv_frame->u.hdr.pkt;
+ if (skb == NULL) {
+ DBG_871X("%s :skb==NULL something wrong!!!!\n", __func__);
+ goto _recv_drop;
+ }
+
+ skb->data = precv_frame->u.hdr.rx_data;
+ skb_set_tail_pointer(skb, precv_frame->u.hdr.len);
+ skb->len = precv_frame->u.hdr.len;
+ skb->ip_summed = CHECKSUM_NONE;
+ skb->pkt_type = PACKET_OTHERHOST;
+ skb->protocol = htons(0x0019); /* ETH_P_80211_RAW */
+
+ rtw_netif_rx(padapter->pnetdev, skb);
+
+ /* pointers to NULL before rtw_free_recvframe() */
+ precv_frame->u.hdr.pkt = NULL;
+
+ ret = _SUCCESS;
+
+_recv_drop:
+
+ /* enqueue back to free_recv_queue */
+ if (precv_frame)
+ rtw_free_recvframe(precv_frame, pfree_recv_queue);
+
+ return ret;
+
+}
+
int rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame)
{
struct recv_priv *precvpriv;
@@ -599,6 +645,9 @@ _func_enter_;
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("\n skb->head=%p skb->data=%p skb->tail=%p skb->end=%p skb->len=%d\n", skb->head, skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb->len));
+ if (pattrib->eth_type == 0x888e)
+ DBG_871X_LEVEL(_drv_always_, "recv eapol packet\n");
+
#ifdef CONFIG_AUTO_AP_MODE
#if 1 //for testing
#if 1
diff --git a/rtl8xxx_EU/os_dep/linux/rtw_android.c b/rtl8xxx_EU/os_dep/linux/rtw_android.c
index 59ce0dc..a807602 100755
--- a/rtl8xxx_EU/os_dep/linux/rtw_android.c
+++ b/rtl8xxx_EU/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",
@@ -73,6 +76,7 @@ const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = {
"MACADDR",
+ "BLOCK_SCAN",
"BLOCK",
"WFD-ENABLE",
"WFD-DISABLE",
@@ -135,16 +139,18 @@ char pno_in_example[] = {
#endif /* PNO_SUPPORT */
typedef struct android_wifi_priv_cmd {
+ char *buf;
+ int used_len;
+ int total_len;
+} android_wifi_priv_cmd;
#ifdef CONFIG_COMPAT
+typedef struct compat_android_wifi_priv_cmd {
compat_uptr_t buf;
-#else
- char *buf;
-#endif
-
int used_len;
int total_len;
-} android_wifi_priv_cmd;
+} compat_android_wifi_priv_cmd;
+#endif /* CONFIG_COMPAT */
/**
* Local (static) functions and variables
@@ -346,6 +352,18 @@ int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int tota
return bytes_written;
}
+int rtw_android_set_block_scan(struct net_device *net, char *command, int total_len)
+{
+ _adapter *adapter = (_adapter *)rtw_netdev_priv(net);
+ char *block_value = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_BLOCK_SCAN]) + 1;
+
+ #ifdef CONFIG_IOCTL_CFG80211
+ adapter_wdev_data(adapter)->block_scan = (*block_value == '0')?_FALSE:_TRUE;
+ #endif
+
+ return 0;
+}
+
int rtw_android_set_block(struct net_device *net, char *command, int total_len)
{
_adapter *adapter = (_adapter *)rtw_netdev_priv(net);
@@ -381,6 +399,28 @@ int rtw_android_getband(struct net_device *net, char *command, int total_len)
return bytes_written;
}
+#ifdef CONFIG_WFD
+int rtw_android_set_miracast_mode(struct net_device *net, char *command, int total_len)
+{
+ _adapter *adapter = (_adapter *)rtw_netdev_priv(net);
+ struct wifi_display_info *wfd_info = &adapter->wfd_info;
+ 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) {
+ wfd_info->stack_wfd_mode = mode;
+ DBG_871X("Miracast mode: %s(%u)\n", get_miracast_mode_str(wfd_info->stack_wfd_mode), wfd_info->stack_wfd_mode);
+ ret = _SUCCESS;
+ }
+
+ return (ret == _SUCCESS)?0:-1;
+}
+#endif /* CONFIG_WFD */
+
int get_int_from_command( char* pcmd )
{
int i = 0;
@@ -460,12 +500,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;
@@ -488,11 +543,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;
}
@@ -545,7 +596,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
case ANDROID_WIFI_CMD_MACADDR:
bytes_written = rtw_android_get_macaddr(net, command, priv_cmd.total_len);
break;
-
+
+ case ANDROID_WIFI_CMD_BLOCK_SCAN:
+ bytes_written = rtw_android_set_block_scan(net, command, priv_cmd.total_len);
+ break;
+
case ANDROID_WIFI_CMD_BLOCK:
bytes_written = rtw_android_set_block(net, command, priv_cmd.total_len);
break;
@@ -595,7 +650,7 @@ 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_COUNTRY:
bytes_written = rtw_android_set_country(net, command, priv_cmd.total_len);
break;
@@ -639,6 +694,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
#endif //CONFIG_IOCTL_CFG80211
#ifdef CONFIG_WFD
+
+ case ANDROID_WIFI_CMD_MIRACAST:
+ bytes_written = rtw_android_set_miracast_mode(net, command, priv_cmd.total_len);
+ break;
+
case ANDROID_WIFI_CMD_WFD_ENABLE:
{
// Commented by Albert 2012/07/24
@@ -671,11 +731,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->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;
}
@@ -691,12 +747,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;
@@ -770,11 +821,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/rtl8xxx_EU/os_dep/linux/rtw_proc.c b/rtl8xxx_EU/os_dep/linux/rtw_proc.c
index dd09476..9ecc542 100644..100755
--- a/rtl8xxx_EU/os_dep/linux/rtw_proc.c
+++ b/rtl8xxx_EU/os_dep/linux/rtw_proc.c
@@ -261,6 +261,17 @@ static int proc_get_rf_reg_dump(struct seq_file *m, void *v)
return 0;
}
+
+static int proc_get_dump_adapters_status(struct seq_file *m, void *v)
+{
+ struct net_device *dev = m->private;
+ _adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
+
+ dump_adapters_status(m, adapter_to_dvobj(adapter));
+
+ return 0;
+}
+
static int proc_get_linked_info_dump(struct seq_file *m, void *v)
{
struct net_device *dev = m->private;
@@ -424,15 +435,15 @@ static int proc_get_cam_cache(struct seq_file *m, void *v)
const struct rtw_proc_hdl adapter_proc_hdls [] = {
{"write_reg", proc_get_dummy, proc_set_write_reg},
{"read_reg", proc_get_read_reg, proc_set_read_reg},
+ {"adapters_status", proc_get_dump_adapters_status, NULL},
{"fwstate", proc_get_fwstate, NULL},
{"sec_info", proc_get_sec_info, NULL},
{"mlmext_state", proc_get_mlmext_state, NULL},
{"qos_option", proc_get_qos_option, NULL},
{"ht_option", proc_get_ht_option, NULL},
{"rf_info", proc_get_rf_info, NULL},
- {"survey_info", proc_get_survey_info, NULL},
+ {"survey_info", proc_get_survey_info, proc_set_survey_info},
{"ap_info", proc_get_ap_info, NULL},
- {"adapter_state", proc_get_adapter_state, NULL},
{"trx_info", proc_get_trx_info, NULL},
{"rate_ctl", proc_get_rate_ctl, proc_set_rate_ctl},
{"mac_qinfo", proc_get_mac_qinfo, NULL},
@@ -496,6 +507,7 @@ const struct rtw_proc_hdl adapter_proc_hdls [] = {
{"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},
+ {"monitor", proc_get_monitor, proc_set_monitor},
};
const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(struct rtw_proc_hdl);
@@ -648,23 +660,18 @@ ssize_t proc_set_odm_adaptivity(struct file *file, const char __user *buffer, si
char tmp[32];
u32 TH_L2H_ini;
s8 TH_EDCCA_HL_diff;
- u32 IGI_Base;
- int ForceEDCCA;
- u8 AdapEn_RSSI;
- u8 IGI_LowerBound;
if (count < 1)
return -EFAULT;
if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
- int num = sscanf(tmp, "%x %hhd %x %d %hhu %hhu",
- &TH_L2H_ini, &TH_EDCCA_HL_diff, &IGI_Base, &ForceEDCCA, &AdapEn_RSSI, &IGI_LowerBound);
+ int num = sscanf(tmp, "%x %hhd", &TH_L2H_ini, &TH_EDCCA_HL_diff);
- if (num != 6)
+ if (num != 2)
return count;
- rtw_odm_adaptivity_parm_set(padapter, (s8)TH_L2H_ini, TH_EDCCA_HL_diff, (s8)IGI_Base, (bool)ForceEDCCA, AdapEn_RSSI, IGI_LowerBound);
+ rtw_odm_adaptivity_parm_set(padapter, (s8)TH_L2H_ini, TH_EDCCA_HL_diff);
}
return count;
diff --git a/rtl8xxx_EU/os_dep/linux/usb_intf.c b/rtl8xxx_EU/os_dep/linux/usb_intf.c
index 295d52b..295d52b 100644..100755
--- a/rtl8xxx_EU/os_dep/linux/usb_intf.c
+++ b/rtl8xxx_EU/os_dep/linux/usb_intf.c
diff --git a/rtl8xxx_EU/os_dep/linux/usb_ops_linux.c b/rtl8xxx_EU/os_dep/linux/usb_ops_linux.c
index adf050c..2cd10af 100755
--- a/rtl8xxx_EU/os_dep/linux/usb_ops_linux.c
+++ b/rtl8xxx_EU/os_dep/linux/usb_ops_linux.c
@@ -1,783 +1,783 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *******************************************************************************/
-#define _USB_OPS_LINUX_C_
-
-#include <drv_types.h>
-#include <hal_data.h>
-#include <rtw_sreset.h>
-
-int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
-{
- _adapter *padapter = pintfhdl->padapter;
- struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
- struct pwrctrl_priv *pwrctl = dvobj_to_pwrctl(pdvobjpriv);
- struct usb_device *udev=pdvobjpriv->pusbdev;
-
- unsigned int pipe;
- int status = 0;
- u32 tmp_buflen=0;
- u8 reqtype;
- u8 *pIo_buf;
- int vendorreq_times = 0;
-
- #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
- u8 *tmp_buf;
- #else // use stack memory
- u8 tmp_buf[MAX_USB_IO_CTL_SIZE];
- #endif
-
-#ifdef CONFIG_CONCURRENT_MODE
- if(padapter->adapter_type > PRIMARY_ADAPTER)
- {
- padapter = padapter->pbuddy_adapter;
- pdvobjpriv = adapter_to_dvobj(padapter);
- udev = pdvobjpriv->pusbdev;
- }
-#endif
-
- //DBG_871X("%s %s:%d\n",__FUNCTION__, current->comm, current->pid);
-
- if (RTW_CANNOT_IO(padapter)){
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usbctrl_vendorreq:(RTW_CANNOT_IO)!!!\n"));
- status = -EPERM;
- goto exit;
- }
-
- if(len>MAX_VENDOR_REQ_CMD_SIZE){
- DBG_8192C( "[%s] Buffer len error ,vendor request failed\n", __FUNCTION__ );
- status = -EINVAL;
- goto exit;
- }
-
- #ifdef CONFIG_USB_VENDOR_REQ_MUTEX
- _enter_critical_mutex(&pdvobjpriv->usb_vendor_req_mutex, NULL);
- #endif
-
-
- // Acquire IO memory for vendorreq
-#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
- pIo_buf = pdvobjpriv->usb_vendor_req_buf;
-#else
- #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
- tmp_buf = rtw_malloc( (u32) len + ALIGNMENT_UNIT);
- tmp_buflen = (u32)len + ALIGNMENT_UNIT;
- #else // use stack memory
- tmp_buflen = MAX_USB_IO_CTL_SIZE;
- #endif
-
- // Added by Albert 2010/02/09
- // For mstar platform, mstar suggests the address for USB IO should be 16 bytes alignment.
- // Trying to fix it here.
- pIo_buf = (tmp_buf==NULL)?NULL:tmp_buf + ALIGNMENT_UNIT -((SIZE_PTR)(tmp_buf) & 0x0f );
-#endif
-
- if ( pIo_buf== NULL) {
- DBG_8192C( "[%s] pIo_buf == NULL \n", __FUNCTION__ );
- status = -ENOMEM;
- goto release_mutex;
- }
-
- while(++vendorreq_times<= MAX_USBCTRL_VENDORREQ_TIMES)
- {
- _rtw_memset(pIo_buf, 0, len);
-
- if (requesttype == 0x01)
- {
- pipe = usb_rcvctrlpipe(udev, 0);//read_in
- reqtype = REALTEK_USB_VENQT_READ;
- }
- else
- {
- pipe = usb_sndctrlpipe(udev, 0);//write_out
- reqtype = REALTEK_USB_VENQT_WRITE;
- _rtw_memcpy( pIo_buf, pdata, len);
- }
-
- status = rtw_usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
-
- if ( status == len) // Success this control transfer.
- {
- rtw_reset_continual_io_error(pdvobjpriv);
- if ( requesttype == 0x01 )
- { // For Control read transfer, we have to copy the read data from pIo_buf to pdata.
- _rtw_memcpy( pdata, pIo_buf, len );
- }
- }
- else { // error cases
- DBG_8192C("reg 0x%x, usb %s %u fail, status:%d value=0x%x, vendorreq_times:%d\n"
- , value,(requesttype == 0x01)?"read":"write" , len, status, *(u32*)pdata, vendorreq_times);
-
- if (status < 0) {
- if(status == (-ESHUTDOWN) || status == -ENODEV )
- {
- padapter->bSurpriseRemoved = _TRUE;
- } else {
- #ifdef DBG_CONFIG_ERROR_DETECT
- {
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- pHalData->srestpriv.Wifi_Error_Status = USB_VEN_REQ_CMD_FAIL;
- }
- #endif
- }
- }
- else // status != len && status >= 0
- {
- if(status > 0) {
- if ( requesttype == 0x01 )
- { // For Control read transfer, we have to copy the read data from pIo_buf to pdata.
- _rtw_memcpy( pdata, pIo_buf, len );
- }
- }
- }
-
- if(rtw_inc_and_chk_continual_io_error(pdvobjpriv) == _TRUE ){
- padapter->bSurpriseRemoved = _TRUE;
- break;
- }
-
- }
-
- // firmware download is checksumed, don't retry
- if( (value >= FW_START_ADDRESS ) || status == len )
- break;
-
- }
-
- // release IO memory used by vendorreq
- #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
- rtw_mfree(tmp_buf, tmp_buflen);
- #endif
-
-release_mutex:
- #ifdef CONFIG_USB_VENDOR_REQ_MUTEX
- _exit_critical_mutex(&pdvobjpriv->usb_vendor_req_mutex, NULL);
- #endif
-exit:
- return status;
-
-}
-
-#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
-static void _usbctrl_vendorreq_async_callback(struct urb *urb, struct pt_regs *regs)
-{
- if (urb) {
- if (urb->context) {
- rtw_mfree(urb->context);
- }
- usb_free_urb(urb);
- }
-}
-
-static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
- u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
-{
- int rc;
- unsigned int pipe;
- u8 reqtype;
- struct usb_ctrlrequest *dr;
- struct urb *urb;
- struct rtl819x_async_write_data {
- u8 data[VENDOR_CMD_MAX_DATA_LEN];
- struct usb_ctrlrequest dr;
- } *buf;
-
-
- if (requesttype == VENDOR_READ) {
- pipe = usb_rcvctrlpipe(udev, 0);//read_in
- reqtype = REALTEK_USB_VENQT_READ;
- }
- else {
- pipe = usb_sndctrlpipe(udev, 0);//write_out
- reqtype = REALTEK_USB_VENQT_WRITE;
- }
-
- buf = (struct rtl819x_async_write_data *)rtw_zmalloc(sizeof(*buf));
- if (!buf) {
- rc = -ENOMEM;
- goto exit;
- }
-
- urb = usb_alloc_urb(0, GFP_ATOMIC);
- if (!urb) {
- rtw_mfree((u8*)buf, sizeof(*buf));
- rc = -ENOMEM;
- goto exit;
- }
-
- dr = &buf->dr;
-
- dr->bRequestType = reqtype;
- dr->bRequest = request;
- dr->wValue = cpu_to_le16(value);
- dr->wIndex = cpu_to_le16(index);
- dr->wLength = cpu_to_le16(len);
-
- _rtw_memcpy(buf, pdata, len);
-
- usb_fill_control_urb(urb, udev, pipe, (unsigned char *)dr, buf, len,
- _usbctrl_vendorreq_async_callback, buf);
-
- rc = usb_submit_urb(urb, GFP_ATOMIC);
- if (rc < 0) {
- rtw_mfree((u8*)buf, sizeof(*buf));
- usb_free_urb(urb);
- }
-
-exit:
- return rc;
-}
-
-int usb_write_async(struct usb_device *udev, u32 addr, void *pdata, u16 len)
-{
- u8 request;
- u8 requesttype;
- u16 wvalue;
- u16 index;
-
- int ret;
-
- requesttype = VENDOR_WRITE;//write_out
- request = REALTEK_USB_VENQT_CMD_REQ;
- index = REALTEK_USB_VENQT_CMD_IDX;//n/a
-
- wvalue = (u16)(addr&0x0000ffff);
-
- ret = _usbctrl_vendorreq_async_write(udev, request, wvalue, index, pdata, len, requesttype);
-
- return ret;
-}
-
-int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
-{
- u8 data;
- int ret;
- struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
- struct usb_device *udev=pdvobjpriv->pusbdev;
-
- _func_enter_;
- data = val;
- ret = usb_write_async(udev, addr, &data, 1);
- _func_exit_;
-
- return ret;
-}
-
-int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
-{
- u16 data;
- int ret;
- struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
- struct usb_device *udev=pdvobjpriv->pusbdev;
-
- _func_enter_;
- data = val;
- ret = usb_write_async(udev, addr, &data, 2);
- _func_exit_;
-
- return ret;
-}
-
-int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
-{
- u32 data;
- int ret;
- struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
- struct usb_device *udev=pdvobjpriv->pusbdev;
-
- _func_enter_;
- data = val;
- ret = usb_write_async(udev, addr, &data, 4);
- _func_exit_;
-
- return ret;
-}
-#endif /* CONFIG_USB_SUPPORT_ASYNC_VDN_REQ */
-
-unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr)
-{
- unsigned int pipe=0, ep_num=0;
- struct usb_device *pusbd = pdvobj->pusbdev;
-
- if (addr == RECV_BULK_IN_ADDR) {
- pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[0]);
-
- } else if (addr == RECV_INT_IN_ADDR) {
- pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[1]);
-
- } else if (addr < HW_QUEUE_ENTRY) {
- ep_num = pdvobj->Queue2Pipe[addr];
- pipe = usb_sndbulkpipe(pusbd, ep_num);
- }
-
- return pipe;
-}
-
-struct zero_bulkout_context{
- void *pbuf;
- void *purb;
- void *pirp;
- void *padapter;
-};
-
-static void usb_bulkout_zero_complete(struct urb *purb, struct pt_regs *regs)
-{
- struct zero_bulkout_context *pcontext = (struct zero_bulkout_context *)purb->context;
-
- //DBG_8192C("+usb_bulkout_zero_complete\n");
-
- if(pcontext)
- {
- if(pcontext->pbuf)
- {
- rtw_mfree(pcontext->pbuf, sizeof(int));
- }
-
- if(pcontext->purb && (pcontext->purb==purb))
- {
- usb_free_urb(pcontext->purb);
- }
-
-
- rtw_mfree((u8*)pcontext, sizeof(struct zero_bulkout_context));
- }
-
-
-}
-
-static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr)
-{
- int pipe, status, len;
- u32 ret;
- unsigned char *pbuf;
- struct zero_bulkout_context *pcontext;
- PURB purb = NULL;
- _adapter *padapter = (_adapter *)pintfhdl->padapter;
- struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
- struct pwrctrl_priv *pwrctl = dvobj_to_pwrctl(pdvobj);
- struct usb_device *pusbd = pdvobj->pusbdev;
-
- //DBG_871X("%s\n", __func__);
-
-
- if (RTW_CANNOT_TX(padapter))
- {
- return _FAIL;
- }
-
-
- pcontext = (struct zero_bulkout_context *)rtw_zmalloc(sizeof(struct zero_bulkout_context));
- if (pcontext == NULL) {
- return _FAIL;
- }
-
- pbuf = (unsigned char *)rtw_zmalloc(sizeof(int));
- purb = usb_alloc_urb(0, GFP_ATOMIC);
-
- //translate DMA FIFO addr to pipehandle
- pipe = ffaddr2pipehdl(pdvobj, addr);
-
- len = 0;
- pcontext->pbuf = pbuf;
- pcontext->purb = purb;
- pcontext->pirp = NULL;
- pcontext->padapter = padapter;
-
-
- //translate DMA FIFO addr to pipehandle
- //pipe = ffaddr2pipehdl(pdvobj, addr);
-
- usb_fill_bulk_urb(purb, pusbd, pipe,
- pbuf,
- len,
- usb_bulkout_zero_complete,
- pcontext);//context is pcontext
-
- status = usb_submit_urb(purb, GFP_ATOMIC);
-
- if (!status)
- {
- ret= _SUCCESS;
- }
- else
- {
- ret= _FAIL;
- }
-
-
- return _SUCCESS;
-
-}
-
-void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
-{
-
-}
-
-void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
-{
-
-}
-
-
-void usb_read_port_cancel(struct intf_hdl *pintfhdl)
-{
- int i;
- struct recv_buf *precvbuf;
- _adapter *padapter = pintfhdl->padapter;
- precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf;
-
- DBG_871X("%s\n", __func__);
-
- for (i=0; i < NR_RECVBUFF ; i++) {
-
- precvbuf->reuse = _TRUE;
- if (precvbuf->purb) {
- //DBG_8192C("usb_read_port_cancel : usb_kill_urb \n");
- usb_kill_urb(precvbuf->purb);
- }
- precvbuf++;
- }
-
-#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
- usb_kill_urb(padapter->recvpriv.int_in_urb);
-#endif
-}
-
-static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs)
-{
- _irqL irqL;
- int i;
- struct xmit_buf *pxmitbuf = (struct xmit_buf *)purb->context;
- //struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data;
- //_adapter *padapter = pxmitframe->padapter;
- _adapter *padapter = pxmitbuf->padapter;
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- //struct pkt_attrib *pattrib = &pxmitframe->attrib;
-
-_func_enter_;
-
- switch(pxmitbuf->flags)
- {
- case VO_QUEUE_INX:
- pxmitpriv->voq_cnt--;
- break;
- case VI_QUEUE_INX:
- pxmitpriv->viq_cnt--;
- break;
- case BE_QUEUE_INX:
- pxmitpriv->beq_cnt--;
- break;
- case BK_QUEUE_INX:
- pxmitpriv->bkq_cnt--;
- break;
- default:
- break;
- }
-
-
-/*
- _enter_critical(&pxmitpriv->lock, &irqL);
-
- pxmitpriv->txirp_cnt--;
-
- switch(pattrib->priority)
- {
- case 1:
- case 2:
- pxmitpriv->bkq_cnt--;
- //DBG_8192C("pxmitpriv->bkq_cnt=%d\n", pxmitpriv->bkq_cnt);
- break;
- case 4:
- case 5:
- pxmitpriv->viq_cnt--;
- //DBG_8192C("pxmitpriv->viq_cnt=%d\n", pxmitpriv->viq_cnt);
- break;
- case 6:
- case 7:
- pxmitpriv->voq_cnt--;
- //DBG_8192C("pxmitpriv->voq_cnt=%d\n", pxmitpriv->voq_cnt);
- break;
- case 0:
- case 3:
- default:
- pxmitpriv->beq_cnt--;
- //DBG_8192C("pxmitpriv->beq_cnt=%d\n", pxmitpriv->beq_cnt);
- break;
-
- }
-
- _exit_critical(&pxmitpriv->lock, &irqL);
-
-
- if(pxmitpriv->txirp_cnt==0)
- {
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: txirp_cnt== 0, set allrxreturnevt!\n"));
- _rtw_up_sema(&(pxmitpriv->tx_retevt));
- }
-*/
- //rtw_free_xmitframe(pxmitpriv, pxmitframe);
-
- if (RTW_CANNOT_TX(padapter))
- {
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved));
- DBG_8192C("%s(): TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) pxmitbuf->buf_tag(%x) \n",
- __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,pxmitbuf->buf_tag);
-
- goto check_completion;
- }
-
-
- if (purb->status==0) {
-
- } else {
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete : purb->status(%d) != 0 \n", purb->status));
- DBG_871X("###=> urb_write_port_complete status(%d)\n",purb->status);
- if((purb->status==-EPIPE)||(purb->status==-EPROTO))
- {
- //usb_clear_halt(pusbdev, purb->pipe);
- //msleep(10);
- sreset_set_wifi_error_status(padapter, USB_WRITE_PORT_FAIL);
- } else if (purb->status == -EINPROGRESS) {
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: EINPROGESS\n"));
- goto check_completion;
-
- } else if (purb->status == -ENOENT) {
- DBG_871X("%s: -ENOENT\n", __func__);
- goto check_completion;
-
- } else if (purb->status == -ECONNRESET) {
- DBG_871X("%s: -ECONNRESET\n", __func__);
- goto check_completion;
-
- } else if (purb->status == -ESHUTDOWN) {
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: ESHUTDOWN\n"));
- padapter->bDriverStopped=_TRUE;
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped=TRUE\n"));
-
- goto check_completion;
- }
- else
- {
- padapter->bSurpriseRemoved=_TRUE;
- DBG_8192C("bSurpriseRemoved=TRUE\n");
- //rtl8192cu_trigger_gpio_0(padapter);
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bSurpriseRemoved=TRUE\n"));
-
- goto check_completion;
- }
- }
-
- #ifdef DBG_CONFIG_ERROR_DETECT
- {
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- pHalData->srestpriv.last_tx_complete_time = rtw_get_current_time();
- }
- #endif
-
-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);
- _exit_critical(&pxmitpriv->lock_sctx, &irqL);
-
- rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
-
- //if(rtw_txframes_pending(padapter))
- {
- tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
- }
-
-_func_exit_;
-
-}
-
-u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
-{
- _irqL irqL;
- unsigned int pipe;
- int status;
- u32 ret = _FAIL, bwritezero = _FALSE;
- PURB purb = NULL;
- _adapter *padapter = (_adapter *)pintfhdl->padapter;
- struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
- struct pwrctrl_priv *pwrctl = dvobj_to_pwrctl(pdvobj);
- struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- struct xmit_buf *pxmitbuf = (struct xmit_buf *)wmem;
- struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data;
- struct usb_device *pusbd = pdvobj->pusbdev;
- struct pkt_attrib *pattrib = &pxmitframe->attrib;
-
-_func_enter_;
-
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("+usb_write_port\n"));
-
- if (RTW_CANNOT_TX(padapter)) {
- #ifdef DBG_TX
- DBG_871X(" DBG_TX %s:%d bDriverStopped%d, bSurpriseRemoved:%d\n",__FUNCTION__, __LINE__
- ,padapter->bDriverStopped, padapter->bSurpriseRemoved);
- #endif
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved )!!!\n"));
- rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_TX_DENY);
- goto exit;
- }
-
- _enter_critical(&pxmitpriv->lock, &irqL);
-
- switch(addr)
- {
- case VO_QUEUE_INX:
- pxmitpriv->voq_cnt++;
- pxmitbuf->flags = VO_QUEUE_INX;
- break;
- case VI_QUEUE_INX:
- pxmitpriv->viq_cnt++;
- pxmitbuf->flags = VI_QUEUE_INX;
- break;
- case BE_QUEUE_INX:
- pxmitpriv->beq_cnt++;
- pxmitbuf->flags = BE_QUEUE_INX;
- break;
- case BK_QUEUE_INX:
- pxmitpriv->bkq_cnt++;
- pxmitbuf->flags = BK_QUEUE_INX;
- break;
- case HIGH_QUEUE_INX:
- pxmitbuf->flags = HIGH_QUEUE_INX;
- break;
- default:
- pxmitbuf->flags = MGT_QUEUE_INX;
- break;
- }
-
- _exit_critical(&pxmitpriv->lock, &irqL);
-
- purb = pxmitbuf->pxmit_urb[0];
-
- //translate DMA FIFO addr to pipehandle
- pipe = ffaddr2pipehdl(pdvobj, addr);
-
-#ifdef CONFIG_REDUCE_USB_TX_INT
- if ( (pxmitpriv->free_xmitbuf_cnt%NR_XMITBUFF == 0)
- || (pxmitbuf->buf_tag > XMITBUF_DATA) )
- {
- purb->transfer_flags &= (~URB_NO_INTERRUPT);
- } else {
- purb->transfer_flags |= URB_NO_INTERRUPT;
- //DBG_8192C("URB_NO_INTERRUPT ");
- }
-#endif
-
-
- usb_fill_bulk_urb(purb, pusbd, pipe,
- pxmitframe->buf_addr, //= pxmitbuf->pbuf
- cnt,
- usb_write_port_complete,
- pxmitbuf);//context is pxmitbuf
-
-#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX
- purb->transfer_dma = pxmitbuf->dma_transfer_addr;
- purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
- purb->transfer_flags |= URB_ZERO_PACKET;
-#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX
-
-#ifdef USB_PACKET_OFFSET_SZ
-#if (USB_PACKET_OFFSET_SZ == 0)
- purb->transfer_flags |= URB_ZERO_PACKET;
-#endif
-#endif
-
-#if 0
- if (bwritezero)
- {
- purb->transfer_flags |= URB_ZERO_PACKET;
- }
-#endif
-
- status = usb_submit_urb(purb, GFP_ATOMIC);
- if (!status) {
- #ifdef DBG_CONFIG_ERROR_DETECT
- {
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
- pHalData->srestpriv.last_tx_time = rtw_get_current_time();
- }
- #endif
- } else {
- rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR);
- DBG_871X("usb_write_port, status=%d\n", status);
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port(): usb_submit_urb, status=%x\n", status));
-
- switch (status) {
- case -ENODEV:
- padapter->bDriverStopped=_TRUE;
- break;
- default:
- break;
- }
- goto exit;
- }
-
- ret= _SUCCESS;
-
-// Commented by Albert 2009/10/13
-// We add the URB_ZERO_PACKET flag to urb so that the host will send the zero packet automatically.
-/*
- if(bwritezero == _TRUE)
- {
- usb_bulkout_zero(pintfhdl, addr);
- }
-*/
-
- RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("-usb_write_port\n"));
-
-exit:
- if (ret != _SUCCESS)
- rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
-_func_exit_;
- return ret;
-
-}
-
-void usb_write_port_cancel(struct intf_hdl *pintfhdl)
-{
- int i, j;
- _adapter *padapter = pintfhdl->padapter;
- struct xmit_buf *pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmitbuf;
-
- DBG_871X("%s \n", __func__);
-
- for (i=0; i<NR_XMITBUFF; i++) {
- for (j=0; j<8; j++) {
- if (pxmitbuf->pxmit_urb[j]) {
- usb_kill_urb(pxmitbuf->pxmit_urb[j]);
- }
- }
- pxmitbuf++;
- }
-
- pxmitbuf = (struct xmit_buf*)padapter->xmitpriv.pxmit_extbuf;
- 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]);
- }
- }
- pxmitbuf++;
- }
-}
-
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *******************************************************************************/
+#define _USB_OPS_LINUX_C_
+
+#include <drv_types.h>
+#include <hal_data.h>
+#include <rtw_sreset.h>
+
+int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
+{
+ _adapter *padapter = pintfhdl->padapter;
+ struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
+ struct pwrctrl_priv *pwrctl = dvobj_to_pwrctl(pdvobjpriv);
+ struct usb_device *udev=pdvobjpriv->pusbdev;
+
+ unsigned int pipe;
+ int status = 0;
+ u32 tmp_buflen=0;
+ u8 reqtype;
+ u8 *pIo_buf;
+ int vendorreq_times = 0;
+
+ #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
+ u8 *tmp_buf;
+ #else // use stack memory
+ u8 tmp_buf[MAX_USB_IO_CTL_SIZE];
+ #endif
+
+#ifdef CONFIG_CONCURRENT_MODE
+ if(padapter->adapter_type > PRIMARY_ADAPTER)
+ {
+ padapter = padapter->pbuddy_adapter;
+ pdvobjpriv = adapter_to_dvobj(padapter);
+ udev = pdvobjpriv->pusbdev;
+ }
+#endif
+
+ //DBG_871X("%s %s:%d\n",__FUNCTION__, current->comm, current->pid);
+
+ if (RTW_CANNOT_IO(padapter)){
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usbctrl_vendorreq:(RTW_CANNOT_IO)!!!\n"));
+ status = -EPERM;
+ goto exit;
+ }
+
+ if(len>MAX_VENDOR_REQ_CMD_SIZE){
+ DBG_8192C( "[%s] Buffer len error ,vendor request failed\n", __FUNCTION__ );
+ status = -EINVAL;
+ goto exit;
+ }
+
+ #ifdef CONFIG_USB_VENDOR_REQ_MUTEX
+ _enter_critical_mutex(&pdvobjpriv->usb_vendor_req_mutex, NULL);
+ #endif
+
+
+ // Acquire IO memory for vendorreq
+#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
+ pIo_buf = pdvobjpriv->usb_vendor_req_buf;
+#else
+ #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
+ tmp_buf = rtw_malloc( (u32) len + ALIGNMENT_UNIT);
+ tmp_buflen = (u32)len + ALIGNMENT_UNIT;
+ #else // use stack memory
+ tmp_buflen = MAX_USB_IO_CTL_SIZE;
+ #endif
+
+ // Added by Albert 2010/02/09
+ // For mstar platform, mstar suggests the address for USB IO should be 16 bytes alignment.
+ // Trying to fix it here.
+ pIo_buf = (tmp_buf==NULL)?NULL:tmp_buf + ALIGNMENT_UNIT -((SIZE_PTR)(tmp_buf) & 0x0f );
+#endif
+
+ if ( pIo_buf== NULL) {
+ DBG_8192C( "[%s] pIo_buf == NULL \n", __FUNCTION__ );
+ status = -ENOMEM;
+ goto release_mutex;
+ }
+
+ while(++vendorreq_times<= MAX_USBCTRL_VENDORREQ_TIMES)
+ {
+ _rtw_memset(pIo_buf, 0, len);
+
+ if (requesttype == 0x01)
+ {
+ pipe = usb_rcvctrlpipe(udev, 0);//read_in
+ reqtype = REALTEK_USB_VENQT_READ;
+ }
+ else
+ {
+ pipe = usb_sndctrlpipe(udev, 0);//write_out
+ reqtype = REALTEK_USB_VENQT_WRITE;
+ _rtw_memcpy( pIo_buf, pdata, len);
+ }
+
+ status = rtw_usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
+
+ if ( status == len) // Success this control transfer.
+ {
+ rtw_reset_continual_io_error(pdvobjpriv);
+ if ( requesttype == 0x01 )
+ { // For Control read transfer, we have to copy the read data from pIo_buf to pdata.
+ _rtw_memcpy( pdata, pIo_buf, len );
+ }
+ }
+ else { // error cases
+ DBG_8192C("reg 0x%x, usb %s %u fail, status:%d value=0x%x, vendorreq_times:%d\n"
+ , value,(requesttype == 0x01)?"read":"write" , len, status, *(u32*)pdata, vendorreq_times);
+
+ if (status < 0) {
+ if(status == (-ESHUTDOWN) || status == -ENODEV )
+ {
+ padapter->bSurpriseRemoved = _TRUE;
+ } else {
+ #ifdef DBG_CONFIG_ERROR_DETECT
+ {
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ pHalData->srestpriv.Wifi_Error_Status = USB_VEN_REQ_CMD_FAIL;
+ }
+ #endif
+ }
+ }
+ else // status != len && status >= 0
+ {
+ if(status > 0) {
+ if ( requesttype == 0x01 )
+ { // For Control read transfer, we have to copy the read data from pIo_buf to pdata.
+ _rtw_memcpy( pdata, pIo_buf, len );
+ }
+ }
+ }
+
+ if(rtw_inc_and_chk_continual_io_error(pdvobjpriv) == _TRUE ){
+ padapter->bSurpriseRemoved = _TRUE;
+ break;
+ }
+
+ }
+
+ // firmware download is checksumed, don't retry
+ if( (value >= FW_START_ADDRESS ) || status == len )
+ break;
+
+ }
+
+ // release IO memory used by vendorreq
+ #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
+ rtw_mfree(tmp_buf, tmp_buflen);
+ #endif
+
+release_mutex:
+ #ifdef CONFIG_USB_VENDOR_REQ_MUTEX
+ _exit_critical_mutex(&pdvobjpriv->usb_vendor_req_mutex, NULL);
+ #endif
+exit:
+ return status;
+
+}
+
+#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
+static void _usbctrl_vendorreq_async_callback(struct urb *urb, struct pt_regs *regs)
+{
+ if (urb) {
+ if (urb->context) {
+ rtw_mfree(urb->context);
+ }
+ usb_free_urb(urb);
+ }
+}
+
+static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
+ u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
+{
+ int rc;
+ unsigned int pipe;
+ u8 reqtype;
+ struct usb_ctrlrequest *dr;
+ struct urb *urb;
+ struct rtl819x_async_write_data {
+ u8 data[VENDOR_CMD_MAX_DATA_LEN];
+ struct usb_ctrlrequest dr;
+ } *buf;
+
+
+ if (requesttype == VENDOR_READ) {
+ pipe = usb_rcvctrlpipe(udev, 0);//read_in
+ reqtype = REALTEK_USB_VENQT_READ;
+ }
+ else {
+ pipe = usb_sndctrlpipe(udev, 0);//write_out
+ reqtype = REALTEK_USB_VENQT_WRITE;
+ }
+
+ buf = (struct rtl819x_async_write_data *)rtw_zmalloc(sizeof(*buf));
+ if (!buf) {
+ rc = -ENOMEM;
+ goto exit;
+ }
+
+ urb = usb_alloc_urb(0, GFP_ATOMIC);
+ if (!urb) {
+ rtw_mfree((u8*)buf, sizeof(*buf));
+ rc = -ENOMEM;
+ goto exit;
+ }
+
+ dr = &buf->dr;
+
+ dr->bRequestType = reqtype;
+ dr->bRequest = request;
+ dr->wValue = cpu_to_le16(value);
+ dr->wIndex = cpu_to_le16(index);
+ dr->wLength = cpu_to_le16(len);
+
+ _rtw_memcpy(buf, pdata, len);
+
+ usb_fill_control_urb(urb, udev, pipe, (unsigned char *)dr, buf, len,
+ _usbctrl_vendorreq_async_callback, buf);
+
+ rc = usb_submit_urb(urb, GFP_ATOMIC);
+ if (rc < 0) {
+ rtw_mfree((u8*)buf, sizeof(*buf));
+ usb_free_urb(urb);
+ }
+
+exit:
+ return rc;
+}
+
+int usb_write_async(struct usb_device *udev, u32 addr, void *pdata, u16 len)
+{
+ u8 request;
+ u8 requesttype;
+ u16 wvalue;
+ u16 index;
+
+ int ret;
+
+ requesttype = VENDOR_WRITE;//write_out
+ request = REALTEK_USB_VENQT_CMD_REQ;
+ index = REALTEK_USB_VENQT_CMD_IDX;//n/a
+
+ wvalue = (u16)(addr&0x0000ffff);
+
+ ret = _usbctrl_vendorreq_async_write(udev, request, wvalue, index, pdata, len, requesttype);
+
+ return ret;
+}
+
+int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
+{
+ u8 data;
+ int ret;
+ struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
+ struct usb_device *udev=pdvobjpriv->pusbdev;
+
+ _func_enter_;
+ data = val;
+ ret = usb_write_async(udev, addr, &data, 1);
+ _func_exit_;
+
+ return ret;
+}
+
+int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
+{
+ u16 data;
+ int ret;
+ struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
+ struct usb_device *udev=pdvobjpriv->pusbdev;
+
+ _func_enter_;
+ data = val;
+ ret = usb_write_async(udev, addr, &data, 2);
+ _func_exit_;
+
+ return ret;
+}
+
+int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
+{
+ u32 data;
+ int ret;
+ struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
+ struct usb_device *udev=pdvobjpriv->pusbdev;
+
+ _func_enter_;
+ data = val;
+ ret = usb_write_async(udev, addr, &data, 4);
+ _func_exit_;
+
+ return ret;
+}
+#endif /* CONFIG_USB_SUPPORT_ASYNC_VDN_REQ */
+
+unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr)
+{
+ unsigned int pipe=0, ep_num=0;
+ struct usb_device *pusbd = pdvobj->pusbdev;
+
+ if (addr == RECV_BULK_IN_ADDR) {
+ pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[0]);
+
+ } else if (addr == RECV_INT_IN_ADDR) {
+ pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[1]);
+
+ } else if (addr < HW_QUEUE_ENTRY) {
+ ep_num = pdvobj->Queue2Pipe[addr];
+ pipe = usb_sndbulkpipe(pusbd, ep_num);
+ }
+
+ return pipe;
+}
+
+struct zero_bulkout_context{
+ void *pbuf;
+ void *purb;
+ void *pirp;
+ void *padapter;
+};
+
+static void usb_bulkout_zero_complete(struct urb *purb, struct pt_regs *regs)
+{
+ struct zero_bulkout_context *pcontext = (struct zero_bulkout_context *)purb->context;
+
+ //DBG_8192C("+usb_bulkout_zero_complete\n");
+
+ if(pcontext)
+ {
+ if(pcontext->pbuf)
+ {
+ rtw_mfree(pcontext->pbuf, sizeof(int));
+ }
+
+ if(pcontext->purb && (pcontext->purb==purb))
+ {
+ usb_free_urb(pcontext->purb);
+ }
+
+
+ rtw_mfree((u8*)pcontext, sizeof(struct zero_bulkout_context));
+ }
+
+
+}
+
+static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr)
+{
+ int pipe, status, len;
+ u32 ret;
+ unsigned char *pbuf;
+ struct zero_bulkout_context *pcontext;
+ PURB purb = NULL;
+ _adapter *padapter = (_adapter *)pintfhdl->padapter;
+ struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
+ struct pwrctrl_priv *pwrctl = dvobj_to_pwrctl(pdvobj);
+ struct usb_device *pusbd = pdvobj->pusbdev;
+
+ //DBG_871X("%s\n", __func__);
+
+
+ if (RTW_CANNOT_TX(padapter))
+ {
+ return _FAIL;
+ }
+
+
+ pcontext = (struct zero_bulkout_context *)rtw_zmalloc(sizeof(struct zero_bulkout_context));
+ if (pcontext == NULL) {
+ return _FAIL;
+ }
+
+ pbuf = (unsigned char *)rtw_zmalloc(sizeof(int));
+ purb = usb_alloc_urb(0, GFP_ATOMIC);
+
+ //translate DMA FIFO addr to pipehandle
+ pipe = ffaddr2pipehdl(pdvobj, addr);
+
+ len = 0;
+ pcontext->pbuf = pbuf;
+ pcontext->purb = purb;
+ pcontext->pirp = NULL;
+ pcontext->padapter = padapter;
+
+
+ //translate DMA FIFO addr to pipehandle
+ //pipe = ffaddr2pipehdl(pdvobj, addr);
+
+ usb_fill_bulk_urb(purb, pusbd, pipe,
+ pbuf,
+ len,
+ usb_bulkout_zero_complete,
+ pcontext);//context is pcontext
+
+ status = usb_submit_urb(purb, GFP_ATOMIC);
+
+ if (!status)
+ {
+ ret= _SUCCESS;
+ }
+ else
+ {
+ ret= _FAIL;
+ }
+
+
+ return _SUCCESS;
+
+}
+
+void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
+{
+
+}
+
+void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
+{
+
+}
+
+
+void usb_read_port_cancel(struct intf_hdl *pintfhdl)
+{
+ int i;
+ struct recv_buf *precvbuf;
+ _adapter *padapter = pintfhdl->padapter;
+ precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf;
+
+ DBG_871X("%s\n", __func__);
+
+ for (i=0; i < NR_RECVBUFF ; i++) {
+
+ precvbuf->reuse = _TRUE;
+ if (precvbuf->purb) {
+ //DBG_8192C("usb_read_port_cancel : usb_kill_urb \n");
+ usb_kill_urb(precvbuf->purb);
+ }
+ precvbuf++;
+ }
+
+#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
+ usb_kill_urb(padapter->recvpriv.int_in_urb);
+#endif
+}
+
+static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs)
+{
+ _irqL irqL;
+ int i;
+ struct xmit_buf *pxmitbuf = (struct xmit_buf *)purb->context;
+ //struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data;
+ //_adapter *padapter = pxmitframe->padapter;
+ _adapter *padapter = pxmitbuf->padapter;
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+ //struct pkt_attrib *pattrib = &pxmitframe->attrib;
+
+_func_enter_;
+
+ switch(pxmitbuf->flags)
+ {
+ case VO_QUEUE_INX:
+ pxmitpriv->voq_cnt--;
+ break;
+ case VI_QUEUE_INX:
+ pxmitpriv->viq_cnt--;
+ break;
+ case BE_QUEUE_INX:
+ pxmitpriv->beq_cnt--;
+ break;
+ case BK_QUEUE_INX:
+ pxmitpriv->bkq_cnt--;
+ break;
+ default:
+ break;
+ }
+
+
+/*
+ _enter_critical(&pxmitpriv->lock, &irqL);
+
+ pxmitpriv->txirp_cnt--;
+
+ switch(pattrib->priority)
+ {
+ case 1:
+ case 2:
+ pxmitpriv->bkq_cnt--;
+ //DBG_8192C("pxmitpriv->bkq_cnt=%d\n", pxmitpriv->bkq_cnt);
+ break;
+ case 4:
+ case 5:
+ pxmitpriv->viq_cnt--;
+ //DBG_8192C("pxmitpriv->viq_cnt=%d\n", pxmitpriv->viq_cnt);
+ break;
+ case 6:
+ case 7:
+ pxmitpriv->voq_cnt--;
+ //DBG_8192C("pxmitpriv->voq_cnt=%d\n", pxmitpriv->voq_cnt);
+ break;
+ case 0:
+ case 3:
+ default:
+ pxmitpriv->beq_cnt--;
+ //DBG_8192C("pxmitpriv->beq_cnt=%d\n", pxmitpriv->beq_cnt);
+ break;
+
+ }
+
+ _exit_critical(&pxmitpriv->lock, &irqL);
+
+
+ if(pxmitpriv->txirp_cnt==0)
+ {
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: txirp_cnt== 0, set allrxreturnevt!\n"));
+ _rtw_up_sema(&(pxmitpriv->tx_retevt));
+ }
+*/
+ //rtw_free_xmitframe(pxmitpriv, pxmitframe);
+
+ if (RTW_CANNOT_TX(padapter))
+ {
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved));
+ DBG_8192C("%s(): TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) pxmitbuf->buf_tag(%x) \n",
+ __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,pxmitbuf->buf_tag);
+
+ goto check_completion;
+ }
+
+
+ if (purb->status==0) {
+
+ } else {
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete : purb->status(%d) != 0 \n", purb->status));
+ DBG_871X("###=> urb_write_port_complete status(%d)\n",purb->status);
+ if((purb->status==-EPIPE)||(purb->status==-EPROTO))
+ {
+ //usb_clear_halt(pusbdev, purb->pipe);
+ //msleep(10);
+ sreset_set_wifi_error_status(padapter, USB_WRITE_PORT_FAIL);
+ } else if (purb->status == -EINPROGRESS) {
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: EINPROGESS\n"));
+ goto check_completion;
+
+ } else if (purb->status == -ENOENT) {
+ DBG_871X("%s: -ENOENT\n", __func__);
+ goto check_completion;
+
+ } else if (purb->status == -ECONNRESET) {
+ DBG_871X("%s: -ECONNRESET\n", __func__);
+ goto check_completion;
+
+ } else if (purb->status == -ESHUTDOWN) {
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: ESHUTDOWN\n"));
+ padapter->bDriverStopped=_TRUE;
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped=TRUE\n"));
+
+ goto check_completion;
+ }
+ else
+ {
+ padapter->bSurpriseRemoved=_TRUE;
+ DBG_8192C("bSurpriseRemoved=TRUE\n");
+ //rtl8192cu_trigger_gpio_0(padapter);
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bSurpriseRemoved=TRUE\n"));
+
+ goto check_completion;
+ }
+ }
+
+ #ifdef DBG_CONFIG_ERROR_DETECT
+ {
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ pHalData->srestpriv.last_tx_complete_time = rtw_get_current_time();
+ }
+ #endif
+
+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);
+ _exit_critical(&pxmitpriv->lock_sctx, &irqL);
+
+ rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
+
+ //if(rtw_txframes_pending(padapter))
+ {
+ tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
+ }
+
+_func_exit_;
+
+}
+
+u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
+{
+ _irqL irqL;
+ unsigned int pipe;
+ int status;
+ u32 ret = _FAIL, bwritezero = _FALSE;
+ PURB purb = NULL;
+ _adapter *padapter = (_adapter *)pintfhdl->padapter;
+ struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
+ struct pwrctrl_priv *pwrctl = dvobj_to_pwrctl(pdvobj);
+ struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+ struct xmit_buf *pxmitbuf = (struct xmit_buf *)wmem;
+ struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data;
+ struct usb_device *pusbd = pdvobj->pusbdev;
+ struct pkt_attrib *pattrib = &pxmitframe->attrib;
+
+_func_enter_;
+
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("+usb_write_port\n"));
+
+ if (RTW_CANNOT_TX(padapter)) {
+ #ifdef DBG_TX
+ DBG_871X(" DBG_TX %s:%d bDriverStopped%d, bSurpriseRemoved:%d\n",__FUNCTION__, __LINE__
+ ,padapter->bDriverStopped, padapter->bSurpriseRemoved);
+ #endif
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved )!!!\n"));
+ rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_TX_DENY);
+ goto exit;
+ }
+
+ _enter_critical(&pxmitpriv->lock, &irqL);
+
+ switch(addr)
+ {
+ case VO_QUEUE_INX:
+ pxmitpriv->voq_cnt++;
+ pxmitbuf->flags = VO_QUEUE_INX;
+ break;
+ case VI_QUEUE_INX:
+ pxmitpriv->viq_cnt++;
+ pxmitbuf->flags = VI_QUEUE_INX;
+ break;
+ case BE_QUEUE_INX:
+ pxmitpriv->beq_cnt++;
+ pxmitbuf->flags = BE_QUEUE_INX;
+ break;
+ case BK_QUEUE_INX:
+ pxmitpriv->bkq_cnt++;
+ pxmitbuf->flags = BK_QUEUE_INX;
+ break;
+ case HIGH_QUEUE_INX:
+ pxmitbuf->flags = HIGH_QUEUE_INX;
+ break;
+ default:
+ pxmitbuf->flags = MGT_QUEUE_INX;
+ break;
+ }
+
+ _exit_critical(&pxmitpriv->lock, &irqL);
+
+ purb = pxmitbuf->pxmit_urb[0];
+
+ //translate DMA FIFO addr to pipehandle
+ pipe = ffaddr2pipehdl(pdvobj, addr);
+
+#ifdef CONFIG_REDUCE_USB_TX_INT
+ if ( (pxmitpriv->free_xmitbuf_cnt%NR_XMITBUFF == 0)
+ || (pxmitbuf->buf_tag > XMITBUF_DATA) )
+ {
+ purb->transfer_flags &= (~URB_NO_INTERRUPT);
+ } else {
+ purb->transfer_flags |= URB_NO_INTERRUPT;
+ //DBG_8192C("URB_NO_INTERRUPT ");
+ }
+#endif
+
+
+ usb_fill_bulk_urb(purb, pusbd, pipe,
+ pxmitframe->buf_addr, //= pxmitbuf->pbuf
+ cnt,
+ usb_write_port_complete,
+ pxmitbuf);//context is pxmitbuf
+
+#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX
+ purb->transfer_dma = pxmitbuf->dma_transfer_addr;
+ purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+ purb->transfer_flags |= URB_ZERO_PACKET;
+#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX
+
+#ifdef USB_PACKET_OFFSET_SZ
+#if (USB_PACKET_OFFSET_SZ == 0)
+ purb->transfer_flags |= URB_ZERO_PACKET;
+#endif
+#endif
+
+#if 0
+ if (bwritezero)
+ {
+ purb->transfer_flags |= URB_ZERO_PACKET;
+ }
+#endif
+
+ status = usb_submit_urb(purb, GFP_ATOMIC);
+ if (!status) {
+ #ifdef DBG_CONFIG_ERROR_DETECT
+ {
+ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
+ pHalData->srestpriv.last_tx_time = rtw_get_current_time();
+ }
+ #endif
+ } else {
+ rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR);
+ DBG_871X("usb_write_port, status=%d\n", status);
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port(): usb_submit_urb, status=%x\n", status));
+
+ switch (status) {
+ case -ENODEV:
+ padapter->bDriverStopped=_TRUE;
+ break;
+ default:
+ break;
+ }
+ goto exit;
+ }
+
+ ret= _SUCCESS;
+
+// Commented by Albert 2009/10/13
+// We add the URB_ZERO_PACKET flag to urb so that the host will send the zero packet automatically.
+/*
+ if(bwritezero == _TRUE)
+ {
+ usb_bulkout_zero(pintfhdl, addr);
+ }
+*/
+
+ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("-usb_write_port\n"));
+
+exit:
+ if (ret != _SUCCESS)
+ rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
+_func_exit_;
+ return ret;
+
+}
+
+void usb_write_port_cancel(struct intf_hdl *pintfhdl)
+{
+ int i, j;
+ _adapter *padapter = pintfhdl->padapter;
+ struct xmit_buf *pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmitbuf;
+
+ DBG_871X("%s \n", __func__);
+
+ for (i=0; i<NR_XMITBUFF; i++) {
+ for (j=0; j<8; j++) {
+ if (pxmitbuf->pxmit_urb[j]) {
+ usb_kill_urb(pxmitbuf->pxmit_urb[j]);
+ }
+ }
+ pxmitbuf++;
+ }
+
+ pxmitbuf = (struct xmit_buf*)padapter->xmitpriv.pxmit_extbuf;
+ 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]);
+ }
+ }
+ pxmitbuf++;
+ }
+}
+
diff --git a/rtl8xxx_EU/os_dep/linux/wifi_regd.c b/rtl8xxx_EU/os_dep/linux/wifi_regd.c
index 2831ff1..2831ff1 100644..100755
--- a/rtl8xxx_EU/os_dep/linux/wifi_regd.c
+++ b/rtl8xxx_EU/os_dep/linux/wifi_regd.c
diff --git a/rtl8xxx_EU/os_dep/linux/xmit_linux.c b/rtl8xxx_EU/os_dep/linux/xmit_linux.c
index 732408f..732408f 100644..100755
--- a/rtl8xxx_EU/os_dep/linux/xmit_linux.c
+++ b/rtl8xxx_EU/os_dep/linux/xmit_linux.c
diff --git a/rtl8xxx_EU/platform/platform_ARM_SUNnI_sdio.c b/rtl8xxx_EU/platform/platform_ARM_SUNnI_sdio.c
index 4806526..49ccf8d 100755
--- a/rtl8xxx_EU/platform/platform_ARM_SUNnI_sdio.c
+++ b/rtl8xxx_EU/platform/platform_ARM_SUNnI_sdio.c
@@ -1,111 +1,111 @@
-/******************************************************************************
- *
- * 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
- *
- *
- ******************************************************************************/
-/*
- * Description:
- * This file can be applied to following platforms:
- * CONFIG_PLATFORM_ARM_SUN6I
- * CONFIG_PLATFORM_ARM_SUN7I
- * CONFIG_PLATFORM_ARM_SUN8I
- */
-#include <drv_types.h>
-#include <mach/sys_config.h>
-#ifdef CONFIG_GPIO_WAKEUP
-#include <linux/gpio.h>
-#endif
-
-#ifdef CONFIG_MMC
-static int sdc_id = -1;
-static signed int gpio_eint_wlan = -1;
-static u32 eint_wlan_handle = 0;
-#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
-extern void sw_mci_rescan_card(unsigned id, unsigned insert);
-#elif defined(CONFIG_PLATFORM_ARM_SUN8I)
-extern void sunxi_mci_rescan_card(unsigned id, unsigned insert);
-#endif
-extern int wifi_pm_get_mod_type(void);
-extern void wifi_pm_power(int on);
-#ifdef CONFIG_GPIO_WAKEUP
-extern unsigned int oob_irq;
-#endif
-#endif // CONFIG_MMC
-
-/*
- * Return:
- * 0: power on successfully
- * others: power on failed
- */
-int platform_wifi_power_on(void)
-{
- int ret = 0;
-
-#ifdef CONFIG_MMC
-{
- script_item_u val;
- script_item_value_type_e type;
-
- unsigned int mod_sel = wifi_pm_get_mod_type();
-
- type = script_get_item("wifi_para", "wifi_sdc_id", &val);
- if (SCIRPT_ITEM_VALUE_TYPE_INT!=type) {
- DBG_871X("get wifi_sdc_id failed\n");
- ret = -1;
- } 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
- DBG_871X("%s: power up, rescan card.\n", __FUNCTION__);
- }
-
-#ifdef CONFIG_GPIO_WAKEUP
- type = script_get_item("wifi_para", "rtl8723bs_wl_host_wake", &val);
- if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) {
- DBG_871X("has no rtl8723bs_wl_wake_host\n");
- ret = -1;
- } else {
- gpio_eint_wlan = val.gpio.gpio;
-#ifdef CONFIG_PLATFORM_ARM_SUN8I
- oob_irq = gpio_to_irq(gpio_eint_wlan);
-#endif
- }
-#endif // CONFIG_GPIO_WAKEUP
-}
-#endif // CONFIG_MMC
-
- return ret;
-}
-
-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
- DBG_871X("%s: remove card, power off.\n", __FUNCTION__);
-#endif // CONFIG_MMC
-}
+/******************************************************************************
+ *
+ * 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
+ *
+ *
+ ******************************************************************************/
+/*
+ * Description:
+ * This file can be applied to following platforms:
+ * CONFIG_PLATFORM_ARM_SUN6I
+ * CONFIG_PLATFORM_ARM_SUN7I
+ * CONFIG_PLATFORM_ARM_SUN8I
+ */
+#include <drv_types.h>
+#include <mach/sys_config.h>
+#ifdef CONFIG_GPIO_WAKEUP
+#include <linux/gpio.h>
+#endif
+
+#ifdef CONFIG_MMC
+static int sdc_id = -1;
+static signed int gpio_eint_wlan = -1;
+static u32 eint_wlan_handle = 0;
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+extern void sw_mci_rescan_card(unsigned id, unsigned insert);
+#elif defined(CONFIG_PLATFORM_ARM_SUN8I)
+extern void sunxi_mci_rescan_card(unsigned id, unsigned insert);
+#endif
+extern int wifi_pm_get_mod_type(void);
+extern void wifi_pm_power(int on);
+#ifdef CONFIG_GPIO_WAKEUP
+extern unsigned int oob_irq;
+#endif
+#endif // CONFIG_MMC
+
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+
+#ifdef CONFIG_MMC
+{
+ script_item_u val;
+ script_item_value_type_e type;
+
+ unsigned int mod_sel = wifi_pm_get_mod_type();
+
+ type = script_get_item("wifi_para", "wifi_sdc_id", &val);
+ if (SCIRPT_ITEM_VALUE_TYPE_INT!=type) {
+ DBG_871X("get wifi_sdc_id failed\n");
+ ret = -1;
+ } 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
+ DBG_871X("%s: power up, rescan card.\n", __FUNCTION__);
+ }
+
+#ifdef CONFIG_GPIO_WAKEUP
+ type = script_get_item("wifi_para", "rtl8723bs_wl_host_wake", &val);
+ if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) {
+ DBG_871X("has no rtl8723bs_wl_wake_host\n");
+ ret = -1;
+ } else {
+ gpio_eint_wlan = val.gpio.gpio;
+#ifdef CONFIG_PLATFORM_ARM_SUN8I
+ oob_irq = gpio_to_irq(gpio_eint_wlan);
+#endif
+ }
+#endif // CONFIG_GPIO_WAKEUP
+}
+#endif // CONFIG_MMC
+
+ return ret;
+}
+
+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
+ DBG_871X("%s: remove card, power off.\n", __FUNCTION__);
+#endif // CONFIG_MMC
+}
diff --git a/rtl8xxx_EU/platform/platform_ARM_SUNxI_sdio.c b/rtl8xxx_EU/platform/platform_ARM_SUNxI_sdio.c
index 5bc888d..770f935 100755
--- a/rtl8xxx_EU/platform/platform_ARM_SUNxI_sdio.c
+++ b/rtl8xxx_EU/platform/platform_ARM_SUNxI_sdio.c
@@ -1,95 +1,95 @@
-/******************************************************************************
- *
- * Copyright(c) 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#include <drv_types.h>
-
-#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
-#ifdef CONFIG_WITS_EVB_V13
-#define SDIOID 0
-#else // !CONFIG_WITS_EVB_V13
-#define SDIOID (CONFIG_CHIP_ID==1123 ? 3 : 1)
-#endif // !CONFIG_WITS_EVB_V13
-
-#define SUNXI_SDIO_WIFI_NUM_RTL8189ES 10
-extern void sunximmc_rescan_card(unsigned id, unsigned insert);
-extern int mmc_pm_get_mod_type(void);
-extern int mmc_pm_gpio_ctrl(char* name, int level);
-/*
- * rtl8189es_shdn = port:PH09<1><default><default><0>
- * rtl8189es_wakeup = port:PH10<1><default><default><1>
- * rtl8189es_vdd_en = port:PH11<1><default><default><0>
- * rtl8189es_vcc_en = port:PH12<1><default><default><0>
- */
-
-int rtl8189es_sdio_powerup(void)
-{
- mmc_pm_gpio_ctrl("rtl8189es_vdd_en", 1);
- udelay(100);
- mmc_pm_gpio_ctrl("rtl8189es_vcc_en", 1);
- udelay(50);
- mmc_pm_gpio_ctrl("rtl8189es_shdn", 1);
- return 0;
-}
-
-int rtl8189es_sdio_poweroff(void)
-{
- mmc_pm_gpio_ctrl("rtl8189es_shdn", 0);
- mmc_pm_gpio_ctrl("rtl8189es_vcc_en", 0);
- mmc_pm_gpio_ctrl("rtl8189es_vdd_en", 0);
- return 0;
-}
-#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
-
-/*
- * Return:
- * 0: power on successfully
- * others: power on failed
- */
-int platform_wifi_power_on(void)
-{
- int ret = 0;
-#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
- unsigned int mod_sel = mmc_pm_get_mod_type();
-#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
-
-
-#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
- if (mod_sel == SUNXI_SDIO_WIFI_NUM_RTL8189ES) {
- rtl8189es_sdio_powerup();
- sunximmc_rescan_card(SDIOID, 1);
- printk("[rtl8189es] %s: power up, rescan card.\n", __FUNCTION__);
- } else {
- ret = -1;
- printk("[rtl8189es] %s: mod_sel = %d is incorrect.\n", __FUNCTION__, mod_sel);
- }
-#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
-
- return ret;
-}
-
-void platform_wifi_power_off(void)
-{
-#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
- sunximmc_rescan_card(SDIOID, 0);
-#ifdef CONFIG_RTL8188E
- rtl8189es_sdio_poweroff();
- printk("[rtl8189es] %s: remove card, power off.\n", __FUNCTION__);
-#endif // CONFIG_RTL8188E
-#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
-}
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#include <drv_types.h>
+
+#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
+#ifdef CONFIG_WITS_EVB_V13
+#define SDIOID 0
+#else // !CONFIG_WITS_EVB_V13
+#define SDIOID (CONFIG_CHIP_ID==1123 ? 3 : 1)
+#endif // !CONFIG_WITS_EVB_V13
+
+#define SUNXI_SDIO_WIFI_NUM_RTL8189ES 10
+extern void sunximmc_rescan_card(unsigned id, unsigned insert);
+extern int mmc_pm_get_mod_type(void);
+extern int mmc_pm_gpio_ctrl(char* name, int level);
+/*
+ * rtl8189es_shdn = port:PH09<1><default><default><0>
+ * rtl8189es_wakeup = port:PH10<1><default><default><1>
+ * rtl8189es_vdd_en = port:PH11<1><default><default><0>
+ * rtl8189es_vcc_en = port:PH12<1><default><default><0>
+ */
+
+int rtl8189es_sdio_powerup(void)
+{
+ mmc_pm_gpio_ctrl("rtl8189es_vdd_en", 1);
+ udelay(100);
+ mmc_pm_gpio_ctrl("rtl8189es_vcc_en", 1);
+ udelay(50);
+ mmc_pm_gpio_ctrl("rtl8189es_shdn", 1);
+ return 0;
+}
+
+int rtl8189es_sdio_poweroff(void)
+{
+ mmc_pm_gpio_ctrl("rtl8189es_shdn", 0);
+ mmc_pm_gpio_ctrl("rtl8189es_vcc_en", 0);
+ mmc_pm_gpio_ctrl("rtl8189es_vdd_en", 0);
+ return 0;
+}
+#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
+
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
+ unsigned int mod_sel = mmc_pm_get_mod_type();
+#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
+
+
+#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
+ if (mod_sel == SUNXI_SDIO_WIFI_NUM_RTL8189ES) {
+ rtl8189es_sdio_powerup();
+ sunximmc_rescan_card(SDIOID, 1);
+ printk("[rtl8189es] %s: power up, rescan card.\n", __FUNCTION__);
+ } else {
+ ret = -1;
+ printk("[rtl8189es] %s: mod_sel = %d is incorrect.\n", __FUNCTION__, mod_sel);
+ }
+#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
+
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
+ sunximmc_rescan_card(SDIOID, 0);
+#ifdef CONFIG_RTL8188E
+ rtl8189es_sdio_poweroff();
+ printk("[rtl8189es] %s: remove card, power off.\n", __FUNCTION__);
+#endif // CONFIG_RTL8188E
+#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
+}
diff --git a/rtl8xxx_EU/platform/platform_ARM_SUNxI_usb.c b/rtl8xxx_EU/platform/platform_ARM_SUNxI_usb.c
index 5352313..774392b 100755
--- a/rtl8xxx_EU/platform/platform_ARM_SUNxI_usb.c
+++ b/rtl8xxx_EU/platform/platform_ARM_SUNxI_usb.c
@@ -1,142 +1,142 @@
-/******************************************************************************
- *
- * 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
- *
- *
- ******************************************************************************/
-/*
- * Description:
- * This file can be applied to following platforms:
- * CONFIG_PLATFORM_ARM_SUNXI Series platform
- *
- */
-
-#include <drv_types.h>
-#include <mach/sys_config.h>
-
-#ifdef CONFIG_PLATFORM_ARM_SUNxI
-extern int sw_usb_disable_hcd(__u32 usbc_no);
-extern int sw_usb_enable_hcd(__u32 usbc_no);
-static int usb_wifi_host = 2;
-#endif
-
-#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
-extern int sw_usb_disable_hcd(__u32 usbc_no);
-extern int sw_usb_enable_hcd(__u32 usbc_no);
-extern void wifi_pm_power(int on);
-static script_item_u item;
-#endif
-
-#ifdef CONFIG_PLATFORM_ARM_SUN8I
-extern int sunxi_usb_disable_hcd(__u32 usbc_no);
-extern int sunxi_usb_enable_hcd(__u32 usbc_no);
-extern void wifi_pm_power(int on);
-static script_item_u item;
-#endif
-
-
-int platform_wifi_power_on(void)
-{
- int ret = 0;
-
-#ifdef CONFIG_PLATFORM_ARM_SUNxI
-#ifndef CONFIG_RTL8723A
- {
- /* ----------get usb_wifi_usbc_num------------- */
- ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64);
- if(ret != 0){
- DBG_8192C("ERR: script_parser_fetch usb_wifi_usbc_num failed\n");
- ret = -ENOMEM;
- goto exit;
- }
- DBG_8192C("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host);
- sw_usb_enable_hcd(usb_wifi_host);
- }
-#endif //CONFIG_RTL8723A
-#endif //CONFIG_PLATFORM_ARM_SUNxI
-
-#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
- {
- script_item_value_type_e type;
-
- type = script_get_item("wifi_para", "wifi_usbc_id", &item);
- if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
- printk("ERR: script_get_item wifi_usbc_id failed\n");
- ret = -ENOMEM;
- goto exit;
- }
-
- printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
- wifi_pm_power(1);
- mdelay(10);
-
- #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
- sw_usb_enable_hcd(item.val);
- #endif
- }
-#endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
-
-#if defined(CONFIG_PLATFORM_ARM_SUN8I)
- {
- script_item_value_type_e type;
-
- type = script_get_item("wifi_para", "wifi_usbc_id", &item);
- if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
- printk("ERR: script_get_item wifi_usbc_id failed\n");
- ret = -ENOMEM;
- goto exit;
- }
-
- printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
- wifi_pm_power(1);
- mdelay(10);
-
- #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
- sunxi_usb_enable_hcd(item.val);
- #endif
- }
-#endif //CONFIG_PLATFORM_ARM_SUN8I
-
-exit:
- return ret;
-}
-
-void platform_wifi_power_off(void)
-{
-
-#ifdef CONFIG_PLATFORM_ARM_SUNxI
-#ifndef CONFIG_RTL8723A
- DBG_8192C("sw_usb_disable_hcd: usbc_num = %d\n", usb_wifi_host);
- sw_usb_disable_hcd(usb_wifi_host);
-#endif //ifndef CONFIG_RTL8723A
-#endif //CONFIG_PLATFORM_ARM_SUNxI
-
-#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
- #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
- sw_usb_disable_hcd(item.val);
- #endif
- wifi_pm_power(0);
-#endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
-
-#if defined(CONFIG_PLATFORM_ARM_SUN8I)
- #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
- sunxi_usb_disable_hcd(item.val);
- #endif
- wifi_pm_power(0);
-#endif //defined(CONFIG_PLATFORM_ARM_SUN8I)
-
-}
-
+/******************************************************************************
+ *
+ * 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
+ *
+ *
+ ******************************************************************************/
+/*
+ * Description:
+ * This file can be applied to following platforms:
+ * CONFIG_PLATFORM_ARM_SUNXI Series platform
+ *
+ */
+
+#include <drv_types.h>
+#include <mach/sys_config.h>
+
+#ifdef CONFIG_PLATFORM_ARM_SUNxI
+extern int sw_usb_disable_hcd(__u32 usbc_no);
+extern int sw_usb_enable_hcd(__u32 usbc_no);
+static int usb_wifi_host = 2;
+#endif
+
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+extern int sw_usb_disable_hcd(__u32 usbc_no);
+extern int sw_usb_enable_hcd(__u32 usbc_no);
+extern void wifi_pm_power(int on);
+static script_item_u item;
+#endif
+
+#ifdef CONFIG_PLATFORM_ARM_SUN8I
+extern int sunxi_usb_disable_hcd(__u32 usbc_no);
+extern int sunxi_usb_enable_hcd(__u32 usbc_no);
+extern void wifi_pm_power(int on);
+static script_item_u item;
+#endif
+
+
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+
+#ifdef CONFIG_PLATFORM_ARM_SUNxI
+#ifndef CONFIG_RTL8723A
+ {
+ /* ----------get usb_wifi_usbc_num------------- */
+ ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64);
+ if(ret != 0){
+ DBG_8192C("ERR: script_parser_fetch usb_wifi_usbc_num failed\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+ DBG_8192C("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host);
+ sw_usb_enable_hcd(usb_wifi_host);
+ }
+#endif //CONFIG_RTL8723A
+#endif //CONFIG_PLATFORM_ARM_SUNxI
+
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+ {
+ script_item_value_type_e type;
+
+ type = script_get_item("wifi_para", "wifi_usbc_id", &item);
+ if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
+ printk("ERR: script_get_item wifi_usbc_id failed\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+
+ printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
+ wifi_pm_power(1);
+ mdelay(10);
+
+ #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
+ sw_usb_enable_hcd(item.val);
+ #endif
+ }
+#endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+
+#if defined(CONFIG_PLATFORM_ARM_SUN8I)
+ {
+ script_item_value_type_e type;
+
+ type = script_get_item("wifi_para", "wifi_usbc_id", &item);
+ if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
+ printk("ERR: script_get_item wifi_usbc_id failed\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+
+ printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
+ wifi_pm_power(1);
+ mdelay(10);
+
+ #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
+ sunxi_usb_enable_hcd(item.val);
+ #endif
+ }
+#endif //CONFIG_PLATFORM_ARM_SUN8I
+
+exit:
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+
+#ifdef CONFIG_PLATFORM_ARM_SUNxI
+#ifndef CONFIG_RTL8723A
+ DBG_8192C("sw_usb_disable_hcd: usbc_num = %d\n", usb_wifi_host);
+ sw_usb_disable_hcd(usb_wifi_host);
+#endif //ifndef CONFIG_RTL8723A
+#endif //CONFIG_PLATFORM_ARM_SUNxI
+
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+ #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
+ sw_usb_disable_hcd(item.val);
+ #endif
+ wifi_pm_power(0);
+#endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+
+#if defined(CONFIG_PLATFORM_ARM_SUN8I)
+ #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
+ sunxi_usb_disable_hcd(item.val);
+ #endif
+ wifi_pm_power(0);
+#endif //defined(CONFIG_PLATFORM_ARM_SUN8I)
+
+}
+
diff --git a/rtl8xxx_EU/platform/platform_RTK_DMP_usb.c b/rtl8xxx_EU/platform/platform_RTK_DMP_usb.c
index 5331433..d296641 100755
--- a/rtl8xxx_EU/platform/platform_RTK_DMP_usb.c
+++ b/rtl8xxx_EU/platform/platform_RTK_DMP_usb.c
@@ -1,36 +1,36 @@
-/******************************************************************************
- *
- * Copyright(c) 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#include <drv_types.h>
-
-int platform_wifi_power_on(void)
-{
- int ret = 0;
- u32 tmp;
- tmp=readl((volatile unsigned int*)0xb801a608);
- tmp &= 0xffffff00;
- tmp |= 0x55;
- writel(tmp,(volatile unsigned int*)0xb801a608);//write dummy register for 1055
- return ret;
-}
-
-void platform_wifi_power_off(void)
-{
-}
-
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#include <drv_types.h>
+
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+ u32 tmp;
+ tmp=readl((volatile unsigned int*)0xb801a608);
+ tmp &= 0xffffff00;
+ tmp |= 0x55;
+ writel(tmp,(volatile unsigned int*)0xb801a608);//write dummy register for 1055
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+}
+
diff --git a/rtl8xxx_EU/platform/platform_aml.c b/rtl8xxx_EU/platform/platform_aml.c
index 5ec49da..5ec49da 100644..100755
--- a/rtl8xxx_EU/platform/platform_aml.c
+++ b/rtl8xxx_EU/platform/platform_aml.c
diff --git a/rtl8xxx_EU/platform/platform_ops.c b/rtl8xxx_EU/platform/platform_ops.c
index e9b0191..cd2f4e5 100755
--- a/rtl8xxx_EU/platform/platform_ops.c
+++ b/rtl8xxx_EU/platform/platform_ops.c
@@ -1,37 +1,37 @@
-/******************************************************************************
- *
- * Copyright(c) 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef CONFIG_PLATFORM_OPS
-/*
- * Return:
- * 0: power on successfully
- * others: power on failed
- */
-int platform_wifi_power_on(void)
-{
- int ret = 0;
-
-
- return ret;
-}
-
-void platform_wifi_power_off(void)
-{
-}
-#endif // !CONFIG_PLATFORM_OPS
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef CONFIG_PLATFORM_OPS
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+
+
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+}
+#endif // !CONFIG_PLATFORM_OPS
diff --git a/rtl8xxx_EU/platform/platform_ops.h b/rtl8xxx_EU/platform/platform_ops.h
index bd2e668..7b66f44 100755
--- a/rtl8xxx_EU/platform/platform_ops.h
+++ b/rtl8xxx_EU/platform/platform_ops.h
@@ -1,31 +1,31 @@
-/******************************************************************************
- *
- * Copyright(c) 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#ifndef __PLATFORM_OPS_H__
-#define __PLATFORM_OPS_H__
-
-/*
- * Return:
- * 0: power on successfully
- * others: power on failed
- */
-int platform_wifi_power_on(void);
-void platform_wifi_power_off(void);
-
-#endif // __PLATFORM_OPS_H__
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __PLATFORM_OPS_H__
+#define __PLATFORM_OPS_H__
+
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void);
+void platform_wifi_power_off(void);
+
+#endif // __PLATFORM_OPS_H__
diff --git a/rtl8xxx_EU/platform/platform_sprd_sdio.c b/rtl8xxx_EU/platform/platform_sprd_sdio.c
index a4e2502..eec8945 100755
--- a/rtl8xxx_EU/platform/platform_sprd_sdio.c
+++ b/rtl8xxx_EU/platform/platform_sprd_sdio.c
@@ -1,89 +1,89 @@
-/******************************************************************************
- *
- * Copyright(c) 2013 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-#include <drv_types.h>
-
-extern void sdhci_bus_scan(void);
-#ifndef ANDROID_2X
-extern int sdhci_device_attached(void);
-#endif
-
-/*
- * Return:
- * 0: power on successfully
- * others: power on failed
- */
-int platform_wifi_power_on(void)
-{
- int ret = 0;
-
-
-#ifdef CONFIG_RTL8188E
- rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_ON);
-#endif // CONFIG_RTL8188E
-
- /* Pull up pwd pin, make wifi leave power down mode. */
- rtw_wifi_gpio_init();
- rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_ON);
-
-#if (MP_DRIVER == 1) && (defined(CONFIG_RTL8723A)||defined(CONFIG_RTL8723B))
- // Pull up BT reset pin.
- rtw_wifi_gpio_wlan_ctrl(WLAN_BT_PWDN_ON);
-#endif
- rtw_mdelay_os(5);
-
- sdhci_bus_scan();
-#ifdef CONFIG_RTL8723B
- //YJ,test,130305
- rtw_mdelay_os(1000);
-#endif
-#ifdef ANDROID_2X
- rtw_mdelay_os(200);
-#else // !ANDROID_2X
- if (1) {
- int i = 0;
-
- for (i = 0; i <= 50; i++) {
- msleep(10);
- if (sdhci_device_attached())
- break;
- printk("%s delay times:%d\n", __func__, i);
- }
- }
-#endif // !ANDROID_2X
-
- return ret;
-}
-
-void platform_wifi_power_off(void)
-{
- /* Pull down pwd pin, make wifi enter power down mode. */
- rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_OFF);
- rtw_mdelay_os(5);
- rtw_wifi_gpio_deinit();
-
-#ifdef CONFIG_RTL8188E
- rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_OFF);
-#endif // CONFIG_RTL8188E
-
-#ifdef CONFIG_WOWLAN
- if(mmc_host)
- mmc_host->pm_flags &= ~MMC_PM_KEEP_POWER;
-#endif // CONFIG_WOWLAN
-}
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#include <drv_types.h>
+
+extern void sdhci_bus_scan(void);
+#ifndef ANDROID_2X
+extern int sdhci_device_attached(void);
+#endif
+
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+
+
+#ifdef CONFIG_RTL8188E
+ rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_ON);
+#endif // CONFIG_RTL8188E
+
+ /* Pull up pwd pin, make wifi leave power down mode. */
+ rtw_wifi_gpio_init();
+ rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_ON);
+
+#if (MP_DRIVER == 1) && (defined(CONFIG_RTL8723A)||defined(CONFIG_RTL8723B))
+ // Pull up BT reset pin.
+ rtw_wifi_gpio_wlan_ctrl(WLAN_BT_PWDN_ON);
+#endif
+ rtw_mdelay_os(5);
+
+ sdhci_bus_scan();
+#ifdef CONFIG_RTL8723B
+ //YJ,test,130305
+ rtw_mdelay_os(1000);
+#endif
+#ifdef ANDROID_2X
+ rtw_mdelay_os(200);
+#else // !ANDROID_2X
+ if (1) {
+ int i = 0;
+
+ for (i = 0; i <= 50; i++) {
+ msleep(10);
+ if (sdhci_device_attached())
+ break;
+ printk("%s delay times:%d\n", __func__, i);
+ }
+ }
+#endif // !ANDROID_2X
+
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+ /* Pull down pwd pin, make wifi enter power down mode. */
+ rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_OFF);
+ rtw_mdelay_os(5);
+ rtw_wifi_gpio_deinit();
+
+#ifdef CONFIG_RTL8188E
+ rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_OFF);
+#endif // CONFIG_RTL8188E
+
+#ifdef CONFIG_WOWLAN
+ if(mmc_host)
+ mmc_host->pm_flags &= ~MMC_PM_KEEP_POWER;
+#endif // CONFIG_WOWLAN
+}