rymanluk commented on code in PR #1892:
URL: https://github.com/apache/mynewt-nimble/pull/1892#discussion_r1811351920
##########
nimble/controller/src/ble_ll_adv.c:
##########
@@ -625,83 +625,73 @@ ble_ll_adv_pdu_make(uint8_t *dptr, void *pducb_arg,
uint8_t *hdr_byte)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV)
static void
ble_ll_adv_put_syncinfo(struct ble_ll_adv_sm *advsm,
- struct ble_ll_conn_sm *connsm, uint8_t *conn_event_cnt,
+ struct ble_ll_conn_sm *connsm, uint8_t
*conn_event_cntr,
uint8_t *dptr)
{
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_TRANSFER)
- uint16_t conn_cnt;
-#endif
- unsigned int event_cnt_off = 0;
- uint32_t offset = 0;
- uint32_t itvl_us;
+ uint32_t offset_us;
+ uint32_t offset;
uint32_t anchor_ticks;
uint8_t anchor_rem_us;
- uint8_t units;
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_TRANSFER)
+ uint16_t anchor_event_cntr;
+#endif
+ uint32_t event_start;
+ uint8_t event_start_us;
+ uint32_t event_cntr_offset = 0;
if (connsm) {
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_TRANSFER)
- anchor_ticks = connsm->anchor_point;
- anchor_rem_us = connsm->anchor_point_usecs;
- conn_cnt = connsm->event_cntr;
-
- /* get anchor for conn event that is before
periodic_adv_event_start_time */
- while (LL_TMR_GT(anchor_ticks, advsm->padv_event_start)) {
- ble_ll_conn_get_anchor(connsm, --conn_cnt, &anchor_ticks,
&anchor_rem_us);
- }
-
- offset = ble_ll_tmr_t2u(advsm->padv_event_start - anchor_ticks);
- offset -= anchor_rem_us;
- offset += advsm->padv_event_start_rem_us;
+ ble_ll_conn_anchor_get(connsm, &anchor_event_cntr,
+ &anchor_ticks, &anchor_rem_us);
/* connEventCount */
- put_le16(conn_event_cnt, conn_cnt);
+ put_le16(conn_event_cntr, anchor_event_cntr);
+#else
+ BLE_LL_ASSERT(0);
Review Comment:
nit: Could be a comment here, that `connsm` shall be used only for
SYNC_TRANSFER
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]