Bluetooth: controller: Fix ISO broadcaster pre-transmission groups > 1
For pre-transmission groups > 1, the broadcaster link layer would fetch incorrect payloads from the TX node queue. Update payload index calculation to reference correct TX payload. Fix PTO FIXMEs and range checks. Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit is contained in:
parent
35aea49096
commit
d58724d7d7
2 changed files with 22 additions and 10 deletions
|
@ -627,9 +627,24 @@ static void isr_tx_common(void *param,
|
||||||
if (!pdu) {
|
if (!pdu) {
|
||||||
uint8_t payload_index;
|
uint8_t payload_index;
|
||||||
|
|
||||||
payload_index = (lll->bn_curr - 1U) +
|
if (lll->ptc_curr) {
|
||||||
(lll->ptc_curr * lll->pto);
|
uint8_t ptx_idx = lll->ptc_curr - 1;
|
||||||
payload_count = lll->payload_count + payload_index - lll->bn;
|
uint8_t ptx_payload_idx;
|
||||||
|
uint32_t ptx_group_mult;
|
||||||
|
uint8_t ptx_group_idx;
|
||||||
|
|
||||||
|
/* Calculate group index and multiplier for deriving
|
||||||
|
* pre-transmission payload index.
|
||||||
|
*/
|
||||||
|
ptx_group_idx = ptx_idx / lll->bn;
|
||||||
|
ptx_payload_idx = ptx_idx - ptx_group_idx * lll->bn;
|
||||||
|
ptx_group_mult = (ptx_group_idx + 1) * lll->pto;
|
||||||
|
payload_index = ptx_payload_idx + ptx_group_mult * lll->bn;
|
||||||
|
} else {
|
||||||
|
payload_index = lll->bn_curr - 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
payload_count = lll->payload_count - lll->bn + payload_index;
|
||||||
|
|
||||||
#if !TEST_WITH_DUMMY_PDU
|
#if !TEST_WITH_DUMMY_PDU
|
||||||
struct lll_adv_iso_stream *stream;
|
struct lll_adv_iso_stream *stream;
|
||||||
|
|
|
@ -201,12 +201,11 @@ static uint8_t big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bi
|
||||||
return BT_HCI_ERR_INVALID_PARAM;
|
return BT_HCI_ERR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: PTO is currently limited to BN */
|
if (!IN_RANGE(pto, 0x00, 0x0F)) {
|
||||||
if (!IN_RANGE(pto, 0x00, bn /*0x0F*/)) {
|
|
||||||
return BT_HCI_ERR_INVALID_PARAM;
|
return BT_HCI_ERR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bn * irc + pto < nse) {
|
if (pto && !(bn * irc < nse)) {
|
||||||
return BT_HCI_ERR_INVALID_PARAM;
|
return BT_HCI_ERR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1162,10 +1161,8 @@ static uint8_t ptc_calc(const struct lll_adv_iso *lll, uint32_t event_spacing,
|
||||||
(lll->sub_interval * lll->bn * lll->num_bis)) *
|
(lll->sub_interval * lll->bn * lll->num_bis)) *
|
||||||
lll->bn;
|
lll->bn;
|
||||||
|
|
||||||
/* FIXME: Here we restrict to a maximum of BN Pre-Transmission
|
/* Restrict PTC to number of available subevents */
|
||||||
* subevents per BIS
|
ptc = MIN(ptc, lll->nse - lll->bn * lll->irc);
|
||||||
*/
|
|
||||||
ptc = MIN(ptc, lll->bn);
|
|
||||||
|
|
||||||
return ptc;
|
return ptc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue