You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/05/04 02:22:46 UTC

[1/2] incubator-mynewt-core git commit: BLE Host - use big endian for iBeacon ver fields.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop c3c1c2462 -> fd3d28ea7


BLE Host - use big endian for iBeacon ver fields.


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/478eaad8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/478eaad8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/478eaad8

Branch: refs/heads/develop
Commit: 478eaad89cf2efb71e9c0dc7bc430f49ba199dca
Parents: c3c1c24
Author: Christopher Collins <cc...@apache.org>
Authored: Mon May 2 15:43:00 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue May 3 17:20:07 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_ibeacon.c |  4 +-
 net/nimble/include/nimble/ble.h   |  6 +++
 net/nimble/src/util.c             | 84 ++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/478eaad8/net/nimble/host/src/ble_ibeacon.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_ibeacon.c b/net/nimble/host/src/ble_ibeacon.c
index 896dc10..db34dfb 100644
--- a/net/nimble/host/src/ble_ibeacon.c
+++ b/net/nimble/host/src/ble_ibeacon.c
@@ -42,8 +42,8 @@ ble_ibeacon_set_adv_data(void *uuid128, uint16_t major, uint16_t minor)
     memcpy(buf + 4, uuid128, 16);
 
     /** Version number. */
-    htole16(buf + 20, major);
-    htole16(buf + 22, minor);
+    htobe16(buf + 20, major);
+    htobe16(buf + 22, minor);
 
     /** Last byte (tx power level) filled in after HCI exchange. */
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/478eaad8/net/nimble/include/nimble/ble.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/ble.h b/net/nimble/include/nimble/ble.h
index c0b5b74..9081b8c 100644
--- a/net/nimble/include/nimble/ble.h
+++ b/net/nimble/include/nimble/ble.h
@@ -127,12 +127,18 @@ extern uint8_t g_random_addr[BLE_DEV_ADDR_LEN];
 #undef le16toh
 #undef le32toh
 #undef le64toh
+#undef htobe16
+#undef htobe32
+#undef htobe64
 void htole16(void *buf, uint16_t x);
 void htole32(void *buf, uint32_t x);
 void htole64(void *buf, uint64_t x);
 uint16_t le16toh(void *buf);
 uint32_t le32toh(void *buf);
 uint64_t le64toh(void *buf);
+void htobe16(void *buf, uint16_t x);
+void htobe32(void *buf, uint32_t x);
+void htobe64(void *buf, uint64_t x);
 void swap_in_place(void *buf, int len);
 void swap_buf(uint8_t *dst, uint8_t *src, int len);
 /* XXX */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/478eaad8/net/nimble/src/util.c
----------------------------------------------------------------------
diff --git a/net/nimble/src/util.c b/net/nimble/src/util.c
index c6f2a43..d0056df 100644
--- a/net/nimble/src/util.c
+++ b/net/nimble/src/util.c
@@ -105,6 +105,90 @@ le64toh(void *buf)
 }
 
 void
+htobe16(void *buf, uint16_t x)
+{
+    uint8_t *u8ptr;
+
+    u8ptr = buf;
+    u8ptr[0] = (uint8_t)(x >> 8);
+    u8ptr[1] = (uint8_t)x;
+}
+
+void
+htobe32(void *buf, uint32_t x)
+{
+    uint8_t *u8ptr;
+
+    u8ptr = buf;
+    u8ptr[0] = (uint8_t)(x >> 24);
+    u8ptr[1] = (uint8_t)(x >> 16);
+    u8ptr[2] = (uint8_t)(x >> 8);
+    u8ptr[3] = (uint8_t)x;
+}
+
+void
+htobe64(void *buf, uint64_t x)
+{
+    uint8_t *u8ptr;
+
+    u8ptr = buf;
+    u8ptr[0] = (uint8_t)(x >> 56);
+    u8ptr[1] = (uint8_t)(x >> 48);
+    u8ptr[2] = (uint8_t)(x >> 40);
+    u8ptr[3] = (uint8_t)(x >> 32);
+    u8ptr[4] = (uint8_t)(x >> 24);
+    u8ptr[5] = (uint8_t)(x >> 16);
+    u8ptr[6] = (uint8_t)(x >> 8);
+    u8ptr[7] = (uint8_t)x;
+}
+
+uint16_t
+be16toh(void *buf)
+{
+    uint16_t x;
+    uint8_t *u8ptr;
+
+    u8ptr = buf;
+    x = (uint16_t)u8ptr[0] << 8;
+    x |= u8ptr[1];
+
+    return x;
+}
+
+uint32_t
+be32toh(void *buf)
+{
+    uint32_t x;
+    uint8_t *u8ptr;
+
+    u8ptr = buf;
+    x = (uint32_t)u8ptr[0] << 24;
+    x |= (uint32_t)u8ptr[1] << 16;
+    x |= (uint32_t)u8ptr[2] << 8;
+    x |= u8ptr[3];
+
+    return x;
+}
+
+uint64_t
+be64toh(void *buf)
+{
+    uint64_t x;
+    uint8_t *u8ptr;
+
+    u8ptr = buf;
+    x = (uint64_t)u8ptr[0] << 56;
+    x |= (uint64_t)u8ptr[1] << 48;
+    x |= (uint64_t)u8ptr[2] << 40;
+    x |= (uint64_t)u8ptr[3] << 32;
+    x |= (uint64_t)u8ptr[4] << 24;
+    x |= (uint64_t)u8ptr[5] << 16;
+    x |= (uint64_t)u8ptr[6] << 8;
+    x |= u8ptr[7];
+
+    return x;
+}
+void
 swap_in_place(void *buf, int len)
 {
     uint8_t *u8ptr;


[2/2] incubator-mynewt-core git commit: bleprph - increase stack size.

Posted by cc...@apache.org.
bleprph - increase stack size.


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/fd3d28ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/fd3d28ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/fd3d28ea

Branch: refs/heads/develop
Commit: fd3d28ea780a4e38891aabb7ceaec5c6cf3b263a
Parents: 478eaad
Author: Christopher Collins <cc...@apache.org>
Authored: Mon May 2 15:58:15 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue May 3 17:20:16 2016 -0700

----------------------------------------------------------------------
 apps/bleprph/src/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fd3d28ea/apps/bleprph/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleprph/src/main.c b/apps/bleprph/src/main.c
index a9d8657..55c6a74 100755
--- a/apps/bleprph/src/main.c
+++ b/apps/bleprph/src/main.c
@@ -61,7 +61,7 @@ struct log bleprph_log;
 #define BLEPRPH_BLE_HS_PRIO         (1)
 
 /** bleprph task settings. */
-#define BLEPRPH_STACK_SIZE          (OS_STACK_ALIGN(200))
+#define BLEPRPH_STACK_SIZE          (OS_STACK_ALIGN(288))
 #define BLEPRPH_TASK_PRIO           (BLEPRPH_BLE_HS_PRIO + 1)
 
 struct os_eventq bleprph_evq;