mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [8/8] incubator-mynewt-core git commit: BLE apps - Base ble_hs max_hci setting on HCI cfg.
Date Wed, 10 Aug 2016 02:12:01 GMT
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/1e9bbc28
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/1e9bbc28
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/1e9bbc28

Branch: refs/heads/develop
Commit: 1e9bbc2860e38c88d63a1504b6724f175ddd6def
Parents: 8b8d887
Author: Christopher Collins <ccollins@apache.org>
Authored: Tue Aug 9 17:56:52 2016 -0700
Committer: Christopher Collins <ccollins@apache.org>
Committed: Tue Aug 9 18:00:31 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/1e9bbc28/apps/blecent/src/main.c
----------------------------------------------------------------------
diff --git a/apps/blecent/src/main.c b/apps/blecent/src/main.c
index 66a4e3f..2b89a11 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/1e9bbc28/apps/bleprph/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleprph/src/main.c b/apps/bleprph/src/main.c
index 9d75a66..961ed4b 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/1e9bbc28/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index dbb340b..f2941e7 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/1e9bbc28/apps/bleuart/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleuart/src/main.c b/apps/bleuart/src/main.c
index a530195..061ab3b 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);
 


Mime
View raw message