1#
2# Copyright (c) 2021, Nordic Semiconductor ASA
3# All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are met:
9#
10# 1. Redistributions of source code must retain the above copyright notice, this
11#    list of conditions and the following disclaimer.
12#
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16#
17# 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18#    contributors may be used to endorse or promote products derived from this
19#    software without specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23# IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
24# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31# POSSIBILITY OF SUCH DAMAGE.
32#
33#
34
35target_include_directories(nrf-802154-driver-interface INTERFACE include)
36
37add_library(nrf-802154-driver STATIC EXCLUDE_FROM_ALL)
38
39target_include_directories(nrf-802154-driver
40  PRIVATE
41    src
42)
43
44target_sources(nrf-802154-driver
45  PRIVATE
46    src/nrf_802154.c
47    src/nrf_802154_aes_ccm_acc_ccm.c
48    src/nrf_802154_aes_ccm_acc_ecb.c
49    src/nrf_802154_bsim_utils.c
50    src/nrf_802154_co.c
51    src/nrf_802154_core.c
52    src/nrf_802154_core_hooks.c
53    src/nrf_802154_critical_section.c
54    src/nrf_802154_debug.c
55    src/nrf_802154_encrypt.c
56    src/nrf_802154_notification_direct.c
57    src/nrf_802154_notification_swi.c
58    src/nrf_802154_pib.c
59    src/nrf_802154_peripherals_alloc.c
60    src/nrf_802154_queue.c
61    src/nrf_802154_request_direct.c
62    src/nrf_802154_request_swi.c
63    src/nrf_802154_rssi.c
64    src/nrf_802154_rx_buffer.c
65    src/nrf_802154_stats.c
66    src/nrf_802154_swi.c
67    src/nrf_802154_trx.c
68    src/nrf_802154_trx_dppi.c
69    src/nrf_802154_trx_ppi.c
70    src/nrf_802154_tx_work_buffer.c
71    src/nrf_802154_tx_power.c
72    src/mac_features/nrf_802154_csma_ca.c
73    src/mac_features/nrf_802154_delayed_trx.c
74    src/mac_features/nrf_802154_filter.c
75    src/mac_features/nrf_802154_frame_parser.c
76    src/mac_features/nrf_802154_ie_writer.c
77    src/mac_features/nrf_802154_ifs.c
78    src/mac_features/nrf_802154_security_pib_ram.c
79    src/mac_features/nrf_802154_security_writer.c
80    src/mac_features/nrf_802154_precise_ack_timeout.c
81    src/mac_features/ack_generator/nrf_802154_ack_data.c
82    src/mac_features/ack_generator/nrf_802154_ack_generator.c
83    src/mac_features/ack_generator/nrf_802154_enh_ack_generator.c
84    src/mac_features/ack_generator/nrf_802154_imm_ack_generator.c
85)
86
87if (SL_OPENSOURCE)
88  target_compile_definitions(nrf-802154-driver-interface
89    INTERFACE
90      # Disable Frame Timestamps
91      NRF_802154_FRAME_TIMESTAMP_ENABLED=0
92      # Disable DTRX
93      NRF_802154_DELAYED_TRX_ENABLED=0
94      # Disable IFS
95      NRF_802154_IFS_ENABLED=0
96      # Disable CSMA-CA
97      NRF_802154_CSMA_CA_ENABLED=0
98      # Use nrf_802154_notification_direct.c implementation for "notification" module
99      NRF_802154_NOTIFICATION_IMPL=NRF_802154_NOTIFICATION_IMPL_DIRECT
100      # Use nrf_802154_request_direct.c implementation for "request" module
101      NRF_802154_REQUEST_IMPL=NRF_802154_REQUEST_IMPL_DIRECT
102  )
103endif()
104
105if (NRF_802154_PROJECT_CONFIG)
106  target_compile_definitions(nrf-802154-driver-interface
107    INTERFACE
108      # Propagate project config from build system defines
109      NRF_802154_PROJECT_CONFIG="${NRF_802154_PROJECT_CONFIG}"
110  )
111endif()
112
113target_compile_definitions(nrf-802154-driver-interface
114  INTERFACE
115    # The core for which the code is compiled contains the 802.15.4 radio driver
116    NRF_802154_SERIALIZATION_HOST=0
117)
118
119target_link_libraries(nrf-802154-driver-interface
120  INTERFACE
121    nrf-802154-common-interface
122)
123
124target_link_libraries(nrf-802154-driver
125  PUBLIC
126    nrf-802154-driver-interface
127    nrf-802154-platform
128    nrf-802154-sl
129    nrf-802154-common
130)
131