1# Copyright (c) 2021 Nordic Semiconductor ASA 2# SPDX-License-Identifier: Apache-2.0 3 4zephyr_library_named(nrf-802154-platform) 5zephyr_interface_library_named(zephyr-802154-interface) 6 7if (CONFIG_NRF_802154_RADIO_DRIVER) 8 target_sources(nrf-802154-platform 9 PRIVATE 10 radio/platform/nrf_802154_random_zephyr.c 11 sl_opensource/platform/nrf_802154_clock_zephyr.c 12 sl_opensource/platform/nrf_802154_irq_zephyr.c 13 sl_opensource/platform/nrf_802154_temperature_zephyr.c 14 ) 15endif () 16 17if (CONFIG_NRF_802154_SERIALIZATION) 18 target_sources(nrf-802154-platform 19 PRIVATE 20 serialization/platform/nrf_802154_serialization_crit_sect.c 21 serialization/platform/nrf_802154_spinel_log.c 22 serialization/platform/nrf_802154_spinel_backend_ipc.c 23 serialization/platform/nrf_802154_spinel_response_notifier.c 24 ) 25endif () 26 27if (CONFIG_NRF_802154_SER_RADIO) 28 target_sources(nrf-802154-platform 29 PRIVATE 30 serialization/platform/nrf_802154_init_net.c 31 ) 32endif () 33 34target_compile_definitions(zephyr-802154-interface 35 INTERFACE 36 # Number of slots containing short addresses of nodes for which 37 # pending data is stored. 38 NRF_802154_PENDING_SHORT_ADDRESSES=${CONFIG_NRF_802154_PENDING_SHORT_ADDRESSES} 39 40 # Number of slots containing extended addresses of nodes for which 41 # pending data is stored. 42 NRF_802154_PENDING_EXTENDED_ADDRESSES=${CONFIG_NRF_802154_PENDING_EXTENDED_ADDRESSES} 43 44 # Number of buffers in receive queue. 45 NRF_802154_RX_BUFFERS=${CONFIG_NRF_802154_RX_BUFFERS} 46 47 NRF_802154_TX_STARTED_NOTIFY_ENABLED=1 48 49 # ACK timeout 50 NRF_802154_ACK_TIMEOUT_ENABLED=1 51 52 # CCA mode options 53 NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} 54 NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} 55 NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} 56 57 # Key storage size 58 NRF_802154_SECURITY_KEY_STORAGE_SIZE=${CONFIG_NRF_802154_SECURITY_KEY_STORAGE_SIZE} 59) 60 61if (CONFIG_NRF_802154_CCA_MODE_ED) 62 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED) 63elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER) 64 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER) 65elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_AND_ED) 66 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_AND_ED) 67elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_OR_ED) 68 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_OR_ED) 69endif() 70 71if (CONFIG_NRF_802154_ENCRYPTION) 72 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENCRYPTION_ENABLED=1) 73 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_SECURITY_WRITER_ENABLED=1) 74 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_IE_WRITER_ENABLED=1) 75else () 76 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENCRYPTION_ENABLED=0) 77 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_SECURITY_WRITER_ENABLED=0) 78 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_IE_WRITER_ENABLED=0) 79endif() 80 81if (NOT CONFIG_IEEE802154_NRF5 AND NOT CONFIG_IEEE802154_NRF5_EXT_IRQ_MGMT AND CONFIG_NRF_802154_SL_OPENSOURCE) 82 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_INTERNAL_RADIO_IRQ_HANDLING=1) 83else() 84 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_INTERNAL_RADIO_IRQ_HANDLING=0) 85endif() 86 87if (CONFIG_NRF_802154_CARRIER_FUNCTIONS) 88 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CARRIER_FUNCTIONS_ENABLED=1) 89else() 90 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CARRIER_FUNCTIONS_ENABLED=0) 91endif() 92 93if (CONFIG_NRF_802154_ASSERT_ZEPHYR OR CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) 94 target_include_directories(zephyr-802154-interface INTERFACE include) 95 target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_PLATFORM_ASSERT_INCLUDE=\"nrf_802154_assert_zephyr.h\") 96 target_sources(nrf-802154-platform PRIVATE nrf_802154_assert_handler.c) 97endif() 98 99set(NRF52_SERIES ${CONFIG_SOC_SERIES_NRF52X}) 100set(NRF53_SERIES ${CONFIG_SOC_SERIES_NRF53X}) 101set(SER_HOST ${CONFIG_NRF_802154_SER_HOST}) 102set(SL_OPENSOURCE ${CONFIG_NRF_802154_SL_OPENSOURCE}) 103 104if(CONFIG_NRF_802154_SOURCE_HAL_NORDIC) 105 add_subdirectory(${ZEPHYR_CURRENT_MODULE_DIR}/drivers/nrf_802154 nrf_802154) 106 107 target_link_libraries(nrf-802154-driver-interface INTERFACE zephyr-802154-interface) 108 target_link_libraries(nrf-802154-serialization-interface INTERFACE zephyr-802154-interface) 109endif() 110 111 112if (CONFIG_NRF_802154_RADIO_DRIVER) 113 zephyr_append_cmake_library(nrf-802154-driver) 114 zephyr_append_cmake_library(nrf-802154-sl) 115 target_link_libraries(zephyr_interface INTERFACE nrf-802154-driver-interface) 116 # This link is needed to resolve circular dependency between SL and platform 117 target_link_libraries(nrf-802154-platform PRIVATE nrf-802154-sl) 118endif () 119 120if (CONFIG_NRF_802154_SERIALIZATION) 121 zephyr_append_cmake_library(nrf-802154-serialization) 122 target_link_libraries(zephyr_interface INTERFACE nrf-802154-serialization-interface) 123endif () 124