diff --git a/subsys/bluetooth/controller/ll_sw/lll.h b/subsys/bluetooth/controller/ll_sw/lll.h index ac3165002a1..201a517b7cd 100644 --- a/subsys/bluetooth/controller/ll_sw/lll.h +++ b/subsys/bluetooth/controller/ll_sw/lll.h @@ -25,12 +25,6 @@ #define XON_BITMASK BIT(31) /* XTAL has been retained from previous prepare */ #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ -#if defined(CONFIG_BT_BROADCASTER) && defined(CONFIG_BT_CTLR_ADV_SET) -#define BT_CTLR_ADV_MAX (CONFIG_BT_CTLR_ADV_SET + 1) -#else -#define BT_CTLR_ADV_MAX 1 -#endif - enum { TICKER_ID_LLL_PREEMPT = 0, @@ -38,7 +32,8 @@ enum { TICKER_ID_ADV_STOP, TICKER_ID_ADV_BASE, #if defined(CONFIG_BT_CTLR_ADV_EXT) || defined(CONFIG_BT_HCI_MESH_EXT) - TICKER_ID_ADV_LAST = ((TICKER_ID_ADV_BASE) + (BT_CTLR_ADV_MAX) - 1), + TICKER_ID_ADV_LAST = ((TICKER_ID_ADV_BASE) + + (CONFIG_BT_CTLR_ADV_SET) - 1), #if (CONFIG_BT_CTLR_ADV_AUX_SET > 0) TICKER_ID_ADV_AUX_BASE, TICKER_ID_ADV_AUX_LAST = ((TICKER_ID_ADV_AUX_BASE) + diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index 3f68eb64495..20dd9d2e4b8 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -69,10 +69,16 @@ static void conn_release(struct ll_adv_set *adv); static inline uint8_t disable(uint8_t handle); -static struct ll_adv_set ll_adv[BT_CTLR_ADV_MAX]; +#if defined(CONFIG_BT_CTLR_ADV_SET) +#define BT_CTLR_ADV_SET CONFIG_BT_CTLR_ADV_SET +#else +#define BT_CTLR_ADV_SET 1 +#endif + +static struct ll_adv_set ll_adv[BT_CTLR_ADV_SET]; #if defined(CONFIG_BT_TICKER_EXT) -static struct ticker_ext ll_adv_ticker_ext[BT_CTLR_ADV_MAX]; +static struct ticker_ext ll_adv_ticker_ext[BT_CTLR_ADV_SET]; #endif /* CONFIG_BT_TICKER_EXT */ #if defined(CONFIG_BT_CTLR_ADV_EXT) @@ -1135,7 +1141,7 @@ int ull_adv_reset(void) #endif /* CONFIG_BT_CTLR_ADV_AUX_SET */ #endif /* CONFIG_BT_CTLR_ADV_EXT */ - for (handle = 0U; handle < BT_CTLR_ADV_MAX; handle++) { + for (handle = 0U; handle < BT_CTLR_ADV_SET; handle++) { (void)disable(handle); } @@ -1149,7 +1155,7 @@ int ull_adv_reset(void) inline struct ll_adv_set *ull_adv_set_get(uint8_t handle) { - if (handle >= BT_CTLR_ADV_MAX) { + if (handle >= BT_CTLR_ADV_SET) { return NULL; } @@ -1329,7 +1335,7 @@ static void ticker_stop_cb(uint32_t ticks_at_expire, uint32_t remainder, uint16_ #endif handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_MAX); + LL_ASSERT(handle < BT_CTLR_ADV_SET); ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_ADV_BASE + handle, diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c index 75a02f88081..f74dd46390a 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c @@ -439,8 +439,7 @@ uint16_t ll_adv_aux_max_data_length_get(void) uint8_t ll_adv_aux_set_count_get(void) { - /* TODO: return a Kconfig value */ - return 0; + return CONFIG_BT_CTLR_ADV_SET; } uint8_t ll_adv_aux_set_remove(uint8_t handle) diff --git a/subsys/bluetooth/shell/ll.c b/subsys/bluetooth/shell/ll.c index b4049350d28..97f7e471cd8 100644 --- a/subsys/bluetooth/shell/ll.c +++ b/subsys/bluetooth/shell/ll.c @@ -190,7 +190,7 @@ int cmd_advx(const struct shell *shell, size_t argc, char *argv[]) ad = 1; } else { handle = strtoul(argv[2], NULL, 16); - if (handle >= BT_CTLR_ADV_MAX) { + if (handle >= CONFIG_BT_CTLR_ADV_SET) { return -EINVAL; } } @@ -205,7 +205,7 @@ int cmd_advx(const struct shell *shell, size_t argc, char *argv[]) ad = 1; } else { handle = strtoul(argv[3], NULL, 16); - if (handle >= BT_CTLR_ADV_MAX) { + if (handle >= CONFIG_BT_CTLR_ADV_SET) { return -EINVAL; } } @@ -218,7 +218,7 @@ int cmd_advx(const struct shell *shell, size_t argc, char *argv[]) ad = 1; } else { handle = strtoul(argv[4], NULL, 16); - if (handle >= BT_CTLR_ADV_MAX) { + if (handle >= CONFIG_BT_CTLR_ADV_SET) { return -EINVAL; } } @@ -229,7 +229,7 @@ int cmd_advx(const struct shell *shell, size_t argc, char *argv[]) ad = 1; } else { handle = strtoul(argv[5], NULL, 16); - if (handle >= BT_CTLR_ADV_MAX) { + if (handle >= CONFIG_BT_CTLR_ADV_SET) { return -EINVAL; } } @@ -237,7 +237,7 @@ int cmd_advx(const struct shell *shell, size_t argc, char *argv[]) if (argc > 6) { handle = strtoul(argv[6], NULL, 16); - if (handle >= BT_CTLR_ADV_MAX) { + if (handle >= CONFIG_BT_CTLR_ADV_SET) { return -EINVAL; } }