From d940d23c10908a6e3e053ff3108fc5c04f4a9c93 Mon Sep 17 00:00:00 2001 From: Nazar Palamar Date: Mon, 9 May 2022 15:19:46 +0300 Subject: [PATCH] modules: hal_infineon: added initial Kconfig and CMakeLists.txt - added initial Kconfig - added initial CMakeLists.txt (root, core-lib, mtb-pal-cat1) - updated module, driver and soc to use CONFIG_USE_INFINEON_xx defines from modules/hal_infineon/Kconfig Signed-off-by: Nazar Palamar --- drivers/serial/Kconfig.psoc6 | 1 + drivers/spi/Kconfig.psoc6 | 1 + modules/hal_infineon/CMakeLists.txt | 18 ++++++ modules/hal_infineon/Kconfig | 63 +++++++++++++++++++ modules/hal_infineon/core-lib/CMakeLists.txt | 6 ++ .../hal_infineon/mtb-pdl-cat1/CMakeLists.txt | 63 +++++++++++++++++++ 6 files changed, 152 insertions(+) create mode 100644 modules/hal_infineon/CMakeLists.txt create mode 100644 modules/hal_infineon/Kconfig create mode 100644 modules/hal_infineon/core-lib/CMakeLists.txt create mode 100644 modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt diff --git a/drivers/serial/Kconfig.psoc6 b/drivers/serial/Kconfig.psoc6 index 7f1e2456041..e5595788688 100644 --- a/drivers/serial/Kconfig.psoc6 +++ b/drivers/serial/Kconfig.psoc6 @@ -9,5 +9,6 @@ config UART_PSOC6 depends on SOC_FAMILY_PSOC6 select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT + select USE_INFINEON_UART help This option enables the SCB[UART] driver for PSoC-6 SoC family. diff --git a/drivers/spi/Kconfig.psoc6 b/drivers/spi/Kconfig.psoc6 index 6b2adce59b0..66b4e87fe38 100644 --- a/drivers/spi/Kconfig.psoc6 +++ b/drivers/spi/Kconfig.psoc6 @@ -6,5 +6,6 @@ config SPI_PSOC6 bool "PSoC-6 MCU SCB spi driver" depends on SOC_FAMILY_PSOC6 + select USE_INFINEON_SPI help This option enables the SCB[SPI] driver for PSoC-6 SoC family. diff --git a/modules/hal_infineon/CMakeLists.txt b/modules/hal_infineon/CMakeLists.txt new file mode 100644 index 00000000000..ba74a19bd00 --- /dev/null +++ b/modules/hal_infineon/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (c) 2020 Linumiz +# Copyright (c) 2022 Cypress Semiconductor Corporation. +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library_named(modules_hal_infineon) + +## Add PDL sources for XMC devices +if (CONFIG_HAS_XMCLIB) + add_subdirectory(${ZEPHYR_HAL_INFINEON_MODULE_DIR}/XMCLib XMCLib) +endif() + +if (CONFIG_SOC_FAMILY_PSOC6) + ## Add core-lib sources for CAT1 devices + add_subdirectory(core-lib) + + ## Add mtb-pdl-cat1 sources for CAT1 devices + add_subdirectory(mtb-pdl-cat1) +endif() diff --git a/modules/hal_infineon/Kconfig b/modules/hal_infineon/Kconfig new file mode 100644 index 00000000000..7f313af8e1d --- /dev/null +++ b/modules/hal_infineon/Kconfig @@ -0,0 +1,63 @@ +# Copyright (c) 2022 Cypress Semiconductor Corporation. +# SPDX-License-Identifier: Apache-2.0 + +config ZEPHYR_HAL_INFINEON_MODULE + bool + +if SOC_FAMILY_PSOC6 + +config USE_INFINEON_ADC + bool + help + Enable Analog-to-Digital Converter (ADC) HAL module driver for Infineon devices + +config USE_INFINEON_I2C + bool + help + Enable Inter-Integrated Circuit Interface (I2C) HAL module driver for Infineon devices + +config USE_INFINEON_RTC + bool + help + Enable Real-Time Clock (RTC) HAL module driver for Infineon devices + +config USE_INFINEON_SDIO + bool + help + Enable Secure Digital Input/Output interface (SDIO) HAL module for Infineon devices + driver + +config USE_INFINEON_SPI + bool + help + Enable Serial Peripheral Interface (SPI) HAL module driver for Infineon devices + + +config USE_INFINEON_TIMER + bool + help + Enable Timer (Timer/Counter) HAL module driver for Infineon devices + +config USE_INFINEON_LPTIMER + bool + help + Enable Low-Power Timer (LPTimer) HAL module driver for Infineon devices + +config USE_INFINEON_TRNG + bool + help + Enable True Random Number Generator (TRNG) HAL module driver for Infineon devices + +config USE_INFINEON_UART + bool + help + Enable Universal Asynchronous Receiver/Transmitter (UART) HAL module + driver for Infineon devices + +config USE_INFINEON_PWM + bool + help + Enable Pulse Width Modulator (PWM) HAL module + driver for Infineon devices + +endif # SOC_FAMILY_PSOC6 diff --git a/modules/hal_infineon/core-lib/CMakeLists.txt b/modules/hal_infineon/core-lib/CMakeLists.txt new file mode 100644 index 00000000000..45daa771b29 --- /dev/null +++ b/modules/hal_infineon/core-lib/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (c) 2022 Cypress Semiconductor Corporation. +# +# SPDX-License-Identifier: Apache-2.0 + +# Add core-lib +zephyr_include_directories(${ZEPHYR_HAL_INFINEON_MODULE_DIR}/core-lib/include) diff --git a/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt b/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt new file mode 100644 index 00000000000..2d12fafe1a5 --- /dev/null +++ b/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt @@ -0,0 +1,63 @@ +# Copyright (c) 2022 Cypress Semiconductor Corporation. +# +# SPDX-License-Identifier: Apache-2.0 + +set(pdl_dir ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-pdl-cat1) +set(pdl_drv_dir ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-pdl-cat1/drivers) +set(pdl_dev_cat1a_dir ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-pdl-cat1/devices/COMPONENT_CAT1A) + +zephyr_compile_definitions(${CONFIG_SOC_PART_NUMBER}) + +# Add mtb-pdl-cat1 +zephyr_include_directories(${pdl_drv_dir}/include) +zephyr_include_directories(${pdl_dev_cat1a_dir}/include) +zephyr_include_directories(${pdl_dev_cat1a_dir}/include/ip) +zephyr_include_directories(${pdl_dev_cat1a_dir}/templates/COMPONENT_MTB) + +zephyr_library_sources(${pdl_dev_cat1a_dir}/source/cy_device.c) +zephyr_library_sources(${pdl_drv_dir}/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.S) + +zephyr_library_sources_ifdef(CONFIG_CPU_CORTEX_M4 + ${pdl_dev_cat1a_dir}/templates/COMPONENT_MTB/COMPONENT_CM4/system_psoc6_cm4.c) +zephyr_library_sources_ifdef(CONFIG_CPU_CORTEX_M0PLUS + ${pdl_dev_cat1a_dir}/templates/COMPONENT_MTB/COMPONENT_CM0P/system_psoc6_cm0plus.c) + +# Peripheral drivers +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_UART ${pdl_drv_dir}/source/cy_scb_uart.c) +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC ${pdl_drv_dir}/source/cy_sar.c) +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_I2C ${pdl_drv_dir}/source/cy_scb_i2c.c) +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SPI ${pdl_drv_dir}/source/cy_scb_spi.c) +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_TIMER ${pdl_drv_dir}/source/cy_tcpwm_counter.c) +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_PWM ${pdl_drv_dir}/source/cy_tcpwm_pwm.c) +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_LPTIMER ${pdl_drv_dir}/source/cy_mcwdt.c) +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_RTC ${pdl_drv_dir}/source/cy_rtc.c) +zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SDIO ${pdl_drv_dir}/source/cy_sd_host.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FAMILY_PSOC6 ${pdl_drv_dir}/source/cy_sysint.c) + +if(CONFIG_USE_INFINEON_TRNG) + zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto.c) + zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto_core_trng_v1.c) + zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto_core_trng_v2.c) +endif() + +if(CONFIG_USE_INFINEON_UART OR CONFIG_USE_INFINEON_I2C OR CONFIG_USE_INFINEON_SPI) + zephyr_library_sources(${pdl_drv_dir}/source/cy_scb_common.c) +endif() + +if(CONFIG_USE_INFINEON_ADC) + zephyr_library_sources(${pdl_drv_dir}/source/cy_sysanalog.c) +endif() + +# Common part +zephyr_library_sources(${pdl_drv_dir}/source/cy_flash.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_gpio.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_drv.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_pipe.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_ipc_sema.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_prot.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_sysclk.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_syslib.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_systick.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_trigmux.c) +zephyr_library_sources(${pdl_drv_dir}/source/cy_wdt.c)