You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2020/01/02 10:04:33 UTC

[mynewt-nimble] branch master updated: nimble/ll: Fix build with periodic sync enabled and PHY disabled

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0214c03  nimble/ll: Fix build with periodic sync enabled and PHY disabled
0214c03 is described below

commit 0214c03bd57e2258bb0f2e38cc514f0a2b40a234
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Thu Jan 2 10:18:23 2020 +0100

    nimble/ll: Fix build with periodic sync enabled and PHY disabled
    
    This leaves periodic sync code PHY unrelated. If none is enabled
    code will ve removed by linker.
---
 nimble/controller/src/ble_ll_ctrl.c | 100 ++++++++++++++++++------------------
 1 file changed, 50 insertions(+), 50 deletions(-)

diff --git a/nimble/controller/src/ble_ll_ctrl.c b/nimble/controller/src/ble_ll_ctrl.c
index fcd0e7a..001619a 100644
--- a/nimble/controller/src/ble_ll_ctrl.c
+++ b/nimble/controller/src/ble_ll_ctrl.c
@@ -559,6 +559,56 @@ ble_ll_ctrl_start_rsp_timer(struct ble_ll_conn_sm *connsm)
                      ble_npl_time_ms_to_ticks32(BLE_LL_CTRL_PROC_TIMEOUT_MS));
 }
 
+/**
+ * Convert a phy mask to a numeric phy value.
+ *
+ * NOTE: only one bit should be set here and there should be at least one.
+ * If this function returns a 0 it is an error!
+ *
+ * @param phy_mask Bitmask of phy
+ *
+ * @return uint8_t The numeric value associated with the phy mask
+ *
+ * BLE_HCI_LE_PHY_1M                    (1)
+ * BLE_HCI_LE_PHY_2M                    (2)
+ * BLE_HCI_LE_PHY_CODED                 (3)
+ */
+uint8_t
+ble_ll_ctrl_phy_from_phy_mask(uint8_t phy_mask)
+{
+    uint8_t phy;
+
+    /*
+     * NOTE: wipe out unsupported PHYs. There should not be an unsupported
+     * in this mask if the other side is working correctly.
+     */
+#if !MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY)
+    phy_mask &= ~BLE_HCI_LE_PHY_2M_PREF_MASK;
+#endif
+#if !MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)
+    phy_mask &= ~BLE_HCI_LE_PHY_CODED_PREF_MASK;
+#endif
+
+    if (phy_mask & BLE_PHY_MASK_1M) {
+        phy = BLE_PHY_1M;
+        phy_mask &= ~BLE_PHY_MASK_1M;
+    } else if (phy_mask & BLE_PHY_MASK_2M) {
+        phy = BLE_PHY_2M;
+        phy_mask &= ~BLE_PHY_MASK_2M;
+    } else if (phy_mask & BLE_PHY_MASK_CODED) {
+        phy = BLE_PHY_CODED;
+        phy_mask &= ~BLE_PHY_MASK_CODED;
+    } else {
+        phy = 0;
+    }
+
+    if (phy_mask != 0) {
+        phy = 0;
+    }
+
+    return phy;
+}
+
 #if (BLE_LL_BT5_PHY_SUPPORTED == 1)
 uint8_t
 ble_ll_ctrl_phy_tx_transition_get(uint8_t phy_mask)
@@ -620,56 +670,6 @@ ble_ll_ctrl_phy_update_proc_complete(struct ble_ll_conn_sm *connsm)
 }
 
 /**
- * Convert a phy mask to a numeric phy value.
- *
- * NOTE: only one bit should be set here and there should be at least one.
- * If this function returns a 0 it is an error!
- *
- * @param phy_mask Bitmask of phy
- *
- * @return uint8_t The numeric value associated with the phy mask
- *
- * BLE_HCI_LE_PHY_1M                    (1)
- * BLE_HCI_LE_PHY_2M                    (2)
- * BLE_HCI_LE_PHY_CODED                 (3)
- */
-uint8_t
-ble_ll_ctrl_phy_from_phy_mask(uint8_t phy_mask)
-{
-    uint8_t phy;
-
-    /*
-     * NOTE: wipe out unsupported PHYs. There should not be an unsupported
-     * in this mask if the other side is working correctly.
-     */
-#if !MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY)
-    phy_mask &= ~BLE_HCI_LE_PHY_2M_PREF_MASK;
-#endif
-#if !MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)
-    phy_mask &= ~BLE_HCI_LE_PHY_CODED_PREF_MASK;
-#endif
-
-    if (phy_mask & BLE_PHY_MASK_1M) {
-        phy = BLE_PHY_1M;
-        phy_mask &= ~BLE_PHY_MASK_1M;
-    } else if (phy_mask & BLE_PHY_MASK_2M) {
-        phy = BLE_PHY_2M;
-        phy_mask &= ~BLE_PHY_MASK_2M;
-    } else if (phy_mask & BLE_PHY_MASK_CODED) {
-        phy = BLE_PHY_CODED;
-        phy_mask &= ~BLE_PHY_MASK_CODED;
-    } else {
-        phy = 0;
-    }
-
-    if (phy_mask != 0) {
-        phy = 0;
-    }
-
-    return phy;
-}
-
-/**
  *
  *  There is probably a better way for the controller to choose which PHY use.
  *  There are no BER metrics and RSSI does not give you S/N so for now we will