This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch new-master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 07a5d6965ffe20d7ac0490a9b94be674eab11e64
Author: Ɓukasz Rymanowski <lukasz.rymanow...@codecoup.pl>
AuthorDate: Thu Mar 8 14:54:31 2018 +0100

    nimble/mesh: Use OS_TASK_STACK_DEFINE for stacks in mesh
    
    X-Original-Commit: 5a97968cdfa5914ad14318051dcb7d6fbef928ea
---
 nimble/host/mesh/src/adv.c   | 9 +++------
 nimble/host/mesh/src/shell.c | 7 +++----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/nimble/host/mesh/src/adv.c b/nimble/host/mesh/src/adv.c
index 3dce81c..f75dcb4 100644
--- a/nimble/host/mesh/src/adv.c
+++ b/nimble/host/mesh/src/adv.c
@@ -45,6 +45,7 @@ static s32_t adv_int_min =  ADV_INT_DEFAULT_MS;
  * an increased call stack whenever it's used.
  */
 #define ADV_STACK_SIZE 768
+OS_TASK_STACK_DEFINE(g_blemesh_stack, ADV_STACK_SIZE);
 
 struct os_task adv_task;
 static struct os_eventq adv_queue;
@@ -294,12 +295,8 @@ static void bt_mesh_scan_cb(const bt_addr_le_t *addr, s8_t 
rssi,
 
 void bt_mesh_adv_init(void)
 {
-       os_stack_t *pstack;
        int rc;
 
-       pstack = malloc(sizeof(os_stack_t) * ADV_STACK_SIZE);
-       assert(pstack);
-
        rc = os_mempool_init(&adv_buf_mempool, 
MYNEWT_VAL(BLE_MESH_ADV_BUF_COUNT),
                             BT_MESH_ADV_DATA_SIZE + BT_MESH_MBUF_HEADER_SIZE,
                             adv_buf_mem, "adv_buf_pool");
@@ -313,8 +310,8 @@ void bt_mesh_adv_init(void)
        os_eventq_init(&adv_queue);
 
        os_task_init(&adv_task, "mesh_adv", adv_thread, NULL,
-                    MYNEWT_VAL(BLE_MESH_ADV_TASK_PRIO), OS_WAIT_FOREVER, 
pstack,
-                    ADV_STACK_SIZE);
+                    MYNEWT_VAL(BLE_MESH_ADV_TASK_PRIO), OS_WAIT_FOREVER,
+                    g_blemesh_stack, ADV_STACK_SIZE);
 
        /* For BT5 controllers we can have fast advertising interval */
        if (ble_hs_hci_get_hci_version() >= BLE_HCI_VER_BCS_5_0) {
diff --git a/nimble/host/mesh/src/shell.c b/nimble/host/mesh/src/shell.c
index 668ec38..8a5cb38 100644
--- a/nimble/host/mesh/src/shell.c
+++ b/nimble/host/mesh/src/shell.c
@@ -36,6 +36,8 @@
 #define BLE_MESH_SHELL_TASK_PRIO 126
 #define BLE_MESH_SHELL_STACK_SIZE 768
 
+OS_TASK_STACK_DEFINE(g_blemesh_shell_stack, BLE_MESH_SHELL_STACK_SIZE);
+
 struct os_task mesh_shell_task;
 static struct os_eventq mesh_shell_queue;
 
@@ -2249,13 +2251,10 @@ static void mesh_shell_thread(void *args)
 
 static void bt_mesh_shell_task_init(void)
 {
-       os_stack_t *pstack;
-
-       pstack = malloc(sizeof(os_stack_t) * BLE_MESH_SHELL_STACK_SIZE);
        os_eventq_init(&mesh_shell_queue);
 
        os_task_init(&mesh_shell_task, "mesh_sh", mesh_shell_thread, NULL,
-                    BLE_MESH_SHELL_TASK_PRIO, OS_WAIT_FOREVER, pstack,
+                    BLE_MESH_SHELL_TASK_PRIO, OS_WAIT_FOREVER, 
g_blemesh_shell_stack,
                     BLE_MESH_SHELL_STACK_SIZE);
 }
 #endif

-- 
To stop receiving notification emails like this one, please contact
a...@apache.org.

Reply via email to