Skip to content

Commit ee21280

Browse files
author
ganghe
committed
module: hal_sifli: Add CMakefile script for bluetooth HCI driver.
Add CMakefile script and header files needed for Bluetooth HCI driver. Signed-off-by: ganghe <[email protected]>
1 parent 110017a commit ee21280

File tree

2 files changed

+82
-2
lines changed

2 files changed

+82
-2
lines changed

modules/hal_sifli/CMakeLists.txt

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ if(CONFIG_HAS_SIFLI_HAL)
55
# Allow using CMSIS headers from HAL without compiling HAL library.
66
# This gives us access to register definitions and CMSIS HAL glue code.
77
zephyr_compile_definitions(SOC_BF0_HCPU)
8+
89
if(CONFIG_SOC_SERIES_SF32LB52X)
910
zephyr_compile_definitions(SF32LB52X)
1011
endif()
@@ -22,7 +23,11 @@ if(CONFIG_HAS_SIFLI_HAL)
2223
HAL_TICK_PER_SECOND=${CONFIG_SYS_CLOCK_TICKS_PER_SEC}
2324
)
2425

25-
zephyr_library_include_directories(${CMAKE_CURRENT_LIST_DIR})
26+
if (CONFIG_USE_SIFLI_IPC_QUEUE)
27+
zephyr_compile_definitions(USING_IPC_QUEUE)
28+
endif()
29+
30+
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR})
2631
zephyr_include_directories(${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/include)
2732

2833
zephyr_library_sources(
@@ -43,7 +48,9 @@ if(CONFIG_HAS_SIFLI_HAL)
4348
CONFIG_USE_SIFLI_HAL_ADC ${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_adc.c
4449
)
4550
zephyr_library_sources_ifdef(
46-
CONFIG_USE_SIFLI_HAL_AON ${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_hpaon.c
51+
CONFIG_USE_SIFLI_HAL_AON
52+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_hpaon.c
53+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_lpaon.c
4754
)
4855
zephyr_library_sources_ifdef(
4956
CONFIG_USE_SIFLI_HAL_ATIM ${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_tim_ex.c
@@ -90,6 +97,9 @@ if(CONFIG_HAS_SIFLI_HAL)
9097
zephyr_library_sources_ifdef(
9198
CONFIG_USE_SIFLI_HAL_LCD ${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_lcdc.c
9299
)
100+
zephyr_library_sources_ifdef(
101+
CONFIG_USE_SIFLI_HAL_LCPU_CONFIGURE ${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_lcpu_config.c
102+
)
93103
zephyr_library_sources_ifdef(
94104
CONFIG_USE_SIFLI_HAL_LCPU_PATCH ${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_patch.c
95105
)
@@ -148,6 +158,35 @@ if(CONFIG_HAS_SIFLI_HAL)
148158
zephyr_library_sources_ifdef(
149159
CONFIG_USE_SIFLI_HAL_WDT ${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_wdt.c
150160
)
161+
if(CONFIG_USE_SIFLI_IPC_QUEUE)
162+
zephyr_library_sources(
163+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/ipc_queue/common/circular_buf.c
164+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/ipc_queue/common/ipc_hw.c
165+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/ipc_queue/common/ipc_queue.c
166+
)
167+
zephyr_include_directories(
168+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/ipc_queue/common
169+
)
170+
endif()
171+
if(CONFIG_SOC_SERIES_SF32LB52X)
172+
zephyr_library_sources_ifdef(
173+
CONFIG_BT_SF32LB
174+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/cmsis/sf32lb52x/bf0_lcpu_init.c
175+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/cmsis/sf32lb52x/lcpu_config_type.c
176+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/cmsis/sf32lb52x/lcpu_patch.c
177+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/cmsis/sf32lb52x/lcpu_patch_rev_b.c
178+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/cmsis/sf32lb52x/bt_rf_fulcal.c
179+
)
180+
if(CONFIG_USE_SIFLI_IPC_QUEUE)
181+
zephyr_library_sources(
182+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/ipc_queue/sf32lb52x/ipc_hw_port.c
183+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/ipc_queue/sf32lb52x/lcpu.c
184+
)
185+
zephyr_include_directories(
186+
${ZEPHYR_HAL_SIFLI_MODULE_DIR}/ipc_queue/sf32lb52x
187+
)
188+
endif()
189+
endif()
151190

152191
if(CONFIG_USE_SIFLI_HAL_AES OR CONFIG_USE_SIFLI_HAL_HASH)
153192
zephyr_library_sources(${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_aes.c)
@@ -156,5 +195,6 @@ if(CONFIG_HAS_SIFLI_HAL)
156195
if(CONFIG_USE_SIFLI_HAL_SD OR CONFIG_USE_SIFLI_HAL_SDHCI)
157196
zephyr_library_sources(${ZEPHYR_HAL_SIFLI_MODULE_DIR}/hal/src/bf0_hal_sd_ex.c)
158197
endif()
198+
159199
endif()
160200
endif()

modules/hal_sifli/sf_type.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2019-2022 SiFli Technologies(Nanjing) Co., Ltd
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef SF_TYPE_H
8+
#define SF_TYPE_H
9+
10+
#include <stdbool.h>
11+
#include <stdint.h>
12+
#include <zephyr/irq.h>
13+
#include <zephyr/sys/__assert.h>
14+
#include <zephyr/drivers/timer/system_timer.h>
15+
16+
#define HAL_GetTick sys_clock_elapsed
17+
18+
#include <bf0_hal.h>
19+
20+
#undef HAL_ASSERT
21+
#define HAL_ASSERT(expr) __ASSERT_NO_MSG(expr)
22+
#define SF_ASSERT(expr) __ASSERT_NO_MSG(expr)
23+
24+
#define SF_EOK 0 /**< There is no error */
25+
#define SF_ERR 1 /**< A generic error happens */
26+
#define SF_ETIMEOUT 2 /**< Timed out */
27+
#define SF_EFULL 3 /**< The resource is full */
28+
#define SF_EEMPTY 4 /**< The resource is empty */
29+
#define SF_ENOMEM 5 /**< No memory */
30+
#define SF_ENOSYS 6 /**< No system */
31+
#define SF_EBUSY 7 /**< Busy */
32+
#define SF_EIO 8 /**< IO error */
33+
#define SF_EINTR 9 /**< Interrupted system call */
34+
#define SF_EINVAL 10 /**< Invalid argument */
35+
36+
typedef int sf_err_t;
37+
38+
39+
#endif
40+

0 commit comments

Comments
 (0)