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_SOC_FAMILY_INFINEON_CAT1B)
49  zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC      ${pdl_drv_dir}/source/cy_adcmic.c)
50else()
51  zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC      ${pdl_drv_dir}/source/cy_sar.c)
52endif()
53
54if(CONFIG_USE_INFINEON_TRNG)
55  zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto.c)
56  zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto_core_trng_v1.c)
57  zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto_core_trng_v2.c)
58endif()
59
60if(CONFIG_USE_INFINEON_UART OR CONFIG_USE_INFINEON_I2C OR CONFIG_USE_INFINEON_SPI)
61  zephyr_library_sources(${pdl_drv_dir}/source/cy_scb_common.c)
62endif()
63
64if(CONFIG_USE_INFINEON_ADC OR CONFIG_USE_INFINEON_SMIF)
65  zephyr_library_sources(${pdl_drv_dir}/source/cy_dma.c)
66  zephyr_library_sources(${pdl_drv_dir}/source/cy_dmac.c)
67endif()
68
69zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SMIF ${pdl_drv_dir}/source/cy_smif.c)
70zephyr_code_relocate(FILES ${pdl_drv_dir}/source/cy_smif.c LOCATION RAM)
71zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SMIF ${pdl_drv_dir}/source/cy_smif_sfdp.c)
72zephyr_code_relocate(FILES ${pdl_drv_dir}/source/cy_smif_sfdp.c LOCATION RAM)
73zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SMIF ${pdl_drv_dir}/source/cy_smif_memslot.c)
74zephyr_code_relocate(FILES ${pdl_drv_dir}/source/cy_smif_memslot.c LOCATION RAM)
75
76if(CONFIG_USE_INFINEON_ADC)
77  zephyr_library_sources(${pdl_drv_dir}/source/cy_sysanalog.c)
78endif()
79
80# Common part
81zephyr_library_sources(${pdl_drv_dir}/source/cy_flash.c)
82zephyr_library_sources(${pdl_drv_dir}/source/cy_gpio.c)
83zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_drv.c)
84zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_pipe.c)
85zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_sema.c)
86zephyr_library_sources(${pdl_drv_dir}/source/cy_prot.c)
87zephyr_library_sources(${pdl_drv_dir}/source/cy_sysclk.c)
88if(CONFIG_SOC_FAMILY_INFINEON_CAT1B)
89  zephyr_library_sources(${pdl_drv_dir}/source/cy_sysclk_v2.c)
90  zephyr_library_sources(${pdl_drv_dir}/source/cy_systick_v2.c)
91  zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm_v2.c)
92  zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm_btss.c)
93  zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm_ppu.c)
94  zephyr_library_sources(${pdl_drv_dir}/source/ppu_v1.c)
95endif()
96zephyr_library_sources(${pdl_drv_dir}/source/cy_syslib.c)
97zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm.c)
98zephyr_library_sources(${pdl_drv_dir}/source/cy_systick.c)
99zephyr_library_sources(${pdl_drv_dir}/source/cy_trigmux.c)
100zephyr_library_sources(${pdl_drv_dir}/source/cy_wdt.c)
101
102# add IPC_BT driver for CYW208XX devices
103zephyr_library_sources_ifdef(CONFIG_BT_CYW208XX  ${pdl_drv_dir}/source/cy_ipc_bt.c)
104zephyr_library_sources_ifdef(CONFIG_BT_CYW208XX  ${pdl_drv_dir}/source/cy_syspm_pdcm.c)
105