From b1dfff401061f639de662d735764ec7a42819565 Mon Sep 17 00:00:00 2001 From: wangjialiang Date: Wed, 7 Feb 2024 15:07:06 +0800 Subject: [PATCH] feat(ble_mesh): Make alarm number configurable --- components/bt/Kconfig | 6 ++++++ components/bt/common/Kconfig.in | 6 ++++++ components/bt/common/include/bt_user_config.h | 9 +++++++++ components/bt/common/osi/include/osi/alarm.h | 3 ++- 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 components/bt/common/Kconfig.in diff --git a/components/bt/Kconfig b/components/bt/Kconfig index 1423b7fd51..6e33f67991 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -105,6 +105,12 @@ menu "Bluetooth" This option is to configure the buffer size of the hci adv report cache in hci debug mode. This is a ring buffer, the new data will overwrite the oldest data if the buffer is full. + menu "Common Options" + visible if (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED) + + source "$IDF_PATH/components/bt/common/Kconfig.in" + endmenu + endmenu menuconfig BLE_MESH diff --git a/components/bt/common/Kconfig.in b/components/bt/common/Kconfig.in new file mode 100644 index 0000000000..6b19dd8ec0 --- /dev/null +++ b/components/bt/common/Kconfig.in @@ -0,0 +1,6 @@ +config BT_ALARM_MAX_NUM + int "Maximum number of Bluetooth alarms" + default 50 + help + This option decides the maximum number of alarms which + could be used by Bluetooth host. diff --git a/components/bt/common/include/bt_user_config.h b/components/bt/common/include/bt_user_config.h index 7f69b6730a..dac4a671da 100644 --- a/components/bt/common/include/bt_user_config.h +++ b/components/bt/common/include/bt_user_config.h @@ -50,6 +50,15 @@ #define UC_BTC_TASK_STACK_SIZE 4096 #endif +/********************************************************** + * Alarm reference + **********************************************************/ +#ifdef CONFIG_BT_ALARM_MAX_NUM +#define UC_ALARM_MAX_NUM CONFIG_BT_ALARM_MAX_NUM +#else +#define UC_ALARM_MAX_NUM 50 +#endif + /********************************************************** * Trace reference **********************************************************/ diff --git a/components/bt/common/osi/include/osi/alarm.h b/components/bt/common/osi/include/osi/alarm.h index fe8344cdb9..0ac1d11cca 100644 --- a/components/bt/common/osi/include/osi/alarm.h +++ b/components/bt/common/osi/include/osi/alarm.h @@ -21,6 +21,7 @@ #include #include "esp_timer.h" +#include "bt_user_config.h" typedef struct alarm_t osi_alarm_t; typedef uint64_t period_ms_t; @@ -33,7 +34,7 @@ typedef enum { OSI_ALARM_ERR_INVALID_STATE = -3, } osi_alarm_err_t; -#define ALARM_CBS_NUM 50 +#define ALARM_CBS_NUM UC_ALARM_MAX_NUM #define ALARM_ID_BASE 1000 int osi_alarm_create_mux(void);