################################################################################
#
# RTL8852CU_CV
#
################################################################################

RTL8852CU_CV_VERSION = v1.19.2-107-g2751ef875.20221230
RTL8852CU_CV_SOURCE = rtl8852CU_WiFi_linux_$(RTL8852CU_CV_VERSION).tar.gz
RTL8852CU_CV_SITE = $(BR2_EXTERNAL_CVBOARD_PATH)/package/rtl8852cu_CV
RTL8852CU_CV_SITE_METHOD = local

RTL8852CU_CV_LICENSE = GPL-2.0
RTL8852CU_CV_LICENSE_FILES = LICENSE

RTL8852CU_CV_PATCH_DIR = $(RTL8852CU_CV_SITE)/patches/

define RTL8852CU_CV_EXTRACT_CMDS
    tar --strip-components=1 -xzf $(RTL8852CU_CV_SITE)/$(RTL8852CU_CV_SOURCE) -C $(BUILD_DIR)/rtl8852cu_CV-$(RTL8852CU_CV_VERSION)
    patch -p0 -d $(BUILD_DIR)/rtl8852cu_CV-$(RTL8852CU_CV_VERSION) < $(RTL8852CU_CV_PATCH_DIR)/0001-warn-compile-problem.patch
endef

RTL8852CU_CV_EXTRA_CFLAGS = \
    -DCONFIG_$(call qstrip,$(BR2_ENDIAN))_ENDIAN \
    -DCONFIG_IOCTL_CFG80211 \
    -DRTW_USE_CFG80211_STA_EVENT
#    -DCONFIG_RADIO_WORK \
#    -DCONFIG_CONCURRENT_MODE

RTL8852CU_CV_MODULE_MAKE_OPTS = \
    CONFIG_PLATFORM_I386_PC=n \
    CONFIG_RTL8852CU=m \
    CONFIG_RTW_DEBUG=n \
    _PLATFORM_FILES+=platform/platform_ops.o \
    KVER=$(LINUX_VERSION_PROBED) \
    USER_EXTRA_CFLAGS="$(RTL8852CU_CV_EXTRA_CFLAGS)"

RTL8852CU_CV_POST_RSYNC_HOOKS = RTL8852CU_CV_EXTRACT_CMDS

$(eval $(kernel-module))
$(eval $(generic-package))
