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 d84b41ea nimble/ll: Split LL initialization
d84b41ea is described below

commit d84b41eac17e2a7c829f9a4289791281f2fa0aaf
Author: Szymon Janc <szymon.j...@codecoup.pl>
AuthorDate: Wed Nov 8 17:21:50 2023 +0100

    nimble/ll: Split LL initialization
    
    This splits LL intiialization into two phases, one that initialize all
    LL internals and second that is called when LL side of transport is
    initialized. This makes sure that all internals are fully initialized
    before host sends any commands or LL sends any events (since HS side of
    transport is initialized before LL side) regardless of how much time
    pass between those HS and LL transport initialization.
---
 nimble/controller/pkg.yml      | 5 +++++
 nimble/controller/src/ble_ll.c | 8 +++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/nimble/controller/pkg.yml b/nimble/controller/pkg.yml
index 5e43ba39..2f22e3eb 100644
--- a/nimble/controller/pkg.yml
+++ b/nimble/controller/pkg.yml
@@ -41,3 +41,8 @@ pkg.deps:
     - "@apache-mynewt-core/crypto/tinycrypt"
     - nimble
     - nimble/transport
+
+pkg.init:
+    ble_ll_init:
+        - $before:ble_transport_hs_init
+        - $before:ble_transport_ll_init
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 620e1b1b..998f8d4f 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -1371,9 +1371,6 @@ ble_ll_task(void *arg)
                                                   
MYNEWT_VAL(BLE_LL_TX_PWR_MAX_DBM)));
     g_ble_ll_tx_power_phy_current = INT8_MAX;
 
-    /* Tell the host that we are ready to receive packets */
-    ble_ll_hci_send_noop();
-
     while (1) {
         ev = ble_npl_eventq_get(&g_ble_ll_data.ll_evq, BLE_NPL_TIME_FOREVER);
         BLE_LL_ASSERT(ev);
@@ -1767,7 +1764,7 @@ ble_ll_assert(const char *file, unsigned line)
  *
  * @return int
  */
-static void
+void
 ble_ll_init(void)
 {
     int rc;
@@ -2003,7 +2000,8 @@ ble_transport_to_ll_iso_impl(struct os_mbuf *om)
 void
 ble_transport_ll_init(void)
 {
-    ble_ll_init();
+    /* Tell the host that we are ready to receive packets */
+    ble_ll_hci_send_noop();
 }
 
 int

Reply via email to