You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/08/11 21:27:41 UTC

[41/50] [abbrv] incubator-mynewt-core git commit: BLE apps - Base ble_hs max_hci setting on HCI cfg.

BLE apps - Base ble_hs max_hci setting on HCI cfg.

The host should be configured to allocate the same number of OS events
as there are HCI event buffers.  This commit changes the sample apps to
use the RAM transport's configuration to determine how many OS events to
configure the host with.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/9f944afa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9f944afa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9f944afa

Branch: refs/heads/phyrx_no_mbuf
Commit: 9f944afa795a2540837e56c0b520a9ec087dab7f
Parents: 74c3c9b
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Aug 9 17:56:52 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Thu Aug 11 14:26:26 2016 -0700

----------------------------------------------------------------------
 apps/blecent/src/main.c | 6 ++++--
 apps/bleprph/src/main.c | 5 ++++-
 apps/bletiny/src/main.c | 1 +
 apps/bleuart/src/main.c | 6 ++++--
 4 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9f944afa/apps/blecent/src/main.c
----------------------------------------------------------------------
diff --git a/apps/blecent/src/main.c b/apps/blecent/src/main.c
index 6cc01e2..d5f47e6 100755
--- a/apps/blecent/src/main.c
+++ b/apps/blecent/src/main.c
@@ -508,6 +508,7 @@ blecent_task_handler(void *unused)
 int
 main(void)
 {
+    struct ble_hci_ram_cfg hci_cfg;
     struct ble_hs_cfg cfg;
     uint32_t seed;
     int rc;
@@ -567,12 +568,13 @@ main(void)
     assert(rc == 0);
 
     /* Initialize the RAM HCI transport. */
-    rc = ble_hci_ram_init(&ble_hci_ram_cfg_dflt);
+    hci_cfg = ble_hci_ram_cfg_dflt;
+    rc = ble_hci_ram_init(&hci_cfg);
     assert(rc == 0);
 
     /* Configure the host. */
     cfg = ble_hs_cfg_dflt;
-    cfg.max_hci_bufs = 3;
+    cfg.max_hci_bufs = hci_cfg.num_evt_hi_bufs + hci_cfg.num_evt_lo_bufs;
     cfg.max_gattc_procs = 5;
     cfg.sm_bonding = 1;
     cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9f944afa/apps/bleprph/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleprph/src/main.c b/apps/bleprph/src/main.c
index 524690d..b08b077 100755
--- a/apps/bleprph/src/main.c
+++ b/apps/bleprph/src/main.c
@@ -332,6 +332,7 @@ bleprph_task_handler(void *unused)
 int
 main(void)
 {
+    struct ble_hci_ram_cfg hci_cfg;
     struct ble_hs_cfg cfg;
     uint32_t seed;
     int rc;
@@ -391,11 +392,13 @@ main(void)
     assert(rc == 0);
 
     /* Initialize the RAM HCI transport. */
-    rc = ble_hci_ram_init(&ble_hci_ram_cfg_dflt);
+    hci_cfg = ble_hci_ram_cfg_dflt;
+    rc = ble_hci_ram_init(&hci_cfg);
     assert(rc == 0);
 
     /* Initialize the NimBLE host configuration. */
     cfg = ble_hs_cfg_dflt;
+    cfg.max_hci_bufs = hci_cfg.num_evt_hi_bufs + hci_cfg.num_evt_lo_bufs;
     cfg.max_gattc_procs = 2;
     cfg.sm_bonding = 1;
     cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9f944afa/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index 86b502a..469944c 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -1704,6 +1704,7 @@ main(void)
 
     /* Initialize the NimBLE host configuration. */
     cfg = ble_hs_cfg_dflt;
+    cfg.max_hci_bufs = hci_cfg.num_evt_hi_bufs + hci_cfg.num_evt_lo_bufs;
     cfg.max_gattc_procs = 2;
     cfg.reset_cb = bletiny_on_reset;
     cfg.store_read_cb = ble_store_ram_read;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9f944afa/apps/bleuart/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleuart/src/main.c b/apps/bleuart/src/main.c
index a9e71bd..264be92 100755
--- a/apps/bleuart/src/main.c
+++ b/apps/bleuart/src/main.c
@@ -253,6 +253,7 @@ bleuart_task_handler(void *unused)
 int
 main(void)
 {
+    struct ble_hci_ram_cfg hci_cfg;
     struct ble_hs_cfg cfg;
     uint32_t seed;
     int rc;
@@ -297,11 +298,13 @@ main(void)
     assert(rc == 0);
 
     /* Initialize the RAM HCI transport. */
-    rc = ble_hci_ram_init(&ble_hci_ram_cfg_dflt);
+    hci_cfg = ble_hci_ram_cfg_dflt;
+    rc = ble_hci_ram_init(&hci_cfg);
     assert(rc == 0);
 
     /* Initialize the BLE host. */
     cfg = ble_hs_cfg_dflt;
+    cfg.max_hci_bufs = hci_cfg.num_evt_hi_bufs + hci_cfg.num_evt_lo_bufs;
     cfg.max_connections = 1;
     cfg.max_gattc_procs = 2;
     cfg.max_l2cap_chans = 3;
@@ -334,7 +337,6 @@ main(void)
     rc = nmgr_ble_gatt_svr_init(&bleuart_evq, &cfg);
     assert(rc == 0);
 
-
     rc = ble_hs_init(&bleuart_evq, &cfg);
     assert(rc == 0);