1EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) 2EXTRA_CFLAGS += -O1 3#EXTRA_CFLAGS += -O3 4#EXTRA_CFLAGS += -Wall 5#EXTRA_CFLAGS += -Wextra 6#EXTRA_CFLAGS += -Werror 7#EXTRA_CFLAGS += -pedantic 8#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes 9 10EXTRA_CFLAGS += -Wno-unused-variable 11#EXTRA_CFLAGS += -Wno-unused-value 12#EXTRA_CFLAGS += -Wno-unused-label 13#EXTRA_CFLAGS += -Wno-unused-parameter 14EXTRA_CFLAGS += -Wno-unused-function 15EXTRA_CFLAGS += -Wno-unused 16#EXTRA_CFLAGS += -Wno-uninitialized 17 18GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) 19ifeq ($(GCC_VER_49),1) 20EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later 21endif 22 23EXTRA_CFLAGS += -I$(src)/include 24 25EXTRA_LDFLAGS += --strip-debug 26 27HDF_NTEWORK_ADAPTER_INC := \ 28 -I$(srctree)/../../../../drivers/adapter/khdf/linux/network/include 29 30HDF_FRAMEWORKS_INC := \ 31 -I$(srctree)/drivers/hdf/framework/core/common/include/host \ 32 -I$(srctree)/drivers/hdf/framework/core/host/include \ 33 -I$(srctree)/drivers/hdf/framework/core/manager/include \ 34 -I$(srctree)/drivers/hdf/framework/core/shared/include \ 35 -I$(srctree)/drivers/hdf/framework/include \ 36 -I$(srctree)/drivers/hdf/framework/include/config \ 37 -I$(srctree)/drivers/hdf/framework/include/core \ 38 -I$(srctree)/drivers/hdf/framework/include/platform \ 39 -I$(srctree)/drivers/hdf/framework/include/utils \ 40 -I$(srctree)/drivers/hdf/framework/support/platform/include \ 41 -I$(srctree)/drivers/hdf/framework/support/platform/include/platform \ 42 -I$(srctree)/drivers/hdf/framework/utils/include \ 43 -I$(srctree)/drivers/hdf/khdf/osal/include \ 44 -I$(srctree)/drivers/hdf/inner_api/osal/shared \ 45 -I$(srctree)/drivers/hdf/inner_api/host/shared \ 46 -I$(srctree)/drivers/hdf/inner_api/utils \ 47 -I$(srctree)/drivers/hdf/inner_api/core \ 48 -I$(srctree)/drivers/hdf/khdf/config/include \ 49 -I$(srctree)/include/hdf \ 50 -I$(srctree)/include/hdf/osal \ 51 -I$(srctree)/include/hdf/utils 52 53HDF_WIFI_FRAMEWORKS_INC := \ 54 -I$(srctree)/drivers/hdf/framework/model/network/wifi/core/components/eapol \ 55 -I$(srctree)/drivers/hdf/framework/model/network/wifi/core/components/softap \ 56 -I$(srctree)/drivers/hdf/framework/model/network/wifi/core/components/sta \ 57 -I$(srctree)/drivers/hdf/framework/model/network/wifi/core/components/p2p \ 58 -I$(srctree)/drivers/hdf/framework/model/network/wifi/include \ 59 -I$(srctree)/drivers/hdf/framework/model/network/wifi/core \ 60 -I$(srctree)/drivers/hdf/framework/model/network/wifi/core/module \ 61 -I$(srctree)/drivers/hdf/framework/model/network/common/netdevice \ 62 -I$(srctree)/drivers/hdf/framework/model/network/wifi/platform/include \ 63 -I$(srctree)/drivers/hdf/framework/model/network/wifi/platform/include/message \ 64 -I$(srctree)/drivers/hdf/framework/model/network/wifi/client/include \ 65 -I$(srctree)/drivers/hdf/framework/include/wifi \ 66 -I$(srctree)/drivers/hdf/framework/include/net \ 67 -I$(srctree)/drivers/hdf/frameworks/model/network/wifi/bus 68 69HDF_WIFI_ADAPTER_INC := \ 70 -I$(srctree)/drivers/hdf/khdf/network/include 71 72HDF_WIFI_VENDOR_INC := \ 73 -I$(srctree)/drivers/hdf/wifi/driver/core 74 75SECURE_LIB_INC := \ 76 -I$(srctree)/bounds_checking_function/include 77 78EXTRA_CFLAGS += \ 79 $(HDF_FRAMEWORKS_INC) \ 80 $(HDF_WIFI_FRAMEWORKS_INC) \ 81 $(SECURE_LIB_INC) \ 82 $(HDF_WIFI_ADAPTER_INC) \ 83 $(HDF_NTEWORK_ADAPTER_INC) 84 85ifeq ($(CONFIG_RTL8822CS_WIFI_HDF),y) 86EXTRA_CFLAGS += -DCONFIG_RTL8822CS_WIFI_HDF 87else 88EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE 89endif 90 91CONFIG_AUTOCFG_CP = n 92 93########################## WIFI IC ############################ 94CONFIG_MULTIDRV = n 95CONFIG_RTL8188E = n 96CONFIG_RTL8812A = n 97CONFIG_RTL8821A = n 98CONFIG_RTL8192E = n 99CONFIG_RTL8723B = n 100CONFIG_RTL8814A = n 101CONFIG_RTL8723C = n 102CONFIG_RTL8188F = n 103CONFIG_RTL8188GTV = n 104CONFIG_RTL8822B = n 105CONFIG_RTL8723D = n 106CONFIG_RTL8821C = n 107CONFIG_RTL8710B = n 108CONFIG_RTL8192F = n 109CONFIG_RTL8822C = y 110CONFIG_RTL8814B = n 111CONFIG_RTL8814C = n 112CONFIG_RTL8723F = n 113######################### Interface ########################### 114CONFIG_USB_HCI = n 115CONFIG_PCI_HCI = n 116CONFIG_SDIO_HCI = y 117CONFIG_GSPI_HCI = n 118########################## Features ########################### 119CONFIG_AP_MODE = y 120CONFIG_P2P = y 121CONFIG_MP_INCLUDED = y 122CONFIG_POWER_SAVING = y 123CONFIG_IPS_MODE = default 124CONFIG_LPS_MODE = default 125CONFIG_USB_AUTOSUSPEND = n 126CONFIG_HW_PWRP_DETECTION = n 127CONFIG_BT_COEXIST = y 128CONFIG_WAPI_SUPPORT = n 129CONFIG_EFUSE_CONFIG_FILE = y 130CONFIG_EXT_CLK = n 131CONFIG_TRAFFIC_PROTECT = n 132CONFIG_LOAD_PHY_PARA_FROM_FILE = y 133CONFIG_TXPWR_BY_RATE = y 134CONFIG_TXPWR_BY_RATE_EN = y 135CONFIG_TXPWR_LIMIT = y 136CONFIG_TXPWR_LIMIT_EN = n 137CONFIG_RTW_CHPLAN = 0xFFFF 138CONFIG_RTW_ADAPTIVITY_EN = disable 139CONFIG_RTW_ADAPTIVITY_MODE = normal 140CONFIG_80211D = n 141CONFIG_SIGNAL_SCALE_MAPPING = n 142CONFIG_80211W = y 143CONFIG_REDUCE_TX_CPU_LOADING = n 144CONFIG_BR_EXT = y 145CONFIG_TDLS = n 146CONFIG_WIFI_MONITOR = n 147CONFIG_MCC_MODE = n 148CONFIG_APPEND_VENDOR_IE_ENABLE = n 149CONFIG_RTW_NAPI = y 150CONFIG_RTW_GRO = y 151CONFIG_RTW_NETIF_SG = y 152CONFIG_RTW_IPCAM_APPLICATION = n 153CONFIG_RTW_REPEATER_SON = n 154CONFIG_ICMP_VOQ = n 155CONFIG_IP_R_MONITOR = n #arp VOQ and high rate 156# user priority mapping rule : tos, dscp 157CONFIG_RTW_UP_MAPPING_RULE = tos 158CONFIG_RTW_MBO = n 159CONFIG_WAKE_ON_BT = n 160CONFIG_RTW_NBI = n 161 162########################## Android ########################### 163# CONFIG_RTW_ANDROID - 0: no Android, 4/5/6/7/8/9/10/11 : Android version 164CONFIG_RTW_ANDROID = 0 165 166ifeq ($(shell test $(CONFIG_RTW_ANDROID) -gt 0; echo $$?), 0) 167EXTRA_CFLAGS += -DCONFIG_RTW_ANDROID=$(CONFIG_RTW_ANDROID) 168endif 169 170########################## Debug ########################### 171CONFIG_RTW_DEBUG = n 172# default log level is _DRV_INFO_ = 4, 173# please refer to "How_to_set_driver_debug_log_level.doc" to set the available level. 174CONFIG_RTW_LOG_LEVEL = 1 175 176# enable /proc/net/rtlxxxx/ debug interfaces 177CONFIG_PROC_DEBUG = y 178 179######################## Wake On Lan ########################## 180CONFIG_WOWLAN = n 181#bit2: deauth, bit1: unicast, bit0: magic pkt. 182CONFIG_WAKEUP_TYPE = 0x7 183CONFIG_WOW_LPS_MODE = default 184#bit0: disBBRF off, #bit1: Wireless remote controller (WRC) 185CONFIG_SUSPEND_TYPE = 0 186CONFIG_WOW_STA_MIX = n 187CONFIG_GPIO_WAKEUP = n 188# Please contact with RTK support team first. After getting the agreement from RTK support team, 189# you are just able to modify the CONFIG_WAKEUP_GPIO_IDX with customized requirement. 190CONFIG_WAKEUP_GPIO_IDX = default 191CONFIG_HIGH_ACTIVE_DEV2HST = n 192######### only for USB ######### 193CONFIG_ONE_PIN_GPIO = n 194CONFIG_HIGH_ACTIVE_HST2DEV = n 195CONFIG_PNO_SUPPORT = n 196CONFIG_PNO_SET_DEBUG = n 197CONFIG_AP_WOWLAN = n 198######### Notify SDIO Host Keep Power During Syspend ########## 199CONFIG_RTW_SDIO_PM_KEEP_POWER = y 200###################### MP HW TX MODE FOR VHT ####################### 201CONFIG_MP_VHT_HW_TX_MODE = n 202###################### ROAMING ##################################### 203CONFIG_LAYER2_ROAMING = y 204#bit0: ROAM_ON_EXPIRED, #bit1: ROAM_ON_RESUME, #bit2: ROAM_ACTIVE 205CONFIG_ROAMING_FLAG = 0x3 206####################### Security Memory ############################ 207# Define for using dma_declare_coherent_memory DMA API. 208# User Must set the SECURITY_MEM_ADDR and SECURITY_MEM_SIZE. 209# If SECURITY_MEM_ADDR is NULL, driver will show WARN_ON for notification. 210CONFIG_SECURITY_MEM = n 211CONFIG_SECURITY_MEM_ADDR = 0 212CONFIG_SECURITY_MEM_SIZE = 3686400 213###################### Platform Related ####################### 214CONFIG_PLATFORM_I386_PC = n 215CONFIG_PLATFORM_ANDROID_X86 = n 216CONFIG_PLATFORM_ANDROID_INTEL_X86 = n 217CONFIG_PLATFORM_JB_X86 = n 218CONFIG_PLATFORM_ARM_S3C2K4 = n 219CONFIG_PLATFORM_ARM_PXA2XX = n 220CONFIG_PLATFORM_ARM_S3C6K4 = n 221CONFIG_PLATFORM_MIPS_RMI = n 222CONFIG_PLATFORM_RTD2880B = n 223CONFIG_PLATFORM_MIPS_AR9132 = n 224CONFIG_PLATFORM_RTK_DMP = n 225CONFIG_PLATFORM_MIPS_PLM = n 226CONFIG_PLATFORM_MSTAR389 = n 227CONFIG_PLATFORM_MT53XX = n 228CONFIG_PLATFORM_ARM_MX51_241H = n 229CONFIG_PLATFORM_FS_MX61 = n 230CONFIG_PLATFORM_ACTIONS_ATJ227X = n 231CONFIG_PLATFORM_TEGRA3_CARDHU = n 232CONFIG_PLATFORM_TEGRA4_DALMORE = n 233CONFIG_PLATFORM_ARM_TCC8900 = n 234CONFIG_PLATFORM_ARM_TCC8920 = n 235CONFIG_PLATFORM_ARM_TCC8920_JB42 = n 236CONFIG_PLATFORM_ARM_TCC8930_JB42 = n 237CONFIG_PLATFORM_ARM_RK2818 = n 238CONFIG_PLATFORM_ARM_RK3066 = n 239CONFIG_PLATFORM_ARM_RK3188 = n 240CONFIG_PLATFORM_ARM_URBETTER = n 241CONFIG_PLATFORM_ARM_TI_PANDA = n 242CONFIG_PLATFORM_MIPS_JZ4760 = n 243CONFIG_PLATFORM_DMP_PHILIPS = n 244CONFIG_PLATFORM_MSTAR_TITANIA12 = n 245CONFIG_PLATFORM_MSTAR = n 246CONFIG_PLATFORM_SZEBOOK = n 247CONFIG_PLATFORM_ARM_SUNxI = n 248CONFIG_PLATFORM_ARM_SUN6I = n 249CONFIG_PLATFORM_ARM_SUN7I = n 250CONFIG_PLATFORM_ARM_SUN8I_W3P1 = n 251CONFIG_PLATFORM_ARM_SUN8I_W5P1 = n 252CONFIG_PLATFORM_ACTIONS_ATM702X = n 253CONFIG_PLATFORM_ACTIONS_ATV5201 = n 254CONFIG_PLATFORM_ACTIONS_ATM705X = n 255CONFIG_PLATFORM_ARM_SUN50IW1P1 = n 256CONFIG_PLATFORM_ARM_RTD299X = n 257CONFIG_PLATFORM_ARM_LGE = n 258CONFIG_PLATFORM_ARM_SPREADTRUM_6820 = n 259CONFIG_PLATFORM_ARM_SPREADTRUM_8810 = n 260CONFIG_PLATFORM_ARM_WMT = n 261CONFIG_PLATFORM_TI_DM365 = n 262CONFIG_PLATFORM_MOZART = n 263CONFIG_PLATFORM_RTK119X = n 264CONFIG_PLATFORM_RTK119X_AM = n 265CONFIG_PLATFORM_RTK129X = n 266CONFIG_PLATFORM_RTK1319 = n 267CONFIG_PLATFORM_RTK390X = n 268CONFIG_PLATFORM_NOVATEK_NT72668 = n 269CONFIG_PLATFORM_HISILICON = n 270CONFIG_PLATFORM_HISILICON_HI3798 = n 271CONFIG_PLATFORM_NV_TK1 = n 272CONFIG_PLATFORM_NV_TK1_UBUNTU = n 273CONFIG_PLATFORM_RTL8197D = n 274CONFIG_PLATFORM_AML_S905 = y 275CONFIG_PLATFORM_ZTE_ZX296716 = n 276########### CUSTOMER ################################ 277CONFIG_CUSTOMER_HUAWEI_GENERAL = n 278 279CONFIG_DRVEXT_MODULE = n 280 281export TopDIR ?= $(shell pwd) 282 283########### COMMON ################################# 284HCI_NAME = sdio 285 286_OS_INTFS_FILES := os_dep/osdep_service.o \ 287 os_dep/linux/os_intfs.o \ 288 os_dep/linux/$(HCI_NAME)_intf.o \ 289 os_dep/linux/$(HCI_NAME)_ops_linux.o \ 290 os_dep/linux/ioctl_linux.o \ 291 os_dep/linux/xmit_linux.o \ 292 os_dep/linux/mlme_linux.o \ 293 os_dep/linux/recv_linux.o \ 294 os_dep/linux/ioctl_cfg80211.o \ 295 os_dep/linux/rtw_cfgvendor.o \ 296 os_dep/linux/wifi_regd.o \ 297 os_dep/linux/rtw_android.o \ 298 os_dep/linux/rtw_proc.o \ 299 os_dep/linux/nlrtw.o \ 300 os_dep/linux/rtw_rhashtable.o 301 302ifeq ($(CONFIG_MP_INCLUDED), y) 303_OS_INTFS_FILES += os_dep/linux/ioctl_mp.o 304endif 305 306ifeq ($(CONFIG_SDIO_HCI), y) 307_OS_INTFS_FILES += os_dep/linux/custom_gpio_linux.o 308_OS_INTFS_FILES += os_dep/linux/$(HCI_NAME)_ops_linux.o 309endif 310 311ifeq ($(CONFIG_GSPI_HCI), y) 312_OS_INTFS_FILES += os_dep/linux/custom_gpio_linux.o 313_OS_INTFS_FILES += os_dep/linux/$(HCI_NAME)_ops_linux.o 314endif 315 316 317_HAL_INTFS_FILES := hal/hal_intf.o \ 318 hal/hal_com.o \ 319 hal/hal_com_phycfg.o \ 320 hal/hal_phy.o \ 321 hal/hal_dm.o \ 322 hal/hal_dm_acs.o \ 323 hal/hal_btcoex_wifionly.o \ 324 hal/hal_btcoex.o \ 325 hal/hal_mp.o \ 326 hal/hal_mcc.o \ 327 hal/hal_hci/hal_$(HCI_NAME).o \ 328 hal/led/hal_led.o \ 329 hal/led/hal_$(HCI_NAME)_led.o 330 331 332EXTRA_CFLAGS += -I$(src)/platform 333_PLATFORM_FILES := platform/platform_ops.o 334 335EXTRA_CFLAGS += -I$(src)/hal/btc 336 337########### HAL_RTL8822B ################################# 338ifeq ($(CONFIG_RTL8822B), y) 339RTL871X := rtl8822b 340ifeq ($(CONFIG_USB_HCI), y) 341ifeq ($(CONFIG_BT_COEXIST), n) 342MODULE_NAME = 8812bu 343else 344MODULE_NAME = 88x2bu 345endif 346endif 347ifeq ($(CONFIG_PCI_HCI), y) 348MODULE_NAME = 88x2be 349endif 350ifeq ($(CONFIG_SDIO_HCI), y) 351MODULE_NAME = 88x2bs 352endif 353 354endif 355########### HAL_RTL8821C ################################# 356ifeq ($(CONFIG_RTL8821C), y) 357RTL871X := rtl8821c 358ifeq ($(CONFIG_USB_HCI), y) 359MODULE_NAME = 8821cu 360endif 361ifeq ($(CONFIG_PCI_HCI), y) 362MODULE_NAME = 8821ce 363endif 364ifeq ($(CONFIG_SDIO_HCI), y) 365MODULE_NAME = 8821cs 366endif 367 368endif 369 370########### HAL_RTL8822C ################################# 371ifeq ($(CONFIG_RTL8822C), y) 372RTL871X := rtl8822c 373ifeq ($(CONFIG_USB_HCI), y) 374ifeq ($(CONFIG_BT_COEXIST), n) 375MODULE_NAME = 8812cu 376else 377MODULE_NAME = 88x2cu 378endif 379endif 380ifeq ($(CONFIG_PCI_HCI), y) 381MODULE_NAME = 88x2ce 382endif 383ifeq ($(CONFIG_SDIO_HCI), y) 384MODULE_NAME = 88x2cs 385endif 386 387endif 388 389########### AUTO_CFG ################################# 390 391ifeq ($(CONFIG_AUTOCFG_CP), y) 392 393ifeq ($(CONFIG_MULTIDRV), y) 394$(shell cp $(TopDIR)/autoconf_multidrv_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h) 395else 396ifeq ($(CONFIG_RTL8188E)$(CONFIG_SDIO_HCI),yy) 397$(shell cp $(TopDIR)/autoconf_rtl8189e_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h) 398else ifeq ($(CONFIG_RTL8188F)$(CONFIG_SDIO_HCI),yy) 399$(shell cp $(TopDIR)/autoconf_rtl8189f_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h) 400else ifeq ($(CONFIG_RTL8723C),y) 401$(shell cp $(TopDIR)/autoconf_rtl8723c_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h) 402else 403$(shell cp $(TopDIR)/autoconf_$(RTL871X)_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h) 404endif 405endif 406 407endif 408 409########### END OF PATH ################################# 410 411ifeq ($(CONFIG_AP_MODE), y) 412EXTRA_CFLAGS += -DCONFIG_AP_MODE 413endif 414 415ifeq ($(CONFIG_P2P), y) 416EXTRA_CFLAGS += -DCONFIG_P2P 417ifneq ($(CONFIG_AP_MODE), y) 418$(error "CONFIG_AP_MODE is required for CONFIG_P2P") 419endif 420endif 421 422ifeq ($(CONFIG_USB_HCI), y) 423ifeq ($(CONFIG_USB_AUTOSUSPEND), y) 424EXTRA_CFLAGS += -DCONFIG_USB_AUTOSUSPEND 425endif 426endif 427 428ifeq ($(CONFIG_MP_INCLUDED), y) 429#MODULE_NAME := $(MODULE_NAME)_mp 430EXTRA_CFLAGS += -DCONFIG_MP_INCLUDED 431endif 432 433ifeq ($(CONFIG_POWER_SAVING), y) 434ifneq ($(CONFIG_IPS_MODE), default) 435EXTRA_CFLAGS += -DRTW_IPS_MODE=$(CONFIG_IPS_MODE) 436endif 437ifneq ($(CONFIG_LPS_MODE), default) 438EXTRA_CFLAGS += -DRTW_LPS_MODE=$(CONFIG_LPS_MODE) 439endif 440ifneq ($(CONFIG_WOW_LPS_MODE), default) 441EXTRA_CFLAGS += -DRTW_WOW_LPS_MODE=$(CONFIG_WOW_LPS_MODE) 442endif 443EXTRA_CFLAGS += -DCONFIG_POWER_SAVING 444endif 445 446ifeq ($(CONFIG_HW_PWRP_DETECTION), y) 447EXTRA_CFLAGS += -DCONFIG_HW_PWRP_DETECTION 448endif 449 450ifeq ($(CONFIG_BT_COEXIST), y) 451EXTRA_CFLAGS += -DCONFIG_BT_COEXIST 452endif 453 454ifeq ($(CONFIG_WAPI_SUPPORT), y) 455EXTRA_CFLAGS += -DCONFIG_WAPI_SUPPORT 456endif 457 458 459ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y) 460EXTRA_CFLAGS += -DCONFIG_EFUSE_CONFIG_FILE 461 462#EFUSE_MAP_PATH 463USER_EFUSE_MAP_PATH ?= 464ifneq ($(USER_EFUSE_MAP_PATH),) 465EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"$(USER_EFUSE_MAP_PATH)\" 466else ifeq ($(MODULE_NAME), 8189es) 467EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8189e.map\" 468else ifeq ($(MODULE_NAME), 8723bs) 469EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8723bs.map\" 470else 471EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_$(MODULE_NAME).map\" 472endif 473 474#WIFIMAC_PATH 475USER_WIFIMAC_PATH ?= 476ifneq ($(USER_WIFIMAC_PATH),) 477EXTRA_CFLAGS += -DWIFIMAC_PATH=\"$(USER_WIFIMAC_PATH)\" 478else 479EXTRA_CFLAGS += -DWIFIMAC_PATH=\"/data/wifimac.txt\" 480endif 481 482endif 483 484ifeq ($(CONFIG_EXT_CLK), y) 485EXTRA_CFLAGS += -DCONFIG_EXT_CLK 486endif 487 488ifeq ($(CONFIG_TRAFFIC_PROTECT), y) 489EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT 490endif 491 492ifeq ($(CONFIG_LOAD_PHY_PARA_FROM_FILE), y) 493EXTRA_CFLAGS += -DCONFIG_LOAD_PHY_PARA_FROM_FILE 494#EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER 495EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH=\"/lib/firmware/\" 496endif 497 498ifeq ($(CONFIG_TXPWR_BY_RATE), n) 499EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE=0 500else ifeq ($(CONFIG_TXPWR_BY_RATE), y) 501EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE=1 502endif 503ifeq ($(CONFIG_TXPWR_BY_RATE_EN), n) 504EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=0 505else ifeq ($(CONFIG_TXPWR_BY_RATE_EN), y) 506EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=1 507else ifeq ($(CONFIG_TXPWR_BY_RATE_EN), auto) 508EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=2 509endif 510 511ifeq ($(CONFIG_TXPWR_LIMIT), n) 512EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT=0 513else ifeq ($(CONFIG_TXPWR_LIMIT), y) 514EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT=1 515endif 516ifeq ($(CONFIG_TXPWR_LIMIT_EN), n) 517EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT_EN=0 518else ifeq ($(CONFIG_TXPWR_LIMIT_EN), y) 519EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT_EN=1 520else ifeq ($(CONFIG_TXPWR_LIMIT_EN), auto) 521EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT_EN=2 522endif 523 524ifneq ($(CONFIG_RTW_CHPLAN), 0xFFFF) 525EXTRA_CFLAGS += -DCONFIG_RTW_CHPLAN=$(CONFIG_RTW_CHPLAN) 526endif 527 528ifeq ($(CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY), y) 529EXTRA_CFLAGS += -DCONFIG_CALIBRATE_TX_POWER_BY_REGULATORY 530endif 531 532ifeq ($(CONFIG_CALIBRATE_TX_POWER_TO_MAX), y) 533EXTRA_CFLAGS += -DCONFIG_CALIBRATE_TX_POWER_TO_MAX 534endif 535 536ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), disable) 537EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_EN=0 538else ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), enable) 539EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_EN=1 540else ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), auto) 541EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_EN=2 542endif 543 544ifeq ($(CONFIG_RTW_ADAPTIVITY_MODE), normal) 545EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_MODE=0 546else ifeq ($(CONFIG_RTW_ADAPTIVITY_MODE), carrier_sense) 547EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_MODE=1 548endif 549 550ifeq ($(CONFIG_80211D), y) 551EXTRA_CFLAGS += -DCONFIG_80211D 552endif 553 554ifeq ($(CONFIG_SIGNAL_SCALE_MAPPING), y) 555EXTRA_CFLAGS += -DCONFIG_SIGNAL_SCALE_MAPPING 556endif 557 558ifeq ($(CONFIG_80211W), y) 559EXTRA_CFLAGS += -DCONFIG_IEEE80211W 560endif 561 562ifeq ($(CONFIG_WOWLAN), y) 563EXTRA_CFLAGS += -DCONFIG_WOWLAN -DRTW_WAKEUP_EVENT=$(CONFIG_WAKEUP_TYPE) 564EXTRA_CFLAGS += -DRTW_SUSPEND_TYPE=$(CONFIG_SUSPEND_TYPE) 565ifeq ($(CONFIG_WOW_STA_MIX), y) 566EXTRA_CFLAGS += -DRTW_WOW_STA_MIX 567endif 568ifeq ($(CONFIG_SDIO_HCI), y) 569EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER 570endif 571endif 572 573ifeq ($(CONFIG_AP_WOWLAN), y) 574EXTRA_CFLAGS += -DCONFIG_AP_WOWLAN 575ifeq ($(CONFIG_AP_MODE), n) 576EXTRA_CFLAGS += -DCONFIG_AP_MODE 577endif 578ifeq ($(CONFIG_SDIO_HCI), y) 579EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER 580endif 581endif 582 583ifeq ($(CONFIG_LAYER2_ROAMING), y) 584EXTRA_CFLAGS += -DCONFIG_LAYER2_ROAMING -DCONFIG_ROAMING_FLAG=$(CONFIG_ROAMING_FLAG) 585endif 586 587ifeq ($(CONFIG_PNO_SUPPORT), y) 588EXTRA_CFLAGS += -DCONFIG_PNO_SUPPORT 589ifeq ($(CONFIG_PNO_SET_DEBUG), y) 590EXTRA_CFLAGS += -DCONFIG_PNO_SET_DEBUG 591endif 592endif 593 594ifeq ($(CONFIG_GPIO_WAKEUP), y) 595EXTRA_CFLAGS += -DCONFIG_GPIO_WAKEUP 596ifeq ($(CONFIG_ONE_PIN_GPIO), y) 597EXTRA_CFLAGS += -DCONFIG_RTW_ONE_PIN_GPIO 598endif 599ifeq ($(CONFIG_HIGH_ACTIVE_DEV2HST), y) 600EXTRA_CFLAGS += -DHIGH_ACTIVE_DEV2HST=1 601else 602EXTRA_CFLAGS += -DHIGH_ACTIVE_DEV2HST=0 603endif 604endif 605 606ifeq ($(CONFIG_HIGH_ACTIVE_HST2DEV), y) 607EXTRA_CFLAGS += -DHIGH_ACTIVE_HST2DEV=1 608else 609EXTRA_CFLAGS += -DHIGH_ACTIVE_HST2DEV=0 610endif 611 612ifneq ($(CONFIG_WAKEUP_GPIO_IDX), default) 613EXTRA_CFLAGS += -DWAKEUP_GPIO_IDX=$(CONFIG_WAKEUP_GPIO_IDX) 614endif 615 616ifeq ($(CONFIG_RTW_SDIO_PM_KEEP_POWER), y) 617ifeq ($(CONFIG_SDIO_HCI), y) 618EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER 619endif 620endif 621 622ifeq ($(CONFIG_REDUCE_TX_CPU_LOADING), y) 623EXTRA_CFLAGS += -DCONFIG_REDUCE_TX_CPU_LOADING 624endif 625 626ifeq ($(CONFIG_BR_EXT), y) 627BR_NAME = br0 628EXTRA_CFLAGS += -DCONFIG_BR_EXT 629EXTRA_CFLAGS += '-DCONFIG_BR_EXT_BRNAME="'$(BR_NAME)'"' 630endif 631 632 633ifeq ($(CONFIG_TDLS), y) 634EXTRA_CFLAGS += -DCONFIG_TDLS 635endif 636 637ifeq ($(CONFIG_WIFI_MONITOR), y) 638EXTRA_CFLAGS += -DCONFIG_WIFI_MONITOR 639endif 640 641ifeq ($(CONFIG_MCC_MODE), y) 642EXTRA_CFLAGS += -DCONFIG_MCC_MODE 643endif 644 645ifeq ($(CONFIG_RTW_NAPI), y) 646EXTRA_CFLAGS += -DCONFIG_RTW_NAPI 647endif 648 649ifeq ($(CONFIG_RTW_GRO), y) 650EXTRA_CFLAGS += -DCONFIG_RTW_GRO 651endif 652 653ifeq ($(CONFIG_RTW_REPEATER_SON), y) 654EXTRA_CFLAGS += -DCONFIG_RTW_REPEATER_SON 655endif 656 657ifeq ($(CONFIG_RTW_IPCAM_APPLICATION), y) 658EXTRA_CFLAGS += -DCONFIG_RTW_IPCAM_APPLICATION 659ifeq ($(CONFIG_WIFI_MONITOR), n) 660EXTRA_CFLAGS += -DCONFIG_WIFI_MONITOR 661endif 662endif 663 664ifeq ($(CONFIG_RTW_NETIF_SG), y) 665EXTRA_CFLAGS += -DCONFIG_RTW_NETIF_SG 666endif 667 668ifeq ($(CONFIG_ICMP_VOQ), y) 669EXTRA_CFLAGS += -DCONFIG_ICMP_VOQ 670endif 671 672ifeq ($(CONFIG_IP_R_MONITOR), y) 673EXTRA_CFLAGS += -DCONFIG_IP_R_MONITOR 674endif 675 676ifeq ($(CONFIG_MP_VHT_HW_TX_MODE), y) 677EXTRA_CFLAGS += -DCONFIG_MP_VHT_HW_TX_MODE 678ifeq ($(CONFIG_PLATFORM_I386_PC), y) 679## For I386 X86 ToolChain use Hardware FLOATING 680EXTRA_CFLAGS += -mhard-float 681else 682## For ARM ToolChain use Hardware FLOATING 683EXTRA_CFLAGS += -mfloat-abi=hard 684endif 685endif 686 687ifeq ($(CONFIG_APPEND_VENDOR_IE_ENABLE), y) 688EXTRA_CFLAGS += -DCONFIG_APPEND_VENDOR_IE_ENABLE 689endif 690 691ifeq ($(CONFIG_RTW_DEBUG), y) 692EXTRA_CFLAGS += -DCONFIG_RTW_DEBUG 693EXTRA_CFLAGS += -DRTW_LOG_LEVEL=$(CONFIG_RTW_LOG_LEVEL) 694endif 695 696ifeq ($(CONFIG_PROC_DEBUG), y) 697EXTRA_CFLAGS += -DCONFIG_PROC_DEBUG 698endif 699 700ifeq ($(CONFIG_RTW_UP_MAPPING_RULE), dscp) 701EXTRA_CFLAGS += -DCONFIG_RTW_UP_MAPPING_RULE=1 702else 703EXTRA_CFLAGS += -DCONFIG_RTW_UP_MAPPING_RULE=0 704endif 705 706EXTRA_CFLAGS += -DDM_ODM_SUPPORT_TYPE=0x04 707 708ifeq ($(CONFIG_RTW_MBO), y) 709EXTRA_CFLAGS += -DCONFIG_RTW_MBO -DCONFIG_RTW_80211K -DCONFIG_RTW_WNM -DCONFIG_RTW_BTM_ROAM 710EXTRA_CFLAGS += -DCONFIG_RTW_80211R 711endif 712 713ifeq ($(CONFIG_WAKE_ON_BT), y) 714EXTRA_CFLAGS += -DCONFIG_WAKE_ON_BT 715endif 716 717ifeq ($(CONFIG_RTW_NBI), y) 718EXTRA_CFLAGS += -DCONFIG_RTW_NBI 719endif 720 721ifeq ($(CONFIG_SECURITY_MEM), y) 722EXTRA_CFLAGS += -DCONFIG_SECURITY_MEM 723EXTRA_CFLAGS += -DSECURITY_MEM_ADDR=$(CONFIG_SECURITY_MEM_ADDR) 724EXTRA_CFLAGS += -DSECURITY_MEM_SIZE=$(CONFIG_SECURITY_MEM_SIZE) 725endif 726 727ifeq ($(CONFIG_PLATFORM_AML_S905), y) 728EXTRA_CFLAGS += -DCONFIG_PLATFORM_AML_S905 729EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -fno-pic 730# default setting for Android 731EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 732EXTRA_CFLAGS += -DRTW_USE_CFG80211_STA_EVENT 733# default setting for Android 5.x and later 734EXTRA_CFLAGS += -DCONFIG_RADIO_WORK 735 736ifeq ($(CONFIG_SDIO_HCI), y) 737EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS 738_PLATFORM_FILES += platform/platform_aml_s905_sdio.o 739endif 740 741ARCH ?= arm64 742CROSS_COMPILE ?= /4.4_S905L_8822bs_compile/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu- 743ifndef KSRC 744KSRC := /4.4_S905L_8822bs_compile/common 745# To locate output files in a separate directory. 746KSRC += O=/4.4_S905L_8822bs_compile/KERNEL_OBJ 747endif 748 749ifeq ($(CONFIG_RTL8822B), y) 750ifeq ($(CONFIG_SDIO_HCI), y) 751CONFIG_RTL8822BS ?= m 752USER_MODULE_NAME := 8822bs 753endif 754endif 755 756endif 757 758ifeq ($(CONFIG_PLATFORM_ZTE_ZX296716), y) 759EXTRA_CFLAGS += -Wno-error=date-time 760EXTRA_CFLAGS += -DCONFIG_PLATFORM_ZTE_ZX296716 761EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN 762# default setting for Android 763EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE 764EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 765EXTRA_CFLAGS += -DRTW_USE_CFG80211_STA_EVENT 766# default setting for Android 5.x and later 767#EXTRA_CFLAGS += -DCONFIG_RADIO_WORK 768 769ifeq ($(CONFIG_SDIO_HCI), y) 770# mark this temporarily 771#EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS 772#_PLATFORM_FILES += platform/platform_zte_zx296716_sdio.o 773endif 774 775ARCH ?= arm64 776CROSS_COMPILE ?= 777KSRC ?= 778 779ifeq ($(CONFIG_RTL8822B), y) 780ifeq ($(CONFIG_SDIO_HCI), y) 781CONFIG_RTL8822BS ?= m 782USER_MODULE_NAME := 8822bs 783endif 784endif 785 786endif 787 788########### CUSTOMER ################################ 789ifeq ($(CONFIG_CUSTOMER_HUAWEI_GENERAL), y) 790CONFIG_CUSTOMER_HUAWEI = y 791endif 792 793ifeq ($(CONFIG_CUSTOMER_HUAWEI), y) 794EXTRA_CFLAGS += -DCONFIG_HUAWEI_PROC 795endif 796 797CONFIG_PLATFORM_CMAP_INTFS = n 798ifeq ($(CONFIG_PLATFORM_CMAP_INTFS), y) 799PLATFORM_CMAP_INTFS_TYPE = 00 800EXTRA_CFLAGS += -DCONFIG_PLATFORM_CMAP_INTFS -DCMAP_UNASSOC_METRICS_STA_MAX=32 801_OS_INTFS_FILES += os_dep/linux/custom_multiap_intfs/custom_multiap_intfs.o 802_PLATFORM_FILES += platform/custom_multiap_intfs_$(PLATFORM_CMAP_INTFS_TYPE).o 803endif 804 805ifeq ($(CONFIG_MULTIDRV), y) 806 807ifeq ($(CONFIG_SDIO_HCI), y) 808MODULE_NAME := rtw_sdio 809endif 810 811ifeq ($(CONFIG_USB_HCI), y) 812MODULE_NAME := rtw_usb 813endif 814 815ifeq ($(CONFIG_PCI_HCI), y) 816MODULE_NAME := rtw_pci 817endif 818 819 820endif 821 822USER_MODULE_NAME ?= 823ifneq ($(USER_MODULE_NAME),) 824MODULE_NAME := $(USER_MODULE_NAME) 825endif 826 827ifneq ($(KERNELRELEASE),) 828 829########### this part for *.mk ############################ 830include $(src)/hal/phydm/phydm.mk 831 832########### HAL_RTL8822C ################################# 833ifeq ($(CONFIG_RTL8822C), y) 834include $(src)/rtl8822c.mk 835endif 836 837rtk_core := core/rtw_cmd.o \ 838 core/rtw_security.o \ 839 core/rtw_debug.o \ 840 core/rtw_io.o \ 841 core/rtw_ioctl_query.o \ 842 core/rtw_ioctl_set.o \ 843 core/rtw_ieee80211.o \ 844 core/rtw_mlme.o \ 845 core/rtw_mlme_ext.o \ 846 core/rtw_mi.o \ 847 core/rtw_wlan_util.o \ 848 core/rtw_vht.o \ 849 core/rtw_pwrctrl.o \ 850 core/rtw_rf.o \ 851 core/rtw_chplan.o \ 852 core/monitor/rtw_radiotap.o \ 853 core/rtw_recv.o \ 854 core/rtw_sta_mgt.o \ 855 core/rtw_ap.o \ 856 core/wds/rtw_wds.o \ 857 core/mesh/rtw_mesh.o \ 858 core/mesh/rtw_mesh_pathtbl.o \ 859 core/mesh/rtw_mesh_hwmp.o \ 860 core/rtw_xmit.o \ 861 core/rtw_p2p.o \ 862 core/rtw_rson.o \ 863 core/rtw_tdls.o \ 864 core/rtw_br_ext.o \ 865 core/rtw_iol.o \ 866 core/rtw_sreset.o \ 867 core/rtw_btcoex_wifionly.o \ 868 core/rtw_btcoex.o \ 869 core/rtw_beamforming.o \ 870 core/rtw_odm.o \ 871 core/rtw_rm.o \ 872 core/rtw_rm_fsm.o \ 873 core/rtw_ft.o \ 874 core/rtw_wnm.o \ 875 core/rtw_mbo.o \ 876 core/rtw_rm_util.o \ 877 core/efuse/rtw_efuse.o \ 878 core/rtw_roch.o 879 880ifeq ($(CONFIG_SDIO_HCI), y) 881rtk_core += core/rtw_sdio.o 882endif 883 884EXTRA_CFLAGS += -I$(src)/core/crypto 885rtk_core += \ 886 core/crypto/aes-internal.o \ 887 core/crypto/aes-internal-enc.o \ 888 core/crypto/aes-gcm.o \ 889 core/crypto/aes-ccm.o \ 890 core/crypto/aes-omac1.o \ 891 core/crypto/ccmp.o \ 892 core/crypto/gcmp.o \ 893 core/crypto/aes-siv.o \ 894 core/crypto/aes-ctr.o \ 895 core/crypto/sha256-internal.o \ 896 core/crypto/sha256.o \ 897 core/crypto/sha256-prf.o \ 898 core/crypto/rtw_crypto_wrap.o \ 899 core/rtw_swcrypto.o 900 901$(MODULE_NAME)-y += $(rtk_core) 902 903$(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o \ 904 core/rtw_wapi_sms4.o 905 906$(MODULE_NAME)-y += $(_OS_INTFS_FILES) 907$(MODULE_NAME)-y += $(_HAL_INTFS_FILES) 908$(MODULE_NAME)-y += $(_PHYDM_FILES) 909$(MODULE_NAME)-y += $(_BTC_FILES) 910$(MODULE_NAME)-y += $(_PLATFORM_FILES) 911 912$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o 913 914ifeq ($(CONFIG_RTL8723B), y) 915$(MODULE_NAME)-$(CONFIG_MP_INCLUDED)+= core/rtw_bt_mp.o 916endif 917 918obj-$(CONFIG_RTL8822CS) += $(MODULE_NAME).o 919 920else 921 922export CONFIG_RTL8822CS = m 923 924all: modules 925 926modules: 927 $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules 928 929strip: 930 $(CROSS_COMPILE)strip $(MODULE_NAME).ko --strip-unneeded 931 932install: 933 install -p -m 644 $(MODULE_NAME).ko $(MODDESTDIR) 934 /sbin/depmod -a ${KVER} 935 936uninstall: 937 rm -f $(MODDESTDIR)/$(MODULE_NAME).ko 938 /sbin/depmod -a ${KVER} 939 940backup_rtlwifi: 941 @echo "Making backup rtlwifi drivers" 942ifneq (,$(wildcard $(STAGINGMODDIR)/rtl*)) 943 @tar cPf $(wildcard $(STAGINGMODDIR))/backup_rtlwifi_driver.tar $(wildcard $(STAGINGMODDIR)/rtl*) 944 @rm -rf $(wildcard $(STAGINGMODDIR)/rtl*) 945endif 946ifneq (,$(wildcard $(MODDESTDIR)realtek)) 947 @tar cPf $(MODDESTDIR)backup_rtlwifi_driver.tar $(MODDESTDIR)realtek 948 @rm -fr $(MODDESTDIR)realtek 949endif 950ifneq (,$(wildcard $(MODDESTDIR)rtl*)) 951 @tar cPf $(MODDESTDIR)../backup_rtlwifi_driver.tar $(wildcard $(MODDESTDIR)rtl*) 952 @rm -fr $(wildcard $(MODDESTDIR)rtl*) 953endif 954 @/sbin/depmod -a ${KVER} 955 @echo "Please reboot your system" 956 957restore_rtlwifi: 958 @echo "Restoring backups" 959ifneq (,$(wildcard $(STAGINGMODDIR)/backup_rtlwifi_driver.tar)) 960 @tar xPf $(STAGINGMODDIR)/backup_rtlwifi_driver.tar 961 @rm $(STAGINGMODDIR)/backup_rtlwifi_driver.tar 962endif 963ifneq (,$(wildcard $(MODDESTDIR)backup_rtlwifi_driver.tar)) 964 @tar xPf $(MODDESTDIR)backup_rtlwifi_driver.tar 965 @rm $(MODDESTDIR)backup_rtlwifi_driver.tar 966endif 967ifneq (,$(wildcard $(MODDESTDIR)../backup_rtlwifi_driver.tar)) 968 @tar xPf $(MODDESTDIR)../backup_rtlwifi_driver.tar 969 @rm $(MODDESTDIR)../backup_rtlwifi_driver.tar 970endif 971 @/sbin/depmod -a ${KVER} 972 @echo "Please reboot your system" 973 974config_r: 975 @echo "make config" 976 /bin/bash script/Configure script/config.in 977 978 979.PHONY: modules clean 980 981clean: 982 #$(MAKE) -C $(KSRC) M=$(shell pwd) clean 983 cd hal ; rm -fr */*/*/*.mod.c */*/*/*.mod */*/*/*.o */*/*/.*.cmd */*/*/*.ko 984 cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/.*.cmd */*/*.ko 985 cd hal ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko 986 cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko 987 cd core ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko 988 cd core ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko 989 cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko 990 cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko 991 cd platform ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko 992 rm -fr Module.symvers ; rm -fr Module.markers ; rm -fr modules.order 993 rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~ 994 rm -fr .tmp_versions 995endif 996 997