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(hal_dir         ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-hal-cat1)
7set(hal_cat1a_dir   ${hal_dir}/COMPONENT_CAT1A)
8set(hal_cat1b_dir   ${hal_dir}/COMPONENT_CAT1B)
9
10# PSOC 6 family defines
11zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1A COMPONENT_CAT1A)
12zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1B COMPONENT_CAT1B)
13zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1 COMPONENT_CAT1)
14zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1 CY_USING_HAL)
15
16# Add mtb-hal-cat1
17zephyr_include_directories(${hal_dir}/include)
18zephyr_include_directories(${hal_dir}/include_pvt)
19zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1A ${hal_cat1a_dir}/include)
20zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1B ${hal_cat1b_dir}/include)
21
22# Packages sources
23zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_01_104_M_CSP_BLE
24  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_01_104_m_csp_ble.c)
25zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_01_104_M_CSP_BLE_USB
26  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_01_104_m_csp_ble_usb.c)
27zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_01_116_BGA_BLE
28  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_01_116_bga_ble.c)
29zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_01_116_BGA_USB
30  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_01_116_bga_usb.c)
31zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_01_124_BGA
32  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_01_124_bga.c)
33zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_01_124_BGA_SIP
34  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_01_124_bga_sip.c)
35zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_01_68_QFN_BLE
36  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_01_68_qfn_ble.c)
37zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_01_80_WLCSP
38  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_01_80_wlcsp.c)
39zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_02_100_WLCSP
40  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_02_100_wlcsp.c)
41zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_02_124_BGA
42  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_02_124_bga.c)
43zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_02_128_TQFP
44  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_02_128_tqfp.c)
45zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_02_68_QFN
46  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_02_68_qfn.c)
47zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_03_100_TQFP
48  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_03_100_tqfp.c)
49zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_03_49_WLCSP
50  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_03_49_wlcsp.c)
51zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_03_68_QFN
52  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_03_68_qfn.c)
53zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_04_64_TQFP
54  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_04_64_tqfp.c)
55zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_04_68_QFN
56  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_04_68_qfn.c)
57zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_PSOC6_04_80_TQFP
58  ${hal_cat1a_dir}/source/pin_packages/cyhal_psoc6_04_80_tqfp.c)
59
60zephyr_library_sources_ifdef(CONFIG_SOC_PACKAGE_CYW20829_56_QFN
61  ${hal_cat1b_dir}/source/pin_packages/cyhal_cyw20829_56_qfn.c)
62
63zephyr_library_sources_ifdef(CONFIG_SOC_DIE_CYW20829
64  ${hal_cat1b_dir}/source/triggers/cyhal_triggers_cyw20829.c)
65
66zephyr_library_sources_ifdef(CONFIG_SOC_DIE_PSOC6_01
67  ${hal_cat1a_dir}/source/triggers/cyhal_triggers_psoc6_01.c)
68zephyr_library_sources_ifdef(CONFIG_SOC_DIE_PSOC6_02
69  ${hal_cat1a_dir}/source/triggers/cyhal_triggers_psoc6_02.c)
70zephyr_library_sources_ifdef(CONFIG_SOC_DIE_PSOC6_03
71  ${hal_cat1a_dir}/source/triggers/cyhal_triggers_psoc6_03.c)
72zephyr_library_sources_ifdef(CONFIG_SOC_DIE_PSOC6_04
73  ${hal_cat1a_dir}/source/triggers/cyhal_triggers_psoc6_04.c)
74
75# High level interface for interacting with CAT1 hardware
76zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC     ${hal_dir}/source/cyhal_adc_sar.c)
77zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC     ${hal_dir}/source/cyhal_analog_common.c)
78zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_FLASH   ${hal_dir}/source/cyhal_nvm.c)
79zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_I2C     ${hal_dir}/source/cyhal_i2c.c)
80zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_LPTIMER ${hal_dir}/source/cyhal_lptimer.c)
81zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_RTC     ${hal_dir}/source/cyhal_rtc.c)
82zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SDIO    ${hal_dir}/source/cyhal_sdhc.c)
83zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SPI     ${hal_dir}/source/cyhal_spi.c)
84zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_TIMER   ${hal_dir}/source/cyhal_timer.c)
85zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_TRNG    ${hal_dir}/source/cyhal_trng.c)
86zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_UART    ${hal_dir}/source/cyhal_uart.c)
87zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_WDT     ${hal_dir}/source/cyhal_wdt.c)
88
89if(CONFIG_USE_INFINEON_ADC OR CONFIG_USE_INFINEON_SMIF)
90  zephyr_library_sources(${hal_dir}/source/cyhal_dma.c)
91  zephyr_library_sources(${hal_dir}/source/cyhal_dma_dmac.c)
92  zephyr_library_sources(${hal_dir}/source/cyhal_dma_dw.c)
93endif()
94
95if(CONFIG_USE_INFINEON_TIMER)
96  zephyr_library_sources(${hal_dir}/source/cyhal_tcpwm_common.c)
97endif()
98
99if(CONFIG_USE_INFINEON_UART OR CONFIG_USE_INFINEON_I2C OR CONFIG_USE_INFINEON_SPI)
100  zephyr_library_sources(${hal_dir}/source/cyhal_scb_common.c)
101endif()
102
103# Common part
104zephyr_library_sources(${hal_dir}/source/cyhal_clock.c)
105zephyr_library_sources(${hal_dir}/source/cyhal_gpio.c)
106zephyr_library_sources(${hal_dir}/source/cyhal_hwmgr.c)
107zephyr_library_sources(${hal_dir}/source/cyhal_interconnect.c)
108zephyr_library_sources(${hal_dir}/source/cyhal_syspm.c)
109zephyr_library_sources(${hal_dir}/source/cyhal_system.c)
110zephyr_library_sources(${hal_dir}/source/cyhal_utils.c)
111zephyr_library_sources(${hal_dir}/source/cyhal_utils_impl.c)
112zephyr_library_sources(${hal_dir}/source/cyhal_wdt.c)
113zephyr_library_sources(${hal_dir}/source/cyhal_irq_impl.c)
114