1#
2# Copyright (c) 2021, Telink
3#
4# SPDX-License-Identifier: Apache-2.0
5#
6
7zephyr_library()
8
9zephyr_include_directories(common)
10zephyr_include_directories(drivers/B91/compatibility_pack)
11zephyr_include_directories(drivers/B91/reg_include)
12zephyr_include_directories(drivers/B91)
13
14# soc.c referance sources
15if (NOT CONFIG_PM AND NOT CONFIG_BT_B91)
16zephyr_library_sources(drivers/B91/sys.c)
17endif() # no PM and no BLE external dependency
18zephyr_library_sources(drivers/B91/pm.c)
19zephyr_library_sources(drivers/B91/clock.c)
20zephyr_library_sources(drivers/B91/analog.c)
21
22# Flash driver reference sources
23zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_TELINK_B91 drivers/B91/flash.c)
24zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_TELINK_B91 drivers/B91/plic.c)
25zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_TELINK_B91 drivers/B91/stimer.c)
26
27# PWM driver reference sources
28zephyr_library_sources_ifdef(CONFIG_PWM_TELINK_B91 drivers/B91/pwm.c)
29
30# SPI driver reference sources
31zephyr_library_sources_ifdef(CONFIG_SPI_TELINK_B91 drivers/B91/gpio.c)
32
33# I2C driver reference sources
34zephyr_library_sources_ifdef(CONFIG_I2C_TELINK_B91 drivers/B91/i2c.c)
35
36# RF driver reference sources
37zephyr_library_sources_ifdef(CONFIG_IEEE802154_TELINK_B91 drivers/B91/stimer.c)
38zephyr_library_sources_ifdef(CONFIG_IEEE802154_TELINK_B91 drivers/B91/rf.c)
39
40# Entropy driver reference sources
41zephyr_library_sources_ifdef(CONFIG_ENTROPY_TELINK_B91_TRNG drivers/B91/trng.c)
42
43# ADC driver reference sources
44zephyr_library_sources_ifdef(CONFIG_ADC_TELINK_B91 drivers/B91/adc.c)
45zephyr_library_sources_ifdef(CONFIG_ADC_TELINK_B91 drivers/B91/gpio.c)
46
47#PM driver dependency
48zephyr_library_sources_ifdef(CONFIG_PM drivers/B91/stimer.c)
49
50# BLE reference sources
51if (CONFIG_BT_B91)
52
53zephyr_include_directories(
54	ble
55	ble/vendor/controller
56)
57
58zephyr_library_sources(
59	drivers/B91/pke.c
60	drivers/B91/aes.c
61	drivers/B91/flash.c
62	drivers/B91/plic.c
63	drivers/B91/stimer.c
64	drivers/B91/ext_driver/software_pa.c
65	ble/common/utility.c
66	ble/vendor/controller/b91_bt.c
67	ble/vendor/controller/b91_bt_init.c
68	ble/vendor/controller/b91_bt_buffer.c
69)
70
71endif() # CONFIG_BT_B91
72
73# PM and BLE external dependency
74if(CONFIG_PM OR CONFIG_BT_B91)
75
76if(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "zephyr")
77	zephyr_link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/ble/proj_lib/lib/liblt_9518_zephyr.a)
78else()
79	zephyr_link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/ble/proj_lib/lib/liblt_9518.a)
80endif()
81
82if(CONFIG_PM)
83zephyr_ld_options(-mtune=rocket)
84endif() # PM
85
86endif() # PM or BLE external dependency
87