mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [2/3] incubator-mynewt-larva git commit: Move some stuff into bssnz (from bss).
Date Sat, 23 Jan 2016 23:55:28 GMT
Move some stuff into bssnz (from bss).


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

Branch: refs/heads/master
Commit: b3d21e4b38127a4a9dfaa8adae85806024c12eaa
Parents: 67fa51a
Author: Christopher Collins <ccollins476ad@gmail.com>
Authored: Sat Jan 23 15:45:10 2016 -0800
Committer: Christopher Collins <ccollins476ad@gmail.com>
Committed: Sat Jan 23 15:45:10 2016 -0800

----------------------------------------------------------------------
 net/nimble/host/src/ble_att_svr.c  | 53 ++++++++++++++++-----------------
 net/nimble/host/src/ble_gap_conn.c | 13 ++------
 2 files changed, 29 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/b3d21e4b/net/nimble/host/src/ble_att_svr.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_svr.c b/net/nimble/host/src/ble_att_svr.c
index 2f1c027..26c3eda 100644
--- a/net/nimble/host/src/ble_att_svr.c
+++ b/net/nimble/host/src/ble_att_svr.c
@@ -34,7 +34,9 @@ static uint16_t ble_att_svr_id;
 static struct os_mutex ble_att_svr_list_mutex;
 
 #define BLE_ATT_SVR_NUM_ENTRIES          128
-static void *ble_att_svr_entry_mem;
+static bssnz_t os_membuf_t
+ble_att_svr_entry_mem[OS_MEMPOOL_SIZE(BLE_ATT_SVR_NUM_ENTRIES,
+                                      sizeof (struct ble_att_svr_entry))];
 static struct os_mempool ble_att_svr_entry_pool;
 
 #define BLE_ATT_SVR_PREP_MBUF_BUF_SIZE         (128)
@@ -43,10 +45,14 @@ static struct os_mempool ble_att_svr_entry_pool;
      sizeof(struct os_mbuf_pkthdr))
 
 #define BLE_ATT_SVR_NUM_PREP_ENTRIES     8
-#define BLE_ATT_SVR_NUM_PREP_MBUFS       12
-static void *ble_att_svr_prep_entry_mem;
+#define BLE_ATT_SVR_NUM_PREP_MBUFS       8
+static bssnz_t os_membuf_t
+ble_att_svr_prep_entry_mem[OS_MEMPOOL_SIZE(BLE_ATT_SVR_NUM_PREP_ENTRIES,
+                           sizeof (struct ble_att_prep_entry))];
 static struct os_mempool ble_att_svr_prep_entry_pool;
-static void *ble_att_svr_prep_mbuf_mem;
+static bssnz_t os_membuf_t
+ble_att_svr_prep_mbuf_mem[OS_MEMPOOL_SIZE(BLE_ATT_SVR_NUM_PREP_MBUFS,
+                          BLE_ATT_SVR_PREP_MBUF_MEMBLOCK_SIZE)];
 static struct os_mempool ble_att_svr_prep_mbuf_mempool;
 static struct os_mbuf_pool ble_att_svr_prep_mbuf_pool;
 
@@ -2607,14 +2613,6 @@ done:
 static void
 ble_att_svr_free_mem(void)
 {
-    free(ble_att_svr_entry_mem);
-    ble_att_svr_entry_mem = NULL;
-
-    free(ble_att_svr_prep_entry_mem);
-    ble_att_svr_prep_entry_mem = NULL;
-
-    free(ble_att_svr_prep_mbuf_mem);
-    ble_att_svr_prep_mbuf_mem = NULL;
 }
 
 int
@@ -2631,30 +2629,31 @@ ble_att_svr_init(void)
         goto err;
     }
 
-    rc = ble_hs_misc_malloc_mempool(&ble_att_svr_entry_mem,
-                                    &ble_att_svr_entry_pool,
-                                    BLE_ATT_SVR_NUM_ENTRIES,
-                                    sizeof (struct ble_att_svr_entry),
-                                    "ble_att_svr_entry_pool");
+    rc = os_mempool_init(&ble_att_svr_entry_pool, BLE_ATT_SVR_NUM_ENTRIES,
+                         sizeof (struct ble_att_svr_entry),
+                         ble_att_svr_entry_mem, "ble_att_svr_entry_pool");
     if (rc != 0) {
+        rc = BLE_HS_EOS;
         goto err;
     }
 
-    rc = ble_hs_misc_malloc_mempool(&ble_att_svr_prep_entry_mem,
-                                    &ble_att_svr_prep_entry_pool,
-                                    BLE_ATT_SVR_NUM_PREP_ENTRIES,
-                                    sizeof (struct ble_att_prep_entry),
-                                    "ble_att_prep_entry_pool");
+    rc = os_mempool_init(&ble_att_svr_prep_entry_pool,
+                         BLE_ATT_SVR_NUM_PREP_ENTRIES,
+                         sizeof (struct ble_att_prep_entry),
+                         ble_att_svr_prep_entry_mem,
+                         "ble_att_svr_prep_entry_pool");
     if (rc != 0) {
+        rc = BLE_HS_EOS;
         goto err;
     }
 
-    rc = ble_hs_misc_malloc_mempool(&ble_att_svr_prep_mbuf_mem,
-                                    &ble_att_svr_prep_mbuf_mempool,
-                                    BLE_ATT_SVR_NUM_PREP_MBUFS,
-                                    BLE_ATT_SVR_PREP_MBUF_MEMBLOCK_SIZE,
-                                    "ble_att_prep_mbuf_mempool");
+    rc = os_mempool_init(&ble_att_svr_prep_mbuf_mempool,
+                         BLE_ATT_SVR_NUM_PREP_MBUFS,
+                         BLE_ATT_SVR_PREP_MBUF_MEMBLOCK_SIZE,
+                         ble_att_svr_prep_mbuf_mem,
+                         "ble_att_svr_prep_mbuf_pool");
     if (rc != 0) {
+        rc = BLE_HS_EOS;
         goto err;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/b3d21e4b/net/nimble/host/src/ble_gap_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap_conn.c b/net/nimble/host/src/ble_gap_conn.c
index 0101ff0..0871aab 100644
--- a/net/nimble/host/src/ble_gap_conn.c
+++ b/net/nimble/host/src/ble_gap_conn.c
@@ -162,7 +162,9 @@ struct ble_gap_conn_update_entry {
 };
 static SLIST_HEAD(, ble_gap_conn_update_entry) ble_gap_conn_update_entries;
 
-static os_membuf_t *ble_gap_conn_update_mem;
+static bssnz_t os_membuf_t 
+ble_gap_conn_update_mem[OS_MEMPOOL_SIZE(BLE_GAP_CONN_MAX_UPDATES,
+                         sizeof (struct ble_gap_conn_update_entry))];
 static struct os_mempool ble_gap_conn_update_pool;
 
 static int ble_gap_conn_adv_params_tx(void *arg);
@@ -2047,8 +2049,6 @@ ble_gap_conn_init_slave_params(void)
 static void
 ble_gap_conn_free_mem(void)
 {
-    free(ble_gap_conn_update_mem);
-    ble_gap_conn_update_mem = NULL;
 }
 
 int
@@ -2069,13 +2069,6 @@ ble_gap_conn_init(void)
     os_callout_func_init(&ble_gap_conn_slave_timer, &ble_hs_evq,
                          ble_gap_conn_slave_timer_exp, NULL);
 
-    ble_gap_conn_update_mem = malloc(
-        OS_MEMPOOL_BYTES(BLE_GAP_CONN_MAX_UPDATES,
-                         sizeof (struct ble_gap_conn_update_entry)));
-    if (ble_gap_conn_update_mem == NULL) {
-        rc = BLE_HS_ENOMEM;
-        goto err;
-    }
     rc = os_mempool_init(&ble_gap_conn_update_pool, BLE_GAP_CONN_MAX_UPDATES,
                          sizeof (struct ble_gap_conn_update_entry),
                          ble_gap_conn_update_mem, "ble_gap_conn_update_pool");


Mime
View raw message