#
# Copyright (C) 2022. Hisilicon Technologies Co., Ltd.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 and
# only version 2 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.
#

INCLUDE_DIR += \
	-I$(HVGR_PATH)/datan/counter

SRC += \
	$(HVGR_ROOT)/datan/hvgr_datan.c \
	$(HVGR_ROOT)/datan/counter/hvgr_datan_ct.c \
	$(HVGR_ROOT)/datan/counter/hvgr_datan_ct_inner.c \
	$(HVGR_ROOT)/datan/counter/hvgr_datan_ct_time.c \
	$(HVGR_ROOT)/datan/counter/hvgr_datan_ct_hal.c \

ifdef CONFIG_HVGR_DFX_MNTN_REPORT
	SRC += \
	$(HVGR_ROOT)/datan/hvgr_mntn.c \
	$(HVGR_ROOT)/datan/debugbus/hvgr_mntn_dump.c
endif

ifdef CONFIG_HVGR_DFX_DEBUG_BUS_DUMP
INCLUDE_DIR += \
	-I$(HVGR_PATH)/datan/debugbus
SRC += \
	$(HVGR_ROOT)/datan/debugbus/$(CHIP_VER_DIR)/hvgr_debug_bus_dump.c \
	$(HVGR_ROOT)/datan/debugbus/hvgr_local_dump.c
endif

ifdef CONFIG_HVGR_DFX_MEM_DUMP
SRC += \
	$(HVGR_ROOT)/datan/memdump/hvgr_mem_dump.c
endif

ifdef CONFIG_DFX_DEBUG_FS
SRC += \
	$(HVGR_ROOT)/datan/hvgr_datan_switch.c
endif

ifdef CONFIG_HVGR_DFX_DATAN
SRC += \
	$(HVGR_ROOT)/datan/jobtrace/datan_jobtrace.c
ifeq ($(findstring $(HVGR_VERSION_CODE), 200 300), )
SRC += \
	$(HVGR_ROOT)/datan/jobtrace/datan_jobtrace_fw_upgrade.c \
	$(HVGR_ROOT)/datan/jobtrace/$(CHIP_VER_DIR)/datan_jobtrace_normal_dump.c \
	$(HVGR_ROOT)/datan/jobtrace/$(CHIP_VER_DIR)/datan_jobtrace_global_reg_dump.c
endif
endif

ifdef CONFIG_HVGR_DATAN_JOB_TIMELINE
HVGR_DATAN_JOB_TIMELINE ?= 1
DEFINES += -DHVGR_DATAN_JOB_TIMELINE=$(HVGR_DATAN_JOB_TIMELINE)
INCLUDE_DIR += \
	-I$(HVGR_PATH)/datan/jobtimeline
SRC += \
	$(HVGR_ROOT)/datan/jobtimeline/hvgr_datan_jt_common.c \
	$(HVGR_ROOT)/datan/jobtimeline/$(CHIP_VER_DIR)/hvgr_datan_jt.c \
	$(HVGR_ROOT)/datan/jobtimeline/$(CHIP_VER_DIR)/hvgr_datan_jt_debug.c
endif
