[mynewt-core] branch master updated (2a9184f -> 3d41bd3)

2018-03-12 Thread rymek
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-core.git.


from 2a9184f  Fix build errors in BSP
 add dc600a0  nimble/dtm: Allow for being late on RX start timer
 new 3d41bd3  Merge pull request #866 from rymanluk/dtm_impr

The 1 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:
 net/nimble/controller/src/ble_ll_dtm.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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


[GitHub] rymanluk closed pull request #866: nimble/dtm: Couple of improvements helping in RF testing.

2018-03-12 Thread GitBox
rymanluk closed pull request #866: nimble/dtm: Couple of improvements helping 
in RF testing.
URL: https://github.com/apache/mynewt-core/pull/866
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/net/nimble/controller/src/ble_ll_dtm.c 
b/net/nimble/controller/src/ble_ll_dtm.c
index 23a5cfcb2..e014d249e 100644
--- a/net/nimble/controller/src/ble_ll_dtm.c
+++ b/net/nimble/controller/src/ble_ll_dtm.c
@@ -311,7 +311,9 @@ ble_ll_dtm_rx_start(void)
 
 rc = ble_phy_setchan(channel_rf_to_index[g_ble_ll_dtm_ctx.rf_channel],
  BLE_DTM_SYNC_WORD, BLE_DTM_CRC);
-assert(rc == 0);
+if (rc) {
+return rc;
+}
 
 #if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY) || 
MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY))
 ble_phy_mode_set(g_ble_ll_dtm_ctx.phy_mode, g_ble_ll_dtm_ctx.phy_mode);
@@ -319,7 +321,9 @@ ble_ll_dtm_rx_start(void)
 
 rc = ble_phy_rx_set_start_time(os_cputime_get32() +
g_ble_ll_sched_offset_ticks, 0);
-assert(rc == 0);
+if (rc && rc != BLE_PHY_ERR_RX_LATE) {
+return rc;
+}
 
 ble_ll_state_set(BLE_LL_STATE_DTM);
 


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] 01/01: Merge pull request #866 from rymanluk/dtm_impr

2018-03-12 Thread rymek
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-core.git

commit 3d41bd30587911376a748fdd5cd12260edb95fc6
Merge: 2a9184f dc600a0
Author: Łukasz Rymanowski 
AuthorDate: Mon Mar 12 08:49:22 2018 +0100

Merge pull request #866 from rymanluk/dtm_impr

nimble/dtm: Allow RX being late

 net/nimble/controller/src/ble_ll_dtm.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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


[GitHub] andrzej-kaczmarek commented on issue #903: service/ans: don't depent on libm for creating bitmask

2018-03-12 Thread GitBox
andrzej-kaczmarek commented on issue #903: service/ans: don't depent on libm 
for creating bitmask
URL: https://github.com/apache/mynewt-core/pull/903#issuecomment-372240114
 
 
   This looks good, but please squash this into single commit - the commit 
message for 2nd commit does not look good ;-)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mehulhirpara commented on issue #895: Nimble host tests are not running due to compilation issue

2018-03-12 Thread GitBox
mehulhirpara commented on issue #895: Nimble host tests are not running due to 
compilation issue
URL: https://github.com/apache/mynewt-core/issues/895#issuecomment-372240285
 
 
   Thanks for the info and to provide support for older version of GCC.
   
   FYI, I upgraded GCC from 4.8 to 4.9 as mentioned 
[here](https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu)
 but still facing same issue.
   
   Build logs for reference: 
[nimble_host_test_compilation_log_gcc4.9.txt](https://github.com/apache/mynewt-core/files/1802078/nimble_host_test_compilation_log_gcc4.9.txt)
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-newt] branch master updated (213c75b -> 62a7a09)

2018-03-12 Thread utzig
This is an automated email from the ASF dual-hosted git repository.

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


from 213c75b  Merge pull request #140 from ccollins476ad/repodeps
 new 30cca83  master newt version ahead of releases
 new 62a7a09  Make 1.4.0-dev distinct from 1.4.0 in repo compat check

The 2 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:
 newt/newtutil/newtutil.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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


[mynewt-newt] 02/02: Make 1.4.0-dev distinct from 1.4.0 in repo compat check

2018-03-12 Thread utzig
This is an automated email from the ASF dual-hosted git repository.

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

commit 62a7a09a22f0c8d609def0e64ef45d38d43cb5f9
Author: Fabio Utzig 
AuthorDate: Fri Mar 9 08:37:53 2018 -0300

Make 1.4.0-dev distinct from 1.4.0 in repo compat check
---
 newt/newtutil/newtutil.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newt/newtutil/newtutil.go b/newt/newtutil/newtutil.go
index ca2e7ac..d15770d 100644
--- a/newt/newtutil/newtutil.go
+++ b/newt/newtutil/newtutil.go
@@ -31,7 +31,7 @@ import (
"mynewt.apache.org/newt/yaml"
 )
 
-var NewtVersion Version = Version{1, 4, 0}
+var NewtVersion Version = Version{1, 3, }
 var NewtVersionStr string = "Apache Newt version: 1.4.0-dev"
 var NewtBlinkyTag string = "master"
 var NewtNumJobs int

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


[mynewt-newt] 01/02: master newt version ahead of releases

2018-03-12 Thread utzig
This is an automated email from the ASF dual-hosted git repository.

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

commit 30cca831a5d319d9ece86e4772432ebd582dbe2a
Author: Paul LaCrosse 
AuthorDate: Tue Dec 5 08:22:01 2017 -0500

master newt version ahead of releases
---
 newt/newtutil/newtutil.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/newt/newtutil/newtutil.go b/newt/newtutil/newtutil.go
index a4e1d6b..ca2e7ac 100644
--- a/newt/newtutil/newtutil.go
+++ b/newt/newtutil/newtutil.go
@@ -31,9 +31,9 @@ import (
"mynewt.apache.org/newt/yaml"
 )
 
-var NewtVersion Version = Version{1, 3, 0}
-var NewtVersionStr string = "Apache Newt version: 1.3.0"
-var NewtBlinkyTag string = "mynewt_1_3_0_tag"
+var NewtVersion Version = Version{1, 4, 0}
+var NewtVersionStr string = "Apache Newt version: 1.4.0-dev"
+var NewtBlinkyTag string = "master"
 var NewtNumJobs int
 var NewtForce bool
 var NewtAsk bool

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


[GitHub] utzig closed pull request #146: make master newt version ahead of releases

2018-03-12 Thread GitBox
utzig closed pull request #146: make master newt version ahead of releases
URL: https://github.com/apache/mynewt-newt/pull/146
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/newt/newtutil/newtutil.go b/newt/newtutil/newtutil.go
index a4e1d6b2..d15770d9 100644
--- a/newt/newtutil/newtutil.go
+++ b/newt/newtutil/newtutil.go
@@ -31,9 +31,9 @@ import (
"mynewt.apache.org/newt/yaml"
 )
 
-var NewtVersion Version = Version{1, 3, 0}
-var NewtVersionStr string = "Apache Newt version: 1.3.0"
-var NewtBlinkyTag string = "mynewt_1_3_0_tag"
+var NewtVersion Version = Version{1, 3, }
+var NewtVersionStr string = "Apache Newt version: 1.4.0-dev"
+var NewtBlinkyTag string = "master"
 var NewtNumJobs int
 var NewtForce bool
 var NewtAsk bool


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig commented on issue #115: make master newt version ahead of releases

2018-03-12 Thread GitBox
utzig commented on issue #115: make master newt version ahead of releases
URL: https://github.com/apache/mynewt-newt/pull/115#issuecomment-372251763
 
 
   Superseded by #146.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig closed pull request #115: make master newt version ahead of releases

2018-03-12 Thread GitBox
utzig closed pull request #115: make master newt version ahead of releases
URL: https://github.com/apache/mynewt-newt/pull/115
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/newt/newtutil/newtutil.go b/newt/newtutil/newtutil.go
index b092a8b2..8f28eb2a 100644
--- a/newt/newtutil/newtutil.go
+++ b/newt/newtutil/newtutil.go
@@ -35,8 +35,8 @@ import (
"mynewt.apache.org/newt/viper"
 )
 
-var NewtVersion Version = Version{1, 2, 0}
-var NewtVersionStr string = "Apache Newt version: 1.2.0-dev"
+var NewtVersion Version = Version{1, 4, 0}
+var NewtVersionStr string = "Apache Newt version: 1.4.0-dev"
 var NewtBlinkyTag string = "master"
 var NewtNumJobs int
 var NewtForce bool


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig commented on issue #115: make master newt version ahead of releases

2018-03-12 Thread GitBox
utzig commented on issue #115: make master newt version ahead of releases
URL: https://github.com/apache/mynewt-newt/pull/115#issuecomment-372251763
 
 
   Fixed with #146.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] sdalu commented on issue #903: service/ans: don't depent on libm for creating bitmask

2018-03-12 Thread GitBox
sdalu commented on issue #903: service/ans: don't depent on libm for creating 
bitmask
URL: https://github.com/apache/mynewt-core/pull/903#issuecomment-372254304
 
 
   I'm not particularly good at git, could you give me the command line to do 
it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] sdalu commented on issue #903: service/ans: don't depent on libm for creating bitmask

2018-03-12 Thread GitBox
sdalu commented on issue #903: service/ans: don't depent on libm for creating 
bitmask
URL: https://github.com/apache/mynewt-core/pull/903#issuecomment-372254304
 
 
   I'm not particularly good at git, could you give me the command line to do 
it.
   Isn't squashing done automatically when merging pull-request?
   
https://help.github.com/articles/about-pull-request-merges/#squash-and-merge-your-pull-request-commits


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU

2018-03-12 Thread GitBox
utzig commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU
URL: https://github.com/apache/mynewt-core/pull/897#issuecomment-372263470
 
 
   Hardcoded stm32f4x and stm32f7x number of vectors with 2f99168


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig commented on issue #903: service/ans: don't depent on libm for creating bitmask

2018-03-12 Thread GitBox
utzig commented on issue #903: service/ans: don't depent on libm for creating 
bitmask
URL: https://github.com/apache/mynewt-core/pull/903#issuecomment-372268917
 
 
   Yes, you can "squash and merge" and rewrite the commit message directly in 
the interface.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig commented on issue #902: Feature: stm32 f3/f7 pll clk off HSI

2018-03-12 Thread GitBox
utzig commented on issue #902: Feature: stm32 f3/f7 pll clk off HSI
URL: https://github.com/apache/mynewt-core/pull/902#issuecomment-372272265
 
 
   Looks good. Would you mind also applying the changes you did for the 
`nucleo-f303*` to `stm32f3discovery`?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mkiiskila opened a new pull request #905: Possible integer overflows when computing malloc sizes

2018-03-12 Thread GitBox
mkiiskila opened a new pull request #905: Possible integer overflows when 
computing malloc sizes
URL: https://github.com/apache/mynewt-core/pull/905
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig opened a new pull request #906: Add flash area config for nffs/reboot/config/coredump

2018-03-12 Thread GitBox
utzig opened a new pull request #906: Add flash area config for 
nffs/reboot/config/coredump
URL: https://github.com/apache/mynewt-core/pull/906
 
 
   This allows building/testing with slinky on stm32f3.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mkiiskila commented on issue #824: Add stm32 common hal for shared drivers

2018-03-12 Thread GitBox
mkiiskila commented on issue #824: Add stm32 common hal for shared drivers
URL: https://github.com/apache/mynewt-core/pull/824#issuecomment-372279244
 
 
   hal_debugger_connected() if-statement should be behind MCU specific macro 
too. E.g. I'm not sure it's possible to do that check on STM32L1.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: Fix boot script name for nucleo-f413

2018-03-12 Thread utzig
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new b9e3b60  Fix boot script name for nucleo-f413
b9e3b60 is described below

commit b9e3b605e971a5a4765a86009d334e2b29c38648
Author: Fabio Utzig 
AuthorDate: Fri Mar 9 17:12:57 2018 -0300

Fix boot script name for nucleo-f413
---
 hw/bsp/nucleo-f413zh/{boot-nucleo413zh.ld => boot-nucleo-f413zh.ld} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/hw/bsp/nucleo-f413zh/boot-nucleo413zh.ld 
b/hw/bsp/nucleo-f413zh/boot-nucleo-f413zh.ld
similarity index 100%
rename from hw/bsp/nucleo-f413zh/boot-nucleo413zh.ld
rename to hw/bsp/nucleo-f413zh/boot-nucleo-f413zh.ld

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


[GitHub] utzig closed pull request #899: Fix boot script name for nucleo-f413

2018-03-12 Thread GitBox
utzig closed pull request #899: Fix boot script name for nucleo-f413
URL: https://github.com/apache/mynewt-core/pull/899
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/bsp/nucleo-f413zh/boot-nucleo413zh.ld 
b/hw/bsp/nucleo-f413zh/boot-nucleo-f413zh.ld
similarity index 100%
rename from hw/bsp/nucleo-f413zh/boot-nucleo413zh.ld
rename to hw/bsp/nucleo-f413zh/boot-nucleo-f413zh.ld


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig commented on issue #824: Add stm32 common hal for shared drivers

2018-03-12 Thread GitBox
utzig commented on issue #824: Add stm32 common hal for shared drivers
URL: https://github.com/apache/mynewt-core/pull/824#issuecomment-372292227
 
 
   @mkiiskila Nice catch! It should work on STM32L1 because it is a Cortex-M3. 
But it will probably fail on STM32L0 which is Cortex-M0+ so makes sense to make 
it a macro too.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: Add stm32 common hal for shared drivers

2018-03-12 Thread utzig
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 15cef3a  Add stm32 common hal for shared drivers
15cef3a is described below

commit 15cef3a900d3003771feb81b3de1333c4da61842
Author: Fabio Utzig 
AuthorDate: Tue Feb 20 09:10:28 2018 -0300

Add stm32 common hal for shared drivers

Signed-off-by: Fabio Utzig 
---
 hw/mcu/stm/{stm32f1xx => stm32_common}/pkg.yml | 14 +
 .../{stm32l1xx => stm32_common}/src/hal_os_tick.c  |  0
 .../{stm32f4xx => stm32_common}/src/hal_system.c   |  3 +-
 .../src/hal_system_start.c |  7 ++-
 .../{stm32f1xx => stm32_common}/src/hal_watchdog.c |  5 +-
 .../src/stm32_hw_id.c} |  7 +--
 .../stm32f1xx_hw_id.c => include/mcu/stm32_hal.h}  | 38 --
 hw/mcu/stm/stm32f1xx/pkg.yml   |  2 +-
 hw/mcu/stm/stm32f1xx/src/hal_os_tick.c | 55 
 hw/mcu/stm/stm32f1xx/src/hal_system.c  | 55 
 hw/mcu/stm/stm32f1xx/src/hal_system_start.c| 54 
 .../hal_watchdog.c => include/mcu/stm32_hal.h} | 57 ++---
 hw/mcu/stm/stm32f4xx/pkg.yml   |  6 +--
 hw/mcu/stm/stm32f4xx/src/hal_os_tick.c | 55 
 .../stm32f7xx_hw_id.c => include/mcu/stm32_hal.h}  | 46 +++--
 hw/mcu/stm/stm32f7xx/pkg.yml   |  2 +-
 hw/mcu/stm/stm32f7xx/src/hal_os_tick.c | 55 
 hw/mcu/stm/stm32f7xx/src/hal_system.c  | 55 
 hw/mcu/stm/stm32f7xx/src/hal_system_start.c| 55 
 hw/mcu/stm/stm32f7xx/src/hal_watchdog.c| 59 --
 .../stm32l1xx_hw_id.c => include/mcu/stm32_hal.h}  | 44 +---
 hw/mcu/stm/stm32l1xx/pkg.yml   |  2 +-
 hw/mcu/stm/stm32l1xx/src/hal_system.c  | 55 
 hw/mcu/stm/stm32l1xx/src/hal_system_start.c| 54 
 hw/mcu/stm/stm32l1xx/src/hal_watchdog.c| 59 --
 25 files changed, 123 insertions(+), 721 deletions(-)

diff --git a/hw/mcu/stm/stm32f1xx/pkg.yml b/hw/mcu/stm/stm32_common/pkg.yml
similarity index 81%
copy from hw/mcu/stm/stm32f1xx/pkg.yml
copy to hw/mcu/stm/stm32_common/pkg.yml
index 919a3e0..90575b3 100644
--- a/hw/mcu/stm/stm32f1xx/pkg.yml
+++ b/hw/mcu/stm/stm32_common/pkg.yml
@@ -17,23 +17,13 @@
 # under the License.
 #
 
-pkg.name: hw/mcu/stm/stm32f1xx
-pkg.description: MCU definition for STM32F1 ARM Cortex-M3 chips.
+pkg.name: hw/mcu/stm/stm32_common
+pkg.description: STM32 shared drivers
 pkg.author: "Apache Mynewt "
 pkg.homepage: "http://mynewt.apache.org/";
 pkg.keywords:
 - stm32
-- stm32f1
-
-pkg.type: sdk
-
-pkg.ign_files:
-- ".*template.*"
-
-pkg.ign_dirs:
-- "Device"
 
 pkg.deps:
 - hw/hal
-- hw/mcu/stm/stm32f1xx
 - hw/cmsis-core
diff --git a/hw/mcu/stm/stm32l1xx/src/hal_os_tick.c 
b/hw/mcu/stm/stm32_common/src/hal_os_tick.c
similarity index 100%
rename from hw/mcu/stm/stm32l1xx/src/hal_os_tick.c
rename to hw/mcu/stm/stm32_common/src/hal_os_tick.c
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_system.c 
b/hw/mcu/stm/stm32_common/src/hal_system.c
similarity index 95%
rename from hw/mcu/stm/stm32f4xx/src/hal_system.c
rename to hw/mcu/stm/stm32_common/src/hal_system.c
index 2167830..57522dc 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_system.c
+++ b/hw/mcu/stm/stm32_common/src/hal_system.c
@@ -17,10 +17,9 @@
  * under the License.
  */
 
-#include 
+#include "mcu/stm32_hal.h"
 #include 
 #include "hal/hal_system.h"
-#include "stm32f4xx_hal_def.h"
 
 void
 hal_system_reset(void)
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_system_start.c 
b/hw/mcu/stm/stm32_common/src/hal_system_start.c
similarity index 91%
rename from hw/mcu/stm/stm32f4xx/src/hal_system_start.c
rename to hw/mcu/stm/stm32_common/src/hal_system_start.c
index 42c85a0..4f26632 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_system_start.c
+++ b/hw/mcu/stm/stm32_common/src/hal_system_start.c
@@ -20,7 +20,8 @@
 #include 
 #include 
 #include 
-#include 
+
+#include "mcu/stm32_hal.h"
 
 /**
  * Boots the image described by the supplied image header.
@@ -44,9 +45,7 @@ hal_system_start(void *img_start)
 jump_addr = base0entry;
 fn = (jump_fn *)jump_addr;
 
-/* Remap memory such that flash gets mapped to the code region. */
-SYSCFG->MEMRMP = 0;
-__DSB();
+STM32_HAL_FLASH_REMAP();
 
 /* Jump to image. */
 fn();
diff --git a/hw/mcu/stm/stm32f1xx/src/hal_watchdog.c 
b/hw/mcu/stm/stm32_common/src/hal_watchdog.c
similarity index 95%
rename from hw/mcu/stm/stm32f1xx/src/hal_watchdog.c
rename to hw/mcu/stm/stm32_common/src/hal_watchdog.c
index 7bc5a69..02723f0 100644
--- a/hw/mcu/stm/stm32f1xx/src/h

[GitHub] utzig closed pull request #824: Add stm32 common hal for shared drivers

2018-03-12 Thread GitBox
utzig closed pull request #824: Add stm32 common hal for shared drivers
URL: https://github.com/apache/mynewt-core/pull/824
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/mcu/stm/stm32_common/pkg.yml b/hw/mcu/stm/stm32_common/pkg.yml
new file mode 100644
index 0..90575b30f
--- /dev/null
+++ b/hw/mcu/stm/stm32_common/pkg.yml
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+pkg.name: hw/mcu/stm/stm32_common
+pkg.description: STM32 shared drivers
+pkg.author: "Apache Mynewt "
+pkg.homepage: "http://mynewt.apache.org/";
+pkg.keywords:
+- stm32
+
+pkg.deps:
+- hw/hal
+- hw/cmsis-core
diff --git a/hw/mcu/stm/stm32f1xx/src/hal_os_tick.c 
b/hw/mcu/stm/stm32_common/src/hal_os_tick.c
similarity index 100%
rename from hw/mcu/stm/stm32f1xx/src/hal_os_tick.c
rename to hw/mcu/stm/stm32_common/src/hal_os_tick.c
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_system.c 
b/hw/mcu/stm/stm32_common/src/hal_system.c
similarity index 95%
rename from hw/mcu/stm/stm32f4xx/src/hal_system.c
rename to hw/mcu/stm/stm32_common/src/hal_system.c
index 216783041..57522dc2d 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_system.c
+++ b/hw/mcu/stm/stm32_common/src/hal_system.c
@@ -17,10 +17,9 @@
  * under the License.
  */
 
-#include 
+#include "mcu/stm32_hal.h"
 #include 
 #include "hal/hal_system.h"
-#include "stm32f4xx_hal_def.h"
 
 void
 hal_system_reset(void)
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_system_start.c 
b/hw/mcu/stm/stm32_common/src/hal_system_start.c
similarity index 91%
rename from hw/mcu/stm/stm32f4xx/src/hal_system_start.c
rename to hw/mcu/stm/stm32_common/src/hal_system_start.c
index 42c85a062..4f266329d 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_system_start.c
+++ b/hw/mcu/stm/stm32_common/src/hal_system_start.c
@@ -20,7 +20,8 @@
 #include 
 #include 
 #include 
-#include 
+
+#include "mcu/stm32_hal.h"
 
 /**
  * Boots the image described by the supplied image header.
@@ -44,9 +45,7 @@ hal_system_start(void *img_start)
 jump_addr = base0entry;
 fn = (jump_fn *)jump_addr;
 
-/* Remap memory such that flash gets mapped to the code region. */
-SYSCFG->MEMRMP = 0;
-__DSB();
+STM32_HAL_FLASH_REMAP();
 
 /* Jump to image. */
 fn();
diff --git a/hw/mcu/stm/stm32l1xx/src/hal_watchdog.c 
b/hw/mcu/stm/stm32_common/src/hal_watchdog.c
similarity index 95%
rename from hw/mcu/stm/stm32l1xx/src/hal_watchdog.c
rename to hw/mcu/stm/stm32_common/src/hal_watchdog.c
index 1183fc31d..02723f0ee 100644
--- a/hw/mcu/stm/stm32l1xx/src/hal_watchdog.c
+++ b/hw/mcu/stm/stm32_common/src/hal_watchdog.c
@@ -18,8 +18,7 @@
  */
 
 #include "hal/hal_watchdog.h"
-#include "stm32l1xx_hal.h"
-#include "stm32l1xx_hal_iwdg.h"
+#include "mcu/stm32_hal.h"
 
 IWDG_HandleTypeDef g_wdt_cfg;
 
@@ -40,6 +39,7 @@ hal_watchdog_init(uint32_t expire_msecs)
 g_wdt_cfg.Instance = IWDG;
 g_wdt_cfg.Init.Prescaler = IWDG_PRESCALER_256;
 g_wdt_cfg.Init.Reload = reload;
+STM32_HAL_WATCHDOG_CUSTOM_INIT(&g_wdt_cfg);
 
 return 0;
 }
@@ -56,4 +56,3 @@ hal_watchdog_tickle(void)
 {
 HAL_IWDG_Refresh(&g_wdt_cfg);
 }
-
diff --git a/hw/mcu/stm/stm32f7xx/src/stm32f7xx_hw_id.c 
b/hw/mcu/stm/stm32_common/src/stm32_hw_id.c
similarity index 88%
rename from hw/mcu/stm/stm32f7xx/src/stm32f7xx_hw_id.c
rename to hw/mcu/stm/stm32_common/src/stm32_hw_id.c
index 684756919..4dad67af9 100644
--- a/hw/mcu/stm/stm32f7xx/src/stm32f7xx_hw_id.c
+++ b/hw/mcu/stm/stm32_common/src/stm32_hw_id.c
@@ -20,23 +20,20 @@
 #include 
 #include 
 
+#include "mcu/stm32_hal.h"
 #include 
 
 #ifndef min
 #define min(a, b) ((a)<(b)?(a):(b))
 #endif
 
-/*
- * STM32F7 has a unique 96-bit id at address 0x1FF0F420.
- * See ref manual chapter 45.1.
- */
 int
 hal_bsp_hw_id(uint8_t *id, int max_len)
 {
 int cnt;
 
 cnt = min(12, max_len);
-memcpy(id, (void *)0x1FF0F420, cnt);
+memcpy(id, (void *)STM32_HW_ID_ADDR, cnt);
 
 return cnt;
 }
diff --git a/hw/mcu/stm/stm32f1xx/src/stm32f1xx_hw_id.c 
b/hw/mcu/stm/stm32f1xx/include/mcu/stm32_ha

[GitHub] mkiiskila commented on issue #824: Add stm32 common hal for shared drivers

2018-03-12 Thread GitBox
mkiiskila commented on issue #824: Add stm32 common hal for shared drivers
URL: https://github.com/apache/mynewt-core/pull/824#issuecomment-372296130
 
 
   Indeed, STM32L0 with it?s M0 was the one I was thinking of.
   
   > On Mar 12, 2018, at 2:25 PM, Fabio Utzig  wrote:
   > 
   > @mkiiskila  Nice catch! It should work on 
STM32L1 because it is a Cortex-M3. But it will probably fail on STM32L0 which 
is Cortex-M0+ so makes sense to make it a macro too.
   > 
   > ?
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub 
, or 
mute the thread 
.
   > 
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-nimble] 03/32: nimble/gap: Remove redundant formward declaration

2018-03-12 Thread andk
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 49c1941f89c5762c2c75e9c86c662150a1bfa957
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 23:01:27 2018 +0100

nimble/gap: Remove redundant formward declaration

X-Original-Commit: b83cc69fbbb59e1bb2c80914d2a9b31698f13b76
---
 nimble/host/services/gap/include/services/gap/ble_svc_gap.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h 
b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
index bc8433d..f64c4f6 100644
--- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
+++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
@@ -24,8 +24,6 @@
 extern "C" {
 #endif
 
-struct ble_hs_cfg;
-
 #define BLE_SVC_GAP_UUID16  0x1800
 #define BLE_SVC_GAP_CHR_UUID16_DEVICE_NAME  0x2a00
 #define BLE_SVC_GAP_CHR_UUID16_APPEARANCE   0x2a01

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


[mynewt-nimble] 22/32: mesh: Use a single transmission from Friend to LPN

2018-03-12 Thread andk
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 e99920f59e5836ab75cd95fa8f71e938ebcfc368
Author: Michał Narajowski 
AuthorDate: Wed Feb 21 12:56:20 2018 +0100

mesh: Use a single transmission from Friend to LPN

As per TSE 10009 the TS will enforce that a Friend ever only uses a
single transmission when sending packets to an LPN. Make sure that our
implementation follows this.

https://www.bluetooth.org/tse/errata_view.cfm?errata_id=10009

X-Original-Commit: 564a956d1a3b291234dc1351f422830b781689f1
---
 nimble/host/mesh/src/friend.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/nimble/host/mesh/src/friend.c b/nimble/host/mesh/src/friend.c
index 9969737..42c9384 100644
--- a/nimble/host/mesh/src/friend.c
+++ b/nimble/host/mesh/src/friend.c
@@ -44,6 +44,12 @@ static struct os_mempool friend_buf_mempool;
 #define FRIEND_ADV(buf) CONTAINER_OF(BT_MESH_ADV(buf), \
 struct friend_adv, adv)
 
+/* PDUs from Friend to the LPN should only be transmitted once with the
+ * smallest possible interval (20ms).
+ */
+#define FRIEND_XMIT_COUNT   0
+#define FRIEND_XMIT_INT 20
+
 struct friend_pdu_info {
u16_t  src;
u16_t  dst;
@@ -87,15 +93,13 @@ static void discard_buffer(void)
 
 static struct os_mbuf *friend_buf_alloc(u16_t src)
 {
-   u8_t xmit = bt_mesh_net_transmit_get();
struct os_mbuf *buf;
 
do {
buf = bt_mesh_adv_create_from_pool(&friend_os_mbuf_pool, 
adv_alloc,
   BT_MESH_ADV_DATA,
-  BT_MESH_TRANSMIT_COUNT(xmit),
-  BT_MESH_TRANSMIT_INT(xmit),
-  K_NO_WAIT);
+  FRIEND_XMIT_COUNT,
+  FRIEND_XMIT_INT, K_NO_WAIT);
if (!buf) {
discard_buffer();
}

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


[mynewt-nimble] 06/32: nimble/gap: Make device name configurable via syscfg

2018-03-12 Thread andk
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 0256df284f7ae9cee12a63023a42d1dcc048fdb1
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 21:16:29 2018 +0100

nimble/gap: Make device name configurable via syscfg

This can still be overriden by app, as previously - it's just not
hardcoded.

X-Original-Commit: d8101a357beb0b541597f46e5f049af799063aff
---
 nimble/host/services/gap/src/ble_svc_gap.c | 3 ++-
 nimble/host/services/gap/syscfg.yml| 5 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index cff7210..f0dda62 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -28,7 +28,8 @@
 /* XXX: This should be configurable. */
 #define BLE_SVC_GAP_NAME_MAX_LEN31
 
-static char ble_svc_gap_name[BLE_SVC_GAP_NAME_MAX_LEN + 1] = "nimble";
+static char ble_svc_gap_name[BLE_SVC_GAP_NAME_MAX_LEN + 1] =
+MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME);
 static const uint8_t ble_svc_gap_appearance[2] = {
  (MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE)) & 0xFF,
  ((MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE)) >> 8) & 0xFF
diff --git a/nimble/host/services/gap/syscfg.yml 
b/nimble/host/services/gap/syscfg.yml
index 18bf82d..0e327fd 100644
--- a/nimble/host/services/gap/syscfg.yml
+++ b/nimble/host/services/gap/syscfg.yml
@@ -19,6 +19,11 @@
 # Package: net/nimble/host/services/gap
 
 syscfg.defs:
+BLE_SVC_GAP_DEVICE_NAME:
+description: >
+Default value for "Device Name" characteristics, unless overwritten
+by application.
+value: '"nimble"'
 BLE_SVC_GAP_APPEARANCE:
 description: 'Device appearance'
 value: 0

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


[mynewt-nimble] 27/32: Merge pull request #837 from andrzej-kaczmarek/nimble-numpktcmp-fix

2018-03-12 Thread andk
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 1ca40fe58004f0c58d80067a0ca0644bf8dcc3cd
Merge: 6014f93 1e7940c
Author: Andrzej Kaczmarek 
AuthorDate: Wed Mar 7 11:10:26 2018 +0100

Merge pull request #837 from andrzej-kaczmarek/nimble-numpktcmp-fix

nimble/ll: Fix sending HCI Number of Completed Packets event

X-Original-Commit: 356528ca3c7307d38ceb6b44ab452e9c6d74f2a9

 nimble/controller/src/ble_ll_conn_hci.c | 7 +++
 nimble/controller/syscfg.yml| 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

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


[mynewt-nimble] 15/32: mesh: Add support for OOB info and URI in provisioning data

2018-03-12 Thread andk
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 417418eaac3bee5a9237fa4db2219d66819ebeb4
Author: Michał Narajowski 
AuthorDate: Tue Feb 20 12:30:15 2018 +0100

mesh: Add support for OOB info and URI in provisioning data

Until now the OOB info and URI fields in unprovisioned beacons were
generally ignored by the implementation. Add fields for these to
bt_mesh_prov and make sure to take them into account when encoding
advertising data, both for PB-ADV and PB-GATT. For PB-ADV the URI goes
out in a separate beacon, whereas for PB-GATT it is placed in the scan
response data.

X-Original-Commit: e6b7f42e2688c2d4102dea83bf962d2fbc74ac5e
---
 nimble/host/mesh/include/mesh/glue.h |  2 ++
 nimble/host/mesh/include/mesh/main.h | 26 +
 nimble/host/mesh/src/adv.c   |  5 ++--
 nimble/host/mesh/src/adv.h   |  1 +
 nimble/host/mesh/src/beacon.c| 39 ---
 nimble/host/mesh/src/prov.c  |  4 ++--
 nimble/host/mesh/src/prov.h  |  2 +-
 nimble/host/mesh/src/proxy.c | 45 +++-
 8 files changed, 110 insertions(+), 14 deletions(-)

diff --git a/nimble/host/mesh/include/mesh/glue.h 
b/nimble/host/mesh/include/mesh/glue.h
index 4cb61c5..66c3818 100644
--- a/nimble/host/mesh/include/mesh/glue.h
+++ b/nimble/host/mesh/include/mesh/glue.h
@@ -97,6 +97,7 @@
 #define BT_DATA_SOLICIT32   0x1f /* Solicit UUIDs, 32-bit */
 #define BT_DATA_SVC_DATA32  0x20 /* Service data, 32-bit UUID */
 #define BT_DATA_SVC_DATA128 0x21 /* Service data, 128-bit UUID */
+#define BT_DATA_URI 0x24 /* URI */
 #define BT_DATA_MESH_PROV   0x29 /* Mesh Provisioning PDU */
 #define BT_DATA_MESH_MESSAGE0x2a /* Mesh Networking PDU */
 #define BT_DATA_MESH_BEACON 0x2b /* Mesh Beacon */
@@ -356,6 +357,7 @@ static inline unsigned int find_msb_set(u32_t op)
 #define CONFIG_BT_MESH_MODEL_KEY_COUNT  
MYNEWT_VAL(BLE_MESH_MODEL_KEY_COUNT)
 #define CONFIG_BT_MESH_NODE_ID_TIMEOUT  
MYNEWT_VAL(BLE_MESH_NODE_ID_TIMEOUT)
 #define CONFIG_BT_MAX_CONN  MYNEWT_VAL(BLE_MAX_CONNECTIONS)
+#define CONFIG_BT_DEVICE_NAME   "nimble-mesh"
 
 #define printk console_printf
 
diff --git a/nimble/host/mesh/include/mesh/main.h 
b/nimble/host/mesh/include/mesh/main.h
index bc3c86f..752878f 100644
--- a/nimble/host/mesh/include/mesh/main.h
+++ b/nimble/host/mesh/include/mesh/main.h
@@ -39,11 +39,37 @@ typedef enum {
BT_MESH_PROV_GATT  = BIT(1),
 } bt_mesh_prov_bearer_t;
 
+typedef enum {
+   BT_MESH_PROV_OOB_OTHER = BIT(0),
+   BT_MESH_PROV_OOB_URI   = BIT(1),
+   BT_MESH_PROV_OOB_2D_CODE   = BIT(2),
+   BT_MESH_PROV_OOB_BAR_CODE  = BIT(3),
+   BT_MESH_PROV_OOB_NFC   = BIT(4),
+   BT_MESH_PROV_OOB_NUMBER= BIT(5),
+   BT_MESH_PROV_OOB_STRING= BIT(6),
+   /* 7 - 10 are reserved */
+   BT_MESH_PROV_OOB_ON_BOX= BIT(11),
+   BT_MESH_PROV_OOB_IN_BOX= BIT(12),
+   BT_MESH_PROV_OOB_ON_PAPER  = BIT(13),
+   BT_MESH_PROV_OOB_IN_MANUAL = BIT(14),
+   BT_MESH_PROV_OOB_ON_DEV= BIT(15),
+} bt_mesh_prov_oob_info_t;
+
 /** Provisioning properties & capabilities. */
 struct bt_mesh_prov {
/** The UUID that's used when advertising as unprovisioned */
const u8_t *uuid;
 
+   /** Optional URI. This will be advertised separately from the
+*  unprovisioned beacon, however the unprovisioned beacon will
+*  contain a hash of it so the two can be associated by the
+*  provisioner.
+*/
+   const char *uri;
+
+   /** Out of Band information field. */
+   bt_mesh_prov_oob_info_t oob_info;
+
/** Static OOB value */
const u8_t *static_val;
/** Static OOB value length */
diff --git a/nimble/host/mesh/src/adv.c b/nimble/host/mesh/src/adv.c
index c8aced1..f5a032c 100644
--- a/nimble/host/mesh/src/adv.c
+++ b/nimble/host/mesh/src/adv.c
@@ -55,9 +55,10 @@ struct os_mbuf_pool adv_os_mbuf_pool;
 static struct os_mempool adv_buf_mempool;
 
 static const u8_t adv_type[] = {
-   [BT_MESH_ADV_PROV] = BLE_HS_ADV_TYPE_MESH_PROV,
-   [BT_MESH_ADV_DATA] = BLE_HS_ADV_TYPE_MESH_MESSAGE,
+   [BT_MESH_ADV_PROV]   = BLE_HS_ADV_TYPE_MESH_PROV,
+   [BT_MESH_ADV_DATA]   = BLE_HS_ADV_TYPE_MESH_MESSAGE,
[BT_MESH_ADV_BEACON] = BLE_HS_ADV_TYPE_MESH_BEACON,
+   [BT_MESH_ADV_URI]= BLE_HS_ADV_TYPE_URI,
 };
 
 
diff --git a/nimble/host/mesh/src/adv.h b/nimble/host/mesh/src/adv.h
index 27930d5..e40d667 100644
--- a/nimble/host/mesh/src/adv.h
+++ b/nimble/host/mesh/src/adv.h
@@ -28,6 +28,7 @@ enum bt_mesh_adv_type
BT_MESH_ADV_PROV,
BT_MESH_ADV_DATA,
BT_MESH_ADV_BEACON,
+   BT_MESH_ADV_URI,
 };
 
 ty

[mynewt-nimble] 05/32: nimble/gap: Add "Central Address Resolution" characteristic

2018-03-12 Thread andk
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 e77d5460c6a9cd320b07a5cb3b74a817da68863d
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 21:11:20 2018 +0100

nimble/gap: Add "Central Address Resolution" characteristic

This characteristics is mandatory for LE Central role if LL Privacy is
supported.

We could be smarter in registering it by checking controller features,
but this is quite complex to implement due to the way everything is set
up so let's leave proper configuration for user :)

X-Original-Commit: 4934ddf4afc889c0aaa932734d5bf361eb4dc042
---
 .../services/gap/include/services/gap/ble_svc_gap.h |  1 +
 nimble/host/services/gap/src/ble_svc_gap.c  | 17 +
 nimble/host/services/gap/syscfg.yml |  6 ++
 3 files changed, 24 insertions(+)

diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h 
b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
index b8dd196..f4bc213 100644
--- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
+++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
@@ -28,6 +28,7 @@ extern "C" {
 #define BLE_SVC_GAP_CHR_UUID16_DEVICE_NAME  0x2a00
 #define BLE_SVC_GAP_CHR_UUID16_APPEARANCE   0x2a01
 #define BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS  0x2a04
+#define BLE_SVC_GAP_CHR_UUID16_CENTRAL_ADDRESS_RESOLUTION   0x2aa6
 
 #define BLE_SVC_GAP_APPEARANCE_GEN_UNKNOWN 0
 #define BLE_SVC_GAP_APPEARANCE_GEN_COMPUTER128
diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index 995534e..cff7210 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -61,6 +61,13 @@ static const struct ble_gatt_svc_def ble_svc_gap_defs[] = {
 .access_cb = ble_svc_gap_access,
 .flags = BLE_GATT_CHR_F_READ,
 }, {
+#if MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION) >= 0
+/*** Characteristic: Central Address Resolution. */
+.uuid = 
BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_CENTRAL_ADDRESS_RESOLUTION),
+.access_cb = ble_svc_gap_access,
+.flags = BLE_GATT_CHR_F_READ,
+}, {
+#endif
 0, /* No more characteristics in this service. */
 } },
 },
@@ -75,6 +82,9 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t attr_handle,
struct ble_gatt_access_ctxt *ctxt, void *arg)
 {
 uint16_t uuid16;
+#if MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION) >= 0
+uint8_t central_ar = MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION);
+#endif
 int rc;
 
 uuid16 = ble_uuid_u16(ctxt->chr->uuid);
@@ -99,6 +109,13 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t 
attr_handle,
 sizeof ble_svc_gap_pref_conn_params);
 return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
 
+#if MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION) >= 0
+case BLE_SVC_GAP_CHR_UUID16_CENTRAL_ADDRESS_RESOLUTION:
+assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
+rc = os_mbuf_append(ctxt->om, ¢ral_ar, sizeof(central_ar));
+return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+#endif
+
 default:
 assert(0);
 return BLE_ATT_ERR_UNLIKELY;
diff --git a/nimble/host/services/gap/syscfg.yml 
b/nimble/host/services/gap/syscfg.yml
index f686e67..18bf82d 100644
--- a/nimble/host/services/gap/syscfg.yml
+++ b/nimble/host/services/gap/syscfg.yml
@@ -22,3 +22,9 @@ syscfg.defs:
 BLE_SVC_GAP_APPEARANCE:
 description: 'Device appearance'
 value: 0
+BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION:
+description: >
+Value of "Central Address Resolution" characteristics, as defined
+by Core specification 5.0, Vol 3, Part C, section 12.
+Set to '-1' to disable.
+value: -1

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


[mynewt-nimble] 23/32: Merge pull request #841 from michal-narajowski/mesh-zephyr-ports

2018-03-12 Thread andk
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 8feb3cade1217a0c5a1043716086919121a2e653
Merge: aaf569e e99920f
Author: Michał Narajowski 
AuthorDate: Tue Feb 27 12:06:19 2018 +0100

Merge pull request #841 from michal-narajowski/mesh-zephyr-ports

Mesh zephyr ports

X-Original-Commit: 6192e73f2685d55fa950013e2040621a5d619f77

 nimble/host/mesh/include/mesh/glue.h |  3 +++
 nimble/host/mesh/include/mesh/main.h | 26 +
 nimble/host/mesh/src/adv.c   | 32 ++---
 nimble/host/mesh/src/adv.h   |  1 +
 nimble/host/mesh/src/beacon.c| 38 +++---
 nimble/host/mesh/src/cfg_cli.c   |  6 ++---
 nimble/host/mesh/src/friend.c| 12 ++
 nimble/host/mesh/src/glue.c  |  5 
 nimble/host/mesh/src/prov.c  | 14 ---
 nimble/host/mesh/src/prov.h  |  2 +-
 nimble/host/mesh/src/proxy.c | 45 +++-
 nimble/host/mesh/src/transport.c | 38 +++---
 12 files changed, 174 insertions(+), 48 deletions(-)

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


[mynewt-nimble] 31/32: Merge pull request #866 from rymanluk/dtm_impr

2018-03-12 Thread andk
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 448954c40b0d57eed247adeceac968ac75c88385
Merge: 07a5d69 b35de4c
Author: Łukasz Rymanowski 
AuthorDate: Mon Mar 12 08:49:22 2018 +0100

Merge pull request #866 from rymanluk/dtm_impr

nimble/dtm: Allow RX being late

X-Original-Commit: 3d41bd30587911376a748fdd5cd12260edb95fc6

 nimble/controller/src/ble_ll_dtm.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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


[mynewt-nimble] 21/32: mesh: Ignore segments of cancelled message

2018-03-12 Thread andk
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 7ed968551eab2f54dfb5ca0d995e2679ed1a9fb3
Author: Michał Narajowski 
AuthorDate: Tue Feb 20 14:25:30 2018 +0100

mesh: Ignore segments of cancelled message

This fixes the issue when after incomplete timer expiration
host sent ACK.
The host failed in two cases:
1. Sending ACK right after the incomplete timer expiration;
2. Sending ACK from new RX context. Now, seq_auth of cancelled
message is not cleaned on RX reset, so segments of cancelled message
will be discarded when resend.

According to the Mesh Profile v1.0
"When the incomplete timer expires, the lower transport layer
shall consider that the message being received has failed and
cancel the acknowledgment timer. Any segment of a canceled
message shall be ignored."

X-Original-Commit: 50e7d632932c4188849aee89e0d23e2207352601
---
 nimble/host/mesh/src/transport.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/nimble/host/mesh/src/transport.c b/nimble/host/mesh/src/transport.c
index 4ae20f3..918af1f 100644
--- a/nimble/host/mesh/src/transport.c
+++ b/nimble/host/mesh/src/transport.c
@@ -1009,9 +1009,7 @@ static void seg_ack(struct os_event *work)
 
if (k_uptime_get_32() - rx->last > K_SECONDS(60)) {
BT_WARN("Incomplete timer expired");
-   send_ack(rx->sub, rx->dst, rx->src, rx->ttl,
-&rx->seq_auth, 0, rx->obo);
-   seg_rx_reset(rx, true);
+   seg_rx_reset(rx, false);
 
if (IS_ENABLED(CONFIG_BT_TESTING)) {
bt_test_mesh_trans_incomp_timer_exp();

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


[mynewt-nimble] 12/32: nimble/gap: Make max device length configurable

2018-03-12 Thread andk
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 78617e16445892abbce5716932a67cb84d31e427
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 23:07:06 2018 +0100

nimble/gap: Make max device length configurable

X-Original-Commit: a1122f0c7a942baf6e0c963fcae9b8df9484a27b
---
 nimble/host/services/gap/src/ble_svc_gap.c | 4 ++--
 nimble/host/services/gap/syscfg.yml| 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index bfdd0cf..49ccf9d 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -32,8 +32,8 @@
  MYNEWT_VAL(BLE_SVC_GAP_PPCP_SLAVE_LATENCY) || \
  MYNEWT_VAL(BLE_SVC_GAP_PPCP_SUPERVISION_TMO))
 
-/* XXX: This should be configurable. */
-#define BLE_SVC_GAP_NAME_MAX_LEN31
+#define BLE_SVC_GAP_NAME_MAX_LEN \
+MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH)
 
 static ble_svc_gap_chr_changed_fn *ble_svc_gap_chr_changed_cb_fn;
 
diff --git a/nimble/host/services/gap/syscfg.yml 
b/nimble/host/services/gap/syscfg.yml
index 11aeaa9..136ac42 100644
--- a/nimble/host/services/gap/syscfg.yml
+++ b/nimble/host/services/gap/syscfg.yml
@@ -33,6 +33,9 @@ syscfg.defs:
 BLE_GATT_CHR_F_WRITE_AUTHOR
 Set to '-1' to make characteristic read only.
 value: -1
+BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH:
+description: Maximum length for "Device Name" characteristics
+value: 31
 BLE_SVC_GAP_APPEARANCE:
 description: 'Device appearance'
 value: 0

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


[mynewt-nimble] branch new-master updated (b886ac3 -> 210d624)

2018-03-12 Thread andk
This is an automated email from the ASF dual-hosted git repository.

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


 discard b886ac3  nimble: Make this proper external repository
 new da72102  nimble/gap: Fix whitespaces
 new 49c1941  nimble/gap: Remove redundant formward declaration
 new 724dea1  nimble/gap: Remove deprecated characteristics
 new e77d546  nimble/gap: Add "Central Address Resolution" characteristic
 new 0256df2  nimble/gap: Make device name configurable via syscfg
 new 095bbc8  nimble/gap: Store appearance as simple uint16
 new ac3727c  nimble/gap: Fix characteristics in non-peripheral role
 new 0fa1d0e  nimble/gap: Make PPCP configurable
 new 5f5b248  nimble/gap: Make device name optionally writable
 new 48ec479  nimble/gap: Make appearance optionally writable
 new 78617e1  nimble/gap: Make max device length configurable
 new aaf569e  nimble: Adding missing inttypes.h include
 new ad3ff34  mesh: Fix passing CID to model publication messages
 new 417418e  mesh: Add support for OOB info and URI in provisioning data
 new 703c021  mesh: Fix coverity warning with unchecked error return
 new 6e2c7d1  mesh: Account for scan window delaying adv events
 new 35bcfc2  mesh: Fix handling of failed transmissions
 new 63b487a  mesh: Resend Link Acknowledgment when necessary
 new d7fc4a5  mesh: Fix sending Provisioning Failed for PB-GATT
 new 7ed9685  mesh: Ignore segments of cancelled message
 new e99920f  mesh: Use a single transmission from Friend to LPN
 new 8feb3ca  Merge pull request #841 from 
michal-narajowski/mesh-zephyr-ports
 new c33701a  nimble/phy: Fix receiver configuration on late RX
 new 8acb7a8  nimble/ll: Allow setting scan rsp data before configuring 
advertising
 new 6014f93  Merge pull request #871 from 
michal-narajowski/ll-legacy-adv-fix
 new 1e7940c  nimble/ll: Update handling of HCI Number of Completed Packets 
event
 new 1ca40fe  Merge pull request #837 from 
andrzej-kaczmarek/nimble-numpktcmp-fix
 new 7925ccf  nimble/ll: Use OS_TASK_STACK_DEFINE to init ble_ll stack
 new 07a5d69  nimble/mesh: Use OS_TASK_STACK_DEFINE for stacks in mesh
 new b35de4c  nimble/dtm: Allow for being late on RX start timer
 new 448954c  Merge pull request #866 from rymanluk/dtm_impr
 new 210d624  nimble: Make this proper external repository

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b886ac3)
\
 N -- N -- N   refs/heads/new-master (210d624)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 32 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/controller/src/ble_ll.c |   3 +-
 nimble/controller/src/ble_ll_adv.c |   4 +-
 nimble/controller/src/ble_ll_conn_hci.c|   7 +-
 nimble/controller/src/ble_ll_dtm.c |   8 +-
 nimble/controller/syscfg.yml   |   2 +-
 nimble/drivers/native/pkg.yml  |   4 +-
 nimble/drivers/nrf51/pkg.yml   |   6 +-
 nimble/drivers/nrf52/pkg.yml   |   6 +-
 nimble/drivers/nrf52/src/ble_phy.c |  22 ++-
 nimble/host/mesh/include/mesh/glue.h   |   3 +
 nimble/host/mesh/include/mesh/main.h   |  26 +++
 nimble/host/mesh/src/adv.c |  41 ++--
 nimble/host/mesh/src/adv.h |   1 +
 nimble/host/mesh/src/beacon.c  |  38 +++-
 nimble/host/mesh/src/cfg_cli.c |   6 +-
 nimble/host/mesh/src/friend.c  |  12 +-
 nimble/host/mesh/src/glue.c|   5 +
 nimble/host/mesh/src/prov.c|  14 +-
 nimble/host/mesh/src/prov.h|   2 +-
 nimble/host/mesh/src/proxy.c   |  45 -
 nimble/host/mesh/src/shell.c   |   7 +-
 nimble/host/mesh/src/transport.c   |  38 ++--
 .../gap/include/services/gap/ble_svc_gap.h |  14 +-
 nimble/host/services/gap/src/ble_svc_gap.c | 212 -
 nimble/host/services/gap/syscfg.yml|  56 ++
 nimble/tra

[mynewt-nimble] 07/32: nimble/gap: Store appearance as simple uint16

2018-03-12 Thread andk
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 095bbc8f8889f73770a52115b9191e8e236456ca
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 21:19:06 2018 +0100

nimble/gap: Store appearance as simple uint16

X-Original-Commit: a57cfcafecae8b880acb6a3214708f945d9e98b8
---
 nimble/host/services/gap/src/ble_svc_gap.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index f0dda62..3c9b53d 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -30,10 +30,8 @@
 
 static char ble_svc_gap_name[BLE_SVC_GAP_NAME_MAX_LEN + 1] =
 MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME);
-static const uint8_t ble_svc_gap_appearance[2] = {
- (MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE)) & 0xFF,
- ((MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE)) >> 8) & 0xFF
-};
+static const uint16_t ble_svc_gap_appearance =
+MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE);
 static uint8_t ble_svc_gap_pref_conn_params[8];
 
 static int
@@ -83,6 +81,7 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t attr_handle,
struct ble_gatt_access_ctxt *ctxt, void *arg)
 {
 uint16_t uuid16;
+uint16_t appearance = htole16(ble_svc_gap_appearance);
 #if MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION) >= 0
 uint8_t central_ar = MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION);
 #endif
@@ -100,8 +99,7 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t 
attr_handle,
 
 case BLE_SVC_GAP_CHR_UUID16_APPEARANCE:
 assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
-rc = os_mbuf_append(ctxt->om, &ble_svc_gap_appearance,
-sizeof ble_svc_gap_appearance);
+rc = os_mbuf_append(ctxt->om, &appearance, sizeof(appearance));
 return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
 
 case BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS:
@@ -148,7 +146,7 @@ ble_svc_gap_device_name_set(const char *name)
 uint16_t
 ble_svc_gap_device_appearance(void)
 {
-  return get_le16(ble_svc_gap_appearance);
+  return ble_svc_gap_appearance;
 }
 
 void

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


[mynewt-nimble] 14/32: nimble: Adding missing inttypes.h include

2018-03-12 Thread andk
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 aaf569e8bc5894d755daa257eca9849caef153e5
Author: Vipul Rahane 
AuthorDate: Mon Feb 26 15:27:23 2018 -0800

nimble: Adding missing inttypes.h include

- This was causing a build failure

X-Original-Commit: 13566431878bc3e4ac84cd0e9a36eb1d2cd5c870
---
 nimble/host/services/gap/include/services/gap/ble_svc_gap.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h 
b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
index d31a3b8..d7b60df 100644
--- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
+++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
@@ -20,6 +20,8 @@
 #ifndef H_BLE_SVC_GAP_
 #define H_BLE_SVC_GAP_
 
+#include 
+
 #ifdef __cplusplus
 extern "C" {
 #endif

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


[mynewt-nimble] 30/32: nimble/mesh: Use OS_TASK_STACK_DEFINE for stacks in mesh

2018-03-12 Thread andk
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 
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.


[mynewt-nimble] 26/32: Merge pull request #871 from michal-narajowski/ll-legacy-adv-fix

2018-03-12 Thread andk
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 6014f938cdeb008f4454b1b4bbe2df7855a2b46d
Merge: c33701a 8acb7a8
Author: Michał Narajowski 
AuthorDate: Wed Mar 7 11:10:06 2018 +0100

Merge pull request #871 from michal-narajowski/ll-legacy-adv-fix

nimble/ll: Allow setting scan rsp data before configuring advertising

X-Original-Commit: 8f0a8d53bd57cc17644758dc31f0d0439327f752

 nimble/controller/src/ble_ll_adv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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


[mynewt-nimble] 11/32: nimble/gap: Make appearance optionally writable

2018-03-12 Thread andk
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 48ec4798d53723bbd2455470e9c40e331adb4f8d
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 22:50:54 2018 +0100

nimble/gap: Make appearance optionally writable

As it turns out, spec allows appearance characteristic to be writable
so let us allow configure it this way. Also we need API to set this
from app so it can read new appearance value, store it and then restore
after reboot.

X-Original-Commit: b1b1c785b6f7968588aec68cad897711539552d5
---
 .../gap/include/services/gap/ble_svc_gap.h |  1 +
 nimble/host/services/gap/src/ble_svc_gap.c | 71 +++---
 nimble/host/services/gap/syscfg.yml|  9 +++
 3 files changed, 74 insertions(+), 7 deletions(-)

diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h 
b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
index 29bbf48..d31a3b8 100644
--- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
+++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
@@ -41,6 +41,7 @@ void 
ble_svc_gap_set_chr_changed_cb(ble_svc_gap_chr_changed_fn *cb);
 const char *ble_svc_gap_device_name(void);
 int ble_svc_gap_device_name_set(const char *name);
 uint16_t ble_svc_gap_device_appearance(void);
+int ble_svc_gap_device_appearance_set(uint16_t appearance);
 
 void ble_svc_gap_init(void);
 
diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index 7f2818c..bfdd0cf 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -39,8 +39,7 @@ static ble_svc_gap_chr_changed_fn 
*ble_svc_gap_chr_changed_cb_fn;
 
 static char ble_svc_gap_name[BLE_SVC_GAP_NAME_MAX_LEN + 1] =
 MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME);
-static const uint16_t ble_svc_gap_appearance =
-MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE);
+static uint16_t ble_svc_gap_appearance = MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE);
 
 static int
 ble_svc_gap_access(uint16_t conn_handle, uint16_t attr_handle,
@@ -65,7 +64,12 @@ static const struct ble_gatt_svc_def ble_svc_gap_defs[] = {
 /*** Characteristic: Appearance. */
 .uuid = BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_APPEARANCE),
 .access_cb = ble_svc_gap_access,
-.flags = BLE_GATT_CHR_F_READ,
+.flags = BLE_GATT_CHR_F_READ |
+#if MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE_WRITE_PERM) >= 0
+ BLE_GATT_CHR_F_WRITE |
+ MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE_WRITE_PERM) |
+#endif
+ 0,
 }, {
 #if PPCP_ENABLED
 /*** Characteristic: Peripheral Preferred Connection Parameters. */
@@ -132,11 +136,51 @@ ble_svc_gap_device_name_write_access(struct 
ble_gatt_access_ctxt *ctxt)
 }
 
 static int
+ble_svc_gap_appearance_read_access(struct ble_gatt_access_ctxt *ctxt)
+{
+uint16_t appearance = htole16(ble_svc_gap_appearance);
+int rc;
+
+rc = os_mbuf_append(ctxt->om, &appearance, sizeof(appearance));
+
+return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+}
+
+static int
+ble_svc_gap_appearance_write_access(struct ble_gatt_access_ctxt *ctxt)
+{
+#if MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE_WRITE_PERM) < 0
+assert(0);
+return 0;
+#else
+uint16_t om_len;
+int rc;
+
+om_len = OS_MBUF_PKTLEN(ctxt->om);
+if (om_len != sizeof(ble_svc_gap_appearance)) {
+return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
+}
+
+rc = ble_hs_mbuf_to_flat(ctxt->om, ble_svc_gap_appearance, om_len, NULL);
+if (rc != 0) {
+return BLE_ATT_ERR_UNLIKELY;
+}
+
+ble_svc_gap_appearance = le16toh(ble_svc_gap_appearance);
+
+if (ble_svc_gap_chr_changed_cb_fn) {
+ble_svc_gap_chr_changed_cb_fn(BLE_SVC_GAP_CHR_UUID16_APPEARANCE);
+}
+
+return rc;
+#endif
+}
+
+static int
 ble_svc_gap_access(uint16_t conn_handle, uint16_t attr_handle,
struct ble_gatt_access_ctxt *ctxt, void *arg)
 {
 uint16_t uuid16;
-uint16_t appearance = htole16(ble_svc_gap_appearance);
 #if MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION) >= 0
 uint8_t central_ar = MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION);
 #endif
@@ -165,9 +209,14 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t 
attr_handle,
 return rc;
 
 case BLE_SVC_GAP_CHR_UUID16_APPEARANCE:
-assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
-rc = os_mbuf_append(ctxt->om, &appearance, sizeof(appearance));
-return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) {
+rc = ble_svc_gap_appearance_read_access(ctxt);
+} else if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
+rc = ble_svc_gap_appearance_write_access(ctxt);
+} else {
+assert(

[mynewt-nimble] 01/32: mesh: Fix passing CID to model publication messages

2018-03-12 Thread andk
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 ad3ff34e98c285c0a063fc91fea58a34ebe04804
Author: Michał Narajowski 
AuthorDate: Tue Feb 20 11:50:51 2018 +0100

mesh: Fix passing CID to model publication messages

The vendor variants of the model publication client messages were not
passing onward the CID, rather passing CID_NVAL which is clearly not
right.

X-Original-Commit: 398fd57f82a407a343ff04e445aed6de9e990e8e
---
 nimble/host/mesh/src/cfg_cli.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/nimble/host/mesh/src/cfg_cli.c b/nimble/host/mesh/src/cfg_cli.c
index 05c302b..4d1af2e 100644
--- a/nimble/host/mesh/src/cfg_cli.c
+++ b/nimble/host/mesh/src/cfg_cli.c
@@ -1132,8 +1132,7 @@ int bt_mesh_cfg_mod_pub_get_vnd(u16_t net_idx, u16_t 
addr, u16_t elem_addr,
return -EINVAL;
}
 
-   return mod_pub_get(net_idx, addr, elem_addr, mod_id, CID_NVAL,
-  pub, status);
+   return mod_pub_get(net_idx, addr, elem_addr, mod_id, cid, pub, status);
 }
 
 static int mod_pub_set(u16_t net_idx, u16_t addr, u16_t elem_addr,
@@ -1205,8 +1204,7 @@ int bt_mesh_cfg_mod_pub_set_vnd(u16_t net_idx, u16_t 
addr, u16_t elem_addr,
return -EINVAL;
}
 
-   return mod_pub_set(net_idx, addr, elem_addr, mod_id, CID_NVAL,
-  pub, status);
+   return mod_pub_set(net_idx, addr, elem_addr, mod_id, cid, pub, status);
 }
 
 int bt_mesh_cfg_hb_sub_set(u16_t net_idx, u16_t addr,

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


[mynewt-nimble] 09/32: nimble/gap: Make PPCP configurable

2018-03-12 Thread andk
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 0fa1d0e1a81856d23c339ec37e65e90bf694c808
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 21:40:44 2018 +0100

nimble/gap: Make PPCP configurable

Allow to configure value of "Peripherap Preferred Connection Parameters"
characteristic. Since this characteristic is optional and right now we
do not set any meaningful value there, we simply disable it by default.

X-Original-Commit: ce7276d7ea9e46e2912980d010b98ef5beadc6ee
---
 nimble/host/services/gap/src/ble_svc_gap.c | 23 ++-
 nimble/host/services/gap/syscfg.yml| 24 
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index a52b3be..2445b9a 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -25,6 +25,13 @@
 #include "services/gap/ble_svc_gap.h"
 #include "os/endian.h"
 
+#define PPCP_ENABLED \
+MYNEWT_VAL(BLE_ROLE_PERIPHERAL) && \
+(MYNEWT_VAL(BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL) || \
+ MYNEWT_VAL(BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL) || \
+ MYNEWT_VAL(BLE_SVC_GAP_PPCP_SLAVE_LATENCY) || \
+ MYNEWT_VAL(BLE_SVC_GAP_PPCP_SUPERVISION_TMO))
+
 /* XXX: This should be configurable. */
 #define BLE_SVC_GAP_NAME_MAX_LEN31
 
@@ -32,7 +39,6 @@ static char ble_svc_gap_name[BLE_SVC_GAP_NAME_MAX_LEN + 1] =
 MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME);
 static const uint16_t ble_svc_gap_appearance =
 MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE);
-static uint8_t ble_svc_gap_pref_conn_params[8];
 
 static int
 ble_svc_gap_access(uint16_t conn_handle, uint16_t attr_handle,
@@ -54,7 +60,7 @@ static const struct ble_gatt_svc_def ble_svc_gap_defs[] = {
 .access_cb = ble_svc_gap_access,
 .flags = BLE_GATT_CHR_F_READ,
 }, {
-#if MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
+#if PPCP_ENABLED
 /*** Characteristic: Peripheral Preferred Connection Parameters. */
 .uuid =
 
BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS),
@@ -87,6 +93,14 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t 
attr_handle,
 #if MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION) >= 0
 uint8_t central_ar = MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION);
 #endif
+#if PPCP_ENABLED
+uint16_t ppcp[4] = {
+htole16(MYNEWT_VAL(BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL)),
+htole16(MYNEWT_VAL(BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL)),
+htole16(MYNEWT_VAL(BLE_SVC_GAP_PPCP_SLAVE_LATENCY)),
+htole16(MYNEWT_VAL(BLE_SVC_GAP_PPCP_SUPERVISION_TMO))
+};
+#endif
 int rc;
 
 uuid16 = ble_uuid_u16(ctxt->chr->uuid);
@@ -104,11 +118,10 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t 
attr_handle,
 rc = os_mbuf_append(ctxt->om, &appearance, sizeof(appearance));
 return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
 
-#if MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
+#if PPCP_ENABLED
 case BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS:
 assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
-rc = os_mbuf_append(ctxt->om, &ble_svc_gap_pref_conn_params,
-sizeof ble_svc_gap_pref_conn_params);
+rc = os_mbuf_append(ctxt->om, &ppcp, sizeof(ppcp));
 return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
 #endif
 
diff --git a/nimble/host/services/gap/syscfg.yml 
b/nimble/host/services/gap/syscfg.yml
index 0e327fd..25597e9 100644
--- a/nimble/host/services/gap/syscfg.yml
+++ b/nimble/host/services/gap/syscfg.yml
@@ -27,6 +27,30 @@ syscfg.defs:
 BLE_SVC_GAP_APPEARANCE:
 description: 'Device appearance'
 value: 0
+
+# Setting all values for PPCP to '0' will disable characteristic!
+BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL:
+description: >
+Value of "minimum connection interval" of PPCP characteristic as
+defined by Core specification 5.0, Vol 3, Part C, section 12.3.
+value: 0
+BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL:
+description: >
+Value of "maximum connection interval" of PPCP characteristic as
+defined by Core specification 5.0, Vol 3, Part C, section 12.3.
+value: 0
+BLE_SVC_GAP_PPCP_SLAVE_LATENCY:
+description: >
+Value of "slave latency" of PPCP characteristic as  defined by Core
+specification 5.0, Vol 3, Part C, section 12.3.
+value: 0
+BLE_SVC_GAP_PPCP_SUPERVISION_TMO:
+description: >
+Value of "connection supervision timeout multiplier" of PPCP
+characteristic as defined by Core specification 5.0, Vol 3, Part C,
+section 12.3.
+value: 0
+
 BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION:
 description: >
  

[mynewt-nimble] 18/32: mesh: Fix handling of failed transmissions

2018-03-12 Thread andk
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 35bcfc25b76b6be19093a5e85b94485e9160104c
Author: Michał Narajowski 
AuthorDate: Tue Feb 20 14:23:49 2018 +0100

mesh: Fix handling of failed transmissions

When sending a segmented message, the state could get stuck if the
advertising bearer fails in transmitting and we don't detect that it
happened. Add a send_start callback for all packets so we can always
know if sending fails.

X-Original-Commit: c2f6fa5baf8eab609a705347e1c1b881e48bd710
---
 nimble/host/mesh/src/transport.c | 34 --
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/nimble/host/mesh/src/transport.c b/nimble/host/mesh/src/transport.c
index 9902a6d..4ae20f3 100644
--- a/nimble/host/mesh/src/transport.c
+++ b/nimble/host/mesh/src/transport.c
@@ -46,6 +46,12 @@
 /* Number of retransmit attempts (after the initial transmit) per segment */
 #define SEG_RETRANSMIT_ATTEMPTS 4
 
+/* "This timer shall be set to a minimum of 200 + 50 * TTL milliseconds.".
+ * We use 400 since 300 is a common send duration for standard HCI, and we
+ * need to have a timeout that's bigger than that.
+ */
+#define SEG_RETRANSMIT_TIMEOUT(tx) (K_MSEC(400) + 50 * (tx)->ttl)
+
 /* How long to wait for available buffers before giving up */
 #define BUF_TIMEOUT K_NO_WAIT
 
@@ -191,7 +197,7 @@ static inline void seg_tx_complete(struct seg_tx *tx, int 
err)
seg_tx_reset(tx);
 }
 
-static void seg_send_start(u16_t duration, int err, void *user_data)
+static void seg_first_send_start(u16_t duration, int err, void *user_data)
 {
struct seg_tx *tx = user_data;
 
@@ -200,27 +206,35 @@ static void seg_send_start(u16_t duration, int err, void 
*user_data)
}
 }
 
-static void seg_sent(int err, void *user_data)
+static void seg_send_start(u16_t duration, int err, void *user_data)
 {
struct seg_tx *tx = user_data;
-   s32_t timeout;
 
-   /* "This timer shall be set to a minimum of 200 + 50 * TTL
-* milliseconds.". We use 400 since 300 is a common send
-* duration for standard HCI, and we need to have a timeout
-* that's bigger than that.
+   /* If there's an error in transmitting the 'sent' callback will never
+* be called. Make sure that we kick the retransmit timer also in this
+* case since otherwise we risk the transmission of becoming stale.
 */
-   timeout = K_MSEC(400) + 50 * tx->ttl;
+   if (err) {
+   k_delayed_work_submit(&tx->retransmit,
+ SEG_RETRANSMIT_TIMEOUT(tx));
+   }
+}
 
-   k_delayed_work_submit(&tx->retransmit, timeout);
+static void seg_sent(int err, void *user_data)
+{
+   struct seg_tx *tx = user_data;
+
+   k_delayed_work_submit(&tx->retransmit,
+ SEG_RETRANSMIT_TIMEOUT(tx));
 }
 
 static const struct bt_mesh_send_cb first_sent_cb = {
-   .start = seg_send_start,
+   .start = seg_first_send_start,
.end = seg_sent,
 };
 
 static const struct bt_mesh_send_cb seg_sent_cb = {
+   .start = seg_send_start,
.end = seg_sent,
 };
 

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


[mynewt-nimble] 02/32: nimble/gap: Fix whitespaces

2018-03-12 Thread andk
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 da72102f4421e64666d2ead77e50e051fed035cc
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 23:01:05 2018 +0100

nimble/gap: Fix whitespaces

X-Original-Commit: 7e4dae9ad578d711c4cba0243b1edbfcb0262be6
---
 nimble/host/services/gap/include/services/gap/ble_svc_gap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h 
b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
index 7f8a8e7..bc8433d 100644
--- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
+++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
@@ -35,7 +35,7 @@ struct ble_hs_cfg;
 
 #define BLE_SVC_GAP_APPEARANCE_GEN_UNKNOWN 0
 #define BLE_SVC_GAP_APPEARANCE_GEN_COMPUTER128
-#define BLE_SVC_GAP_APPEARANCE_CYC_SPEED_AND_CADENCE_SENSOR1157
  
+#define BLE_SVC_GAP_APPEARANCE_CYC_SPEED_AND_CADENCE_SENSOR1157
 
 const char *ble_svc_gap_device_name(void);
 int ble_svc_gap_device_name_set(const char *name);

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


[mynewt-nimble] 13/32: nimble/ll: Update handling of HCI Number of Completed Packets event

2018-03-12 Thread andk
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 1e7940c858d83d5566e10873c0c600502657f072
Author: Andrzej Kaczmarek 
AuthorDate: Wed Feb 21 13:54:57 2018 +0100

nimble/ll: Update handling of HCI Number of Completed Packets event

The calculations for sending this HCI event periodically are a bit
mysterious at first glance - let's make them more obvious.

X-Original-Commit: 29d5d03fc888c414fb21ac22d6df4b970847f92f
---
 nimble/controller/src/ble_ll_conn_hci.c | 7 +++
 nimble/controller/syscfg.yml| 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/nimble/controller/src/ble_ll_conn_hci.c 
b/nimble/controller/src/ble_ll_conn_hci.c
index d8bf4e5..c6ea897 100644
--- a/nimble/controller/src/ble_ll_conn_hci.c
+++ b/nimble/controller/src/ble_ll_conn_hci.c
@@ -279,8 +279,8 @@ ble_ll_conn_num_comp_pkts_event_send(struct ble_ll_conn_sm 
*connsm)
  * have completed but there are data packets in the controller buffers
  * (i.e. enqueued in a connection state machine).
  */
-if ((uint32_t)(g_ble_ll_last_num_comp_pkt_evt - os_time_get()) <
- (MYNEWT_VAL(BLE_NUM_COMP_PKT_RATE) * OS_TICKS_PER_SEC)) {
+if ((int32_t)(os_time_get() - g_ble_ll_last_num_comp_pkt_evt) <
+MYNEWT_VAL(BLE_NUM_COMP_PKT_RATE)) 
{
 /*
  * If this connection has completed packets, send an event right away.
  * We do this to increase throughput but we dont want to search the
@@ -354,8 +354,7 @@ skip_conn:
 }
 
 if (event_sent) {
-g_ble_ll_last_num_comp_pkt_evt = os_time_get() +
-(MYNEWT_VAL(BLE_NUM_COMP_PKT_RATE) * OS_TICKS_PER_SEC);
+g_ble_ll_last_num_comp_pkt_evt = os_time_get();
 }
 }
 
diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml
index 00cb1e8..8a89a12 100644
--- a/nimble/controller/syscfg.yml
+++ b/nimble/controller/syscfg.yml
@@ -79,7 +79,7 @@ syscfg.defs:
 Determines the maximum rate at which the controller will send the
 number of completed packets event to the host. Rate is in os time
 ticks.
-value: '((2000 * OS_TICKS_PER_SEC) / 1000)'
+value: '(2 * OS_TICKS_PER_SEC)'
 
 BLE_LL_MFRG_ID:
 description: >

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


[mynewt-nimble] 08/32: nimble/gap: Fix characteristics in non-peripheral role

2018-03-12 Thread andk
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 ac3727c406ef5f8932257937fd83ec96251c60aa
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 21:25:39 2018 +0100

nimble/gap: Fix characteristics in non-peripheral role

"Peripheral Preferred Connection Parameters" is only optional in
peripheral role and excluded otherwise - so make it register only
if we're configured for peripheral role.

X-Original-Commit: 3b1e9855a8dcf0450a21f1bc18102601701d3f60
---
 nimble/host/services/gap/src/ble_svc_gap.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index 3c9b53d..a52b3be 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -54,12 +54,14 @@ static const struct ble_gatt_svc_def ble_svc_gap_defs[] = {
 .access_cb = ble_svc_gap_access,
 .flags = BLE_GATT_CHR_F_READ,
 }, {
+#if MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
 /*** Characteristic: Peripheral Preferred Connection Parameters. */
 .uuid =
 
BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS),
 .access_cb = ble_svc_gap_access,
 .flags = BLE_GATT_CHR_F_READ,
 }, {
+#endif
 #if MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION) >= 0
 /*** Characteristic: Central Address Resolution. */
 .uuid = 
BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_CENTRAL_ADDRESS_RESOLUTION),
@@ -102,11 +104,13 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t 
attr_handle,
 rc = os_mbuf_append(ctxt->om, &appearance, sizeof(appearance));
 return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
 
+#if MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
 case BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS:
 assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
 rc = os_mbuf_append(ctxt->om, &ble_svc_gap_pref_conn_params,
 sizeof ble_svc_gap_pref_conn_params);
 return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+#endif
 
 #if MYNEWT_VAL(BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION) >= 0
 case BLE_SVC_GAP_CHR_UUID16_CENTRAL_ADDRESS_RESOLUTION:

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


[mynewt-nimble] 28/32: nimble/dtm: Allow for being late on RX start timer

2018-03-12 Thread andk
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 b35de4c81e3044b440758e94efc205ec3a712a27
Author: Łukasz Rymanowski 
AuthorDate: Fri Mar 2 11:48:58 2018 +0100

nimble/dtm: Allow for being late on RX start timer

So far we assert when being late or starting RX timer. Now we allow to
be late as it is not important for dtm code. RX is still on after it.

X-Original-Commit: dc600a051f11e3c9f31e93fdd45e63c659c3c8c4
---
 nimble/controller/src/ble_ll_dtm.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/nimble/controller/src/ble_ll_dtm.c 
b/nimble/controller/src/ble_ll_dtm.c
index 23a5cfc..e014d24 100644
--- a/nimble/controller/src/ble_ll_dtm.c
+++ b/nimble/controller/src/ble_ll_dtm.c
@@ -311,7 +311,9 @@ ble_ll_dtm_rx_start(void)
 
 rc = ble_phy_setchan(channel_rf_to_index[g_ble_ll_dtm_ctx.rf_channel],
  BLE_DTM_SYNC_WORD, BLE_DTM_CRC);
-assert(rc == 0);
+if (rc) {
+return rc;
+}
 
 #if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY) || 
MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY))
 ble_phy_mode_set(g_ble_ll_dtm_ctx.phy_mode, g_ble_ll_dtm_ctx.phy_mode);
@@ -319,7 +321,9 @@ ble_ll_dtm_rx_start(void)
 
 rc = ble_phy_rx_set_start_time(os_cputime_get32() +
g_ble_ll_sched_offset_ticks, 0);
-assert(rc == 0);
+if (rc && rc != BLE_PHY_ERR_RX_LATE) {
+return rc;
+}
 
 ble_ll_state_set(BLE_LL_STATE_DTM);
 

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


[mynewt-nimble] 04/32: nimble/gap: Remove deprecated characteristics

2018-03-12 Thread andk
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 724dea122cadaa87c0d4345ff859d8026b9187e7
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 20:23:04 2018 +0100

nimble/gap: Remove deprecated characteristics

"Peripheal Privacy Flag" and "Reconnection Address" are not included in
GAP spec since 4.1, so let's remove them. And they were not properly
configured anyway...

X-Original-Commit: 3e2a7295ab2a6be2e46319677ba0d19f4d36224b
---
 .../gap/include/services/gap/ble_svc_gap.h |  2 --
 nimble/host/services/gap/src/ble_svc_gap.c | 27 --
 2 files changed, 29 deletions(-)

diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h 
b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
index f64c4f6..b8dd196 100644
--- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
+++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
@@ -27,8 +27,6 @@ extern "C" {
 #define BLE_SVC_GAP_UUID16  0x1800
 #define BLE_SVC_GAP_CHR_UUID16_DEVICE_NAME  0x2a00
 #define BLE_SVC_GAP_CHR_UUID16_APPEARANCE   0x2a01
-#define BLE_SVC_GAP_CHR_UUID16_PERIPH_PRIV_FLAG 0x2a02
-#define BLE_SVC_GAP_CHR_UUID16_RECONNECT_ADDR   0x2a03
 #define BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS  0x2a04
 
 #define BLE_SVC_GAP_APPEARANCE_GEN_UNKNOWN 0
diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index 0ca195e..995534e 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -33,8 +33,6 @@ static const uint8_t ble_svc_gap_appearance[2] = {
  (MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE)) & 0xFF,
  ((MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE)) >> 8) & 0xFF
 };
-static uint8_t ble_svc_gap_privacy_flag;
-static uint8_t ble_svc_gap_reconnect_addr[6];
 static uint8_t ble_svc_gap_pref_conn_params[8];
 
 static int
@@ -57,16 +55,6 @@ static const struct ble_gatt_svc_def ble_svc_gap_defs[] = {
 .access_cb = ble_svc_gap_access,
 .flags = BLE_GATT_CHR_F_READ,
 }, {
-/*** Characteristic: Peripheral Privacy Flag. */
-.uuid = 
BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_PERIPH_PRIV_FLAG),
-.access_cb = ble_svc_gap_access,
-.flags = BLE_GATT_CHR_F_READ,
-}, {
-/*** Characteristic: Reconnection Address. */
-.uuid = BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_RECONNECT_ADDR),
-.access_cb = ble_svc_gap_access,
-.flags = BLE_GATT_CHR_F_WRITE,
-}, {
 /*** Characteristic: Peripheral Preferred Connection Parameters. */
 .uuid =
 
BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS),
@@ -105,21 +93,6 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t 
attr_handle,
 sizeof ble_svc_gap_appearance);
 return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
 
-case BLE_SVC_GAP_CHR_UUID16_PERIPH_PRIV_FLAG:
-assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
-rc = os_mbuf_append(ctxt->om, &ble_svc_gap_privacy_flag,
-sizeof ble_svc_gap_privacy_flag);
-return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
-
-case BLE_SVC_GAP_CHR_UUID16_RECONNECT_ADDR:
-assert(ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR);
-if (OS_MBUF_PKTLEN(ctxt->om) != sizeof ble_svc_gap_reconnect_addr) {
-return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
-}
-ble_hs_mbuf_to_flat(ctxt->om, ble_svc_gap_reconnect_addr,
-sizeof ble_svc_gap_reconnect_addr, NULL);
-return 0;
-
 case BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS:
 assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
 rc = os_mbuf_append(ctxt->om, &ble_svc_gap_pref_conn_params,

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


[mynewt-nimble] 32/32: nimble: Make this proper external repository

2018-03-12 Thread andk
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 210d62470c7193a70221ce0ed7edf91bb565cc39
Author: Andrzej Kaczmarek 
AuthorDate: Wed Dec 20 14:33:54 2017 +0100

nimble: Make this proper external repository
---
 nimble/controller/pkg.yml  |  6 +++---
 nimble/controller/test/pkg.yml | 14 +++---
 nimble/drivers/native/pkg.yml  |  4 ++--
 nimble/drivers/nrf51/pkg.yml   |  6 +++---
 nimble/drivers/nrf52/pkg.yml   |  6 +++---
 nimble/host/mesh/pkg.yml   | 12 ++--
 nimble/host/pkg.yml| 16 
 nimble/host/services/ans/pkg.yml   |  4 ++--
 nimble/host/services/bleuart/pkg.yml   |  6 +++---
 nimble/host/services/gap/pkg.yml   |  4 ++--
 nimble/host/services/gatt/pkg.yml  |  4 ++--
 nimble/host/services/ias/pkg.yml   |  4 ++--
 nimble/host/services/lls/pkg.yml   |  4 ++--
 nimble/host/services/tps/pkg.yml   |  4 ++--
 nimble/host/store/config/pkg.yml   |  8 
 nimble/host/store/ram/pkg.yml  |  4 ++--
 nimble/host/test/pkg.yml   | 16 
 nimble/host/util/pkg.yml   |  4 ++--
 nimble/pkg.yml |  4 ++--
 nimble/transport/emspi/pkg.yml |  6 +++---
 nimble/transport/pkg.yml   | 14 +++---
 nimble/transport/ram/pkg.yml   |  6 +++---
 nimble/transport/socket/pkg.yml| 10 +-
 nimble/transport/uart/pkg.yml  | 10 +-
 nimble/host/util/pkg.yml => repository.yml | 21 +++--
 25 files changed, 99 insertions(+), 98 deletions(-)

diff --git a/nimble/controller/pkg.yml b/nimble/controller/pkg.yml
index fa50118..8ccb9f8 100644
--- a/nimble/controller/pkg.yml
+++ b/nimble/controller/pkg.yml
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-pkg.name: net/nimble/controller
+pkg.name: nimble/controller
 pkg.description: Controller side of the nimble Bluetooth Smart stack.
 pkg.author: "Apache Mynewt "
 pkg.homepage: "http://mynewt.apache.org/";
@@ -31,8 +31,8 @@ pkg.req_apis:
 - stats
 
 pkg.deps:
-- kernel/os
-- net/nimble
+- "@apache-mynewt-core/kernel/os"
+- nimble
 
 pkg.init:
 ble_ll_init: 250
diff --git a/nimble/controller/test/pkg.yml b/nimble/controller/test/pkg.yml
index c345c13..ab1d9db 100644
--- a/nimble/controller/test/pkg.yml
+++ b/nimble/controller/test/pkg.yml
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-pkg.name: net/nimble/controller/test
+pkg.name: nimble/controller/test
 pkg.type: unittest
 pkg.description: "NimBLE controller unit tests."
 pkg.author: "Apache Mynewt "
@@ -23,11 +23,11 @@ pkg.homepage: "http://mynewt.apache.org/";
 pkg.keywords:
 
 pkg.deps:
-- test/testutil
-- net/nimble/controller
+- "@apache-mynewt-core/test/testutil"
+- nimble/controller
 
 pkg.deps.SELFTEST:
-- sys/console/stub
-- sys/log/full
-- sys/stats/stub
-- net/nimble/transport/ram
+- "@apache-mynewt-core/sys/console/stub"
+- "@apache-mynewt-core/sys/log/full"
+- "@apache-mynewt-core/sys/stats/stub"
+- nimble/transport/ram
diff --git a/nimble/drivers/native/pkg.yml b/nimble/drivers/native/pkg.yml
index f57af62..8795898 100644
--- a/nimble/drivers/native/pkg.yml
+++ b/nimble/drivers/native/pkg.yml
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-pkg.name: hw/drivers/nimble/native
+pkg.name: nimble/drivers/native
 pkg.description: BLE driver for simulations.
 pkg.author: "Apache Mynewt "
 pkg.homepage: "http://mynewt.apache.org/";
@@ -27,4 +27,4 @@ pkg.keywords:
 
 pkg.apis: ble_driver
 pkg.deps:
-- net/nimble/controller
+- nimble/controller
diff --git a/nimble/drivers/nrf51/pkg.yml b/nimble/drivers/nrf51/pkg.yml
index 6c427b5..5f17d6f 100644
--- a/nimble/drivers/nrf51/pkg.yml
+++ b/nimble/drivers/nrf51/pkg.yml
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-pkg.name: hw/drivers/nimble/nrf51
+pkg.name: nimble/drivers/nrf51
 pkg.description: BLE driver for nRF51 systems.
 pkg.author: "Apache Mynewt "
 pkg.homepage: "http://mynewt.apache.org/";
@@ -27,5 +27,5 @@ pkg.keywords:
 
 pkg.apis: ble_driver
 pkg.deps:
-- net/nimble
-- net/nimble/controller
+- nimble
+- nimble/controller
diff --git a/nimble/drivers/nrf52/pkg.yml b/nimble/drivers/nrf52/pkg.yml
index f682667..180919c 100644
--- a/nimble/drivers/nrf52/pkg.yml
+++ b/nimble/drivers/nrf52/pkg.yml
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-pkg.name: hw/drivers/nimble/nrf52
+pkg.name: nimble/drivers/nrf52
 pkg.description: BLE driver for nRF52 systems.
 pkg.author: "Apache Mynewt "
 pkg.homepage: "http://mynewt.apache.org/";
@@ -27,5 +27,5 @@ pkg.keywords:
 
 pkg.apis: ble_driver
 pkg.deps:
-- net/nimble
-- net/nimble/contro

[mynewt-nimble] 25/32: nimble/ll: Allow setting scan rsp data before configuring advertising

2018-03-12 Thread andk
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 8acb7a83eff5dc0722c1aef762d9b0c57551
Author: Michał Narajowski 
AuthorDate: Tue Mar 6 15:35:46 2018 +0100

nimble/ll: Allow setting scan rsp data before configuring advertising

When using legacy advertising commands

X-Original-Commit: 7c9ebd15755af50377418f4fb7b19fd9f22fcfc8
---
 nimble/controller/src/ble_ll_adv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/nimble/controller/src/ble_ll_adv.c 
b/nimble/controller/src/ble_ll_adv.c
index e2bf15a..e8a4f71 100644
--- a/nimble/controller/src/ble_ll_adv.c
+++ b/nimble/controller/src/ble_ll_adv.c
@@ -1813,7 +1813,9 @@ ble_ll_adv_set_scan_rsp_data(uint8_t *cmd, uint8_t 
instance, uint8_t operation)
 
 /* check if type of advertising support scan rsp */
 if (!(advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_SCANNABLE)) {
-return BLE_ERR_INV_HCI_CMD_PARMS;
+if (!(advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_LEGACY)) {
+return BLE_ERR_INV_HCI_CMD_PARMS;
+}
 }
 
 switch (operation) {

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


[mynewt-nimble] 24/32: nimble/phy: Fix receiver configuration on late RX

2018-03-12 Thread andk
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 c33701ae80cfe3d23ba7ae02d6328fec2b4ec209
Author: Andrzej Kaczmarek 
AuthorDate: Tue Mar 6 10:20:04 2018 +0100

nimble/phy: Fix receiver configuration on late RX

If we are late when scheduling RX, receiver is enabled anyway since we
may just want to scan for "anything". However, current code only enables
receiver but does not configure it so the results seem unpredictable.

This patch fixes this by ensuring that radio is properly configured for
RX in both cases.

X-Original-Commit: 068c09a8da97bc62eddd5084fa1e40f910abf7e8
---
 nimble/drivers/nrf52/src/ble_phy.c | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/nimble/drivers/nrf52/src/ble_phy.c 
b/nimble/drivers/nrf52/src/ble_phy.c
index adae7f0..8590929 100644
--- a/nimble/drivers/nrf52/src/ble_phy.c
+++ b/nimble/drivers/nrf52/src/ble_phy.c
@@ -1443,6 +1443,7 @@ ble_phy_tx_set_start_time(uint32_t cputime, uint8_t 
rem_usecs)
 int
 ble_phy_rx_set_start_time(uint32_t cputime, uint8_t rem_usecs)
 {
+bool late = false;
 int rc = 0;
 
 /* XXX: This should not be necessary, but paranoia is good! */
@@ -1451,16 +1452,29 @@ ble_phy_rx_set_start_time(uint32_t cputime, uint8_t 
rem_usecs)
 
 if (ble_phy_set_start_time(cputime, rem_usecs, false) != 0) {
 STATS_INC(ble_phy_stats, rx_late);
+
+/*
+ * Disable PPI so ble_phy_rx() will start RX immediately after
+ * configuring receiver.
+ */
 NRF_PPI->CHENCLR = PPI_CHEN_CH21_Msk;
-NRF_RADIO->TASKS_RXEN = 1;
-rc = BLE_PHY_ERR_RX_LATE;
+late = true;
 } else {
 /* Enable PPI to automatically start RXEN */
 NRF_PPI->CHENSET = PPI_CHEN_CH21_Msk;
+}
 
-/* Start rx */
-rc = ble_phy_rx();
+/* Start rx */
+rc = ble_phy_rx();
+
+/*
+ * If we enabled receiver but were late, let's return proper error code so
+ * caller can handle this.
+ */
+if (!rc && late) {
+rc = BLE_PHY_ERR_RX_LATE;
 }
+
 return rc;
 }
 

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


[mynewt-nimble] 16/32: mesh: Fix coverity warning with unchecked error return

2018-03-12 Thread andk
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 703c021133e3e7e158d79c736333fa53c57f1628
Author: Michał Narajowski 
AuthorDate: Tue Feb 20 12:31:32 2018 +0100

mesh: Fix coverity warning with unchecked error return

This fixes Zephyr's Coverity CID 182769.

X-Original-Commit: 584c807f5e25a9c325d90ad6643628198785128d
---
 nimble/host/mesh/src/beacon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nimble/host/mesh/src/beacon.c b/nimble/host/mesh/src/beacon.c
index a54cedb..34ea6b8 100644
--- a/nimble/host/mesh/src/beacon.c
+++ b/nimble/host/mesh/src/beacon.c
@@ -169,9 +169,8 @@ static int unprovisioned_beacon_send(void)
net_buf_add_u8(buf, BEACON_TYPE_UNPROVISIONED);
net_buf_add_mem(buf, prov->uuid, 16);
 
-   if (prov->uri) {
+   if (prov->uri && bt_mesh_s1(prov->uri, uri_hash) == 0) {
oob_info = prov->oob_info | BT_MESH_PROV_OOB_URI;
-   bt_mesh_s1(prov->uri, uri_hash);
} else {
oob_info = prov->oob_info;
}

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


[mynewt-nimble] 19/32: mesh: Resend Link Acknowledgment when necessary

2018-03-12 Thread andk
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 63b487ad59a15d268dc2a51d493ad0d2582dd49a
Author: Michał Narajowski 
AuthorDate: Tue Feb 20 14:24:33 2018 +0100

mesh: Resend Link Acknowledgment when necessary

The Provisioner might have missed our earlier Link Acknowledgement, so
if we receive another one with matching Link ID and link.expect state,
simply send another acknowledgement.

X-Original-Commit: b6d823cb5131e8750d7ec1152b4d48ea60ac85c3
---
 nimble/host/mesh/src/prov.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/nimble/host/mesh/src/prov.c b/nimble/host/mesh/src/prov.c
index 0a2d3b2..04cab17 100644
--- a/nimble/host/mesh/src/prov.c
+++ b/nimble/host/mesh/src/prov.c
@@ -1179,7 +1179,14 @@ static void link_open(struct prov_rx *rx, struct os_mbuf 
*buf)
}
 
if (atomic_test_bit(link.flags, LINK_ACTIVE)) {
-   BT_WARN("Ignoring bearer open: link already active");
+   /* Send another link ack if the provisioner missed the last */
+   if (link.id == rx->link_id && link.expect == PROV_INVITE) {
+   BT_DBG("Resending link ack");
+   bearer_ctl_send(LINK_ACK, NULL, 0);
+   } else {
+   BT_WARN("Ignoring bearer open: link already active");
+   }
+
return;
}
 

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


[mynewt-nimble] 20/32: mesh: Fix sending Provisioning Failed for PB-GATT

2018-03-12 Thread andk
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 d7fc4a5a1157006921aa1ffd61482cfdcb939728
Author: Michał Narajowski 
AuthorDate: Tue Feb 20 14:24:57 2018 +0100

mesh: Fix sending Provisioning Failed for PB-GATT

In the case of an unexpected PDU we need to send the right response.
This was already taken care of for PB-ADV, but not for PB-GATT.

X-Original-Commit: 65b2467d6192e9bd943a3f898132775984d6b871
---
 nimble/host/mesh/src/prov.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nimble/host/mesh/src/prov.c b/nimble/host/mesh/src/prov.c
index 04cab17..07d3d02 100644
--- a/nimble/host/mesh/src/prov.c
+++ b/nimble/host/mesh/src/prov.c
@@ -1477,6 +1477,7 @@ int bt_mesh_pb_gatt_recv(uint16_t conn_handle, struct 
os_mbuf *buf)
type = net_buf_simple_pull_u8(buf);
if (type != PROV_FAILED && type != link.expect) {
BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect);
+   prov_send_fail_msg(PROV_ERR_UNEXP_PDU);
return -EINVAL;
}
 

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


[mynewt-nimble] 17/32: mesh: Account for scan window delaying adv events

2018-03-12 Thread andk
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 6e2c7d19022c4d9e956a309b55e326f130a455d7
Author: Michał Narajowski 
AuthorDate: Tue Feb 20 14:12:47 2018 +0100

mesh: Account for scan window delaying adv events

New advertising started while scanning is already enabled
would delay the first advertisement event until the end of
the current overlapping scan window in the Zephyr native BLE
controller implementation. Hence, consider this scan window
duration when calculating the advertising stop.

X-Original-Commit: 9b8e353c059d260134310e0255bce8b40b00d394
---
 nimble/host/mesh/include/mesh/glue.h |  1 +
 nimble/host/mesh/src/adv.c   | 27 +++
 nimble/host/mesh/src/glue.c  |  5 +
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/nimble/host/mesh/include/mesh/glue.h 
b/nimble/host/mesh/include/mesh/glue.h
index 66c3818..b1050d8 100644
--- a/nimble/host/mesh/include/mesh/glue.h
+++ b/nimble/host/mesh/include/mesh/glue.h
@@ -287,6 +287,7 @@ void k_delayed_work_cancel(struct k_delayed_work *w);
 void k_delayed_work_submit(struct k_delayed_work *w, uint32_t ms);
 int64_t k_uptime_get(void);
 u32_t k_uptime_get_32(void);
+void k_sleep(int32_t duration);
 void k_work_submit(struct os_callout *w);
 void k_work_add_arg(struct os_callout *w, void *arg);
 void k_delayed_work_add_arg(struct k_delayed_work *w, void *arg);
diff --git a/nimble/host/mesh/src/adv.c b/nimble/host/mesh/src/adv.c
index f5a032c..3dce81c 100644
--- a/nimble/host/mesh/src/adv.c
+++ b/nimble/host/mesh/src/adv.c
@@ -1,6 +1,7 @@
 /*  Bluetooth Mesh */
 
 /*
+ * Copyright (c) 2018 Nordic Semiconductor ASA
  * Copyright (c) 2017 Intel Corporation
  *
  * SPDX-License-Identifier: Apache-2.0
@@ -23,20 +24,22 @@
 #include "prov.h"
 #include "proxy.h"
 
-/* Window and Interval are equal for continuous scanning */
-#define MESH_SCAN_INTERVAL 0x10
-#define MESH_SCAN_WINDOW   0x10
-
 /* Convert from ms to 0.625ms units */
-#define ADV_INT(_ms) ((_ms) * 8 / 5)
+#define ADV_SCAN_UNIT(_ms) ((_ms) * 8 / 5)
+
+/* Window and Interval are equal for continuous scanning */
+#define MESH_SCAN_INTERVAL_MS 10
+#define MESH_SCAN_WINDOW_MS   10
+#define MESH_SCAN_INTERVALADV_SCAN_UNIT(MESH_SCAN_INTERVAL_MS)
+#define MESH_SCAN_WINDOW  ADV_SCAN_UNIT(MESH_SCAN_WINDOW_MS)
 
 /* Pre-5.0 controllers enforce a minimum interval of 100ms
  * whereas 5.0+ controllers can go down to 20ms.
  */
-#define ADV_INT_DEFAULT  K_MSEC(100)
-#define ADV_INT_FAST K_MSEC(20)
+#define ADV_INT_DEFAULT_MS 100
+#define ADV_INT_FAST_MS20
 
-static s32_t adv_int_min =  ADV_INT_DEFAULT;
+static s32_t adv_int_min =  ADV_INT_DEFAULT_MS;
 
 /* TinyCrypt PRNG consumes a lot of stack space, so we need to have
  * an increased call stack whenever it's used.
@@ -97,7 +100,7 @@ static inline void adv_send(struct os_mbuf *buf)
int err;
 
adv_int = max(adv_int_min, adv->adv_int);
-   duration = (adv->count + 1) * (adv_int + 10);
+   duration = MESH_SCAN_WINDOW_MS + (adv->count + 1) * (adv_int + 10);
 
BT_DBG("buf %p, type %u len %u:", buf, adv->type,
   buf->om_len);
@@ -108,7 +111,7 @@ static inline void adv_send(struct os_mbuf *buf)
ad.data_len = buf->om_len;
ad.data = buf->om_data;
 
-   param.itvl_min = ADV_INT(adv_int);
+   param.itvl_min = ADV_SCAN_UNIT(adv_int);
param.itvl_max = param.itvl_min;
param.conn_mode = BLE_GAP_CONN_MODE_NON;
 
@@ -122,7 +125,7 @@ static inline void adv_send(struct os_mbuf *buf)
 
BT_DBG("Advertising started. Sleeping %u ms", duration);
 
-   os_time_delay(OS_TICKS_PER_SEC * duration / 1000);
+   k_sleep(K_MSEC(duration));
 
err = bt_le_adv_stop();
adv_send_end(err, cb, cb_data);
@@ -315,7 +318,7 @@ void bt_mesh_adv_init(void)
 
/* For BT5 controllers we can have fast advertising interval */
if (ble_hs_hci_get_hci_version() >= BLE_HCI_VER_BCS_5_0) {
-   adv_int_min = ADV_INT_FAST;
+   adv_int_min = ADV_INT_FAST_MS;
}
 }
 
diff --git a/nimble/host/mesh/src/glue.c b/nimble/host/mesh/src/glue.c
index 086edaf..b93d9db 100644
--- a/nimble/host/mesh/src/glue.c
+++ b/nimble/host/mesh/src/glue.c
@@ -391,6 +391,11 @@ u32_t k_uptime_get_32(void)
 return k_uptime_get();
 }
 
+void k_sleep(int32_t duration)
+{
+os_time_delay(OS_TICKS_PER_SEC * duration / 1000);
+}
+
 static uint8_t pub[64];
 static uint8_t priv[32];
 static bool has_pub = false;

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


[mynewt-nimble] 29/32: nimble/ll: Use OS_TASK_STACK_DEFINE to init ble_ll stack

2018-03-12 Thread andk
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 7925ccfb83cd15e0bbb9455e8558884ac01103bf
Author: Łukasz Rymanowski 
AuthorDate: Thu Mar 8 14:50:24 2018 +0100

nimble/ll: Use OS_TASK_STACK_DEFINE to init ble_ll stack

This will assure correct aligment

X-Original-Commit: f217015c76f8e2e26a68cc0126f8f9994c96d10f
---
 nimble/controller/src/ble_ll.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 23d8d78..a1775c1 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -217,7 +217,8 @@ static void ble_ll_event_dbuf_overflow(struct os_event *ev);
 #endif
 
 struct os_task g_ble_ll_task;
-os_stack_t g_ble_ll_stack[BLE_LL_STACK_SIZE];
+
+OS_TASK_STACK_DEFINE(g_ble_ll_stack, BLE_LL_STACK_SIZE);
 
 /** Our global device address (public) */
 uint8_t g_dev_addr[BLE_DEV_ADDR_LEN];

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


[mynewt-nimble] 10/32: nimble/gap: Make device name optionally writable

2018-03-12 Thread andk
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 5f5b248e34116179e879f6bf5d47cc7854194329
Author: Andrzej Kaczmarek 
AuthorDate: Fri Feb 23 22:26:00 2018 +0100

nimble/gap: Make device name optionally writable

GAP service takes care of updating characteristic value. Application
can register callback to be notified of value change and can then read
this value and store somewhere (and restore on next boot).

X-Original-Commit: 46e768f451bc4c7a0222348fee384b4d1c87aff1
---
 .../gap/include/services/gap/ble_svc_gap.h |  4 ++
 nimble/host/services/gap/src/ble_svc_gap.c | 67 --
 nimble/host/services/gap/syscfg.yml|  9 +++
 3 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h 
b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
index f4bc213..29bbf48 100644
--- a/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
+++ b/nimble/host/services/gap/include/services/gap/ble_svc_gap.h
@@ -34,6 +34,10 @@ extern "C" {
 #define BLE_SVC_GAP_APPEARANCE_GEN_COMPUTER128
 #define BLE_SVC_GAP_APPEARANCE_CYC_SPEED_AND_CADENCE_SENSOR1157
 
+typedef void (ble_svc_gap_chr_changed_fn) (uint16_t uuid);
+
+void ble_svc_gap_set_chr_changed_cb(ble_svc_gap_chr_changed_fn *cb);
+
 const char *ble_svc_gap_device_name(void);
 int ble_svc_gap_device_name_set(const char *name);
 uint16_t ble_svc_gap_device_appearance(void);
diff --git a/nimble/host/services/gap/src/ble_svc_gap.c 
b/nimble/host/services/gap/src/ble_svc_gap.c
index 2445b9a..7f2818c 100644
--- a/nimble/host/services/gap/src/ble_svc_gap.c
+++ b/nimble/host/services/gap/src/ble_svc_gap.c
@@ -35,6 +35,8 @@
 /* XXX: This should be configurable. */
 #define BLE_SVC_GAP_NAME_MAX_LEN31
 
+static ble_svc_gap_chr_changed_fn *ble_svc_gap_chr_changed_cb_fn;
+
 static char ble_svc_gap_name[BLE_SVC_GAP_NAME_MAX_LEN + 1] =
 MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME);
 static const uint16_t ble_svc_gap_appearance =
@@ -53,7 +55,12 @@ static const struct ble_gatt_svc_def ble_svc_gap_defs[] = {
 /*** Characteristic: Device Name. */
 .uuid = BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_DEVICE_NAME),
 .access_cb = ble_svc_gap_access,
-.flags = BLE_GATT_CHR_F_READ,
+.flags = BLE_GATT_CHR_F_READ |
+#if MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM) >= 0
+ BLE_GATT_CHR_F_WRITE |
+ MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM) |
+#endif
+ 0,
 }, {
 /*** Characteristic: Appearance. */
 .uuid = BLE_UUID16_DECLARE(BLE_SVC_GAP_CHR_UUID16_APPEARANCE),
@@ -85,6 +92,46 @@ static const struct ble_gatt_svc_def ble_svc_gap_defs[] = {
 };
 
 static int
+ble_svc_gap_device_name_read_access(struct ble_gatt_access_ctxt *ctxt)
+{
+int rc;
+
+rc = os_mbuf_append(ctxt->om, ble_svc_gap_name, strlen(ble_svc_gap_name));
+
+return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+}
+
+static int
+ble_svc_gap_device_name_write_access(struct ble_gatt_access_ctxt *ctxt)
+{
+#if MYNEWT_VAL(BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM) < 0
+assert(0);
+return 0;
+#else
+uint16_t om_len;
+int rc;
+
+om_len = OS_MBUF_PKTLEN(ctxt->om);
+if (om_len > BLE_SVC_GAP_NAME_MAX_LEN) {
+return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
+}
+
+rc = ble_hs_mbuf_to_flat(ctxt->om, ble_svc_gap_name, om_len, NULL);
+if (rc != 0) {
+return BLE_ATT_ERR_UNLIKELY;
+}
+
+ble_svc_gap_name[om_len] = '\0';
+
+if (ble_svc_gap_chr_changed_cb_fn) {
+ble_svc_gap_chr_changed_cb_fn(BLE_SVC_GAP_CHR_UUID16_DEVICE_NAME);
+}
+
+return rc;
+#endif
+}
+
+static int
 ble_svc_gap_access(uint16_t conn_handle, uint16_t attr_handle,
struct ble_gatt_access_ctxt *ctxt, void *arg)
 {
@@ -108,10 +155,14 @@ ble_svc_gap_access(uint16_t conn_handle, uint16_t 
attr_handle,
 
 switch (uuid16) {
 case BLE_SVC_GAP_CHR_UUID16_DEVICE_NAME:
-assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
-rc = os_mbuf_append(ctxt->om, ble_svc_gap_name,
-strlen(ble_svc_gap_name));
-return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) {
+rc = ble_svc_gap_device_name_read_access(ctxt);
+} else if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
+rc = ble_svc_gap_device_name_write_access(ctxt);
+} else {
+assert(0);
+}
+return rc;
 
 case BLE_SVC_GAP_CHR_UUID16_APPEARANCE:
 assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
@@ -167,6 +218,12 @@ ble_svc_gap_device_appearance(void)
 }
 
 void
+ble_svc_gap_set_chr_changed_cb(ble_svc_gap_chr_changed_f

[GitHub] andrzej-kaczmarek opened a new pull request #907: [WIP] nimble: Remove NimBLE code from core repository

2018-03-12 Thread GitBox
andrzej-kaczmarek opened a new pull request #907: [WIP] nimble: Remove NimBLE 
code from core repository
URL: https://github.com/apache/mynewt-core/pull/907
 
 
   This PR removes NimBLE code from core repository and sets dependency for 
each package to new apache-mynewt-nimble repository. Latest `newt` is required 
for this to work properly, i.e. download dependency and build code using 
external repository.
   
   NOTE:
   Temporarily dependency to apache-mynewt-nimble repository points to my 
forked repo where I put proposed structure of NimBLE code. This is basically 
rewritten history of apache-mynewt-core with only commits related to NimBLE 
included. Each commit has `X-Original-Commit` added with commit id of source 
commit in apache-mynewt-core repository to make lookups easier.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mkiiskila commented on issue #893: libc: Conditionally compile float support in printf

2018-03-12 Thread GitBox
mkiiskila commented on issue #893: libc: Conditionally compile float support in 
printf
URL: https://github.com/apache/mynewt-core/pull/893#issuecomment-372378760
 
 
   Test this please


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated (15cef3a -> 27b97ed)

2018-03-12 Thread marko
This is an automated email from the ASF dual-hosted git repository.

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


from 15cef3a  Add stm32 common hal for shared drivers
 add 7ebdc7c  libc: Conditionally compile float support in printf
 new 27b97ed  Merge pull request #893 from 
michal-narajowski/float-printf-fix

The 1 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:
 libc/baselibc/src/tinyprintf.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

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


[GitHub] mkiiskila closed pull request #893: libc: Conditionally compile float support in printf

2018-03-12 Thread GitBox
mkiiskila closed pull request #893: libc: Conditionally compile float support 
in printf
URL: https://github.com/apache/mynewt-core/pull/893
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/libc/baselibc/src/tinyprintf.c b/libc/baselibc/src/tinyprintf.c
index 1fc262394..9ab3358da 100644
--- a/libc/baselibc/src/tinyprintf.c
+++ b/libc/baselibc/src/tinyprintf.c
@@ -65,6 +65,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include 
 #include 
 
+#include "syscfg/syscfg.h"
+
 struct param {
 unsigned char width; /**< field width */
 char lz;/**< Leading zeros */
@@ -238,8 +240,10 @@ size_t tfp_format(FILE *putp, const char *fmt, va_list va)
 char ch;
 char lng;
 void *v;
+#if MYNEWT_VAL(FLOAT_USER)
 double d;
 int n;
+#endif
 
 p.bf = bf;
 
@@ -339,11 +343,12 @@ size_t tfp_format(FILE *putp, const char *fmt, va_list va)
 written += putchw(putp, &p);
 p.bf = bf;
 break;
+#if MYNEWT_VAL(FLOAT_USER)
 case 'f':
 p.base = 10;
 d = va_arg(va, double);
 /* Cast to an int to get the integer part of the number */
-n = (int)d;
+n = d;
 /* Convert to ascii */
 i2a(n, &p);
 /* Ignore left align for integer part */
@@ -358,7 +363,7 @@ size_t tfp_format(FILE *putp, const char *fmt, va_list va)
 written += putchw(putp, &p);
 /* Take the decimal part and multiply by 1000 */
 n = (d-n)*1000;
-/* Convert to asii */
+/* Convert to ascii */
 i2a(n, &p);
 /* Set the leading zeros for the next integer output to 3 */
 p.lz = 3;
@@ -371,6 +376,7 @@ size_t tfp_format(FILE *putp, const char *fmt, va_list va)
 /* Output the decimal part. */
 written += putchw(putp, &p);
 break;
+#endif
 case '%':
 written += putf(putp, ch);
 break;


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] 01/01: Merge pull request #893 from michal-narajowski/float-printf-fix

2018-03-12 Thread marko
This is an automated email from the ASF dual-hosted git repository.

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

commit 27b97edc8b15c998b7b302ed93dc3b9eacf9ad54
Merge: 15cef3a 7ebdc7c
Author: mkiiskila 
AuthorDate: Mon Mar 12 19:17:46 2018 +0200

Merge pull request #893 from michal-narajowski/float-printf-fix

libc: Conditionally compile float support in printf

 libc/baselibc/src/tinyprintf.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

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


[GitHub] vrahane opened a new issue #908: lps33hw/hb sensor driver and sensor API support

2018-03-12 Thread GitBox
vrahane opened a new issue #908: lps33hw/hb sensor driver and sensor API support
URL: https://github.com/apache/mynewt-core/issues/908
 
 
   - Driver and sensor API support for LPS33HW/HB


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] 01/01: Merge pull request #905 from mkiiskila/malloc_fixes

2018-03-12 Thread marko
This is an automated email from the ASF dual-hosted git repository.

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

commit 83f6f87d0b53447dc85dc7c36e95a61bae95fa0c
Merge: 27b97ed 286f323
Author: mkiiskila 
AuthorDate: Mon Mar 12 20:05:11 2018 +0200

Merge pull request #905 from mkiiskila/malloc_fixes

Possible integer overflows when computing malloc sizes

 libc/baselibc/src/calloc.c  | 8 ++--
 libc/baselibc/src/malloc.c  | 4 +++-
 libc/baselibc/src/realloc.c | 9 +
 net/oic/src/api/oc_ri.c | 2 --
 4 files changed, 14 insertions(+), 9 deletions(-)

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


[GitHub] mkiiskila closed pull request #905: Possible integer overflows when computing malloc sizes

2018-03-12 Thread GitBox
mkiiskila closed pull request #905: Possible integer overflows when computing 
malloc sizes
URL: https://github.com/apache/mynewt-core/pull/905
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/libc/baselibc/src/calloc.c b/libc/baselibc/src/calloc.c
index 3db76649d..505339b05 100644
--- a/libc/baselibc/src/calloc.c
+++ b/libc/baselibc/src/calloc.c
@@ -4,13 +4,17 @@
 
 #include 
 #include 
-
-/* FIXME: This should look for multiplication overflow */
+#include 
 
 void *calloc(size_t nmemb, size_t size)
 {
void *ptr;
+int nb;
 
+nb = sizeof(size_t) * 4;
+if (size >= SIZE_MAX >> nb || nmemb >= SIZE_MAX >> nb) {
+return NULL;
+}
size *= nmemb;
ptr = malloc(size);
if (ptr)
diff --git a/libc/baselibc/src/malloc.c b/libc/baselibc/src/malloc.c
index c00b08892..2bf45515d 100644
--- a/libc/baselibc/src/malloc.c
+++ b/libc/baselibc/src/malloc.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "malloc.h"
 
 /* Both the arena list and the free memory list are double linked
@@ -148,8 +149,9 @@ void *malloc(size_t size)
 void *more_mem;
 extern void *_sbrk(int incr);
 
-if (size == 0)
+if (size == 0 || size > (SIZE_MAX - sizeof(struct arena_header))) {
 return NULL;
+}
 
 /* Add the obligatory arena header, and round up */
 size = (size + 2 * sizeof(struct arena_header) - 1) & ARENA_SIZE_MASK;
diff --git a/libc/baselibc/src/realloc.c b/libc/baselibc/src/realloc.c
index 77e8acb26..5bfab3136 100644
--- a/libc/baselibc/src/realloc.c
+++ b/libc/baselibc/src/realloc.c
@@ -18,7 +18,7 @@ void *realloc(void *ptr, size_t size)
if (!ptr)
return malloc(size);
 
-   if (size == 0) {
+   if (size == 0 || size > (SIZE_MAX - sizeof(struct arena_header))) {
free(ptr);
return NULL;
}
@@ -40,11 +40,12 @@ void *realloc(void *ptr, size_t size)
oldsize = ah->a.size - sizeof(struct arena_header);
 
newptr = malloc(size);
-if(newptr) {
+if (newptr) {
 memcpy(newptr, ptr, (size < oldsize) ? size : oldsize);
+free(ptr);
+} else {
+newptr = ptr;
 }
-   free(ptr);
-
return newptr;
}
 }
diff --git a/net/oic/src/api/oc_ri.c b/net/oic/src/api/oc_ri.c
index a99702536..a1211d658 100644
--- a/net/oic/src/api/oc_ri.c
+++ b/net/oic/src/api/oc_ri.c
@@ -228,8 +228,6 @@ oc_ri_mem_init(void)
 void
 oc_ri_init(void)
 {
-oc_random_init(0); // Fix: allow user to seed RNG.
-
 #ifdef OC_CLIENT
 SLIST_INIT(&oc_client_cbs);
 #endif


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated (27b97ed -> 83f6f87)

2018-03-12 Thread marko
This is an automated email from the ASF dual-hosted git repository.

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


from 27b97ed  Merge pull request #893 from 
michal-narajowski/float-printf-fix
 add 450b9b9  libc; fix possible integer overflow on allocation size.
 add 167eb69  libc; fix integer overflow of alloc size due to 
multiplication.
 add 286f323  net/oic; remove initialization of pseudo random generator to 
known number.
 new 83f6f87  Merge pull request #905 from mkiiskila/malloc_fixes

The 1 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:
 libc/baselibc/src/calloc.c  | 8 ++--
 libc/baselibc/src/malloc.c  | 4 +++-
 libc/baselibc/src/realloc.c | 9 +
 net/oic/src/api/oc_ri.c | 2 --
 4 files changed, 14 insertions(+), 9 deletions(-)

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


[GitHub] vrahane closed issue #908: lps33hw/hb sensor driver and sensor API support

2018-03-12 Thread GitBox
vrahane closed issue #908: lps33hw/hb sensor driver and sensor API support
URL: https://github.com/apache/mynewt-core/issues/908
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated (83f6f87 -> 2219af5)

2018-03-12 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

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


from 83f6f87  Merge pull request #905 from mkiiskila/malloc_fixes
 add 2bff0e1  Sensors LPS33HW: basic pressure output
 add 9c3be65  Sensors LPS33HW: added some config functions
 add c75dc85  Sensors LPS33HW: Can now read with the API
 add bf93630  Sensors LPS33HW: interrupts still need some work to fit into 
the API but are basically functional
 add 100f778  Sensors LPS33HW: Improvements to shell. More progress towards 
high/low notification interrupts.
 add 7fec134  Sensors LPS33HW: Stream read now triggered by sensor_read
 add 85ea4b6  Sensors lps33hw/lps22hb: Fixed threshold interrupt paths
 new 2219af5  Merge pull request #881 from vsyn/lps33hw

The 1 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:
 .../sensors/lps33hw/include/lps33hw/lps33hw.h  | 218 +
 hw/drivers/{lp5523 => sensors/lps33hw}/pkg.yml |  25 +-
 hw/drivers/sensors/lps33hw/src/lps33hw.c   | 874 +
 hw/drivers/sensors/lps33hw/src/lps33hw_priv.h  | 108 +++
 hw/drivers/sensors/lps33hw/src/lps33hw_shell.c | 145 
 hw/drivers/{lp5523 => sensors/lps33hw}/syscfg.yml  |  22 +-
 hw/sensor/creator/src/sensor_creator.c |  59 +-
 hw/sensor/creator/syscfg.yml   |   3 +
 8 files changed, 1431 insertions(+), 23 deletions(-)
 create mode 100644 hw/drivers/sensors/lps33hw/include/lps33hw/lps33hw.h
 copy hw/drivers/{lp5523 => sensors/lps33hw}/pkg.yml (83%)
 create mode 100644 hw/drivers/sensors/lps33hw/src/lps33hw.c
 create mode 100644 hw/drivers/sensors/lps33hw/src/lps33hw_priv.h
 create mode 100644 hw/drivers/sensors/lps33hw/src/lps33hw_shell.c
 copy hw/drivers/{lp5523 => sensors/lps33hw}/syscfg.yml (66%)

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


[GitHub] vrahane closed pull request #881: Lps33hw

2018-03-12 Thread GitBox
vrahane closed pull request #881: Lps33hw
URL: https://github.com/apache/mynewt-core/pull/881
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/drivers/sensors/lps33hw/include/lps33hw/lps33hw.h 
b/hw/drivers/sensors/lps33hw/include/lps33hw/lps33hw.h
new file mode 100644
index 0..8c92e723b
--- /dev/null
+++ b/hw/drivers/sensors/lps33hw/include/lps33hw/lps33hw.h
@@ -0,0 +1,218 @@
+/*
+ * 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 __SENSOR_LPS33HW_H__
+#define __SENSOR_LPS33HW_H__
+
+#include "os/os.h"
+#include "os/os_dev.h"
+#include "sensor/sensor.h"
+#include "hal/hal_gpio.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LPS33HW_I2C_ADDR (0x5C)
+
+#define LPS33HW_INT_LEVEL (0x80)
+#define LPS33HW_INT_OPEN (0x40)
+#define LPS33HW_INT_LATCH_EN (0x20)
+#define LPS33HW_INT_RD_CLEAR (0x10)
+
+enum lps33hw_output_data_rates {
+LPS33HW_ONE_SHOT= 0x00,
+LPS33HW_1HZ = 0x01,
+LPS33HW_10HZ= 0x02,
+LPS33HW_25HZ= 0x03,
+LPS33HW_50HZ= 0x04,
+LPS33HW_75HZ= 0x05
+};
+
+enum lps33hw_low_pass_config {
+LPS33HW_LPF_DISABLED= 0x00, /* Bandwidth = data rate / 2 */
+LPS33HW_LPF_ENABLED_LOW_BW  = 0x02, /* Bandwidth = data rate / 9 */
+LPS33HW_LPF_ENABLED_HIGH_BW = 0x03  /* Bandwidth = data rate / 20 */
+};
+
+struct lps33hw_int_cfg {
+uint8_t pin;
+unsigned int data_rdy : 1;
+unsigned int pressure_low : 1;
+unsigned int pressure_high : 1;
+unsigned int active_low : 1;
+unsigned int open_drain : 1;
+unsigned int latched : 1;
+};
+
+struct lps33hw_cfg {
+sensor_type_t mask;
+struct lps33hw_int_cfg int_cfg;
+enum lps33hw_output_data_rates data_rate;
+enum lps33hw_low_pass_config lpf;
+unsigned int autozero : 1;
+unsigned int autorifp : 1;
+};
+
+struct lps33hw_private_driver_data {
+sensor_data_func_t user_handler;
+void *user_arg;
+};
+
+struct lps33hw {
+struct os_dev dev;
+struct sensor sensor;
+struct lps33hw_cfg cfg;
+os_time_t last_read_time;
+struct lps33hw_private_driver_data pdd;
+};
+
+/**
+ * Set the output data rate.
+ *
+ * @param The interface object associated with the lps33hw.
+ * @param Data rate value.
+ *
+ * @return 0 on success, non-zero error on failure.
+ */
+int lps33hw_set_data_rate(struct sensor_itf *itf,
+enum lps33hw_output_data_rates rate);
+
+/**
+ * Configure the Low Pass Filter.
+ *
+ * @param The interface object associated with the lps33hw.
+ * @param Low pass filter config value
+ *
+ * @return 0 on success, non-zero error on failure.
+ */
+int lps33hw_set_lpf(struct sensor_itf *itf,
+enum lps33hw_low_pass_config lpf);
+
+/**
+ * Software reset.
+ *
+ * @param The interface object associated with the lps33hw.
+ *
+ * @return 0 on success, non-zero error on failure.
+ */
+int lps33hw_reset(struct sensor_itf *itf);
+
+/*
+ * Get pressure.
+ *
+ * @param The interface object associated with the lps33hw.
+ * @param Pressure.
+ *
+ * @return 0 on success, non-zero error on failure.
+ */
+int lps33hw_get_pressure(struct sensor_itf *itf, float *pressure);
+
+/*
+ * Get temperature.
+ *
+ * @param The interface object associated with the lps33hw.
+ * @param Temperature.
+ *
+ * @return 0 on success, non-zero error on failure.
+ */
+int lps33hw_get_temperature(struct sensor_itf *itf, float *temperature);
+
+/*
+ * Set pressure reference.
+ *
+ * @param The interface object associated with the lps33hw.
+ * @param The pressure reference.
+ *
+ * @return 0 on success, non-zero error on failure.
+ */
+int lps33hw_set_reference(struct sensor_itf *itf, float reference);
+
+/*
+ * Set pressure threshold.
+ *
+ * @param The interface object associated with the lps33hw.
+ * @param The pressure reference.
+ *
+ * @return 0 on success, non-zero error on failure.
+ */
+int lps33hw_set_threshold(struct sensor_itf *itf, float threshold);
+
+/*
+ * Set pressure RPDS.
+ *
+ * 

[mynewt-core] 01/01: Merge pull request #881 from vsyn/lps33hw

2018-03-12 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

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

commit 2219af59c13af3a62b4f21f991511a857ef49e1f
Merge: 83f6f87 85ea4b6
Author: Vipul Rahane 
AuthorDate: Mon Mar 12 11:41:35 2018 -0700

Merge pull request #881 from vsyn/lps33hw

- Lps33hw
- This resolves #908

 .../sensors/lps33hw/include/lps33hw/lps33hw.h  | 218 +
 hw/drivers/sensors/lps33hw/pkg.yml |  42 +
 hw/drivers/sensors/lps33hw/src/lps33hw.c   | 874 +
 hw/drivers/sensors/lps33hw/src/lps33hw_priv.h  | 108 +++
 hw/drivers/sensors/lps33hw/src/lps33hw_shell.c | 145 
 hw/drivers/sensors/lps33hw/syscfg.yml  |  34 +
 hw/sensor/creator/src/sensor_creator.c |  59 +-
 hw/sensor/creator/syscfg.yml   |   3 +
 8 files changed, 1481 insertions(+), 2 deletions(-)

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


[mynewt-newtmgr] branch master updated (32fc865 -> 6f35f3d)

2018-03-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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


from 32fc865  Merge pull request #70 from ccollins476ad/dbl-shutdown
 add b9038fa  bll - Allow OwnAddrType to be specified in linux.
 new 6f35f3d  Merge pull request #69 from ccollins476ad/conn-params

The 1 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:
 newtmgr/bll/bll_xport.go   |  9 +++-
 newtmgr/bll/bll_xport_linux.go | 61 ++
 ...l_sesn_cfg_windows.go => bll_xport_nonlinux.go} | 21 +++-
 newtmgr/cli/common.go  |  1 +
 newtmgr/config/bll_config.go   | 14 +++--
 5 files changed, 88 insertions(+), 18 deletions(-)
 create mode 100644 newtmgr/bll/bll_xport_linux.go
 copy newtmgr/bll/{bll_sesn_cfg_windows.go => bll_xport_nonlinux.go} (73%)

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


[mynewt-newtmgr] 01/01: Merge pull request #69 from ccollins476ad/conn-params

2018-03-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 6f35f3df1af03ad3f04bf1be88962c4479f4f6bc
Merge: 32fc865 b9038fa
Author: ccollins476ad 
AuthorDate: Mon Mar 12 11:59:30 2018 -0700

Merge pull request #69 from ccollins476ad/conn-params

bll - Allow OwnAddrType to be specified in linux.

 newtmgr/bll/bll_xport.go  |  9 +-
 newtmgr/bll/bll_xport_linux.go| 61 +++
 newtmgr/bll/bll_xport_nonlinux.go | 34 ++
 newtmgr/cli/common.go |  1 +
 newtmgr/config/bll_config.go  | 14 +++--
 5 files changed, 115 insertions(+), 4 deletions(-)

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


[GitHub] ccollins476ad closed pull request #69: bll - Allow OwnAddrType to be specified in linux.

2018-03-12 Thread GitBox
ccollins476ad closed pull request #69: bll - Allow OwnAddrType to be specified 
in linux.
URL: https://github.com/apache/mynewt-newtmgr/pull/69
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/newtmgr/bll/bll_xport.go b/newtmgr/bll/bll_xport.go
index 6cecf28..06c9b33 100644
--- a/newtmgr/bll/bll_xport.go
+++ b/newtmgr/bll/bll_xport.go
@@ -27,11 +27,13 @@ import (
"github.com/go-ble/ble"
"github.com/go-ble/ble/examples/lib/dev"
 
+   "mynewt.apache.org/newtmgr/nmxact/bledefs"
"mynewt.apache.org/newtmgr/nmxact/sesn"
 )
 
 type XportCfg struct {
-   CtlrName string
+   CtlrNamestring
+   OwnAddrType bledefs.BleAddrType
 }
 
 func NewXportCfg() XportCfg {
@@ -65,6 +67,11 @@ func (bx *BllXport) Start() error {
return err
}
 
+   // Set the connection parameters to use for all initiated connections.
+   if err := BllXportSetConnParams(d, bx.cfg.OwnAddrType); err != nil {
+   return err
+   }
+
ble.SetDefaultDevice(d)
 
return nil
diff --git a/newtmgr/bll/bll_xport_linux.go b/newtmgr/bll/bll_xport_linux.go
new file mode 100644
index 000..a4174ec
--- /dev/null
+++ b/newtmgr/bll/bll_xport_linux.go
@@ -0,0 +1,61 @@
+// +build linux
+
+/**
+ * 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.
+ */
+
+package bll
+
+import (
+   "github.com/go-ble/ble"
+   "github.com/go-ble/ble/linux"
+   "github.com/go-ble/ble/linux/hci"
+   "github.com/go-ble/ble/linux/hci/cmd"
+
+   "mynewt.apache.org/newt/util"
+   "mynewt.apache.org/newtmgr/nmxact/bledefs"
+)
+
+func BllXportSetConnParams(dev ble.Device, ownAddrType bledefs.BleAddrType) 
error {
+   ldev := dev.(*linux.Device)
+
+   cc := cmd.LECreateConnection{
+   LEScanInterval:0x0010, // 0x0004 - 0x4000; N * 0.625 
msec
+   LEScanWindow:  0x0010, // 0x0004 - 0x4000; N * 0.625 
msec
+   InitiatorFilterPolicy: 0x00,   // White list is not used
+   OwnAddressType:uint8(ownAddrType),
+   ConnIntervalMin:   0x0006, // 0x0006 - 0x0C80; N * 1.25 msec
+   ConnIntervalMax:   0x0006, // 0x0006 - 0x0C80; N * 1.25 msec
+   ConnLatency:   0x, // 0x - 0x01F3; N * 1.25 msec
+   SupervisionTimeout:0x0048, // 0x000A - 0x0C80; N * 10 msec
+   MinimumCELength:   0x, // 0x - 0x; N * 0.625 
msec
+   MaximumCELength:   0x, // 0x - 0x; N * 0.625 
msec
+
+   // Specified at connect time.
+   PeerAddressType: 0x00,  // Public Device Address
+   PeerAddress: [6]byte{}, //
+   }
+
+   opt := hci.OptConnParams(cc)
+   if err := ldev.HCI.Option(opt); err != nil {
+   return util.FmtNewtError("error setting connection parameters: 
%s",
+   err.Error())
+   }
+
+   return nil
+}
diff --git a/newtmgr/bll/bll_xport_nonlinux.go 
b/newtmgr/bll/bll_xport_nonlinux.go
new file mode 100644
index 000..cc88a51
--- /dev/null
+++ b/newtmgr/bll/bll_xport_nonlinux.go
@@ -0,0 +1,34 @@
+// +build !linux
+
+/**
+ * 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 

[GitHub] jacobrosenthal commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU

2018-03-12 Thread GitBox
jacobrosenthal commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU
URL: https://github.com/apache/mynewt-core/pull/897#issuecomment-372455868
 
 
   Speaking of duplication, the empty boards.h in nordic targets was me back in 
the day
   
https://github.com/apache/mynewt-core/commit/c37a30581aa7cbbb763baf31e9000d32f75f40ce
   
   I just tested and with new sdk Im not seeing any errors with those removed 
on an nrf51 or nrf52 target
   
   Shall we wipe that out too?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU

2018-03-12 Thread GitBox
jacobrosenthal commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU
URL: https://github.com/apache/mynewt-core/pull/897#issuecomment-372455868
 
 
   Speaking of duplication, the empty boards.h in nordic targets was me back in 
the day
   
https://github.com/apache/mynewt-core/commit/c37a30581aa7cbbb763baf31e9000d32f75f40ce
   
   I just tested and with new sdk Im not seeing any errors on an nrf51 or nrf52 
target
   
   Shall we wipe that out too?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] wes3 opened a new pull request #909: lora coding style changes

2018-03-12 Thread GitBox
wes3 opened a new pull request #909: lora coding style changes
URL: https://github.com/apache/mynewt-core/pull/909
 
 
   This PR is to update some of the semtech driver code to look more like 
mynewt coding standards. There is also a simple bug fix thrown in there as well 
(for sx1272 code when HAS_ANT_SW is set to a valid pin). Not sure about 
additional changes to the code for coding style (for example, renaming 
functions to meet our caps style).


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on issue #901: ble service: Device Information Service

2018-03-12 Thread GitBox
jacobrosenthal commented on issue #901: ble service: Device Information Service
URL: https://github.com/apache/mynewt-core/pull/901#issuecomment-372459003
 
 
   @sdalu I took a shot at one of these a while ago and got busy and never PRed 
so thanks!
   
   BTW I ended up finding newt's 'config' stuff, and filled a bunch of these 
from there
   
https://github.com/jacobrosenthal/mynewt-nimble-services/blob/master/services/dis/src/ble_svc_dis.c#L105
   
   None of these are 'right', I just wanted to point out I think this is where 
a lot of these values are stored 'the newt way' right now for people who use 
newtmgr


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] wes3 commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU

2018-03-12 Thread GitBox
wes3 commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU
URL: https://github.com/apache/mynewt-core/pull/897#issuecomment-372461645
 
 
   Removal of boards.h has been a long time coming...


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU

2018-03-12 Thread GitBox
utzig commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU
URL: https://github.com/apache/mynewt-core/pull/897#issuecomment-372461937
 
 
   Cmon, I agree, but not here! :P


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on a change in pull request #904: ble service: Battery Service

2018-03-12 Thread GitBox
jacobrosenthal commented on a change in pull request #904: ble service: Battery 
Service
URL: https://github.com/apache/mynewt-core/pull/904#discussion_r173946324
 
 

 ##
 File path: net/nimble/host/services/bas/syscfg.yml
 ##
 @@ -0,0 +1,32 @@
+# 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.
+
+syscfg.defs:
+BLE_SVC_BAS_BATTERY_LEVEL_PERM:
+description: >
+Defines permissions for writing "Battery Level" characteristics. 
Can
+be zero to allow write without extra permissions or combination of:
 
 Review comment:
   Defines permissions for *reading "Battery Level"
   and
   Can be zero to allow *read without extra permissions or combination of
   
   And maybe BLE_SVC_BAS_BATTERY_LEVEL_PERM should be 
BLE_SVC_BAS_BATTERY_LEVEL_READ_PERM but I dont particularly care either way.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] wes3 commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU

2018-03-12 Thread GitBox
wes3 commented on issue #897: Move cmsis_nvic.h files frm BSP to MCU
URL: https://github.com/apache/mynewt-core/pull/897#issuecomment-372462596
 
 
   Oh sorry; I did not mean to add it to this PR necessarily. Just that I 
thought it a good idea.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on a change in pull request #901: ble service: Device Information Service

2018-03-12 Thread GitBox
jacobrosenthal commented on a change in pull request #901: ble service: Device 
Information Service
URL: https://github.com/apache/mynewt-core/pull/901#discussion_r173951286
 
 

 ##
 File path: net/nimble/host/services/dis/syscfg.yml
 ##
 @@ -0,0 +1,80 @@
+# 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.
+#
+
+# Package: ble/host/services/dis
+
+syscfg.defs:
+BLE_SVC_DIS_MODEL_NUMBER_READ_PERM:
+description: >
+Defines permissions for writing "Model Number" characteristics. Can
 
 Review comment:
   Same thing here, these should all be Defines permissions for *reading


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on a change in pull request #901: ble service: Device Information Service

2018-03-12 Thread GitBox
jacobrosenthal commented on a change in pull request #901: ble service: Device 
Information Service
URL: https://github.com/apache/mynewt-core/pull/901#discussion_r173953401
 
 

 ##
 File path: net/nimble/host/services/dis/src/ble_svc_dis.c
 ##
 @@ -0,0 +1,249 @@
+/**
+ * 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.
+ */
+
+#include 
+#include 
+#include "sysinit/sysinit.h"
+#include "host/ble_hs.h"
+#include "services/dis/ble_svc_dis.h"
+
+/* Device information */
+struct ble_svc_dis_data ble_svc_dis_data = { 0 };
+
+/* Access function */
+static int
+ble_svc_dis_access(uint16_t conn_handle, uint16_t attr_handle,
+   struct ble_gatt_access_ctxt *ctxt, void *arg);
+
+static const struct ble_gatt_svc_def ble_svc_dis_defs[] = {
+{ /*** Service: Device Information Service (DIS). */
+.type = BLE_GATT_SVC_TYPE_PRIMARY,
+.uuid = BLE_UUID16_DECLARE(BLE_SVC_DIS_UUID16),
+.characteristics = (struct ble_gatt_chr_def[]) { {
+#if (MYNEWT_VAL(BLE_SVC_DIS_MODEL_NUMBER_READ_PERM) >= 0)
+   /*** Characteristic: Model Number String */
+.uuid = BLE_UUID16_DECLARE(BLE_SVC_DIS_CHR_UUID16_MODEL_NUMBER),
+.access_cb = ble_svc_dis_access,
+.flags = BLE_GATT_CHR_F_READ |
+MYNEWT_VAL(BLE_SVC_DIS_MODEL_NUMBER_READ_PERM),
+}, {
+#endif
+#if (MYNEWT_VAL(BLE_SVC_DIS_SERIAL_NUMBER_READ_PERM) >= 0)
+   /*** Characteristic: Serial Number String */
+.uuid = BLE_UUID16_DECLARE(BLE_SVC_DIS_CHR_UUID16_SERIAL_NUMBER),
+.access_cb = ble_svc_dis_access,
+.flags = BLE_GATT_CHR_F_READ |
+MYNEWT_VAL(BLE_SVC_DIS_SERIAL_NUMBER_READ_PERM),
+}, {
+#endif
+#if (MYNEWT_VAL(BLE_SVC_DIS_HARDWARE_REVISION_READ_PERM) >= 0)
+   /*** Characteristic: Hardware Revision String */
+.uuid = 
BLE_UUID16_DECLARE(BLE_SVC_DIS_CHR_UUID16_HARDWARE_REVISION),
+.access_cb = ble_svc_dis_access,
+.flags = BLE_GATT_CHR_F_READ |
+MYNEWT_VAL(BLE_SVC_DIS_HARDWARE_REVISION_READ_PERM),
+}, {
+#endif
+#if (MYNEWT_VAL(BLE_SVC_DIS_FIRMWARE_REVISION_READ_PERM) >= 0)
+   /*** Characteristic: Firmware Revision String */
+.uuid = 
BLE_UUID16_DECLARE(BLE_SVC_DIS_CHR_UUID16_FIRMWARE_REVISION),
+.access_cb = ble_svc_dis_access,
+.flags = BLE_GATT_CHR_F_READ |
+MYNEWT_VAL(BLE_SVC_DIS_FIRMWARE_REVISION_READ_PERM),
+}, {
+#endif
+#if (MYNEWT_VAL(BLE_SVC_DIS_SOFTWARE_REVISION_READ_PERM) >= 0)
+   /*** Characteristic: Software Revision String */
+.uuid = 
BLE_UUID16_DECLARE(BLE_SVC_DIS_CHR_UUID16_SOFTWARE_REVISION),
+.access_cb = ble_svc_dis_access,
+.flags = BLE_GATT_CHR_F_READ |
+MYNEWT_VAL(BLE_SVC_DIS_SOFTWARE_REVISION_READ_PERM),
+}, {
+#endif
+#if (MYNEWT_VAL(BLE_SVC_DIS_MANUFACTURER_NAME_READ_PERM) >= 0)
+   /*** Characteristic: Manufacturer Name */
+.uuid = 
BLE_UUID16_DECLARE(BLE_SVC_DIS_CHR_UUID16_MANUFACTURER_NAME),
+.access_cb = ble_svc_dis_access,
+.flags = BLE_GATT_CHR_F_READ |
+MYNEWT_VAL(BLE_SVC_DIS_MANUFACTURER_NAME_READ_PERM),
+}, {
+#endif
+0, /* No more characteristics in this service */
+}, }
+},
+
+{
+0, /* No more services. */
+},
+};
+
+/**
+ * Simple write access callback for the device information service
 
 Review comment:
   *read access callback


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] andrzej-kaczmarek commented on a change in pull request #901: ble service: Device Information Service

2018-03-12 Thread GitBox
andrzej-kaczmarek commented on a change in pull request #901: ble service: 
Device Information Service
URL: https://github.com/apache/mynewt-core/pull/901#discussion_r173953518
 
 

 ##
 File path: net/nimble/host/services/dis/syscfg.yml
 ##
 @@ -0,0 +1,80 @@
+# 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.
+#
+
+# Package: ble/host/services/dis
+
+syscfg.defs:
+BLE_SVC_DIS_MODEL_NUMBER_READ_PERM:
+description: >
+Defines permissions for writing "Model Number" characteristics. Can
 
 Review comment:
   Also looking at this now I wonder if we should have just one read_perm 
syscfg for all characteristics and enable for each characteristic separately? I 
am not sure if there is scenario for setting different permissions for each 
characteristic here.
   
   Not really sure what is the proper solution here, just thinking out loud.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] andrzej-kaczmarek commented on issue #901: ble service: Device Information Service

2018-03-12 Thread GitBox
andrzej-kaczmarek commented on issue #901: ble service: Device Information 
Service
URL: https://github.com/apache/mynewt-core/pull/901#issuecomment-372471790
 
 
   My proposal with default values was not to propagate each characteristic 
with "computed" value but simply have syscfg with simple string for all/some 
characteristics - just to e.g. define manufacturer or model name from app or 
settings easily. I think DIS implementation should be just generic one as it is 
now.
   
   @jacobrosenthal I think reading these values from config and configuring DIS 
accordingly could be a nice example to include in one of sample apps - blehr or 
blecsc perhaps?
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on issue #901: ble service: Device Information Service

2018-03-12 Thread GitBox
jacobrosenthal commented on issue #901: ble service: Device Information Service
URL: https://github.com/apache/mynewt-core/pull/901#issuecomment-372472834
 
 
   @andrzej-kaczmarek Yeah either seems cool to me. We should figure out what 
some good newt defaults would be, that was my first pass a year ago.
   
   @sdalu  No opinon on some defaults here, Technically theyre all optional in 
the spec so you could do it empty, so maybe ifdef guard this?
   
   But currently if the user doesnt set any syscfg read permissions you get a 
compile error so well have to guard or default
   ```
   Error: 
repos/apache-mynewt-core/net/nimble/host/services/dis/src/ble_svc_dis.c:101:1: 
error: 'ble_svc_dis_access' defined but not used [-Werror=unused-function]
ble_svc_dis_access(uint16_t conn_handle, uint16_t attr_handle,
^
   cc1: all warnings being treated as errors
   ```
   
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] andrzej-kaczmarek commented on issue #903: service/ans: don't depent on libm for creating bitmask

2018-03-12 Thread GitBox
andrzej-kaczmarek commented on issue #903: service/ans: don't depent on libm 
for creating bitmask
URL: https://github.com/apache/mynewt-core/pull/903#issuecomment-372476574
 
 
   @sdalu In general if you just want to fix something in your last commit then 
do `git commit --amend` and then push the result to the same branch with `-f` 
option - this will replace your remote branch with fixed commit and PR will be 
also updated. This way for simple fixes we'll just have single commit with all 
changes instead of series of fixes-for-fixes-for-fix. For editing/squashing 
multiple commits take a look here: 
https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History.
   
   For this simple change I guess we can squash from GitHub ;-)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: service/ans: don't depent on libm for creating bitmask (#903)

2018-03-12 Thread andk
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 0fc4943  service/ans: don't depent on libm for creating bitmask (#903)
0fc4943 is described below

commit 0fc4943638290b121b92bc87266860802ee91258
Author: Stéphane D'Alu 
AuthorDate: Mon Mar 12 22:58:31 2018 +0100

service/ans: don't depent on libm for creating bitmask (#903)
---
 net/nimble/host/services/ans/src/ble_svc_ans.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/net/nimble/host/services/ans/src/ble_svc_ans.c 
b/net/nimble/host/services/ans/src/ble_svc_ans.c
index 507d795..ec58bd5 100644
--- a/net/nimble/host/services/ans/src/ble_svc_ans.c
+++ b/net/nimble/host/services/ans/src/ble_svc_ans.c
@@ -19,12 +19,6 @@
 
 #include 
 #include 
-#include 
-
-/* Some ambiq SDK headers use `OVERFLOW` as an identifier.  This is a macro
- * that is leaked by some versions of math.h.
- */
-#undef OVERFLOW
 
 #include "sysinit/sysinit.h"
 #include "syscfg/syscfg.h"
@@ -32,7 +26,6 @@
 #include "host/ble_gap.h"
 #include "services/ans/ble_svc_ans.h"
 
-
 /* Max length of new alert info string */
 #define BLE_SVC_ANS_INFO_STR_MAX_LEN18
 /* Max length of a new alert notification, max string length + 2 bytes
@@ -349,7 +342,7 @@ ble_svc_ans_unr_alert_add(uint8_t cat_id)
 uint8_t cat_bit_mask; 
 
 if (cat_id < BLE_SVC_ANS_CAT_NUM) {
-cat_bit_mask = pow(2, cat_id);
+cat_bit_mask = 1 << cat_id;
 } else {
 return BLE_HS_EINVAL;
 }

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


[GitHub] andrzej-kaczmarek closed pull request #903: service/ans: don't depent on libm for creating bitmask

2018-03-12 Thread GitBox
andrzej-kaczmarek closed pull request #903: service/ans: don't depent on libm 
for creating bitmask
URL: https://github.com/apache/mynewt-core/pull/903
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/net/nimble/host/services/ans/src/ble_svc_ans.c 
b/net/nimble/host/services/ans/src/ble_svc_ans.c
index 507d79574..ec58bd58c 100644
--- a/net/nimble/host/services/ans/src/ble_svc_ans.c
+++ b/net/nimble/host/services/ans/src/ble_svc_ans.c
@@ -19,12 +19,6 @@
 
 #include 
 #include 
-#include 
-
-/* Some ambiq SDK headers use `OVERFLOW` as an identifier.  This is a macro
- * that is leaked by some versions of math.h.
- */
-#undef OVERFLOW
 
 #include "sysinit/sysinit.h"
 #include "syscfg/syscfg.h"
@@ -32,7 +26,6 @@
 #include "host/ble_gap.h"
 #include "services/ans/ble_svc_ans.h"
 
-
 /* Max length of new alert info string */
 #define BLE_SVC_ANS_INFO_STR_MAX_LEN18
 /* Max length of a new alert notification, max string length + 2 bytes
@@ -349,7 +342,7 @@ ble_svc_ans_unr_alert_add(uint8_t cat_id)
 uint8_t cat_bit_mask; 
 
 if (cat_id < BLE_SVC_ANS_CAT_NUM) {
-cat_bit_mask = pow(2, cat_id);
+cat_bit_mask = 1 << cat_id;
 } else {
 return BLE_HS_EINVAL;
 }


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] andrzej-kaczmarek commented on a change in pull request #904: ble service: Battery Service

2018-03-12 Thread GitBox
andrzej-kaczmarek commented on a change in pull request #904: ble service: 
Battery Service
URL: https://github.com/apache/mynewt-core/pull/904#discussion_r173956969
 
 

 ##
 File path: net/nimble/host/services/bas/src/ble_svc_bas.c
 ##
 @@ -0,0 +1,148 @@
+/**
+ * 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.
+ */
+
+#include 
+#include 
+
+#include "sysinit/sysinit.h"
+#include "syscfg/syscfg.h"
+#include "host/ble_hs.h"
+#include "host/ble_gap.h"
+#include "services/bas/ble_svc_bas.h"
+
+/* Charachteristic value handles */
+#if MYNEWT_VAL(BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY) > 0
+static uint16_t ble_svc_bas_battery_handle;
+#endif
+
+/* Connection handle 
+ *
+ * TODO: In order to support multiple connections we would need to save
+ *   the handles for every connection, not just the most recent. Then
+ *   we would need to notify each connection when needed.
+ * */
+static uint16_t ble_svc_bas_conn_handle;
+
+/* Battery level */
+uint8_t ble_svc_bas_battery_level;
+
+/* Access function */
+static int
+ble_svc_bas_access(uint16_t conn_handle, uint16_t attr_handle,
+   struct ble_gatt_access_ctxt *ctxt, void *arg);
+
+static const struct ble_gatt_svc_def ble_svc_bas_defs[] = {
+{
+/*** Battery Service. */
+.type = BLE_GATT_SVC_TYPE_PRIMARY,
+.uuid = BLE_UUID16_DECLARE(BLE_SVC_BAS_UUID16),
+.characteristics = (struct ble_gatt_chr_def[]) { {
+   /*** Battery level characteristic */
+.uuid = BLE_UUID16_DECLARE(BLE_SVC_BAS_CHR_UUID16_BATTERY_LEVEL),
+.access_cb = ble_svc_bas_access,
+#if MYNEWT_VAL(BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY) > 0
+   .val_handle = &ble_svc_bas_battery_handle,
+#endif
+.flags = BLE_GATT_CHR_F_READ |
+MYNEWT_VAL(BLE_SVC_BAS_BATTERY_LEVEL_PERM) |
+MYNEWT_VAL(BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY),
+   }, {
+0, /* No more characteristics in this service. */
+} },
+},
+
+{
+0, /* No more services. */
+},
+};
+
+/**
+ * BAS access function
+ */
+static int
+ble_svc_bas_access(uint16_t conn_handle, uint16_t attr_handle,
+  struct ble_gatt_access_ctxt *ctxt,
+  void *arg)
+{
+uint16_t uuid16 = ble_uuid_u16(ctxt->chr->uuid);
+int rc;
+
+switch (uuid16) {
+case BLE_SVC_BAS_CHR_UUID16_BATTERY_LEVEL:
+assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
+rc = os_mbuf_append(ctxt->om, &ble_svc_bas_battery_level,
+sizeof ble_svc_bas_battery_level);
+return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+
+default:
+assert(0);
+return BLE_ATT_ERR_UNLIKELY;
+}
+}
+
+/**
+ * This function must be called with the connection handle when a gap 
+ * connect event is received in order to send notifications to the
+ * client.
+ *
+ * @params conn_handle  The connection handle for the current
+ *  connection.
+ */
+void 
+ble_svc_bas_on_gap_connect(uint16_t conn_handle) 
+{
+ble_svc_bas_conn_handle = conn_handle;
+}
+
+/**
+ * Set the battery level, must be between 0 and 100.
+ * If greater than 100, it will be silently set to 100.
+ */
+int
+ble_svc_bas_battery_level_set(uint8_t level) {
+if (level > 100)
+   level = 100;
+ble_svc_bas_battery_level = level;
+#if MYNEWT_VAL(BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY) > 0
+return ble_gattc_notify(ble_svc_bas_conn_handle, 
+ble_svc_bas_battery_handle);
 
 Review comment:
   we probably should not notify if value did not change, i.e. if 
ble_svc_bas_battery_level == level


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] andrzej-kaczmarek commented on a change in pull request #904: ble service: Battery Service

2018-03-12 Thread GitBox
andrzej-kaczmarek commented on a change in pull request #904: ble service: 
Battery Service
URL: https://github.com/apache/mynewt-core/pull/904#discussion_r173956385
 
 

 ##
 File path: net/nimble/host/services/bas/syscfg.yml
 ##
 @@ -0,0 +1,32 @@
+# 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.
+
+syscfg.defs:
+BLE_SVC_BAS_BATTERY_LEVEL_PERM:
+description: >
+Defines permissions for writing "Battery Level" characteristics. 
Can
+be zero to allow write without extra permissions or combination of:
+BLE_GATT_CHR_F_READ_ENC
+BLE_GATT_CHR_F_READ_AUTHEN
+BLE_GATT_CHR_F_READ_AUTHOR
+value: 0
+BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY:
+description: >
+Set to BLE_GATT_CHR_F_NOTIFY to support notification,
+or 0 to disable it.
+value: BLE_GATT_CHR_F_NOTIFY
 
 Review comment:
   this should be a simple 0/1 value - it's not a permissions mask, just simple 
bool to either enable or disable notify prop


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] andrzej-kaczmarek commented on a change in pull request #904: ble service: Battery Service

2018-03-12 Thread GitBox
andrzej-kaczmarek commented on a change in pull request #904: ble service: 
Battery Service
URL: https://github.com/apache/mynewt-core/pull/904#discussion_r173956237
 
 

 ##
 File path: net/nimble/host/services/bas/syscfg.yml
 ##
 @@ -0,0 +1,32 @@
+# 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.
+
+syscfg.defs:
+BLE_SVC_BAS_BATTERY_LEVEL_PERM:
+description: >
+Defines permissions for writing "Battery Level" characteristics. 
Can
+be zero to allow write without extra permissions or combination of:
 
 Review comment:
   +1 for READ_PERM


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] 01/01: Merge pull request #896 from andrzej-kaczmarek/log-api-fix

2018-03-12 Thread andk
This is an automated email from the ASF dual-hosted git repository.

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

commit 3c64f970f3e5b7d01ca622a97b17a1346fa23569
Merge: 0fc4943 5047d30
Author: Andrzej Kaczmarek 
AuthorDate: Mon Mar 12 23:01:19 2018 +0100

Merge pull request #896 from andrzej-kaczmarek/log-api-fix

sys/log: Remove undefined log_rtr_erasei()

 sys/log/full/include/log/log.h | 7 ---
 sys/log/full/src/log_cbmem.c   | 1 -
 sys/log/full/src/log_console.c | 1 -
 sys/log/full/src/log_fcb.c | 7 ---
 4 files changed, 4 insertions(+), 12 deletions(-)

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


[mynewt-core] branch master updated (0fc4943 -> 3c64f97)

2018-03-12 Thread andk
This is an automated email from the ASF dual-hosted git repository.

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


from 0fc4943  service/ans: don't depent on libm for creating bitmask (#903)
 add 5047d30  sys/log: Remove undefined log_rtr_erasei()
 new 3c64f97  Merge pull request #896 from andrzej-kaczmarek/log-api-fix

The 1 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:
 sys/log/full/include/log/log.h | 7 ---
 sys/log/full/src/log_cbmem.c   | 1 -
 sys/log/full/src/log_console.c | 1 -
 sys/log/full/src/log_fcb.c | 7 ---
 4 files changed, 4 insertions(+), 12 deletions(-)

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


[GitHub] andrzej-kaczmarek closed pull request #896: sys/log: Remove undefined log_rtr_erasei()

2018-03-12 Thread GitBox
andrzej-kaczmarek closed pull request #896: sys/log: Remove undefined 
log_rtr_erasei()
URL: https://github.com/apache/mynewt-core/pull/896
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sys/log/full/include/log/log.h b/sys/log/full/include/log/log.h
index a74f1937d..7bb5174e4 100644
--- a/sys/log/full/include/log/log.h
+++ b/sys/log/full/include/log/log.h
@@ -70,11 +70,6 @@ typedef int (*lh_append_func_t)(struct log *, void *buf, int 
len);
 typedef int (*lh_walk_func_t)(struct log *,
 log_walk_func_t walk_func, struct log_offset *log_offset);
 typedef int (*lh_flush_func_t)(struct log *);
-/*
- * This function pointer points to a function that restores the numebr
- * of entries that are specified while erasing
- */
-typedef int (*lh_rtr_erase_func_t)(struct log *, void *arg);
 
 #define LOG_TYPE_STREAM  (0)
 #define LOG_TYPE_MEMORY  (1)
@@ -86,7 +81,6 @@ struct log_handler {
 lh_append_func_t log_append;
 lh_walk_func_t log_walk;
 lh_flush_func_t log_flush;
-lh_rtr_erase_func_t log_rtr_erase;
 };
 
 struct log_entry_hdr {
@@ -221,7 +215,6 @@ int log_read(struct log *log, void *dptr, void *buf, 
uint16_t off,
 int log_walk(struct log *log, log_walk_func_t walk_func,
 struct log_offset *log_offset);
 int log_flush(struct log *log);
-int log_rtr_erase(struct log *log, void *arg);
 
 /* Handler exports */
 #if MYNEWT_VAL(LOG_CONSOLE)
diff --git a/sys/log/full/src/log_cbmem.c b/sys/log/full/src/log_cbmem.c
index c8f9d936d..982a4c94e 100644
--- a/sys/log/full/src/log_cbmem.c
+++ b/sys/log/full/src/log_cbmem.c
@@ -127,5 +127,4 @@ const struct log_handler log_cbmem_handler = {
 .log_append = log_cbmem_append,
 .log_walk = log_cbmem_walk,
 .log_flush = log_cbmem_flush,
-.log_rtr_erase = NULL,
 };
diff --git a/sys/log/full/src/log_console.c b/sys/log/full/src/log_console.c
index 7349d172c..409f4cdae 100644
--- a/sys/log/full/src/log_console.c
+++ b/sys/log/full/src/log_console.c
@@ -76,7 +76,6 @@ const struct log_handler log_console_handler = {
 .log_append = log_console_append,
 .log_walk = log_console_walk,
 .log_flush = log_console_flush,
-.log_rtr_erase = NULL,
 };
 
 #endif
diff --git a/sys/log/full/src/log_fcb.c b/sys/log/full/src/log_fcb.c
index ed1f502d6..91247b8bc 100644
--- a/sys/log/full/src/log_fcb.c
+++ b/sys/log/full/src/log_fcb.c
@@ -32,6 +32,8 @@
 
 static struct flash_area sector;
 
+static int log_fcb_rtr_erase(struct log *log, void *arg);
+
 static int
 log_fcb_append(struct log *log, void *buf, int len)
 {
@@ -53,8 +55,8 @@ log_fcb_append(struct log *log, void *buf, int len)
 goto err;
 }
 
-if (log->l_log->log_rtr_erase && fcb_log->fl_entries) {
-rc = log->l_log->log_rtr_erase(log, fcb_log);
+if (fcb_log->fl_entries) {
+rc = log_fcb_rtr_erase(log, fcb_log);
 if (rc) {
 goto err;
 }
@@ -278,7 +280,6 @@ const struct log_handler log_fcb_handler = {
 .log_append = log_fcb_append,
 .log_walk = log_fcb_walk,
 .log_flush = log_fcb_flush,
-.log_rtr_erase = log_fcb_rtr_erase,
 };
 
 #endif


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on issue #907: [WIP] nimble: Remove NimBLE code from core repository

2018-03-12 Thread GitBox
jacobrosenthal commented on issue #907: [WIP] nimble: Remove NimBLE code from 
core repository
URL: https://github.com/apache/mynewt-core/pull/907#issuecomment-372487547
 
 
   no problems here with a basic bleprph test on an nrf51 device.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on a change in pull request #904: ble service: Battery Service

2018-03-12 Thread GitBox
jacobrosenthal commented on a change in pull request #904: ble service: Battery 
Service
URL: https://github.com/apache/mynewt-core/pull/904#discussion_r173970897
 
 

 ##
 File path: net/nimble/host/services/bas/syscfg.yml
 ##
 @@ -0,0 +1,32 @@
+# 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.
+
+syscfg.defs:
+BLE_SVC_BAS_BATTERY_LEVEL_PERM:
+description: >
+Defines permissions for writing "Battery Level" characteristics. 
Can
+be zero to allow write without extra permissions or combination of:
+BLE_GATT_CHR_F_READ_ENC
+BLE_GATT_CHR_F_READ_AUTHEN
+BLE_GATT_CHR_F_READ_AUTHOR
+value: 0
+BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY:
+description: >
+Set to BLE_GATT_CHR_F_NOTIFY to support notification,
+or 0 to disable it.
+value: BLE_GATT_CHR_F_NOTIFY
 
 Review comment:
   or I suppose the spec allows to permission these? So you could make it a 
permissions mask?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] utzig opened a new pull request #910: Common hal for stm32f3

2018-03-12 Thread GitBox
utzig opened a new pull request #910: Common hal for stm32f3
URL: https://github.com/apache/mynewt-core/pull/910
 
 
   This makes stm32f3 part of common HAL, also fixes small issues with flash 
and flash areas on stm32f3discovery.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


  1   2   >