mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [04/50] [abbrv] incubator-mynewt-core git commit: nimble/controller: Slight refactor of use of pkt receive time
Date Fri, 07 Apr 2017 18:44:38 GMT
nimble/controller: Slight refactor of use of pkt receive time

Modified the code so that the packet receive time is used in less
places. No functionality change.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/8158805c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/8158805c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/8158805c

Branch: refs/heads/master
Commit: 8158805cd5d86b3fb17365065425711f0cb6b7ea
Parents: 9b6c284
Author: William San Filippo <wills@runtime.io>
Authored: Thu Jan 19 14:57:21 2017 -0800
Committer: William San Filippo <wills@runtime.io>
Committed: Thu Mar 30 14:09:04 2017 -0700

----------------------------------------------------------------------
 .../controller/include/controller/ble_ll_conn.h |  2 +-
 net/nimble/controller/src/ble_ll_adv.c          |  7 +------
 net/nimble/controller/src/ble_ll_conn.c         | 21 ++++++++------------
 net/nimble/controller/src/ble_ll_conn_priv.h    |  2 +-
 4 files changed, 11 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8158805c/net/nimble/controller/include/controller/ble_ll_conn.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_conn.h b/net/nimble/controller/include/controller/ble_ll_conn.h
index d0badff..b2e6410 100644
--- a/net/nimble/controller/include/controller/ble_ll_conn.h
+++ b/net/nimble/controller/include/controller/ble_ll_conn.h
@@ -202,7 +202,7 @@ struct ble_ll_conn_sm
     uint16_t max_ce_len;
     uint16_t tx_win_off;
     uint32_t anchor_point;
-    uint32_t last_anchor_point;
+    uint32_t last_anchor_point;     /* Slave only */
     uint32_t slave_cur_tx_win_usecs;
     uint32_t slave_cur_window_widening;
     uint32_t last_rxd_pdu_cputime;  /* Used exclusively for supervision timer */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8158805c/net/nimble/controller/src/ble_ll_adv.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_adv.c b/net/nimble/controller/src/ble_ll_adv.c
index 1130638..203f13a 100644
--- a/net/nimble/controller/src/ble_ll_adv.c
+++ b/net/nimble/controller/src/ble_ll_adv.c
@@ -1209,14 +1209,12 @@ ble_ll_adv_conn_req_rxd(uint8_t *rxbuf, struct ble_mbuf_hdr *hdr,
                         struct ble_ll_adv_sm *advsm)
 {
     int valid;
-    uint8_t pyld_len;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
     uint8_t resolved;
 #endif
     uint8_t addr_type;
     uint8_t *inita;
     uint8_t *ident_addr;
-    uint32_t endtime;
 
     /* Check filter policy. */
     valid = 0;
@@ -1275,10 +1273,7 @@ ble_ll_adv_conn_req_rxd(uint8_t *rxbuf, struct ble_mbuf_hdr *hdr,
 #endif
 
         /* Try to start slave connection. If successful, stop advertising */
-        pyld_len = rxbuf[1] & BLE_ADV_PDU_HDR_LEN_MASK;
-        endtime = hdr->beg_cputime +
-            os_cputime_usecs_to_ticks(BLE_TX_DUR_USECS_M(pyld_len));
-        valid = ble_ll_conn_slave_start(rxbuf, endtime, addr_type, hdr);
+        valid = ble_ll_conn_slave_start(rxbuf, addr_type, hdr);
         if (valid) {
             ble_ll_adv_sm_stop(advsm);
         }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8158805c/net/nimble/controller/src/ble_ll_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn.c b/net/nimble/controller/src/ble_ll_conn.c
index 171d938..1d2714a 100644
--- a/net/nimble/controller/src/ble_ll_conn.c
+++ b/net/nimble/controller/src/ble_ll_conn.c
@@ -1770,11 +1770,11 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
  * @ return 0: connection NOT created. 1: connection created
  */
 static int
-ble_ll_conn_created(struct ble_ll_conn_sm *connsm, uint32_t endtime,
-                    struct ble_mbuf_hdr *rxhdr)
+ble_ll_conn_created(struct ble_ll_conn_sm *connsm, struct ble_mbuf_hdr *rxhdr)
 {
     int rc;
     uint8_t *evbuf;
+    uint32_t endtime;
     uint32_t usecs;
 
     /* Set state to created */
@@ -1798,8 +1798,10 @@ ble_ll_conn_created(struct ble_ll_conn_sm *connsm, uint32_t endtime,
      * the transmit window offset from the end of the connection request.
      */
     rc = 1;
-    connsm->last_anchor_point = endtime;
     if (connsm->conn_role == BLE_LL_CONN_ROLE_SLAVE) {
+        endtime = rxhdr->beg_cputime +
+            os_cputime_usecs_to_ticks(BLE_TX_DUR_USECS_M(BLE_CONNECT_REQ_LEN));
+        connsm->last_anchor_point = endtime;
         connsm->slave_cur_tx_win_usecs =
             connsm->tx_win_size * BLE_LL_CONN_TX_WIN_USECS;
         usecs = 1250 + (connsm->tx_win_off * BLE_LL_CONN_TX_WIN_USECS);
@@ -2169,9 +2171,7 @@ ble_ll_init_rx_pkt_in(uint8_t *rxbuf, struct ble_mbuf_hdr *ble_hdr)
     int8_t rpa_index;
 #endif
     uint8_t addr_type;
-    uint8_t payload_len;
     uint8_t *addr;
-    uint32_t endtime;
     struct ble_ll_conn_sm *connsm;
 
     /* Get the connection state machine we are trying to create */
@@ -2216,10 +2216,7 @@ ble_ll_init_rx_pkt_in(uint8_t *rxbuf, struct ble_mbuf_hdr *ble_hdr)
         /* Connection has been created. Stop scanning */
         g_ble_ll_conn_create_sm = NULL;
         ble_ll_scan_sm_stop(0);
-        payload_len = rxbuf[1] & BLE_ADV_PDU_HDR_LEN_MASK;
-        endtime = ble_hdr->beg_cputime +
-            os_cputime_usecs_to_ticks(BLE_TX_DUR_USECS_M(payload_len));
-        ble_ll_conn_created(connsm, endtime, NULL);
+        ble_ll_conn_created(connsm, NULL);
     } else {
         ble_ll_scan_chk_resume();
     }
@@ -3053,8 +3050,7 @@ ble_ll_conn_set_global_chanmap(uint8_t num_used_chans, uint8_t *chanmap)
  * @return 0: connection not started; 1 connecton started
  */
 int
-ble_ll_conn_slave_start(uint8_t *rxbuf, uint32_t conn_req_end, uint8_t pat,
-                        struct ble_mbuf_hdr *rxhdr)
+ble_ll_conn_slave_start(uint8_t *rxbuf, uint8_t pat, struct ble_mbuf_hdr *rxhdr)
 {
     int rc;
     uint32_t temp;
@@ -3147,8 +3143,7 @@ ble_ll_conn_slave_start(uint8_t *rxbuf, uint32_t conn_req_end, uint8_t
pat,
 
     /* Set initial schedule callback */
     connsm->conn_sch.sched_cb = ble_ll_conn_event_start_cb;
-
-    rc = ble_ll_conn_created(connsm, conn_req_end, rxhdr);
+    rc = ble_ll_conn_created(connsm, rxhdr);
     if (!rc) {
         SLIST_REMOVE(&g_ble_ll_conn_active_list, connsm, ble_ll_conn_sm, act_sle);
         STAILQ_INSERT_TAIL(&g_ble_ll_conn_free_list, connsm, free_stqe);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8158805c/net/nimble/controller/src/ble_ll_conn_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn_priv.h b/net/nimble/controller/src/ble_ll_conn_priv.h
index f3ede51..0913892 100644
--- a/net/nimble/controller/src/ble_ll_conn_priv.h
+++ b/net/nimble/controller/src/ble_ll_conn_priv.h
@@ -103,7 +103,7 @@ void ble_ll_conn_datalen_update(struct ble_ll_conn_sm *connsm,
                                 struct ble_ll_len_req *req);
 
 /* Advertising interface */
-int ble_ll_conn_slave_start(uint8_t *rxbuf, uint32_t conn_req_end, uint8_t pat,
+int ble_ll_conn_slave_start(uint8_t *rxbuf, uint8_t pat,
                             struct ble_mbuf_hdr *rxhdr);
 
 /* Link Layer interface */


Mime
View raw message