include ../../../common.mk

ifdef PSDK_QNX_PATH
# Error if PSDK_QNX_PATH is provided but doesn't exist
ifeq ("$(wildcard $(PSDK_QNX_PATH))","")
$(error TI PSDKQA ($(PSDK_QNX_PATH)): path not found)
endif

# Error if SOC is not provided/recognized
ifdef SOC
ifeq ($(SOC),$(filter $(SOC), j721e))
CCFLAGS += -DSOC_J721E
else ifeq ($(SOC),$(filter $(SOC), j7200))
CCFLAGS += -DSOC_J7200
else ifeq ($(SOC),$(filter $(SOC), j721s2))
CCFLAGS += -DSOC_J721S2
else ifeq ($(SOC),$(filter $(SOC), j784s4))
CCFLAGS += -DSOC_J784S4
else ifeq ($(SOC),$(filter $(SOC), am62x))
CCFLAGS += -DSOC_AM62X
else
$(error SOC ($(SOC)) not recognized!)
endif
else
$(error SOC not provided!)
endif

$(info TI PSDKQA ($(PSDK_QNX_PATH)): driver will be built with DMA support!)
EXTRA_INCVPATH += $(PSDK_QNX_PATH)/pdk/packages
EXTRA_INCVPATH += $(PSDK_QNX_PATH)

LIBS += $(PSDK_QNX_PATH)/qnx/pdk_libs/pdk/aarch64/so.le/libti-pdk.so
LIBS += $(PSDK_QNX_PATH)/qnx/pdk_libs/sciclient/aarch64/so.le/libti-sciclient.so
LIBS += $(PSDK_QNX_PATH)/qnx/pdk_libs/udmalld/aarch64/so.le/libti-udmalld.so
LIBS += $(PSDK_QNX_PATH)/qnx/resmgr/udma_qnx_rsmgr/usr/aarch64/so.le/libtiudma-usr.so

CCFLAGS += -DJ7OSPI_UDMA_SUPPORT

else
$(warning TI PSDKQA not found: driver will be built without DMA support!)
endif

LIBS += cache
