From 367004fd57f05aced23005aa4d4e21272b7e5add Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 5 Oct 2022 16:40:12 +0530 Subject: [PATCH] Bluetooth: Controller: Conditional compile optional ticker interfaces Conditional compile ticker interfaces like ticker_update which are not required when individual state or role samples are build. Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/controller/Kconfig.ll_sw_split | 32 ++++++++++++++ subsys/bluetooth/controller/ticker/ticker.c | 42 ++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 273142f04a0..c2d3753c109 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -43,6 +43,11 @@ config BT_LLL_VENDOR_NORDIC select BT_CTLR_TIFS_HW_SUPPORT select BT_CTLR_ULL_LLL_PRIO_SUPPORT + select BT_TICKER_UPDATE if BT_BROADCASTER || BT_CONN || \ + (BT_OBSERVER && BT_CTLR_ADV_EXT) + select BT_TICKER_NEXT_SLOT_GET if (BT_BROADCASTER && \ + BT_CTLR_ADV_EXT) || \ + BT_CTLR_ADV_PERIODIC select BT_TICKER_REMAINDER_GET if BT_BROADCASTER && BT_CTLR_ADV_EXT select BT_TICKER_LAZY_GET if BT_CTLR_ADV_PERIODIC @@ -58,6 +63,9 @@ config BT_LLL_VENDOR_OPENISA select BT_HAS_HCI_VS select BT_CTLR_LE_ENC_SUPPORT if !BT_CTLR_DATA_LENGTH_CLEAR select BT_CTLR_PRIVACY_SUPPORT + + select BT_TICKER_UPDATE if BT_BROADCASTER || BT_CONN + default y help Use OpenISA Lower Link Layer implementation. @@ -768,8 +776,30 @@ config BT_TICKER_LOW_LAT radio RX/TX. Enabling this option disables the ticker priority- and 'must expire' features. +config BT_TICKER_UPDATE + bool "Ticker Update" + help + This option enables Ticker Update interface. + +config BT_TICKER_JOB_IDLE_GET + bool "Ticker Job Idle Get" + default y if BT_TICKER_LOW_LAT + help + This option enables the ticker interface to query the idle state of + the Ticker Job execution context. This interface is used to disable + Ticker Job execution once in idle state, no operations pending for the + Ticker Job to process. + +config BT_TICKER_NEXT_SLOT_GET + bool "Ticker Next Slot Get" + default y if BT_CENTRAL + help + This option enables ticker interface to iterate through active + ticker nodes, returning tick to expire. + config BT_TICKER_REMAINDER_GET bool "Ticker Next Slot Get with Remainder" + depends on BT_TICKER_NEXT_SLOT_GET help This option enables ticker interface to iterate through active ticker nodes, returning tick to expire and remainder from a reference @@ -777,6 +807,7 @@ config BT_TICKER_REMAINDER_GET config BT_TICKER_LAZY_GET bool "Ticker Next Slot Get with Lazy" + depends on BT_TICKER_NEXT_SLOT_GET help This option enables ticker interface to iterate through active ticker nodes, returning tick to expire and lazy count from a reference @@ -784,6 +815,7 @@ config BT_TICKER_LAZY_GET config BT_TICKER_NEXT_SLOT_GET_MATCH bool "Ticker Next Slot Get with match callback" + depends on BT_TICKER_NEXT_SLOT_GET default y if BT_TICKER_SLOT_AGNOSTIC help This option enables ticker interface to iterate through active diff --git a/subsys/bluetooth/controller/ticker/ticker.c b/subsys/bluetooth/controller/ticker/ticker.c index 2248988d52c..c30f1af9ea1 100644 --- a/subsys/bluetooth/controller/ticker/ticker.c +++ b/subsys/bluetooth/controller/ticker/ticker.c @@ -364,6 +364,7 @@ static uint8_t ticker_by_slot_get(struct ticker_node *node, uint8_t ticker_id_he } #endif /* CONFIG_BT_TICKER_LOW_LAT */ +#if defined(CONFIG_BT_TICKER_NEXT_SLOT_GET) /** * @brief Get next ticker with slot ticks or match * @@ -480,6 +481,7 @@ static void ticker_by_next_slot_get(struct ticker_instance *instance, *ticker_id_head = _ticker_id_head; *ticks_to_expire = _ticks_to_expire; } +#endif /* CONFIG_BT_TICKER_NEXT_SLOT_GET */ #if !defined(CONFIG_BT_TICKER_LOW_LAT) /** @@ -1378,7 +1380,8 @@ static inline void ticker_job_node_manage(struct ticker_instance *instance, uint8_t *insert_head) { /* Handle update of ticker by re-inserting it back. */ - if (user_op->op == TICKER_USER_OP_TYPE_UPDATE) { + if (IS_ENABLED(CONFIG_BT_TICKER_UPDATE) && + (user_op->op == TICKER_USER_OP_TYPE_UPDATE)) { /* Remove ticker node from list */ ticker->ticks_to_expire = ticker_dequeue(instance, user_op->id); @@ -2294,9 +2297,22 @@ static inline void ticker_job_list_insert(struct ticker_instance *instance, } } } + +#if !defined(CONFIG_BT_TICKER_JOB_IDLE_GET) && \ + !defined(CONFIG_BT_TICKER_NEXT_SLOT_GET) && \ + !defined(CONFIG_BT_TICKER_PRIORITY_SET) + user->first = user_ops_first; +#endif /* !CONFIG_BT_TICKER_JOB_IDLE_GET && + * !CONFIG_BT_TICKER_NEXT_SLOT_GET && + * !CONFIG_BT_TICKER_PRIORITY_SET + */ + } } +#if defined(CONFIG_BT_TICKER_JOB_IDLE_GET) || \ + defined(CONFIG_BT_TICKER_NEXT_SLOT_GET) || \ + defined(CONFIG_BT_TICKER_PRIORITY_SET) /** * @brief Perform inquiry for specific user operation * @@ -2312,6 +2328,7 @@ static inline void ticker_job_op_inquire(struct ticker_instance *instance, fp_op_func = NULL; switch (uop->op) { +#if defined(CONFIG_BT_TICKER_NEXT_SLOT_GET) case TICKER_USER_OP_TYPE_SLOT_GET: ticker_by_next_slot_get(instance, uop->params.slot_get.ticker_id, @@ -2334,11 +2351,17 @@ static inline void ticker_job_op_inquire(struct ticker_instance *instance, NULL); #endif /* !CONFIG_BT_TICKER_LAZY_GET */ __fallthrough; +#endif /* CONFIG_BT_TICKER_NEXT_SLOT_GET */ +#if defined(CONFIG_BT_TICKER_JOB_IDLE_GET) || \ + defined(CONFIG_BT_TICKER_NEXT_SLOT_GET) case TICKER_USER_OP_TYPE_IDLE_GET: uop->status = TICKER_STATUS_SUCCESS; fp_op_func = uop->fp_op_func; break; +#endif /* CONFIG_BT_TICKER_JOB_IDLE_GET || + * CONFIG_BT_TICKER_NEXT_SLOT_GET + */ #if !defined(CONFIG_BT_TICKER_LOW_LAT) && \ !defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) && \ @@ -2411,6 +2434,10 @@ static inline void ticker_job_list_inquire(struct ticker_instance *instance) } } } +#endif /* CONFIG_BT_TICKER_JOB_IDLE_GET || + * CONFIG_BT_TICKER_NEXT_SLOT_GET || + * CONFIG_BT_TICKER_PRIORITY_SET + */ /** * @brief Update counter compare value (trigger) @@ -2599,11 +2626,18 @@ void ticker_job(void *param) flag_compare_update = 1U; } +#if defined(CONFIG_BT_TICKER_JOB_IDLE_GET) || \ + defined(CONFIG_BT_TICKER_NEXT_SLOT_GET) || \ + defined(CONFIG_BT_TICKER_PRIORITY_SET) /* Process any list inquiries */ if (!pending) { /* Handle inquiries */ ticker_job_list_inquire(instance); } +#endif /* CONFIG_BT_TICKER_JOB_IDLE_GET || + * CONFIG_BT_TICKER_NEXT_SLOT_GET || + * CONFIG_BT_TICKER_PRIORITY_SET + */ /* update compare if head changed */ if (flag_compare_update) { @@ -2851,6 +2885,7 @@ uint32_t ticker_start(uint8_t instance_index, uint8_t user_id, uint8_t ticker_id return user_op->status; } +#if defined(CONFIG_BT_TICKER_UPDATE) /** * @brief Update a ticker node * @@ -2947,6 +2982,7 @@ uint32_t ticker_update_ext(uint8_t instance_index, uint8_t user_id, return user_op->status; } +#endif /* CONFIG_BT_TICKER_UPDATE */ /** * @brief Yield a ticker node with supplied absolute ticks reference @@ -3110,6 +3146,7 @@ uint32_t ticker_stop_abs(uint8_t instance_index, uint8_t user_id, return user_op->status; } +#if defined(CONFIG_BT_TICKER_NEXT_SLOT_GET) /** * @brief Get next ticker node slot * @@ -3202,7 +3239,9 @@ uint32_t ticker_next_slot_get_ext(uint8_t instance_index, uint8_t user_id, return user_op->status; } +#endif /* CONFIG_BT_TICKER_NEXT_SLOT_GET */ +#if defined(CONFIG_BT_TICKER_JOB_IDLE_GET) /** * @brief Get a callback at the end of ticker job execution * @@ -3254,6 +3293,7 @@ uint32_t ticker_job_idle_get(uint8_t instance_index, uint8_t user_id, return user_op->status; } +#endif /* CONFIG_BT_TICKER_JOB_IDLE_GET */ #if !defined(CONFIG_BT_TICKER_LOW_LAT) && \ !defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) && \