You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2017/05/18 08:51:23 UTC
[10/12] incubator-mynewt-core git commit: nimble/controller: Add
access address constraints for LE Coded PHY
nimble/controller: Add access address constraints for LE Coded PHY
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/1f5c04d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/1f5c04d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/1f5c04d2
Branch: refs/heads/bluetooth5
Commit: 1f5c04d24b144de3cbccfa422ca7f26a2641f261
Parents: b07f4a7
Author: Andrzej Kaczmarek <an...@codecoup.pl>
Authored: Wed May 10 17:58:23 2017 +0200
Committer: Andrzej Kaczmarek <an...@codecoup.pl>
Committed: Wed May 17 11:56:17 2017 +0200
----------------------------------------------------------------------
net/nimble/controller/src/ble_ll_conn.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/1f5c04d2/net/nimble/controller/src/ble_ll_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn.c b/net/nimble/controller/src/ble_ll_conn.c
index 2aefdcd..f6a7379 100644
--- a/net/nimble/controller/src/ble_ll_conn.c
+++ b/net/nimble/controller/src/ble_ll_conn.c
@@ -531,6 +531,7 @@ ble_ll_conn_calc_access_addr(void)
uint8_t bits_diff;
uint8_t consecutive;
uint8_t transitions;
+ uint8_t ones;
/* Calculate a random access address */
aa = 0;
@@ -570,6 +571,7 @@ ble_ll_conn_calc_access_addr(void)
/* Cannot have more than 24 transitions */
transitions = 0;
consecutive = 0;
+ ones = 0;
mask = 0x00000001;
while (mask < 0x80000000) {
prev_bit = aa & mask;
@@ -590,14 +592,33 @@ ble_ll_conn_calc_access_addr(void)
}
}
+ if (prev_bit) {
+ ones++;
+ }
+
+ /* 8 lsb should have at least three 1 */
+ if (mask == 0x00000100 && ones < 3) {
+ break;
+ }
+
+ /* 16 lsb should have no more than 11 transitions */
+ if (mask == 0x00010000 && transitions > 11) {
+ break;
+ }
+
/* This is invalid! */
if (consecutive > 6) {
break;
}
}
+ /* Invalid sequence found */
+ if (mask != 0x80000000) {
+ continue;
+ }
+
/* Cannot be more than 24 transitions */
- if ((consecutive > 6) || (transitions > 24)) {
+ if (transitions > 24) {
continue;
}