Bluetooth: Controller: Add EVENT_OVERHEAD_START_US when enabling states

Add EVENT_OVERHEAD_START_US to ticks_anchor when enabling
advertising, so the first advertising event is not late due
to calculations for aux packets etc.

Signed-off-by: Troels Nilsson <trnn@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Troels Nilsson 2022-09-09 11:11:46 +02:00 committed by Carles Cufí
parent 236d0351e7
commit 2a9cd8ffb1
5 changed files with 26 additions and 4 deletions

View File

@ -1315,6 +1315,14 @@ uint8_t ll_adv_enable(uint8_t enable)
#if !defined(CONFIG_BT_HCI_MESH_EXT)
ticks_anchor = ticker_ticks_now_get();
#if !defined(CONFIG_BT_TICKER_LOW_LAT)
/* NOTE: mesh bsim loopback_group_low_lat test needs both adv and scan
* to not have that start overhead added to pass the test.
*/
ticks_anchor += HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
#endif /* !CONFIG_BT_TICKER_LOW_LAT */
#else /* CONFIG_BT_HCI_MESH_EXT */
if (!at_anchor) {
ticks_anchor = ticker_ticks_now_get();

View File

@ -602,7 +602,9 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref,
* Advertising sets are non-overlapping
* for the same event interval.
*/
ticks_anchor = ticker_ticks_now_get();
ticks_anchor =
ticker_ticks_now_get() +
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
ticks_slot_overhead =
ull_adv_aux_evt_init(aux, &ticks_anchor);

View File

@ -863,7 +863,8 @@ static uint32_t adv_iso_start(struct ll_adv_iso_set *adv_iso,
EVENT_OVERHEAD_START_US) +
(EVENT_TICKER_RES_MARGIN_US << 1));
} else {
ticks_anchor = ticker_ticks_now_get();
ticks_anchor = ticker_ticks_now_get() +
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
}
/* setup to use ISO create prepare function for first radio event */

View File

@ -873,14 +873,18 @@ uint8_t ll_adv_sync_enable(uint8_t handle, uint8_t enable)
* when auxiliary and Periodic Advertising have
* similar event interval.
*/
ticks_anchor_sync = ticker_ticks_now_get();
ticks_anchor_sync =
ticker_ticks_now_get() +
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
} else {
/* Auxiliary set will be started due to inclusion of
* sync info field.
*/
lll_aux = adv->lll.aux;
aux = HDR_LLL2ULL(lll_aux);
ticks_anchor_aux = ticker_ticks_now_get();
ticks_anchor_aux =
ticker_ticks_now_get() +
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
ticks_slot_overhead_aux =
ull_adv_aux_evt_init(aux, &ticks_anchor_aux);
ticks_anchor_sync = ticks_anchor_aux +

View File

@ -555,6 +555,13 @@ uint8_t ull_scan_enable(struct ll_scan_set *scan)
ticks_anchor = ticker_ticks_now_get();
#if !defined(CONFIG_BT_TICKER_LOW_LAT)
/* NOTE: mesh bsim loopback_group_low_lat test needs both adv and scan
* to not have that start overhead added to pass the test.
*/
ticks_anchor += HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
#endif /* !CONFIG_BT_TICKER_LOW_LAT */
#if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_SCHED_ADVANCED)
if (!lll->conn) {
uint32_t ticks_ref = 0U;