You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2018/11/14 16:39:10 UTC

[mynewt-nimble] branch master updated (dc9fb25 -> ba6ce7d)

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

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


    from dc9fb25  Merge pull request #237 from wes3/nrf_hfxo_request
     new dfe8035  [porting][linux] Fixed build errors when BLE Mesh Shell is disabled
     new 55e2c86  [porting][linux] Added required APIs to build glue.c for BLE Mesh app
     new e6fd6e9  Dynamically considering pointer size to support multiple platforms
     new 4b5c5ef  [porting][linux] Added timeout support to Eventq Get API
     new ba6ce7d  Fixed build error of Mesh stack for 64-bit machine

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nimble/host/mesh/src/adv.h                         |  2 +-
 nimble/host/mesh/src/testing.c                     |  6 ++++-
 .../npl/linux/include/console/console.h            | 10 ++++----
 porting/npl/linux/src/os_callout.c                 | 27 ++++++++++++++++++++++
 porting/npl/linux/src/os_eventq.cc                 | 19 +++++++++++++--
 porting/npl/linux/src/os_time.c                    |  7 ++++++
 porting/npl/linux/src/wqueue.h                     | 18 +++++++++++----
 7 files changed, 75 insertions(+), 14 deletions(-)
 copy nimble/transport/ram/include/transport/ram/ble_hci_ram.h => porting/npl/linux/include/console/console.h (85%)


[mynewt-nimble] 04/05: [porting][linux] Added timeout support to Eventq Get API

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4b5c5ef468ba0840ba22e3bc13e55c6e1736d0b1
Author: Mehul Hirpara <me...@inedasystems.com>
AuthorDate: Wed Oct 24 17:56:11 2018 +0530

    [porting][linux] Added timeout support to Eventq Get API
    
    This change helps to get event from eventq with 0 timeout period.
---
 porting/npl/linux/src/os_eventq.cc |  7 +++++--
 porting/npl/linux/src/wqueue.h     | 18 +++++++++++++-----
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/porting/npl/linux/src/os_eventq.cc b/porting/npl/linux/src/os_eventq.cc
index 2ede70b..a3c4b96 100644
--- a/porting/npl/linux/src/os_eventq.cc
+++ b/porting/npl/linux/src/os_eventq.cc
@@ -83,8 +83,11 @@ struct ble_npl_event *ble_npl_eventq_get(struct ble_npl_eventq *evq,
     struct ble_npl_event *ev;
     wqueue_t *q = static_cast<wqueue_t *>(evq->q);
 
-    ev = q->get();
-    ev->ev_queued = 0;
+    ev = q->get(tmo);
+
+    if (ev) {
+        ev->ev_queued = 0;
+    }
 
     return ev;
 }
diff --git a/porting/npl/linux/src/wqueue.h b/porting/npl/linux/src/wqueue.h
index 8eb23b7..0a1e7cc 100644
--- a/porting/npl/linux/src/wqueue.h
+++ b/porting/npl/linux/src/wqueue.h
@@ -54,13 +54,21 @@ public:
         pthread_mutex_unlock(&m_mutex);
     }
 
-    T get() {
+    T get(uint32_t tmo) {
         pthread_mutex_lock(&m_mutex);
-        while (m_queue.size() == 0) {
-            pthread_cond_wait(&m_condv, &m_mutex);
+        if (tmo) {
+            while (m_queue.size() == 0) {
+                pthread_cond_wait(&m_condv, &m_mutex);
+            }
         }
-        T item = m_queue.front();
-        m_queue.pop_front();
+
+        T item = NULL;
+
+        if (m_queue.size() != 0) {
+            item = m_queue.front();
+            m_queue.pop_front();
+        }
+
         pthread_mutex_unlock(&m_mutex);
         return item;
     }


[mynewt-nimble] 02/05: [porting][linux] Added required APIs to build glue.c for BLE Mesh app

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 55e2c86357202927d48c5a3b7d437a462030b3cb
Author: Mehul Hirpara <me...@inedasystems.com>
AuthorDate: Wed Oct 24 17:31:27 2018 +0530

    [porting][linux] Added required APIs to build glue.c for BLE Mesh app
---
 porting/npl/linux/src/os_callout.c | 27 +++++++++++++++++++++++++++
 porting/npl/linux/src/os_eventq.cc | 12 ++++++++++++
 porting/npl/linux/src/os_time.c    |  7 +++++++
 3 files changed, 46 insertions(+)

diff --git a/porting/npl/linux/src/os_callout.c b/porting/npl/linux/src/os_callout.c
index 1804705..d3091fa 100644
--- a/porting/npl/linux/src/os_callout.c
+++ b/porting/npl/linux/src/os_callout.c
@@ -129,3 +129,30 @@ ble_npl_callout_get_ticks(struct ble_npl_callout *co)
 {
     return co->c_ticks;
 }
+
+void
+ble_npl_callout_set_arg(struct ble_npl_callout *co, void *arg)
+{
+    co->c_ev.ev_arg = arg;
+}
+
+uint32_t
+ble_npl_callout_remaining_ticks(struct ble_npl_callout *co,
+                                ble_npl_time_t now)
+{
+    ble_npl_time_t rt;
+    uint32_t exp;
+
+    struct itimerspec its;
+    timer_gettime(co->c_timer, &its);
+
+    exp = its.it_value.tv_sec * 1000;
+
+    if (exp > now) {
+        rt = exp - now;
+    } else {
+        rt = 0;
+    }
+
+    return rt;
+}
diff --git a/porting/npl/linux/src/os_eventq.cc b/porting/npl/linux/src/os_eventq.cc
index 0415836..2ede70b 100644
--- a/porting/npl/linux/src/os_eventq.cc
+++ b/porting/npl/linux/src/os_eventq.cc
@@ -46,6 +46,18 @@ ble_npl_eventq_init(struct ble_npl_eventq *evq)
     evq->q = new wqueue_t();
 }
 
+bool
+ble_npl_eventq_is_empty(struct ble_npl_eventq *evq)
+{
+    wqueue_t *q = static_cast<wqueue_t *>(evq->q);
+
+    if (q->size()) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
 int
 ble_npl_eventq_inited(const struct ble_npl_eventq *evq)
 {
diff --git a/porting/npl/linux/src/os_time.c b/porting/npl/linux/src/os_time.c
index 613e299..6df2e25 100644
--- a/porting/npl/linux/src/os_time.c
+++ b/porting/npl/linux/src/os_time.c
@@ -23,6 +23,7 @@
 #include "os/os.h"
 #include "nimble/nimble_npl.h"
 
+#include <unistd.h>
 #include <time.h>
 
 /**
@@ -63,3 +64,9 @@ uint32_t ble_npl_time_ticks_to_ms32(ble_npl_time_t ticks)
 {
     return ticks;
 }
+
+void
+ble_npl_time_delay(ble_npl_time_t ticks)
+{
+    sleep(ble_npl_time_ticks_to_ms32(ticks)/1000);
+}


[mynewt-nimble] 05/05: Fixed build error of Mesh stack for 64-bit machine

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ba6ce7dfddd55da4b82e48de9b194357eb63f753
Author: Mehul Hirpara <me...@inedasystems.com>
AuthorDate: Thu Nov 1 09:20:47 2018 +0530

    Fixed build error of Mesh stack for 64-bit machine
---
 nimble/host/mesh/src/testing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nimble/host/mesh/src/testing.c b/nimble/host/mesh/src/testing.c
index caf55dd..4a0f1da 100644
--- a/nimble/host/mesh/src/testing.c
+++ b/nimble/host/mesh/src/testing.c
@@ -97,7 +97,7 @@ void bt_test_print_credentials(void)
 	struct bt_mesh_subnet *sub;
 	struct bt_mesh_app_key *app_key;
 
-	console_printf("IV Index: %08lx\n", bt_mesh.iv_index);
+	console_printf("IV Index: %08lx\n", (long) bt_mesh.iv_index);
 	console_printf("Dev key: %s\n", bt_hex(bt_mesh.dev_key, 16));
 
 	for (i = 0; i < MYNEWT_VAL(BLE_MESH_SUBNET_COUNT); ++i)


[mynewt-nimble] 01/05: [porting][linux] Fixed build errors when BLE Mesh Shell is disabled

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit dfe8035947137e7e8993740e2001870b4196a523
Author: Mehul Hirpara <me...@inedasystems.com>
AuthorDate: Wed Oct 24 16:48:30 2018 +0530

    [porting][linux] Fixed build errors when BLE Mesh Shell is disabled
---
 nimble/host/mesh/src/testing.c              |  4 ++++
 porting/npl/linux/include/console/console.h | 35 +++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/nimble/host/mesh/src/testing.c b/nimble/host/mesh/src/testing.c
index 096cff6..caf55dd 100644
--- a/nimble/host/mesh/src/testing.c
+++ b/nimble/host/mesh/src/testing.c
@@ -157,7 +157,11 @@ void bt_test_print_credentials(void)
 
 int bt_test_shell_init(void)
 {
+#if MYNEWT_VAL(BLE_MESH_SHELL)
 	return cmd_mesh_init(0, NULL);
+#else
+	return -ENOTSUP;
+#endif
 }
 
 int bt_test_bind_app_key_to_model(struct bt_mesh_model *model, u16_t key_idx, u16_t id)
diff --git a/porting/npl/linux/include/console/console.h b/porting/npl/linux/include/console/console.h
new file mode 100644
index 0000000..ccbfc01
--- /dev/null
+++ b/porting/npl/linux/include/console/console.h
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef __CONSOLE_H__
+#define __CONSOLE_H__
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define console_printf(_fmt, ...) printf(_fmt, ##__VA_ARGS__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CONSOLE_H__ */


[mynewt-nimble] 03/05: Dynamically considering pointer size to support multiple platforms

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e6fd6e948a4d49263d280127241680b636ed344a
Author: Mehul Hirpara <me...@inedasystems.com>
AuthorDate: Wed Oct 24 17:48:07 2018 +0530

    Dynamically considering pointer size to support multiple platforms
    
    This change helps filling bt_mesh_adv buffer correctly while sending
    secure beacons (on Linux platform).
---
 nimble/host/mesh/src/adv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nimble/host/mesh/src/adv.h b/nimble/host/mesh/src/adv.h
index d37e0d4..8e76e41 100644
--- a/nimble/host/mesh/src/adv.h
+++ b/nimble/host/mesh/src/adv.h
@@ -17,7 +17,7 @@
 #define BT_MESH_ADV_DATA_SIZE 31
 
 /* The user data is a pointer (4 bytes) to struct bt_mesh_adv */
-#define BT_MESH_ADV_USER_DATA_SIZE 4
+#define BT_MESH_ADV_USER_DATA_SIZE (sizeof(struct bt_mesh_adv *))
 
 #define BT_MESH_MBUF_HEADER_SIZE (sizeof(struct os_mbuf_pkthdr) + \
                                     BT_MESH_ADV_USER_DATA_SIZE +\