You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/06/05 03:30:52 UTC

incubator-mynewt-core git commit: Add privacy stubs for native ble

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop b256be023 -> e128963da


Add privacy stubs for native ble


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

Branch: refs/heads/develop
Commit: e128963daba172c2f221e94d940cefe07e82c0b2
Parents: b256be0
Author: William San Filippo <wi...@runtime.io>
Authored: Sat Jun 4 20:29:54 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Sat Jun 4 20:30:36 2016 -0700

----------------------------------------------------------------------
 net/nimble/drivers/native/include/ble/xcvr.h |   6 ++
 net/nimble/drivers/native/src/ble_hw.c       | 124 ++++++++++++++++------
 net/nimble/drivers/native/src/ble_phy.c      |  15 +++
 3 files changed, 113 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e128963d/net/nimble/drivers/native/include/ble/xcvr.h
----------------------------------------------------------------------
diff --git a/net/nimble/drivers/native/include/ble/xcvr.h b/net/nimble/drivers/native/include/ble/xcvr.h
index 34abd7a..54b580c 100644
--- a/net/nimble/drivers/native/include/ble/xcvr.h
+++ b/net/nimble/drivers/native/include/ble/xcvr.h
@@ -29,4 +29,10 @@
 #define XCVR_RX_SCHED_DELAY_USECS     \
     (XCVR_RX_START_DELAY_USECS + XCVR_PROC_DELAY_USECS)
 
+/*
+ * Define HW whitelist size. This is the total possible whitelist size;
+ * not necessarily the size that will be used (may be smaller)
+ */
+#define BLE_HW_WHITE_LIST_SIZE        (0)
+
 #endif /* H_BLE_XCVR_ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e128963d/net/nimble/drivers/native/src/ble_hw.c
----------------------------------------------------------------------
diff --git a/net/nimble/drivers/native/src/ble_hw.c b/net/nimble/drivers/native/src/ble_hw.c
index 1b8c10f..bb30c53 100644
--- a/net/nimble/drivers/native/src/ble_hw.c
+++ b/net/nimble/drivers/native/src/ble_hw.c
@@ -6,7 +6,7 @@
  * 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,
@@ -22,6 +22,7 @@
 #include <string.h>
 #include "os/os.h"
 #include "nimble/ble.h"
+#include "nimble/nimble_opt.h"
 #include "controller/ble_hw.h"
 
 /* Total number of white list elements supported by nrf52 */
@@ -32,8 +33,8 @@ static uint8_t g_ble_hw_whitelist_mask;
 
 /**
  * Clear the whitelist
- * 
- * @return int 
+ *
+ * @return int
  */
 void
 ble_hw_whitelist_clear(void)
@@ -42,11 +43,11 @@ ble_hw_whitelist_clear(void)
 }
 
 /**
- * Add a device to the hw whitelist 
- * 
- * @param addr 
- * @param addr_type 
- * 
+ * Add a device to the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
  * @return int 0: success, BLE error code otherwise
  */
 int
@@ -56,11 +57,11 @@ ble_hw_whitelist_add(uint8_t *addr, uint8_t addr_type)
 }
 
 /**
- * Remove a device from the hw whitelist 
- * 
- * @param addr 
- * @param addr_type 
- * 
+ * Remove a device from the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
  */
 void
 ble_hw_whitelist_rmv(uint8_t *addr, uint8_t addr_type)
@@ -69,8 +70,8 @@ ble_hw_whitelist_rmv(uint8_t *addr, uint8_t addr_type)
 }
 
 /**
- * Returns the size of the whitelist in HW 
- * 
+ * Returns the size of the whitelist in HW
+ *
  * @return int Number of devices allowed in whitelist
  */
 uint8_t
@@ -80,7 +81,7 @@ ble_hw_whitelist_size(void)
 }
 
 /**
- * Enable the whitelisted devices 
+ * Enable the whitelisted devices
  */
 void
 ble_hw_whitelist_enable(void)
@@ -89,7 +90,7 @@ ble_hw_whitelist_enable(void)
 }
 
 /**
- * Disables the whitelisted devices 
+ * Disables the whitelisted devices
  */
 void
 ble_hw_whitelist_disable(void)
@@ -98,10 +99,10 @@ ble_hw_whitelist_disable(void)
 }
 
 /**
- * Boolean function which returns true ('1') if there is a match on the 
- * whitelist. 
- * 
- * @return int 
+ * Boolean function which returns true ('1') if there is a match on the
+ * whitelist.
+ *
+ * @return int
  */
 int
 ble_hw_whitelist_match(void)
@@ -118,11 +119,11 @@ ble_hw_encrypt_block(struct ble_encryption_block *ecb)
 
 /**
  * Initialize the random number generator
- * 
- * @param cb 
- * @param bias 
- * 
- * @return int 
+ *
+ * @param cb
+ * @param bias
+ *
+ * @return int
  */
 int
 ble_hw_rng_init(ble_rng_isr_cb_t cb, int bias)
@@ -132,8 +133,8 @@ ble_hw_rng_init(ble_rng_isr_cb_t cb, int bias)
 
 /**
  * Start the random number generator
- * 
- * @return int 
+ *
+ * @return int
  */
 int
 ble_hw_rng_start(void)
@@ -143,8 +144,8 @@ ble_hw_rng_start(void)
 
 /**
  * Stop the random generator
- * 
- * @return int 
+ *
+ * @return int
  */
 int
 ble_hw_rng_stop(void)
@@ -154,11 +155,70 @@ ble_hw_rng_stop(void)
 
 /**
  * Read the random number generator.
- * 
- * @return uint8_t 
+ *
+ * @return uint8_t
  */
 uint8_t
 ble_hw_rng_read(void)
 {
     return 0;
 }
+
+#if (BLE_LL_CFG_FEAT_LL_PRIVACY == 1)
+/**
+ * Clear the resolving list
+ *
+ * @return int
+ */
+void
+ble_hw_resolv_list_clear(void)
+{
+}
+
+/**
+ * Add a device to the hw resolving list
+ *
+ * @param irk   Pointer to IRK to add
+ *
+ * @return int 0: success, BLE error code otherwise
+ */
+int
+ble_hw_resolv_list_add(uint8_t *irk)
+{
+    return BLE_ERR_MEM_CAPACITY;
+}
+
+/**
+ * Remove a device from the hw resolving list
+ *
+ * @param index Index of IRK to remove
+ */
+void
+ble_hw_resolv_list_rmv(int index)
+{
+}
+
+/**
+ * Returns the size of the resolving list. NOTE: this returns the maximum
+ * allowable entries in the HW. Configuration options may limit this.
+ *
+ * @return int Number of devices allowed in resolving list
+ */
+uint8_t
+ble_hw_resolv_list_size(void)
+{
+    return 0;
+}
+
+/**
+ * Called to determine if the address received was resolved.
+ *
+ * @return int  Negative values indicate unresolved address; positive values
+ *              indicate index in resolving list of resolved address.
+ */
+int
+ble_hw_resolv_list_match(void)
+{
+    return -1;
+}
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e128963d/net/nimble/drivers/native/src/ble_phy.c
----------------------------------------------------------------------
diff --git a/net/nimble/drivers/native/src/ble_phy.c b/net/nimble/drivers/native/src/ble_phy.c
index 6b302aa..e2c9f25 100644
--- a/net/nimble/drivers/native/src/ble_phy.c
+++ b/net/nimble/drivers/native/src/ble_phy.c
@@ -32,6 +32,7 @@ struct ble_phy_obj
     uint8_t phy_state;
     uint8_t phy_transition;
     uint8_t phy_rx_started;
+    uint8_t phy_privacy;
     uint32_t phy_access_address;
     struct os_mbuf *rxpdu;
     void *txend_arg;
@@ -508,3 +509,17 @@ ble_phy_max_data_pdu_pyld(void)
 {
     return BLE_LL_DATA_PDU_MAX_PYLD;
 }
+
+#if (BLE_LL_CFG_FEAT_LL_PRIVACY == 1)
+void
+ble_phy_resolv_list_enable(void)
+{
+    g_ble_phy_data.phy_privacy = 1;
+}
+
+void
+ble_phy_resolv_list_disable(void)
+{
+    g_ble_phy_data.phy_privacy = 0;
+}
+#endif