bluetooth: controller: Use ticker must_expire to ensure ADV timing rand
Enabled use of ticker must_expire feature for ensuring ADV timing randomization, even when ADV doesn't get air-time. This reduces ADV collisions. Not active for nRF51 platform for now. Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit is contained in:
parent
5ce4df2a67
commit
cd07fe94d6
1 changed files with 25 additions and 15 deletions
|
@ -850,7 +850,14 @@ u8_t ll_adv_enable(u8_t enable)
|
||||||
ticks_anchor, 0,
|
ticks_anchor, 0,
|
||||||
HAL_TICKER_US_TO_TICKS((u64_t)interval *
|
HAL_TICKER_US_TO_TICKS((u64_t)interval *
|
||||||
625),
|
625),
|
||||||
TICKER_NULL_REMAINDER, TICKER_NULL_LAZY,
|
TICKER_NULL_REMAINDER,
|
||||||
|
#if !defined(CONFIG_BT_TICKER_COMPATIBILITY_MODE) && \
|
||||||
|
!defined(CONFIG_BT_CTLR_LOW_LAT)
|
||||||
|
/* Force expiry to ensure timing update */
|
||||||
|
TICKER_LAZY_MUST_EXPIRE,
|
||||||
|
#else
|
||||||
|
TICKER_NULL_LAZY,
|
||||||
|
#endif
|
||||||
(adv->evt.ticks_slot + ticks_slot_overhead),
|
(adv->evt.ticks_slot + ticks_slot_overhead),
|
||||||
ticker_cb, adv,
|
ticker_cb, adv,
|
||||||
ull_ticker_status_give, (void *)&ret_cb);
|
ull_ticker_status_give, (void *)&ret_cb);
|
||||||
|
@ -1004,12 +1011,14 @@ static void ticker_cb(u32_t ticks_at_expire, u32_t remainder, u16_t lazy,
|
||||||
|
|
||||||
DEBUG_RADIO_PREPARE_A(1);
|
DEBUG_RADIO_PREPARE_A(1);
|
||||||
|
|
||||||
|
lll = &adv->lll;
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_BT_TICKER_COMPATIBILITY_MODE) ||
|
||||||
|
(lazy != TICKER_LAZY_MUST_EXPIRE)) {
|
||||||
/* Increment prepare reference count */
|
/* Increment prepare reference count */
|
||||||
ref = ull_ref_inc(&adv->ull);
|
ref = ull_ref_inc(&adv->ull);
|
||||||
LL_ASSERT(ref);
|
LL_ASSERT(ref);
|
||||||
|
|
||||||
lll = &adv->lll;
|
|
||||||
|
|
||||||
/* Append timing parameters */
|
/* Append timing parameters */
|
||||||
p.ticks_at_expire = ticks_at_expire;
|
p.ticks_at_expire = ticks_at_expire;
|
||||||
p.remainder = remainder;
|
p.remainder = remainder;
|
||||||
|
@ -1018,9 +1027,10 @@ static void ticker_cb(u32_t ticks_at_expire, u32_t remainder, u16_t lazy,
|
||||||
mfy.param = &p;
|
mfy.param = &p;
|
||||||
|
|
||||||
/* Kick LLL prepare */
|
/* Kick LLL prepare */
|
||||||
ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL,
|
ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH,
|
||||||
0, &mfy);
|
TICKER_USER_ID_LLL, 0, &mfy);
|
||||||
LL_ASSERT(!ret);
|
LL_ASSERT(!ret);
|
||||||
|
}
|
||||||
|
|
||||||
/* Apply adv random delay */
|
/* Apply adv random delay */
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue