Bluetooth: Controller: Fix ISO Sync Receiver skipped ISO SDU
Fix ISO Sync Receiver implementation to correctly reflect the payload number and timestamp for the skipped SDU. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
d6b1de1cc8
commit
a7a199d6de
1 changed files with 15 additions and 8 deletions
|
@ -56,7 +56,8 @@ static void next_chan_calc(struct lll_sync_iso *lll, uint16_t event_counter,
|
||||||
static void isr_rx_iso_data_valid(const struct lll_sync_iso *const lll,
|
static void isr_rx_iso_data_valid(const struct lll_sync_iso *const lll,
|
||||||
uint16_t handle, struct node_rx_pdu *node_rx);
|
uint16_t handle, struct node_rx_pdu *node_rx);
|
||||||
static void isr_rx_iso_data_invalid(const struct lll_sync_iso *const lll,
|
static void isr_rx_iso_data_invalid(const struct lll_sync_iso *const lll,
|
||||||
uint8_t bn, uint16_t handle,
|
uint16_t latency, uint8_t bn,
|
||||||
|
uint16_t handle,
|
||||||
struct node_rx_pdu *node_rx);
|
struct node_rx_pdu *node_rx);
|
||||||
static void isr_rx_ctrl_recv(struct lll_sync_iso *lll, struct pdu_bis *pdu);
|
static void isr_rx_ctrl_recv(struct lll_sync_iso *lll, struct pdu_bis *pdu);
|
||||||
|
|
||||||
|
@ -1160,7 +1161,6 @@ static void isr_rx_done(void *param)
|
||||||
uint16_t latency_event;
|
uint16_t latency_event;
|
||||||
uint16_t payload_index;
|
uint16_t payload_index;
|
||||||
uint8_t bis_idx;
|
uint8_t bis_idx;
|
||||||
uint8_t bn;
|
|
||||||
|
|
||||||
/* Enqueue PDUs to ULL */
|
/* Enqueue PDUs to ULL */
|
||||||
node_rx = NULL;
|
node_rx = NULL;
|
||||||
|
@ -1191,8 +1191,7 @@ static void isr_rx_done(void *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
payload_tail = lll->payload_tail;
|
payload_tail = lll->payload_tail;
|
||||||
bn = lll->bn;
|
for (uint8_t bn = 0U; bn < lll->bn; bn++) {
|
||||||
while (bn--) {
|
|
||||||
if (lll->payload[stream_curr][payload_tail]) {
|
if (lll->payload[stream_curr][payload_tail]) {
|
||||||
node_rx = lll->payload[stream_curr][payload_tail];
|
node_rx = lll->payload[stream_curr][payload_tail];
|
||||||
lll->payload[stream_curr][payload_tail] = NULL;
|
lll->payload[stream_curr][payload_tail] = NULL;
|
||||||
|
@ -1217,7 +1216,8 @@ static void isr_rx_done(void *param)
|
||||||
pdu->len = 0U;
|
pdu->len = 0U;
|
||||||
|
|
||||||
handle = LL_BIS_SYNC_HANDLE_FROM_IDX(stream_handle);
|
handle = LL_BIS_SYNC_HANDLE_FROM_IDX(stream_handle);
|
||||||
isr_rx_iso_data_invalid(lll, bn, handle, node_rx);
|
isr_rx_iso_data_invalid(lll, latency_event, bn,
|
||||||
|
handle, node_rx);
|
||||||
|
|
||||||
iso_rx_put(node_rx->hdr.link, node_rx);
|
iso_rx_put(node_rx->hdr.link, node_rx);
|
||||||
}
|
}
|
||||||
|
@ -1363,7 +1363,9 @@ static void isr_rx_iso_data_valid(const struct lll_sync_iso *const lll,
|
||||||
|
|
||||||
iso_meta = &node_rx->rx_iso_meta;
|
iso_meta = &node_rx->rx_iso_meta;
|
||||||
iso_meta->payload_number = lll->payload_count + (lll->bn_curr - 1U) +
|
iso_meta->payload_number = lll->payload_count + (lll->bn_curr - 1U) +
|
||||||
(lll->ptc_curr * lll->pto) - lll->bn;
|
(lll->ptc_curr * lll->pto);
|
||||||
|
/* Decrement BN as payload_count was pre-incremented */
|
||||||
|
iso_meta->payload_number -= lll->bn;
|
||||||
|
|
||||||
stream = ull_sync_iso_lll_stream_get(lll->stream_handle[0]);
|
stream = ull_sync_iso_lll_stream_get(lll->stream_handle[0]);
|
||||||
iso_meta->timestamp = HAL_TICKER_TICKS_TO_US(radio_tmr_start_get()) +
|
iso_meta->timestamp = HAL_TICKER_TICKS_TO_US(radio_tmr_start_get()) +
|
||||||
|
@ -1381,7 +1383,8 @@ static void isr_rx_iso_data_valid(const struct lll_sync_iso *const lll,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void isr_rx_iso_data_invalid(const struct lll_sync_iso *const lll,
|
static void isr_rx_iso_data_invalid(const struct lll_sync_iso *const lll,
|
||||||
uint8_t bn, uint16_t handle,
|
uint16_t latency, uint8_t bn,
|
||||||
|
uint16_t handle,
|
||||||
struct node_rx_pdu *node_rx)
|
struct node_rx_pdu *node_rx)
|
||||||
{
|
{
|
||||||
struct lll_sync_iso_stream *stream;
|
struct lll_sync_iso_stream *stream;
|
||||||
|
@ -1391,7 +1394,9 @@ static void isr_rx_iso_data_invalid(const struct lll_sync_iso *const lll,
|
||||||
node_rx->hdr.handle = handle;
|
node_rx->hdr.handle = handle;
|
||||||
|
|
||||||
iso_meta = &node_rx->rx_iso_meta;
|
iso_meta = &node_rx->rx_iso_meta;
|
||||||
iso_meta->payload_number = lll->payload_count - bn - 1U;
|
iso_meta->payload_number = lll->payload_count + bn;
|
||||||
|
/* Decrement BN as payload_count was pre-incremented */
|
||||||
|
iso_meta->payload_number -= (latency + 1U) * lll->bn;
|
||||||
|
|
||||||
stream = ull_sync_iso_lll_stream_get(lll->stream_handle[0]);
|
stream = ull_sync_iso_lll_stream_get(lll->stream_handle[0]);
|
||||||
iso_meta->timestamp = HAL_TICKER_TICKS_TO_US(radio_tmr_start_get()) +
|
iso_meta->timestamp = HAL_TICKER_TICKS_TO_US(radio_tmr_start_get()) +
|
||||||
|
@ -1399,6 +1404,8 @@ static void isr_rx_iso_data_invalid(const struct lll_sync_iso *const lll,
|
||||||
((stream->bis_index - 1U) *
|
((stream->bis_index - 1U) *
|
||||||
lll->sub_interval * ((lll->irc * lll->bn) +
|
lll->sub_interval * ((lll->irc * lll->bn) +
|
||||||
lll->ptc));
|
lll->ptc));
|
||||||
|
iso_meta->timestamp -= (latency * lll->iso_interval *
|
||||||
|
PERIODIC_INT_UNIT_US);
|
||||||
iso_meta->timestamp %=
|
iso_meta->timestamp %=
|
||||||
HAL_TICKER_TICKS_TO_US_64BIT(BIT64(HAL_TICKER_CNTR_MSBIT + 1U));
|
HAL_TICKER_TICKS_TO_US_64BIT(BIT64(HAL_TICKER_CNTR_MSBIT + 1U));
|
||||||
iso_meta->status = 1U;
|
iso_meta->status = 1U;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue