Commit graph

42249 commits

Author SHA1 Message Date
Erwan Gouriou
9e113fa98e stm32cube: Update build system to support stm32f7xx
Get stm32f7xx support ready in build system.
Provide minimal file inclusion to support stm32f7 based board
port.

Change-Id: Idf949ef4a627bbd82e7bf95a9ae1d3d073654115
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2016-11-11 19:04:34 +00:00
Erwan Gouriou
9eff2a32c2 stm32cube: Introduce STM32Cube for STM32F7xx series
With this commit we provide header and HAL/LL files for all STM32F7
SoCs.
Using STM32Cube provides generic access to all families, maximizes
code reuse across different STM32 families and helps taking benefit
of a mature SDK

Origin: STM32Cube
URL: http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef7.html
Purpose: Introduction of STM32F7xx STM32Cube definitions
and Abstraction Layers
Maintained-by: External

Original STM32Cube tree structure has been modified to a minimum
structure for a better fit into Zephyr. hal is split into 2 parts:
-driver: initially Drivers/STM32F7xx_HAL_Driver, contains HAL and LL
-soc: initially Drivers/CMSIS/Device/ST/STM32F7xx, contains stm32f7xx
socs header files

Change-Id: I7e5b2cdc5b7fe6d9d107ceb74674b910f4a6c0ab
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2016-11-11 19:04:34 +00:00
Vinayak Chettimada
4812b2d40e Bluetooth: Controller: Fix device whitelist feature
During the initial integration of controller to Zephyr OS,
radio hardware access was abstracted out into hal/radio.c
file. Bug introduced in hal/radio.c has been fixed so that
whitelist feature works again.

Change-id: Ie5faf80b1a008ef326613548a5a28a4ba52e7ef7
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-11-11 16:40:59 +00:00
Anas Nashif
92312026cf Merge "Merge bluetooth branch into master" 2016-11-11 16:39:53 +00:00
Fabien Parent
c4f12d7fe1 stm32cube: add build support for stm32l4xx
The STM32MICRO files for STM32L4xx were dropped in an earlier commit,
but we cannot make any use of them yet because the Kconfig options
and Makefile support is not there yet. This commit adds the ability
for code to use stm32cube from the stm32l4xx code.

Change-Id: I58e85e12e4b4648dc9a203f70703bd54675c3d28
Signed-off-by: Fabien Parent <fparent@baylibre.com>
2016-11-11 16:03:45 +00:00
Anas Nashif
d654c12f52 checkpatch: ignore file changes
Useless message at least for now that basically ends up
in every single gerrit change.

Change-Id: I56cea2b1b4e60d696c0ff9496d4464afca8c43ca
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 14:27:39 +00:00
Anas Nashif
0f3d5478a8 checkpatch: update with latest checkpatch from the linux kernel
Update with commit 577f12c07e4edd54730dc559a9c7bc44d22bf7dc from
the Linux kernel.

Change-Id: Ie2cabbfea415d26ffacef340d9497342b496dc29
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 14:27:39 +00:00
Inaky Perez-Gonzalez
302d23d1a6 testcases: catch more fatal kernel error messages
Turns out all some messages use lower case, some upper case (for
'fatal'). As well, catch 'Fatal task error!').

Change-Id: I98bb4b00cf2ccee2c87010f4d88cae5f8612ac84
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-11 13:21:16 +00:00
Luiz Augusto von Dentz
6b2443e99b console: Fix warnings related to the use of deprecated APIs
This fixes the warnings related to the use of deprecated APIs
converting them to use the unified version.

Change-Id: I76d076de27ecdae4af46abf4baac68e2cc1313c0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-11 14:50:58 +02:00
Johan Hedberg
f363cf5818 Merge bluetooth branch into master
Main changes:

 - Restructure Kconfig to a more logical hierarchy
 - Update code to use unified APIs
 - Initial RFCOMM client support
 - Add HCI_LE_Remove_Device_From_White_List command to controller

----------------------------------------------------------------
Carles Cufi (1):
      Bluetooth: Controller: Add ASSERT info dump on HCI builds

Jaganath Kanakkassery (2):
      Bluetooth: RFCOMM: Initiate session connection
      Bluetooth: shell: Add support for RFCOMM Connect

Johan Hedberg (26):
      Bluetooth: Controller: Kconfig: Clean up style issues
      Bluetooth: samples/hci_uart: Add micro:bit configuration
      Bluetooth: Dump the content of unhandled events as hex
      Bluetooth: Kconfig: Restructure for a more logical hierarchy
      Bluetooth: Kconfig: Remove redundant 'default n' declarations
      Bluetooth: Fine-tune default incoming ACL buffer count
      Bluetooth: samples/hci_uart: Remove dependency on controller
      Bluetooth: samples/hci_uart: Declare assert handler only when needed
      Bluetooth: samples/hci_uart: Remove redundant semicolon
      Bluetooth: Controller: Improve default RX/TX buffer counts
      Bluetooth: Use k_uptime_get() instead of deprecated sys_tick_get_32()
      Bluetooth: Use k_yield() instead of deprecated fiber_yield()
      Bluetooth: Use k_thread_spawn() instead of deprecated nano_fiber_start()
      Bluetooth: Use k_sleep() instead of deprecated fiber_sleep()
      Bluetooth: Remove need for fiber offload
      Bluetooth: drivers: Don't use deprecated NANOKERNEL init level
      Bluetooth: RFCOMM: Switch to using k_thread_spawn()
      Bluetooth: Controller: Stop using deprecated APIs
      Bluetooth: Rename left-over mentions of "fiber" to "thread"
      Bluetooth: hci_ecc: Convert to new thread API
      Bluetooth: samples/hci_ecc: Switch to using k_thread_spawn()
      Bluetooth: tests/tester: Convert left-overs to unified kernel APIs
      Bluetooth: drivers/h5: Convert to unified work APIs
      Bluetooth: drivers/nble: Convert to unified work APIs
      Bluetooth: doc: Remove mentions of legacy kernel concepts
      Bluetooth: Kconfig: Fix order of default entries

Luiz Augusto von Dentz (6):
      Bluetooth: ATT: Fix not forwarding error properly
      Bluetooth: L2CAP: Fix using nano_delayed_work API
      Bluetooth: ATT: Fix using nano_delayed_work API
      Bluetooth: SMP: Fix using nano_delayed_work API
      Bluetooth: conn: Fix using nano_delayed_work API
      Bluetooth: HCI: Fix using nano_delayed_work API

Szymon Janc (9):
      Bluetooth: ATT: Fix non-ASCII characters in code comments
      Bluetooth:  Use unified k_fifo API for FIFOs
      Bluetooth: drivers: Use unified k_fifo API for FIFOs
      Bluetooth: Remove not needed nano_work.h includes
      Bluetooth: samples: Fix using nano_delayed_work in eddystone
      net: buf: Use new API for checking if executing from ISR
      Bluetooth: samples: Fix use of deprecated sleep API
      net: buf: Use unified k_fifo API for FIFOs
      Bluetooth: Use proper timeout defines for net_buf_get_timeout

Vinayak Chettimada (1):
      Bluetooth: Controller: Add HCI_LE_Remove_Device_From_White_List

 doc/subsystems/bluetooth/devel.rst                |   9 +-
 drivers/bluetooth/Kconfig                         |   6 +-
 drivers/bluetooth/hci/Kconfig                     |  21 +--
 drivers/bluetooth/hci/h4.c                        |   2 +-
 drivers/bluetooth/hci/h5.c                        |  80 +++++----
 drivers/bluetooth/nble/Kconfig                    |  26 +--
 drivers/bluetooth/nble/conn.c                     |  16 +-
 drivers/bluetooth/nble/conn_internal.h            |   4 +-
 drivers/bluetooth/nble/gatt.c                     |  14 +-
 drivers/bluetooth/nble/uart.c                     |  23 +--
 drivers/bluetooth/nrf51_pm.c                      |  18 +--
 include/bluetooth/hci_raw.h                       |   2 +-
 include/bluetooth/l2cap.h                         |   3 +-
 include/bluetooth/rfcomm.h                        |  19 ++-
 include/net/buf.h                                 |  25 ++-
 net/buf.c                                         |  22 ++-
 net/ip/net_core.c                                 |   2 +-
 samples/bluetooth/beacon/prj.conf                 |   1 -
 samples/bluetooth/beacon/prj_nble.conf            |   2 +-
 samples/bluetooth/central/prj.conf                |   1 -
 samples/bluetooth/central_hr/prj.conf             |   1 -
 samples/bluetooth/central_hr/src/main.c           |   8 -
 samples/bluetooth/eddystone/prj.conf              |   1 -
 samples/bluetooth/eddystone/prj_nble.conf         |   2 +-
 samples/bluetooth/eddystone/src/main.c            |  15 +-
 samples/bluetooth/handsfree/src/main.c            |   6 +-
 samples/bluetooth/hci_uart/Makefile               |   7 +-
 samples/bluetooth/hci_uart/generic.conf           |   2 +-
 samples/bluetooth/hci_uart/microbit.conf          |  11 ++
 samples/bluetooth/hci_uart/nrf5.conf              |   5 +-
 samples/bluetooth/hci_uart/src/main.c             |  87 ++++++++--
 samples/bluetooth/hci_usb/prj.conf                |   2 +-
 samples/bluetooth/hci_usb/src/main.c              |  10 +-
 samples/bluetooth/peripheral/prj.conf             |   1 -
 samples/bluetooth/peripheral/prj_nble.conf        |   2 +-
 samples/bluetooth/peripheral/src/main.c           |   2 +-
 samples/bluetooth/peripheral_csc/prj_nble.conf    |   2 +-
 samples/bluetooth/peripheral_csc/src/main.c       |   2 +-
 samples/bluetooth/peripheral_dis/prj.conf         |   1 -
 samples/bluetooth/peripheral_esp/prj.conf         |   1 -
 samples/bluetooth/peripheral_esp/prj_nble.conf    |   2 +-
 samples/bluetooth/peripheral_esp/src/main.c       |   2 +-
 samples/bluetooth/peripheral_hids/prj.conf        |   1 -
 samples/bluetooth/peripheral_hids/prj_nble.conf   |   2 +-
 samples/bluetooth/peripheral_hr/prj.conf          |   1 -
 samples/bluetooth/peripheral_hr/prj_nble.conf     |   2 +-
 samples/bluetooth/peripheral_hr/src/main.c        |   2 +-
 samples/bluetooth/peripheral_sc_only/prj.conf     |   1 -
 samples/environmental_sensing/x86/prj_nble.conf   |   2 +-
 samples/environmental_sensing/x86/prj_nimble.conf |   1 -
 samples/net/echo_client/prj_bt.conf               |   1 -
 samples/net/echo_server/prj_bt.conf               |   1 -
 samples/net/trickle-legacy/prj_bt.conf            |   1 -
 samples/testing/unit/main.c                       |  20 +--
 subsys/bluetooth/Kconfig                          |  42 +++++
 subsys/bluetooth/Makefile                         |   2 +-
 subsys/bluetooth/controller/Kconfig               |  27 +++-
 subsys/bluetooth/controller/hal/debug.h           |  10 ++
 subsys/bluetooth/controller/hal/ecb.c             |   2 +-
 subsys/bluetooth/controller/hal/radio.c           |   2 +-
 subsys/bluetooth/controller/hal/rand.c            |   2 +-
 subsys/bluetooth/controller/hal/rtc.c             |   2 +-
 subsys/bluetooth/controller/hci/hci.c             |  25 ++-
 subsys/bluetooth/controller/hci/hci_driver.c      |  20 +--
 subsys/bluetooth/controller/ll/ctrl.c             | 276 +++++++++++++++++---------------
 subsys/bluetooth/controller/ll/ctrl.h             |   1 +
 subsys/bluetooth/controller/ll/ticker.c           |   2 +-
 subsys/bluetooth/host/Kconfig                     | 111 +++----------
 subsys/bluetooth/host/Makefile                    |   7 +-
 subsys/bluetooth/host/a2dp.c                      |   1 -
 subsys/bluetooth/host/att.c                       |  62 ++++---
 subsys/bluetooth/host/avdtp.c                     |   3 +-
 subsys/bluetooth/host/conn.c                      |  60 +++----
 subsys/bluetooth/host/conn_internal.h             |  14 +-
 subsys/bluetooth/host/gatt.c                      |   1 -
 subsys/bluetooth/host/hci_core.c                  | 130 +++++++++------
 subsys/bluetooth/host/hci_core.h                  |  12 +-
 subsys/bluetooth/host/hci_ecc.c                   |  39 ++---
 subsys/bluetooth/host/hci_raw.c                   |   8 +-
 subsys/bluetooth/host/hfp_hf.c                    |   3 +-
 subsys/bluetooth/host/keys.c                      |   1 -
 subsys/bluetooth/host/keys_br.c                   |   1 -
 subsys/bluetooth/host/l2cap.c                     |  27 ++--
 subsys/bluetooth/host/l2cap_br.c                  |  36 ++---
 subsys/bluetooth/host/l2cap_internal.h            |   2 +-
 subsys/bluetooth/host/monitor.c                   |   2 +-
 subsys/bluetooth/host/rfcomm.c                    | 138 ++++++++++++++--
 subsys/bluetooth/host/rfcomm_internal.h           |   1 +
 subsys/bluetooth/host/sdp.c                       |   6 +-
 subsys/bluetooth/host/smp.c                       |  29 ++--
 subsys/bluetooth/host/smp_null.c                  |   3 +-
 tests/bluetooth/init/prj.conf                     |   1 -
 tests/bluetooth/init/prj_0.conf                   |   1 -
 tests/bluetooth/init/prj_1.conf                   |   1 -
 tests/bluetooth/init/prj_10.conf                  |   1 -
 tests/bluetooth/init/prj_11.conf                  |   1 -
 tests/bluetooth/init/prj_12.conf                  |   1 -
 tests/bluetooth/init/prj_13.conf                  |   1 -
 tests/bluetooth/init/prj_14.conf                  |   1 -
 tests/bluetooth/init/prj_15.conf                  |   1 -
 tests/bluetooth/init/prj_16.conf                  |   1 -
 tests/bluetooth/init/prj_17.conf                  |   1 -
 tests/bluetooth/init/prj_18.conf                  |   1 -
 tests/bluetooth/init/prj_19.conf                  |   1 -
 tests/bluetooth/init/prj_2.conf                   |   1 -
 tests/bluetooth/init/prj_20.conf                  |   1 -
 tests/bluetooth/init/prj_21.conf                  |   1 -
 tests/bluetooth/init/prj_22.conf                  |   1 -
 tests/bluetooth/init/prj_3.conf                   |   1 -
 tests/bluetooth/init/prj_4.conf                   |   1 -
 tests/bluetooth/init/prj_5.conf                   |   1 -
 tests/bluetooth/init/prj_6.conf                   |   1 -
 tests/bluetooth/init/prj_7.conf                   |   1 -
 tests/bluetooth/init/prj_8.conf                   |   1 -
 tests/bluetooth/init/prj_9.conf                   |   1 -
 tests/bluetooth/init/prj_controller.conf          |   1 -
 tests/bluetooth/init/prj_controller_dbg.conf      |   1 -
 tests/bluetooth/init/prj_h5.conf                  |   1 -
 tests/bluetooth/init/prj_h5_dbg.conf              |   1 -
 tests/bluetooth/shell/arduino_101.conf            |   1 -
 tests/bluetooth/shell/prj.conf                    |   1 -
 tests/bluetooth/shell/prj_br.conf                 |   1 -
 tests/bluetooth/shell/prj_nble.conf               |   2 +-
 tests/bluetooth/shell/prj_nimble.conf             |   1 -
 tests/bluetooth/shell/src/main.c                  |  36 ++++-
 tests/bluetooth/test_bluetooth/prj.conf           |   1 -
 tests/bluetooth/tester/default.conf               |   1 -
 tests/bluetooth/tester/nble.conf                  |   2 +-
 tests/bluetooth/tester/nimble.conf                |   1 -
 tests/bluetooth/tester/qemu.conf                  |   1 -
 tests/bluetooth/tester/src/bttester.c             |  25 +--
 tests/bluetooth/tester/src/gatt.c                 |   4 +-
 tests/bluetooth/tester/src/l2cap.c                |   4 +-
 tests/net/buf/src/main.c                          |  12 +-
 tests/unit/net/buf/main.c                         |  20 +--
 135 files changed, 958 insertions(+), 796 deletions(-)
 create mode 100644 samples/bluetooth/hci_uart/microbit.conf

Change-Id: Ic510e34c6d5e8785f81f88697f5a6575c48fa9db
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 14:10:46 +02:00
Johan Hedberg
c245b96249 Bluetooth: Kconfig: Fix order of default entries
The conditional defaults must come last in order to be properly
processed.

Change-Id: Id7a152ca1a1584935029e212d0dd8f37494d1cf4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 12:09:46 +00:00
Vinayak Chettimada
5629197b17 Bluetooth: Controller: Add HCI_LE_Remove_Device_From_White_List
Add implementation in HCI and Controller to support
HCI_LE_Remove_Device_From_White_List, as it is listed as
mandatory under BT Spec. v4.2, Part E, Section 3.19 LE
Controller Requirements.

Change-id: Icef88dffc85746f3cc7adb7fb692ae5578274ed2
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-11-11 11:56:47 +00:00
Johan Hedberg
c73aee2cfe Bluetooth: doc: Remove mentions of legacy kernel concepts
Remove mentions of task & fiber from the description of using the
bt_enable() API.

Change-Id: Ia86a2396e5ce286cc7f9a1c183b4c98abf09d394
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 11:24:35 +02:00
Johan Hedberg
effbe6743d Bluetooth: drivers/nble: Convert to unified work APIs
Start using the k_work and k_delayed_work APIs.

Change-Id: Iac0525a444c5c4e0f28db08844d7b28e17e905fc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 11:13:47 +02:00
Johan Hedberg
776b3e6871 Bluetooth: drivers/h5: Convert to unified work APIs
Switch to using k_work and k_delayed_work APIs.

Change-Id: I3be18132cc417607adaec0ad711256b94e314c38
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 11:10:00 +02:00
Johan Hedberg
63a8f3b824 Bluetooth: tests/tester: Convert left-overs to unified kernel APIs
Convert fiber_start to k_thread_spawn and nano_fiber_fifo_put to
k_fifo_put.

Change-Id: If1ec405ec602e28a538f4c9569ede87519346559
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 11:00:45 +02:00
Johan Hedberg
35376eed13 Bluetooth: samples/hci_ecc: Switch to using k_thread_spawn()
Switch from fiber_start() to k_thread_spawn(). Also switch to
k_yield() from fiber_yield() in the same go.

Change-Id: I2dc480310f981112063651b61b0ceedf38601bee
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 10:57:23 +02:00
Johan Hedberg
a14680f7c0 Bluetooth: hci_ecc: Convert to new thread API
Convert from a private task to the thread API, also add stack usage
analysis and tune-down the stack size to avoid wasting memory:

On x86:
ecc stack (real size 1280):	unused 80	usage 1136 / 1216 (93 %)

On arm:
ecc stack (real size 1280):	unused 52	usage 1128 / 1180 (95 %)

Change-Id: Iba84a5a9cb5257c1456663adf4952c5c18650f97
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 10:52:02 +02:00
Johan Hedberg
81975637dc Bluetooth: Rename left-over mentions of "fiber" to "thread"
Rename left-over mentions in code comments of "fiber" to "thread".

Change-Id: I1af1baf99652434e90eb491c10238b94d26d341d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 10:06:05 +02:00
Johan Hedberg
916ed6cdd2 Bluetooth: Controller: Stop using deprecated APIs
Switch from fiber_start() to k_thread_spawn() and from NANOKERNEL to
POST_KERNEL init level.

Change-Id: I34fb11cbe20216c8646ebacb07be304a67e3cd0a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 10:04:02 +02:00
Johan Hedberg
8b92cb2d78 Bluetooth: RFCOMM: Switch to using k_thread_spawn()
Use k_thread_spawn() instead of the deprecated fiber_start() API.

Change-Id: I42e798ef3a4276863659c8d97c85224a652be1fd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:55:27 +02:00
Johan Hedberg
5f5425f20a Bluetooth: drivers: Don't use deprecated NANOKERNEL init level
Don't use the deprecated NANOKERNEL init level. The only requirement
for Bluetooth drivers is for them to be registered before the
application main() runs, so POST_KERNEL should be good enough.

Change-Id: I02a8609bf63e9d608b802576214a2e76211b3965
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:50:47 +02:00
Johan Hedberg
500010d369 Bluetooth: Remove need for fiber offload
The bt_recv() function had protections for being called from a
preemptible task context, however nothing was protecting preemption by
ISR. A fairly simple fix is to protect the couple of critical regions
that can be reached from bt_recv() with the help of irq_lock().

Change-Id: Ifc29fd31205eb5425e1b7c862347d9420688df4e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:38:40 +02:00
Johan Hedberg
c78bfd9a98 Bluetooth: Use k_sleep() instead of deprecated fiber_sleep()
Use the unified kernel API k_sleep() instead of the deprecated
fiber_sleep().

Change-Id: I587d72ca5b53aacc02647b32c3ebceb1d7fe067e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:38:40 +02:00
Johan Hedberg
918a8e6bac Bluetooth: Use k_thread_spawn() instead of deprecated nano_fiber_start()
Switch to using the unified kernel k_thread_spawn() API instead of
nano_fiber_start().

Change-Id: I325cf467ae2a52c6aec8fc166397c323929e3013
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:38:40 +02:00
Johan Hedberg
b0f0742b6e Bluetooth: Use k_yield() instead of deprecated fiber_yield()
Use the unified kernel API k_yield() instead of fiber_yield().

Change-Id: I8f52031f52f7ac8783033a51751dc22decdfa59a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:38:40 +02:00
Johan Hedberg
80e04e4fd1 Bluetooth: Use k_uptime_get() instead of deprecated sys_tick_get_32()
Switch to using k_uptime_get() instead of the deprecated
sys_tick_get_32() API.

Change-Id: I737ef0153eff9d283bae840ff5177f8132396e1b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:38:24 +00:00
Szymon Janc
2b16287286 Bluetooth: Use proper timeout defines for net_buf_get_timeout
Use defines from k_fifo intead of legacy API.

Change-Id: Ib8cf0d88240ef145da550b8cf83d2580e7140521
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 06:00:28 +00:00
Szymon Janc
2f45faba8c net: buf: Use unified k_fifo API for FIFOs
Only net_receive() is using non-special value for net_buf_get_timeout
so this change is included here. Other users are using special values
which are already correctly handling ticks vs ms change.

Change-Id: Ib12d34ac5a546b36fa7b35615f082c82a256bd07
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 06:00:17 +00:00
Szymon Janc
051f97bd7a Bluetooth: samples: Fix use of deprecated sleep API
Use new sleep API or remove sleeps where not needed.

Change-Id: I88c0973e57eb4970b68b3f4fa428683191b1a7f0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Szymon Janc
0a38788c92 net: buf: Use new API for checking if executing from ISR
CC      net/buf.o
zephyr/net/buf.c: In function 'net_buf_get':
zephyr/net/buf.c:103:2: warning: 'sys_execution_context_type_get' is
     deprecated [-Wdeprecated-declarations]
  if (buf || sys_execution_context_type_get() == NANO_CTX_ISR) {
  ^

Change-Id: I580469d4958451cfa05f56c579eae340ec003a3d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Szymon Janc
619d7bafd9 Bluetooth: samples: Fix using nano_delayed_work in eddystone
This fixes warnings related to the use of nano_delayed_work.

Change-Id: Ie20fb47fc6d5c486ff885ad583354eb715d12c1b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Szymon Janc
577fe910ae Bluetooth: Remove not needed nano_work.h includes
Those are lefovers from nano_delayed_work usage.

Change-Id: I3f17c7b89b1fa946495e160732457500e2f74f25
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Szymon Janc
e2795499d8 Bluetooth: drivers: Use unified k_fifo API for FIFOs
Change-Id: Id2ef6f9a134e6471c59bf3baedccef219d7f12f6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Luiz Augusto von Dentz
203897d04e Bluetooth: HCI: Fix using nano_delayed_work API
This fixes warnings related to the use of nano_work and
nano_delayed_work in HCI layer.

Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeout values have been changed.

Change-Id: I953a82a6aa613bb1072a8ad4b01e0f94e5cd64bd
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-11 07:59:15 +02:00
Luiz Augusto von Dentz
5aef8dd1ad Bluetooth: conn: Fix using nano_delayed_work API
This fixes warnings related to the use of nano_work and
nano_delayed_work in bt_conn layer.

Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeout values have been changed.

Change-Id: Ia8f34b475051515fd74000cce745ad226aa18aa5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-11 07:59:15 +02:00
Luiz Augusto von Dentz
b96efa9efd Bluetooth: SMP: Fix using nano_delayed_work API
This fixes warnings related to the use of nano_work and
nano_delayed_work in SMP layer.

Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeout values have been changed.

Change-Id: Ida58ff0f609dc2a8fd415692bc2cec91eb56a294
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-11 07:59:15 +02:00
Luiz Augusto von Dentz
ec57d7cdb2 Bluetooth: ATT: Fix using nano_delayed_work API
This fixes warnings related to the use of nano_work and
nano_delayed_work in ATT layer.

Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeouts values changes.

Change-Id: I14d8438c1537febcb7768ef2934042ce38682739
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-11 07:59:15 +02:00
Luiz Augusto von Dentz
b3cece0af1 Bluetooth: L2CAP: Fix using nano_delayed_work API
This fixes warnings related to the use of nano_work and
nano_delayed_work in L2CAP layer.

Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeouts values changes.

Change-Id: I1e3bd7857248865e34a313dd42862af5f4e3805b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-11 07:59:15 +02:00
Szymon Janc
47eaaf9f96 Bluetooth: Use unified k_fifo API for FIFOs
Change-Id: I6ddc24575e4bf3c3040945a2bdb62f153b15cdb3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg
3062516a1a Bluetooth: Controller: Improve default RX/TX buffer counts
Currently the ideal buffer counts for a controller-only build are 6 RX
buffers and 7 TX buffers: ATT_MTU of 158 bytes can be sent in one
connection interval of 6 tx/rx -es wherein connection interval is
7.5ms

Change-Id: I64b4620c5e8e7db8d7ed72fa1db82e266e121f27
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Szymon Janc
27cbd586cb Bluetooth: ATT: Fix non-ASCII characters in code comments
Change-Id: Ief28ffbab1f1751344184b35e40f32e1fc1d6ac9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Jaganath Kanakkassery
f2b1ffbedb Bluetooth: shell: Add support for RFCOMM Connect
This can be used to initiate an outgoing connection
Syntax:
>br-rfcomm-connect <channel>

Change-Id: I7ac7aeb61e7ae7e3f55c7cd7e815bdb604b27fb3
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg
a3c057a5e9 Bluetooth: samples/hci_uart: Remove redundant semicolon
Remove redundant semicolon from the end of a while loop.

Change-Id: I02cef7879efe0d6eeae59595e14fb1d9b00a6d52
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg
a8506f7814 Bluetooth: samples/hci_uart: Declare assert handler only when needed
If support for the controller assert handler isn't enabled the
function shouldn't exist.

Change-Id: I72076eb1001980f102a0404c91d22e41582ced25
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg
a69996210f Bluetooth: samples/hci_uart: Remove dependency on controller
Don't use a controller define if controller support is not enabled.

Change-Id: I837b3b66f010dfbdf2d9099acd85fa29fce954b7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Jaganath Kanakkassery
00457636f8 Bluetooth: RFCOMM: Initiate session connection
This patch introduces the Connect API which initiates session
connection first. If session is already there with the peer
then it has to reuse it and initiate DLC (which will be done
in the subsequent patch) since there can be only one session
per device.

< ACL Data TX: Handle 256 flags 0x00 dlen 8
      Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
      RFCOMM: Set Async Balance Mode (SABM) (0x2f)
         Address: 0x03 cr 1 dlci 0x00
         Control: 0x3f poll/final 1
         Length: 0
         FCS: 0x1c

> ACL Data RX: Handle 256 flags 0x02 dlen 8
      Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Ack (UA) (0x63)
         Address: 0x03 cr 1 dlci 0x00
         Control: 0x73 poll/final 1
         Length: 0
         FCS: 0xd7

Change-Id: I9828e0f3b3ea43bb17df95f0536e15df86f1b4be
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg
e4c5c96a16 Bluetooth: Fine-tune default incoming ACL buffer count
In some SMP + GATT scenarios it's possible we get up to 6 incoming ACL
packets. To handle these efficiently, and more importantly, to not
have to drop data if the controller lacks host flow control (as is the
case currently with Zephyr-based controllers), increase the default
from 5 to 6.

For a controller-build it makes sense to just match up with the
controller-side configured RX buffers.

Change-Id: Id44fa724597b88a51f9085dac009e8d84a439bfc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg
b64e0d4c51 Bluetooth: Kconfig: Remove redundant 'default n' declarations
All boolean options default to 'n' without the need to explicitly
state this. It's only the cases where we want 'default y' where we
need to state this.

Change-Id: I47dbda62462ea437a2423b8508ea2cc640a22e41
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg
c583a9f43b Bluetooth: Kconfig: Restructure for a more logical hierarchy
Restructure the Bluetooth options more logically.

- Both host and controller are now behind the same high level
  CONFIG_BLUETOOTH.

- Selecting controller support disables other HCI driver selection, so
  the controller isn't in the same list as HCI drivers any more.

- Under the top-level there's a "Custom stack" option, which when
  enabled opens up the option of choosing CONFIG_NBLE.

There are various other cleanups and simplifications in this patch as
well, since splitting these up would have been fairly tricky while
making sure all test cases still build.

Change-Id: I5bb715cb9d20201cb8b72fbd149c8a09a4b2d7d2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00