Skip to content

Commit 63da496

Browse files
Tronilcarlescufi
authored andcommitted
Bluetooth: Controller: Implement Secondary_Advertising_Max_Skip
Behaviour is unchanged for max_skip == 0 For max_skip > 0, use a slightly different calculation to ensure we can pass LL/DDI/ADV/BV-28-C Signed-off-by: Troels Nilsson <[email protected]>
1 parent e816a13 commit 63da496

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

subsys/bluetooth/controller/ll_sw/ull_adv.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ uint8_t ll_adv_params_set(uint16_t interval, uint8_t adv_type,
339339
is_new_set = !adv->is_created;
340340
adv->is_created = 1;
341341
adv->is_ad_data_cmplt = 1U;
342+
adv->max_skip = skip;
342343
#endif /* CONFIG_BT_CTLR_ADV_EXT */
343344

344345
/* remember parameters so that set adv/scan data and adv enable
@@ -1391,6 +1392,7 @@ uint8_t ll_adv_enable(uint8_t enable)
13911392
struct lll_adv_aux *lll_aux = lll->aux;
13921393
uint32_t ticks_slot_overhead_aux;
13931394
uint32_t ticks_anchor_aux;
1395+
uint64_t interval_us;
13941396

13951397
aux = HDR_LLL2ULL(lll_aux);
13961398

@@ -1487,20 +1489,29 @@ uint8_t ll_adv_enable(uint8_t enable)
14871489
}
14881490
#endif /* CONFIG_BT_CTLR_ADV_PERIODIC */
14891491

1490-
/* Keep aux interval equal or higher than primary PDU
1491-
* interval.
1492+
/* Keep aux interval equal or lower than primary PDU
1493+
* interval * (max_skip + 1).
14921494
* Use periodic interval units to represent the
14931495
* periodic behavior of scheduling of AUX_ADV_IND PDUs
14941496
* so that it is grouped with similar interval units
14951497
* used for ACL Connections, Periodic Advertising and
14961498
* BIG radio events.
14971499
*/
1498-
aux->interval =
1499-
DIV_ROUND_UP(((uint64_t)adv->interval *
1500-
ADV_INT_UNIT_US) +
1501-
HAL_TICKER_TICKS_TO_US(
1502-
ULL_ADV_RANDOM_DELAY),
1503-
PERIODIC_INT_UNIT_US);
1500+
interval_us = (uint64_t)adv->interval * ADV_INT_UNIT_US;
1501+
1502+
if (adv->max_skip == 0U) {
1503+
/* Special case to keep behaviour unchanged from
1504+
* before max_skip was implemented; In this case
1505+
* add ULL_ADV_RANDOM_DELAY and round up for a
1506+
* aux interval equal or higher instead
1507+
*/
1508+
aux->interval = DIV_ROUND_UP(interval_us +
1509+
HAL_TICKER_TICKS_TO_US(ULL_ADV_RANDOM_DELAY),
1510+
PERIODIC_INT_UNIT_US);
1511+
} else {
1512+
aux->interval = (interval_us * (adv->max_skip + 1))
1513+
/ PERIODIC_INT_UNIT_US;
1514+
}
15041515

15051516
ret = ull_adv_aux_start(aux, ticks_anchor_aux,
15061517
ticks_slot_overhead_aux);

subsys/bluetooth/controller/ll_sw/ull_adv_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct ll_adv_set {
3636
#if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING)
3737
uint8_t hci_handle;
3838
#endif
39+
uint8_t max_skip;
3940
uint16_t event_counter;
4041
uint16_t max_events;
4142
uint32_t remain_duration_us;

0 commit comments

Comments
 (0)