1# Copyright (c) 2024 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4
5if(CONFIG_NRFS)
6    zephyr_library()
7    if(NOT DEFINED NRFS_DIR)
8        set(NRFS_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/nrfs CACHE PATH "nrfs directory")
9    endif()
10
11    set(INC_DIR ${NRFS_DIR}/include)
12    set(SRC_DIR ${NRFS_DIR}/src)
13    set(HELPERS_DIR ${NRFS_DIR}/helpers)
14
15    zephyr_include_directories(${INC_DIR})
16    zephyr_include_directories(${INC_DIR}/services)
17    zephyr_include_directories(${HELPERS_DIR})
18    zephyr_include_directories(.)
19    zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/backends)
20    zephyr_include_directories_ifdef(CONFIG_NRFS_DVFS_LOCAL_DOMAIN ${CMAKE_CURRENT_SOURCE_DIR}/dvfs)
21
22    zephyr_library_sources(${HELPERS_DIR}/dvfs_oppoint.c)
23
24    if(CONFIG_NRFS_LOCAL_DOMAIN)
25        zephyr_library_sources_ifdef(CONFIG_NRFS_CLOCK_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_clock.c)
26        zephyr_library_sources_ifdef(CONFIG_NRFS_DIAG_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_diag.c)
27        zephyr_library_sources_ifdef(CONFIG_NRFS_DVFS_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_dvfs.c)
28        zephyr_library_sources_ifdef(CONFIG_NRFS_MRAM_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_mram.c)
29        zephyr_library_sources_ifdef(CONFIG_NRFS_PMIC_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_pmic.c)
30        zephyr_library_sources_ifdef(CONFIG_NRFS_RESET_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_reset.c)
31        zephyr_library_sources_ifdef(CONFIG_NRFS_TEMP_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_temp.c)
32        zephyr_library_sources_ifdef(CONFIG_NRFS_VBUS_DETECTOR_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_usb.c)
33        zephyr_library_sources(${SRC_DIR}/internal/nrfs_dispatcher.c)
34        add_subdirectory_ifdef(CONFIG_NRFS_DVFS_LOCAL_DOMAIN dvfs)
35
36        if(CONFIG_NRFS_DIAG_SERVICE_ENABLED)
37            message(WARNING "This service is for Nordic Semiconductor INTERNAL purposes ONLY. Use it with caution due to risk of hardware damage!")
38        endif()
39    endif()
40    zephyr_library_sources_ifdef(CONFIG_NRFS_LOCAL_DOMAIN backends/nrfs_backend_ipc_service.c)
41endif()
42