Skip to content

Commit be7173a

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: Controller: Ticker next slot get to return remainder value
Updated ticker implementation to return remainder value for a ticker when enumerating active tickers with time reservations. This is required to find offsets and to use the remainder value to correctly calculate auxiliary offsets to the microsecond resolution. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent c14bde4 commit be7173a

File tree

6 files changed

+44
-11
lines changed

6 files changed

+44
-11
lines changed

subsys/bluetooth/controller/Kconfig.ll_sw_split

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ config BT_CTLR_ADV_PDU_LINK
198198

199199
config BT_CTLR_ADV_PDU_BACK2BACK
200200
bool "Back-to-back transmission of extended advertising trains"
201-
depends on BT_CTLR_ADV_EXT && BT_BROADCASTER
201+
depends on BT_BROADCASTER && BT_CTLR_ADV_EXT
202202
select BT_CTLR_ADV_PDU_LINK
203203
help
204204
Enables transmission of AUX_CHAIN_IND in extended advertising train by
@@ -707,6 +707,14 @@ config BT_TICKER_LOW_LAT
707707
radio RX/TX. Enabling this option disables the ticker priority- and
708708
'must expire' features.
709709

710+
config BT_TICKER_REMAINDER_GET
711+
bool "Ticker Next Slot Get with Remainder"
712+
default y if BT_BROADCASTER && BT_CTLR_ADV_EXT
713+
help
714+
This option enables ticker interface to iterate through active
715+
ticker nodes, returning tick to expire and remainder from a reference
716+
tick.
717+
710718
config BT_TICKER_LAZY_GET
711719
bool "Ticker Next Slot Get with Lazy"
712720
default y if BT_CTLR_ADV_PERIODIC

subsys/bluetooth/controller/ll_sw/ull_adv_iso.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ static void mfy_iso_offset_get(void *param)
960960
ret = ticker_next_slot_get_ext(TICKER_INSTANCE_ID_CTLR,
961961
TICKER_USER_ID_ULL_LOW,
962962
&id, &ticks_current,
963-
&ticks_to_expire, &lazy,
963+
&ticks_to_expire, NULL, &lazy,
964964
NULL, NULL,
965965
ticker_op_cb, (void *)&ret_cb);
966966
if (ret == TICKER_STATUS_BUSY) {

subsys/bluetooth/controller/ll_sw/ull_adv_sync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ static void mfy_sync_offset_get(void *param)
18091809
ret = ticker_next_slot_get_ext(TICKER_INSTANCE_ID_CTLR,
18101810
TICKER_USER_ID_ULL_LOW,
18111811
&id, &ticks_current,
1812-
&ticks_to_expire, &lazy,
1812+
&ticks_to_expire, NULL, &lazy,
18131813
NULL, NULL,
18141814
ticker_op_cb, (void *)&ret_cb);
18151815
if (ret == TICKER_STATUS_BUSY) {

subsys/bluetooth/controller/ll_sw/ull_sched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
686686
#if defined(CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH)
687687
ret = ticker_next_slot_get_ext(TICKER_INSTANCE_ID_CTLR, user_id,
688688
&ticker_id, ticks_anchor,
689-
&ticks_to_expire,
689+
&ticks_to_expire, NULL,
690690
NULL, /* lazy */
691691
ticker_match_op_cb,
692692
NULL, /* match_op_context */

subsys/bluetooth/controller/ticker/ticker.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ struct ticker_user_op_slot_get {
181181
uint8_t *ticker_id;
182182
uint32_t *ticks_current;
183183
uint32_t *ticks_to_expire;
184+
#if defined(CONFIG_BT_TICKER_REMAINDER_GET)
185+
uint32_t *remainder;
186+
#endif /* CONFIG_BT_TICKER_REMAINDER_GET */
184187
#if defined(CONFIG_BT_TICKER_LAZY_GET)
185188
uint16_t *lazy;
186189
#endif /* CONFIG_BT_TICKER_LAZY_GET */
@@ -385,10 +388,11 @@ static uint8_t ticker_by_slot_get(struct ticker_node *node, uint8_t ticker_id_he
385388
* @internal
386389
*/
387390
static void ticker_by_next_slot_get(struct ticker_instance *instance,
388-
uint8_t *ticker_id_head, uint32_t *ticks_current,
391+
uint8_t *ticker_id_head,
392+
uint32_t *ticks_current,
389393
uint32_t *ticks_to_expire,
390394
ticker_op_match_func fp_match_op_func,
391-
void *match_op_context,
395+
void *match_op_context, uint32_t *remainder,
392396
uint16_t *lazy)
393397
{
394398
struct ticker_node *ticker;
@@ -453,6 +457,13 @@ static void ticker_by_next_slot_get(struct ticker_instance *instance,
453457
if (_ticker_id_head != TICKER_NULL) {
454458
/* Add ticks for found ticker */
455459
_ticks_to_expire += ticker->ticks_to_expire;
460+
461+
#if defined(CONFIG_BT_TICKER_REMAINDER_GET)
462+
if (remainder) {
463+
*remainder = ticker->remainder_current;
464+
}
465+
#endif /* CONFIG_BT_TICKER_REMAINDER_GET */
466+
456467
#if defined(CONFIG_BT_TICKER_LAZY_GET)
457468
if (lazy) {
458469
*lazy = ticker->lazy_current;
@@ -2262,6 +2273,11 @@ static inline void ticker_job_op_inquire(struct ticker_instance *instance,
22622273
#else
22632274
NULL, NULL,
22642275
#endif
2276+
#if defined(CONFIG_BT_TICKER_REMAINDER_GET)
2277+
uop->params.slot_get.remainder,
2278+
#else /* !CONFIG_BT_TICKER_REMAINDER_GET */
2279+
NULL,
2280+
#endif /* !CONFIG_BT_TICKER_REMAINDER_GET */
22652281
#if defined(CONFIG_BT_TICKER_LAZY_GET)
22662282
uop->params.slot_get.lazy);
22672283
#else /* !CONFIG_BT_TICKER_LAZY_GET */
@@ -3057,21 +3073,26 @@ uint32_t ticker_next_slot_get(uint8_t instance_index, uint8_t user_id,
30573073
ticker_op_func fp_op_func, void *op_context)
30583074
{
30593075
#if defined(CONFIG_BT_TICKER_LAZY_GET) || \
3076+
defined(CONFIG_BT_TICKER_REMAINDER_GET) || \
30603077
defined(CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH)
30613078
return ticker_next_slot_get_ext(instance_index, user_id, ticker_id,
30623079
ticks_current, ticks_to_expire, NULL,
3063-
NULL, NULL,
3064-
fp_op_func, op_context);
3080+
NULL, NULL, NULL, fp_op_func,
3081+
op_context);
30653082
}
30663083

30673084
uint32_t ticker_next_slot_get_ext(uint8_t instance_index, uint8_t user_id,
30683085
uint8_t *ticker_id, uint32_t *ticks_current,
3069-
uint32_t *ticks_to_expire, uint16_t *lazy,
3086+
uint32_t *ticks_to_expire,
3087+
uint32_t *remainder, uint16_t *lazy,
30703088
ticker_op_match_func fp_match_op_func,
30713089
void *match_op_context,
30723090
ticker_op_func fp_op_func, void *op_context)
30733091
{
3074-
#endif /* CONFIG_BT_TICKER_LAZY_GET || CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH */
3092+
#endif /* CONFIG_BT_TICKER_LAZY_GET ||
3093+
* CONFIG_BT_TICKER_REMAINDER_GET ||
3094+
* CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH
3095+
*/
30753096
struct ticker_instance *instance = &_instance[instance_index];
30763097
struct ticker_user_op *user_op;
30773098
struct ticker_user *user;
@@ -3094,6 +3115,9 @@ uint32_t ticker_next_slot_get_ext(uint8_t instance_index, uint8_t user_id,
30943115
user_op->params.slot_get.ticker_id = ticker_id;
30953116
user_op->params.slot_get.ticks_current = ticks_current;
30963117
user_op->params.slot_get.ticks_to_expire = ticks_to_expire;
3118+
#if defined(CONFIG_BT_TICKER_REMAINDER_GET)
3119+
user_op->params.slot_get.remainder = remainder;
3120+
#endif /* CONFIG_BT_TICKER_REMAINDER_GET */
30973121
#if defined(CONFIG_BT_TICKER_LAZY_GET)
30983122
user_op->params.slot_get.lazy = lazy;
30993123
#endif /* CONFIG_BT_TICKER_LAZY_GET */

subsys/bluetooth/controller/ticker/ticker.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ uint32_t ticker_next_slot_get(uint8_t instance_index, uint8_t user_id,
157157
ticker_op_func fp_op_func, void *op_context);
158158
uint32_t ticker_next_slot_get_ext(uint8_t instance_index, uint8_t user_id,
159159
uint8_t *ticker_id, uint32_t *ticks_current,
160-
uint32_t *ticks_to_expire, uint16_t *lazy,
160+
uint32_t *ticks_to_expire,
161+
uint32_t *remainder, uint16_t *lazy,
161162
ticker_op_match_func fp_op_match_func,
162163
void *match_op_context,
163164
ticker_op_func fp_op_func, void *op_context);

0 commit comments

Comments
 (0)