1# SPDX-License-Identifier: Apache-2.0
2
3if(CONFIG_BT_CTLR_ADVANCED_FEATURES)
4  message(WARNING "\nCONFIG_BT_CTLR_ADVANCED_FEATURES=y, Advanced Features' "
5                  "default value change could change Zephyr Bluetooth "
6                  "Controller's functional behavior.")
7endif()
8
9zephyr_library()
10zephyr_library_link_libraries(subsys__bluetooth)
11
12if(CONFIG_BT_SHELL AND CONFIG_BT_LL_SW_SPLIT)
13  add_subdirectory(ticker/shell)
14  add_subdirectory(ll_sw/shell)
15endif()
16
17zephyr_library_sources(
18  util/mem.c
19  util/memq.c
20  util/mayfly.c
21  util/dbuf.c
22  util/util.c
23  ticker/ticker.c
24  ll_sw/ll_feat.c
25  ll_sw/ll_tx_pwr.c
26  ll_sw/ll_addr.c
27  ll_sw/ull.c
28  ll_sw/lll_common.c
29  )
30
31zephyr_library_sources_ifdef(
32  CONFIG_BT_CTLR_HCI
33  hci/hci_driver.c
34  hci/hci.c
35  )
36
37if(CONFIG_BT_BROADCASTER)
38  zephyr_library_sources(
39    ll_sw/ull_adv.c
40    )
41  zephyr_library_sources_ifdef(
42    CONFIG_BT_CTLR_ADV_EXT
43    ll_sw/ull_adv_aux.c
44    )
45  zephyr_library_sources_ifdef(
46    CONFIG_BT_CTLR_ADV_PERIODIC
47    ll_sw/ull_adv_sync.c
48    )
49  zephyr_library_sources_ifdef(
50    CONFIG_BT_CTLR_ADV_ISO
51    ll_sw/ull_adv_iso.c
52    )
53endif()
54
55if(CONFIG_BT_OBSERVER)
56  zephyr_library_sources(
57    ll_sw/ull_scan.c
58    )
59  zephyr_library_sources_ifdef(
60    CONFIG_BT_CTLR_ADV_EXT
61    ll_sw/ull_scan_aux.c
62    )
63  zephyr_library_sources_ifdef(
64    CONFIG_BT_CTLR_SYNC_PERIODIC
65    ll_sw/ull_sync.c
66    )
67  zephyr_library_sources_ifdef(
68    CONFIG_BT_CTLR_SYNC_ISO
69    ll_sw/ull_sync_iso.c
70    )
71endif()
72
73if(CONFIG_BT_CONN)
74  zephyr_library_sources(
75    ll_sw/ull_conn.c
76    )
77  zephyr_library_sources_ifdef(
78    CONFIG_BT_CTLR_LE_ENC
79    ll_sw/ull_llcp_enc.c
80    )
81  zephyr_library_sources_ifdef(
82    CONFIG_BT_CTLR_PHY
83    ll_sw/ull_llcp_phy.c
84    )
85  if (CONFIG_BT_CTLR_PERIPHERAL_ISO OR
86      CONFIG_BT_CTLR_CENTRAL_ISO)
87    zephyr_library_sources(
88      ll_sw/ull_llcp_cc.c
89      )
90  endif()
91  zephyr_library_sources(
92    ll_sw/ull_tx_queue.c
93    ll_sw/ull_llcp.c
94    ll_sw/ull_llcp_common.c
95    ll_sw/ull_llcp_local.c
96    ll_sw/ull_llcp_pdu.c
97    ll_sw/ull_llcp_conn_upd.c
98    ll_sw/ull_llcp_chmu.c
99    ll_sw/ull_llcp_remote.c
100    )
101    if (CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER OR
102        CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER)
103      zephyr_library_sources(
104        ll_sw/ull_llcp_past.c
105      )
106    endif()
107    zephyr_library_sources_ifdef(
108    CONFIG_BT_PERIPHERAL
109    ll_sw/ull_peripheral.c
110    )
111  zephyr_library_sources_ifdef(
112    CONFIG_BT_CTLR_PERIPHERAL_ISO
113    ll_sw/ull_peripheral_iso.c
114    )
115  zephyr_library_sources_ifdef(
116    CONFIG_BT_CENTRAL
117    ll_sw/ull_central.c
118    )
119  zephyr_library_sources_ifdef(
120    CONFIG_BT_CTLR_CENTRAL_ISO
121    ll_sw/ull_central_iso.c
122    )
123endif()
124
125zephyr_library_sources_ifdef(
126  CONFIG_BT_CTLR_SCHED_ADVANCED
127  ll_sw/ull_sched.c
128  )
129
130zephyr_library_sources_ifdef(
131  CONFIG_BT_CTLR_DF
132  ll_sw/ull_df.c
133  )
134
135zephyr_library_sources_ifdef(
136  CONFIG_BT_CTLR_CONN_ISO
137  ll_sw/ull_conn_iso.c
138  )
139
140zephyr_library_sources_ifdef(
141  CONFIG_BT_CTLR_ISO
142  ll_sw/ull_iso.c
143  ll_sw/isoal.c
144  )
145
146if(CONFIG_BT_CONN OR
147   (CONFIG_BT_BROADCASTER AND
148    CONFIG_BT_CTLR_ADV_EXT) OR
149   CONFIG_BT_CTLR_ADV_PERIODIC OR
150   CONFIG_BT_CTLR_SYNC_PERIODIC)
151  zephyr_library_sources(
152    ll_sw/ull_chan.c
153    ll_sw/lll_chan.c
154    )
155endif()
156
157if(CONFIG_BT_CTLR_FILTER_ACCEPT_LIST OR
158   CONFIG_BT_CTLR_SYNC_PERIODIC_ADV_LIST)
159  zephyr_library_sources(
160    ll_sw/ull_filter.c
161    )
162endif()
163
164zephyr_library_sources_ifdef(
165  CONFIG_BT_HCI_MESH_EXT
166  ll_sw/ll_mesh.c
167  )
168
169zephyr_library_sources_ifdef(
170  CONFIG_BT_CTLR_SETTINGS
171  ll_sw/ll_settings.c
172  )
173
174zephyr_library_sources_ifdef(
175  CONFIG_BT_CTLR_CRYPTO
176  crypto/crypto.c
177  )
178
179zephyr_library_sources_ifdef(
180  CONFIG_SOC_FLASH_NRF_RADIO_SYNC_TICKER
181  flash/soc_flash_nrf_ticker.c
182  )
183
184zephyr_library_include_directories(
185  .
186  include
187  ../crypto
188  )
189
190zephyr_library_include_directories_ifdef(
191  CONFIG_SOC_FLASH_NRF_RADIO_SYNC_TICKER
192  ${ZEPHYR_BASE}/drivers/flash
193  )
194
195zephyr_library_include_directories_ifdef(
196  CONFIG_BT_LLL_VENDOR_NORDIC
197  ll_sw/nordic
198  ll_sw/nordic/hci
199  )
200
201zephyr_library_include_directories_ifdef(
202  CONFIG_BT_LLL_VENDOR_OPENISA
203  ll_sw/openisa
204  ll_sw/openisa/hci
205  )
206
207add_subdirectory_ifdef(
208  CONFIG_BT_CTLR_COEX_DRIVERS
209  coex
210  )
211
212add_subdirectory_ifdef(
213  CONFIG_BT_LLL_VENDOR_NORDIC
214  ll_sw/nordic
215  )
216
217add_subdirectory_ifdef(
218  CONFIG_BT_LLL_VENDOR_OPENISA
219  ll_sw/openisa
220  )
221
222zephyr_library_compile_options_ifdef(
223  CONFIG_BT_CTLR_OPTIMIZE_FOR_SIZE
224  ${OPTIMIZE_FOR_SIZE_FLAG}
225  )
226
227zephyr_library_compile_options_ifdef(
228  CONFIG_BT_CTLR_OPTIMIZE_FOR_SPEED
229  ${OPTIMIZE_FOR_SPEED_FLAG}
230  )
231