You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/04/27 18:31:15 UTC

[GitHub] andrzej-kaczmarek closed pull request #71: More fixes for non-Mynewt builds

andrzej-kaczmarek closed pull request #71: More fixes for non-Mynewt builds
URL: https://github.com/apache/mynewt-nimble/pull/71
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nimble/controller/include/controller/ble_ll.h b/nimble/controller/include/controller/ble_ll.h
index 4d2e6168..24950232 100644
--- a/nimble/controller/include/controller/ble_ll.h
+++ b/nimble/controller/include/controller/ble_ll.h
@@ -491,8 +491,6 @@ ble_ll_usecs_to_ticks_round_up(uint32_t usecs)
     return os_cputime_usecs_to_ticks(usecs + 30);
 }
 
-#include "console/console.h"
-
 #define BLE_LL_LOG_ID_PHY_SETCHAN       (1)
 #define BLE_LL_LOG_ID_RX_START          (2)
 #define BLE_LL_LOG_ID_RX_END            (3)
diff --git a/nimble/controller/include/controller/ble_ll_conn.h b/nimble/controller/include/controller/ble_ll_conn.h
index 1d04acb1..b462590c 100644
--- a/nimble/controller/include/controller/ble_ll_conn.h
+++ b/nimble/controller/include/controller/ble_ll_conn.h
@@ -26,7 +26,6 @@
 #include "controller/ble_ll_sched.h"
 #include "controller/ble_ll_ctrl.h"
 #include "controller/ble_phy.h"
-#include "hal/hal_timer.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/nimble/controller/include/controller/ble_ll_ctrl.h b/nimble/controller/include/controller/ble_ll_ctrl.h
index 7e5d50ba..4b42d6ec 100644
--- a/nimble/controller/include/controller/ble_ll_ctrl.h
+++ b/nimble/controller/include/controller/ble_ll_ctrl.h
@@ -47,7 +47,7 @@ extern "C" {
 #define CLR_PENDING_CTRL_PROC(sm, proc) (sm->pending_ctrl_procs &= ~(1 << proc))
 
 /* LL control procedure timeout */
-#define BLE_LL_CTRL_PROC_TIMEOUT        (40)    /* in secs */
+#define BLE_LL_CTRL_PROC_TIMEOUT_MS     (40000) /* ms */
 
 /*
  * LL CTRL PDU format
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 453f4222..ce1b48cb 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -18,6 +18,7 @@
  */
 
 #include <stdint.h>
+#include <stdlib.h>
 #include <assert.h>
 #include <string.h>
 #include "sysinit/sysinit.h"
@@ -25,7 +26,6 @@
 #include "os/os.h"
 #include "os/os_cputime.h"
 #include "stats/stats.h"
-#include "bsp/bsp.h"
 #include "nimble/ble.h"
 #include "nimble/nimble_opt.h"
 #include "nimble/hci_common.h"
@@ -208,6 +208,8 @@ static void ble_ll_event_rx_pkt(struct os_event *ev);
 static void ble_ll_event_tx_pkt(struct os_event *ev);
 static void ble_ll_event_dbuf_overflow(struct os_event *ev);
 
+#if MYNEWT
+
 /* The BLE LL task data structure */
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
 /* TODO: This is for testing. Check it we really need it */
@@ -220,6 +222,8 @@ struct os_task g_ble_ll_task;
 
 OS_TASK_STACK_DEFINE(g_ble_ll_stack, BLE_LL_STACK_SIZE);
 
+#endif /* MYNEWT */
+
 /** Our global device address (public) */
 uint8_t g_dev_addr[BLE_DEV_ADDR_LEN];
 
@@ -853,7 +857,7 @@ ble_ll_hw_err_timer_cb(struct os_event *ev)
          * than 100 msecs).
          */
         os_callout_reset(&g_ble_ll_data.ll_hw_err_timer,
-                         OS_TICKS_PER_SEC / 20);
+                         os_time_ms_to_ticks32(50));
     }
 }
 
@@ -1536,10 +1540,19 @@ ble_ll_init(void)
 
     lldata->ll_supp_features = features;
 
+#if MYNEWT
     /* Initialize the LL task */
     os_task_init(&g_ble_ll_task, "ble_ll", ble_ll_task, NULL,
                  MYNEWT_VAL(BLE_LL_PRIO), OS_WAIT_FOREVER, g_ble_ll_stack,
                  BLE_LL_STACK_SIZE);
+#else
+
+/*
+ * For non-Mynewt OS it is required that OS creates task for LL and run LL
+ * routine which is wrapped by nimble_port_ll_task_func().
+ */
+
+#endif
 
     rc = stats_init_and_reg(STATS_HDR(ble_ll_stats),
                             STATS_SIZE_INIT_PARMS(ble_ll_stats, STATS_SIZE_32),
diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c
index a075ab20..50567ad4 100644
--- a/nimble/controller/src/ble_ll_adv.c
+++ b/nimble/controller/src/ble_ll_adv.c
@@ -22,7 +22,6 @@
 #include "syscfg/syscfg.h"
 #include "os/os.h"
 #include "os/os_cputime.h"
-#include "bsp/bsp.h"
 #include "ble/xcvr.h"
 #include "nimble/ble.h"
 #include "nimble/nimble_opt.h"
diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c
index d5b0b47e..1fb5a010 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -18,10 +18,10 @@
  */
 
 #include <stdint.h>
+#include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include "syscfg/syscfg.h"
-#include "bsp/bsp.h"
 #include "os/os.h"
 #include "os/os_cputime.h"
 #include "nimble/ble.h"
diff --git a/nimble/controller/src/ble_ll_conn_hci.c b/nimble/controller/src/ble_ll_conn_hci.c
index bcbfae41..54d21586 100644
--- a/nimble/controller/src/ble_ll_conn_hci.c
+++ b/nimble/controller/src/ble_ll_conn_hci.c
@@ -21,7 +21,6 @@
 #include <string.h>
 #include <assert.h>
 #include "syscfg/syscfg.h"
-#include "bsp/bsp.h"
 #include "os/os.h"
 #include "nimble/ble.h"
 #include "nimble/nimble_opt.h"
diff --git a/nimble/controller/src/ble_ll_conn_priv.h b/nimble/controller/src/ble_ll_conn_priv.h
index 5f299b9d..165872f1 100644
--- a/nimble/controller/src/ble_ll_conn_priv.h
+++ b/nimble/controller/src/ble_ll_conn_priv.h
@@ -56,8 +56,7 @@ extern "C" {
 
 /* Default authenticated payload timeout (30 seconds; in 10 msecs increments) */
 #define BLE_LL_CONN_DEF_AUTH_PYLD_TMO       (3000)
-#define BLE_LL_CONN_AUTH_PYLD_OS_TMO(x)     \
-    ((((uint32_t)(x)) * 10 * OS_TICKS_PER_SEC) / 1000)
+#define BLE_LL_CONN_AUTH_PYLD_OS_TMO(x)     os_time_ms_to_ticks32((x) * 10)
 
 
 typedef void (*ble_ll_hci_post_cmd_complete_cb)(void);
diff --git a/nimble/controller/src/ble_ll_ctrl.c b/nimble/controller/src/ble_ll_ctrl.c
index 5a71d8e3..39d04d1e 100644
--- a/nimble/controller/src/ble_ll_ctrl.c
+++ b/nimble/controller/src/ble_ll_ctrl.c
@@ -1984,7 +1984,7 @@ ble_ll_ctrl_proc_start(struct ble_ll_conn_sm *connsm, int ctrl_proc)
 
                 /* Re-start timer. Control procedure timeout is 40 seconds */
                 os_callout_reset(&connsm->ctrl_proc_rsp_timer,
-                                 OS_TICKS_PER_SEC * BLE_LL_CTRL_PROC_TIMEOUT);
+                                 os_time_ms_to_ticks32(BLE_LL_CTRL_PROC_TIMEOUT_MS));
             }
         }
     }
diff --git a/nimble/controller/src/ble_ll_resolv.c b/nimble/controller/src/ble_ll_resolv.c
index 46518584..a7bbfdad 100644
--- a/nimble/controller/src/ble_ll_resolv.c
+++ b/nimble/controller/src/ble_ll_resolv.c
@@ -368,7 +368,7 @@ ble_ll_resolv_set_rpa_tmo(uint8_t *cmdbuf)
         return BLE_ERR_INV_HCI_CMD_PARMS;
     }
 
-    g_ble_ll_resolv_data.rpa_tmo = tmo_secs * OS_TICKS_PER_SEC;
+    g_ble_ll_resolv_data.rpa_tmo = os_time_ms_to_ticks32(tmo_secs * 1000);
 
     /* If resolving is not enabled, we are done here. */
     if (!ble_ll_resolv_enabled()) {
@@ -590,7 +590,7 @@ ble_ll_resolv_init(void)
     uint8_t hw_size;
 
     /* Default is 15 minutes */
-    g_ble_ll_resolv_data.rpa_tmo = 15 * 60 * OS_TICKS_PER_SEC;
+    g_ble_ll_resolv_data.rpa_tmo = os_time_ms_to_ticks32(15 * 60 * 1000);
 
     hw_size = ble_hw_resolv_list_size();
     if (hw_size > MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE)) {
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 85b743b2..33a180ed 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -18,10 +18,10 @@
  */
 
 #include <stdint.h>
+#include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include "syscfg/syscfg.h"
-#include "bsp/bsp.h"
 #include "os/os.h"
 #include "os/os_cputime.h"
 #include "nimble/ble.h"
diff --git a/nimble/controller/src/ble_ll_sched.c b/nimble/controller/src/ble_ll_sched.c
index e421806d..7f0c1a4a 100644
--- a/nimble/controller/src/ble_ll_sched.c
+++ b/nimble/controller/src/ble_ll_sched.c
@@ -17,9 +17,9 @@
  * under the License.
  */
 #include <stdint.h>
+#include <stdlib.h>
 #include <assert.h>
 #include <string.h>
-#include "bsp/bsp.h"
 #include "os/os.h"
 #include "os/os_cputime.h"
 #include "ble/xcvr.h"
diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index e0ada94e..c5bddcb8 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -3403,7 +3403,7 @@ ble_gap_disc(uint8_t own_addr_type, int32_t duration_ms,
 #else
 
     struct ble_gap_disc_params params;
-    uint32_t duration_ticks;
+    uint32_t duration_ticks = 0;
     int rc;
 
     STATS_INC(ble_gap_stats, discover);
@@ -3836,7 +3836,7 @@ ble_gap_connect(uint8_t own_addr_type, const ble_addr_t *peer_addr,
     return BLE_HS_ENOTSUP;
 #endif
 
-    uint32_t duration_ticks;
+    uint32_t duration_ticks = 0;
     int rc;
 
     STATS_INC(ble_gap_stats, initiate);
diff --git a/nimble/host/util/src/addr.c b/nimble/host/util/src/addr.c
index b797fd68..e0b7880a 100644
--- a/nimble/host/util/src/addr.c
+++ b/nimble/host/util/src/addr.c
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-#include "hal/hal_bsp.h"
 #include "host/ble_hs.h"
 #include "host/util/util.h"
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services