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 2019/07/24 22:32:15 UTC

[mynewt-nimble] branch master updated (d9118c4 -> 4cb0c05)

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

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


    from d9118c4  nimble/phy: Fix memblock overwrite on PDU copy
     new 7014232  nimble/ll: Fix initialization order
     new 4cb0c05  nimble/host: Fix initialization order

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nimble/controller/src/ble_ll.c | 25 +++++++++++++------------
 nimble/host/src/ble_hs.c       |  6 +++---
 2 files changed, 16 insertions(+), 15 deletions(-)


[mynewt-nimble] 02/02: nimble/host: Fix initialization order

Posted by an...@apache.org.
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 4cb0c0561c4529f50a2ffdd9ac9987fc5ec2a1fd
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Jul 24 12:17:54 2019 +0200

    nimble/host: Fix initialization order
    
    Transport should be configured after default queue is set.
    
    Callbacks set by host handle data by putting them on queue and use
    event queue to notify host. If queue is not set (which can happen if
    transport sends data immediately after callbacks are registered),
    we'll have crash.
---
 nimble/host/src/ble_hs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c
index c311847..c269636 100644
--- a/nimble/host/src/ble_hs.c
+++ b/nimble/host/src/ble_hs.c
@@ -781,15 +781,15 @@ ble_hs_init(void)
     ble_hs_dbg_mutex_locked = 0;
 #endif
 
-    /* Configure the HCI transport to communicate with a host. */
-    ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
-
 #ifdef MYNEWT
     ble_hs_evq_set((struct ble_npl_eventq *)os_eventq_dflt_get());
 #else
     ble_hs_evq_set(nimble_port_get_dflt_eventq());
 #endif
 
+    /* Configure the HCI transport to communicate with a host. */
+    ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
+
 #if BLE_MONITOR
     rc = ble_monitor_init();
     SYSINIT_PANIC_ASSERT(rc == 0);


[mynewt-nimble] 01/02: nimble/ll: Fix initialization order

Posted by an...@apache.org.
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 70142326fdc4e84405cb9c0e0fc796ac4d340758
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Jul 24 12:17:26 2019 +0200

    nimble/ll: Fix initialization order
    
    Transport should be configured before sending nop.
    
    Since transport is configured after os_task_init, it won't happen until
    ble_ll_task sleeps on eventq. This means LL will send nop without
    transport configured, which depending on transport may or may not work.
    
    os_task_init should be the last step of LL init and transport should be
    registered just before nop is sent.
---
 nimble/controller/src/ble_ll.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 94ab950..d59acf5 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -1155,6 +1155,9 @@ ble_ll_task(void *arg)
     /* Set output power to 1mW (0 dBm) */
     ble_phy_txpwr_set(MYNEWT_VAL(BLE_LL_TX_PWR_DBM));
 
+    /* Register callback for transport */
+    ble_hci_trans_cfg_ll(ble_ll_hci_cmd_rx, NULL, ble_ll_hci_acl_rx, NULL);
+
     /* Tell the host that we are ready to receive packets */
     ble_ll_hci_send_noop();
 
@@ -1619,6 +1622,16 @@ ble_ll_init(void)
 
     lldata->ll_supp_features = features;
 
+    rc = stats_init_and_reg(STATS_HDR(ble_ll_stats),
+                            STATS_SIZE_INIT_PARMS(ble_ll_stats, STATS_SIZE_32),
+                            STATS_NAME_INIT_PARMS(ble_ll_stats),
+                            "ble_ll");
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+    ble_ll_dtm_init();
+#endif
+
 #if MYNEWT
     /* Initialize the LL task */
     os_task_init(&g_ble_ll_task, "ble_ll", ble_ll_task, NULL,
@@ -1632,16 +1645,4 @@ ble_ll_init(void)
  */
 
 #endif
-
-    rc = stats_init_and_reg(STATS_HDR(ble_ll_stats),
-                            STATS_SIZE_INIT_PARMS(ble_ll_stats, STATS_SIZE_32),
-                            STATS_NAME_INIT_PARMS(ble_ll_stats),
-                            "ble_ll");
-    SYSINIT_PANIC_ASSERT(rc == 0);
-
-    ble_hci_trans_cfg_ll(ble_ll_hci_cmd_rx, NULL, ble_ll_hci_acl_rx, NULL);
-
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
-    ble_ll_dtm_init();
-#endif
 }