You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2020/01/28 09:43:28 UTC

[mynewt-nimble] 02/04: nimble/ll: Use uint64_t for features

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

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

commit b018a1a71b8fc701e57f7212dd5d5b9c4e14180d
Author: Ɓukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Thu Jan 2 10:46:58 2020 +0100

    nimble/ll: Use uint64_t for features
    
    In Bluetooth 5.2 more than 32 bits are used for the supported
    features, therefore let us use uint64_t from now on.
---
 nimble/controller/include/controller/ble_ll.h | 4 ++--
 nimble/controller/src/ble_ll.c                | 6 +++---
 nimble/controller/src/ble_ll_ctrl.c           | 8 +++-----
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/nimble/controller/include/controller/ble_ll.h b/nimble/controller/include/controller/ble_ll.h
index 9d8c801..75fdbac 100644
--- a/nimble/controller/include/controller/ble_ll.h
+++ b/nimble/controller/include/controller/ble_ll.h
@@ -80,7 +80,7 @@ STAILQ_HEAD(ble_ll_pkt_q, os_mbuf_pkthdr);
 struct ble_ll_obj
 {
     /* Supported features */
-    uint32_t ll_supp_features;
+    uint64_t ll_supp_features;
 
     /* Current Link Layer state */
     uint8_t ll_state;
@@ -517,7 +517,7 @@ int ble_ll_set_random_addr(const uint8_t *cmdbuf, uint8_t len, bool hci_adv_ext)
 void ble_ll_wfr_timer_exp(void *arg);
 
 /* Read set of features supported by the Link Layer */
-uint32_t ble_ll_read_supp_features(void);
+uint64_t ble_ll_read_supp_features(void);
 
 /* Read set of states supported by the Link Layer */
 uint64_t ble_ll_read_supp_states(void);
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 9b3fd22..0968d11 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -1269,9 +1269,9 @@ ble_ll_read_supp_states(void)
 /**
  * Returns the features supported by the link layer
  *
- * @return uint32_t bitmask of supported features.
+ * @return uint64_t bitmask of supported features.
  */
-uint32_t
+uint64_t
 ble_ll_read_supp_features(void)
 {
     return g_ble_ll_data.ll_supp_features;
@@ -1515,7 +1515,7 @@ void
 ble_ll_init(void)
 {
     int rc;
-    uint32_t features;
+    uint64_t features;
     ble_addr_t addr;
     struct ble_ll_obj *lldata;
 
diff --git a/nimble/controller/src/ble_ll_ctrl.c b/nimble/controller/src/ble_ll_ctrl.c
index 001619a..789f773 100644
--- a/nimble/controller/src/ble_ll_ctrl.c
+++ b/nimble/controller/src/ble_ll_ctrl.c
@@ -1804,7 +1804,7 @@ ble_ll_ctrl_rx_feature_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
                            uint8_t *rspbuf, uint8_t opcode)
 {
     uint8_t rsp_opcode;
-    uint32_t our_feat;
+    uint64_t our_feat;
 
     /*
      * Only accept slave feature requests if we are a master and feature
@@ -1837,8 +1837,7 @@ ble_ll_ctrl_rx_feature_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
      */
     connsm->conn_features &= our_feat;
 
-    memset(rspbuf + 1, 0, 8);
-    put_le32(rspbuf + 1, our_feat);
+    put_le64(rspbuf + 1, our_feat);
     rspbuf[1] = connsm->conn_features;
 
     return rsp_opcode;
@@ -2092,8 +2091,7 @@ ble_ll_ctrl_proc_init(struct ble_ll_conn_sm *connsm, int ctrl_proc)
             } else {
                 opcode = BLE_LL_CTRL_SLAVE_FEATURE_REQ;
             }
-            memset(ctrdata, 0, BLE_LL_CTRL_FEATURE_LEN);
-            put_le32(ctrdata, ble_ll_read_supp_features());
+            put_le64(ctrdata, ble_ll_read_supp_features());
             break;
         case BLE_LL_CTRL_PROC_VERSION_XCHG:
             opcode = BLE_LL_CTRL_VERSION_IND;