mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
feat(bt): Add Kconfig option to build the BT OSAL conditionally
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
config BT_PRF_TASK_ENABLED
|
||||
bool "Enable the shared BLE profile task (event queue worker)"
|
||||
depends on BT_ENABLED
|
||||
select BT_OSAL_ENABLED
|
||||
default n
|
||||
help
|
||||
Build the shared BLE profile task: a single process-wide event queue
|
||||
|
||||
@@ -143,9 +143,14 @@ list(APPEND bt_common_srcs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/osi/osi.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/osi/semaphore.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ble_log/deprecated/ble_log_spi_out.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/osal/src/bt_osal_freertos.c"
|
||||
)
|
||||
|
||||
if(CONFIG_BT_OSAL_ENABLED)
|
||||
list(APPEND bt_common_srcs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/osal/src/bt_osal_freertos.c"
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND bt_common_include_dirs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/osi/include"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/api/include/api"
|
||||
|
||||
@@ -24,8 +24,22 @@ config BT_BLE_HOST_ALLOW_SUB_SPEC_MIN_CONN_INT
|
||||
menu "OSAL (OS abstraction layer)"
|
||||
depends on BT_ENABLED
|
||||
|
||||
config BT_OSAL_ENABLED
|
||||
bool "Enable the Bluetooth OS abstraction layer"
|
||||
default n
|
||||
help
|
||||
Build the Bluetooth OS abstraction layer (bt_osal): a host-agnostic
|
||||
wrapper over the OS primitives the Bluetooth stack and the BLE
|
||||
profiles rely on — event queues, mutexes, semaphores, callouts
|
||||
(one-shot timers), time conversion and critical sections.
|
||||
|
||||
Disable to leave the OSAL sources out of the build when nothing
|
||||
uses them. A component that relies on the OSAL should
|
||||
"select BT_OSAL_ENABLED" in its own Kconfig.
|
||||
|
||||
config BT_OSAL_USE_ESP_TIMER
|
||||
bool "Use esp_timer to implement the OSAL callout"
|
||||
depends on BT_OSAL_ENABLED
|
||||
default y
|
||||
help
|
||||
Use esp_timer instead of the FreeRTOS software timer to implement the OSAL
|
||||
|
||||
@@ -128,6 +128,7 @@ uint32_t bt_osal_freertos_hw_enter_critical(void);
|
||||
|
||||
void bt_osal_freertos_hw_exit_critical(uint32_t ctx);
|
||||
|
||||
#if CONFIG_BT_OSAL_ENABLED
|
||||
/**
|
||||
* @brief Allocate and populate the OSAL function table
|
||||
*
|
||||
@@ -140,6 +141,15 @@ void bt_osal_freertos_funcs_init(void);
|
||||
* @brief Free the OSAL function table allocated by bt_osal_freertos_funcs_init()
|
||||
*/
|
||||
void bt_osal_freertos_funcs_deinit(void);
|
||||
#else
|
||||
/* The OSAL implementation is not built. The hosts bring the function table up
|
||||
* and down unconditionally during their init/deinit, so keep those two entry
|
||||
* points available as no-ops instead of making every caller guard them. */
|
||||
|
||||
static inline void bt_osal_freertos_funcs_init(void) {}
|
||||
|
||||
static inline void bt_osal_freertos_funcs_deinit(void) {}
|
||||
#endif /* CONFIG_BT_OSAL_ENABLED */
|
||||
|
||||
/**
|
||||
* @brief Get the OSAL function table
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_OSAL_ENABLED=y
|
||||
CONFIG_BT_PRF_TASK_ENABLED=y
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
|
||||
|
||||
Reference in New Issue
Block a user