Bluetooth: Controller: Use maximum Adv PDU size time reservation
Use the maximum advertising PDU size time reservation consider the Advertising Data could be updated from zero to maximum support size. If maximum time reservation is disabled then time reservation corresponding to the Advertising Data present at the time of the start/enable of Advertising is used. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
fab4511164
commit
918585263e
4 changed files with 49 additions and 13 deletions
|
@ -232,6 +232,17 @@ config BT_CTLR_ADV_SYNC_PDU_BACK2BACK_AFS
|
||||||
Specific AUX Frame Space to be used for back-to-back transmission of
|
Specific AUX Frame Space to be used for back-to-back transmission of
|
||||||
periodic advertising trains. Time specified in microseconds.
|
periodic advertising trains. Time specified in microseconds.
|
||||||
|
|
||||||
|
config BT_CTLR_ADV_RESERVE_MAX
|
||||||
|
bool "Use maximum Advertising PDU size time reservation"
|
||||||
|
depends on BT_BROADCASTER && BT_CTLR_ADV_EXT
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Use the maximum advertising PDU size time reservation considering the
|
||||||
|
Advertising Data could be updated from zero to maximum support size.
|
||||||
|
If maximum time reservation is disabled then time reservation
|
||||||
|
corresponding to the Advertising Data present at the time of the
|
||||||
|
start/enable of Advertising is used.
|
||||||
|
|
||||||
config BT_CTLR_ADV_DATA_BUF_MAX
|
config BT_CTLR_ADV_DATA_BUF_MAX
|
||||||
int "Advertising Data Maximum Buffers"
|
int "Advertising Data Maximum Buffers"
|
||||||
depends on BT_BROADCASTER
|
depends on BT_BROADCASTER
|
||||||
|
|
|
@ -1415,9 +1415,20 @@ uint8_t ll_adv_enable(uint8_t enable)
|
||||||
* started.
|
* started.
|
||||||
*/
|
*/
|
||||||
if (sync) {
|
if (sync) {
|
||||||
const uint32_t ticks_slot_aux =
|
uint32_t ticks_slot_aux;
|
||||||
aux->ull.ticks_slot +
|
#if defined(CONFIG_BT_CTLR_ADV_RESERVE_MAX)
|
||||||
|
uint32_t us_slot;
|
||||||
|
|
||||||
|
us_slot = ull_adv_aux_time_get(aux,
|
||||||
|
PDU_AC_PAYLOAD_SIZE_MAX,
|
||||||
|
PDU_AC_PAYLOAD_SIZE_MAX);
|
||||||
|
ticks_slot_aux =
|
||||||
|
HAL_TICKER_US_TO_TICKS(us_slot) +
|
||||||
ticks_slot_overhead_aux;
|
ticks_slot_overhead_aux;
|
||||||
|
#else
|
||||||
|
ticks_slot_aux = aux->ull.ticks_slot +
|
||||||
|
ticks_slot_overhead_aux;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Schedule periodic advertising PDU after
|
/* Schedule periodic advertising PDU after
|
||||||
* auxiliary PDUs.
|
* auxiliary PDUs.
|
||||||
|
|
|
@ -1079,9 +1079,13 @@ uint32_t ull_adv_aux_evt_init(struct ll_adv_aux_set *aux,
|
||||||
uint32_t ticks_slot;
|
uint32_t ticks_slot;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_ADV_RESERVE_MAX)
|
||||||
time_us = ull_adv_aux_time_get(aux, PDU_AC_PAYLOAD_SIZE_MAX,
|
time_us = ull_adv_aux_time_get(aux, PDU_AC_PAYLOAD_SIZE_MAX,
|
||||||
PDU_AC_PAYLOAD_SIZE_MAX);
|
PDU_AC_PAYLOAD_SIZE_MAX);
|
||||||
ticks_slot = HAL_TICKER_US_TO_TICKS(time_us);
|
ticks_slot = HAL_TICKER_US_TO_TICKS(time_us);
|
||||||
|
#else
|
||||||
|
ticks_slot = aux->ull.ticks_slot;
|
||||||
|
#endif
|
||||||
|
|
||||||
err = ull_sched_adv_aux_sync_free_slot_get(TICKER_USER_ID_THREAD,
|
err = ull_sched_adv_aux_sync_free_slot_get(TICKER_USER_ID_THREAD,
|
||||||
(ticks_slot +
|
(ticks_slot +
|
||||||
|
@ -1210,6 +1214,12 @@ uint32_t ull_adv_aux_time_get(const struct ll_adv_aux_set *aux, uint8_t pdu_len,
|
||||||
lll_aux = &aux->lll;
|
lll_aux = &aux->lll;
|
||||||
lll = lll_aux->adv;
|
lll = lll_aux->adv;
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_BT_CTLR_ADV_RESERVE_MAX) &&
|
||||||
|
(lll->phy_s == PHY_CODED)) {
|
||||||
|
pdu_len = PDU_AC_EXT_PAYLOAD_OVERHEAD;
|
||||||
|
pdu_scan_len = PDU_AC_EXT_PAYLOAD_OVERHEAD;
|
||||||
|
}
|
||||||
|
|
||||||
/* NOTE: 16-bit values are sufficient for minimum radio event time
|
/* NOTE: 16-bit values are sufficient for minimum radio event time
|
||||||
* reservation, 32-bit are used here so that reservations for
|
* reservation, 32-bit are used here so that reservations for
|
||||||
* whole back-to-back chaining of PDUs can be accomodated where
|
* whole back-to-back chaining of PDUs can be accomodated where
|
||||||
|
|
|
@ -833,13 +833,15 @@ static struct ull_hdr *ull_hdr_get_cb(uint8_t ticker_id, uint32_t *ticks_slot)
|
||||||
|
|
||||||
aux = ull_adv_aux_get(ticker_id - TICKER_ID_ADV_AUX_BASE);
|
aux = ull_adv_aux_get(ticker_id - TICKER_ID_ADV_AUX_BASE);
|
||||||
if (aux) {
|
if (aux) {
|
||||||
|
if (IS_ENABLED(CONFIG_BT_CTLR_ADV_RESERVE_MAX)) {
|
||||||
uint32_t time_us;
|
uint32_t time_us;
|
||||||
|
|
||||||
time_us = ull_adv_aux_time_get(aux,
|
time_us = ull_adv_aux_time_get(aux, PDU_AC_PAYLOAD_SIZE_MAX,
|
||||||
PDU_AC_PAYLOAD_SIZE_MAX,
|
|
||||||
PDU_AC_PAYLOAD_SIZE_MAX);
|
PDU_AC_PAYLOAD_SIZE_MAX);
|
||||||
|
|
||||||
*ticks_slot = HAL_TICKER_US_TO_TICKS(time_us);
|
*ticks_slot = HAL_TICKER_US_TO_TICKS(time_us);
|
||||||
|
} else {
|
||||||
|
*ticks_slot = aux->ull.ticks_slot;
|
||||||
|
}
|
||||||
|
|
||||||
return &aux->ull;
|
return &aux->ull;
|
||||||
}
|
}
|
||||||
|
@ -851,12 +853,14 @@ static struct ull_hdr *ull_hdr_get_cb(uint8_t ticker_id, uint32_t *ticks_slot)
|
||||||
|
|
||||||
sync = ull_adv_sync_get(ticker_id - TICKER_ID_ADV_SYNC_BASE);
|
sync = ull_adv_sync_get(ticker_id - TICKER_ID_ADV_SYNC_BASE);
|
||||||
if (sync) {
|
if (sync) {
|
||||||
|
if (IS_ENABLED(CONFIG_BT_CTLR_ADV_RESERVE_MAX)) {
|
||||||
uint32_t time_us;
|
uint32_t time_us;
|
||||||
|
|
||||||
time_us = ull_adv_sync_time_get(sync,
|
time_us = ull_adv_sync_time_get(sync, PDU_AC_PAYLOAD_SIZE_MAX);
|
||||||
PDU_AC_PAYLOAD_SIZE_MAX);
|
|
||||||
|
|
||||||
*ticks_slot = HAL_TICKER_US_TO_TICKS(time_us);
|
*ticks_slot = HAL_TICKER_US_TO_TICKS(time_us);
|
||||||
|
} else {
|
||||||
|
*ticks_slot = sync->ull.ticks_slot;
|
||||||
|
}
|
||||||
|
|
||||||
return &sync->ull;
|
return &sync->ull;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue