1# Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or
2# an affiliate of Cypress Semiconductor Corporation
3#
4# SPDX-License-Identifier: Apache-2.0
5
6set(pdl_dir             ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-pdl-cat1)
7set(pdl_drv_dir         ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-pdl-cat1/drivers)
8set(pdl_dev_cat1a_dir   ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-pdl-cat1/devices/COMPONENT_CAT1A)
9set(pdl_dev_cat1b_dir   ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-pdl-cat1/devices/COMPONENT_CAT1B)
10
11
12# Generate PDL specific SOC defines
13zephyr_compile_definitions(${CONFIG_SOC_PART_NUMBER})
14zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1 $<UPPER_CASE:${CONFIG_SOC}>)
15
16# Generate PDL specific define (w. *_device) for SOC module (e.g: CYBLE_416045_02)
17zephyr_compile_definitions_ifdef(CONFIG_SOC_CYBLE_416045_02 CYBLE_416045_02_device)
18
19# Add mtb-pdl-cat1
20zephyr_include_directories(${pdl_drv_dir}/include)
21
22zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1A ${pdl_dev_cat1a_dir}/include)
23zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1A ${pdl_dev_cat1a_dir}/include/ip)
24zephyr_library_sources_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1A ${pdl_dev_cat1a_dir}/source/cy_device.c)
25
26
27zephyr_include_directories(${pdl_drv_dir}/include)
28zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1B ${pdl_dev_cat1b_dir}/include)
29zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1B ${pdl_dev_cat1b_dir}/include/ip)
30zephyr_library_sources_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1B ${pdl_dev_cat1b_dir}/source/cy_device.c)
31
32zephyr_library_sources(${pdl_drv_dir}/source/TOOLCHAIN_GCC_ARM/cy_syslib_ext.S)
33
34# Peripheral drivers
35zephyr_library_sources_ifdef(CONFIG_SOC_FAMILY_PSOC6_LEGACY      ${pdl_drv_dir}/source/cy_sysint.c)
36zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC      ${pdl_drv_dir}/source/cy_sar.c)
37zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_I2C      ${pdl_drv_dir}/source/cy_scb_i2c.c)
38zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_LPTIMER  ${pdl_drv_dir}/source/cy_mcwdt.c)
39zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_PWM      ${pdl_drv_dir}/source/cy_tcpwm_pwm.c)
40zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_RTC      ${pdl_drv_dir}/source/cy_rtc.c)
41zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SDIO     ${pdl_drv_dir}/source/cy_sd_host.c)
42zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SPI      ${pdl_drv_dir}/source/cy_scb_spi.c)
43zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_TIMER    ${pdl_drv_dir}/source/cy_tcpwm_counter.c)
44zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_UART     ${pdl_drv_dir}/source/cy_scb_uart.c)
45zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_FLASH    ${pdl_drv_dir}/source/cy_flash.c)
46zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_WDT      ${pdl_drv_dir}/source/cy_wdt.c)
47
48if(CONFIG_USE_INFINEON_TRNG)
49  zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto.c)
50  zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto_core_trng_v1.c)
51  zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto_core_trng_v2.c)
52endif()
53
54if(CONFIG_USE_INFINEON_UART OR CONFIG_USE_INFINEON_I2C OR CONFIG_USE_INFINEON_SPI)
55  zephyr_library_sources(${pdl_drv_dir}/source/cy_scb_common.c)
56endif()
57
58if(CONFIG_USE_INFINEON_ADC OR CONFIG_USE_INFINEON_SMIF)
59  zephyr_library_sources(${pdl_drv_dir}/source/cy_dma.c)
60  zephyr_library_sources(${pdl_drv_dir}/source/cy_dmac.c)
61endif()
62
63zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SMIF ${pdl_drv_dir}/source/cy_smif.c)
64zephyr_code_relocate(FILES ${pdl_drv_dir}/source/cy_smif.c LOCATION RAM)
65zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SMIF ${pdl_drv_dir}/source/cy_smif_sfdp.c)
66zephyr_code_relocate(FILES ${pdl_drv_dir}/source/cy_smif_sfdp.c LOCATION RAM)
67zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SMIF ${pdl_drv_dir}/source/cy_smif_memslot.c)
68zephyr_code_relocate(FILES ${pdl_drv_dir}/source/cy_smif_memslot.c LOCATION RAM)
69
70if(CONFIG_USE_INFINEON_ADC)
71  zephyr_library_sources(${pdl_drv_dir}/source/cy_sysanalog.c)
72endif()
73
74# Common part
75zephyr_library_sources(${pdl_drv_dir}/source/cy_flash.c)
76zephyr_library_sources(${pdl_drv_dir}/source/cy_gpio.c)
77zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_drv.c)
78zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_pipe.c)
79zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_sema.c)
80zephyr_library_sources(${pdl_drv_dir}/source/cy_prot.c)
81zephyr_library_sources(${pdl_drv_dir}/source/cy_sysclk.c)
82if(CONFIG_SOC_FAMILY_INFINEON_CAT1B)
83  zephyr_library_sources(${pdl_drv_dir}/source/cy_sysclk_v2.c)
84  zephyr_library_sources(${pdl_drv_dir}/source/cy_systick_v2.c)
85  zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm_v2.c)
86  zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm_btss.c)
87endif()
88zephyr_library_sources(${pdl_drv_dir}/source/cy_syslib.c)
89zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm.c)
90zephyr_library_sources(${pdl_drv_dir}/source/cy_systick.c)
91zephyr_library_sources(${pdl_drv_dir}/source/cy_trigmux.c)
92zephyr_library_sources(${pdl_drv_dir}/source/cy_wdt.c)
93
94# add IPC_BT driver for CYW208XX devices
95zephyr_library_sources_ifdef(CONFIG_BT_CYW208XX  ${pdl_drv_dir}/source/cy_ipc_bt.c)
96zephyr_library_sources_ifdef(CONFIG_BT_CYW208XX  ${pdl_drv_dir}/source/cy_syspm_pdcm.c)
97