You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2023/01/27 18:55:31 UTC

[mynewt-nimble] 08/09: nimble/ll: Remove ble_ll_pdu_tx_time_get

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit d9fbaccd3e525c625089608d24fda0e45e6bb821
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Jan 27 01:08:43 2023 +0100

    nimble/ll: Remove ble_ll_pdu_tx_time_get
    
    Use ble_ll_pdu_us instead.
---
 nimble/controller/include/controller/ble_ll.h |  4 --
 nimble/controller/src/ble_ll.c                | 53 +--------------------------
 nimble/controller/src/ble_ll_adv.c            | 35 +++++++++---------
 nimble/controller/src/ble_ll_conn.c           | 21 +++++------
 nimble/controller/src/ble_ll_dtm.c            |  3 +-
 nimble/controller/src/ble_ll_scan_aux.c       |  3 +-
 nimble/controller/src/ble_ll_sched.c          |  5 ++-
 7 files changed, 37 insertions(+), 87 deletions(-)

diff --git a/nimble/controller/include/controller/ble_ll.h b/nimble/controller/include/controller/ble_ll.h
index 25a8f296..9fe3fb8f 100644
--- a/nimble/controller/include/controller/ble_ll.h
+++ b/nimble/controller/include/controller/ble_ll.h
@@ -495,10 +495,6 @@ int ble_ll_is_valid_random_addr(const uint8_t *addr);
 int ble_ll_is_valid_own_addr_type(uint8_t own_addr_type,
                                   const uint8_t *random_addr);
 
-/* Calculate the amount of time in microseconds a PDU with payload length of
- * 'payload_len' will take to transmit on a PHY 'phy_mode'. */
-uint32_t ble_ll_pdu_tx_time_get(uint16_t payload_len, int phy_mode);
-
 /* Calculate maximum octets of PDU payload which can be transmitted during
  * 'usecs' on a PHY 'phy_mode'. */
 uint16_t ble_ll_pdu_max_tx_octets_get(uint32_t usecs, int phy_mode);
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 9b9fc4e0..913f68cf 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -33,6 +33,7 @@
 #include "controller/ble_phy.h"
 #include "controller/ble_phy_trace.h"
 #include "controller/ble_ll.h"
+#include "controller/ble_ll_pdu.h"
 #include "controller/ble_ll_adv.h"
 #include "controller/ble_ll_sched.h"
 #include "controller/ble_ll_scan.h"
@@ -377,25 +378,6 @@ uint8_t g_dev_addr[BLE_DEV_ADDR_LEN];
 /** Our random address */
 uint8_t g_random_addr[BLE_DEV_ADDR_LEN];
 
-static const uint16_t g_ble_ll_pdu_header_tx_time[BLE_PHY_NUM_MODE] =
-{
-    [BLE_PHY_MODE_1M] =
-            (BLE_LL_PREAMBLE_LEN + BLE_LL_ACC_ADDR_LEN + BLE_LL_CRC_LEN +
-                    BLE_LL_PDU_HDR_LEN) << 3,
-    [BLE_PHY_MODE_2M] =
-            (BLE_LL_PREAMBLE_LEN * 2 + BLE_LL_ACC_ADDR_LEN + BLE_LL_CRC_LEN +
-                    BLE_LL_PDU_HDR_LEN) << 2,
-    /* For Coded PHY we have exact TX times provided by specification:
-     * - Preamble, Access Address, CI, TERM1 (always coded as S=8)
-     * - PDU, CRC, TERM2 (coded as S=2 or S=8)
-     * (Vol 6, Part B, 2.2).
-     */
-    [BLE_PHY_MODE_CODED_125KBPS] =
-            (80 + 256 + 16 + 24 + 8 * (BLE_LL_PDU_HDR_LEN * 8 + 24 + 3)),
-    [BLE_PHY_MODE_CODED_500KBPS] =
-            (80 + 256 + 16 + 24 + 2 * (BLE_LL_PDU_HDR_LEN * 8 + 24 + 3)),
-};
-
 /**
  * Counts the number of advertising PDU's received, by type. For advertising
  * PDU's that contain a destination address, we still count these packets even
@@ -1700,37 +1682,6 @@ ble_ll_reset(void)
     return rc;
 }
 
-uint32_t
-ble_ll_pdu_tx_time_get(uint16_t payload_len, int phy_mode)
-{
-    uint32_t usecs;
-
-#if (BLE_LL_BT5_PHY_SUPPORTED)
-    if (phy_mode == BLE_PHY_MODE_1M) {
-        /* 8 usecs per byte */
-        usecs = payload_len << 3;
-    } else if (phy_mode == BLE_PHY_MODE_2M) {
-        /* 4 usecs per byte */
-        usecs = payload_len << 2;
-    } else if (phy_mode == BLE_PHY_MODE_CODED_125KBPS) {
-        /* S=8 => 8 * 8 = 64 usecs per byte */
-        usecs = payload_len << 6;
-    } else if (phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
-        /* S=2 => 2 * 8 = 16 usecs per byte */
-        usecs = payload_len << 4;
-    } else {
-        BLE_LL_ASSERT(0);
-    }
-
-    usecs += g_ble_ll_pdu_header_tx_time[phy_mode];
-#else
-    usecs = (((payload_len) + BLE_LL_PDU_HDR_LEN + BLE_LL_ACC_ADDR_LEN
-            + BLE_LL_PREAMBLE_LEN + BLE_LL_CRC_LEN) << 3);
-#endif
-
-    return usecs;
-}
-
 uint16_t
 ble_ll_pdu_max_tx_octets_get(uint32_t usecs, int phy_mode)
 {
@@ -1739,7 +1690,7 @@ ble_ll_pdu_max_tx_octets_get(uint32_t usecs, int phy_mode)
 
     BLE_LL_ASSERT(phy_mode < BLE_PHY_NUM_MODE);
 
-    header_tx_time = g_ble_ll_pdu_header_tx_time[phy_mode];
+    header_tx_time = ble_ll_pdu_us(0, phy_mode);
 
     /*
      * Current conn max tx time can be too short to even send a packet header
diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c
index 125b6247..6f35c7e5 100644
--- a/nimble/controller/src/ble_ll_adv.c
+++ b/nimble/controller/src/ble_ll_adv.c
@@ -29,6 +29,7 @@
 #include "controller/ble_phy.h"
 #include "controller/ble_hw.h"
 #include "controller/ble_ll.h"
+#include "controller/ble_ll_pdu.h"
 #include "controller/ble_ll_hci.h"
 #include "controller/ble_ll_adv.h"
 #include "controller/ble_ll_sched.h"
@@ -781,7 +782,7 @@ ble_ll_adv_aux_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte)
             offset = 0;
         } else if (advsm->rx_ble_hdr) {
             offset = ble_ll_tmr_t2u(AUX_NEXT(advsm)->start_time - advsm->rx_ble_hdr->beg_cputime);
-            offset -= (advsm->rx_ble_hdr->rem_usecs + ble_ll_pdu_tx_time_get(12, advsm->sec_phy) + BLE_LL_IFS);
+            offset -= (advsm->rx_ble_hdr->rem_usecs + ble_ll_pdu_us(12, advsm->sec_phy) + BLE_LL_IFS);
         } else {
             offset = ble_ll_tmr_t2u(AUX_NEXT(advsm)->start_time - aux->start_time);
         }
@@ -1206,7 +1207,7 @@ ble_ll_adv_set_sched(struct ble_ll_adv_sm *advsm)
     /* Set end time to maximum time this schedule item may take */
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_LEGACY) {
-        max_usecs = ble_ll_pdu_tx_time_get(advsm->adv_pdu_len, BLE_PHY_MODE_1M);
+        max_usecs = ble_ll_pdu_us(advsm->adv_pdu_len, BLE_PHY_MODE_1M);
 
         if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_DIRECTED) {
             max_usecs += BLE_LL_SCHED_DIRECT_ADV_MAX_USECS;
@@ -1218,10 +1219,10 @@ ble_ll_adv_set_sched(struct ble_ll_adv_sm *advsm)
          * In ADV_EXT_IND we always set only ADI and AUX so the payload length
          * is always 7 bytes.
          */
-        max_usecs = ble_ll_pdu_tx_time_get(7, advsm->pri_phy);
+        max_usecs = ble_ll_pdu_us(7, advsm->pri_phy);
     }
 #else
-    max_usecs = ble_ll_pdu_tx_time_get(advsm->adv_pdu_len, BLE_PHY_MODE_1M);
+    max_usecs = ble_ll_pdu_us(advsm->adv_pdu_len, BLE_PHY_MODE_1M);
 
     if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_DIRECTED) {
         max_usecs += BLE_LL_SCHED_DIRECT_ADV_MAX_USECS;
@@ -1509,7 +1510,7 @@ ble_ll_adv_aux_check_data_itvl(struct ble_ll_adv_sm *advsm, uint16_t props,
      * account, but we do not support max skip anyway for now.
      */
 
-    max_usecs = 3 * (ble_ll_pdu_tx_time_get(7, pri_phy) + 300) +
+    max_usecs = 3 * (ble_ll_pdu_us(7, pri_phy) + 300) +
                 BLE_LL_MAFS + MYNEWT_VAL(BLE_LL_SCHED_AUX_MAFS_DELAY);
 
     data_offset = 0;
@@ -1518,7 +1519,7 @@ ble_ll_adv_aux_check_data_itvl(struct ble_ll_adv_sm *advsm, uint16_t props,
         pdu_len = ble_ll_adv_aux_calculate_payload(advsm, props, data, data_offset,
                                                    &data_len, &ext_hdr_flags);
 
-        max_usecs += ble_ll_pdu_tx_time_get(pdu_len, sec_phy);
+        max_usecs += ble_ll_pdu_us(pdu_len, sec_phy);
         max_usecs += BLE_LL_MAFS + MYNEWT_VAL(BLE_LL_SCHED_AUX_CHAIN_MAFS_DELAY);
 
         data_offset += data_len;
@@ -1578,7 +1579,7 @@ ble_ll_adv_aux_schedule_next(struct ble_ll_adv_sm *advsm)
     BLE_LL_ASSERT(rem_data_len > 0);
 
     ble_ll_adv_aux_calculate(advsm, aux_next, next_data_offset);
-    max_usecs = ble_ll_pdu_tx_time_get(aux_next->payload_len, advsm->sec_phy);
+    max_usecs = ble_ll_pdu_us(aux_next->payload_len, advsm->sec_phy);
 
     aux_next->start_time = aux->sch.end_time +
                            ble_ll_tmr_u2t_up(BLE_LL_MAFS +
@@ -1623,13 +1624,13 @@ ble_ll_adv_aux_schedule_first(struct ble_ll_adv_sm *advsm)
 
     /* Set end time to maximum time this schedule item may take */
     if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_CONNECTABLE) {
-        max_usecs = ble_ll_pdu_tx_time_get(aux->payload_len, advsm->sec_phy) +
+        max_usecs = ble_ll_pdu_us(aux->payload_len, advsm->sec_phy) +
                     BLE_LL_IFS +
                     /* AUX_CONN_REQ */
-                    ble_ll_pdu_tx_time_get(34 + 14, advsm->sec_phy)  +
+                    ble_ll_pdu_us(34 + 14, advsm->sec_phy)  +
                     BLE_LL_IFS +
                     /* AUX_CONN_RSP */
-                    ble_ll_pdu_tx_time_get(14, advsm->sec_phy);
+                    ble_ll_pdu_us(14, advsm->sec_phy);
     } else if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_SCANNABLE) {
         /* For scannable advertising we need to calculate how much time we
          * need for AUX_ADV_IND along with AUX_SCAN_REQ, AUX_SCAN_RSP and
@@ -1641,16 +1642,16 @@ ble_ll_adv_aux_schedule_first(struct ble_ll_adv_sm *advsm)
          *  2. length of AUX_ADV_IND is calculated by special function:
          *      ble_ll_adv_aux_scannable_pdu_payload_len()
          */
-        max_usecs = ble_ll_pdu_tx_time_get(ble_ll_adv_aux_scannable_pdu_payload_len(advsm),
+        max_usecs = ble_ll_pdu_us(ble_ll_adv_aux_scannable_pdu_payload_len(advsm),
                                            advsm->sec_phy) +
                     BLE_LL_IFS +
                     /* AUX_SCAN_REQ */
-                    ble_ll_pdu_tx_time_get(12, advsm->sec_phy)  +
+                    ble_ll_pdu_us(12, advsm->sec_phy)  +
                     BLE_LL_IFS +
                     /* AUX_SCAN_RSP */
-                    ble_ll_pdu_tx_time_get(aux->payload_len, advsm->sec_phy);
+                    ble_ll_pdu_us(aux->payload_len, advsm->sec_phy);
     } else {
-        max_usecs = ble_ll_pdu_tx_time_get(aux->payload_len, advsm->sec_phy);
+        max_usecs = ble_ll_pdu_us(aux->payload_len, advsm->sec_phy);
     }
 
     sch = &aux->sch;
@@ -2385,7 +2386,7 @@ ble_ll_adv_periodic_schedule_first(struct ble_ll_adv_sm *advsm,
     ble_ll_adv_sync_calculate(advsm, sync, 0, chan);
 
     /* sync is always non-connectable and non-scannable*/
-    max_usecs = ble_ll_pdu_tx_time_get(sync->payload_len, advsm->sec_phy);
+    max_usecs = ble_ll_pdu_us(sync->payload_len, advsm->sec_phy);
 
     sch = &sync->sch;
 
@@ -2471,7 +2472,7 @@ ble_ll_adv_periodic_schedule_next(struct ble_ll_adv_sm *advsm)
                                  advsm->periodic_chanmap);
 
     ble_ll_adv_sync_calculate(advsm, sync_next, next_data_offset, chan);
-    max_usecs = ble_ll_pdu_tx_time_get(sync_next->payload_len, advsm->sec_phy);
+    max_usecs = ble_ll_pdu_us(sync_next->payload_len, advsm->sec_phy);
 
     sync_next->start_time = sync->sch.end_time +
                             ble_ll_tmr_u2t_up(BLE_LL_MAFS +
@@ -3862,7 +3863,7 @@ ble_ll_adv_periodic_check_data_itvl(uint16_t payload_len, uint16_t props,
     while (offset < payload_len) {
         pdu_len = ble_ll_adv_sync_get_pdu_len(payload_len, &offset, props);
 
-        max_usecs += ble_ll_pdu_tx_time_get(pdu_len, phy);
+        max_usecs += ble_ll_pdu_us(pdu_len, phy);
         max_usecs += BLE_LL_MAFS + MYNEWT_VAL(BLE_LL_SCHED_AUX_CHAIN_MAFS_DELAY);
     }
 
diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c
index 4f12f143..379a59a7 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -28,6 +28,7 @@
 #include "nimble/hci_common.h"
 #include "nimble/transport.h"
 #include "controller/ble_ll.h"
+#include "controller/ble_ll_pdu.h"
 #include "controller/ble_ll_conn.h"
 #include "controller/ble_ll_hci.h"
 #include "controller/ble_ll_scan.h"
@@ -1268,8 +1269,8 @@ ble_ll_conn_tx_pdu(struct ble_ll_conn_sm *connsm)
 #endif
 
         ticks = (BLE_LL_IFS * 3) + connsm->ota_max_rx_time +
-            ble_ll_pdu_tx_time_get(next_txlen, tx_phy_mode) +
-            ble_ll_pdu_tx_time_get(cur_txlen, tx_phy_mode);
+                ble_ll_pdu_us(next_txlen, tx_phy_mode) +
+                ble_ll_pdu_us(cur_txlen, tx_phy_mode);
 
 #if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
         if (connsm->conn_role == BLE_LL_CONN_ROLE_CENTRAL) {
@@ -1677,10 +1678,10 @@ ble_ll_conn_can_send_next_pdu(struct ble_ll_conn_sm *connsm, uint32_t begtime,
             if (rem_bytes > connsm->eff_max_tx_octets) {
                 rem_bytes = connsm->eff_max_tx_octets;
             }
-            usecs = ble_ll_pdu_tx_time_get(rem_bytes, tx_phy_mode);
+            usecs = ble_ll_pdu_us(rem_bytes, tx_phy_mode);
         } else {
             /* We will send empty pdu (just a LL header) */
-            usecs = ble_ll_pdu_tx_time_get(0, tx_phy_mode);
+            usecs = ble_ll_pdu_us(0, tx_phy_mode);
         }
         usecs += (BLE_LL_IFS * 2) + connsm->ota_max_rx_time;
 
@@ -2132,7 +2133,7 @@ ble_ll_conn_update_eff_data_len(struct ble_ll_conn_sm *connsm)
 #else
         phy_mode = BLE_PHY_MODE_1M;
 #endif
-        ota_time = ble_ll_pdu_tx_time_get(connsm->eff_max_rx_octets, phy_mode);
+        ota_time = ble_ll_pdu_us(connsm->eff_max_rx_octets, phy_mode);
         connsm->ota_max_rx_time = min(ota_time, connsm->eff_max_rx_time);
     }
 
@@ -2787,7 +2788,7 @@ ble_ll_conn_created(struct ble_ll_conn_sm *connsm, struct ble_mbuf_hdr *rxhdr)
 
         usecs = rxhdr->rem_usecs + 1250 +
                 (connsm->tx_win_off * BLE_LL_CONN_TX_WIN_USECS) +
-                ble_ll_pdu_tx_time_get(BLE_CONNECT_REQ_LEN,
+                ble_ll_pdu_us(BLE_CONNECT_REQ_LEN,
                                        rxhdr->rxinfo.phy_mode);
 
         if (rxhdr->rxinfo.channel < BLE_PHY_NUM_DATA_CHANS) {
@@ -3689,7 +3690,7 @@ ble_ll_conn_rx_isr_end(uint8_t *rxbuf, struct ble_mbuf_hdr *rxhdr)
     rx_phy_mode = BLE_PHY_MODE_1M;
 #endif
     add_usecs = rxhdr->rem_usecs +
-            ble_ll_pdu_tx_time_get(rx_pyld_len, rx_phy_mode);
+                ble_ll_pdu_us(rx_pyld_len, rx_phy_mode);
 
     /*
      * Check the packet CRC. A connection event can continue even if the
@@ -4341,11 +4342,9 @@ ble_ll_conn_subrate_set(struct ble_ll_conn_sm *connsm,
 #endif
 
 #define MAX_TIME_UNCODED(_maxbytes) \
-        ble_ll_pdu_tx_time_get(_maxbytes + BLE_LL_DATA_MIC_LEN, \
-                               BLE_PHY_MODE_1M);
+    ble_ll_pdu_us(_maxbytes + BLE_LL_DATA_MIC_LEN, BLE_PHY_MODE_1M);
 #define MAX_TIME_CODED(_maxbytes) \
-        ble_ll_pdu_tx_time_get(_maxbytes + BLE_LL_DATA_MIC_LEN, \
-                               BLE_PHY_MODE_CODED_125KBPS);
+    ble_ll_pdu_us(_maxbytes + BLE_LL_DATA_MIC_LEN, BLE_PHY_MODE_CODED_125KBPS);
 
 /**
  * Called to reset the connection module. When this function is called the
diff --git a/nimble/controller/src/ble_ll_dtm.c b/nimble/controller/src/ble_ll_dtm.c
index b1e4f6f0..07e25fe2 100644
--- a/nimble/controller/src/ble_ll_dtm.c
+++ b/nimble/controller/src/ble_ll_dtm.c
@@ -26,6 +26,7 @@
 #include "os/os.h"
 #include "stats/stats.h"
 #include "controller/ble_ll.h"
+#include "controller/ble_ll_pdu.h"
 #include "controller/ble_phy.h"
 #include "controller/ble_ll_sched.h"
 #include "controller/ble_ll_rfmgmt.h"
@@ -269,7 +270,7 @@ ble_ll_dtm_calculate_itvl(struct dtm_ctx *ctx, uint8_t len,
     uint32_t itvl_usec;
 
     /* Calculate interval as per spec Bluetooth 5.0 Vol 6. Part F, 4.1.6 */
-    l = ble_ll_pdu_tx_time_get(len + BLE_LL_PDU_HDR_LEN, phy_mode);
+    l = ble_ll_pdu_us(len, phy_mode);
     itvl_usec = ((l + 249 + 624) / 625) * 625;
 
 #if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
diff --git a/nimble/controller/src/ble_ll_scan_aux.c b/nimble/controller/src/ble_ll_scan_aux.c
index f7c92d53..45f9ce46 100644
--- a/nimble/controller/src/ble_ll_scan_aux.c
+++ b/nimble/controller/src/ble_ll_scan_aux.c
@@ -31,6 +31,7 @@
 #include "controller/ble_phy.h"
 #include "controller/ble_hw.h"
 #include "controller/ble_ll.h"
+#include "controller/ble_ll_pdu.h"
 #include "controller/ble_ll_sched.h"
 #include "controller/ble_ll_scan.h"
 #include "controller/ble_ll_scan_aux.h"
@@ -747,7 +748,7 @@ ble_ll_scan_aux_sched(struct ble_ll_scan_aux_data *aux, uint32_t pdu_time,
         return -1;
     }
 
-    max_aux_time_us = ble_ll_pdu_tx_time_get(MYNEWT_VAL(BLE_LL_SCHED_SCAN_AUX_PDU_LEN),
+    max_aux_time_us = ble_ll_pdu_us(MYNEWT_VAL(BLE_LL_SCHED_SCAN_AUX_PDU_LEN),
                                              ble_ll_phy_to_phy_mode(aux->sec_phy, 0));
 
     rc = ble_ll_sched_scan_aux(&aux->sch, pdu_time, pdu_time_rem, offset_us,
diff --git a/nimble/controller/src/ble_ll_sched.c b/nimble/controller/src/ble_ll_sched.c
index cf64e82f..513257db 100644
--- a/nimble/controller/src/ble_ll_sched.c
+++ b/nimble/controller/src/ble_ll_sched.c
@@ -23,6 +23,7 @@
 #include "ble/xcvr.h"
 #include "controller/ble_phy.h"
 #include "controller/ble_ll.h"
+#include "controller/ble_ll_pdu.h"
 #include "controller/ble_ll_sched.h"
 #include "controller/ble_ll_adv.h"
 #include "controller/ble_ll_scan.h"
@@ -680,7 +681,7 @@ ble_ll_sched_sync_reschedule(struct ble_ll_sched_item *sch,
 
     ble_ll_tmr_sub(&start_time, &start_time_rem_usecs, window_widening);
 
-    dur = ble_ll_pdu_tx_time_get(MYNEWT_VAL(BLE_LL_SCHED_SCAN_SYNC_PDU_LEN),
+    dur = ble_ll_pdu_us(MYNEWT_VAL(BLE_LL_SCHED_SCAN_SYNC_PDU_LEN),
                                  phy_mode);
     end_time = start_time + ble_ll_tmr_u2t(dur);
 
@@ -729,7 +730,7 @@ ble_ll_sched_sync(struct ble_ll_sched_item *sch,
 
     ble_ll_tmr_add(&start_time, &start_time_rem_usecs, offset);
 
-    dur = ble_ll_pdu_tx_time_get(MYNEWT_VAL(BLE_LL_SCHED_SCAN_SYNC_PDU_LEN),
+    dur = ble_ll_pdu_us(MYNEWT_VAL(BLE_LL_SCHED_SCAN_SYNC_PDU_LEN),
                                   phy_mode);
     end_time = start_time + ble_ll_tmr_u2t(dur);